Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: show agent freshness and failures where the operator looks, page titles, try again, and stale-data notes

An agent card shows its freshness (stale with the last report's age, never reported, not in swarm identity) when it is not fresh, so the status filter has a visible reason. A failed state change shows its reason in a panel under the card, and a failed cancel shows its reason in the badge, instead of a hover title. Pages can set their title (usePageTitle) and the flow editor does, so several editor tabs differ; the 404 links home. The claude login dialog offers try again after a failure, announces its wait, and has a per-agent field id. The create-agent tabs go forward again as far as the operator has been, but not past a step that is invalid now (lastReachableStep, tested), and the disabled next and create buttons say why in a hint they are described by. usePolled reports when the last live answer arrived, and StaleNote says how old a list is under a failed refresh, or that it is the answer saved from the last visit, on the alerts, builds, review runs, hives, schedules and flows lists.
This commit is contained in:
iris 2026-11-19 18:59:20 +01:00 • committed by mara
commit 679d2ee420

View file

@ -14,6 +14,7 @@
// `<button>`s) from also toggling the card. The wanted menu carries the destroy
// option here, since no detail row repeats it any more.
import { useState } from "preact/hooks";
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { Badge } from "@hive/shared/badge.js";
import { TerminalIcon } from "@hive/shared/icons.js";
import { Card } from "../../ui/card/Card.js";
@ -23,7 +24,9 @@ import { ClaudeLoginDialog } from "../claude-login/ClaudeLoginDialog.js";
import { AgentDetail } from "../detail/AgentDetail.js";
import { StatusMessage } from "../detail/StatusMessage.js";
import { termPaths } from "../terminal/term-paths.js";
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
import {
FRESHNESS,
hivePauseReason,
isUpdating,
showsLoginNeeded,
@ -67,6 +70,30 @@ export function AgentCard({
name={<span class="ui-agent-card-name">{row.name}</span>}
status={
<>
{row.freshness !== "fresh" ? (
<Badge
tone={FRESHNESS[row.freshness].tone}
title={
row.freshness === "unknown"
? "reported by its hive but not registered in swarm-level identity — needs migration"
: row.freshness === "stale"
? "the hive has not reported this agent lately"
: "the hive has never reported this agent"
}
value={
<>
{FRESHNESS[row.freshness].label}
{row.freshness === "stale" &&
row.last_seen_unix !== null ? (
<>
{" "}
(<RelativeTime epochMs={row.last_seen_unix * 1000} />)
</>
) : null}
</>
}
/>
) : null}
{isUpdating(row) ? (
<Badge
tone="accent"
@ -127,18 +154,17 @@ export function AgentCard({
onSelectPaused={actions.selectPaused}
onDestroy={actions.requestDestroy}
/>
{error ? (
<Badge
tone="negative"
value="failed"
title={error.detail ?? "the declaration failed"}
/>
) : null}
</span>
}
message={<StatusMessage snapshot={row.snapshot} />}
chevron={<span class="ui-agent-card-chevron" aria-hidden="true" />}
/>
{error ? (
<ApiErrorPanel
context={`changing ${row.name}'s state failed`}
problem={error}
/>
) : null}
{open ? (
<div class="ui-agent-card-detail">
<AgentDetail row={row} actions={actions} withTerminal inCard />