/** * Fenced append with optional terminal-head supersession. * * Both the System_State repair scanner and the User_Input cleanup scanner * must sometimes append an effect and supersede a terminal stream head in * one SQLite transaction: the durable predecessor guard would otherwise keep * the fresh effect blocked forever behind a `failed`/`blocked_candidate`/ * `conflict` head the worker will never retry. This helper owns that * transaction shape so both scanners share one fencing contract. */ import { type FencingContext, type NewEffect } from "@hikoutei/ikisaki"; import type { SqlStorageAdapter } from "../../../../contracts/storage/sql.js"; /** One effect to append plus the terminal head it must supersede, if any. */ export interface AppendPlan { readonly effect: NewEffect; /** Terminal stream head superseded with {@link effect} in the same transaction. */ readonly supersedeEffectId: string | null; } /** * Appends every plan under the fence, superseding each declared terminal head * with its replacement effect inside the same transaction. * * A supersede that changes zero rows means the head was already closed by a * concurrent pass: the append is rolled back so the stream stays consistent * and the caller re-plans on the next scan. Returns true only when every * effect was appended and every supersede applied. Fence loss reports false * exactly like `appendPendingEffectsWithAdapter`. */ export declare function appendEffectsWithSupersedes(storage: SqlStorageAdapter, fence: FencingContext, plans: readonly AppendPlan[]): Promise; //# sourceMappingURL=enqueue.d.ts.map