Expand description
Blueprint runner — glue that executes a flow.ir AST
(mlua_flow_ir::Node) through the engine. Each Step.ref is run as a
single task via start_task + dispatch_attempt_with_run_ctx, and
the resulting Pass Value is written back to Step.out.
Fully-async chain. Uses mlua_flow_ir::eval_async and
AsyncDispatcher; block_on and spawn_blocking are never mixed in,
so the whole stack stays consistent with the engine’s tokio async
world.
§Usage
ⓘ
let dispatcher = EngineDispatcher::with_spawner(engine.clone(), op_token, spawner);
let bp: mlua_flow_ir::Node = serde_json::from_str(BP_JSON)?;
let final_ctx = mlua_flow_ir::eval_async(&bp, init_ctx, &dispatcher).await?;§Schema types (the IF crate)
Blueprint / AgentDef / AgentKind and friends live in the
mlua_swarm_schema crate and are re-exported from here.
The struct/enum set that used to live directly in src/blueprint.rs
has been moved into the IF crate to support extension discipline,
versioning, and external consumers.
Modules§
- compiler
- Blueprint
Compiler,CompiledAgentTable, and the three defaultSpawnerFactoryimplementations. - loader
- Compat shim — the Blueprint loader (
expand_file_refs/load_blueprint_from_path/pre_read_default_agent_kind/LoadError) moved to the siblingmlua-swarm-compilecrate’slinkermodule so that the CLI (mse bp lint/mse bp build) and the server register path share one linker binary instead of two hand-copied bodies. This module re-exports the moved surface for pre-migration call sites; new code should reach intomlua_swarm_compile::linkerdirectly (issue 4c4e3eb8 Phase 2). - store
BlueprintStore— the Blueprint VCS abstraction.
Structs§
- Agent
Def - Maps an agent name to a Worker IMPL kind and its configuration. Referenced from flow.ir
Step.refby name. - Agent
Meta - Agent / Operator level metadata (description / version / tags).
- Agent
Profile - Agent persona information. Orthogonal to the backend kind (Shell / InProc / Operator).
- Agent
Provider Capability - One effective capability advertised by an execution-environment provider. Operator manifests normally publish one entry per wrapper variant.
- Agent
Provider Manifest - Capability manifest supplied by an Operator/MainAI or an official execution-platform plugin when joining the Server.
- Audit
Def - GH #34 — one Blueprint-declared after-run audit hook. See
Blueprint::auditsfor the persistence / invariant contract. - Bind
Receipt - Provider report describing the effective runtime binding for one agent.
This value is untrusted until Swarm validates it against
BindRequest. - Bind
Request - Platform-neutral request sent to an
AgentBindingProviderbefore a Run is dispatched. - Binding
Attestation - Core-validated capability statement pinned into a
BoundAgent. - Binding
Digest - Strongly typed identity of one immutable
BoundAgentsnapshot. Transparent serde keeps the public JSON wire form a plain string. - Blueprint
- Unified package of flow.ir + Swarm extension layers. The entry-point type of Swarm.
- Blueprint
Metadata - Blueprint-level metadata (description / origin / tags / ttl / version label / alias).
- Bound
Agent - Immutable, Run-scoped result of binding the Runner / Agent / Context layers for one logical agent.
- Compiler
Hints - Per-agent overrides / hints. Interpreted by the Compiler / SpawnerFactory; not required.
- Compiler
Strategy - Compiler behavior rules. Controls strict / lenient handling and default fallback.
- Engine
Dispatcher - Bridges
mlua_flow_ir::AsyncDispatcherto the engine’sstart_task+dispatch_attempt_with_run_ctxpair. Holds one Operator session token and onespawner, and spins up a fresh task perStep.ref, using it as the agent name. - MetaDef
- Named, multi-step-shared declarative context payload (GH #21 Phase 2).
- Operator
Def - Design-time definition of an Operator role (first-class).
- Projection
Placement Spec - GH #27 (follow-up to #23) — Blueprint-declared override of the
mlua-swarmcore crate’s placement resolver (mlua_swarm::core::projection_placement::ProjectionPlacement), which decides where a Step’s materialized OUTPUT file (submit-time sink, server read-back, and spawn-timectx_projectionpointer — the “3 path” convergence point) is written on disk. Both fields are independently optional and validated (dir_template) atCompiler::compiletime — see that resolver’sfrom_specdoc for the full rejection rules. - Runner
Def - One
Blueprint::runnersregistry entry — a namedRunnerdeclaration referenced byAgentDef.runner_ref/Blueprint::default_runner. Same registry shape asMetaDef(GH #21 Phase 2). - Spawner
Hints - Set of capability hint keys for the SpawnerLayer required by a Blueprint.
- Subprocess
Def - GH #83 — one declarative CLI invocation template: how a materialized worker payload (system prompt + task + model/tools/cwd) is rendered into a child-process invocation, and how its stdout is normalized back into the worker-result shape.
- Subprocess
Output - GH #83 — declarative stdout → worker-result normalization for a
SubprocessDef(plain mode only; streaming modes keep their event protocol untouched). - Subprocess
Overrides - Per-agent overrides for
Runner::Subprocess— values that take precedence over the agent’sprofile.model/profile.toolsand the spawn-time{work_dir}placeholder source when rendering theSubprocessDeftemplate. Lives on the Runner variant (not onSubprocessDef) so the template itself stays flat (no per-agent state, no variant axis). - Worker
Model - Canonical GH #46 Worker unit: a resolved
Runnerpaired with theAgentDefit backs. The Milestone 4 adapter is the consumer that turns this into a runtime spawn; this crate only declares the shape (no execution logic lives here — see the crate doc’s IN-immutability discipline).
Enums§
- Agent
Kind - SoT of the Worker IMPL axis. A closed enum managed inside Swarm and extended by variant addition through explicit maintenance. String lookup / escape hatches are deliberately not adopted.
- Audit
Mode - GH #34 — dispatch timing for an
AuditDef’s audit agent. Neither variant ever changes the audited step’s outcome (seeBlueprint::audits’s binding invariant). - Bind
Outcome - One provider outcome for a single
BindRequest. - Binding
Backend - Backend family a binding provider must resolve.
- Binding
Digest Parse Error - Rejection returned when an external binding digest is not in canonical
sha256:<64 lowercase hex>form. - Blueprint
Origin - Provenance record of a Blueprint.
- Bound
Agent Resolve Error - Failure while constructing immutable
BoundAgentsnapshots. - Runner
- The execution shell an agent’s Worker IMPL runs inside — holding tool grant, model selection, and runtime capabilities. Tier 1 of the GH #46 3-tier Worker model (Runner / Agent / Context).
- Runner
Resolution Source - Which declaration tier supplied a
BoundAgent’s resolved Runner. Kept in the immutable snapshot so explain surfaces can distinguish a first-class binding from the Claude Code compatibility fallback. - Runner
Resolve Error - Everything
resolve_runnercan fail with: anAgentDef.runner_ref/Blueprint.default_runnerreference that names no entry inBlueprint.runners. - Schema
Operator Kind - The schema-side
OperatorKind(seecrate::core::ctx::OperatorKindfor the runtime duplicate consumed byEngine). Re-exported under an explicit alias so callers readingBlueprint.operators[].kind/Blueprint.default_operator_kinddo not have to reach intomlua_swarm_schemadirectly. Kind axis of an Operator role (= “in which mode does this Operator run”). Corresponds 1:1 with the engine’s runtimeOperatorKind. Kept as a schema duplicate so that BPs can be authored while depending only on this crate.
Constants§
- CURRENT_
SCHEMA_ VERSION - Current Blueprint schema version. Tied to this crate’s semver.
Functions§
- current_
schema_ version - Blueprint construction helper: returns the semver of the current schema version.
Callers can write
schema_version: current_schema_version(),. - default_
global_ agent_ kind - Global default
AgentKindat the Schema impl Default layer. Bottom of the 4-layer cascade. - resolve_
bound_ agents - Resolve every
Blueprint.agentsentry into an immutable Run snapshot. Output order followsBlueprint.agents, making persistence and explain responses stable without a second sort. - resolve_
bound_ agents_ strict - Strict counterpart to
resolve_bound_agents: rejects the deprecatedprofile.worker_bindingfallback. This is the migration gate for callers that require every binding to use the platform-neutral Runner contract. - resolve_
runner - Resolve
agent’s effectiveRunneragainstbp, in cascade order (highest priority first):