export type CheckpointEntryType = "file" | "directory" | "symlink" | "missing"; export type CheckpointStatus = "created" | "applied" | "confirmed" | "rolled_back" | "recovery_required"; export interface CheckpointEntry { /** Absolute path within the workspace. */ path: string; type: CheckpointEntryType; /** Whether the path existed in any form before the transaction. */ existed: boolean; /** content-addressed sha256 for file entries. */ contentSha256?: string; mode?: number; symlinkTarget?: string; size?: number; } export interface WorkspaceCheckpoint { checkpointId: string; workspaceId: string; transactionId: string; runId?: string; createdAt: number; entries: CheckpointEntry[]; manifestSha256: string; status: CheckpointStatus; } export interface CheckpointStoreOptions { storageDir: string; /** Refuse to checkpoint files larger than this many bytes. */ maxCheckpointBytes?: number; /** Refuse to checkpoint secret-bearing paths. */ rejectSecrets?: boolean; } export declare class CheckpointError extends Error { readonly code: string; constructor(code: string, message: string); } export declare function sha256(data: string | Buffer): string; /** * Content-addressed, integrity-protected pre-mutation checkpoint store. * * A checkpoint is a recovery artifact, never execution authority. Blobs are * deduplicated by sha256. The manifest carries a hash over its own entries so * tampering (including blob swapping) is detectable. */ export declare class CheckpointStore { private readonly opts; readonly storageDir: string; constructor(options: CheckpointStoreOptions); private checkpointDir; private blobsDir; private manifestPath; private snapshotEntry; /** * Create a checkpoint capturing the given absolute target paths. * The parent blob dir is created before writing. */ create(workspaceId: string, transactionId: string, targetPaths: string[], runId?: string): Promise; read(id: string): Promise; /** Verify manifest integrity and every blob hash. Throws on mismatch. */ verify(id: string): Promise; /** materialize the stored content of a file entry. */ materialize(id: string, entry: CheckpointEntry): Promise; updateStatus(id: string, status: CheckpointStatus): Promise; list(): Promise; /** Delete a checkpoint's storage atomically (used by GC for confirmed, expired ones). */ delete(id: string): Promise; /** * Concurrency-safe garbage collection. Only `confirmed` checkpoints older * than the retention window are removed. rollback-required, * recovery-required, active and other states are never collected. Uses an * atomic rename tombstone so two GC passes cannot race on the same dir. */ gc(opts?: { retainMs?: number; now?: number; }): Promise<{ removed: string[]; }>; } //# sourceMappingURL=checkpoint.d.ts.map