Repository navigation
v0.31.2 — Navbar machine stats & a context bar for every provider
Two navbar upgrades: the TUI title row now shows live machine stats
(CPU %, system RAM %, tagent's own RSS — sampled every 2 s), and the
context bar works for EVERY provider. Unknown models / custom providers
used to resolve a context window of 0 — which hid the bar entirely; the
display now falls back to an assumed 128k window, marked so you always
know what's real and what's estimated.
Added — machine stats in the navbar
- new perf-stats.ts — PerfSampler: cpu % (delta between os.cpus()
snapshots), system RAM % (freemem/totalmem), tagent's own RSS; a 2 s
unref'd interval, O(1) get(), and a sample older than 15 s is
recomputed on read (a suspended laptop no longer shows frozen numbers) - the stats ride the title row's free dash space (roundBox titleRight,
shown at boxW>=58): "🖥 12% · 💾 62% · 210M" — the border row stays
EXACTLY boxW wide, hard-truncated both sides, never wrapped (the
v0.31.1 sticky-math lesson applied from the start) - numbers stay quiet by default — they only take color at cpu>=70% or
RAM>=80% (the bar that matters when the machine is choking)
Added — a context bar for every provider
- the gap, proven: modelContextWindow("custom", "mystery-model-v9")
resolved 0 — custom providers and unlisted models showed NO context
bar at all, while the loop already emitted estimated usage every turn - new ASSUMED_CONTEXT_WINDOW = 128_000 (core/context.ts): the display
falls back to it when the catalog, the registry and
TAGENT_CONTEXT_WINDOW all miss — marked "128k"; estimated usage is" too ("~12.3k/~128k [█░] 10%")
marked " - precedence unchanged: TAGENT_CONTEXT_WINDOW and every real
catalog/registry value always beat the assumption — a known model
never gets a "~" it didn't earn
Fixed — the bar survives (priority + hot-path)
- hint-row priority fit: a long custom model id shrinks first (down to
4 cols) instead of crowding the context bar out of the row - navbar footer ladder: segments shrink or drop in the order ws →
model → -dev → -mcp → -ws → -model before the bar ever does — mode ·
bar · clock survive at every width (verified live at 50 cols) - host.contextInfo() gains a 500 ms cache — the estimated-usage path
walked every session message and read zai-models.json per frame (a
per-render hot path; a perf fix as much as a feature)
/stats & tests
- /stats grows a machine row (cpu · ram · rss · uptime) plus the
"(window assumed 128k)" / "(used estimated)" markers, so the numbers
in the navbar are explainable - new scripts/test-perf-stats.ts — 37 checks: sampler lifecycle
(start/stop/stale-recompute), roundBox exact-width invariants,
bar markers, the gap proof, the host fallback chain (unknown → assumed
128k · glm → 131072 · env wins · fromLoop usage with no window), live
TUI frames at 80/120/50 cols - regression battery green: render-guard 27 · memory-profile 24 ·
glitch-proof.py live-pty 6/6 (the render guard holds with the new
navbar); tsc 117 = baseline, 0 new; PTY suite 10/11 — the one fail
("model list view") is pre-existing on a clean stash, recorded known
Upgrade note
- drop-in: nothing to configure — the stats appear at boxW>=58, the
context bar appears for every provider; if you know the real window
of an unlisted model, TAGENT_CONTEXT_WINDOW= beats the
assumption