Expand description
AXON Runtime — Rust executor integration for typed channels (Fase 13.l).
The Python side (axon/runtime/executor.py) gained four dispatch
branches in Fase 13.i + 13.j (emit_apply / publish_apply /
discover_apply / listen_apply) so a flow’s channel surface
executes end-to-end on the Python interpreter. The Rust crate
exposed TypedEventBus standalone in 13.f.2, but a Rust-native
flow runner that orchestrates IR steps had no equivalent
integration: a Rust adopter who wanted to drive an IRProgram
through the runtime had to wire the bus, value-ref resolution,
and capability/alias scope by hand.
13.l closes that. This module provides:
RunContext: mirror of Python’sContextManagerfor the typed-channel concern. Holds the per-unitTypedEventBus,discovered_handles,capabilities, and step results. Implementsresolve_value_refwith the same lookup order (discovered handles ▶ variables ▶ step results) and dotted-access walk over both serde JSON values andStringmaps.dispatch_emit/dispatch_publish/dispatch_discover/dispatch_listen: async functions that consume an IR step plus a&RunContextand route throughTypedEventBus.- [
bootstrap_run_context]: builds aRunContextfrom anIRProgram(registers everyIRChannelon a freshTypedEventBus).
The dispatch surface is intentionally byte-identical (in semantics)
to the Python handlers: same lookup precedence for value_ref, same
one-shot capability consumption, same alias binding rules. Rust
adopters who want a fully-orchestrated axon run Rust binary can
compose these primitives directly; a future sub-phase wires them
into axon-rs/src/runner.rs::execute_real.
Structs§
- RunContext
- Per-unit run context — the Rust mirror of Python’s
ContextManagerfor the typed-channel concern.
Enums§
- Dispatch
Error - Errors surfaced by the
dispatch_*functions. Each variant tags the channel-op kind so adopters can route failures back to the originating IR step. Mirrors thechannel_op:{op}detailstag the PythonAxonRuntimeErrorcarries. - RunValue
- A value reachable by
value_refduring channel-op dispatch. Rust adopters fill the run context with whatever shape their step outputs use; we only require the two access modes the dotted-access resolver needs (mapping access by string key + nested handle/JSON).
Functions§
- dispatch_
discover - Execute an
IRDiscoverstep. Pops the capability the matchingpublishrecorded earlier in the unit, hands it tobus.discover, and binds the resulting handle underaliasin the discovered- handles scope so subsequent emits / value_refs resolve it. - dispatch_
emit - Execute an
IREmitstep against the run context. - dispatch_
listen - Execute an
IRListenStepstep (free-standing in flow body — single- event receive). Subscribes to the channel, awaits one event, binds the payload underevent_aliasin the right scope (discovered_ handles for mobility, variables for scalar), and returns the payload so the caller can iterateir.children(left to the outer orchestrator since IRListenStep.children is currently typed asVec<IRFlowNode>and dispatch of arbitrary flow steps is the orchestrator’s job, not this module’s). - dispatch_
publish - Execute an
IRPublishstep. Records the returnedCapabilityin the context keyed by channel name so a laterIRDiscoverconsumes it.