/** * @fileoverview Stable filesystem identity, sidecar, and bounded failure * evidence used by the read-only SQLite inspector. */ import type { SqliteIntegrityResult, SqliteSidecarPresence, SqliteSidecarState } from './sqlite-integrity-contract.js'; /** @internal Stable identity fields checked across every file transition. */ export interface SqliteFileIdentity { readonly dev: bigint; readonly ino: bigint; readonly mode: bigint; readonly nlink: bigint; readonly size: bigint; readonly mtimeNs: bigint; readonly ctimeNs: bigint; } /** @internal Hash evidence bound to the file identity that produced it. */ export interface HashedSqliteFile { readonly identity: SqliteFileIdentity; readonly sizeBytes: number; readonly sha256: string; } /** @internal Bounded classification used instead of propagating native details. */ export type SqliteInspectionErrorKind = 'absent' | 'not-sqlite' | 'corrupt' | 'invalid-file-type' | 'changed' | 'close-failed' | 'sidecar-unknown' | 'unreadable'; /** @internal Error carrying only a bounded SQLite inspection classification. */ export declare class SqliteInspectionError extends Error { readonly kind: SqliteInspectionErrorKind; constructor(kind: SqliteInspectionErrorKind); } /** * Hash a regular, singly linked file while proving that its descriptor identity * remains stable. * * @throws {SqliteInspectionError} When the path is absent, unsafe, unreadable, or changes. */ declare function hashStableRegularFile(path: string): HashedSqliteFile; /** @throws {SqliteInspectionError} When the path no longer has the expected identity. */ declare function assertUnchangedPath(path: string, expected: SqliteFileIdentity): void; declare function inspectSidecars(path: string): { readonly wal: SqliteSidecarState; readonly shm: SqliteSidecarState; }; declare function hasUnknownSidecar(sidecars: SqliteSidecarPresence): boolean; /** @throws {SqliteInspectionError} When either SQLite sidecar cannot be classified safely. */ declare function assertSidecarsKnown(sidecars: SqliteSidecarPresence['before'] | SqliteSidecarPresence['after']): void; declare function classifyFailureIdentity(path: string, error: unknown, hashed: HashedSqliteFile | undefined): 'changed' | 'unreadable' | undefined; declare function classifyNativeFailure(error: unknown): SqliteInspectionError; declare function mapInspectionFailure(error: unknown, sidecars: SqliteSidecarPresence): SqliteIntegrityResult; /** * @internal Cohesive filesystem evidence operations used by the inspector. * Keeping this object module-private to the datastore package avoids widening * the public package barrel while retaining independently testable seams. */ export declare const sqliteInspectionEvidence: Readonly<{ assertSidecarsKnown: typeof assertSidecarsKnown; assertUnchangedPath: typeof assertUnchangedPath; classifyFailureIdentity: typeof classifyFailureIdentity; classifyNativeFailure: typeof classifyNativeFailure; hashStableRegularFile: typeof hashStableRegularFile; hasUnknownSidecar: typeof hasUnknownSidecar; inspectSidecars: typeof inspectSidecars; mapInspectionFailure: typeof mapInspectionFailure; }>; export {}; //# sourceMappingURL=sqlite-inspection-evidence.d.ts.map