docs(agent): add GET /api/state, /api/dashboard-state, /api/loose-ends, /api/stats to per-agent endpoints

This commit is contained in:
iris 2026-06-05 15:24:26 +02:00 committed by mara
commit 7d1d5d9bff

View file

@ -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/<name>/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