/** * Private startup channel for the isolated interactive engine. * * The engine child needs four control values (engine role, host PID, guardian * path, and optionally an API key) before its runtime exists. They used to * travel as environment variables, which cannot be taken back: under Bun a * child spawned without an explicit `env` inherits the runtime's launch-time * environment map, so deleting the variables from `process.env` afterwards does * not stop arbitrary extension or hook code from leaking them — including the * API key — into its own subprocesses. * * The engine is therefore launched with an environment that never contained the * values, and the values travel in a 0600 file whose path is passed as a private * CLI argument. The child reads it once, freezes the snapshot, and unlinks it. * The filename carries no secret material. * * Cleanup is ownership-scoped. The path is untrusted child input — anyone can * pass the private flag — so a reader may unlink only that exact file. Only the * writer, which holds an {@link InteractiveEngineBootstrapHandle} for the * directory it created, may remove that directory recursively. */ export declare const INTERACTIVE_ENGINE_BOOTSTRAP_FLAG = "--internal-engine-bootstrap"; export declare const INTERACTIVE_ENGINE_BOOTSTRAP_VERSION = 1; export interface InteractiveEngineBootstrap { version: number; hostPid: number; guardFile: string; apiKey?: string; } /** * Proof that this process created a bootstrap record. A bare path — in * particular one taken from argv — is never sufficient for recursive removal. */ export interface InteractiveEngineBootstrapHandle { readonly path: string; readonly directory: string; } /** * Publish a bootstrap record atomically so a reader never sees a partial file. * * On any failure the exact temporary file and the directory this call created * are removed before the original error propagates, so a `0600` file holding a * credential is never left behind. */ export declare function writeInteractiveEngineBootstrap(record: Omit): InteractiveEngineBootstrapHandle; /** Remove a bootstrap record and the directory whose creation this handle proves. */ export declare function removeOwnedInteractiveEngineBootstrap(handle: InteractiveEngineBootstrapHandle | undefined): void; /** * Split the private bootstrap argument out of an argv slice. * * Returns the remaining arguments so normal CLI parsing never sees the flag. */ export declare function takeInteractiveEngineBootstrapArg(args: readonly string[]): { args: string[]; path: string | undefined; }; /** True when this argv belongs to an isolated interactive engine child. */ export declare function hasInteractiveEngineBootstrapArg(args: readonly string[]): boolean; /** * Read and consume a bootstrap record. * * The named file is always unlinked, including on malformed content, so a stale * API key never outlives the handshake. The path came from argv, so nothing * around it is touched: no parent directory, no sibling. */ export declare function readInteractiveEngineBootstrap(path: string): InteractiveEngineBootstrap | undefined; //# sourceMappingURL=interactive-engine-bootstrap.d.ts.map