Skip to main content

Module input_inject

Module input_inject 

Source
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): SpawnerLayer trait impl plus injection of the IN_REFS list into Ctx.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§

InputInjectMiddleware
Multi-in prompt injection SpawnerLayer. Config: the list of OutputRefs to inject into the next spawn.

Constants§

INPUT_REFS_KEY
Key under ctx.meta.runtime that carries the IN_REFS list.