dashboard: add per-agent ctx-window usage chip to container rows
Reads the most recent turn's context-window token count directly from each agent's hyperhive-turn-stats.sqlite (same path the host-side stats_vacuum uses). Adds ctx_tokens: Option<u64> to ContainerView; populated in build_all via a single best-effort SQL query. Dashboard app.js renders a 'ctx·Nk' badge colour-coded by harness watermarks: green <100k (safe), yellow 100-150k (near auto-reset), red ≥150k (compact territory). Badge only shown when ctx_tokens is present (agent has run at least one turn). Closes #17
This commit is contained in:
parent
25659ee9f3
commit
270ef19920
3 changed files with 65 additions and 0 deletions
|
|
@ -550,6 +550,21 @@
|
|||
},
|
||||
`⏰ ${c.pending_reminders}`));
|
||||
}
|
||||
if (c.ctx_tokens != null) {
|
||||
// Colour thresholds mirror the harness compaction watermarks:
|
||||
// < 100k = safe (green), 100k–150k = approaching reset (yellow),
|
||||
// ≥ 150k = compact territory (red).
|
||||
const k = Math.round(c.ctx_tokens / 1000);
|
||||
const ctxClass = c.ctx_tokens >= 150_000 ? 'badge-ctx-warn'
|
||||
: c.ctx_tokens >= 100_000 ? 'badge-ctx-caution'
|
||||
: 'badge-ctx-ok';
|
||||
head.append(el('span',
|
||||
{
|
||||
class: `badge ${ctxClass}`,
|
||||
title: `last turn context size: ${c.ctx_tokens.toLocaleString()} tokens`,
|
||||
},
|
||||
`ctx·${k}k`));
|
||||
}
|
||||
li.append(head);
|
||||
|
||||
// ── line 2: action buttons ───────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue