import { closeOpLog, listOps, markOpApplied, openOpLog, appendPendingOp } from "../../op/operation-log.js"; import { type RecoverableTerminalReceiptAttempt } from "../../op/receipt-repository.js"; import { observeLocalPodGitState } from "./pod-git-state.js"; import { createPodRecoverySnapshot, planPodRecoverySnapshot, verifyPodRecoverySnapshot, type PodRecoverySnapshotReceipt } from "./pod-recovery-snapshot.js"; import { type PodRepairInspectionResult } from "./pod-repair.js"; export declare const POD_REPAIR_PHASES: readonly ["planned", "staged", "remote-updated", "original-aside", "replacement-active", "verified"]; export type PodRepairPhase = (typeof POD_REPAIR_PHASES)[number]; export interface PodRepairJournalRecord { readonly version: 2; readonly prior_record_digest: string | null; readonly record_digest: string; readonly attempt_id: string; readonly operation_id: string; readonly receipt_replay_digest: string; readonly plan_digest: string; readonly snapshot_plan_digest: string; readonly snapshot_intent: { readonly snapshot_id: string; readonly ref: string; }; readonly snapshot: PodRecoverySnapshotReceipt | null; readonly original_identity: DirectoryIdentity | null; readonly candidate_identity: DirectoryIdentity | null; readonly phase: PodRepairPhase; readonly candidate_step: "intended" | "directory-created" | "repository-initialized" | "remote-added" | "fetched" | "fetched-checked-out" | "replay-proof-complete"; readonly repository_path: string; readonly candidate_path: string; readonly aside_path: string; readonly remote_name: string; readonly remote_url: string; readonly remote_ref: string; readonly branch_ref: string; readonly upstream_ref: string; readonly expected_old: string; readonly replacement_head: string; readonly replay: { readonly proof_digest: string; readonly pod_rid: string; readonly operation_id: string; readonly replay_key_digest: string; readonly before_commit: string; readonly after_commit: string; readonly affected_paths: readonly string[]; } | null; readonly aside_reservation: DirectoryReservation | null; readonly active_reservation: DirectoryReservation | null; } export interface DirectoryReservation { readonly path: string; readonly dev: string | null; readonly ino: string | null; } export interface DirectoryIdentity { readonly realpath: string; readonly dev: string; readonly ino: string; readonly head: string; readonly tree: string; readonly content_sha256: string; } export interface PodRepairApplyDependencies { readonly inspect?: () => Promise; readonly attempt_id?: string; readonly operation_id?: string; readonly replay_digest?: string; readonly plan_snapshot?: typeof planPodRecoverySnapshot; readonly create_snapshot?: typeof createPodRecoverySnapshot; readonly verify_snapshot?: typeof verifyPodRecoverySnapshot; readonly now?: () => Date; readonly open_journal?: typeof openOpLog; readonly close_journal?: typeof closeOpLog; readonly list_journal?: typeof listOps; readonly append_phase?: typeof appendPendingOp; readonly complete_phase?: typeof markOpApplied; readonly move_directory?: typeof moveDirectoryNoClobber; readonly after_phase?: (phase: PodRepairPhase) => void; readonly after_mutation?: (mutation: "snapshot-ref" | "candidate-mkdir" | "candidate-init" | "candidate-remote" | "candidate-fetch" | "candidate-checkout" | "candidate-fetch-checkout" | "candidate-replay" | "aside-reservation-mkdir" | "active-reservation-mkdir" | "stage" | "remote-cas" | "original-aside" | "replacement-active" | "verified") => void; readonly observe_local?: typeof observeLocalPodGitState; readonly resolve_consumed_path?: () => string; } export interface PodRepairApplyResult { readonly mode: "apply"; readonly status: "success" | "no-op" | "refused" | "partial" | "failed"; readonly exit_code: 0 | 1 | 2; readonly repository_path: string; readonly target_commit: string | null; readonly snapshot: PodRecoverySnapshotReceipt | null; readonly local_mutations: number; readonly remote_mutations: number; readonly replayed_transformations: number; readonly error_code: string | null; readonly summary: string; readonly attempt_id: string | null; readonly phase: PodRepairPhase | null; readonly retained_original_path: string | null; readonly retained_original_identity: DirectoryIdentity | null; readonly replay_disposition: "new" | "resumed"; readonly resumed_from_phase?: PodRepairPhase | null; } export interface PendingPodRepairReceiptAttempt { readonly operation_id: string; readonly attempt_id: string; readonly started_at: string; } export type RecoverablePodRepairReceiptAttempt = RecoverableTerminalReceiptAttempt; export interface PendingPodRepairJournalIdentity { readonly operation_id: string; readonly attempt_id: string; readonly replay_digest: string; readonly plan_digest: string; readonly phase: PodRepairPhase; readonly local_mutations: number; readonly remote_mutations: number; } export interface PodRepairLogicalPlan { readonly replay_digest: string; } export declare function planPodRepairPreserveBoth(dependencies?: Pick): Promise; export declare function findPendingPodRepairJournalIdentities(operationIds?: readonly string[], dependencies?: Pick): Promise; export declare function findPendingPodRepairReceiptAttempts(): Promise; export declare function findRecoverablePodRepairReceiptAttempts(): Promise; export declare function applyPodRepairPreserveBoth(dependencies?: PodRepairApplyDependencies): Promise; export declare function moveDirectoryNoClobber(source: string, destination: string, reservation: DirectoryReservation | null): Promise; //# sourceMappingURL=pod-repair-apply.d.ts.map