/** Finalize/persist phase of runInternal (plan 059). */ import type { PendingToolCall, StoredAgentRunState } from "../../agent-run-state.js"; import type { AgentRunResult, AgentRunState, ErrorInfo, Message, ModelConfig, NestedRunRef, Usage } from "../../contracts.js"; import type { RunLimitTracker } from "../../run-limits.js"; import type { RoundContext, SessionHost } from "./types.js"; export declare function persistDurable(session: SessionHost, state: StoredAgentRunState): Promise; export declare function suspendDurable(session: SessionHost, input: { readonly runId: string; readonly model: ModelConfig; readonly limits: RunLimitTracker; readonly interruption: import("../../contracts.js").AgentRunInterruption; readonly messages?: readonly Message[]; readonly pending?: StoredAgentRunState["pending"]; readonly pendingCalls?: readonly PendingToolCall[]; /** Full replacement when provided; otherwise the recorded nested runs are preserved. */ readonly nestedRuns?: readonly NestedRunRef[]; }): Promise; /** * Turn-boundary crash-recovery checkpoint (plan 084 Task 1). Called before each provider * request when `checkpointPolicy: "every-turn"`; a no-op otherwise, so default-policy runs keep * the 0.8.x checkpoint shape and write count unchanged. Pending-decision markers are dropped: * at a turn boundary every gated call has been resolved or the run already suspended, and a * stale marker must never replay. The recorded `checkpointPolicy` makes the cadence survive * into a resumed run, and loop-local state rides along exactly as it does at suspension. */ export declare function checkpointDurableTurn(session: SessionHost, input: { readonly runId: string; readonly model: ModelConfig; readonly limits: RunLimitTracker; }): Promise; /** * Fold-boundary checkpoint (plan 086 T3). Called once per turn that added folded bodies — never * per turn — when the resolved compiler is durable, so a crash after a fold resumes with the * ledger and frontier already on disk. Independent of `checkpointPolicy`: the fold is the * durability point that matters for a long single run, not the turn boundary. */ export declare function checkpointDurableFold(session: SessionHost, input: { readonly runId: string; readonly model: ModelConfig; readonly limits: RunLimitTracker; }): Promise; export declare function persistSucceeded(ctx: RoundContext, loopUsage: Usage | undefined): Promise; export declare function cleanupRun(input: { session: SessionHost; controller: AbortController; cleanupSignal: () => void; runId: string; model: ModelConfig; startedAt: string; runStatus: AgentRunResult["status"]; runError: ErrorInfo | undefined; /** Clean stop taxonomy for the finish record; only written for a succeeded run (plan 084 Task 2). */ stopReason?: import("../../contracts.js").AgentFinishReason; stopDetail?: string; }): Promise;