/** How a rewind restores state. Mirrors Claude Code's `/rewind` modes. */
export type RestoreMode = "code" | "conversation" | "both";
/**
 * A single file touched during a checkpoint's turn. `snapshot` is the sha256 of
 * the file's PRE-mutation content (blob stored under blobs/<sha256>), or the
 * sentinel `"absent"` when the file did not exist before the turn (restore
 * deletes it).
 */
export interface CheckpointFileEntry {
    relPath: string;
    absPath: string;
    snapshot: string;
}
export declare const ABSENT: "absent";
export interface CheckpointManifest {
    id: string;
    turnIndex: number;
    /** messages.length at checkpoint open — conversation rewind truncates to this. */
    messageIndex: number;
    timestamp: number;
    files: CheckpointFileEntry[];
}
export interface CheckpointInfo {
    id: string;
    turnIndex: number;
    messageIndex: number;
    timestamp: number;
    changedFileCount: number;
    /** One-line summary of changed files, e.g. "a.ts, b.ts". */
    summary: string;
}
export interface RestoreResult {
    filesRestored: number;
    messageIndex: number;
}
export interface CheckpointStoreOptions {
    sessionId: string;
    cwd: string;
    /** Root for checkpoint storage. Defaults to ~/.gg/checkpoints. Injectable for tests. */
    baseDir?: string;
    /** Max checkpoints retained per session; older ones are pruned. Default 50. */
    maxCheckpoints?: number;
}
/**
 * Per-session file checkpoint store. Snapshots the pre-mutation content of files
 * that the agent edits through the `write`/`edit` tools so `/rewind` can restore
 * earlier on-disk state and/or conversation position.
 *
 * Snapshots live under `~/.gg/checkpoints/<sessionId>/` (never in the project
 * tree): a manifest JSON per checkpoint plus content-hash-deduped file blobs.
 * Changes made by `bash` (sed/rm/codegen) are NOT tracked — same documented
 * limitation as Claude Code's `/rewind`.
 */
export declare class CheckpointStore {
    private readonly sessionDir;
    private readonly blobsDir;
    private readonly checkpointsDir;
    private readonly cwd;
    private readonly maxCheckpoints;
    /** The checkpoint currently accumulating mutations for the active turn. */
    private current;
    constructor(options: CheckpointStoreOptions);
    private manifestPath;
    /**
     * Open a fresh checkpoint for a new user turn. Persisted immediately so a turn
     * with no file changes still serves as a conversation-rewind point.
     */
    openCheckpoint(meta: {
        turnIndex: number;
        messageIndex: number;
    }): Promise<string>;
    /**
     * Snapshot a file's current on-disk content before it is mutated. Idempotent
     * per (checkpoint, file): only the FIRST mutation of a file in a turn is
     * captured, so restore returns the pre-turn state. No-op when no checkpoint
     * is open.
     */
    recordPreMutation(filePath: string): Promise<void>;
    /** List persisted checkpoints in turn order with changed-file summaries. */
    listCheckpoints(): Promise<CheckpointInfo[]>;
    /**
     * Restore on-disk file state and/or report the conversation position for a
     * checkpoint. For `code`/`both`, writes snapshotted bytes back (or deletes
     * files that were absent at the checkpoint). Conversation truncation is left
     * to the caller via the returned `messageIndex`.
     */
    restore(id: string, mode: RestoreMode): Promise<RestoreResult>;
    private readManifest;
    private persistCurrent;
    /** Drop the oldest manifests beyond maxCheckpoints (blobs are left for GC simplicity). */
    private prune;
}
//# sourceMappingURL=checkpoint-store.d.ts.map