import type { EngineInternals } from './internals.ts'; type PendingUpdateCallbacks = { dispatchEvent: (event: Event) => boolean; broadcast: (message: { type: 'update:completed'; workflowId: string; updateId: string; }) => void; }; export declare function invokeUpdateHandler(internals: EngineInternals, name: string, handler: (payload: unknown) => unknown, payload: unknown): Promise; /** * After an inline workflow advances, wait for its current generator turn to * expose update handlers before draining pending coordinated updates. */ export declare function processPendingUpdatesAfterInlineAdvance(internals: EngineInternals, workflowId: string, callbacks: PendingUpdateCallbacks): Promise; export declare function schedulePendingInlineUpdateDrain(internals: EngineInternals, workflowId: string, callbacks: PendingUpdateCallbacks): void; /** * Drain a workflow's buffered coordinated updates and deliver each to its * handler exactly once, even when several drains race. * * Several triggers can fire near-simultaneously: each `engine.update()` schedules * a `setTimeout(0)` drain, and the post-advance path drains too. Their consume- * deletes are durable (`storage.batch`) and lag the in-memory `getPendingUpdates` * scan, so two overlapping drains both see the same pending set. Each update id * is therefore CLAIMED synchronously in `deliveredPendingUpdateIds` before * delivery (no `await` between the membership check and the add, so a concurrent * drain cannot interleave): a racing drain that re-reads the same id skips it. * * After the drain, re-drive a parked `ctx.waitUntil` once. A coordinated update * buffered before `ctx.onUpdate` was registered drains here (not on the inline * `tryInlineUpdateHandler` path), and a handler may have mutated the workflow- * local state a predicate reads, so the wait must be poked to re-evaluate. */ export declare function processPendingUpdatesForHandlers(internals: EngineInternals, workflowId: string, callbacks: PendingUpdateCallbacks): Promise; export {};