← Về thư mục
openai4s_compute_provider/_resident.py
- scrub_secret_env · function · L52-L81 — def scrub_secret_env(extra_prefixes: tuple[str, ...] = ()) -> None
- ByocResident · class · L84-L993 — class ByocResident
- init · method · L85-L91 — def init(self, provider: ByocProvider, *, idle_timeout_s: int = IDLE_TIMEOUT_S)
- run_repl · method · L95-L113 — def run_repl(self) -> NoReturn
- run_oneshot · method · L115-L161 — def run_oneshot(self, argv: list[str]) -> NoReturn
- _prologue · method · L165-L182 — def _prologue(self) -> None
- _probe_confined · method · L184-L251 — def _probe_confined(self) -> bool
- _handshake · method · L253-L257 — def _handshake(self) -> None
- _arm_idle · method · L261-L267 — def _arm_idle(self) -> None
- _on_idle · method · L269-L271 — def _on_idle(self) -> NoReturn
- _on_auth_expired · method · L273-L275 — def _on_auth_expired(self) -> NoReturn
- _serve_repl · method · L277-L315 — def _serve_repl(self) -> NoReturn: # The compute-provider kernel reuses the worker's stdin/stdout JSON # cell loop verbatim — this entrypoint only owns prologue + handshake # + idle timer. Import and hand off so the cell protocol stays # single-sourced. The worker sits at /kernel/worker.py relative # to /openai4s_compute_provider/.
- readline_with_idle · function · L293-L311 — def readline_with_idle() -> str: # Idle window is between cells (waiting for input), not during # one — so a 30-min image build doesn't trip the 15-min timer. # Lazy lookup: the worker publishes its private dup as # sys._openai4s_protocol_stdin inside main(), after we exec it. # Never fall back to a captured sys.stdin reader: a second reader # over fd 0 can consume the host's next request.
- _op_create · method · L332-L370 — def _op_create(self, req: dict[str, Any]) -> dict[str, Any]
- _best_effort_terminate · method · L372-L391 — def _best_effort_terminate(self, sid: str, stage: str | None = None) -> bool
- _drain_wait · method · L394-L398 — def _drain_wait(r) -> int: # A process handle's wait() blocks until captured stdout is drained.
- _op_submit · method · L400-L551 — def _op_submit(self, req: dict[str, Any]) -> dict[str, Any]
- _disarm_keepalive · function · L448-L459 — def _disarm_keepalive() -> None: # Staging or launch failed after the untar wrote run.sh: /work now # has run.sh present and .phase absent — exactly the PID-1 idle # watchdog's "job running" keepalive predicate, which would disarm # the idle self-exit FOREVER on a sandbox no host path will # terminate. Best-effort remove run.sh so the watchdog regains # authority.
- _probe_one · method · L553-L710 — def _probe_one( self, sid: str, *, poll_s: int, flags: bool = True ) -> dict[str, Any]
- _op_wait · method · L712-L781 — def _op_wait(self, req: dict[str, Any]) -> dict[str, Any]
- _op_probe_many · method · L783-L817 — def _op_probe_many(self, req: dict[str, Any]) -> dict[str, Any]
- _op_reconcile · method · L819-L820 — def _op_reconcile(self, req: dict[str, Any]) -> dict[str, Any]
- _op_list_dir · method · L822-L835 — def _op_list_dir(self, req: dict[str, Any]) -> dict[str, Any]
- _op_list_volumes · method · L837-L844 — def _op_list_volumes(self, req: dict[str, Any]) -> dict[str, Any]
- _op_read_file · method · L846-L877 — def _op_read_file(self, req: dict[str, Any]) -> dict[str, Any]
- _op_tail · method · L879-L929 — def _op_tail(self, req: dict[str, Any]) -> dict[str, Any]
- emit · function · L898-L901 — def emit(tag: str, line: str) -> None
- follow · function · L903-L915 — def follow(tag: str, log_path: str) -> None
- _op_terminate · method · L931-L936 — def _op_terminate(self, req: dict[str, Any]) -> dict[str, Any]
- _stage · method · L939-L954 — def _stage(req: dict[str, Any]) -> str: # Host-supplied via stage/req.json and the sandbox confines writes # anyway, but reject anything outside the expected mkdtemp prefix so a # protocol bug can't be levered into an arbitrary-path open. realpath # both sides — on macOS /tmp is a symlink to /private/tmp.
- _owner_msg · method · L957-L962 — def _owner_msg(sid: str) -> str
- _tails · method · L964-L985 — def _tails(self, sid: str) -> dict[str, str]
- _redact · method · L987-L993 — def _redact(self, s: str) -> str