import { type NodeFileSystem, type RootIdentity } from './filesystem.js'; import { type OwnershipLedger } from './ownership-ledger.js'; import type { InstallPlan } from './types.js'; export type InstallerJournalState = 'header' | 'intent' | 'applied' | 'verified' | 'ledger-published' | 'recovery-started' | 'restored' | 'committed' | 'rolled-back' | 'manual-recovery'; export interface TransactionOperationSnapshot { readonly kind: 'write' | 'delete'; readonly path: string; readonly beforeContent: string | null; readonly beforeSha256: string | null; readonly afterContent: string | null; readonly afterSha256: string | null; } export interface InstallerJournalRecord { readonly schemaVersion: '2.0.0'; readonly sequence: number; readonly transactionId: string; readonly planDigest: string; readonly kind: InstallPlan['mode']; readonly rollbackOf?: string; readonly state: InstallerJournalState; readonly operationIndex?: number; readonly phase?: string; readonly rootIdentity: RootIdentity; readonly expectedLedgerRevision: number; readonly beforeLedger: OwnershipLedger | null; readonly desiredLedger: OwnershipLedger; readonly expectedAbsent: readonly string[]; readonly operations: readonly TransactionOperationSnapshot[]; readonly recoveryStatus: 'clean' | 'recovering' | 'manual-recovery'; readonly previousHash: string | null; readonly checksum: string; } export interface TransactionCursor { sequence: number; previousHash: string; readonly planDigest: string; recoveryStatus: InstallerJournalRecord['recoveryStatus']; } export declare function transactionRelativePath(transactionId: string): string; export declare function transactionPath(location: string, transactionId: string): string; export declare function readTransactionJournal(location: string, transactionId: string, filesystem: NodeFileSystem, options?: { readonly recoverTornTail?: boolean; readonly allowTornTailReadOnly?: boolean; }): Promise; export declare function createTransactionJournal(plan: InstallPlan, beforeLedger: OwnershipLedger | null, operations: readonly TransactionOperationSnapshot[], filesystem: NodeFileSystem, lockedRootIdentity?: RootIdentity): Promise; export declare function appendTransactionRecord(location: string, transactionId: string, state: InstallerJournalState, filesystem: NodeFileSystem, detail?: { readonly operationIndex?: number; readonly phase?: string; readonly recoveryStatus?: InstallerJournalRecord['recoveryStatus']; }, cursor?: TransactionCursor): Promise; export declare function listTransactionIds(location: string, filesystem: NodeFileSystem): Promise; export declare function listTransactionEntries(location: string, filesystem: NodeFileSystem): Promise; export declare function readTransaction(location: string, transactionId: string, filesystem: NodeFileSystem): Promise<{ schemaVersion: "2.0.0"; transactionId: string; state: InstallerJournalState; beforeLedger: OwnershipLedger | null; files: { path: string; beforeContent: string | null; afterSha256: string; }[]; }>;