UNPKG

erosolar-cli

Version:

Unified AI agent framework for the command line - Multi-provider support with schema-driven tools, code intelligence, and transparent reasoning

76 lines 2.38 kB
/** * Checkpoint System - Claude Code Style * * Automatic checkpointing before code changes with instant rewind capability. * Saves both code state and conversation state for full restoration. * * Features: * - Automatic checkpoint creation before file modifications * - Rewind to any previous checkpoint (code only, conversation only, or both) * - Efficient diff-based storage to minimize disk usage * - Integration with session management */ export interface FileSnapshot { path: string; content: string; hash: string; mtime: number; } export interface ConversationSnapshot { messages: Array<{ role: 'user' | 'assistant' | 'system'; content: string; timestamp: number; }>; contextTokens: number; } export interface Checkpoint { id: string; timestamp: number; sessionId: string; description: string; trigger: 'auto' | 'manual' | 'pre-edit' | 'pre-write' | 'pre-delete'; files: FileSnapshot[]; conversation?: ConversationSnapshot; metadata: { toolName?: string; filePath?: string; changeType?: 'edit' | 'write' | 'delete'; }; } export interface RewindOptions { mode: 'code-only' | 'conversation-only' | 'both'; checkpointId: string; } export interface CheckpointManager { createCheckpoint(options: CreateCheckpointOptions): Promise<Checkpoint>; getCheckpoints(sessionId: string): Checkpoint[]; getCheckpoint(id: string): Checkpoint | null; rewind(options: RewindOptions): Promise<RewindResult>; cleanupOldCheckpoints(): void; } export interface CreateCheckpointOptions { sessionId: string; description: string; trigger: Checkpoint['trigger']; files?: string[]; conversation?: ConversationSnapshot; metadata?: Checkpoint['metadata']; } export interface RewindResult { success: boolean; checkpoint: Checkpoint; restoredFiles: string[]; restoredConversation: boolean; errors: string[]; } /** * Create a checkpoint manager for a working directory */ export declare function createCheckpointManager(workingDir: string): CheckpointManager; /** * Format checkpoint for display */ export declare function formatCheckpointForDisplay(checkpoint: Checkpoint): string; export declare function getCheckpointManager(workingDir?: string): CheckpointManager; //# sourceMappingURL=checkpoint.d.ts.map