Expand description
InputInjectMiddleware — the SpawnerLayer for the Data plane’s multi-in
prompt injection.
§Role
A SpawnerLayer that, just before spawn, drops the list of already-
registered OutputRefs into Ctx.meta.runtime. Downstream Operator /
Spawner code (for example mlua-swarm-server’s Operator::execute) looks this
key up and splices a line into the SubAgent’s Spawn directive prompt
along the lines of “$IN_REFS = [out_id_1, out_id_2, ...], fetch these
from the Store”.
MainAI only carries OutputRefs (small ids); the big bodies stay with the
store owner. That keeps MainAI context tight even when ten SubAgents each
stack up four-kilotoken bodies — MainAI only needs to hold the id list.
This layer stays out of the Domain path (the verdict flow). See the
crate::store::output module doc for the canonical narrative.
§Pattern
Same shape as AgentResolver, ProjectNameAliasMiddleware, and
SinkMiddleware: edit ctx, call the inner spawner, done. Engine state
is not touched.
§Implementation status
- Current (scaffold):
SpawnerLayertrait impl plus injection of theIN_REFSlist intoCtx.meta.runtime. Turning that into a real prompt line (literal expansion inside the Operator’s directive) is done on the Operator side and is still a carry. - Carry: literal expansion on the Operator-directive side; a fetch path from the store for actual bodies (today we only inject the id refs — the SubAgent tool is responsible for pulling bodies down); end-to-end wire-through.
Structs§
- Input
Inject Middleware - Multi-in prompt injection
SpawnerLayer. Config: the list ofOutputRefs to inject into the next spawn.
Constants§
- INPUT_
REFS_ KEY - Key under
ctx.meta.runtimethat carries theIN_REFSlist.