/** * Step overrides (spec §13.2/§13.3): replace any step, by name, with a stub — including one nested * inside a branch arm, loop/foreach body, parallel arm, or nested workflow. An override naming a step * the workflow does not contain fails immediately, at construction, rather than surfacing later as a * confusing mid-run failure or (worse) silently doing nothing. * * Implementation: an override is spliced into the node tree as an ordinary FUNCTION step, preserving the * REAL step's name/description/inputSchema/outputSchema/retry/maxDurationMs. Two things fall out of that * for free, with no engine changes at all: * - the stub's return value is validated against the real step's declared `outputSchema`, by the SAME * function-step validation every workflow already goes through (step-runner.ts) — a stub that has * drifted from the contract it stands in for fails the test, not a silent divergence; * - a stub that throws drives the real step's retry/crash/resume machinery (spec §13.3), because it now * IS a function step under that policy — the otherwise-unreachable failure path becomes reachable * without hand-rolling code that fails on purpose. * * `src/testing` stays a pure consumer of `src/flow` — no engine internals are touched, keeping the * override mechanism entirely a testing-layer concern (spec §13.1). */ import type { StepRunArgs, WorkflowDefinition } from "../flow/types.ts"; /** A step stub (spec §13.2): same shape as a function step's `run`, so a thrown error drives retry/crash/resume. */ export type StepOverride = (args: StepRunArgs) => unknown | Promise; /** Per-step stubs, keyed by step name — any step, of any kind, anywhere in the tree. */ export type StepOverrides = Readonly>; /** * Splice `overrides` into `workflow`'s node tree, returning a new `WorkflowDefinition`. Returns * `workflow` unchanged when there is nothing to override. Throws immediately when an override names a * step the workflow does not contain (spec §13.3). */ export declare function applyStepOverrides(workflow: WorkflowDefinition, overrides: StepOverrides | undefined): WorkflowDefinition; //# sourceMappingURL=step-override.d.ts.map