Use /workplans routes in state_hub context resolver

Replace /workstreams/workplan-index and per-workplan fetches with /workplans/index
and /workplans/{id}; task list queries use workplan_id param.
This commit is contained in:
tegwick 2026-07-09 00:29:25 +02:00
parent 2a841d91fe
commit f314bfc7f2
2 changed files with 8 additions and 8 deletions

View file

@ -7,7 +7,7 @@ Supported queries:
bulk (repos:all) -> GET {STATE_HUB_URL}/repos/
- state_summary: GET {STATE_HUB_URL}/state/summary
- next_steps: GET {STATE_HUB_URL}/state/next_steps
- workplan_index: GET {STATE_HUB_URL}/workstreams/workplan-index
- workplan_index: GET {STATE_HUB_URL}/workplans/index
- hub_inbox: GET {STATE_HUB_URL}/messages/?to_agent=hub&unread_only=true
- pending_decisions: GET {STATE_HUB_URL}/decisions/?status=open (topic_id/
workplan_id or legacy workstream_id/decision_type passed through)
@ -109,7 +109,7 @@ class StateHubContextResolver(ContextResolver):
return _fetch_json("/state/next_steps")
if query == "workplan_index":
query_params = dict(params)
return _fetch_json("/workstreams/workplan-index", query_params)
return _fetch_json("/workplans/index", query_params)
if query == "hub_inbox":
query_params = {
"to_agent": params.get("to_agent", "hub"),
@ -717,7 +717,7 @@ def _daily_triage_digest(params: dict[str, Any]) -> str:
return "{}"
workplan_index = _fetch_json(
"/workstreams/workplan-index",
"/workplans/index",
{"refresh": params.get("refresh", False)},
)
if not isinstance(workplan_index, dict):
@ -788,8 +788,8 @@ def _open_workplan_digest(
if workplan_row.get("status") not in _OPEN_WORKPLAN_STATUSES:
continue
workplan_id = workplan_row.get("id")
detail = _fetch_json(f"/workstreams/{workplan_id}") if workplan_id else {}
tasks = _fetch_json("/tasks/", {"workstream_id": workplan_id, "limit": 200})
detail = _fetch_json(f"/workplans/{workplan_id}") if workplan_id else {}
tasks = _fetch_json("/tasks/", {"workplan_id": workplan_id, "limit": 200})
if not isinstance(detail, dict):
detail = {}
if not isinstance(tasks, list):

View file

@ -65,7 +65,7 @@ def test_daily_triage_queries(monkeypatch) -> None:
"timeout": 10.0,
},
{
"url": "http://state-hub.test/workstreams/workplan-index",
"url": "http://state-hub.test/workplans/index",
"params": {"refresh": False},
"timeout": 10.0,
},
@ -617,7 +617,7 @@ def test_daily_triage_digest_is_curated_scalar_json(monkeypatch) -> None:
}
],
},
"/workstreams/workplan-index": {
"/workplans/index": {
"workstreams": {
"ws-1": {
"repo_slug": "the-custodian",
@ -648,7 +648,7 @@ def test_daily_triage_digest_is_curated_scalar_json(monkeypatch) -> None:
"created_at": "2026-05-19T05:00:00Z",
}
],
"/workstreams/ws-1": {
"/workplans/ws-1": {
"planning_priority": "high",
"planning_order": 45,
},