/** * Checkpoint restore hooks (plan 094 Task 3). A hook restores one external layer (git commit, * document version, workspace fingerprint) recorded in a checkpoint's sidecar metadata. * * All-or-nothing: hooks run before the resume claims the checkpoint. The first hook that fails * or times out aborts the resume with `CheckpointRestoreError` naming that hook, so the * conversation restore never applies on top of a half-restored external world. Hosts that need * every layer back where they were re-run the whole restore after fixing the failing layer. */ /** Per-hook ceiling for a restore (plan 094 Task 3 default). */ export declare const DEFAULT_CHECKPOINT_RESTORE_TIMEOUT_MS = 10000; /** One hook that completed during a restore. */ export interface CheckpointRestoreAuditEntry { readonly hook: string; readonly durationMs: number; } /** Audit of a completed restore: every hook that ran, in order. */ export interface CheckpointRestoreAudit { readonly hooks: readonly CheckpointRestoreAuditEntry[]; readonly durationMs: number; } /** * Host code restoring one external layer. `signal` aborts on the per-hook timeout and on the * caller's abort, so a hook that talks to a remote system can cancel instead of dangling. */ export type CheckpointRestoreHook = (checkpoint: Context, signal: AbortSignal) => void | Promise; /** Thrown when a restore hook fails or times out; the checkpoint and conversation are untouched. */ export declare class CheckpointRestoreError extends Error { readonly code = "ERR_PRISM_CHECKPOINT_RESTORE"; /** Name of the failing hook (`fn.name` or `hook[i]`). */ readonly hook: string; constructor(hook: string, cause: unknown); } export interface RunCheckpointRestoreHooksOptions { /** Per-hook timeout; defaults to `DEFAULT_CHECKPOINT_RESTORE_TIMEOUT_MS`. */ readonly timeoutMs?: number; /** Caller abort: checked between hooks and combined into each hook's signal. */ readonly signal?: AbortSignal; } /** * Run restore hooks sequentially and report the audit. A hook failure throws * `CheckpointRestoreError` immediately (later hooks do not run); an already-aborted caller signal * throws its own abort reason so the resume reads as cancelled rather than as a restore failure. */ export declare function runCheckpointRestoreHooks(hooks: readonly CheckpointRestoreHook[], context: Context, options?: RunCheckpointRestoreHooksOptions): Promise;