import { CommandFailure, type CommitIntentRecord, type JsonValue, type ManagerCommitEvidence, type ManagerFinalizeEvidence, type MaintenanceLock, type MaintenanceReadyRecord, type ProcessOwner, type RestoreActiveRecord, type RestoreDegradedRecord, type RestoreListenerProof, type RestoreManagerCommittedRecord, type StoreIdentity } from "@cotal-ai/workspace"; export interface RestoreFlags { restore: string; "restore-only"?: string; "accept-missing-source"?: boolean; "store-dir"?: string; space?: string; server?: string; host?: string; runtime?: string; detach?: boolean; open?: boolean; "user-auth"?: boolean; idp?: string; /** Consent for admission gate 3, as the ordinary resume path takes it: a restored journal's * retained seats pass the same gates, so they need the same override available. */ "accept-stale-checkpoint"?: boolean; } export interface PreparedRestore { root: string; attemptId: string; targetPath: string; space: string; mode: MaintenanceReadyRecord["mode"]; server: string; host: string; runtime: string; detached: boolean; selection: "full" | "registry"; inventory: JsonValue; serverName: string; serverNonce: string; /** True only when reconstructed from durable commit/repair state after coordinator loss. */ reentry: boolean; journalState: "commit-intent" | "manager-committed" | "active" | "degraded"; managerCommit?: ManagerCommitEvidence; listenerProof?: RestoreListenerProof; cleanupStage(): void; } type RecoverableRestoreRecord = CommitIntentRecord | RestoreManagerCommittedRecord | RestoreActiveRecord | RestoreDegradedRecord; export declare function rehydratePreparedRestore(root: string, journal: RecoverableRestoreRecord): PreparedRestore; export declare function bindPreparedRestoreListener(prepared: PreparedRestore, processOwner: ProcessOwner, heldLock?: MaintenanceLock): RestoreListenerProof; export declare function replacePreparedDeadRestoreListener(prepared: PreparedRestore, heldLock?: MaintenanceLock): void; export declare function isManagerCommittedRestore(journal: RestoreActiveRecord): boolean; export declare function isManagerCommitResult(value: unknown, attemptId: string): value is ManagerCommitEvidence; export declare function isManagerFinalizeResult(value: unknown, attemptId: string): value is { attemptId: string; state: "active"; }; /** Where a preserved store is relative to the path its journal recorded. `moved` means that path is * gone and this root's own `.cotal/nats` is the same store, by device, inode and generation, so the * folder was moved after the cut and `recordedRoot` is where it was. Resume and restore use the * recorded path, so moving the folder back is what lets them run. */ export declare function preservedSourceState(root: string, source: StoreIdentity): { state: "present"; } | { state: "missing"; } | { state: "moved"; recordedRoot: string; store: string; }; /** The refusal for a folder moved after its state was preserved: where the journal recorded the * store, where it is now, and the folder to move back to before `then` runs there. */ export declare function movedFolderRefusal(root: string, space: string, recordedStore: string, moved: { recordedRoot: string; store: string; }, then: string): CommandFailure; /** The step that moves a full restore attempt on from `state`, for a refusal to name. A committed or * degraded attempt goes forward through bare `up`, which continues it. */ export declare function restoreNextStep(state: string, attemptId: string): string; /** The refusal while a restore's or backup's claim is not provably stale: what holds it, until * when, and when `backup recover` can release it. The refusing command changed nothing. */ export declare function heldClaim(root: string, attemptId: string, claim: { readonly deadline: string; readonly coordinator: ProcessOwner; readonly owners: readonly ProcessOwner[]; }, command: string, assessment: "live" | "ambiguous"): CommandFailure; /** The restore attempt the root's journal holds, with the step that moves it on, so a failure can * name the full attempt a recovery command needs. An unreadable journal names none. */ export declare function heldRestoreAttempt(root: string): { attemptId: string; journalState: string; remedy: string; } | undefined; /** `progress` receives the seat admission lines. `up --restore` leaves them on stdout; `backup restore` * routes them to stderr so its receipt stays the only stdout document. */ export declare function prepareRestore(root: string, flags: RestoreFlags, progress?: (line: string) => void): Promise; export declare function markPreparedRestoreActive(prepared: PreparedRestore, managerResult: ManagerFinalizeEvidence, heldLock?: MaintenanceLock): void; export declare function recordPreparedRestoreManagerCommit(prepared: PreparedRestore, evidence: ManagerCommitEvidence, heldLock?: MaintenanceLock): void; export declare function markPreparedRestoreDegraded(root: string, attemptId: string, reason: string, heldLock?: MaintenanceLock): void; export {}; //# sourceMappingURL=restore.d.ts.map