/** * The Iteration record: what one loop fire's turn actually did (ADR-0002). * * An iteration is a child record of a loop task, never a task: it has no row of * its own in the panel and no schedule of its own. It holds the tool calls the * turn made — every tool, not just the ones that start background processes — * so a reader can answer "what did that wake do" without replaying the * transcript. * * @author mystery4f <40482524+mystery4f@users.noreply.github.com> */ /** * Tool calls one iteration keeps. A long turn can make hundreds of calls, and * the record is written to the session file on every change, so the cap is what * keeps one busy wake from filling the disk (ADR-0002). */ export declare const ITERATION_CALL_LIMIT = 100; /** Iterations one loop keeps; older ones are counted on the loop record instead. */ export declare const ITERATION_HISTORY_LIMIT = 50; /** How a tool call inside an iteration ended. */ export type IterationCallStatus = "running" | "completed" | "failed" | "aborted" | "interrupted"; /** * One tool call made during the turn a fire woke. `id` is the model's tool call * id: parallel calls start in source order and end in completion order, so the * pairing key is the id and never the position (ADR-0002). */ export interface IterationCall { readonly id: string; readonly tool: string; /** One line naming what the call acted on: the command, for a shell tool. */ readonly subject: string; readonly startedAt: number; endedAt?: number; status: IterationCallStatus; durationMs?: number; /** What the tool said when it failed. */ error?: string; } /** * How an iteration ended. `interrupted` means the end of the turn was never * observed — the process went away mid-turn — and is only written when a * record is read back. */ export type IterationStatus = "running" | "completed" | "aborted" | "interrupted"; /** One fire's turn: the child record of the loop task that fired. */ export interface Iteration { /** One-based fire number of the owning loop; unique within that loop. */ readonly fire: number; readonly startedAt: number; endedAt?: number; status: IterationStatus; /** * The wake reached pi, so this turn is real and its tool calls are its own. A * fire that never woke the model keeps this false and records no calls. */ bound?: boolean; /** Calls in the order they started; the newest are kept when the cap is hit. */ calls: IterationCall[]; /** Calls the cap dropped. Non-zero means the record is truncated, and says so. */ droppedCalls: number; } /** * The identifying argument of a call, as one readable line. A shell tool's * command is the interesting fact; a file tool's path is; anything else falls * back to a compact rendering of its arguments rather than to nothing. */ export declare function callSubject(args: unknown): string; /** * What a failed tool call said. Results reach an extension untyped, so this * reads the common `content` shape and gives up quietly on anything else: the * call is already marked failed, the text is a courtesy. */ export declare function callErrorText(result: unknown, fallback: string): string;