/** * Auto Checkpointer * * Tracks operation count and automatically creates checkpoints * at configurable intervals, on errors, or on milestones. * * Agents call `recordOperation()` after each significant action. * The checkpointer decides when to snapshot based on: * - Operation count threshold (default: every 10 ops) * - Error events (immediate checkpoint on failure) * - Milestone markers (explicit "save now" signal) * * This is a thin coordination layer over CheckpointManager. */ import { TaskState, TaskCheckpoint } from "@massa-th0th/shared"; export type CheckpointTrigger = "operation" | "error" | "milestone"; export interface AutoCheckpointerOptions { /** Create checkpoint every N operations (default: 10) */ operationInterval?: number; /** Agent ID for labeling checkpoints */ agentId?: string; /** Project ID for labeling checkpoints */ projectId?: string; /** TTL for auto-checkpoints in ms (default: 3 days) */ autoTtlMs?: number; /** TTL for milestone checkpoints in ms (default: 14 days) */ milestoneTtlMs?: number; } export declare class AutoCheckpointer { private operationCount; private lastCheckpointId; private checkpointManager; private options; private static instance; static getInstance(options?: AutoCheckpointerOptions): AutoCheckpointer; constructor(options?: AutoCheckpointerOptions); /** * Record an operation and maybe create a checkpoint. * * Call this from tools (store_memory, search_memories, etc.) * after each significant action. * * @returns The checkpoint if one was created, null otherwise. */ recordOperation(state: TaskState, trigger?: CheckpointTrigger): TaskCheckpoint | null; /** * Force-create a milestone checkpoint. */ markMilestone(state: TaskState): TaskCheckpoint; /** * Force-create an error checkpoint. */ markError(state: TaskState, error: Error): TaskCheckpoint; /** * Get the ID of the last created checkpoint. */ getLastCheckpointId(): string | null; /** * Get current operation count since last checkpoint. */ getOperationCount(): number; /** * Reset the operation counter (called after manual checkpoint). */ resetCounter(): void; private createCheckpoint; close(): void; } //# sourceMappingURL=auto-checkpointer.d.ts.map