← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / openai4s_compute_provider / README.md

BYOC worker runtime

中文说明

The package name is a leftover. What lives here is a stdlib-only worker runtime, not a concrete compute provider. A provider is a shim at skills/remote-compute-<id>/provider.py that implements the protocol defined here, and it is the only layer expected to import a third-party provider SDK. Everything those shims share sits in this package: authentication, secret-environment scrubbing, ownership checks, lifecycle operations, staging, output caps, and error normalization.

Where this fits

ComputeManager launches __main__.py in isolated Python mode for BYOC operations. The oneshot path is the one in use today: request and reply cross a private staging directory as files, and the credential arrives on stdin, never in the child environment. The runtime loads one provider shim, verifies ownership before it operates on an existing sandbox, and leaves the actual sandbox create/exec/list/terminate behavior to that provider.

There is also a long-lived REPL mode, with an fd-3 control/auth channel and the common Python Cell protocol. The support surface exists; do not read it as proof that every host path or the UI wires a persistent provider kernel end to end.

Files

File Responsibility
__init__.py The public surface. Documents the package contract and exports the provider protocols, the resident, the channel helpers, limits, error kinds, paths, and the secret-scrub function.
__main__.py The one entry point every provider goes through. Runs the baseline environment scrub before it imports provider.py, loads PROVIDER by exact file path, then starts oneshot or REPL mode. It also loads this package by file location rather than by putting its parent on sys.path: a package import lists the directory it searches, so the old form required the parent — the repository root, in a source or editable install — to be readable from inside the confinement, handing an untracked .env and .git to a process that by design has the network.
_channel.py Transport plumbing that knows nothing about providers or ops: capped newline-framed fd-3 ready/event/auth messages, the authentication handshake read from stdin or fd-3, byte formatting, and a courtesy stdout/stderr token scrubber.
_constants.py One place for the values the resident, the channel, and every shim have to agree on: stream and harvest caps, the idle timeout, stage and work paths, protocol exit codes, fd and line limits, recognized credential-name patterns, provider-secret prefixes, and the normalized error kinds.
_protocol.py The ByocProvider and running-ExecResult structural contracts plus the typed ByocError. A provider with no browsable persistent store simply omits the optional browsing methods.
_resident.py The confined process that hosts the provider: the hardened prologue, then the oneshot or REPL lifecycle. It handles create, submit, wait/harvest, batch probe, reconcile, tail, browse/read, and terminate, with owner-tag checks, bounded transfers, redaction, deadlines, and structured replies.

Lifecycle and trust boundaries