Module: Mistri::Dispatchers
- Defined in:
- lib/mistri/dispatchers.rb
Overview
How a background child actually executes. The spawn tool hands every dispatcher two things: the serializable spec (name, session_id, parent_session_id, type, instructions, tool_names, model, workspace, task) and a runner closure that executes the child in this process with everything already reconstructed.
In-process dispatchers just call the runner. A queue dispatcher ignores the runner, enqueues the spec, and its job reconstructs the pieces from host registries and calls SubAgent.run_dispatched:
dispatcher: ->(spec, _runner) { ChildRunJob.perform_async(spec) }
The runner closes over the spawn-time event sink, so in-process children keep streaming to whoever watched the spawn; that sink must outlive the parent's turn (a broadcast lambda does, a request-scoped object may not).