import type { HarnessEvent, HarnessRunSpec } from "@claudexor/schema"; import { type ChildStdin } from "./proc.js"; import type { ProcessTreeTerminationOutcome, ReapProcessTreeOptions } from "./process-tree.js"; export declare function abortSignalFromSpec(spec: HarnessRunSpec): AbortSignal | undefined; export interface CliRunLoopOptions { bin: string; args: string[]; spec: HarnessRunSpec; /** One-shot stdin payload. Mutually exclusive with the bidirectional session owner. */ input?: string; /** * Translate one parsed JSON stdout object into normalized events. * Return `null` for UNRECOGNIZED shapes (counted as dropped) and `[]` for * recognized-but-intentionally-skipped events (progress ticks etc.). */ parseEvent: (obj: unknown, sessionId: string) => HarnessEvent[] | null; env?: Record; /** Label used in synthesized error messages; defaults to `bin`. */ label?: string; /** Redactor applied to stderr detail before it is surfaced. */ redact?: (text: string) => string; /** Adapter-owned translation for a recognized stderr-only nonzero exit. */ parseStderrFailure?: (stderr: string, sessionId: string) => HarnessEvent | null; /** Stop and reap the harness immediately after a normalized fatal event. */ stopAfterEvent?: (event: HarnessEvent) => boolean; /** * Bidirectional session support (e.g. Claude's stream-json control * protocol). When set, stdin stays open, `initialStdin` is written at spawn, * frames matching `matches` are routed to `handle` (an async generator that * may yield normalized events and write control responses via the stdin * handle), and stdin is closed when `closeStdinOn` matches a frame — * the cooperative end of a streaming session. */ session?: { initialStdin?: string; matches: (obj: unknown) => boolean; handle: (obj: unknown, io: ChildStdin) => AsyncGenerator; closeStdinOn?: (obj: unknown) => boolean; }; /** Injection seam for the whole-tree death proof (deterministic tests of the * termination_unconfirmed terminal fact). Forwarded to spawnProcess; production * callers never set this. */ reap?: (opts: ReapProcessTreeOptions) => Promise; } export declare function runCliHarness(opts: CliRunLoopOptions): AsyncGenerator; //# sourceMappingURL=runloop.d.ts.map