import { type Checkpoint, type CheckpointFaultMode, type CheckpointStore, type CheckpointSummary, type CheckpointToken, type ReopenReason, type ResolveExpectation, type ResumeOutcome } from "../../core/checkpoint-store.js"; export interface FileCheckpointStoreOptions { /** When false, an `appendLine` for a state transition is NOT fsync'd. The checkpoint COMMIT POINT always * fsyncs regardless (its crash-safety depends on it); this only affects whether `put` fsyncs. Default true. */ fsync?: boolean; /** Compact the ledger into a snapshot once it exceeds this many events (then truncate). Default 1000. */ compactEvery?: number; } export declare class FileCheckpointStore implements CheckpointStore { private readonly dir; private readonly tmpDir; private readonly ledgerPath; private readonly snapshotPath; private readonly fsyncEnabled; private readonly compactEvery; /** Authoritative in-memory state (replayed at boot). The CAS reads/writes THIS; disk is the durable log. */ private readonly cps; /** Per-token async mutex chain (identical shape to `TtlSessionStore.pending`). */ private readonly locks; /** Number of events appended to the live ledger since the last compaction (drives auto-compaction). */ private ledgerEvents; private log; /** One-shot crash fault (mirrors `InMemoryCheckpointStore.testInjectFault`). */ private fault; constructor(root: string, opts?: FileCheckpointStoreOptions); /** Rebuild the authoritative map: snapshot first (the compacted base), then the live ledger's events. */ private replay; /** Fold one ledger event into the authoritative map (last-writer-wins by event order). */ private applyEvent; /** * Serialize an op behind any in-flight op on the same token (the in-process per-token async mutex — the * SAME `Map` chain shape as `TtlSessionStore.pending`). Each call appends a new tail to the * chain; the next caller awaits THIS op before running. A prior op's rejection never blocks the chain * (we await it `.catch`-guarded). The chain entry is GC'd once it is the settled tail (no op queued after). */ private withLock; /** Commit one ledger event (append + fsync) THEN flip the in-memory map (crash-safe ordering, §2.4). */ private commit; put(token: CheckpointToken, cp: Checkpoint): Promise; get(token: CheckpointToken): Promise; resolve(token: CheckpointToken, scope: string, outcome: ResumeOutcome, expect?: ResolveExpectation): Promise; reopen(token: CheckpointToken, scope: string, reason: ReopenReason): Promise; setPendingSteer(token: CheckpointToken, scope: string, steer: { text: string; trusted: boolean; }): Promise; expire(token: CheckpointToken, scope: string): Promise; reap(scope: string, cutoff: number): Promise; listByScope(scope: string): Promise; /** Rewrite the snapshot from the current authoritative map (atomic) and truncate the live ledger. After * this, `replay` reads the full state from the snapshot alone — the round-trip is identical. */ private compact; /** Force a compaction now (test/inspection). */ compactNow(): void; /** Arm a one-shot fault on the next `resolve` (mirrors InMemory `testInjectFault`, council #5). */ testInjectFault(mode: CheckpointFaultMode | null): void; /** Test/inspection helper: number of stored checkpoints. */ get size(): number; /** Release the append handle (best-effort). The boot LOCK is released by the backend factory. */ close(): void; } //# sourceMappingURL=checkpoint-store.d.ts.map