import { computeRecordHash } from '../core/record.js'; import type { LedgerRecord, UnhashedRecord } from '../core/record.js'; import type { StorePaths } from './paths.js'; /** Cached chain tip so appends are O(1) instead of rescanning the JSONL. */ export interface LedgerHead { readonly seq: number; readonly hash: string; } export interface AppendInput { readonly record: Omit; } export declare function appendRecord(paths: StorePaths, input: AppendInput): Promise; export declare function readLedger(paths: StorePaths, session: string): readonly LedgerRecord[]; export declare function parseLedgerLines(content: string): readonly LedgerRecord[]; export interface ChainCheck { readonly ok: boolean; readonly length: number; readonly brokenAtSeq?: number; readonly reason?: string; /** Set when the head sidecar points past the file end — evidence of truncation. */ readonly truncated?: boolean; } export declare function verifyChain(records: readonly LedgerRecord[], head?: LedgerHead): ChainCheck; export declare function loadHead(paths: StorePaths, session: string): LedgerHead | undefined; /** Exposed for tests: recompute what a record's hash should be. */ export declare const internals: { computeRecordHash: typeof computeRecordHash; };