/** * The worker-side replay state: the per-run record of cached step outcomes the worker * runner rebuilds from a checkpoint, plus the helpers that create it and fold a resumed * operation outcome back into it. Extracted from `workflow-runner.ts` so that module * stays under the line cap; the runner imports these back and owns the generator-driving * flow that consumes them. * * @module workers/worker-replay-state */ import type { Checkpoint, OperationOutcome, WorkerReplayOperationFailure } from '../core/types.ts'; import type { WorkerReplayOperationSignature } from '../core/worker-protocol.ts'; /** Per-run worker replay state, rebuilt from a checkpoint on every run/recovery. */ export interface WorkerReplayState { checkpoint: Checkpoint; accumulatedResults: Map; signatures: Map; failedOutcomes: Map; nextStepIndex: number; pendingStepIndex: number | null; maxProtocolMessageBytes: number | undefined; } export declare function createReplayState(message: { workflowId: string; checkpoint?: ArrayBuffer; maxProtocolMessageBytes?: number; }): WorkerReplayState; /** * Fold a resumed operation outcome into the replay state at the pending step: cache a * success in `accumulatedResults`, a failure in `failedOutcomes` (mutually exclusive), * and advance `nextStepIndex` past it. A no-op when there is no pending step or outcome. */ export declare function recordOperationOutcome(replayState: WorkerReplayState, outcome: OperationOutcome | undefined): void;