import type { ONICheckpoint, ONICheckpointer, CheckpointListOptions } from "../types.js"; export interface WorkspaceCheckpointerConfig { /** SQLite path for graph state persistence */ dbPath: string; /** Git repo root directory */ workspaceDir: string; /** If true, checkpoint → git commit automatically */ autoCommit: boolean; /** Prefix for commit messages, e.g. "chore(oni):" */ commitMessagePrefix: string; } export interface CheckpointCommit { checkpointId: string; commitHash: string; commitMessage: string; timestamp: string; } export interface CheckpointMetadata { description?: string; featureId?: string; } export declare class WorkspaceCheckpointer implements ONICheckpointer { private readonly config; private readonly workspaceDir; private readonly mappingPath; private readonly gitAvailable; private sqlite; /** Optional metadata for the next put() — set via setNextMetadata() */ private pendingMetadata; private constructor(); /** * Factory method — mirrors SqliteCheckpointer.create() pattern. * Checks git availability and degrades gracefully if not found. */ static create(config: WorkspaceCheckpointerConfig): Promise>; /** * Set metadata that will be used by the next put() call. * This allows callers to attach a description/featureId before Pregel * calls put() through the standard ONICheckpointer interface. */ setNextMetadata(metadata: CheckpointMetadata): void; get(threadId: string): Promise | null>; /** * Write checkpoint to SQLite, then optionally commit workspace to git. * This is the method Pregel calls — git logic lives here, not in a * separate save() that the engine would never invoke. */ put(checkpoint: ONICheckpoint): Promise; list(threadId: string, opts?: CheckpointListOptions): Promise[]>; delete(threadId: string): Promise; /** * Returns all checkpoints with their associated git commit hashes. */ listWithCommits(): Promise; /** * Rolls back to a prior checkpoint: * 1. Stashes current changes to avoid dirty workspace conflicts * 2. Checks out the git commit associated with the checkpoint * 3. Truncates the SQLite checkpoint history so that `get(threadId)` * returns the rolled-back checkpoint — not a later one. * * This is critical: Pregel resumes from whatever `get()` returns. * Simply reading the old checkpoint is not enough — later checkpoints * must be removed so the engine picks the correct one. * * Returns the restored checkpoint so callers can resume from it. */ rollbackTo(checkpointId: string): Promise | null>; /** * Returns a diff summary between two checkpoints. */ diff(fromCheckpointId: string, toCheckpointId: string): Promise; /** * Close the underlying SQLite connection. */ close(): void; private commitWorkspace; private readMappings; private addCommitMapping; } //# sourceMappingURL=WorkspaceCheckpointer.d.ts.map