extract ctx token thresholds into named constants
This commit is contained in:
parent
de13e80082
commit
808b9cbe1a
1 changed files with 9 additions and 5 deletions
|
|
@ -3,6 +3,13 @@
|
||||||
// and tails the unified dashboard event channel over `/dashboard/stream`.
|
// and tails the unified dashboard event channel over `/dashboard/stream`.
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
|
// ─── constants ──────────────────────────────────────────────────────────
|
||||||
|
// Context-window token thresholds — mirror the harness compaction watermarks
|
||||||
|
// in hive-ag3nt (HIVE_COMPACT_WATERMARK_TOKENS = 150k; auto-reset at 100k).
|
||||||
|
// TODO: source these from model metadata once damocles lands that feature.
|
||||||
|
const CTX_WARN_TOKENS = 150_000; // ≥ this → compact territory (red)
|
||||||
|
const CTX_CAUTION_TOKENS = 100_000; // ≥ this → approaching reset (yellow)
|
||||||
|
|
||||||
// ─── helpers ────────────────────────────────────────────────────────────
|
// ─── helpers ────────────────────────────────────────────────────────────
|
||||||
const $ = (id) => document.getElementById(id);
|
const $ = (id) => document.getElementById(id);
|
||||||
const esc = (s) => String(s).replace(/[&<>"]/g, (c) =>
|
const esc = (s) => String(s).replace(/[&<>"]/g, (c) =>
|
||||||
|
|
@ -551,12 +558,9 @@
|
||||||
`⏰ ${c.pending_reminders}`));
|
`⏰ ${c.pending_reminders}`));
|
||||||
}
|
}
|
||||||
if (c.ctx_tokens != null) {
|
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 k = Math.round(c.ctx_tokens / 1000);
|
||||||
const ctxClass = c.ctx_tokens >= 150_000 ? 'badge-ctx-warn'
|
const ctxClass = c.ctx_tokens >= CTX_WARN_TOKENS ? 'badge-ctx-warn'
|
||||||
: c.ctx_tokens >= 100_000 ? 'badge-ctx-caution'
|
: c.ctx_tokens >= CTX_CAUTION_TOKENS ? 'badge-ctx-caution'
|
||||||
: 'badge-ctx-ok';
|
: 'badge-ctx-ok';
|
||||||
head.append(el('span',
|
head.append(el('span',
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue