From f314bfc7f2d8ae8f9a1015430b9164281bfa1588 Mon Sep 17 00:00:00 2001 From: tegwick Date: Thu, 9 Jul 2026 00:29:25 +0200 Subject: [PATCH] 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. --- src/activity_core/context_resolvers/state_hub.py | 10 +++++----- tests/test_state_hub_context_resolver.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/activity_core/context_resolvers/state_hub.py b/src/activity_core/context_resolvers/state_hub.py index 3467add..2b3738d 100644 --- a/src/activity_core/context_resolvers/state_hub.py +++ b/src/activity_core/context_resolvers/state_hub.py @@ -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): diff --git a/tests/test_state_hub_context_resolver.py b/tests/test_state_hub_context_resolver.py index 4689bfc..313d7db 100644 --- a/tests/test_state_hub_context_resolver.py +++ b/tests/test_state_hub_context_resolver.py @@ -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, },