/** * tool-command-worker-ipc — the worker-side IPC message helpers for the external * tool command dispatch plane (ADR-0054). Extracted from * `tool-command-worker-entry.ts` so the entry module keeps only the run * orchestration: this module owns building/sending the {@link DispatchWorkerMessage} * shapes (progress + terminal result/error) and stamping the worker's diagnostics * snapshot onto the terminal result (ADR-0174). */ import { type WorkerMessage } from '@opensip-cli/core'; import type { DispatchProgressEvent, ToolCommandFailureClass, ToolCommandResult } from './tool-command-dispatch-types.js'; /** * The worker's IPC message type binding: host-RPC requests stream on the * `progress` arm; the final {@link ToolCommandResult} settles `result`. */ export type DispatchWorkerMessage = WorkerMessage; /** Post one IPC message to the parent (no-op when not forked — e.g. a unit call). */ export declare function send(msg: DispatchWorkerMessage): void; /** * Terminal IPC send — drains before the worker process exits so the parent does * not race `exit` ahead of `message` under load (the 61849de7 race, closed here * for the external-tool dispatch path). Progress/host-RPC sends stay synchronous; * only the final result/error needs the drain. */ export declare function sendTerminal(msg: DispatchWorkerMessage): Promise; /** * Build a structured `error` IPC message with a failure class (+ stack when * present). `code` carries the canonical exit class while `detailCode` carries * the original stable subcode, so the supervisor can rebuild the right subclass * without discarding machine-readable capability diagnostics. */ export declare function errorMessage(message: string, failureClass: ToolCommandFailureClass, stack?: string, code?: string, detailCode?: string): DispatchWorkerMessage; /** * Attach the worker run's diagnostics snapshot to the terminal result message so * the host can fold it into its own bus (ADR-0174): a worker-side capability * decision (a domain that routed 0-of-N packs, a denied pack, a foreign-core * skip) reaches the operator's `--json` diagnostics instead of dying with the * worker. The error IPC arm carries its own structured message/stack; result * diagnostics are the observability-critical path. */ export declare function stampWorkerDiagnostics(msg: DispatchWorkerMessage): DispatchWorkerMessage; //# sourceMappingURL=tool-command-worker-ipc.d.ts.map