/** * tool-command-worker-entry — the WORKER side of the out-of-process external * tool command dispatch plane (ADR-0054, increments M4-C / M4-D / M4-E). * * This is a HOST internal `CommandSpec` (`__tool-command-worker`), forked by the * supervisor as `node __tool-command-worker --cwd `. * Forking the CLI binary as a subcommand (the SAME pattern graph's * `graph-run-worker` uses) means the FULL CLI bootstrap runs first: the preAction * hook discovers + imports the external tool runtime IN THE WORKER, registers it, * runs its `contributeScope`, composes + validates config, and builds the full * per-run scope — so by the time this handler runs, `currentScope()` carries the * tool's subscope (`scope.fitness`/…), the check/recipe registries, project * context, and `toolConfig` exactly as an in-process run (ADR-0054 M4-C `scope` * mapping: "the worker re-bootstraps its OWN scope … exactly like graph's * worker"). This is the isolation move — the untrusted runtime loads HERE, in the * worker, never in the host. * * The handler then resolves the dispatched tool from the re-bootstrapped registry * and runs ITS command handler against the WORKER-side `ToolCliContext` shim * (`tool-command-worker-context.ts`): FRR seams (render/json/envelope/raw/error/ * exit) record the value and return it once in the {@link ToolCommandResult}; the * host-RPC seams (egress / SARIF / baselines / toolState / hostPlanes / * report-open / exit-code re-affirm) UPCALL the host over the rpc-reply channel * (the host performs the privileged effect — network/FS/exit stay host-owned). * The ambient RunScope datastore thunk is DENIED in workers (ADR-0145 / * `host-rpc-only`): `cli.scope.datastore()` and `currentScope().datastore()` fail * loud with PLUGIN.WORKER.DATASTORE_DIRECT_ACCESS. Only the live-view seams fail * loud as `unsupported-seam`. * * A handler that calls `process.exit`, throws, crashes the native layer, or spins * the event loop is contained: the supervisor turns a premature child exit / * timeout / `error` message into a structured parent-side failure, and the host * process survives. */ import { type CommandSpec } from '@opensip-cli/core'; import { type CliCommandsContext } from '../commands/shared.js'; import { type DispatchWorkerMessage } from './tool-command-worker-ipc.js'; /** * The testable core: produce the {@link DispatchWorkerMessage} the worker would * post, without touching `process.send`. Never throws — every failure becomes a * structured `error` message (the supervisor rejects on it). Must run inside an * entered scope (the bootstrap enters it for the real subcommand; unit tests wrap * it in `runWithScope`). */ export declare function runToolCommandWorker(specPath: string): Promise; /** * Run one external tool command headless in this worker and post the slim * {@link ToolCommandResult} (or a structured `error`) over IPC. Never throws to * the caller — every failure becomes an `error` IPC message so the supervisor * rejects cleanly. This is the host CommandSpec handler's body. */ export declare function executeToolCommandWorker(specPath: string): Promise; /** * `__tool-command-worker ` — the [internal] host subcommand the * dispatch supervisor forks. Mirrors `graphRunWorkerCommandSpec`: `raw-stream` * (it owns its own IPC output surface), `scope: 'project'` (the full bootstrap * runs first), `visibility: 'internal'`. The supervisor passes `--cwd` so the * bootstrap targets the right project. The handler ignores the host `ctx` it is * given (the worker builds its OWN context shim over the bootstrapped scope) and * posts the result over the IPC channel. */ export declare const toolCommandWorkerCommandSpec: CommandSpec; //# sourceMappingURL=tool-command-worker-entry.d.ts.map