import type { AgentMessage, AgentRunArgs } from './agent-runner.js'; import { type DshEvent } from './dsh-runner-parse.js'; export declare const TURN_TIMEOUT_MS: number; /** Filled in by streamTurn while the process runs and when it exits. */ export interface DshTurnOutcome { exitCode: number; stderrTail: string; timedOut: boolean; sessionId?: string; /** Summed from every `step_end.usage` of this invocation. */ inputTokens: number; outputTokens: number; cacheReadTokens: number; cacheWriteTokens: number; /** The `error` event's message (a failure outside a turn). */ errorEvent?: string; /** The last `turn_end` reason. */ turnEnd?: DshEvent['reason']; /** The emulated max-turns cap killed the process. */ maxTurnsHit: boolean; } /** Steps (`step_start`) seen so far for this mailbox message, across tool * rounds; the cap is AgentRunArgs.maxTurns (0 = none). */ export interface StepBudget { steps: number; max: number; } export type DshStreamEvent = { kind: 'assistant'; rawText: string; text?: string; } | { kind: 'message'; message: AgentMessage; }; /** * Permission mode for the spawned dsh (dsh-base reads DSH_PERMISSION_MODE * for both the sandbox policy and the approval policy). Full access: * `danger-full-access` → sandbox off, approval `never`. Otherwise * `workspace-write` (approval `ask`, which headless mode, having no * answerer, fails closed), or `read-only` when the caller asked for it — * never an ambient `danger-full-access` inherited from the environment. */ export declare function dshPermissionMode(args: Pick): string; /** * `dsh` argv for one invocation. Launcher flags (`--profile`, `--patch`) * must come before the first app flag: the launcher hands everything from * the first token it does not know (`--json`) to the headless app, which * rejects `--patch` (checked live). The task goes over stdin (`-`). */ export declare function dshArgs(sessionId: string | undefined, patchPath: string | undefined): string[]; /** * Run one `dsh --profile headless --json` invocation and stream its events * as they arrive. Text/thinking are per committed step, not per token. */ export declare function streamTurn(bin: string, prompt: string, sessionId: string | undefined, patchPath: string | undefined, args: AgentRunArgs, outcome: DshTurnOutcome, budget: StepBudget): AsyncGenerator; //# sourceMappingURL=dsh-runner-stream.d.ts.map