diff --git a/docs/2-handbook/swarm/ui.md b/docs/2-handbook/swarm/ui.md index f80e61228..4de52efb5 100644 --- a/docs/2-handbook/swarm/ui.md +++ b/docs/2-handbook/swarm/ui.md @@ -13,7 +13,7 @@ place, and every one reads from [`swarm-controller`](../../../swarm-controller/R | route | what | | ---------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `/` | the start page: the swarm's name over a digital-rain backdrop with the slug (`hyperhive / we are the wired`, its shaded gradients pulsing in a wave unless reduced motion is on) at the foot, plus a paperclip offering to set up an agent while no `ruth` exists, or her hive declares her destroyed (it opens the create form with `ruth` filled in and the `ruth` archetype picked); the swarm name in the header links here | -| `/agents` | every agent as a card that opens in place (status, terminal, subagents, and settings with permissions, internet, allowed domains and accounts); create agents (with their permissions, optionally from an [archetype](archetypes.md)), link forge, matrix and GitHub accounts | +| `/agents` | every agent as a card; select one to open its details beside the list (status, terminal, subagents, and settings with permissions, internet, allowed domains and accounts); create agents (with their permissions, optionally from an [archetype](archetypes.md)), link forge, matrix and GitHub accounts | | `/swarm` | what belongs to the whole swarm: a folded **hives** card with the hive directory and each hive's last reported status, a folded **egress** card with the swarm-wide allowed and denied domains, and a folded, **beta** **notification router** card (with a warning banner) holding the router's flows: a switch for each built-in, a card for each flow an archetype carries, every flow drawn as a graph, and an editor for custom flows. `/notifications` redirects here | | `/agents//terminal` | one agent's live terminal | | `/agents//subagents//terminal` | one of that agent's subagents' live terminal | diff --git a/docs/4-implementation/web-ui/swarm-ui.md b/docs/4-implementation/web-ui/swarm-ui.md index da1e3325c..5186b1635 100644 --- a/docs/4-implementation/web-ui/swarm-ui.md +++ b/docs/4-implementation/web-ui/swarm-ui.md @@ -62,7 +62,7 @@ asks from inside a handler with the `useConfirm` hook, with no dialog state of i | route | what | | ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `/` | the start page: the swarm's name over a digital-rain backdrop with the slug (`hyperhive / we are the wired`, its shaded gradients pulsing in a wave unless reduced motion is on) at the foot, plus a paperclip offering to set up an agent while no `ruth` exists, or her hive declares her destroyed (it opens the create form with `ruth` filled in); the swarm name in the header links here | -| `/agents` | every agent as a card that opens in place (status, terminal, subagents, and settings with permissions, internet, allowed domains and accounts); create agents (with their permissions, optionally from an [archetype](../../2-handbook/swarm/archetypes.md)), link forge, matrix and GitHub accounts | +| `/agents` | every agent as a card; select one to open its details beside the list (status, terminal, subagents, and settings with permissions, internet, allowed domains and accounts); create agents (with their permissions, optionally from an [archetype](../../2-handbook/swarm/archetypes.md)), link forge, matrix and GitHub accounts | | `/swarm` | what belongs to the whole swarm: a folded **hives** card with the hive directory and each hive's last reported status, a folded **egress** card with the swarm-wide allowed and denied domains, and a folded, **beta** **notification router** card (with a warning banner) holding the router's flows: a switch for each built-in, every flow drawn as a graph, and an editor for custom flows. `/notifications` redirects here | | `/agents//terminal` | one agent's live terminal | | `/agents//subagents//terminal` | one of that agent's subagents' live terminal | @@ -86,7 +86,7 @@ The pages that only display (agents, alerts, builds, review runs and the hives card) show the answer they last saw at once, then replace it with the fresh one while the spinner runs, so opening one never starts on an empty page. On the very first visit, the hives card and the alerts table show their own header with three -grey placeholder rows until the first answer comes. In an opened agent card, a +grey placeholder rows until the first answer comes. In an agent's details, a setting still loading (permissions, resource caps, internet, allowed domains) shows a grey pill the size of its badge, and the AGENTS.md editor a grey block. The browser @@ -110,7 +110,7 @@ the code back. A failed login offers **try again** in the same dialog. When the secret store has the login, the dialog closes and a short toast in the top-right corner says so. The credentials go to the agent through the secret store ([`claude-login.md`](../../2-handbook/swarm/claude-login.md)). The agent's own web UI login still -works too. The settings section of an opened card has a **claude login** row: when +works too. The settings section of an agent's details has a **claude login** row: when the swarm stored the agent's login, or that none is, with a **log in** button (**log in again** when the swarm holds one) that opens the same dialog, and a **delete login** action that asks first. @@ -130,21 +130,32 @@ sweep. A hive that doesn't publish the field shows no badge. `/agents` is a column of separate cards: a filter card, then one card per agent, none of them inside a bigger card. A card's -header shows its icon, name, the status message with how long ago the agent set it (`5m ago`), a **terminal** +header shows its icon, name, the status message on one line (the whole message is in the details and in the card's tooltip) with how long ago the agent set it (`5m ago`), a **terminal** button that opens the agent's terminal tab, the **wanted** menu (up, offline, paused, destroy), a **paused by hive** badge when the agent's own harness paused its turn loop (hover for the reason; set the agent **up** to resume it), and a -**login needed** badge with a **log in** button when its claude has no session. Select the header to open the -card in place; select it again to close it. Several cards can be open at once, -and a card stays open across the page's refresh, but not across a reload. The +**login needed** badge with a **log in** button when its claude has no session. + +Select a card to open the agent's details. The address becomes +`/agents/`, so a link or a reload lands on the same agent, and the +browser's back and forward buttons walk through the selections. Until you select +an agent the list takes the whole width. Selecting one narrows the list to a +third of the page and slides the details in on the right, which scroll on their +own while the list stays in view, and the selected card gets a purple border and fill. The widths animate, +and stand still where motion is off. A screen narrower than 60em has room for one +column, so the details replace the list. At any width, the **← agents** button above +the details shuts them and the list takes the width again, and focus returns to +the agent's card. A name the roster doesn't have, from a stale link, shows +"no agent named …" and the same button. The filter card, which also holds the **+ agent** button and the refresh picker, filters by name, hive, status, message, wanted state and config PR. While the agent list loads for the first time, the page shows grey placeholder cards with the same layout as the real ones, so the cards don't jump when the data arrives. The placeholders stand still where motion is off. -An opened card has six sections, and each reads nothing until you open it. -**status** and **terminal** start open, the other four folded: +Below the agent's state, message and wanted menu, the details have six sections, +and each reads nothing until you open it. **status** and **terminal** start +open, the other four folded: - **status**: how fresh the agent's last report is (with its age), its turn state and context, its hive, links to its profile and its config repo on the swarm's forge (built from the forge entry @@ -169,7 +180,7 @@ An opened card has six sections, and each reads nothing until you open it. ### Agent and subagent terminals -An opened agent card on `/agents` shows, in its **terminal** section, a small live preview of its +An agent's detail pane on `/agents` shows, in its **terminal** section, a small live preview of its terminal, and below it the agent's **subagents**: every subagent the swarm queue holds terminal rows for from the last 24 hours. Picking one shows its terminal in the same preview, and **expand** opens it in its own tab, as it @@ -273,7 +284,7 @@ with no icon keeps the hyperhive mark. Everywhere else the swarm UI shows an age The tab also has an agent badge, with the agent's icon (carrying the connection light) and name, ahead of the state badges. It opens the agent's details in a popover under the badge: the same status, state, wanted state and folded **status** and **settings** sections (inference, resource caps, internet, allowed domains, permissions and linked accounts) as the -opened card on `/agents`, without the terminal and subagents. The popover doesn't dim the +details on `/agents`, without the terminal and subagents. The popover doesn't dim the page. Selecting outside it, or Escape, closes it. From the keyboard, opening a popover moves focus into it, and Escape puts focus back on the badge. The filter popovers on table headers work the same way. You can stop or pause the @@ -704,7 +715,7 @@ store identity, or no queue address, publishes no subagent terminals.
Where the background task list comes from -An opened agent card has a **background tasks** section, below the subagents, listing the +An agent's detail pane has a **background tasks** section, below the subagents, listing the tasks the agent started through the bash MCP. Its bash MCP publishes one status per task to the `bash-task-status` bucket, and swarm-controller serves the list as `GET /api/agents//bash-tasks`: each task's id, command, state, the time the agent queued it and @@ -832,7 +843,7 @@ text stays. ### Inference settings -An opened agent card shows, in its **settings** section, its model and effort under **inference**, each +An agent's detail pane shows, in its **settings** section, its model and effort under **inference**, each with where it comes from: the swarm, its agent.nix, its own pick, or the default. Below them are the subagent model list the swarm sets, or "its own" when it sets none, the subagent cap, which reads "no cap" when unset, and the @@ -847,7 +858,7 @@ report reaches the controller, it shows the swarm's stored values only. ### Editing an agent's instructions -The **instructions** row of an opened agent card's **settings** has an **edit** button. It +The **instructions** row of an agent's **settings** has an **edit** button. It opens `AGENTS.md`, the file the agent reads its instructions from, in a plain text box. The text is the copy the agent last published, so the box still opens for a stopped agent, but **save** needs the agent running. @@ -863,7 +874,7 @@ dialog keeps an unsaved edit for the next time you open it. ### Resource caps -An opened agent card shows, under **settings**, its CPU quota and memory max under **resource +An agent's detail pane shows, under **settings**, its CPU quota and memory max under **resource caps**. A cap is the swarm's, so it follows the agent to whichever hive runs it, and it replaces what the hive says for that field. A field the swarm leaves out shows as the hive deciding it. **edit** opens a dialog with the two @@ -904,7 +915,7 @@ reason and a **retry** button. ### Permissions -An opened agent card shows, under **settings**, what the swarm grants it under **permissions**: +An agent's detail pane shows, under **settings**, what the swarm grants it under **permissions**: a badge reading the default set, none, or a count. A swarm grant is the agent's whole set, so it follows the agent to whichever hive runs it. Selecting the badge opens a box under it with one checkbox per permission the controller @@ -975,7 +986,7 @@ same grant from a shell. ### Allowed domains -An opened agent card lists, under **settings**, the destinations it may reach through its +An agent's detail pane lists, under **settings**, the destinations it may reach through its hive's egress proxy under **allowed domains**, beyond the base list every agent has: one badge per source with its count, **swarm-wide** (the entries for every agent), **this agent** (the ones for it alone) and **automatic**. Selecting a badge @@ -1057,7 +1068,7 @@ the dialog goes back to step 2 and shows the reason there. ### Settings at creation Step 4 of the **+ agent** dialog has **resource caps** and **inference**, with -the same fields as the opened card's settings editors. Leave the +the same fields as the agent's settings editors. Leave the fields empty and the request is the plain name and hive. Fill them and `POST /api/agents` carries them as optional `limits` and `inference` objects, the same shapes the two `PUT` routes take. The controller checks them with the `PUT` rules before it queues @@ -1100,14 +1111,14 @@ reads back and its box starts with the stored text. The secrets never read back, so their box starts empty and replaces the stored secrets only when filled and saved. -The **claude login** row of an opened agent also sets the API key: **set API key** +The **claude login** row of an agent's details also sets the API key: **set API key** (or **replace API key**) sends the key as `ANTHROPIC_API_KEY=` to the agent's secrets, **remove API key** deletes them, and **advanced** opens the form above. The row shows whether the store holds a key and never the key. A change reaches the agent at its next restart, and an agent with a key tries it instead of waiting for a claude login. -An opened agent card lists its linked accounts at the end of its **settings** section, one row +An agent's detail pane lists its linked accounts at the end of its **settings** section, one row per account: kind, name and host. Opening an agent makes one request, `GET /api/hives/{hive}/agents/{agent}/linked-accounts`, which returns every account of that agent as names and hosts and never a credential. When the card diff --git a/frontend/packages/swarm-ui/src/App.tsx b/frontend/packages/swarm-ui/src/App.tsx index 7d56a8556..8c1a15e8b 100644 --- a/frontend/packages/swarm-ui/src/App.tsx +++ b/frontend/packages/swarm-ui/src/App.tsx @@ -54,7 +54,8 @@ export function App() { ))} - + {/* `/agents/:name` is the same page with that agent selected. */} + — one agent's details: its status, wanted state, hive, config // PR, inference settings, resource caps and linked accounts, plus the actions on -// them. Two layouts. In an opened card on `/agents` (`inCard`) the card header -// already shows status, message and wanted state, so the body is folded -// sections (`sections.ts`): status, terminal, open todos, subagents, background -// tasks and settings, each built when first opened. In the details popover on a -// terminal page (`AgentDetailPopover`) it is the status and the settings only, -// since the page is already beside a terminal. +// them. Two layouts. In the details beside the list on `/agents` +// (`withTerminal`) it is the state rows, then folded sections (`sections.ts`): +// status, terminal, open todos, subagents, background tasks and settings, each +// built when first opened. In the details popover on a terminal page +// (`AgentDetailPopover`) it is the state rows, then the status and the settings +// only, since the page is already beside a terminal. // // Takes the agent's *live* row and the shared `AgentActions`, so a state // change or a link made here shows wherever else the same row is drawn. @@ -51,7 +51,7 @@ import { SubagentTerms } from "../terminal/SubagentTerms.js"; import { WantedMenu } from "../roster/WantedMenu.js"; import "./AgentDetail.css"; -/** The rows the card header already shows: status, message and wanted. */ +/** The state rows: status, message and wanted. */ function HeaderRows({ row, actions, @@ -295,7 +295,7 @@ function LinkAccountAction({ ); } -/** The body of one folded section of an opened card. */ +/** The body of one folded section of an agent's details. */ function SectionBody({ section, row, @@ -338,25 +338,17 @@ export function AgentDetail({ row, actions, withTerminal = false, - inCard = false, }: { row: AgentRow; actions: AgentActions; /** Add the live terminal, todos, subagents and background tasks sections. */ withTerminal?: boolean; - /** - * An opened card, whose header already shows the state rows. Without it - * (the terminal page's popover) those rows go above the same sections. - */ - inCard?: boolean; }) { return (
- {inCard ? null : ( -
- -
- )} +
+ +
{sectionsFor(withTerminal).map((section) => ( — an agent's details from `/agents`, as in an opened card, in a popover +// — an agent's details from `/agents`, as in the details beside the list, in a popover // under its anchor, for a page that is already showing the agent's terminal // and should not be left, or dimmed, to read or change its details. It carries // the same body (`AgentDetail`) and the same actions (`useAgentActions`) as the diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx index 0bb99d066..af4dfbe7c 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentInference.tsx @@ -1,4 +1,4 @@ -// — one agent's inference settings in an opened agent card: the +// — one agent's inference settings in an agent's details: the // model and effort it runs on now, with where each came from, and an editor // for the value the swarm sets. // diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx index 9a401f181..7aecb4573 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentInstructions.tsx @@ -1,5 +1,5 @@ // — an editor for an agent's AGENTS.md, in a dialog opened -// from the agent's opened card. +// from the agent's details. // // It loads the copy the agent's harness last published // (`GET /api/agents/{name}/agents-md`, so a stopped agent shows the text it diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentLimits.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentLimits.tsx index ec3c1fa22..379ff6bf2 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentLimits.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentLimits.tsx @@ -1,4 +1,4 @@ -// — one agent's resource caps in an opened agent card: the CPU and +// — one agent's resource caps in an agent's details: the CPU and // memory caps the swarm sets for it, and an editor for them. // // Reads `GET /api/agents/{name}/limits`, which answers the stored caps as diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentPermissions.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentPermissions.tsx index 241d7263b..97f7ee549 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentPermissions.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentPermissions.tsx @@ -1,5 +1,5 @@ // , and — one agent's grant in an -// opened agent card: the permissions it holds, how far its traffic may leave +// an agent's details: the permissions it holds, how far its traffic may leave // the host, and how many repositories its forge account may create. Each is a badge that opens a control under it, which saves as soon as it // changes. // diff --git a/frontend/packages/swarm-ui/src/agent/detail/AgentSsh.tsx b/frontend/packages/swarm-ui/src/agent/detail/AgentSsh.tsx index d79af3ee6..f53a4a394 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/AgentSsh.tsx +++ b/frontend/packages/swarm-ui/src/agent/detail/AgentSsh.tsx @@ -1,4 +1,4 @@ -// — one agent's SSH access in an opened agent card: a badge that +// — one agent's SSH access in an agent's details: a badge that // opens a warning and the switch, then three folded sections: "how it works" // (the explainer), "on the target" (the text a machine needs to trust the // agent's certificates) and "connections" (the agent's named connections, in diff --git a/frontend/packages/swarm-ui/src/agent/detail/allowed-domains.ts b/frontend/packages/swarm-ui/src/agent/detail/allowed-domains.ts index 25bd13f34..c1e9361d6 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/allowed-domains.ts +++ b/frontend/packages/swarm-ui/src/agent/detail/allowed-domains.ts @@ -1,4 +1,4 @@ -// The allowed-domains editor of an opened agent card: which entries it +// The allowed-domains editor of an agent's details: which entries it // shows and the bodies it sends. Kept out of the component so `npm test` can // run it. diff --git a/frontend/packages/swarm-ui/src/agent/detail/permissions.ts b/frontend/packages/swarm-ui/src/agent/detail/permissions.ts index c965d94d4..d9149e681 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/permissions.ts +++ b/frontend/packages/swarm-ui/src/agent/detail/permissions.ts @@ -1,4 +1,4 @@ -// An opened agent card's permissions editor: what it starts on and how a granted +// The agent details' permissions editor: what it starts on and how a granted // set reads. Kept out of the component so `npm test` can run it. /** diff --git a/frontend/packages/swarm-ui/src/agent/detail/sections.ts b/frontend/packages/swarm-ui/src/agent/detail/sections.ts index 4b39594d7..ee59f0b11 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/sections.ts +++ b/frontend/packages/swarm-ui/src/agent/detail/sections.ts @@ -2,7 +2,7 @@ // what order, and which start open. The card's header already shows the // agent's state, message and wanted state, so the sections hold the rest. -/** One folded block of an opened agent card. */ +/** One folded block of an agent's details. */ export type DetailSection = | "status" | "terminal" diff --git a/frontend/packages/swarm-ui/src/agent/detail/ssh-connections.ts b/frontend/packages/swarm-ui/src/agent/detail/ssh-connections.ts index bc80b71a0..101fadd74 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/ssh-connections.ts +++ b/frontend/packages/swarm-ui/src/agent/detail/ssh-connections.ts @@ -1,4 +1,4 @@ -// The named SSH connections of an opened agent card: the routes, the body a +// The named SSH connections of an agent's details: the routes, the body a // save sends and what the add form says about a name that is already there. // Kept out of the component so `npm test` can run it. The controller checks // every field (the name, user and host rules, the ports it refuses, the limit of diff --git a/frontend/packages/swarm-ui/src/agent/detail/ssh.ts b/frontend/packages/swarm-ui/src/agent/detail/ssh.ts index e77a1d6db..a86c2e38b 100644 --- a/frontend/packages/swarm-ui/src/agent/detail/ssh.ts +++ b/frontend/packages/swarm-ui/src/agent/detail/ssh.ts @@ -1,4 +1,4 @@ -// An opened agent card's SSH row: what the badge says, the body of the PUT that +// The agent details' SSH row: what the badge says, the body of the PUT that // flips the switch, and the text an operator puts on a target machine. Kept out // of the component so `npm test` can run it. diff --git a/frontend/packages/swarm-ui/src/agent/roster/AgentCard.css b/frontend/packages/swarm-ui/src/agent/roster/AgentCard.css index 5215a352b..5da145bbd 100644 --- a/frontend/packages/swarm-ui/src/agent/roster/AgentCard.css +++ b/frontend/packages/swarm-ui/src/agent/roster/AgentCard.css @@ -25,10 +25,13 @@ align-items: center; gap: 0.4em; } +/* One line, cut with an ellipsis: the whole message is in the card's tooltip + and in the details beside the list. */ .ui-agent-card-message { color: var(--muted); - white-space: normal; - word-break: break-word; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } /* Icon (`AgentIcon`) beside the name/message. */ .ui-agent-card-row { @@ -44,38 +47,18 @@ min-width: 0; } -/* The header is what opens the card: it reads as a control without a box. */ +/* The header is what opens the agent's details: it reads as a control without + a box. */ .ui-agent-card-row[role="button"] { cursor: pointer; } -/* The opened body, set off from the header by a rule. */ -.ui-agent-card-detail { - margin-block-start: 0.75em; - padding-block-start: 0.75em; - border-block-start: 1px solid var(--border); +/* The card's own row takes the clicks, so the card shows the hover and the + keyboard focus the way a `Card` with a click handler does. */ +.ui-card:has(> .ui-agent-card-row[role="button"]:hover) { + border-color: var(--purple); } - -/* The same chevron as a folded card's (`ui/disclosure/`): right while shut, - down while open, so the header reads as something that unfolds. */ -.ui-agent-card-chevron { - align-self: center; - width: 0.55em; - height: 0.55em; - flex: none; - border-right: 2px solid var(--muted); - border-bottom: 2px solid var(--muted); - transform: rotate(-45deg); - transition: transform 0.15s ease; -} -/* The placeholder card keeps the chevron's box without its arrow. */ -.ui-agent-card-chevron-blank { - border-color: transparent; -} -.ui-agent-card-row[aria-expanded="true"] .ui-agent-card-chevron { - transform: rotate(45deg); -} -@media (prefers-reduced-motion: reduce) { - .ui-agent-card-chevron { - transition: none; - } +.ui-card:has(> .ui-agent-card-row[role="button"]:focus-visible) { + border-color: var(--purple); + outline: 2px solid var(--purple); + outline-offset: 2px; } diff --git a/frontend/packages/swarm-ui/src/agent/roster/AgentCard.tsx b/frontend/packages/swarm-ui/src/agent/roster/AgentCard.tsx index 4c086da09..759f014f5 100644 --- a/frontend/packages/swarm-ui/src/agent/roster/AgentCard.tsx +++ b/frontend/packages/swarm-ui/src/agent/roster/AgentCard.tsx @@ -1,10 +1,9 @@ // — one card per roster agent (mara: "main view: name, // status, message, wanted" / "message as second line" / "more like -// card per agent"). The header is those four things; selecting it opens the -// card in place into the agent's details (mara: "one column of expandable -// cards"), so there is no second panel to select into. The header already -// shows the agent's status, message and wanted state, so the opened body is the -// rest: `AgentDetail`'s folded sections (`inCard`). +// card per agent"). The header is those four things, with the message cut to one +// line. Selecting the card opens the agent's details beside the list (`onOpen`, +// which the page turns into `/agents/`); the card of the open agent is +// marked `selected`. // // The terminal badge beside the wanted menu opens the agent's terminal tab, the // most common action, without opening the card. @@ -21,8 +20,8 @@ import { Card } from "../../ui/card/Card.js"; import { useDynamicTabs } from "../../shell/useDynamicTabs.js"; import { AgentIcon } from "../AgentIcon.js"; import { ClaudeLoginDialog } from "../claude-login/ClaudeLoginDialog.js"; -import { AgentDetail } from "../detail/AgentDetail.js"; import { StatusMessage } from "../detail/StatusMessage.js"; +import { statusText } from "../detail/status-fields.js"; import { termPaths } from "../terminal/term-paths.js"; import { RelativeTime } from "../../ui/relative-time/RelativeTime.js"; import { @@ -40,29 +39,34 @@ import "./AgentCard.css"; export function AgentCard({ row, actions, + selected = false, + onOpen, }: { row: AgentRow; actions: AgentActions; + /** This agent's details are open beside the list. */ + selected?: boolean; + /** Called when the card is chosen, to open the agent's details. */ + onOpen: () => void; }) { const [loggingIn, setLoggingIn] = useState(false); - const [open, setOpen] = useState(false); const error = actions.actionErrors.get(row.name); - const toggle = () => setOpen((was) => !was); const { open: openTab } = useDynamicTabs(); const term = termPaths(row.name); return ( - + { if (e.target !== e.currentTarget) return; if (e.key === "Enter" || e.key === " ") { e.preventDefault(); - toggle(); + onOpen(); } }, }} @@ -157,7 +161,7 @@ export function AgentCard({ } message={} - chevron={ ); } diff --git a/frontend/packages/swarm-ui/src/agent/roster/AgentCardLayout.tsx b/frontend/packages/swarm-ui/src/agent/roster/AgentCardLayout.tsx index e946eccc0..b7d57e688 100644 --- a/frontend/packages/swarm-ui/src/agent/roster/AgentCardLayout.tsx +++ b/frontend/packages/swarm-ui/src/agent/roster/AgentCardLayout.tsx @@ -1,6 +1,6 @@ // — the arrangement of an agent card's header, with a slot // for each part: the icon, the name, the status (freshness and login badges), -// the trailing controls, the message line and the chevron. `AgentCard` fills +// the trailing controls and the message line. `AgentCard` fills // the slots with the real sub components; `AgentCardSkeleton` fills the same // slots with placeholder shapes, so the card that replaces it lands in the same // place. @@ -13,7 +13,7 @@ export function AgentCardLayout({ status, trailing, message, - chevron, + messageTitle, rowProps, }: { icon: ComponentChildren; @@ -21,9 +21,10 @@ export function AgentCardLayout({ status: ComponentChildren; trailing: ComponentChildren; message: ComponentChildren; - chevron?: ComponentChildren; + /** The whole message as a tooltip, for the line that cuts it short. */ + messageTitle?: string; /** Attributes of the header row, for the card that opens on a click. */ - rowProps?: HTMLAttributes; + rowProps?: HTMLAttributes & { "data-agent"?: string }; }) { return (
@@ -34,9 +35,10 @@ export function AgentCardLayout({ {status} {trailing}
-
{message}
+
+ {message} +
- {chevron} ); } diff --git a/frontend/packages/swarm-ui/src/agent/roster/AgentCardSkeleton.tsx b/frontend/packages/swarm-ui/src/agent/roster/AgentCardSkeleton.tsx index 9f2fda7bb..df38c62f5 100644 --- a/frontend/packages/swarm-ui/src/agent/roster/AgentCardSkeleton.tsx +++ b/frontend/packages/swarm-ui/src/agent/roster/AgentCardSkeleton.tsx @@ -22,14 +22,6 @@ export function AgentCardSkeleton() { } message={} - // The real chevron's box with no arrow, so the trailing controls end at - // the same x. - chevron={ -