feat(dashboard): ST4TS tab — hive-wide stats view
Builds the dashboard UI on the /api/stats-hive endpoint: a new ST4TS tab showing swarm totals (active agents, turns, tokens, labelled est cost), a busiest-first per-agent table, and a model-mix bar list. Plain tables/CSS bars — no chart lib in the dashboard bundle; per-agent trend charts stay on each agent's own /stats page. Fetched on tab activation + window change (pull-only, no SSE). Also adds conn.busy_timeout(500ms) in hive_stats read_agent per review: turn_stats is rollback-journal, so a read landing mid-INSERT would hit SQLITE_BUSY and silently drop that active agent — wait the write out.
This commit is contained in:
parent
447a84e8a6
commit
8e74dda4c5
4 changed files with 263 additions and 2 deletions
|
|
@ -58,6 +58,15 @@
|
|||
<span class="tab-count" id="tab-count-schedules" hidden></span>
|
||||
</a>
|
||||
|
||||
<!-- ST4TS: hive-wide turn-stats rollup (swarm totals, busiest
|
||||
agents, model mix, est cost). Fetched on tab activation +
|
||||
window change from GET /api/stats-hive. -->
|
||||
<a class="tab" id="tab-stats" href="#stats" role="tab"
|
||||
aria-controls="tab-pane-stats"
|
||||
data-tab="stats">
|
||||
<span class="tab-label">◆ ST4TS ◆</span>
|
||||
</a>
|
||||
|
||||
<!-- P33RS: peer hive navigation links. Hidden until at least one
|
||||
peer is configured in `services.hyperhive.peers`. -->
|
||||
<a class="tab" id="tab-peers" href="#peers" role="tab"
|
||||
|
|
@ -257,6 +266,31 @@
|
|||
</div>
|
||||
</section>
|
||||
|
||||
<!-- ST4TS: hive-wide turn-stats aggregate. Plain tables/bars (the
|
||||
dashboard bundle has no chart lib); data from GET
|
||||
/api/stats-hive?window=, fetched on tab activation + on
|
||||
window change. Per-agent trend charts stay on each agent's
|
||||
own /stats page. -->
|
||||
<section class="tab-pane" id="tab-pane-stats"
|
||||
role="tabpanel" aria-labelledby="tab-stats">
|
||||
<h2>◆ ST4TS ◆</h2>
|
||||
<div class="divider">══════════════════════════════════════════════════════════════</div>
|
||||
<p class="meta">hive-wide turn statistics, aggregated across every agent over the selected window. <strong>cost is a rough estimate</strong> from approximate per-model list prices — it drifts and is a ballpark, not a bill.</p>
|
||||
<div class="hive-stats-windows" id="hive-stats-windows">
|
||||
<button type="button" class="btn" data-w="1h">1h</button>
|
||||
<button type="button" class="btn" data-w="4h">4h</button>
|
||||
<button type="button" class="btn active" data-w="24h">24h</button>
|
||||
<button type="button" class="btn" data-w="3d">3d</button>
|
||||
<button type="button" class="btn" data-w="7d">7d</button>
|
||||
<button type="button" class="btn" data-w="30d">30d</button>
|
||||
</div>
|
||||
<div class="hive-stats-chips" id="hive-stats-summary"></div>
|
||||
<h3>◇ busiest agents</h3>
|
||||
<div id="hive-stats-agents"><p class="meta">loading…</p></div>
|
||||
<h3>◇ model mix (turns across the swarm)</h3>
|
||||
<div id="hive-stats-models"></div>
|
||||
</section>
|
||||
|
||||
<!-- FL0W: lives on its own page now (`/flow.html`). The
|
||||
message-flow + inbox + compose DOM only exists there — when
|
||||
tabs.js boots on this page the corresponding renderers
|
||||
|
|
|
|||
Loading…
Reference in a new issue