import type { HostSettings } from "../host/host.js"; import type { AgencyCallbacks } from "./hooks.js"; import { type RestoreSignal } from "./errors.js"; import type { Policy } from "./policy.js"; import type { Checkpoint, CheckpointJSON } from "./state/checkpointStore.js"; import type { PendingArgOverrides, RuntimeContext } from "./state/context.js"; import type { GlobalStore } from "./state/globalStore.js"; import type { StateStack } from "./state/stateStack.js"; import type { GraphState } from "./types.js"; import { type CheckpointEdit, type ResumeOverrides, type StopAt } from "./state/checkpointPatch/index.js"; export type { ResumeOverrides } from "./state/checkpointPatch/index.js"; export type ResumeMetadata = { callbacks?: AgencyCallbacks; }; export type AfterCheckpointRestored = () => void; /** What a resume changes in the checkpoint before restoring it: the * old override shapes, which become edits on the frame at `at`, and * edits proper. `at` is the stop the edits are made at, for a caller * with a stop record; the checkpoint's own location otherwise. */ export type ResumeEdits = { overrides?: ResumeOverrides; edits?: CheckpointEdit[]; at?: StopAt; }; export type ResumeRequest = ResumeEdits & { checkpoint: Checkpoint; policy?: Policy; metadata?: ResumeMetadata; afterCheckpointRestored?: AfterCheckpointRestored; }; type RestoreOverrideTarget = { stateStack: StateStack; globals: GlobalStore; _pendingArgOverrides?: PendingArgOverrides; }; /** A copy of `source` with the overrides and edits applied, re-signed * under `settings` when it was signed. Throws `CheckpointEditError` * with every reason when any edit is refused. */ export declare function applyResumeEdits(source: Checkpoint | CheckpointJSON, request: ResumeEdits, settings: HostSettings): Checkpoint; /** A copy of `source` with `overrides` written into the frame the * checkpoint was taken in, re-signed under `settings` when it was * signed. */ export declare function applyLocalOverrides(source: Checkpoint, overrides: Record, settings: HostSettings): Checkpoint; /** The args of a function frame the program has not entered yet wait * for its entry (`__takeArgOverrides`), keyed by the frame's scope. * The frame is the one at `at`, the same frame `fromOverrides` writes * the args into, so the two halves of an args override name one * frame: inside a tool call that is the tool's frame, not the root's * last. A node frame has been entered, so its args are never queued. */ export declare function applyRestoreOverrides(target: RestoreOverrideTarget, checkpoint: Checkpoint, overrides?: Pick, at?: StopAt): void; /** React to a `restore(cp)` the program made mid-run: count it against * `maxRestores`, put the checkpoint's state back, and return the node to run * next. Every run loop goes through here, so the limit holds on a fresh run, * a resumed run, and a rewind alike. The limit matters because a restore also * rewinds what a cost guard has spent, so a guard cannot stop a restore loop. */ export declare function applyRestoreSignal(execCtx: RuntimeContext, signal: RestoreSignal): string; export declare function restoreForResume(execCtx: RuntimeContext, request: ResumeRequest): Promise;