pub fn spawn(
rx: Receiver<TaskEvent>,
backend: Arc<dyn ExternalBackend>,
tmux: Arc<TmuxManager>,
runner: Arc<TaskRunner>,
capture: Arc<CaptureService>,
semaphore: Arc<Semaphore>,
task_manager: Arc<TaskManager>,
weight_tx: Sender<WeightSignal>,
router_arc: Arc<RwLock<Router>>,
dispatching: Arc<DashMap<String, String>>,
store: Arc<TaskStore>,
repo: String,
)Expand description
Spawn a task that listens for Routed events and dispatches agents.
This mirrors the logic in tick_dispatch_tasks but triggers instantly
instead of waiting for the next tick. The dispatching set prevents
double-dispatch if the tick loop picks up the same task.