Expand description
task.run JSON-RPC method (#2056, vision spec §4.3): start a
session-driven task execution.
Why: this is the API surface the M1 control-plane cut line needs — a
caller creates (or targets an existing) session and asks the daemon to
actually EXECUTE a task against it, asynchronously, streaming progress via
the #2054/#2055 session.attach path. Kept as its own JSON-RPC method
(rather than overloading session.send) because session.send’s
existing #2054/#2055 contract — record an observable SessionInput event
— is already tested and shipped; task.run is the deliberate, explicit
“start executing” entry point the issue names.
What: register wires task.run onto a Router, sharing the SAME
Arc<SessionRegistry> every session.* method uses. Params match the
vision spec §4.3 example almost verbatim: task_description,
agent_name (top-level/PM agent, default "pm"), context (accepted for
forward-compatibility; not yet injected into the prompt — project
CLAUDE.md context already flows through run_task’s existing
machinery, and free-form per-call context injection is a smaller
follow-up, not core to this cut line), model_override (pins the
delegated ENGINEER’s model for this run), and an ADDITIONAL optional
session_id for “sessionful” execution against an already-session.created
session (the spec’s “single-shot or sessionful” phrasing).
Test: task::protocol::tests::*; the full flow end-to-end (a real
subprocess) in tests/task_e2e.rs.
Functions§
- register
- Register
task.runontorouter.