Expand description
behavior — component-graph IR + run_behavior unified execution IF.
Ports the TS reference ts/src/behavior.ts (scp-ir-architecture.md §5-§7).
A portable component-graph IR (components[]{name, inputPorts, body[], output, plan})
is executed on top of the existing COMMON primitives: run_plan (stage exec /
Skip propagation / Policy Kind) + evaluate (Expression IR). The concrete
per-component (leaf) implementation is resolved by name through a ComponentExec
seam — the boundary-injected handler registry (IR + {effects,config,hooks}).
Body node kinds:
- componentRef:
{id, component, ports, parent?, bindField?, relationKind?, policy?} - map:
{id, map:{over, as, component, ports, when?, into?, batched?, parent?, relationKind?, policy?}}(when/into/batchedare behaviorVersion 2) - cond:
{id, cond:{if, then, else, parent?}}(pure Expression; no handler)
behaviorVersion 2 (bc#22):
map.when— per-element guard, lowered to{cond:[when,true,false]}(strict bool; non-bool fails closed with TYPE_MISMATCH). Falsy elements are skipped (handler not called, excluded from the result list; order preserved).map.into— zip-attach: the node result becomes theoverlist with each guard-passing element shallow-copied and augmented withinto: <handler result>(same length/order asover; skipped elements pass through unchanged). Parent results are never mutated. Non-object kept elements fail closed (MAP_INTO_ELEMENT_NOT_OBJECT).map.batched— evaluates the ports of all guard-passing elements first, then calls the handler ONCE with{items:[<ports>...]}; the handler must return a list aligned to items (violations fail closed with MAP_BATCH_RESULT_MISMATCH). Zero kept elements means the handler is not called and the result is the empty list.- handler ctx — every handler call carries the node identity (nodeId + component)
via the
ComponentExec::exec_ctxseam (additive; default forwards toexec).
Structs§
- Behavior
Error - A unified failure for
run_behavior, carrying a stable string code so the conformance runner can compare against expression / plan / behavior codes alike.
Enums§
- Behavior
Failure Code - Stable behavior-execution failure codes (in addition to plan/expr codes).
Traits§
- Component
Exec - The boundary-injected handler registry seam (§7.1). Resolves a catalog name to
a leaf implementation and executes it with evaluated ports (+ the map element
boundvalue, if any). ReturnsNonewhen the name is unknown sorun_behaviorcan fail closed withUNKNOWN_COMPONENT.
Functions§
- run_
behavior - Run a component-graph IR (scp-ir-architecture.md §7).