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
17 changed files with 430 additions and 199 deletions

View file

@ -22,7 +22,6 @@ export function AgentStateRow({ agent }: { agent: string }) {
<StateBadges
header={header}
ctx={tokenTotal(header.ctx_usage)}
cost={tokenTotal(header.cost_usage)}
withModel={false}
/>
) : (

View file

@ -1,7 +1,8 @@
import { Badge, type BadgeTone } from "@hive/shared/badge.js";
import { ChipIcon, GaugeIcon } from "@hive/shared/icons.js";
import { BadgePopover } from "../../ui/badge-popover/BadgePopover.js";
import { AgentInference } from "../detail/AgentInference.js";
import { effortTitle, modelTitle } from "./badge-titles.js";
import { inferenceTitle } from "./badge-titles.js";
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
import {
useSwarmAgentStateStream,
@ -42,24 +43,25 @@ function fmtTokens(n: number): string {
return String(n);
}
// Turn state, agent state, model, ctx and cost, as the badges beside the
// connection one. Siblings only, no wrapper: they sit in the caller's row.
// Turn state, agent state, the model with its effort, and the context size, as
// the badges beside the connection one. Siblings only, no wrapper: they sit in
// the caller's row. The model and the effort are one badge, "opus (high)", and
// there is no cost badge: the cost is a metric in Grafana.
export function StateBadges({
header,
ctx,
cost,
withModel = true,
agent,
}: {
header: NonNullable<ReturnType<typeof useSwarmAgentStateStream>["header"]>;
ctx: number | null;
cost: number | null;
// Off where the model is shown beside them, as in the details table.
withModel?: boolean;
// The agent whose settings the model and effort badges open in a popover
// when clicked. Omitted: the badges only display.
// The agent whose settings the model badge opens in a popover when clicked.
// Omitted: the badge only displays.
agent?: string;
}) {
const model = `${header.model} (${header.effort})`;
return (
<>
<Badge
@ -85,32 +87,25 @@ export function StateBadges({
{withModel &&
(agent === undefined ? (
<Badge
label="model"
value={header.model}
title={modelTitle(header.resolved_model, false)}
icon={<ChipIcon />}
value={model}
title={inferenceTitle(
header.resolved_model,
header.effort_source,
false,
)}
ariaLabel={`model ${model}`}
/>
) : (
<BadgePopover
label="model"
value={header.model}
title={modelTitle(header.resolved_model, true)}
popoverLabel={`${agent} inference settings`}
>
<AgentInference agent={agent} />
</BadgePopover>
))}
{withModel &&
(agent === undefined ? (
<Badge
label="effort"
value={header.effort}
title={effortTitle(header.effort_source, false)}
/>
) : (
<BadgePopover
label="effort"
value={header.effort}
title={effortTitle(header.effort_source, true)}
icon={<ChipIcon />}
value={model}
title={inferenceTitle(
header.resolved_model,
header.effort_source,
true,
)}
ariaLabel={`model ${model}`}
popoverLabel={`${agent} inference settings`}
>
<AgentInference agent={agent} />
@ -118,16 +113,10 @@ export function StateBadges({
))}
{ctx !== null && (
<Badge
label="ctx"
icon={<GaugeIcon />}
value={fmtTokens(ctx)}
title="tokens used in the current context window"
/>
)}
{cost !== null && (
<Badge
label="cost"
value={fmtTokens(cost)}
title="cumulative tokens billed across the last turn"
ariaLabel={`context ${fmtTokens(ctx)} tokens`}
/>
)}
</>

View file

@ -1,22 +1,19 @@
// The tooltips of the model and effort badges in an agent's terminal header.
// Clickable ones, which open the agent's inference settings, say so; the plain
// ones, on a subagent's terminal and in the details table, only say where the
// value comes from.
// The tooltip of the model badge in an agent's terminal header, which names the
// model and the effort together. A clickable one, which opens the agent's
// inference settings, says so; the plain one, on a subagent's terminal and in
// the details table, only says where the values come from.
const OPENS = "Click for the inference settings";
/** The model badge's tooltip: what the alias resolved to, when known. */
export function modelTitle(
/**
* What the alias resolved to, when known, and where the effort comes from.
*/
export function inferenceTitle(
resolvedModel: string | null | undefined,
effortSource: string,
clickable: boolean,
): string | undefined {
const resolved = resolvedModel ? `resolved to ${resolvedModel}` : undefined;
if (!clickable) return resolved;
return resolved ? `${resolved}. ${OPENS}` : OPENS;
}
/** The effort badge's tooltip: where the effort comes from. */
export function effortTitle(source: string, clickable: boolean): string {
const from = `set by: ${source}`;
): string {
const resolved = resolvedModel ? `resolved to ${resolvedModel}; ` : "";
const from = `${resolved}effort set by: ${effortSource}`;
return clickable ? `${from}. ${OPENS}` : from;
}

View file

@ -79,13 +79,13 @@
this: with the base padding, "thinking"/"model sonnet" sat directly
on top of the terminal's first line whenever content started right
at the top (a running preview scrolled to the newest rows almost
always does). One badge row: the connection badge and the expand
always does). One badge row: the connection light and the expand
trigger, each keeping the 2.75em touch-target floor. */
padding-block-start: 3.4em;
}
/* The floating row over the terminal's top edge: the connection badge
(and on the full tab turn_state/agent_state/model/ctx/cost) on the left, the
/* The floating row over the terminal's top edge: the connection light
(and on the full tab turn_state/agent_state/model/ctx) on the left, the
expand trigger on the right. Positioned by `.terminal-wrap`'s own
`position: relative`, same anchor `@hive/shared/terminal.css`'s
`.tail-pill` uses, which anchors bottom-right and so never competes for

View file

@ -8,7 +8,7 @@
// component the per-hive local terminal uses — "share components between hive and swarm level
// term as much as possible" (mara).
//
// **Floating header badges** — turn state / model / ctx / cost parity
// **Floating header badges** — turn state / model / ctx parity
// with the per-agent page's own `StatusChips` — mara: "dont make it a
// header though - make it floating elements on top of the terminal", so
// this is a small `Badge` cluster pinned to the terminal box's own
@ -18,7 +18,7 @@
// has its own control surface (`WantedMenu` on `AgentsPage`), so nothing
// here needs to be interactive. Sourced from `useSwarmAgentStateStream`,
// not from `AgentRow` — the roster fetch `AgentsPage` already did has no
// notion of turn_state/model/ctx/cost, only `wanted`/`snapshot.running`.
// notion of turn_state/model/ctx, only `wanted`/`snapshot.running`.
// Only the full-tab mount (`fullHeight`) shows the state badges: the small
// preview in an opened card stays free of them (mara: "the preview is small
// and should not be encroached further with badges on top, but for the full
@ -34,7 +34,7 @@
// already IS the destination, so it has nothing further to expand to.
import { useLayoutEffect, useRef, useState } from "preact/hooks";
import type { ComponentChildren } from "preact";
import { Badge, type BadgeTone } from "@hive/shared/badge.js";
import { Badge } from "@hive/shared/badge.js";
import { ExpandIcon } from "@hive/shared/icons.js";
import { Row } from "@hive/shared/term-row.js";
import { useDynamicTabs } from "../../shell/useDynamicTabs.js";
@ -45,26 +45,13 @@ import {
import { useSwarmAgentStateStream } from "./useSwarmAgentStateStream.js";
import { termPaths } from "./term-paths.js";
import { StateBadges, tokenTotal } from "../state/StateBadges.js";
import { CONNECTION_LABEL, ConnectionDot } from "./ConnectionDot.js";
import { AgentInputForm } from "./AgentInputForm.js";
import { CancelTurnBadge } from "./CancelTurnBadge.js";
import "./AgentTermPreview.css";
const NEAR_BOTTOM_PX = 48;
const CONNECTION_LABEL: Record<ConnectionState, string> = {
connecting: "connecting…",
open: "live",
reconnecting: "reconnecting…",
closed: "disconnected",
};
const CONNECTION_TONE: Record<ConnectionState, BadgeTone> = {
connecting: "neutral",
open: "positive",
reconnecting: "warning",
closed: "negative",
};
export function AgentTermPreview({
agentName,
subagent,
@ -79,9 +66,10 @@ export function AgentTermPreview({
// The full-tab mount: fills the tab, has no expand trigger, and shows the
// agent's state badges beside the connection one.
fullHeight?: boolean;
// A badge ahead of the connection badge, for the full-tab mount's
// link back to the agent's details.
leading?: ComponentChildren;
// The badges ahead of the state ones, for the full-tab mount's link back to
// the agent's details. Given the connection, which it shows as a light on the
// name badge. Without it the connection is a light of its own.
leading?: (connection: ConnectionState) => ComponentChildren;
// Icon-only badges in the top right corner, for the full-tab mount's own
// controls (a group pane's maximize and close).
trailing?: ComponentChildren;
@ -98,7 +86,6 @@ export function AgentTermPreview({
const [stickToBottom, setStickToBottom] = useState(true);
const ctx = header ? tokenTotal(header.ctx_usage) : null;
const cost = header ? tokenTotal(header.cost_usage) : null;
function handleScroll() {
const el = logRef.current;
@ -130,11 +117,11 @@ export function AgentTermPreview({
it has no expand trigger. */}
<div class="ui-agent-term-preview-controls">
<div class="ui-agent-term-preview-header-badges">
{leading}
<Badge
tone={CONNECTION_TONE[connection]}
value={CONNECTION_LABEL[connection]}
/>
{leading ? (
leading(connection)
) : (
<ConnectionDot connection={connection} />
)}
{connection === "closed" && (
<Badge
variant="quiet"
@ -150,7 +137,6 @@ export function AgentTermPreview({
<StateBadges
header={header}
ctx={ctx}
cost={cost}
agent={subagent === undefined ? agentName : undefined}
/>
)}

View file

@ -8,12 +8,31 @@
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { Hint } from "../../ui/hint/Hint.js";
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
import { isLive, runningTasksLabel, stateWord } from "./bash-tasks.js";
import type { ProblemDetails } from "@hive/shared/api-error.js";
import {
isLive,
runningTasksLabel,
stateWord,
type BashTask,
} from "./bash-tasks.js";
import { useBashTasks } from "./useBashTasks.js";
import "./BashTasks.css";
export function BashTasks({ agentName }: { agentName: string }) {
const { tasks, error } = useBashTasks(agentName);
return <BashTasksList agentName={agentName} tasks={tasks} error={error} />;
}
/** The list for a fetch already made, so a badge and its popover share one poll. */
export function BashTasksList({
agentName,
tasks,
error,
}: {
agentName: string;
tasks: BashTask[] | null;
error: ProblemDetails | null;
}) {
return (
<section class="ui-bash-tasks" aria-label={`${agentName}'s bash tasks`}>
{error && (

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>
</>
);
}

View file

@ -0,0 +1,47 @@
.ui-conn-dot {
display: inline-block;
width: 0.65em;
height: 0.65em;
flex: none;
border-radius: 50%;
background: var(--muted);
box-shadow: 0 0 0 2px color-mix(in srgb, var(--bg) 70%, transparent);
}
.ui-conn-dot-open {
background: var(--green);
box-shadow:
0 0 0 2px color-mix(in srgb, var(--bg) 70%, transparent),
0 0 6px var(--green);
}
.ui-conn-dot-connecting,
.ui-conn-dot-reconnecting {
background: var(--amber);
}
.ui-conn-dot-closed {
background: var(--red);
}
/* On the corner of the icon: the light sits half over its bottom-right edge. */
.ui-live-icon {
position: relative;
display: inline-flex;
}
.ui-conn-dot-on-icon {
position: absolute;
right: -0.2em;
bottom: -0.2em;
}
@media (prefers-reduced-motion: no-preference) {
.ui-conn-dot-connecting,
.ui-conn-dot-reconnecting {
animation: ui-conn-dot-pulse 1.2s ease-in-out infinite;
}
}
@keyframes ui-conn-dot-pulse {
50% {
opacity: 0.45;
}
}
/* Alone in a terminal's top corner, with room around it. */
.ui-agent-term-preview-controls .ui-conn-dot:not(.ui-conn-dot-on-icon) {
margin: 0.55em 0 0 0.55em;
}

View file

@ -0,0 +1,52 @@
// The connection of a terminal's stream as an indicator light: green when it is
// live, amber while it connects or reconnects, red when it is closed. It says
// what the "live" badge said, in less room. Beside an agent's name it sits on the
// corner of the name badge's icon (`LiveAgentIcon`); alone, it stands for the
// connection badge of a terminal that has no name badge.
import { AgentIcon } from "../AgentIcon.js";
import type { ConnectionState } from "./useSwarmTermStream.js";
import "./ConnectionDot.css";
export const CONNECTION_LABEL: Record<ConnectionState, string> = {
connecting: "connecting…",
open: "live",
reconnecting: "reconnecting…",
closed: "disconnected",
};
export function ConnectionDot({
connection,
onIcon = false,
}: {
connection: ConnectionState;
/** Drawn on the corner of an icon rather than as a light of its own. */
onIcon?: boolean;
}) {
return (
<span
class={
`ui-conn-dot ui-conn-dot-${connection}` +
(onIcon ? " ui-conn-dot-on-icon" : "")
}
role="img"
aria-label={CONNECTION_LABEL[connection]}
title={CONNECTION_LABEL[connection]}
/>
);
}
/** An agent's icon with the connection light on its corner. */
export function LiveAgentIcon({
name,
connection,
}: {
name: string;
connection: ConnectionState;
}) {
return (
<span class="ui-live-icon">
<AgentIcon name={name} small />
<ConnectionDot connection={connection} onIcon />
</span>
);
}

View file

@ -1,5 +1,5 @@
// <SubagentsMenu> — "N running subagents" in the full-screen terminal page's
// header: a badge that opens a list of the agent's subagents, each a link to
// <SubagentsMenu> — a branching icon and the number of running subagents in the
// full-screen terminal page's header: a badge that opens a list of the agent's subagents, each a link to
// its own terminal page. On a subagent's page the current one is marked and the
// list starts with a way back to the agent's own terminal. The list is the
// same `GET /api/agents/{name}/subagents` as the one under the preview, and
@ -17,6 +17,7 @@ import { useRef, useState } from "preact/hooks";
import { Link } from "wouter-preact";
import { ApiErrorPanel } from "@hive/shared/api-error-panel.js";
import { Badge } from "@hive/shared/badge.js";
import { SubagentsIcon } from "@hive/shared/icons.js";
import { Panel } from "../../ui/panel/Panel.js";
import { Popover } from "../../ui/popover/Popover.js";
import { RelativeTime } from "../../ui/relative-time/RelativeTime.js";
@ -121,9 +122,11 @@ export function SubagentsMenu({
<>
<span ref={anchorRef}>
<Badge
value={runningLabel(running.length)}
icon={<SubagentsIcon />}
value={running.length}
tone={running.length > 0 ? "positive" : "neutral"}
title={`${open ? "close" : "open"} ${agentName}'s subagents`}
ariaLabel={runningLabel(running.length)}
title={`${runningLabel(running.length)}: ${open ? "close" : "open"} ${agentName}'s subagents`}
expanded={open}
onClick={() => setOpen((o) => !o)}
/>

View file

@ -11,25 +11,6 @@
.ui-agent-group-grip {
cursor: grab;
}
.ui-agent-group-menu {
list-style: none;
margin: 0;
padding: 0;
display: grid;
gap: 0.4em;
}
.ui-agent-group-menu li {
display: flex;
align-items: center;
gap: 0.5em;
}
.ui-agent-group-menu-name {
flex: 1;
}
.ui-agent-group-menu-empty {
margin: 0;
max-width: 22em;
}
.ui-agent-group-missing {
padding: 2em;
}

View file

@ -13,9 +13,10 @@ import { useEffect } from "preact/hooks";
import { useLocation, type RouteComponentProps } from "wouter-preact";
import { Badge } from "@hive/shared/badge.js";
import { CloseIcon, ExpandIcon } from "@hive/shared/icons.js";
import { AgentIcon } from "../../agent/AgentIcon.js";
import { SubagentsMenu } from "../../agent/terminal/SubagentsMenu.js";
import { AgentTermPreview } from "../../agent/terminal/AgentTermPreview.js";
import { BashTasksMenu } from "../../agent/terminal/BashTasksMenu.js";
import { LiveAgentIcon } from "../../agent/terminal/ConnectionDot.js";
import { termPaths } from "../../agent/terminal/term-paths.js";
import {
agentsIn,
@ -27,54 +28,16 @@ import {
resizeAt,
splitKey,
splitPane,
terminalAgentOf,
type Side,
} from "../../agent/terminal/split-layout.js";
import { endAgentDrag, startAgentDrag } from "../../agent/terminal/termDrag.js";
import { fetchJson, usePolled } from "../../ui/polled/usePolled.js";
import { useTermGroups } from "../../agent/terminal/useTermGroups.js";
import { useDynamicTabs } from "../../shell/useDynamicTabs.js";
import { BadgePopover } from "../../ui/badge-popover/BadgePopover.js";
import { Button } from "../../ui/button/Button.js";
import { PaneDropTarget } from "../../ui/pane-tree/PaneDropTarget.js";
import { PaneTree } from "../../ui/pane-tree/PaneTree.js";
import "./AgentGroupPage.css";
// The split menu of a pane: the agents whose terminal tab is open and that are
// not in the group yet, each to be put beside this pane on the right or below.
function SplitMenu({
candidates,
onSplit,
}: {
candidates: string[];
onSplit: (agent: string, side: Side) => void;
}) {
return (
<BadgePopover
value="split"
title="put another agent's terminal beside this one"
popoverLabel="split this pane"
>
{candidates.length === 0 ? (
<p class="ui-agent-group-menu-empty">
Open another agent's terminal tab first, then split it in here, or
drag its tab onto a pane.
</p>
) : (
<ul class="ui-agent-group-menu">
{candidates.map((agent) => (
<li key={agent}>
<span class="ui-agent-group-menu-name">{agent}</span>
<Button onClick={() => onSplit(agent, "right")}>right</Button>
<Button onClick={() => onSplit(agent, "bottom")}>below</Button>
</li>
))}
</ul>
)}
</BadgePopover>
);
}
export function AgentGroupPage({
params,
}: RouteComponentProps<{ id: string }>) {
@ -82,7 +45,7 @@ export function AgentGroupPage({
const href = groupHref(id);
const groups = useTermGroups();
const group = groups.find(id);
const { tabs, open, close } = useDynamicTabs();
const { open, close } = useDynamicTabs();
const [, navigate] = useLocation();
const inGroup = group === undefined ? [] : agentsIn(group.root);
@ -134,10 +97,6 @@ export function AgentGroupPage({
);
}
const candidates = tabs
.map((t) => terminalAgentOf(t.href))
.filter((a): a is string => a !== null && !inGroup.includes(a));
// `key` is the pane's key: its agent, or `agent/subagent` for a subagent's.
function renderPane(key: string) {
const { agent, subagent } = splitKey(key);
@ -152,7 +111,7 @@ export function AgentGroupPage({
agentName={agent}
subagent={subagent}
fullHeight
leading={
leading={(connection) => (
<>
<span
class="ui-agent-group-grip"
@ -161,14 +120,11 @@ export function AgentGroupPage({
onDragStart={(e) => startAgentDrag(e, key)}
onDragEnd={endAgentDrag}
>
<Badge icon={<AgentIcon name={agent} small />} value={key} />
<Badge
icon={<LiveAgentIcon name={agent} connection={connection} />}
value={key}
/>
</span>
<SplitMenu
candidates={candidates}
onSplit={(other, side) =>
groups.update(id, (r) => splitPane(r, key, other, side))
}
/>
<SubagentsMenu
key={agent}
agentName={agent}
@ -184,8 +140,11 @@ export function AgentGroupPage({
)
}
/>
{subagent === undefined && (
<BashTasksMenu key={agent} agentName={agent} />
)}
</>
}
)}
trailing={
<>
<Badge

View file

@ -13,9 +13,10 @@ import { useEffect, useRef, useState } from "preact/hooks";
import type { RouteComponentProps } from "wouter-preact";
import { Badge } from "@hive/shared/badge.js";
import { AgentDetailPopover } from "../../agent/detail/AgentDetailPopover.js";
import { AgentIcon } from "../../agent/AgentIcon.js";
import { SubagentsMenu } from "../../agent/terminal/SubagentsMenu.js";
import { AgentTermPreview } from "../../agent/terminal/AgentTermPreview.js";
import { BashTasksMenu } from "../../agent/terminal/BashTasksMenu.js";
import { LiveAgentIcon } from "../../agent/terminal/ConnectionDot.js";
import { termPaths } from "../../agent/terminal/term-paths.js";
import { useAgentFavicon } from "../../agent/terminal/useAgentFavicon.js";
import {
@ -70,11 +71,11 @@ export function AgentTerminalPage({
agentName={name}
subagent={subagent}
fullHeight
leading={
leading={(connection) => (
<>
<span ref={badgeRef}>
<Badge
icon={<AgentIcon name={name} small />}
icon={<LiveAgentIcon name={name} connection={connection} />}
value={name}
title={`${detailOpen ? "close" : "open"} ${name}'s details`}
expanded={detailOpen}
@ -93,8 +94,11 @@ export function AgentTerminalPage({
open({ href: groupHref(group.id), label: groupTitle(group) });
}}
/>
{subagent === undefined && (
<BashTasksMenu key={name} agentName={name} />
)}
</>
}
)}
/>
);

View file

@ -200,6 +200,33 @@
.shell-tab-active {
border-color: var(--pink);
}
/* A tab that can be dragged onto a terminal to split it shows a grip in a gutter
of its own on hover, so the drag is discoverable. The gutter is part of the
padding, so the tab does not change size when the grip appears. */
.shell-tab-draggable {
position: relative;
padding-left: 1.3em;
cursor: grab;
}
.shell-tab-grip {
position: absolute;
left: 0.35em;
top: 50%;
display: inline-flex;
color: var(--muted);
opacity: 0;
transform: translateY(-50%);
transition: opacity 0.15s ease;
pointer-events: none;
}
.shell-tab-draggable:hover .shell-tab-grip {
opacity: 0.9;
}
@media (prefers-reduced-motion: reduce) {
.shell-tab-grip {
transition: none;
}
}
.shell-tab-link {
color: var(--muted);
text-decoration: none;

View file

@ -35,6 +35,7 @@ import { useHideDebug } from "./useHideDebug.js";
import { SettingsMenu } from "@hive/shared/settings-menu.js";
import { HideDebugSetting } from "@hive/shared/hide-debug-setting.js";
import { ShowThinkingSetting } from "@hive/shared/show-thinking-setting.js";
import { GripIcon } from "@hive/shared/icons.js";
import { ExpandDetailsSetting } from "@hive/shared/expand-details-setting.js";
import { useApplyThemeOverride } from "@hive/shared/theme-apply.js";
import { useApplyMotionOverride } from "@hive/shared/motion-apply.js";
@ -174,13 +175,25 @@ function DynamicTabLink({
const [editing, setEditing] = useState(false);
return (
<span
class={"shell-tab" + (active ? " shell-tab-active" : "")}
class={
"shell-tab" +
(active ? " shell-tab-active" : "") +
(agent !== undefined ? " shell-tab-draggable" : "")
}
title={
agent === undefined ? undefined : "drag onto a terminal to split it"
}
draggable={agent !== undefined && !editing}
onDragStart={
agent === undefined ? undefined : (e) => startAgentDrag(e, agent)
}
onDragEnd={agent === undefined ? undefined : endAgentDrag}
>
{agent !== undefined && (
<span class="shell-tab-grip" aria-hidden="true">
<GripIcon />
</span>
)}
{editing && onRename !== undefined ? (
<input
class="shell-tab-rename"

View file

@ -14,8 +14,10 @@ import "./BadgePopover.css";
export function BadgePopover({
label,
value,
icon,
tone,
title,
ariaLabel,
popoverLabel,
children,
}: {
@ -23,9 +25,13 @@ export function BadgePopover({
label?: ComponentChildren;
/** What the badge says, e.g. "7 granted". */
value: ComponentChildren;
/** A glyph before the value. */
icon?: ComponentChildren;
tone?: BadgeTone;
/** Tooltip on the badge: what clicking it does. */
title?: string;
/** The badge's accessible name, when its text is not enough of one. */
ariaLabel?: string;
/** `aria-label` of the floating box. */
popoverLabel: string;
children: ComponentChildren;
@ -38,8 +44,10 @@ export function BadgePopover({
<Badge
label={label}
value={value}
icon={icon}
tone={tone}
title={title}
ariaLabel={ariaLabel}
expanded={open}
onClick={() => setOpen((o) => !o)}
/>

View file

@ -1,27 +1,28 @@
// The model and effort badge tooltips. Run by `npm test`, which Node runs with
// its built-in test runner and type stripping.
// The model badge's tooltip. Run by `npm test`, which Node runs with its
// built-in test runner and type stripping.
import assert from "node:assert/strict";
import { test } from "node:test";
import { effortTitle, modelTitle } from "../src/agent/state/badge-titles.ts";
import { inferenceTitle } from "../src/agent/state/badge-titles.ts";
test("a plain model badge says what the alias resolved to, or nothing", () => {
assert.equal(modelTitle("claude-x-1", false), "resolved to claude-x-1");
assert.equal(modelTitle(undefined, false), undefined);
assert.equal(modelTitle("", false), undefined);
});
test("a clickable model badge says it opens the settings", () => {
test("the tooltip says what the alias resolved to and where the effort comes from", () => {
assert.equal(
modelTitle("claude-x-1", true),
"resolved to claude-x-1. Click for the inference settings",
inferenceTitle("claude-x-1", "swarm", false),
"resolved to claude-x-1; effort set by: swarm",
);
assert.equal(modelTitle(undefined, true), "Click for the inference settings");
});
test("the effort badge names its source and, when clickable, the click", () => {
assert.equal(effortTitle("swarm", false), "set by: swarm");
test("an alias that did not resolve leaves that part out", () => {
for (const resolved of [undefined, null, ""]) {
assert.equal(
inferenceTitle(resolved, "default", false),
"effort set by: default",
);
}
});
test("a clickable badge says it opens the settings", () => {
assert.equal(
effortTitle("swarm", true),
"set by: swarm. Click for the inference settings",
inferenceTitle("claude-x-1", "swarm", true),
"resolved to claude-x-1; effort set by: swarm. Click for the inference settings",
);
});