Skip to main content

Module step

Module step 

Source
Expand description

Steps: the closed 7-kind vocabulary (02 §4) plus the act-chain binding types (02 §5).

§Wire shape vs. Rust shape

On the wire, StepIR is a kind-discriminated union whose variants compose StepBase (baseline schema: allOf + unevaluatedProperties: false). In Rust, each variant struct carries an explicit const kind marker field and #[serde(flatten)]s StepBase; StepIR itself is #[serde(untagged)]. This produces the exact same wire bytes as serde’s internal tagging and lets a variant struct (e.g. HumanStepIR inside HandlerAction::escalate) serialize standalone with its kind field, as the baseline requires.

§Closedness caveat (documented divergence)

serde’s deny_unknown_fields cannot be combined with flatten, so the step variant structs are serde-lenient about unknown fields at runtime. The schema stays authoritative: #[schemars(deny_unknown_fields)] (schema-only, no serde effect) closes each variant in the generated schema, mirroring the baseline’s unevaluatedProperties: false. Golden fixture behavioral equivalence is judged schema-vs-schema (02 §1.1), so runtime leniency of the DTO loader is an implementation note, not a contract change.

Structs§

ActionBinding
Ordered, closed act-chain. No declared fallback ⇒ exactly one attempt (principle 6: the runner never improvises a downgrade).
ActionStepIR
Action step (02 §4.1): fixed pipeline preflight? → act → observe → assert.
AssertStepIR
Assert step (02 §4.2): side-effect-free observation and judgment.
BoundAttempt
One fully bound attempt of the act-chain (02 §5.1).
CallStepIR
Call step (02 §6): subflow invocation. Callee pinned by content hash (flowRef.irHash must appear in FlowIR.subflows). Call-by-value: inputs are evaluated in the caller scope and snapshotted.
ForeachStepIR
Foreach step (02 §4.6): iteration container. The iteration variable is referenced via iter.<as>; RunPath disambiguates rounds with { kind: "iteration", index } frames, so body stepIds do not (and must not) vary per round.
HumanStepIR
Human step (02 §4.4): human collaboration is a formal node (principle 8).
IfStepIR
If step (02 §4.5): conditional container. Container hashes exclude the subtree — child steps carry their own identity and hashes (02 §12.3).
LetStepIR
Let step (02 §4.7): pure bindings into the vars.* scope, SSA single assignment (rebinding an existing var name is a check-phase error).
ObservationFromStep
The object branch of ObservationSource (inline in the baseline).
StepBase
Common step envelope (02 §3).

Enums§

ActionKind
kind: "action".
AssertKind
kind: "assert".
CallKind
kind: "call".
ForeachKind
kind: "foreach".
FreshMarker
The "fresh" literal of ObservationSource.
HumanKind
kind: "human".
IfKind
kind: "if".
LetKind
kind: "let".
ObservationSource
Where an assert step’s observation comes from.
StepIR
The closed step union (7 kinds, spine A.4), discriminated by kind on the wire. See the module docs for why this is untagged in serde while remaining a kind-tagged union on the wire.