/** * tool-command-worker-context — the WORKER-side {@link ToolCliContext} shim for * the ADR-0054 out-of-process dispatch plane (increments M4-C / M4-D). * * Each seam the worker exposes to the dispatched handler is implemented per its * transport strategy from ADR-0054's M4-C mapping table: * * - final-result-return (FRR): `render` / `emitJson` / `emitEnvelope` / * `emitRaw` / `emitError` / `setExitCode` record into a {@link * ResultAccumulator} drained into a `ToolCommandResult` after the handler * resolves; the host replays them through the real seams. * - host-RPC (RPC): `deliverSignals` / `writeSarif` / the four baseline seams * / `writeArtifact` / `ensureArtifactDir` / `toolState.*` / `hostPlanes.*` / * `maybeOpenReport` / `getExitCode` issue a typed {@link HostRpcRequest} via * the {@link WorkerRpcClient} and await the host's reply — the HOST performs * the privileged effect (datastore / egress / FS / process exit) and returns * the result. * - host-only (fail loud): the live-view seams (`registerLiveView` / * `renderLive`) throw {@link UnsupportedSeamError} — Ink/TTY rendering * cannot leave the host (documented as a later increment). * * `scope` / `runSession` / `logger` are backed by the worker's own minimal * {@link RunScope} + run timer (the worker re-bootstraps its own scope; it never * ships a live `RunScope` across IPC). */ import { type ResolvedReportFailure, type RunScope, type RunTimer, type ToolCliContext } from '@opensip-cli/core'; import { type ExternalAdapterProgressBridge } from '@opensip-cli/external-tool-adapter'; import type { ToolCommandFailureClass, ToolCommandResult } from './tool-command-dispatch-types.js'; import type { WorkerRpcClient } from './tool-command-worker-rpc.js'; /** * A loud, marked failure for a seam the worker shim cannot marshal (the * live-view seams). Carries the {@link ToolCommandFailureClass} so the * supervisor can triage; the worker catch turns it into an `error` IPC message. */ export declare class UnsupportedSeamError extends Error { readonly failureClass: ToolCommandFailureClass; constructor(seam: string); } /** * The mutable accumulator the worker-side context shim records final-result * seam calls into. Drained into a {@link ToolCommandResult} after the handler * resolves. */ export interface ResultAccumulator { render?: unknown; envelope?: unknown; json?: unknown; raw?: unknown; error?: ToolCommandResult['error']; reportedFailure?: ResolvedReportFailure; exitCode?: number; } /** Inputs for {@link buildWorkerContext} — bundled so the seam stays narrow. */ export interface BuildWorkerContextInput { readonly scope: RunScope; readonly timing: RunTimer; readonly acc: ResultAccumulator; readonly rpcClient: WorkerRpcClient; /** Byte cap for captured worker output (defaults to the worker limits). */ readonly maxCapturedOutputBytes?: number; readonly adapterProgress?: ExternalAdapterProgressBridge; } /** * Build the worker-side {@link ToolCliContext} shim. FRR seams record into * `acc`; RPC seams upcall via `rpcClient`; the live-view seams fail loud. * * The `scope` is the same already-restricted RunScope the worker bootstrap built * (local project/config/parse state; ambient datastore denied). This builder * does not replace, re-enable, or re-wrap the datastore thunk. */ export declare function buildWorkerContext(input: BuildWorkerContextInput): ToolCliContext; //# sourceMappingURL=tool-command-worker-context.d.ts.map