export type LbugSidecarState = { kind: 'clean'; dbPath: string; } | { kind: 'wal-with-shadow'; dbPath: string; walBytes: number; shadowBytes: number; } | { kind: 'tiny-orphan-wal'; dbPath: string; walBytes: number; } | { kind: 'orphan-wal'; dbPath: string; walBytes: number; } | { kind: 'orphan-shadow'; dbPath: string; shadowBytes: number; }; export interface SidecarRecoveryLogger { warn: (message: string) => void; info?: (message: string) => void; debug?: (message: string) => void; } export declare const TINY_ORPHAN_WAL_BYTES: number; export declare const isMissingFsError: (err: unknown) => boolean; export declare const statIfExists: (filePath: string) => Promise<{ size: number; } | null>; export declare const isMissingShadowSidecarError: (err: unknown) => boolean; export declare const isReadOnlyShadowReplayError: (err: unknown) => boolean; export declare const shadowSidecarRecoveryMessage: (dbPath: string, err: unknown) => string; export declare const isPermissionRenameError: (err: unknown) => boolean; /** * Classify a failure surfaced by quarantine rename into an actionable user-facing * message. * * - EACCES / EPERM / EBUSY → permission-specific message pointing at filesystem * ACLs, AV exclusions, and file-locks. Importantly does NOT instruct the user * to rebuild the index — the underlying problem is environmental, not data * integrity, and re-running after fixing the lock/permission will succeed. * - Everything else (including the LadybugDB "Cannot open file *.shadow" * missing-shadow error, ENOSPC, EROFS, EIO, and any other thrown Error) → * falls back to `shadowSidecarRecoveryMessage`, preserving today's behavior. * * Use at caller catches around `quarantineWalForMissingShadow` and any other * path where an `fs.rename`-class failure may surface to operators. */ export declare const renameFailureMessage: (dbPath: string, err: unknown) => string; export declare function inspectLbugSidecars(dbPath: string): Promise; export declare function quarantineWalForMissingShadow(dbPath: string, options: { logger: SidecarRecoveryLogger; level?: 'debug' | 'info' | 'warn'; reason?: string; }): Promise; export declare function preflightLbugSidecars(dbPath: string, options: { mode: 'read-only' | 'write'; logger: SidecarRecoveryLogger; allowQuarantine: boolean; }): Promise; export declare function finalizeLbugSidecarsAfterClose(dbPath: string, options: { logger: SidecarRecoveryLogger; }): Promise; export declare function listQuarantinedMissingShadowWals(dbPath: string): Promise; export declare function cleanQuarantinedMissingShadowWals(dbPath: string): Promise; export declare const _resetSidecarRecoveryWarningsForTest: () => void;