Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: select a pane's name badge in a terminal group to open the agent's details

This commit is contained in:
iris 2026-11-22 17:20:03 +01:00 • committed by mara
commit 8e2844ec92
3 changed files with 73 additions and 19 deletions

View file

@ -287,11 +287,13 @@ another agent's terminal tab from the header onto the left, right, top or
bottom half of a terminal: the half it would take lights up, and the drop makes
a group of the two, with its own header tab at `/agents/group/<id>`. In a group,
the same drag onto a pane splits that pane, as many times as you like, and
dragging a pane's header badge onto another pane moves it there. A tab you can
drag shows a grip at its left edge when the pointer is over it, and its tooltip
reads "drag onto a terminal to split it." A pane can hold a subagent's
terminal (its header reads `agent/subagent`), put there by the **subagents**
badge in the pane's header. Two icon buttons sit in a pane's top right corner.
dragging a pane's header badge onto another pane moves it there. Selecting that
badge opens the agent's details in a popover, as the name badge of its own
terminal does. A tab you can drag shows a grip at its left edge when the pointer
is over it, and its tooltip reads "drag onto a terminal to split it." A pane
can hold a subagent's terminal (its header reads `agent/subagent`), put there
by the **subagents** badge in the pane's header. Two icon buttons sit in a
pane's top right corner.
**Maximize** (the arrows pointing to the corners) opens that pane's own terminal
in its tab, or goes to the tab when one is open already. **Close** (the cross)
takes the pane out of the group, and a group left with one pane goes, landing on that

View file

@ -0,0 +1,60 @@
// <GroupPaneName> — the name badge of a pane in a group of terminals. Dragging
// it moves the pane onto another pane's edge, and selecting it opens the
// agent's details in a popover under it, as the name badge of an agent's own
// terminal does. The two share one element: a click that follows no drag is the
// select, and it works from the keyboard too. It's a draggable `span`, not a
// button inside one, because Firefox starts no drag from a button.
import { useRef, useState } from "preact/hooks";
import { Badge } from "@hive/shared/badge.js";
import { AgentDetailPopover } from "../detail/AgentDetailPopover.js";
import { LiveAgentIcon } from "./ConnectionDot.js";
import { endAgentDrag, startAgentDrag } from "./termDrag.js";
export function GroupPaneName({
paneKey,
agent,
connection,
}: {
/** The pane's key: its agent, or `agent/subagent` for a subagent's. */
paneKey: string;
/** The agent whose details open; a subagent has none of its own. */
agent: string;
connection: Parameters<typeof LiveAgentIcon>[0]["connection"];
}) {
const [open, setOpen] = useState(false);
const ref = useRef<HTMLSpanElement>(null);
return (
<>
<span
ref={ref}
class="ui-agent-group-grip"
role="button"
tabIndex={0}
aria-expanded={open}
aria-label={`${paneKey}, ${agent}'s details`}
title={`${open ? "close" : "open"} ${agent}'s details; drag ${paneKey} onto another pane to move it`}
draggable
onClick={() => setOpen((o) => !o)}
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
setOpen((o) => !o);
}
}}
onDragStart={(e) => startAgentDrag(e, paneKey)}
onDragEnd={endAgentDrag}
>
<Badge
icon={<LiveAgentIcon name={agent} connection={connection} />}
value={paneKey}
/>
</span>
<AgentDetailPopover
agent={agent}
open={open}
onClose={() => setOpen(false)}
anchorRef={ref}
/>
</>
);
}

View file

@ -16,7 +16,7 @@ import { CloseIcon, ExpandIcon } from "@hive/shared/icons.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 { GroupPaneName } from "../../agent/terminal/GroupPaneName.js";
import { termPaths } from "../../agent/terminal/term-paths.js";
import {
agentsIn,
@ -29,7 +29,6 @@ import {
splitKey,
splitPane,
} 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";
@ -113,18 +112,11 @@ export function AgentGroupPage({
fullHeight
leading={(connection) => (
<>
<span
class="ui-agent-group-grip"
draggable
title={`drag ${key} onto another pane to move it`}
onDragStart={(e) => startAgentDrag(e, key)}
onDragEnd={endAgentDrag}
>
<Badge
icon={<LiveAgentIcon name={agent} connection={connection} />}
value={key}
<GroupPaneName
paneKey={key}
agent={agent}
connection={connection}
/>
</span>
<SubagentsMenu
key={agent}
agentName={agent}