/** Host-provided correlation only. Command arguments cannot create this identity. */ export interface ShellRunInvocation { /** Canonical current host workspace; never a model-provided cwd or owner. */ workspaceRoot?: string; callId?: string; runId?: string; sessionId?: string; taskEpoch?: number; ownerId?: string; } export type ShellRunState = "running" | "completed" | "failed" | "stopped" | "timed_out"; export interface ShellRunSnapshot { id: string; source: "shell" | "background_run"; taskId?: string; /** Host-owned custody proof. Present only after a background lease registers. */ leaseId?: string; command: string; cwd: string; timeoutMs: number | null; startedAt: number; finishedAt?: number; pid: number; state: ShellRunState; exitCode: number | null; signal: string | null; sequence: number; outputTail: string; omittedBytes: number; invocation?: ShellRunInvocation; outputCoverage?: import("./tool-output-spool.js").ToolOutputCoverage; } export type ShellRunEvent = { type: "start" | "end"; runId: string; sequence: number; run: ShellRunSnapshot; } | { type: "output"; runId: string; sequence: number; channel: "stdout" | "stderr"; text: string; }; export interface ShellRunSource { /** Future events only. Subscribe then snapshot; sequence numbers fence overlap. */ subscribeRuns(listener: (event: ShellRunEvent) => void): () => void; snapshotRuns(): readonly ShellRunSnapshot[]; /** Resolves only after this owned process has settled; never accepts a PID. */ stopRun(runId: string): Promise; } export declare const SHELL_RUN_TAIL_BYTES = 65536; export declare const SHELL_RUN_TERMINAL_RETENTION = 32; export declare const SHELL_MODEL_GUIDANCE = "Run command:string with required timeout: positive integer milliseconds or null for no deadline. Example: {\"command\":\"pwd\",\"timeout\":null}. Optional stdin:string. No cwd/workdir/yield fields; use cd inside command. Persistent jobs: background_run."; /** Preserve exact intent for a small set of historical spellings. Never * supply a deadline, coerce values, or choose between conflicting arguments. */ export declare function normalizeShellInput(args: Record): Record; /** Shared strict policy: omission and zero never mean "use a default". */ export declare function explicitShellTimeout(args: Record, key: "timeout" | "timeout_ms"): number | null; /** Node clamps oversized timers to 1ms. Schedule long explicit deadlines in pieces. */ export declare function scheduleShellDeadline(timeoutMs: number | null, callback: () => void): () => void; /** Process-local observation/control, never persisted process or effect authority. */ export declare class ShellRunRegistry implements ShellRunSource { private runs; private listeners; subscribeRuns(listener: (event: ShellRunEvent) => void): () => void; snapshotRuns(): readonly ShellRunSnapshot[]; observeOutputCoverage(id: string | undefined, value: import("./tool-output-spool.js").ToolOutputCoverage): void; stopRun(id: string): Promise; start(input: Omit, stop: () => boolean | void, initialOutput?: { outputTail: string; omittedBytes: number; }): string; output(id: string | undefined, channel: "stdout" | "stderr", text: string): void; finish(id: string | undefined, outcome: { state: Exclude; exitCode: number | null; signal?: string | null; }): void; private copy; private emit; }