Expand description
POST /tasks REST route over the task.run JSON-RPC method (#2983
Slice 4).
Why: Slices 2-3 (super::sessions/super::sessions_write) cover the
session.* resource — but a REST-only client also needs the explicit
“start executing” entry point task.run names (see
crate::task::protocol module docs): mint-or-reuse a session and kick off
a background LLM run against it. As with every route in this gateway, the
handler stays thin — extract the body, build the JSON-RPC params, call
super::respond/[respond_accepted] — because the actual behaviour
(session resolution, HarnessMode precedence, slot reservation, …)
already lives in crate::task::protocol::task_run; duplicating it here
would fork the two surfaces (see super module docs).
What: routes builds a standalone axum::Router<()> (its own
TasksState carrying just the Arc<Router>, with_state-erased before
return, mirroring super::sessions::SessionsState) mapping
POST /tasks -> task.run.
crate::serve::http::build_axum_router merges this into the daemon’s main
router alongside POST /rpc, GET /health, GET /sessions/{id}/events,
and the session.* REST routes — /tasks collides with none of them.
Test: tests::*.
Functions§
- routes
- Build the
POST /tasksroute group.