import type { CheckpointOwnerRegistry } from "./checkpoint-owners.js"; import type { FileCheckpointUnavailableReason, GitCheckpoint, GitRepository, GitRunner, PendingGitCheckpoint, SnapshotIndexLease } from "./types.js"; /** Single spelling of the retained-history ref namespace. Takes an * already-hashed session (`checkpointNamespace(sessionId)`), never a raw id. */ export declare const HISTORY_REF_ROOT = "refs/omp-undo-redo/history/"; export declare function historyRefPrefix(sessionHash: string): string; export declare function releaseAllPersistentSnapshotIndices(): Promise; export declare function checkpointNamespace(sessionId: string): string; export type RepositoryResolution = { repository: GitRepository; } | { reason: "git_unavailable" | "not_repository" | "repository_unresolvable"; }; export declare function resolveRepository(git: GitRunner): Promise; type SnapshotResult = { hash: string; snapshotIndexLease?: SnapshotIndexLease; } | { reason: "invalid_head" | "snapshot_failed"; }; export declare function createSnapshotCommit(git: GitRunner, message: string, retainIndex?: boolean): Promise; interface RefRelease { repository: GitRepository; ref: string; expectedHash: string; } export declare function releaseRefs(gitForRepository: (repository: GitRepository) => GitRunner, refs: readonly RefRelease[]): Promise; export declare function releaseCheckpoints(gitForRepository: (repository: GitRepository) => GitRunner, checkpoints: readonly GitCheckpoint[]): Promise; export declare function releaseCheckpoint(git: GitRunner, checkpoint: GitCheckpoint): Promise; export declare function releasePendingCheckpoint(git: GitRunner, pending: Pick): Promise; export type PrepareBeforeTurnResult = { status: "git"; checkpoint: PendingGitCheckpoint; } | { status: "session_only"; reason: FileCheckpointUnavailableReason; }; export type FinishAfterTurnResult = { status: "git"; checkpoint: GitCheckpoint; } | { status: "session_only"; reason: FileCheckpointUnavailableReason; }; export declare function prepareBeforeTurn(git: GitRunner, sessionId: string, ownerRegistry?: CheckpointOwnerRegistry): Promise; export declare function finishAfterTurn(git: GitRunner, before: Pick, parentLeafId: string | null, leafId: string | null): Promise; export declare function retainCheckpointForResume(git: GitRunner, sessionId: string, checkpoint: GitCheckpoint): Promise; export type CheckpointApplyResult = "applied" | "conflict" | "failed"; /** Restores `targetHash`'s content over a worktree that currently matches * `sourceHash`, via a patch instead of a checkout so the index is untouched. * * Every flag pins the plumbing contract against the user's own * configuration, each of which otherwise kills restoration outright on that * machine: `diff.noprefix`/`diff.srcPrefix`/`diff.dstPrefix` produce a patch * `git apply -p1` cannot resolve; `color.diff=always` prefixes it with ANSI * escapes ("No valid patches in input"); `diff.external` and textconv * filters replace it with another program's output; `diff.submodule=log` * replaces a gitlink hunk with a commit listing, which invalidates the whole * patch; `diff.context=0` yields hunks `git apply` refuses without * `--unidiff-zero`; `apply.whitespace=error` rejects content git itself * snapshotted. */ export declare function applyCheckpoint(git: GitRunner, sourceHash: string, targetHash: string): Promise; export {};