/** * Web Worker entry point for workflow execution. * * Sets up `self.onmessage` to handle {@link WorkerInboundMessage} and posts * back {@link WorkerOutboundMessage} via `self.postMessage`. Uses the * existing runner helpers from `workflow-runner.ts`. * * @module workers/workflow-worker-entry */ import type { WorkerWorkflowContext } from './workflow-runner.ts'; /** * A workflow handler. Receives a worker-side {@link WorkerWorkflowContext} as * the first argument so it can read `ctx.workflowId` exactly like inline-mode * handlers do. */ export type WorkflowHandler = (ctx: WorkerWorkflowContext, input: unknown) => AsyncGenerator; /** * Initialize the worker message loop. Call this from within a Web Worker * to wire up the message protocol. * * Sends a {@link WorkerRealmReadyMessage} first (WFT-28), built from exactly the * workflow type names in `workflows` — the host validates it against its own * expected manifest before this realm can receive its first `run` turn. * * @param workflows - Map of workflow type name to its async generator * function. This is also the realm's complete workflow-type advertisement: * the same names the ready manifest reports. */ export declare function initializeWorkerMessageLoop(workflows: Readonly>): void;