feat(health): System Health in three groups, a score that sees lag; admin user detail

Dashboard → System Health is grouped into AgentHub, Machine and Agent
activity. The machine (GET /api/host, every signed-in user) is drawn by
components/health/HostHealth.tsx: host card beside the CPU/memory history,
then CPU (threads as compact cells + temperatures/GPUs), disks & network,
busiest processes, and per-user tiles. Concurrency bars each show their own
agent type on hover.

The Health Score (client/src/lib/healthScore.ts) is now 100 minus what each
check costs, between an amber and a red threshold: event-loop p99
(server/lib/loop-delay.js, shared with /api/metrics), Linux PSI pressure for
CPU, memory and disk I/O (/api/host `pressure`; load per core without PSI),
RAM, the database's disk, V8 heap, hooks silent while agents work, and agent
errors in the last 24 h. All-time success rate, API errors and the transcript
cache hit rate no longer count. /api/settings/info adds server.event_loop and
activity {last_event_at, working_agents, agents_24h}.

Administration: a user row opens its detail in place (GET
/api/users/:id/details — spend, account pool share, live panes, workspaces,
newest sessions); the server panel is gone, member tmux folded into the table;
the Sessions list shows each row's owner in server mode.
This commit is contained in:
2026-10-27 16:39:38 +07:00
parent df15789982
commit 1c6dfea5b5
49 changed files with 5154 additions and 1971 deletions
+35
View File
@@ -247,6 +247,15 @@ function createOpenApiSpec() {
"The AI coding CLI that produced the session: `claude` (Claude Code's hooks and imported transcripts), `codex` (Codex's rollout journals and its opt-in hooks) `antigravity` (agy's conversation files and its opt-in hooks) or `cursor` (Cursor's agent transcripts — sessions only, no tokens).",
},
agent_count: { type: "integer", nullable: true },
owner_id: {
type: "integer",
nullable: true,
description:
"Server mode, list only: the account owning the session's workspace (its lane, else the lane of a dashboard run holding it); null when none. Absent in local mode.",
},
owner_name: { type: "string", nullable: true, description: "That owner's username." },
owner_display_name: { type: "string", nullable: true },
owner_avatar_at: { type: "string", format: "date-time", nullable: true },
last_activity: { type: "string", format: "date-time", nullable: true },
cost: { type: "number", nullable: true },
awaiting_input_since: {
@@ -1234,6 +1243,32 @@ function createOpenApiSpec() {
node_version: { type: "string" },
platform: { type: "string" },
ws_connections: { type: "integer" },
event_loop: {
type: "object",
description:
"Event-loop delay over the last minute in ms (p50, p99, max) — how long requests, hooks and terminal echo waited.",
properties: {
p50: { type: "number" },
p99: { type: "number" },
max: { type: "number" },
},
},
},
},
activity: {
type: "object",
description:
"For the System Health score: when the newest event (hook) landed, agents working now, and how the agents that ended in the last 24 h ended (scoped to the caller's rows).",
properties: {
last_event_at: { type: "string", nullable: true },
working_agents: { type: "integer" },
agents_24h: {
type: "object",
properties: {
completed: { type: "integer" },
error: { type: "integer" },
},
},
},
},
transcript_cache: {