Skip to main content

Module worker_binding

Module worker_binding 

Source
Expand description

WorkerBindingMiddleware — a SpawnerLayer that propagates the Blueprint-baked per-agent WorkerBinding through Ctx.meta.runtime.

service::task_launch builds an agent name → WorkerBinding map from Blueprint.agents[].profile.worker_binding at launch time and places this layer on the stack (outermost, next to ProjectNameAliasMiddleware). Just before spawn it looks the map up by ctx.agent and, on a hit, inserts the serialized binding into Ctx.meta.runtime under the worker_binding key.

Downstream OperatorDelegateMiddleware reads it back so the delegate axis (session-global Operator delegation, which has no per-agent OperatorSpawner to carry a compile-time-baked binding) can hand Some(worker) to Operator::execute instead of the historical hardcoded None. Agents with no declared binding get no entry — the WS thin-path requires_worker_binding fail-loud stays the safety net.

Same shape as ProjectNameAliasMiddleware / CompiledAgentTable: a compile/launch-time table keyed by agent name, looked up via ctx.agent at spawn time, no engine state touched.

Structs§

WorkerBindingMiddleware
SpawnerLayer that drops the per-agent binding into ctx just before spawn.

Constants§

WORKER_BINDING_KEY
Key under ctx.meta.runtime that downstream code (the delegate axis) reads with get.