Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: the terminal's status badges overhaul

The connection is a light on the agent's icon instead of a "live" badge, the
model and the effort are one badge, the context badge has an icon, subagents
and a new bash tasks badge are an icon and a count, and an agent's tab shows a
drag grip on hover.

It also removes two things the overhaul replaces: the cost badge, and the
"split" badge with its menu in group panes (splitting is by dragging a tab, or
from the subagents list).
This commit is contained in:
iris 2026-11-16 23:40:59 +01:00 • committed by mara
commit 3a846c8c45

View file

@ -0,0 +1,52 @@
// <BashTasksMenu> — the agent's background bash tasks as a badge in the terminal
// header: a prompt icon and the number running, and the list of tasks (the same
// one the agent card's "background tasks" section shows) in a popover under it.
// Nothing shows for an agent with no tasks, and nothing before the first answer;
// a failed fetch shows its reason in the open list.
import { useRef, useState } from "preact/hooks";
import { Badge } from "@hive/shared/badge.js";
import { TerminalIcon } from "@hive/shared/icons.js";
import { Panel } from "../../ui/panel/Panel.js";
import { Popover } from "../../ui/popover/Popover.js";
import { BashTasksList } from "./BashTasks.js";
import { isLive, runningTasksLabel } from "./bash-tasks.js";
import { useBashTasks } from "./useBashTasks.js";
export function BashTasksMenu({ agentName }: { agentName: string }) {
const { tasks, error } = useBashTasks(agentName);
const [open, setOpen] = useState(false);
const anchorRef = useRef<HTMLSpanElement>(null);
if (!error && (tasks === null || tasks.length === 0)) return null;
const running = (tasks ?? []).filter(isLive).length;
const label = runningTasksLabel(tasks ?? []);
return (
<>
<span ref={anchorRef}>
<Badge
icon={<TerminalIcon />}
value={running}
tone={running > 0 ? "positive" : "neutral"}
ariaLabel={label}
title={`${label}: ${open ? "close" : "open"} ${agentName}'s bash tasks`}
expanded={open}
onClick={() => setOpen((o) => !o)}
/>
</span>
<Popover
open={open}
onClose={() => setOpen(false)}
anchorRef={anchorRef}
label={`${agentName}'s bash tasks`}
>
<Panel
title={`${agentName}'s bash tasks`}
onClose={() => setOpen(false)}
>
<BashTasksList agentName={agentName} tasks={tasks} error={error} />
</Panel>
</Popover>
</>
);
}