Expand description
GET/POST /workstreams* REST routes over the full workstream.*
JSON-RPC surface (issues #3294, #3295, epic #3292).
§Spec References
Why: mirrors every other resource group in this gateway (super::sessions,
super::tasks, …) — a REST-only client gets the same workstream.*
surface POST /rpc exposes, without duplicating
crate::workstreams::protocol‘s business logic as bespoke axum handlers
(see super module docs’ “forking the two surfaces” rationale). This is
where BOTH concurrent tickets against that RPC surface land their REST
twins: #3295’s CRUD/inspection routes (create/get/list/close) and
#3294’s activation-lock routes (activate/deactivate).
Path prefix deviation from DOC-48 §5.2 (documented, deliberate): the
spec’s table writes /api/v1/workstreams, but every REST resource group
this crate has shipped since #2983 (/sessions, /tasks, /fs, …) is
UNPREFIXED — there is no /api/v1 anywhere in crate::serve::rest. today.
Introducing a prefix for exactly one resource group would make the API
surface internally inconsistent (a client would need to special-case
which resource lives under which prefix) for no behavioural gain; this
ticket follows the shipped convention instead of the spec’s literal path,
matching every curl example in §12 except for the prefix itself.
What: routes builds a standalone axum::Router<()> (its own
WorkstreamsState carrying just the Arc<Router>, with_state-erased
before return, mirroring super::sessions::SessionsState) mapping:
POST /workstreams->workstream.create(201 Created)GET /workstreams/{id}->workstream.getGET /workstreams?include_closed=..->workstream.listPOST /workstreams/{id}/close->workstream.closePOST /workstreams/{id}/activate->workstream.activate{id, force?}(JSON body{"force": bool}, defaultingforcetofalsewhen the body omits it or is{})POST /workstreams/{id}/deactivate->workstream.deactivate{id}(no body, mirroringsuper::sessions_write’sPOST /sessions/{id}/cancel)POST /workstreams/{id}/rename->workstream.rename{id, name}(JSON body{"name": string}, issue #3300, Phase C — DOC-48 §5.1 marked this verb “future, Phase C” when Phase 1A shipped; this is that phase)
crate::serve::http::build_axum_router merges this into the daemon’s main
router alongside POST /rpc, GET /health, and the other REST resource
groups — none of those paths collide with the ones here.
Test: tests::*.
Functions§
- routes
- Build the
GET/POST /workstreams*route group.