import { journalShimSource } from "./journal-shim.js"; import type { FabricJournalDelivery, FabricJournalDriver, FabricJournalOutcome, FabricJournalStop } from "./kernel.js"; export { journalShimSource }; /** The durable worker's journal offer for one fabric_exec call. */ export interface FabricJournalOffer { readonly path: string; /** Header digest the worker recorded; present only when resuming. */ readonly digest?: string; /** Record the header digest durably before the program starts. */ accept(digest: string): Promise; } /** Host-local state the execution service keeps in step with the journal. */ export interface FabricJournalHooks { /** Restore host-local state for a call served from the journal. */ served(delivery: FabricJournalDelivery, args: Record, signal: AbortSignal): void | Promise; /** Host-local data stored with a completion, such as a deferred handoff. */ local(seq: number): unknown; } /** A resume Fabric refuses; the message is the report for the model. */ export declare class FabricJournalRefusal extends Error { } interface JournalHeader { h: 1; format: string; versions: Record; identity: string; seed: number; startedAt: number; } interface CompletionRecord { p: string; c: number; seq: number; ref: string; t?: string; d: string; at: number; o: FabricJournalOutcome; l?: unknown; handle?: true; } /** Digest of one call's arguments; replay compares it with the reissued call. */ export declare const journalDigest: (args: unknown) => string; export declare class FabricExecJournal implements FabricJournalDriver { #private; readonly shim: string; readonly startedAt: number; readonly resuming: boolean; readonly replay: readonly FabricJournalDelivery[]; constructor(fd: number, header: JournalHeader, resuming: boolean, completions: readonly CompletionRecord[], intents: Map, hooks: FabricJournalHooks, previous: string); digest(args: Record): string; /** Durably record that call `seq` is about to reach its effect. */ intent(seq: number, ref: string): void; complete(seq: number, ref: string, args: Record, value: unknown, outcome: FabricJournalOutcome): number; /** Restore host-local state for a served call; a failure stops the resume. */ served(delivery: FabricJournalDelivery, args: Record, signal: AbortSignal): Promise; frontier(held: ReadonlyArray<{ seq: number; ref: string; args: Record; }>): FabricJournalStop | undefined; diverged(expected: FabricJournalDelivery, actual?: { ref: string; args: Record; }): string; close(): void; } /** * Create a journal for a fresh call, or reopen one to resume it. A resume that * cannot be trusted throws FabricJournalRefusal; the program must not run. */ export declare function openFabricExecJournal(offer: FabricJournalOffer, identity: Record, hooks: FabricJournalHooks): Promise; //# sourceMappingURL=exec-journal.d.ts.map