import type { RunEvent } from "./types.ts"; /** A step's lifecycle state (spec §5.1). Exactly one at a time. */ export type StepState = "todo" | "in_progress" | "blocked" | "completed" | "skipped" | "cancelled" | "crashed"; /** * The addressing key a step's state is keyed by (spec §5.4: "static node path" — the node path with * iteration/item indices dropped, e.g. `until-valid/design`). Latest execution wins: a step re-entered * by a new loop iteration or foreach item simply overwrites its own map entry. */ export type StepStateKey = string; /** * Derive every step's current state from a run's event log (spec §5.1, §5.4). * * Latest execution wins: a step reflects only its most recently emitted state (a step re-entered by a * loop iteration simply overwrites its own map entry — no loop-awareness needed since each iteration * re-emits the same step name's events). A branch arm whose condition was false is `skipped` directly * from its `branch-arm` event; the arm's OWN name is the key (its body's individual steps, if any, * simply never run and stay `todo` — enumerating them would require walking the `WorkflowDefinition`, * which is exactly the kind of thing node-path addressing in P2 exists for). * * A run-level terminal event (`run-crashed`/`run-cancelled`) force-closes any step still `in_progress` * or `blocked` at that point to the same terminal state, even when the event carries no `stepName` * (a node-level crash — e.g. a loop's `maxIterations` guard, a workflow input violation, or a resume's * definition-drift check — has no single step to attribute to) or when it names a *different* step than * the one left open (a cold cancel of a blocked run, spec §6.4, records `run-cancelled` with no * `stepName` at all). Without this, a step blocked when its run later crashed for an unrelated reason * would read `blocked` forever, even though nothing is waiting on it any more (spec §5.1: `blocked` * means, and only ever means, waiting on a human). */ export declare function deriveStepStates(events: readonly RunEvent[]): Map; /** One step's derived state (`todo` when it has no recorded events yet). */ export declare function stepState(states: ReadonlyMap, name: string): StepState; //# sourceMappingURL=step-state.d.ts.map