Skip to main content

collapse_operator_kind

Function collapse_operator_kind 

Source
pub fn collapse_operator_kind(
    runtime_agent: Option<OperatorKind>,
    runtime_global: Option<OperatorKind>,
    bp_agent: Option<OperatorKind>,
    bp_global: Option<OperatorKind>,
) -> OperatorKind
Expand description

The single canonical implementation of the 4-tier OperatorKind cascade (schema doc: mlua_swarm_schema::Blueprint::default_operator_kind).

Each tier is optional; the first Some wins, top to bottom. All four absent falls back to OperatorKind::default() (Automate).

tiermeaning
runtime_agentper-agent override supplied at task-launch time (narrowest, most direct)
runtime_globalthe launch-time operator_kind request (session-wide)
bp_agentOperatorDef.kind, resolved per-agent via AgentDef.spec.operator_ref
bp_globalBlueprint.default_operator_kind

Consumed by Engine::resolve_operator_info (crate::core::engine), which supplies runtime_agent / bp_agent from per-agent HashMap lookups on OperatorSession, and runtime_global / bp_global from session-level fields — runtime_global is OperatorSession.operator_kind verbatim (an Option<OperatorKind>; Some(_) is always an explicit request, including Some(Automate), and None means unspecified).