From 9f6510682248684cd7d0cb0c516ac8204fc115c6 Mon Sep 17 00:00:00 2001 From: Taylor Ho Date: Mon, 15 Jun 2026 01:14:10 -0700 Subject: [PATCH] refactor(agents): drop transcript compact mode and simplify row spacing - Remove the compact layout prop from AgentSessionTranscriptList, ManagedAgentSessionPanel, and AgentSessionThreadPanel; always render the tighter transcript density - Revert consecutive tool-call grouping (tool_group segments, ToolCallGroup, segment spacing helpers) and render each tool as a normal transcript row - Add symmetric per-type row spacing: my-2.5 for messages, my-1 for tools, my-2 for other items - Simplify ToolItem wrapper padding now that grouped/compact props are gone --- .../agents/ui/AgentSessionToolItem.tsx | 10 +- .../agents/ui/AgentSessionTranscriptList.tsx | 180 +++--------------- .../agents/ui/ManagedAgentSessionPanel.tsx | 6 - .../agentSessionTranscriptGrouping.test.mjs | 25 --- .../ui/agentSessionTranscriptGrouping.ts | 36 +--- .../channels/ui/AgentSessionThreadPanel.tsx | 1 - 6 files changed, 31 insertions(+), 227 deletions(-) diff --git a/desktop/src/features/agents/ui/AgentSessionToolItem.tsx b/desktop/src/features/agents/ui/AgentSessionToolItem.tsx index 683896cfd4..c06c8add89 100644 --- a/desktop/src/features/agents/ui/AgentSessionToolItem.tsx +++ b/desktop/src/features/agents/ui/AgentSessionToolItem.tsx @@ -10,12 +10,8 @@ import { buildCompactToolSummary } from "./agentSessionToolSummary"; import { asRecord, formatCodeValue, formatDuration } from "./agentSessionUtils"; export function ToolItem({ - compact = false, - grouped = false, item, }: { - compact?: boolean; - grouped?: boolean; item: Extract; }) { const [isExpanded, setIsExpanded] = React.useState(false); @@ -34,11 +30,7 @@ export function ToolItem({ return (
+

No ACP activity yet

{emptyDescription}

@@ -104,7 +97,7 @@ export function AgentSessionTranscriptList({
{displayBlocks.map((block) => ( @@ -113,7 +106,6 @@ export function AgentSessionTranscriptList({ agentName={agentName} agentPubkey={agentPubkey} block={block} - compact={compact} key={getDisplayBlockKey(block)} profiles={profiles} /> @@ -147,28 +139,17 @@ function TranscriptDisplayBlockView({ agentName, agentPubkey, block, - compact, profiles, }: AgentTranscriptIdentityProps & { block: TranscriptDisplayBlock; - compact: boolean; profiles?: UserProfileLookup; }) { if (block.kind === "single") { - if (block.item.type === "tool") { - return ( -
- -
- ); - } - return ( @@ -177,51 +158,24 @@ function TranscriptDisplayBlockView({ return (
- {block.segments.map((segment, index) => ( -
( + - -
+ profiles={profiles} + segment={segment} + /> ))}
); } -function getTurnSegmentSpacing( - previous: TranscriptTurnSegment | undefined, - segment: TranscriptTurnSegment, - compact: boolean, -): string | undefined { - if (!previous) { - return undefined; - } - - const involvesTool = - previous.kind === "tool_group" || segment.kind === "tool_group"; - if (involvesTool) { - return compact ? "mt-3" : "mt-3.5"; - } - - return compact ? "mt-2" : "mt-2.5"; -} - function getTurnSegmentKey(turnId: string, segment: TranscriptTurnSegment) { if (segment.kind === "setup") { return `turn:${turnId}:setup`; @@ -229,9 +183,6 @@ function getTurnSegmentKey(turnId: string, segment: TranscriptTurnSegment) { if (segment.kind === "prompt") { return `turn:${turnId}:prompt`; } - if (segment.kind === "tool_group") { - return `turn:${turnId}:tools:${segment.items.map((item) => item.id).join("+")}`; - } return segment.item.id; } @@ -239,18 +190,15 @@ function TranscriptTurnSegmentView({ agentAvatarUrl, agentName, agentPubkey, - compact, profiles, segment, }: AgentTranscriptIdentityProps & { - compact: boolean; profiles?: UserProfileLookup; segment: TranscriptTurnSegment; }) { if (segment.kind === "prompt") { return ( ; - } - - if (segment.kind === "tool_group") { - return ; + return ; } return ( @@ -272,8 +216,6 @@ function TranscriptTurnSegmentView({ agentAvatarUrl={agentAvatarUrl} agentName={agentName} agentPubkey={agentPubkey} - compact={compact} - embedded item={segment.item} profiles={profiles} /> @@ -281,13 +223,11 @@ function TranscriptTurnSegmentView({ } function TurnPromptBlock({ - compact, context, profiles, setup, user, }: { - compact: boolean; context: Extract | null; profiles?: UserProfileLookup; setup: Extract[]; @@ -304,7 +244,6 @@ function TurnPromptBlock({
) : null} | null; item: Extract; profiles?: UserProfileLookup; @@ -353,12 +290,7 @@ function PromptUserMessage({ size="xs" />
-
+

{text}

{contextOpen && context ? ( @@ -503,43 +435,19 @@ function TurnSetupFooter({ ); } -function ToolCallGroup({ - compact, - items, -}: { - compact: boolean; - items: Extract[]; -}) { - return ( -
- {items.map((item) => ( - - ))} -
- ); -} - function TranscriptItemRow({ agentAvatarUrl, agentName, agentPubkey, - compact, - embedded = false, item, profiles, }: AgentTranscriptIdentityProps & { - compact: boolean; - embedded?: boolean; item: TranscriptItem; profiles?: UserProfileLookup; }) { return (
{SHOW_TRANSCRIPT_ACP_SOURCE && item.acpSource ? ( @@ -549,7 +457,6 @@ function TranscriptItemRow({ agentAvatarUrl={agentAvatarUrl} agentName={agentName} agentPubkey={agentPubkey} - compact={compact} item={item} profiles={profiles} /> @@ -558,10 +465,8 @@ function TranscriptItemRow({ } function TurnSetupStatus({ - compact, items, }: { - compact: boolean; items: Extract[]; }) { const timestamp = turnSetupTimestamp(items); @@ -570,31 +475,29 @@ function TurnSetupStatus({ } return ( -
+
); } -function getItemSpacingClass(item: TranscriptItem) { - if (item.type === "lifecycle") { - return "mt-1.5 first:mt-0"; +function getTranscriptItemRowSpacing(item: TranscriptItem): string { + if (item.type === "message") { + return "my-2.5"; } - if (item.type === "metadata" || item.type === "thought") { - return "mt-1.5 first:mt-0"; + if (item.type === "tool") { + return "my-1"; } - return undefined; + return "my-2"; } const TranscriptItemView = React.memo(function TranscriptItemView({ agentAvatarUrl, agentName, agentPubkey, - compact, item, profiles, }: AgentTranscriptIdentityProps & { - compact: boolean; item: TranscriptItem; profiles?: UserProfileLookup; }) { @@ -604,20 +507,19 @@ const TranscriptItemView = React.memo(function TranscriptItemView({ agentAvatarUrl={agentAvatarUrl} agentName={agentName} agentPubkey={agentPubkey} - compact={compact} item={item} profiles={profiles} /> ); } if (item.type === "tool") { - return ; + return ; } if (item.type === "thought") { - return ; + return ; } if (item.type === "metadata") { - return ; + return ; } return ; }); @@ -626,11 +528,9 @@ function MessageItem({ agentAvatarUrl, agentName, agentPubkey, - compact, item, profiles, }: AgentTranscriptIdentityProps & { - compact: boolean; item: Extract; profiles?: UserProfileLookup; }) { @@ -659,14 +559,9 @@ function MessageItem({
; }) { return (
@@ -751,27 +641,13 @@ function ThoughtItem({ } function MetadataItem({ - compact, - embedded = false, item, }: { - compact: boolean; - embedded?: boolean; item: Extract; }) { return (
diff --git a/desktop/src/features/agents/ui/ManagedAgentSessionPanel.tsx b/desktop/src/features/agents/ui/ManagedAgentSessionPanel.tsx index 74aae7ef0b..327213ff28 100644 --- a/desktop/src/features/agents/ui/ManagedAgentSessionPanel.tsx +++ b/desktop/src/features/agents/ui/ManagedAgentSessionPanel.tsx @@ -30,7 +30,6 @@ type ManagedAgentSessionPanelProps = { }; channelId?: string | null; className?: string; - compact?: boolean; emptyDescription?: string; isWorking?: boolean; rawLayout?: "responsive" | "exclusive"; @@ -43,7 +42,6 @@ export function ManagedAgentSessionPanel({ agent, channelId = null, className, - compact = false, emptyDescription = "Mention this agent in a channel to watch the next turn.", isWorking = false, rawLayout = "responsive", @@ -104,7 +102,6 @@ export function ManagedAgentSessionPanel({ agentAvatarUrl={agent.avatarUrl ?? null} agentName={agent.name} agentPubkey={agent.pubkey} - compact={compact} connectionState={connectionState} emptyDescription={emptyDescription} errorMessage={errorMessage} @@ -159,7 +156,6 @@ function SessionBody({ agentAvatarUrl, agentName, agentPubkey, - compact, connectionState, emptyDescription, errorMessage, @@ -174,7 +170,6 @@ function SessionBody({ agentAvatarUrl: string | null; agentName: string; agentPubkey: string; - compact: boolean; connectionState: ConnectionState; emptyDescription: string; errorMessage: string | null; @@ -219,7 +214,6 @@ function SessionBody({ agentAvatarUrl={agentAvatarUrl} agentName={agentName} agentPubkey={agentPubkey} - compact={compact} emptyDescription={emptyDescription} isWorking={isWorking} items={transcript} diff --git a/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.test.mjs b/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.test.mjs index 07ba3b2e52..7639a97c65 100644 --- a/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.test.mjs +++ b/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.test.mjs @@ -124,32 +124,7 @@ test("buildTranscriptDisplayBlocks bundles user prompt, setup, and context toget assert.equal(promptSegment.context?.id, "context"); assert.equal(promptSegment.setup.length, 2); assert.equal(turnBlock.segments[1]?.kind, "item"); - assert.equal(turnBlock.segments[2]?.kind, "tool_group"); -}); - -test("buildTranscriptDisplayBlocks groups consecutive tool calls", () => { - const rawItems = [ - userPrompt("prompt", "run these", "turn-1"), - toolCall("tool-1", "turn-1"), - toolCall("tool-2", "turn-1"), - assistantMessage("assistant", "Done.", "turn-1"), - toolCall("tool-3", "turn-1"), - ]; - - const blocks = buildTranscriptDisplayBlocks(rawItems); - const turnBlock = blocks[0]; - assert.equal(turnBlock?.kind, "turn"); - assert.equal(turnBlock.segments[1]?.kind, "tool_group"); - assert.deepEqual( - turnBlock.segments[1]?.items?.map((item) => item.id), - ["tool-1", "tool-2"], - ); assert.equal(turnBlock.segments[2]?.kind, "item"); - assert.equal(turnBlock.segments[3]?.kind, "tool_group"); - assert.deepEqual( - turnBlock.segments[3]?.items?.map((item) => item.id), - ["tool-3"], - ); }); test("buildTranscriptDisplayBlocks collapses setup lifecycle inside prompt bundle", () => { diff --git a/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.ts b/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.ts index 3a840e22f1..d350ca2993 100644 --- a/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.ts +++ b/desktop/src/features/agents/ui/agentSessionTranscriptGrouping.ts @@ -2,7 +2,6 @@ import type { TranscriptItem } from "./agentSessionTypes"; export type TranscriptTurnSegment = | { kind: "item"; item: TranscriptItem } - | { kind: "tool_group"; items: Extract[] } | { kind: "setup"; items: Extract[] } | { kind: "prompt"; @@ -68,9 +67,7 @@ function classifyTurnItems(items: TranscriptItem[]): TranscriptTurnSegment[] { const activity = items.filter((item) => !consumed.has(item)); if (!userPrompt) { - return groupConsecutiveToolSegments( - activity.map((item) => ({ kind: "item", item })), - ); + return activity.map((item) => ({ kind: "item", item })); } const segments: TranscriptTurnSegment[] = [ @@ -93,34 +90,7 @@ function classifyTurnItems(items: TranscriptItem[]): TranscriptTurnSegment[] { segments.push({ kind: "item", item }); } - return groupConsecutiveToolSegments(segments); -} - -function groupConsecutiveToolSegments( - segments: TranscriptTurnSegment[], -): TranscriptTurnSegment[] { - const grouped: TranscriptTurnSegment[] = []; - let toolBuffer: Extract[] = []; - - const flushTools = () => { - if (toolBuffer.length === 0) { - return; - } - grouped.push({ kind: "tool_group", items: toolBuffer }); - toolBuffer = []; - }; - - for (const segment of segments) { - if (segment.kind === "item" && segment.item.type === "tool") { - toolBuffer.push(segment.item); - continue; - } - flushTools(); - grouped.push(segment); - } - - flushTools(); - return grouped; + return segments; } /** @@ -192,8 +162,6 @@ export function flattenDisplayBlocks( for (const segment of block.segments) { if (segment.kind === "item") { result.push(segment.item); - } else if (segment.kind === "tool_group") { - result.push(...segment.items); } else if (segment.kind === "prompt") { result.push(segment.user); result.push(...segment.setup); diff --git a/desktop/src/features/channels/ui/AgentSessionThreadPanel.tsx b/desktop/src/features/channels/ui/AgentSessionThreadPanel.tsx index 536d36415c..1c402a5cb2 100644 --- a/desktop/src/features/channels/ui/AgentSessionThreadPanel.tsx +++ b/desktop/src/features/channels/ui/AgentSessionThreadPanel.tsx @@ -200,7 +200,6 @@ export function AgentSessionThreadPanel({ agent={agent} channelId={channel.id} className="border-0 bg-transparent p-0 shadow-none" - compact emptyDescription={`Mention ${agent.name} in the channel to see its work here.`} isWorking={isWorking} profiles={profiles}