/** * HandlerRegistry — stores handler closures extracted from code-defined workflows. * * When a workflow is defined with the fluent DSL, nodes carry handler closures * (task functions, if/while conditions, switch expressions). These closures * cannot be serialized across process boundaries, so they are extracted from * the executable graph and stored here for lookup during execution. * * Each engine creates its own registry instance: * - InMemory/Restate: handlers live on graph nodes directly, registry is optional * - Temporal: V8 sandbox prevents the interpreter from accessing closures, * so the registry is injected into the activity module for lookup * * Keyed by workflowId (UUID), not by name — names can collide across definitions. */ import type { WorkflowGraph, HandlerResult } from './types.js'; export type HandlerFn = (stepContext: Record) => HandlerResult | Promise; export declare class HandlerRegistry { #private; /** * Extract and register all handler closures from an executable graph. * Overwrites any previously registered handlers for the same workflowId. */ registerFromGraph(workflowId: string, graph: WorkflowGraph): void; /** Look up a handler for a specific node in a workflow. */ get(workflowId: string, nodeKey: string): HandlerFn | undefined; /** Remove all handlers for a workflow (cleanup after run() completes). */ clear(workflowId: string): void; /** Check whether any handlers are registered for a workflow. */ has(workflowId: string): boolean; } /** * Build a step context matching the shape fluent DSL handlers expect. * * Used by engines that run handlers outside the in-process interpreter * (e.g., Temporal activities). The in-process interpreters (InMemory, Restate) * build their own step context inline since they have richer state access. */ export declare function buildStepContext(workflowInput: unknown, completedNodeOutputs: Record): Record; //# sourceMappingURL=handler-registry.d.ts.map