dashboard: derive ctx badge thresholds from the model context window

This commit is contained in:
iris 2026-05-21 22:52:32 +02:00 committed by Mara
parent cbd4b71322
commit 4a27ef7304
4 changed files with 122 additions and 26 deletions

View file

@ -186,6 +186,13 @@ guess from container state.
`ctx · Nk` chip showing the agent's last-turn context size
(from `ContainerView.ctx_tokens`, read from the turn-stats
sqlite on each `build_all` sweep; absent until the first turn).
The chip colour (green / yellow / red) is keyed off the model's
real context window: `build_all` resolves the last turn's model
against the host's per-model `contextWindowTokens` config and
exposes it as `ContainerView.context_window_tokens`; the badge
goes yellow ≥ 50% and red ≥ 75% of that window (the harness
compaction watermarks). When the window can't be resolved the
badge falls back to fixed 100k / 150k thresholds. (issue #66)
- Line 2: action buttons — `↻ R3BU1LD` always, `DESTR0Y` + `PURG3`
on sub-agents, `↺ R3ST4RT` + (sub-agents) `■ ST0P` when running,
`▶ ST4RT` when stopped. Buttons dim + disable while a transient