← Về thư mục
openai4s/kernel/worker.py
- _remote_credential_path · function · L137-L153 — def _remote_credential_path() -> str
- _connect_remote_protocol · function · L156-L225 — def _connect_remote_protocol()
- _setup_protocol_channels · function · L228-L278 — def _setup_protocol_channels() -> None
- _fd_ident · function · L281-L283 — def _fd_ident(fd: int) -> tuple[int, int]
- _proto_out · function · L286-L287 — def _proto_out()
- _proto_in · function · L290-L291 — def _proto_in()
- _write_lock · function · L294-L295 — def _write_lock() -> threading.Lock
- _host_call_lock · function · L298-L299 — def _host_call_lock() -> threading.Lock
- _recover_protocol_in · function · L305-L344 — def _recover_protocol_in() -> None
- _readline_protocol · function · L347-L371 — def _readline_protocol() -> str
- _write_frame · function · L374-L427 — def _write_frame(obj: dict) -> None
- _cpu_seconds · function · L433-L436 — def _cpu_seconds() -> float
- _reset_peak_rss · function · L439-L444 — def _reset_peak_rss() -> None
- _peak_rss_kb · function · L447-L457 — def _peak_rss_kb() -> int
- _begin_file_read_observation · function · L477-L480 — def _begin_file_read_observation(tag: str) -> None
- _finish_file_read_observation · function · L483-L490 — def _finish_file_read_observation() -> list[str]
- _attach_cell_context · function · L493-L520 — def _attach_cell_context(method: str, args: list) -> list
- host_call · function · L523-L577 — def host_call(method: str, args: list) -> object
- _publish_skill_sidecar_event · function · L589-L651 — def _publish_skill_sidecar_event( event: object, _emit=_write_frame, _cell_state=_ACTIVE_CELL_ID, _frame_count=_SKILL_LOAD_PROTOCOL_FRAMES, ) -> None
- _complete_skill_sidecar_attestations · function · L654-L657 — def _complete_skill_sidecar_attestations(_audit=sys.audit) -> None
- _sigint_swallow · function · L680-L682 — def _sigint_swallow(signum, frame): # noqa: ANN001, ARG001
- _disarm_sigint · function · L685-L689 — def _disarm_sigint() -> None
- _sigint_handler · function · L692-L702 — def _sigint_handler(signum, frame): # noqa: ANN001, ARG001
- _arm_sigint · function · L705-L735 — def _arm_sigint() -> bool
- _raise_if_sigint_pending · function · L738-L750 — def _raise_if_sigint_pending() -> None
- _register_cell · function · L753-L760 — def _register_cell(code: str, tag: str) -> None
- _error_lineno · function · L763-L770 — def _error_lineno(tb, tag: str) -> tuple[int | None, str | None]
- _drain_skill_sidecar_loads · function · L773-L799 — def _drain_skill_sidecar_loads() -> list[dict]
- _install_host · function · L802-L856 — def _install_host(ns: dict, *, mode: str) -> None
- _HostUnavailable · class · L841-L846 — class _HostUnavailable
- getattr · method · L842-L843 — def getattr(self, name)
- call · method · L845-L846 — def call(self, a, *k)
- _BoundedBuffer · class · L859-L915 — class _BoundedBuffer(io.StringIO)
- init · method · L874-L881 — def init(self) -> None
- full · method · L884-L891 — def full(self) -> bool
- write · method · L893-L909 — def write(self, s: str) -> int: # type: ignore[override]
- captured · method · L911-L915 — def captured(self) -> str
- _StreamingStdout · class · L918-L959 — class _StreamingStdout(_BoundedBuffer)
- init · method · L932-L936 — def init(self, cell_id: str) -> None
- _emit · method · L938-L939 — def _emit(self, text: str) -> None
- write · method · L941-L959 — def write(self, s: str) -> int: # type: ignore[override]
- _cap · function · L962-L980 — def _cap(s: str) -> str
- _bounded_format_exc · function · L983-L1017 — def _bounded_format_exc(exc: BaseException) -> str
- _run_cell · function · L1020-L1204 — def _run_cell( code: str, cell_id: str, origin: str = "agent", *, kernel_mode: str | None = None, ) -> dict
- _safe_type_name · function · L1222-L1230 — def _safe_type_name(value: object) -> str
- _bounded_bytes · function · L1233-L1241 — def _bounded_bytes(value: bytes) -> bytes
- _primitive_token · function · L1244-L1281 — def _primitive_token(value: object) -> bytes | None
- _primitive_preview · function · L1284-L1302 — def _primitive_preview(value: object) -> object
- _container_sample · function · L1305-L1345 — def _container_sample(value: object) -> tuple[list[object], int]
- _safe_container_summary · function · L1348-L1396 — def _safe_container_summary(value: object) -> tuple[str, int, str, str] | None
- _inspect_one · function · L1399-L1429 — def _inspect_one(name: str, value: object) -> dict
- _inspect_namespace · function · L1432-L1447 — def _inspect_namespace(limit: int) -> dict
- _workspace_relative_read_path · function · L1450-L1488 — def _workspace_relative_read_path( raw_path: str, *, root: str, cwd: str, isabs, normpath, relpath, separator: str, ) -> str | None
- _install_file_read_audit_hook · function · L1491-L1605 — def _install_file_read_audit_hook() -> None
- _observe_file_read · function · L1519-L1603 — def _observe_file_read( event, args, *, _state=read_state, _root=root, _relative_path=_workspace_relative_read_path, _isabs=path_isabs, _normpath=path_normpath, _relpath=path_relpath, _separator=path_separator, _getcwd=getcwd, _fsdecode=fsdecode, _getframe=sys._getframe, _o_accmode=getattr(os, "O_ACCMODE", os.O_WRONLY | os.O_RDWR), _o_wronly=os.O_WRONLY, _max_files=max_files, _max_chars=max_chars, ): # noqa: ANN001 - CPython owns the audit-hook signature
- _install_audit_hook · function · L1608-L1640 — def _install_audit_hook(event_key: bytes) -> bool
- skill_event_origin · function · L1622-L1623 — def skill_event_origin() -> str
- _initialize_manager_attestation · function · L1643-L1684 — def _initialize_manager_attestation() -> bool
- main · function · L1687-L1778 — def main() -> None: # First statement, before any handshake: an idle worker must survive a # signal. Until the first cell armed one, SIGINT kept Python's default # disposition, so a stop delivered before or between cells raised # KeyboardInterrupt straight out of this loop and killed the worker -- # taking the namespace with it, which is the one thing the interrupt # contract promises not to do. Placing it ahead of the attestation makes # "the manager has a live worker" imply "that worker is signal-safe".