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 ───────────────────────────────────
|
||||
|
|
|
|||
|
|
@ -123,6 +123,20 @@ a:hover {
|
|||
color: var(--cyan); border-color: var(--cyan);
|
||||
text-shadow: 0 0 6px rgba(137, 220, 235, 0.4);
|
||||
}
|
||||
/* Context-window usage badges on dashboard container rows.
|
||||
Green < 100k, yellow 100–150k, red ≥ 150k (mirrors harness watermarks). */
|
||||
.badge-ctx-ok {
|
||||
color: var(--green); border-color: var(--green);
|
||||
opacity: 0.85;
|
||||
}
|
||||
.badge-ctx-caution {
|
||||
color: var(--amber); border-color: var(--amber);
|
||||
text-shadow: 0 0 6px rgba(250, 179, 135, 0.5);
|
||||
}
|
||||
.badge-ctx-warn {
|
||||
color: var(--red); border-color: var(--red);
|
||||
text-shadow: 0 0 6px rgba(243, 139, 168, 0.5);
|
||||
}
|
||||
.container-row.tombstone {
|
||||
border-style: dashed;
|
||||
background: rgba(24, 24, 37, 0.35);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue