import type { EventV3 } from "./contract.js"; export declare const EVENT_V3_LEDGER_RELATIVE_ROOT: ".harnery/ledgers/v3"; export type EventV3DurabilityState = "committed" | "ready"; export interface WriteEventV3Result { state: EventV3DurabilityState | "epoch_replaced"; event_id: string; row_digest: `sha256:${string}`; ready_path?: string; diagnostic_code?: "wal_drain_failed"; } export interface WriteEventV3Options { leaseMs?: number; /** * Leave the durable row in the ready WAL instead of draining it into the * active authority during this call. A later `drainReadyEventsV3` commits * the batch under one append lease. Production writers default to false; * the option exists for matched harness-cost experiments. */ deferDrain?: boolean; /** * Epoch fence: the genesis id of the epoch this event was produced for. * An event carries per-epoch authority (producer boot sequences start at 1 * and every causal link must resolve inside its own epoch), so committing * it into a replaced epoch would poison the new authority. When set, the * write refuses with `epoch_replaced` if the live genesis no longer * matches, the spooled ready row is tagged with the id, and the drain * quarantines any tagged row whose epoch has been replaced underneath it. */ expectedGenesisId?: `gex_${string}`; now?: () => number; onStep?: (step: EventV3WriteStep, eventId?: string) => void; } export type EventV3WriteStep = "ready_temp_flushed" | "ready_published" | "active_tail_repaired" | "active_row_appended" | "active_row_flushed" | "receipt_committed" | "receipt_removed"; /** * Persist one already-normalized V3 event through the spool-first WAL. * * A successful ready rename is the durability boundary. Lease contention or * append failure leaves that ready record recoverable and returns `ready` * instead of changing the producing tool's result. */ export declare function writeEventV3(coordRoot: string, event: EventV3, options?: WriteEventV3Options): WriteEventV3Result; /** Drain every durable ready record under the fenced append lease. */ export declare function drainReadyEventsV3(coordRoot: string, options?: WriteEventV3Options): number; export declare function withEventV3LedgerLease(coordRoot: string, options: WriteEventV3Options, operation: () => T): T; export declare function drainReadyEventsUnderLeaseV3(paths: ReturnType, options?: WriteEventV3Options): number; export declare function eventV3Paths(coordRoot: string): { coordRoot: string; root: string; active: string; catalog: string; spool: string; diagnostics: string; segments: string; authorityOutbox: string; lease: string; }; export declare function ensureEventV3Layout(coordRoot: string): { coordRoot: string; root: string; active: string; catalog: string; spool: string; diagnostics: string; segments: string; authorityOutbox: string; lease: string; }; //# sourceMappingURL=writer.d.ts.map