/** Durable checkpoints for agents that may be interrupted by a catchable lifecycle event. */ import type { AgentInvocation } from "./types.js"; import type { LifetimeUsage } from "./usage.js"; type ActiveStatus = "running" | "queued"; type TerminalStatus = "completed" | "steered" | "stopped" | "aborted" | "error"; export type AgentRecoveryStatus = ActiveStatus | TerminalStatus; export interface AgentRecoveryCheckpoint { version: 1; id: string; type: string; description: string; status: AgentRecoveryStatus; startedAt: number; completedAt?: number; result?: string; error?: string; toolUses: number; lifetimeUsage: LifetimeUsage; compactionCount: number; transcriptPath?: string; invocation?: AgentInvocation; } /** Validate untrusted JSON before it can enter the manager or UI. */ export declare function isAgentRecoveryCheckpoint(value: unknown): value is AgentRecoveryCheckpoint; /** Return the on-disk path for an agent's single deduplicated checkpoint. */ export declare function agentRecoveryCheckpointPath(cwd: string, agentId: string): string; /** * Atomically write one checkpoint. Repeated writes for the same agent replace * the same file; identical payloads are skipped, so shutdown + abort callbacks * cannot create duplicate recovery records. */ export declare function removeAgentRecoveryCheckpoint(cwd: string, agentId: string): boolean; export declare function writeAgentRecoveryCheckpoint(cwd: string, checkpoint: AgentRecoveryCheckpoint): boolean; /** Load valid checkpoints, ignoring orphan, malformed, and corrupt files. */ export declare function readAgentRecoveryCheckpoints(cwd: string): AgentRecoveryCheckpoint[]; export {}; //# sourceMappingURL=agent-recovery.d.ts.map