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:
parent
016caaa3d2
commit
dc11b0c414
3 changed files with 7 additions and 100 deletions
|
|
@ -201,8 +201,7 @@ strip entries — `📊 stats`, `🖥 screen` when GUI is enabled, plus any
|
|||
agent-declared `dashboardLinks` extras), `status_text` / `status_set_at` (agent
|
||||
self-reported status — the `(set N ago)` chip carries a `data-set-at`
|
||||
stamp and ticks every 30s to stay fresh across the long-lived keyed row
|
||||
cache), `rate_limited`, `ctx_tokens` / `context_window_tokens`
|
||||
(context-window badge data). hive-agent is the single source
|
||||
cache), `rate_limited`. hive-agent is the single source
|
||||
of truth for all of these. The dashboard resolves each `AgentLink.kind`
|
||||
against a per-agent base URL depending on whether hive-gateway is in
|
||||
front (`StateSnapshot.gateway_enabled`, sourced from the
|
||||
|
|
@ -225,8 +224,7 @@ as a unit.
|
|||
**When the container is stopped** (`ContainerView.running = false`),
|
||||
the dashboard skips the async `dashboard-state` fetch entirely (the agent
|
||||
web server is down), so a single badge replaces the badge chain,
|
||||
the nav strip is empty, and status text / rate-limited / ctx
|
||||
badges disappear. The agent icon goes straight to the dimmed
|
||||
the nav strip is empty, and status text and the rate-limited badge disappear. The agent icon goes straight to the dimmed
|
||||
`/favicon.svg` fallback instead of attempting a doomed load from the
|
||||
container's URL. Static fields — `pending_reminders`, `parent`, `config` link — remain visible
|
||||
regardless of run state.
|
||||
|
|
@ -258,7 +256,7 @@ start / stop / restart / rebuild / destroy). An agent can carry
|
|||
running alongside a `stop_for_update` on the same agent — and each
|
||||
renders as its own independent badge instead of collapsing
|
||||
into one label, matching the existing multi-badge convention this
|
||||
line already uses for `paused`/model/ctx.
|
||||
line already uses for `paused`.
|
||||
|
||||
Any pending badge means the row is actually **running** something
|
||||
right now (see **Pending-badge derivation** below); every row
|
||||
|
|
@ -295,24 +293,6 @@ banner below is the only queued-work indicator on this tab, and it
|
|||
reads the narrow `/api/jobq/rollup` endpoint rather than the full
|
||||
graph.
|
||||
|
||||
**Active model badge** (`model · <name>`, blue) appears when the
|
||||
container is running and the harness has persisted a model name (the
|
||||
`active_model` field of `hyperhive-harness.json`, the consolidated
|
||||
harness state file in the agent's state dir). Read by hive-c0re's
|
||||
`ContainerView` (`read_active_model`); absent until the agent has
|
||||
completed at least one turn, and hive-c0re suppresses stale values
|
||||
for stopped containers.
|
||||
|
||||
**`ctx · Nk` chip** shows the agent's last-turn context size,
|
||||
populated from `DashboardState.ctx_tokens` (absent until the
|
||||
agent has completed at least one turn). The chip colour (green /
|
||||
yellow / red) keys off `DashboardState.context_window_tokens`
|
||||
(the real context window for the model the agent last ran on,
|
||||
authoritative from the agent side); the badge goes yellow ≥ 50%
|
||||
and red ≥ 75% of that window, matching the harness compaction
|
||||
watermarks. When the window value is absent the badge falls back
|
||||
to fixed 100k / 150k thresholds.
|
||||
|
||||
**Per-agent `⋮` overflow menu** — a `⋮` button appears on the right
|
||||
edge of each container row. Selecting it opens a small dropdown with
|
||||
per-agent actions and navigation links. Contents:
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue