/** * streamTurn: the spawn-per-turn headless runner. Spawn, drain both stdio * streams concurrently, decode typed HarnessEvents, watchdog stalls (only * for none-granularity invocations - a structured stream proves its own * liveness), classify the exit, always end with `done` (spawn failures * included). Runtime primitives are injected (D-005); structured boundary * events (spawn/exit/stall, argv redacted by POSITION) are always-on * evidence, not diagnostics. An abandoned turn (consumer breaks early) * closes backpressure, disposes output, stops the child, and awaits both * pumps before it returns. * * The supervising policies - stall clock, signal escalation, stderr * classification, question detection at close - are the turn supervisor's * (RFC-02 change 5); this runner composes it and owns only what is * particular to one-shot turns: the wall-clock deadline, the exit * classification, and the identity-first event buffer. */ import { type LaunchOptions } from "../interpretation/argv.js"; import { type QuestionMode } from "../interpretation/question.js"; import type { HarnessDescriptor } from "../knowledge/descriptor.js"; import type { RunnerDeps } from "./deps.js"; import { type HarnessEvent } from "./events.js"; /** The grace allowed for pipes still held open (by a grandchild) after the * process itself exited. */ export declare const PIPE_GRACE_MS = 2000; /** Redact by POSITION, not shape: the prompt is a known argv slot and is * masked wholesale (content never reaches a log line - v1 D-005); every * other token is kept unless it is secret-shaped. Only the prompt's * positional slot is masked, so a one-word prompt that equals a flag * value does not cause that flag value to be masked. */ export declare const redactArgv: (argv: readonly string[], prompt?: string, viaStdin?: boolean) => string[]; export interface TurnRunOptions extends LaunchOptions { readonly nativeApprovals?: boolean; /** Re-read and preserve this exact native settings source before spawning. */ readonly nativeSettingsFingerprint?: string; /** Resume this session id instead of launching fresh - the turn spawns * with the descriptor's resume grammar, and identity decoding treats a * DIFFERENT announced id as a rotation anomaly. */ readonly resume?: string; /** The caller confirmed this id exists in the native store before spawn. * Omitted means unverified, so create-on-missing resumes still warn. */ readonly resumeVerified?: true; /** Resume the harness's most recent session without naming an id (RFC-06). * The plan threads this from the parsed flag; the spawn renders through * the resume-last builder and the turn env resolves at resume phase. */ readonly resumeLast?: true; /** The resume-last pre-spawn lines (fixed warning, resolved-root * diagnostic, absent-directory warn), computed by the CLI layer and * passed in as plain data (ADR 0005: session input and protocol state * flow in). Execution only emits them, before any harness output, * spawn failures included; it never resolves roots or reads text. */ readonly resumeLastNotices?: readonly string[]; /** Working directory for the spawned harness. */ readonly cwd?: string; /** Per-call environment, merged over parent; "" deletes. */ readonly env?: Readonly>; /** D6 passthrough: raw harness tokens appended verbatim after the * normalized argv. Wrong-harness flags here fail in the harness itself * and surface as native errors - hcn never validates them. */ readonly passthrough?: readonly string[]; /** question mode: which preamble to inject (ask/assume/none). * Behavior instruction - never a harness flag. Defaults to "ask". */ readonly questions?: QuestionMode; /** F-05: caller-requested stop. When aborted, the runner escalates * SIGTERM then SIGKILL and classifies the exit as killed with no * transport failure for the kill itself. */ readonly signal?: AbortSignal; } export declare function streamTurn(h: HarnessDescriptor, opts: TurnRunOptions, deps: RunnerDeps): AsyncIterable; //# sourceMappingURL=stream-turn.d.ts.map