import { type NodeFileSystem, type PathIdentity } from './filesystem.js'; import type { ArtifactRuntime, InstallComponent, InstallProfile, RuntimeId } from './types.js'; export interface OwnedFile { readonly path: string; readonly sha256: string; readonly runtime: ArtifactRuntime; readonly component: InstallComponent; } export interface OwnershipLedger { readonly schemaVersion: '2.0.0'; readonly revision: number; readonly product: 'humbleagents'; readonly productVersion: string; readonly selection: { readonly profile: InstallProfile; readonly runtimes: readonly RuntimeId[]; readonly components: readonly InstallComponent[]; }; readonly lastTransactionId: string; readonly previousLedgerDigest: string | null; readonly files: readonly OwnedFile[]; } export declare const installerStateRelativeRoot = ".ads/state/v2/installer"; export declare const ledgerRelativePath = ".ads/state/v2/installer/ledger.json"; export interface OwnershipLedgerSnapshot { readonly ledger: OwnershipLedger | null; readonly digest: string | null; readonly identity: PathIdentity | null; } export interface LedgerMutationHooks { readonly claimId?: string; readonly beforeMutation?: () => void | Promise; readonly afterClaim?: () => void | Promise; readonly afterMutation?: () => void | Promise; } export declare function stableJson(value: unknown): string; export declare function ledgerDigest(ledger: OwnershipLedger): string; export declare function ledgerPath(location: string): string; export declare function validateOwnershipLedger(value: unknown): OwnershipLedger; export declare function readLedgerSnapshot(location: string, filesystem: NodeFileSystem): Promise; export declare function readLedger(location: string, filesystem: NodeFileSystem): Promise; export declare function writeLedger(location: string, ledger: OwnershipLedger, filesystem: NodeFileSystem): Promise; export declare function ledgerClaimPath(location: string, claimId: string): string; export declare function reconcileLedgerClaim(location: string, transactionId: string, beforeLedger: OwnershipLedger | null, desiredLedger: OwnershipLedger, filesystem: NodeFileSystem): Promise<'none' | 'reconciled' | 'manual'>; export declare function writeLedgerCas(location: string, expected: OwnershipLedgerSnapshot, ledger: OwnershipLedger, filesystem: NodeFileSystem, hooks?: LedgerMutationHooks): Promise; export declare function removeLedgerCas(location: string, expected: OwnershipLedgerSnapshot, filesystem: NodeFileSystem, hooks?: LedgerMutationHooks): Promise;