Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ type Line = {
agent?: Subagent;
name: string;
detail?: string;
/// The kind of agent it is, for the hover card.
kind?: string;
progress?: string;
status: SubagentStatus;
state: string;
Expand Down Expand Up @@ -178,7 +180,10 @@ export function SubagentsSection({
agent,
name: agent.name,
progress: subagentProgress(t, language, agent).join(" · "),
detail: live(status) ? (agent.action ?? agent.kind) : agent.kind,
// What it does now, while it runs; its kind (Explore, general-purpose) is no subtitle on the
// line (Leo, 2026-10-31: "a lot of these subtitles are bad"): the hover card keeps it.
detail: live(status) ? agent.action : undefined,
kind: agent.kind && agent.kind !== agent.name ? agent.kind : undefined,
status,
state: subagentStateText(t, agent, waiting),
working: Boolean(retrying(agent)),
Expand Down Expand Up @@ -248,6 +253,7 @@ export function SubagentsSection({
{[
item.state,
item.time,
item.kind,
item.progress,
item.status === "running" || item.status === "waiting" ? item.detail : undefined,
]
Expand Down
35 changes: 31 additions & 4 deletions webviews/src/agent-session/acpmux/subagents/AgentLine.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
// 2026-10-29: "why are you saying sub-agent so many fucking times? Like, you can just add the icon
// when it's in here"). A line that opens something ends in a chevron. A line with nothing to open is
// a disabled button with no hover at all (subagents.css).
//
// In the tray a line has one anatomy, after Claude desktop's and Claude Code's subagent rows (Leo,
// 2026-10-31: "why is this still so ass in latest nightly", and earlier "eg a lot of these
// subtitles are bad"): one leading glyph (the spinner while it works, else its own icon or its
// harness's mark), never a second kind glyph beside it; the title; one muted trailing meta (what it
// spent, a state worth reading, its time); the chevron. No agent-type subtitle on the line (the
// tooltip and the hover card keep it), and no "Done" or "Running" word: the glyph says those
// (`quiet`), and the word stays for screen readers. design/chat-transcript.md "Subagent row anatomy".
import type { CSSProperties, ReactNode } from "react";
import { AgentMark, knownMark } from "../../shared/AgentMark";
import { Tooltip } from "../../../ui/Tooltip";
Expand Down Expand Up @@ -51,6 +59,8 @@ export function AgentLine({
working = false,
expanded,
trayColumns = false,
quiet = false,
progressAt = "below",
}: {
name: string;
/// What it does now, or the kind of agent it is; dim after the name.
Expand Down Expand Up @@ -99,6 +109,12 @@ export function AgentLine({
expanded?: boolean;
/// Use the running tray's fixed trailing columns; other AgentLine consumers keep their flow.
trayColumns?: boolean;
/// Its state needs no word on the line (done, or running under the spinner): screen readers
/// still read it. Tray lines only.
quiet?: boolean;
/// Where `progress` sits on a tray line: in the trailing meta before the time (`meta`), or on a
/// line under the title (`below`, every other consumer's place).
progressAt?: "meta" | "below";
}) {
const shimmer = waveProps(wave);
const brand = mark ? knownMark(mark, mark.split(/[-_/]/)[0]) : undefined;
Expand All @@ -117,7 +133,9 @@ export function AgentLine({
data-status={status}
aria-current={current ? "true" : undefined}
aria-expanded={expanded}
aria-label={label && progress ? `${label} · ${progress}` : label}
// A quiet line names its state here too: an aria-label overrides the line's own text, its
// screen-reader state word included.
aria-label={label ? [label, trayColumns && quiet ? state : undefined, progress].filter(Boolean).join(" · ") : undefined}
/* tooltip-allow: the line shows the name; the task appears nowhere else */
title={card ? undefined : title}
disabled={!onOpen}
Expand Down Expand Up @@ -146,16 +164,25 @@ export function AgentLine({
)}
<span className="acpmux-summary-agent__name">{name}</span>
{detail && detail !== name && <span className="acpmux-summary-agent__kind">{detail}</span>}
{progress && <span className="acpmux-agent-line__progress">{progress}</span>}
{progress && !(trayColumns && progressAt === "meta") && (
<span className="acpmux-agent-line__progress">{progress}</span>
)}
</span>
{trayColumns ? (
<>
{/* One muted trailing meta: what it spent and a state worth a word, then its time. */}
{((progress && progressAt === "meta") || !quiet) && (
<span className="acpmux-summary-meta acpmux-agent-line__meta">
{progress && progressAt === "meta" && <span className="acpmux-agent-line__stats">{progress}</span>}
{/* Running turns to Waiting or Failed with a tick, never a jump (trayMotion.tsx). */}
{!quiet && <Tick className="acpmux-summary-agent__state" text={state} />}
</span>
)}
{quiet && <span className="acpmux-agent-line__sr">{state}</span>}
<span className="acpmux-summary-meta acpmux-agent-line__time" aria-hidden={time === undefined}>
{time}
</span>
<span className="acpmux-agent-line__status">
{/* Running turns to Waiting or Done with a tick, never a jump (trayMotion.tsx). */}
<Tick className="acpmux-summary-meta acpmux-summary-agent__state" text={state} />
{chevron && onOpen && (
<span className="acpmux-agent-line__chevron" aria-hidden="true">
<Icon name="disclosure.collapsed" size={ROW_ICON} row />
Expand Down
21 changes: 15 additions & 6 deletions webviews/src/agent-session/acpmux/subagents/SubagentGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ export function SubagentGroupHeader({

/// One subagent in an open group: its avatar, name (in the agent's color,
/// agentTones.ts), state or current action with what it has spent (subagentProgress.ts), and time. `edge` rounds the list's first and last
/// rows. A click opens its own view; a running one has a stop button beside it.
/// rows. A click opens its own view; a running one has a stop button beside it. Its kind (Explore,
/// general-purpose) is no subtitle beside the name (Leo, 2026-10-31: "a lot of these subtitles are
/// bad"): the line's tooltip keeps it.
export function SubagentListRow({ row }: { row: AcpmuxRow }) {
const t = useT();
const language = usePaneLanguage();
Expand All @@ -166,17 +168,22 @@ export function SubagentListRow({ row }: { row: AcpmuxRow }) {
<>
<Avatar agent={agent} />
<span className="cv-subagent__text">
<span className="cv-subagent__name">
{agent.name}
{agent.kind && agent.kind !== agent.name && <span className="cv-subagent__kind">{agent.kind}</span>}
</span>
<span className="cv-subagent__name">{agent.name}</span>
<span className="cv-subagent__state">{state}</span>
</span>
<span className="cv-subagent__time">{formatDuration(elapsed(agent, now))}</span>
</>
);
const kind = agent.kind && agent.kind !== agent.name ? agent.kind : undefined;
const line = !open ? (
<div id={row.id} className="cv-subagent" data-edge={row.status} data-agent-tone={tones?.get(agent.id)}>
<div
id={row.id}
className="cv-subagent"
data-edge={row.status}
data-agent-tone={tones?.get(agent.id)}
// tooltip-allow: its kind, which the line no longer shows
title={kind}
>
{content}
</div>
) : (
Expand All @@ -187,6 +194,8 @@ export function SubagentListRow({ row }: { row: AcpmuxRow }) {
data-edge={row.status}
data-agent-tone={tones?.get(agent.id)}
aria-label={t("subagents.open", { name: agent.name })}
// tooltip-allow: its kind, which the line no longer shows
title={kind}
onClick={() => open(agent.id)}
>
{content}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// l10n-allow-file: gallery fixtures (prompts, subagent names), not shipped UI.
// One tray line's anatomy (design/chat-transcript.md "Subagent row anatomy"; Leo, 2026-10-31: "why
// is this still so ass in latest nightly", and earlier "eg a lot of these subtitles are bad"): one
// leading glyph (the spinner while it works), the title a gap after it, one muted trailing meta and
// the time, the chevron. No agent-type subtitle and no Done or Running word on the line; a tray with
// nothing running draws no card. The arms (trayPanel.experiment.ts `trayRowLook`) place a running
// line's stats: in the trailing meta, on a second line, or right after the title.
import { agentPaneEntry } from "../../../gallery/format";
import { assistant, chat, row, user } from "../../../gallery/fixtures/acpmux";
import { minutesAgo } from "../../../gallery/clock";
import type { PlayContext } from "../../../gallery/play";
import { SUBAGENTS, type Subagent } from "./subagentFold";
import { trayRowLook } from "./trayPanel.experiment";

function agent(
name: string,
minutes: number,
state: Subagent["state"] = "running",
fields: Partial<Subagent> & { ran?: number } = {},
): Subagent {
const { ran = 1.4, ...rest } = fields;
return {
id: `agent-${name.toLowerCase().replaceAll(" ", "-")}`,
parent: null,
name,
task: name,
kind: "general-purpose",
state,
startedAt: minutesAgo(minutes),
...(state !== "running" && { endedAt: minutesAgo(minutes - ran) }),
...rest,
};
}

const group = (agents: Subagent[], minutes: number) => row(SUBAGENTS, minutes, { subagents: agents });

/** The anatomy every arm keeps; a broken one fails the variant. */
function anatomy(ctx: PlayContext): void {
const lines = [...ctx.document.querySelectorAll<HTMLElement>(".acpmux-running-tray .acpmux-agent-line")];
if (lines.length === 0) throw new Error("no tray line");
for (const line of lines) {
if (line.querySelector(".acpmux-agent-line__kind-icon")) throw new Error("a second leading glyph");
if (line.querySelector(".acpmux-summary-agent__kind")) throw new Error("an agent-type subtitle on the line");
const glyph = line.querySelector<HTMLElement>(".acpmux-lineage__icon")!.getBoundingClientRect();
const title = line.querySelector<HTMLElement>(".acpmux-summary-agent__name")!.getBoundingClientRect();
if (title.left - glyph.right < 6) throw new Error(`the title touches its glyph (${title.left - glyph.right}px)`);
}
}

const script = [
{
name: "the tray at rest",
run: async (ctx: PlayContext) => {
await ctx.waitFor(() => ctx.document.querySelector(".acpmux-running-tray .acpmux-agent-line"));
anatomy(ctx);
},
},
];

const play = (settled: boolean) => async (ctx: PlayContext) => {
await ctx.waitFor(() => ctx.document.querySelector(".acpmux-running-tray .acpmux-agent-line"));
anatomy(ctx);
const tray = ctx.document.querySelector<HTMLElement>(".acpmux-running-tray")!;
if (settled !== tray.hasAttribute("data-settled")) throw new Error(`settled should be ${settled}`);
if (settled && getComputedStyle(tray).boxShadow !== "none") throw new Error("a settled tray draws no card");
};

export default agentPaneEntry({
id: "agent-pane.subagent-row-anatomy",
title: "Subagent row anatomy",
area: "Agent pane",
height: 360,
covers: [
"agent-session/acpmux/subagents/AgentLine.tsx",
"agent-session/acpmux/subagents/SubagentTray.tsx",
"agent-session/acpmux/subagents/subagents.css",
],
experiment: { definition: trayRowLook, script },
variants: {
"done-one": {
note: "One subagent finished, nothing running: one fork glyph, the title, a muted 1m 24s, the chevron; no general-purpose subtitle, no Done word, no card.",
play: play(true),
snapshot: chat(
[
user("Land the open fix and tidy the glyphs", 4),
group([agent("Land the fix and glyph nits follow-up", 3, "completed", { ran: 1.4 })], 3),
assistant("Landed, and the glyph nits are in a follow-up.", 1),
],
{ isWorking: false },
),
},
"running-stats": {
note: "A running subagent with what it spent: the spinner is its one glyph, its stats sit muted before its time, and the finished one under it lines its time up with it.",
play: play(false),
snapshot: chat(
[
user("Carry the composer PR and land the follow-up", 6),
group(
[
agent("Carry the composer PR", 5, "running", { tokens: 236_600, toolUses: 112, action: "Bash" }),
agent("Land the fix and glyph nits follow-up", 4, "completed", { ran: 1.4 }),
],
5,
),
],
{ isWorking: true },
),
},
mixed: {
note: "Running, finished and failed lines together: only a state worth a word says it (Failed), muted in the meta before the time; the finished Explore agent's kind is in its tooltip, not on the line.",
play: play(false),
snapshot: chat(
[
user("Fan out the review", 8),
group(
[
agent("Review the fold", 6, "running", { tokens: 48_200, toolUses: 31, action: "Read subagentFold.ts" }),
agent("Check the docs", 7, "completed", { kind: "Explore", ran: 2.1 }),
agent("Run the flaky suite", 7, "failed", { ran: 3.2 }),
],
7,
),
],
{ isWorking: true },
),
},
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -286,15 +286,15 @@ export default agentPaneEntry({
experiment: { definition: trayPanelLook, script: panelScript },
variants: {
"panel-two": {
note: 'Leo\'s panel with two chats running and three ended (2026-10-25: "this section, the whatever background tasks ... it\'s kind of wack"): the header pinned on top, running first, then the latest that ended; a chat\'s raw shell doing line reads "Running sed -i …", never "cd /Users/… && sed -i …".',
note: "Leo's panel with two chats running and three ended (2026-10-25: \"this section, the whatever background tasks ... it's kind of wack\"): the header pinned on top, running first, then the latest that ended; no line carries a subtitle, so none shows a raw shell line.",
play: async (ctx) => {
await ctx.waitFor(() => ctx.document.querySelector(".acpmux-running-tray__head"));
headInView(ctx);
const details = [...ctx.document.querySelectorAll(".acpmux-running-tray .acpmux-summary-agent__kind")].map(
(node) => node.textContent ?? "",
);
if (details.some((text) => text.startsWith("cd ")))
throw new Error(`a line never shows a raw shell line: ${details.join(" | ")}`);
// No line carries a subtitle, so none shows a raw shell line (subagents/AgentLine.tsx).
const tray = ctx.document.querySelector<HTMLElement>(".acpmux-running-tray")!;
if (tray.querySelector(".acpmux-summary-agent__kind"))
throw new Error("a tray line carries no subtitle: what it does is its tooltip");
if ((tray.textContent ?? "").includes("cd /Users/")) throw new Error("a line never shows a raw shell line");
},
snapshot: panel(3),
},
Expand Down
Loading