Watch
0
0
Fork
You've already forked hyperhive
0

hive ui: the container rows no longer show the active model or the context size

Removes the model pill and the ctx chip from the hive dashboard's container
rows, with their styles and the page's fingerprint field. The agent's own
status already carries context and cost in the swarm UI.
This commit is contained in:
iris 2026-11-10 19:40:07 +01:00 • committed by mara
commit dc11b0c414
2 changed files with 7 additions and 100 deletions

View file

@ -13,17 +13,6 @@ import { containersState } from "./state.js";
import { closeAllMenus } from "@hive/shared/hive-menu.js";
import "./agent-menu/hive-agent-menu.js"; // registers <hive-agent-menu> — side-effect import
// Context-window badge thresholds. Preferred source is each container's
// `context_window_tokens` from /api/state (the real window for the model
// it last ran on) — thresholds are then 75% / 50% of it, matching the
// harness compaction watermarks (compact at 75%, auto-reset at 50%). The
// fixed token constants are the fallback for when that field is absent
// (agent has no turns yet, or no per-model config matched the model).
const CTX_WARN_FRACTION = 0.75; // >= this share of the window -> red
const CTX_CAUTION_FRACTION = 0.5; // >= this share of the window -> yellow
const CTX_WARN_TOKENS = 150_000; // fallback red threshold (~= 75% of 200k)
const CTX_CAUTION_TOKENS = 100_000; // fallback yellow threshold (~= 50% of 200k)
// ─── module-level state ─────────────────────────────────────────────────────
// Keyed container row cache. Maps agent name -> { el: <li>, fingerprint }.
@ -239,7 +228,7 @@ function sortedContainerRows(containers) {
// Serialise the visible state of a container row into a stable string
// for change-detection. Includes everything that affects what the row
// renders — container fields, derived pending/selection state, and
// link-base context. The async dashboard-state (nav strip, ctx badge,
// link-base context. The async dashboard-state (nav strip,
// status text) is intentionally excluded: it populates in-place and is
// preserved when a row is reused.
function containerRowFingerprint(
@ -255,7 +244,6 @@ function containerRowFingerprint(
failed: c.failed,
paused: c.paused,
needs_login: c.needs_login,
active_model: c.active_model,
port: c.port,
pending,
opRunning,
@ -349,7 +337,7 @@ function buildContainerLi(c, opts) {
// Fetch the lean dashboard-state snapshot from the agent directly.
// Populates: nav strip links (including the screen link that
// c0re's disk-based build cannot detect), rate_limited badge,
// ctx-window badge, and self-reported status text.
// and self-reported status text.
// Fails gracefully when the agent is starting up or the gateway
// is not yet routing to it — badges simply don't appear.
// Only runs when the row is first built (fingerprint changed) —
@ -396,32 +384,6 @@ function buildContainerLi(c, opts) {
),
);
}
// ctx-window badge
if (ds.ctx_tokens != null) {
const k = Math.round(ds.ctx_tokens / 1000);
const win = ds.context_window_tokens;
const warn = win != null ? win * CTX_WARN_FRACTION : CTX_WARN_TOKENS;
const caution =
win != null ? win * CTX_CAUTION_FRACTION : CTX_CAUTION_TOKENS;
const ctxClass =
ds.ctx_tokens >= warn
? "badge-ctx-warn"
: ds.ctx_tokens >= caution
? "badge-ctx-caution"
: "badge-ctx-ok";
const title =
win != null
? `last turn context: ${ds.ctx_tokens.toLocaleString()} / ${win.toLocaleString()} ` +
`tokens (${Math.round((ds.ctx_tokens / win) * 100)}% of the window)`
: `last turn context size: ${ds.ctx_tokens.toLocaleString()} tokens`;
head.append(
el(
"span",
{ class: `hive-pill-sm ${ctxClass}`, title },
`ctx·${k}k`,
),
);
}
// -- agent status text (self-reported via set_status) ---------
if (ds.status_text) {
const nowUnix = Math.floor(Date.now() / 1000);
@ -470,7 +432,7 @@ function buildContainerLi(c, opts) {
// (an absent `failed` — an older backend — is `undefined`, falsy,
// so this degrades to the old single badge). `needs_login` is still
// c0re-owned (reads auth sentinel files on the host). rate_limited /
// ctx / status_text are agent-owned and rendered by the async
// status_text is agent-owned and rendered by the async
// dashboard-state fetch above.
if (pending.length) {
// One badge per pill — an agent can carry several transients at
@ -540,19 +502,6 @@ function buildContainerLi(c, opts) {
),
);
}
if (c.active_model) {
head.append(
el(
"span",
{
class: "hive-pill-sm badge-model",
title: `active claude model: ${c.active_model}`,
},
c.active_model,
),
);
}
body.append(head);
// Per-card action buttons (R3ST4RT / ST0P / ST4RT / R3BU1LD /
@ -671,7 +620,7 @@ export function renderContainers(s) {
let li;
if (cached && cached.fingerprint === fp) {
// Row unchanged — reuse the existing DOM node. The async
// dashboard-state (nav strip, ctx badge, status text) stays
// dashboard-state (nav strip, status text) stays
// intact from the previous build, avoiding a redundant fetch.
li = cached.el;
} else {

View file

@ -112,28 +112,6 @@ code {
border-color: var(--yellow);
background: color-mix(in srgb, var(--yellow) 10%, transparent);
}
/* Active Claude model badge on dashboard container rows. */
.badge-model {
color: var(--blue);
border-color: var(--blue);
opacity: 0.8;
}
/* Context-window usage badges on dashboard container rows. */
.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 color-mix(in srgb, var(--amber) 50%, transparent);
}
.badge-ctx-warn {
color: var(--red);
border-color: var(--red);
text-shadow: 0 0 6px color-mix(in srgb, var(--red) 50%, transparent);
}
.badge-ok {
background: color-mix(in srgb, var(--green) 12%, transparent);
color: var(--green);