From 7d1d5d9bff3075b94e7380124d30647bf66030cf Mon Sep 17 00:00:00 2001 From: iris Date: Fri, 5 Jun 2026 15:24:26 +0200 Subject: [PATCH] docs(agent): add GET /api/state, /api/dashboard-state, /api/loose-ends, /api/stats to per-agent endpoints --- docs/web-ui/agent.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/web-ui/agent.md b/docs/web-ui/agent.md index bc2413fa..8c874aed 100644 --- a/docs/web-ui/agent.md +++ b/docs/web-ui/agent.md @@ -295,6 +295,24 @@ shaped). operator sees them in the live panel rather than as an HTTP error. Missing files (already logged out) are treated as idempotent. +- `GET /api/state` — cold-load snapshot (`StateSnapshot`) consumed by + `app.js` on page load and while `status === 'needs_login_in_progress'`. + Includes `turn_state`, `context_window_tokens`, `qualified_label`, + `available_models`, `links`, and other fields described inline + throughout this document. All subsequent state updates arrive via SSE. +- `GET /api/dashboard-state` — lean snapshot of agent-owned fields + fetched once per running agent by the dashboard's container row to + get fresh values without relying on hive-c0re's periodic file-reads. + Returns `{ status_text?, status_set_at?, ctx_tokens?, context_window_tokens, + rate_limited, links }`. Only called when the container is running; + skipped (muted badges) when stopped. Also accessible via the gateway + at `/agent//api/dashboard-state`. +- `GET /api/loose-ends` — loose-ends snapshot consumed by the inbox + flyout (`renderLooseEnds`). Returns pending questions the agent asked + or owes, plus pending reminders. Also calls `reconcileAskBinds()` to + wire inline answer forms to open `question_asked` events. +- `GET /api/stats?window=24h|7d|30d` — time-bucketed turn analytics + `Snapshot` consumed by the `/stats` page. - `GET /events/history` — replay buffer for the terminal. - `GET /screen` — VNC viewer page (minimal RFB-over-WebSocket renderer — deliberately thin, just enough to display the