import type { Span } from '@opentelemetry/api'; import { type WorkflowRun, type World } from '@workflow/world'; import type { WorkflowSuspension } from '../global.js'; import { type MutableEventLog } from './helpers.js'; export interface SuspensionHandlerParams { suspension: WorkflowSuspension; world: World; run: WorkflowRun; span?: Span; requestId?: string; /** * The runtime's loaded event log. Each event creation is sent with this * snapshot's `stateUpdatedAt` and, if the backend rejects it as stale (412), * the log is reloaded in place and the create is retried — see * `withPreconditionRetry`. Guarding per-create (rather than the whole * suspension) ensures a retry never re-issues an already-created event. */ eventLog?: MutableEventLog; } export interface SuspensionHandlerResult { timeoutSeconds?: number; /** * Correlation IDs of steps whose arguments failed to serialize. Each was * finalized here as `step_created` (with a placeholder input — the real * input is precisely what refused to serialize) followed by `step_failed` * carrying the serialization error, so the next replay rejects the step's * promise and a try/catch around the step call observes the error — * exactly like a step-body failure. No step-execution message is * dispatched for these, so an immediate re-invocation is scheduled * (`timeoutSeconds: 0`): when the failed step was the only pending work, * nothing else would ever wake the run to observe the terminal event. */ failedStepCorrelationIds?: Set; } /** * Handles a workflow suspension by processing all pending operations (hooks, steps, waits). * Uses an event-sourced architecture where entities (steps, hooks) are created atomically * with their corresponding events via events.create(). * * Processing order: * 1. Hooks are processed first to prevent race conditions with webhook receivers * 2. Steps and waits are processed in parallel after hooks complete */ export declare function handleSuspension({ suspension, world, run, span, requestId, eventLog, }: SuspensionHandlerParams): Promise; //# sourceMappingURL=suspension-handler.d.ts.map