import type { PatchPublication, PatchUpdate } from './hmr-protocol.ts'; type PublishPatches = (publication: PatchPublication) => Promise; /** * Owns the cumulative sequence range between the host's published frontier and the runtime's applied frontier. * * For example, if the runtime has applied sequence 4: * * 1. produce([5, 6]) publishes [5, 6]; * 2. produce([7]) before an application report publishes [5, 6, 7], so a mode may miss the first delivery safely; * 3. acknowledge(6) retains [7]; * 4. produce([8]) then publishes [7, 8], exactly the suffix the runtime still needs. * * The host may advance Rolldown's published frontier immediately after each durable publication, but the journal prunes only * through the runtime's last successful ACK. Published and applied sequences are deliberately distinct: collapsing them would * make one missed delivery unrecoverable. The journal owns that gap and build identity while the mode owns representation. */ export declare class PatchJournal { private readonly publishPatches; private buildId; private readonly pendingPatches; private hasPublishedPatches; constructor(publishPatches: PublishPatches); /** True when the buildId belongs to the current complete build. */ isCurrentBuild(buildId: string): boolean; /** Begins a fresh build and returns both sides of the client-session rotation. */ startBuild(): Readonly<{ buildId: string; previousBuildId: string | undefined; }>; /** * Appends a Rolldown batch and publishes the complete range not yet applied by the runtime. * * Host action serialization guarantees this readonly view cannot be mutated by an ACK, build rotation, or later production * until publishPatches settles. Resolution proves only that the mode made the suffix durable, not that the App applied it; a * failed publication therefore leaves the appended range intact, and a successful one remains until an explicit ACK. */ produce(patches: readonly PatchUpdate[]): Promise; /** A new App can use the disk baseline only while no patches have been published against it. */ isBaselineCurrent(): boolean; /** * Removes only the prefix covered by the runtime's successful application frontier. * * Publication must never call this method: retaining the gap between published and applied frontiers is what lets a mode * safely coalesce, replay, or miss an intermediate delivery without losing a factory required by the live App generation. */ acknowledge(seq: number): void; } export {};