/** * Ownership seam for structured CLI runs, mirroring TerminalHost for PTYs. * Persistent adapters (terminald) outlive web restarts; the in-process adapter * deliberately keeps the legacy "die with the server" lifecycle. */ /** Per-stream replay log cap inside the daemon. Reducers need full history. */ export declare const STRUCTURED_RUN_LOG_MAX_CHARS: number; export interface StructuredSpawnRequest { /** Stable across restarts: `structured:`. One run per session. */ runId: string; file: string; args: string[]; cwd: string; env: NodeJS.ProcessEnv; /** Written to stdin once, then stdin is closed. Omit for stdio-ignore CLIs. */ stdinData?: string; } export interface StructuredRunState { runId: string; incarnationId: string; pid: number; status: "running" | "exited"; exitCode: number | null; signal: number | null; stdoutSeq: number; stderrSeq: number; stdoutLog: string; stderrLog: string; stdoutTruncated: boolean; stderrTruncated: boolean; } export interface StructuredStreamEvent { stream: "stdout" | "stderr"; data: string; seq: number; } export interface StructuredExitEvent { exitCode: number | null; signal: number | null; } export interface StructuredExecProcess { readonly runId: string; readonly incarnationId: string; readonly pid: number; interrupt(signal?: string): void; onStream(listener: (event: StructuredStreamEvent) => void): { dispose(): void; }; onExit(listener: (event: StructuredExitEvent) => void): { dispose(): void; }; } export interface StructuredExecHost { readonly persistent: boolean; spawnStructured(request: StructuredSpawnRequest): Promise; /** Full state incl. replay logs; null when the host does not know the run. */ attachRun(runId: string): Promise; /** Subscribe to a known running run without spawning anything. */ adoptRun(runId: string): Promise; listRuns(): Promise; forgetRun(runId: string): void; } /** Resolve a stable daemon-side key for a session's active structured run. */ export declare function structuredRunId(sessionId: string): string; /** Legacy/local adapter and deterministic test adapter for the structured seam. */ export declare class InProcessStructuredExecHost implements StructuredExecHost { readonly persistent = false; private readonly processes; spawnStructured(request: StructuredSpawnRequest): Promise; attachRun(): Promise; adoptRun(): Promise; listRuns(): Promise; forgetRun(runId: string): void; } /** Map a NodeJS.Signals name to the numeric value used by waitpid-style APIs. */ export declare function osSignalNumber(signal: NodeJS.Signals): number;