Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

refactor(chat): remove legacy subagent renderers

Steven Enamakel579af5d9e78b
diff --git a/app/src/components/ai-elements/index.ts b/app/src/components/ai-elements/index.ts
index 2a1f9ce6a6..c326bc0b89 100644
--- a/app/src/components/ai-elements/index.ts
+++ b/app/src/components/ai-elements/index.ts
@@ -17,7 +17,7 @@
* this product's real transcript surfaces and deleted rather than force-fitted:
*
* - `Reasoning` / `ChainOfThought` — this product renders the agent's thinking
- * INLINE at the position it streamed (`ToolTimelineBlock`'s `ThoughtBlock`,
+ * INLINE at the position it streamed (the assistant-ui delegation transcript,
* explicitly "no heading, no collapse"; `ProcessingTranscriptView`'s
* interleaved narration). Both upstream components are whole-panel
* collapsibles that hide that trail behind one "Thought for N seconds"
diff --git a/app/src/features/conversations/components/AgentProcessSourcePanel.tsx b/app/src/features/conversations/components/AgentProcessSourcePanel.tsx
index 4c5c94e5ff..326ba82287 100644
--- a/app/src/features/conversations/components/AgentProcessSourcePanel.tsx
+++ b/app/src/features/conversations/components/AgentProcessSourcePanel.tsx
@@ -11,8 +11,8 @@ import {
formatTimelineEntry,
} from '../../../utils/toolTimelineFormatting';
import { AgentSparkIcon } from './AgentTimelineRail';
+import { AssistantUiSubagentCall } from './AssistantUiSubagentCall';
import { ProcessingTranscriptView } from './ProcessingTranscriptView';
-import { SubagentActivityBlock } from './SubagentActivityBlock';
import { ToolTimelineBlock } from './ToolTimelineBlock';
const log = createDebug('app:conversations:agent-process-source');
@@ -176,7 +176,7 @@ export function AgentProcessSourcePanel({
{scopedEntry ? (
// Scoped to one step: show only that step's details.
scopedEntry.subagent ? (
- <SubagentActivityBlock subagent={scopedEntry.subagent} />
+ <AssistantUiSubagentCall activity={scopedEntry.subagent} />
) : scopedDetail ? (
<pre className="max-h-[60vh] overflow-y-auto rounded-lg bg-surface-muted px-3 py-2 text-[12px] whitespace-pre-wrap wrap-break-word text-content-secondary">
{scopedDetail}
@@ -195,7 +195,7 @@ export function AgentProcessSourcePanel({
<ProcessingTranscriptView
transcript={transcript}
entries={entries}
- renderSubagent={subagent => <SubagentActivityBlock subagent={subagent} />}
+ renderSubagent={subagent => <AssistantUiSubagentCall activity={subagent} />}
/>
) : entries.length > 0 ? (
// Legacy snapshot (no transcript): fall back to the tool timeline,
@@ -223,7 +223,7 @@ export function AgentProcessSourcePanel({
<p className="text-[12px] font-medium text-content-secondary">
{formatTimelineEntry(entry).title}
</p>
- <SubagentActivityBlock subagent={entry.subagent!} />
+ <AssistantUiSubagentCall activity={entry.subagent!} />
</div>
))}
</div>
diff --git a/app/src/features/conversations/components/SubagentActivityBlock.tsx b/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
similarity index 62%
rename from app/src/features/conversations/components/SubagentActivityBlock.tsx
rename to app/src/features/conversations/components/AssistantUiSubagentCall.tsx
index fa9cfc5463..783ee93fd3 100644
--- a/app/src/features/conversations/components/SubagentActivityBlock.tsx
+++ b/app/src/features/conversations/components/AssistantUiSubagentCall.tsx
@@ -1,3 +1,11 @@
+import { CheckIcon, ChevronDownIcon, Loader2Icon, WorkflowIcon } from 'lucide-react';
+
+import { cn } from '../../../components/assistant-ui/lib/utils';
+import {
+ Collapsible,
+ CollapsibleContent,
+ CollapsibleTrigger,
+} from '../../../components/assistant-ui/ui/collapsible';
import Badge from '../../../components/ui/Badge';
import WorktreeActions from '../../../components/worktree/WorktreeActions';
import { useT } from '../../../lib/i18n/I18nContext';
@@ -28,26 +36,9 @@ function ChildToolCallCard({ call }: { call: ChildToolCall }) {
);
}
-/**
- * The agent's reasoning or visible narration, surfaced inline in the timeline
- * as quoted/italic prose at the position it streamed — so a thought shows up
- * wherever it occurred between tool calls. Shown directly (no "Thoughts"
- * heading, no collapse). Both `thinking` and `text` transcript items render
- * through here. Renders nothing for an all-whitespace delta so a half-streamed
- * item never flashes an empty quote.
- */
-export function ThoughtBlock({ text }: { text: string }) {
- // Drop any inline `<tool_call>…</tool_call>` envelope the model emitted as
- // text — the call already shows as its own row. Keep the original newlines
- // (only trim the ends) so the markdown renderer can see headings, lists,
- // code fences and emphasis instead of flattening them to one plain line.
+function Thought({ text }: { text: string }) {
const clean = stripToolCallEnvelopes(text).trim();
if (!clean) return null;
- // Rendered through the shared `BubbleMarkdown` so a thought formats markdown
- // (bold, code, lists) — but scaled back to the original quiet thought look:
- // small (12px) and light/muted, not the larger, darker agent-bubble prose.
- // Descendant overrides on `.prose` beat the typography plugin's base sizing;
- // code keeps its accent colour so inline `tool_names` still read clearly.
return (
<div
data-testid="subagent-thought"
@@ -57,24 +48,11 @@ export function ThoughtBlock({ text }: { text: string }) {
);
}
-/**
- * Render the live activity of one running (or completed) sub-agent inside its
- * parent timeline row — the mode/dedicated-thread badge, the child iteration
- * counter, the final-run statistics, and the ordered transcript of child tool
- * calls interleaved with the agent's "Thoughts" (reasoning + narration).
- *
- * Kept as a sibling of the existing worker-thread / detail block so the
- * surrounding disclosure chevron + status pill behaviour is unaffected — this
- * component only renders when `subagent` is present on the entry, which is true
- * for any row produced by the `subagent_*` socket events from a current core.
- */
-export function SubagentActivityBlock({
+function SubagentDetails({
subagent,
onView,
}: {
subagent: SubagentActivity;
- /** Opens the full-transcript drawer for this subagent. Omitted in
- * read-only contexts (e.g. a completed snapshot with no live driver). */
onView?: () => void;
}) {
const { t } = useT();
@@ -82,13 +60,11 @@ export function SubagentActivityBlock({
if (subagent.mode) headerBits.push(subagent.mode);
if (subagent.dedicatedThread) headerBits.push(t('conversations.toolTimeline.workerThread'));
if (subagent.childIteration != null) {
- if (subagent.childMaxIterations != null) {
- headerBits.push(
- `${t('conversations.toolTimeline.turn')} ${subagent.childIteration}/${subagent.childMaxIterations}`
- );
- } else {
- headerBits.push(`${t('conversations.toolTimeline.step')} ${subagent.childIteration}`);
- }
+ headerBits.push(
+ subagent.childMaxIterations != null
+ ? `${t('conversations.toolTimeline.turn')} ${subagent.childIteration}/${subagent.childMaxIterations}`
+ : `${t('conversations.toolTimeline.step')} ${subagent.childIteration}`
+ );
} else if (subagent.iterations != null) {
headerBits.push(
subagent.iterations === 1
@@ -103,12 +79,6 @@ export function SubagentActivityBlock({
: `${subagent.elapsedMs}ms`
);
}
-
- // The ordered transcript drives the inline activity: child tool-call rows
- // and the agent's "Thoughts" (reasoning + visible narration) render in the
- // exact order they streamed, so each thought appears wherever it occurred
- // between tool calls. Falls back to the flat tool-call list when the prose
- // transcript is absent (e.g. a rehydrated/interrupted snapshot).
const transcript = subagent.transcript ?? [];
return (
@@ -126,11 +96,11 @@ export function SubagentActivityBlock({
) : null}
{transcript.length > 0 ? (
<div className="ml-1 space-y-0.5" data-testid="subagent-transcript">
- {transcript.map((item, i) =>
+ {transcript.map((item, index) =>
item.kind === 'tool' ? (
<ChildToolCallCard key={item.callId} call={item} />
) : (
- <ThoughtBlock key={`thought-${i}`} text={item.text} />
+ <Thought key={`thought-${index}`} text={item.text} />
)
)}
</div>
@@ -155,7 +125,7 @@ export function SubagentActivityBlock({
<Badge variant={subagent.isDirty ? 'warning' : 'success'} className="rounded-full">
{subagent.isDirty ? t('worktree.dirty') : t('worktree.clean')}
</Badge>
- {subagent.changedFiles && subagent.changedFiles.length > 0 ? (
+ {subagent.changedFiles?.length ? (
<span className="text-[11px] text-content-faint">
{subagent.changedFiles.length}{' '}
{subagent.changedFiles.length === 1
@@ -179,3 +149,53 @@ export function SubagentActivityBlock({
</div>
);
}
+
+export function AssistantUiSubagentCall({
+ activity,
+ running = false,
+ description,
+ onView,
+ defaultOpen = false,
+}: {
+ activity: SubagentActivity;
+ running?: boolean;
+ description?: string;
+ onView?: () => void;
+ defaultOpen?: boolean;
+}) {
+ const name = activity.displayName ?? activity.agentId ?? 'subagent';
+ return (
+ <Collapsible
+ defaultOpen={defaultOpen}
+ data-slot="aui_subagent-call"
+ data-testid="assistant-ui-subagent-call"
+ className={cn(
+ 'aui-subagent-call border-border/60 dark:border-muted-foreground/15 rounded-xl border',
+ running && 'border-dashed'
+ )}>
+ <CollapsibleTrigger className="group/subagent text-muted-foreground hover:text-foreground flex w-full items-center gap-2 px-3 py-2 text-sm transition-colors">
+ <WorkflowIcon className="size-4 shrink-0" />
+ <span className="text-start leading-none">
+ Delegated to <b className="text-foreground">{name}</b>
+ </span>
+ {running ? (
+ <span className="bg-muted text-muted-foreground flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] leading-none">
+ <Loader2Icon className="size-3 animate-spin [animation-duration:0.6s]" /> running
+ </span>
+ ) : (
+ <span className="text-muted-foreground flex shrink-0 items-center gap-1.5 text-[11px] leading-none">
+ <CheckIcon className="size-3.5" />
+ {activity.elapsedMs != null ? (
+ <span className="tabular-nums">{(activity.elapsedMs / 1000).toFixed(1)}s</span>
+ ) : null}
+ </span>
+ )}
+ <ChevronDownIcon className="ml-auto size-4 shrink-0 -rotate-90 transition-transform group-data-[state=open]/subagent:rotate-0" />
+ </CollapsibleTrigger>
+ <CollapsibleContent className="px-3 pb-3">
+ {description ? <p className="text-muted-foreground text-xs">{description}</p> : null}
+ <SubagentDetails subagent={activity} onView={onView} />
+ </CollapsibleContent>
+ </Collapsible>
+ );
+}
diff --git a/app/src/features/conversations/components/ChatToolParts.tsx b/app/src/features/conversations/components/ChatToolParts.tsx
index f2d8c59a3a..606abd8490 100644
--- a/app/src/features/conversations/components/ChatToolParts.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.tsx
@@ -1,22 +1,15 @@
import type { ToolCallMessagePartComponent } from '@assistant-ui/react';
-import { CheckIcon, ChevronDownIcon, Loader2Icon, WorkflowIcon } from 'lucide-react';
import type { FC, PropsWithChildren } from 'react';
-import { cn } from '../../../components/assistant-ui/lib/utils';
import type { ThreadGroupPart } from '../../../components/assistant-ui/thread';
import {
ToolGroupContent,
ToolGroupRoot,
ToolGroupTrigger,
} from '../../../components/assistant-ui/tool-group';
-import {
- Collapsible,
- CollapsibleContent,
- CollapsibleTrigger,
-} from '../../../components/assistant-ui/ui/collapsible';
import type { SubagentActivity } from '../../../store/chatRuntimeSlice';
+import { AssistantUiSubagentCall } from './AssistantUiSubagentCall';
import { OpenHumanToolCall } from './AssistantUiToolCall';
-import { SubagentActivityBlock } from './SubagentActivityBlock';
function asSubagentActivity(value: unknown): SubagentActivity | undefined {
if (!value || typeof value !== 'object') return undefined;
@@ -44,50 +37,18 @@ function readSubagentState(
return { activity: progress, running: result === undefined };
}
-/** Render a real OpenHuman `task` delegation using the existing activity view. */
+/** Adapt an assistant-ui `task` part onto the shared delegation card. */
export const SubagentCall: ToolCallMessagePartComponent = ({ args, result }) => {
const { activity, running } = readSubagentState(args, result);
const description = (args as { description?: string } | undefined)?.description;
- const name =
- activity?.displayName ??
- activity?.agentId ??
- (args as { subagent_type?: string } | undefined)?.subagent_type ??
- 'subagent';
-
+ const fallbackAgent = (args as { subagent_type?: string } | undefined)?.subagent_type;
+ const resolved = activity ?? {
+ taskId: 'pending-subagent',
+ agentId: fallbackAgent ?? 'subagent',
+ toolCalls: [],
+ };
return (
- <Collapsible
- defaultOpen={false}
- data-slot="aui_subagent-call"
- data-testid="assistant-ui-subagent-call"
- className={cn(
- 'aui-subagent-call border-border/60 dark:border-muted-foreground/15 rounded-xl border',
- running && 'border-dashed'
- )}>
- <CollapsibleTrigger className="group/subagent text-muted-foreground hover:text-foreground flex w-full items-center gap-2 px-3 py-2 text-sm transition-colors">
- <WorkflowIcon className="size-4 shrink-0" />
- <span className="text-start leading-none">
- Delegated to <b className="text-foreground">{name}</b>
- </span>
- {running ? (
- <span className="bg-muted text-muted-foreground flex shrink-0 items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] leading-none">
- <Loader2Icon className="size-3 animate-spin [animation-duration:0.6s]" />
- running
- </span>
- ) : (
- <span className="text-muted-foreground flex shrink-0 items-center gap-1.5 text-[11px] leading-none">
- <CheckIcon className="size-3.5" />
- {activity?.elapsedMs != null && (
- <span className="tabular-nums">{(activity.elapsedMs / 1000).toFixed(1)}s</span>
- )}
- </span>
- )}
- <ChevronDownIcon className="ml-auto size-4 shrink-0 -rotate-90 transition-transform group-data-[state=open]/subagent:rotate-0" />
- </CollapsibleTrigger>
- <CollapsibleContent className="px-3 pb-3">
- {description && <p className="text-muted-foreground text-xs">{description}</p>}
- {activity && <SubagentActivityBlock subagent={activity} />}
- </CollapsibleContent>
- </Collapsible>
+ <AssistantUiSubagentCall activity={resolved} running={running} description={description} />
);
};
diff --git a/app/src/features/conversations/components/PastTurnInsights.tsx b/app/src/features/conversations/components/PastTurnInsights.tsx
index 28d2e5c6a2..6389ed70e5 100644
--- a/app/src/features/conversations/components/PastTurnInsights.tsx
+++ b/app/src/features/conversations/components/PastTurnInsights.tsx
@@ -1,7 +1,8 @@
import type { ProcessingTranscriptItem, ToolTimelineEntry } from '../../../store/chatRuntimeSlice';
import { formatTimelineEntry } from '../../../utils/toolTimelineFormatting';
+import { AssistantUiSubagentCall } from './AssistantUiSubagentCall';
import { ProcessingTranscriptView } from './ProcessingTranscriptView';
-import { SubagentActivityBlock, ToolTimelineBlock } from './ToolTimelineBlock';
+import { ToolTimelineBlock } from './ToolTimelineBlock';
/**
* The collapsed process trail rendered above a PAST (settled) turn's answer on a
@@ -50,7 +51,7 @@ export function PastTurnInsights({
<p className="text-[12px] font-medium text-content-secondary">
{formatTimelineEntry(entry).title}
</p>
- <SubagentActivityBlock subagent={entry.subagent!} />
+ <AssistantUiSubagentCall activity={entry.subagent!} />
</div>
))}
</div>
diff --git a/app/src/features/conversations/components/ProcessingTranscriptView.tsx b/app/src/features/conversations/components/ProcessingTranscriptView.tsx
index 4d2a680d01..b2ddf66801 100644
--- a/app/src/features/conversations/components/ProcessingTranscriptView.tsx
+++ b/app/src/features/conversations/components/ProcessingTranscriptView.tsx
@@ -35,7 +35,7 @@ export function ProcessingTranscriptView({
* Renders a delegated sub-agent's nested activity (its own child tool calls,
* transcript and thoughts) under the row that spawned it.
*
- * Injected rather than imported because `SubagentActivityBlock` lives in
+ * Injected rather than imported because the assistant-ui delegation card lives in
* `ToolTimelineBlock`, which imports THIS component for the inline rail —
* importing it back would be a cycle. Without this, a `subagent:*` row
* rendered as a bare one-line step and every child tool call it made was
@@ -171,7 +171,7 @@ function ToolRow({
{/* A delegated sub-agent's own tool calls hang off the parent entry, so
without this the whole child run collapsed into this single line.
Rendered as a `<div>` SIBLING under the `<li>` (indented past the
- icon), not nested inside the label `<span>` — SubagentActivityBlock
+ icon), not nested inside the label `<span>` — the delegation card
renders a `<div>`, and `<div>`-inside-`<span>` is invalid nesting. */}
{entry.subagent && renderSubagent ? (
<div className="ml-5" data-testid="processing-subagent">
diff --git a/app/src/features/conversations/components/SubagentDrawer.tsx b/app/src/features/conversations/components/SubagentDrawer.tsx
index 328c7feaf3..7df0210f1a 100644
--- a/app/src/features/conversations/components/SubagentDrawer.tsx
+++ b/app/src/features/conversations/components/SubagentDrawer.tsx
@@ -1,7 +1,7 @@
import createDebug from 'debug';
import { type ReactNode, useEffect, useState } from 'react';
-import Badge from '../../../components/ui/Badge';
+import Badge, { type BadgeVariant } from '../../../components/ui/Badge';
import Button from '../../../components/ui/Button';
import { SheetContent, SheetRoot, SheetTitle } from '../../../components/ui/Sheet';
import { useT } from '../../../lib/i18n/I18nContext';
@@ -14,15 +14,30 @@ import type {
import type { ThreadMessage } from '../../../types/thread';
import { stripToolCallEnvelopes } from '../../../utils/toolTimelineFormatting';
import { BubbleMarkdown } from './AgentMessageBubble';
-import {
- formatElapsed,
- subagentStatusVariant,
- SubagentToolCallRow,
- useSubagentStatusLabel,
-} from './SubagentToolCallRow';
+import { AssistantUiToolCallCard } from './AssistantUiToolCall';
const log = createDebug('app:conversations:subagent-drawer');
+function formatElapsed(ms: number): string {
+ return ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${ms}ms`;
+}
+
+function subagentStatusVariant(status: ToolTimelineEntryStatus | undefined): BadgeVariant {
+ if (status === 'success') return 'success';
+ if (status === 'error') return 'danger';
+ if (status === 'cancelled') return 'neutral';
+ return 'warning';
+}
+
+function useSubagentStatusLabel(status: ToolTimelineEntryStatus | undefined): string {
+ const { t } = useT();
+ if (status === 'success') return t('conversations.subagent.statusCompleted');
+ if (status === 'error') return t('conversations.subagent.statusFailed');
+ if (status === 'cancelled') return t('conversations.subagent.statusCancelled');
+ if (status === 'awaiting_user') return t('conversations.subagent.statusAwaitingUser');
+ return t('conversations.subagent.statusRunning');
+}
+
/**
* Rebuild a renderable transcript from a worker sub-thread's persisted
* messages so a delegation can be reopened from memory after its live
@@ -367,7 +382,16 @@ export function SubagentDrawer({
return (
<ItemWrapper key={`tl-${item.callId}`} divider={turnDivider}>
- <SubagentToolCallRow item={item} />
+ <AssistantUiToolCallCard
+ toolName={item.toolName}
+ args={item.args}
+ result={item.result}
+ status={item.status}
+ displayName={item.displayName}
+ detail={item.detail}
+ elapsedMs={item.elapsedMs}
+ failure={item.failure}
+ />
</ItemWrapper>
);
})}
diff --git a/app/src/features/conversations/components/SubagentToolCallRow.tsx b/app/src/features/conversations/components/SubagentToolCallRow.tsx
deleted file mode 100644
index c2c030eefb..0000000000
--- a/app/src/features/conversations/components/SubagentToolCallRow.tsx
+++ /dev/null
@@ -1,87 +0,0 @@
-import Badge, { type BadgeVariant } from '../../../components/ui/Badge';
-import { useT } from '../../../lib/i18n/I18nContext';
-import type {
- SubagentTranscriptItem,
- ToolTimelineEntryStatus,
-} from '../../../store/chatRuntimeSlice';
-import { AssistantUiToolCallCard } from './AssistantUiToolCall';
-
-/** Human-readable elapsed time for a sub-agent run or one of its tool calls. */
-export function formatElapsed(ms: number): string {
- return ms >= 1000 ? `${(ms / 1000).toFixed(1)}s` : `${ms}ms`;
-}
-
-/**
- * Map a sub-agent lifecycle status to the shared {@link Badge} variant used
- * for it everywhere in the conversation panel, so the drawer header pill, the
- * transcript tool rows and the inline timeline all read as one system. Kept in
- * one place because a status that renders `warning` in one surface and
- * `neutral` in another is a bug nobody notices until a screenshot diff.
- */
-export function subagentStatusVariant(status: ToolTimelineEntryStatus | undefined): BadgeVariant {
- switch (status) {
- case 'success':
- return 'success';
- case 'error':
- return 'danger';
- case 'cancelled':
- return 'neutral';
- default:
- // running / awaiting_user — in flight, needs attention.
- return 'warning';
- }
-}
-
-/** Localised label for a sub-agent lifecycle status. */
-export function useSubagentStatusLabel(status: ToolTimelineEntryStatus | undefined): string {
- const { t } = useT();
- switch (status) {
- case 'success':
- return t('conversations.subagent.statusCompleted');
- case 'error':
- return t('conversations.subagent.statusFailed');
- case 'cancelled':
- return t('conversations.subagent.statusCancelled');
- case 'awaiting_user':
- return t('conversations.subagent.statusAwaitingUser');
- default:
- return t('conversations.subagent.statusRunning');
- }
-}
-
-type SubagentToolItem = Extract<SubagentTranscriptItem, { kind: 'tool' }>;
-
-/**
- * Pretty-print a tool's input arguments for display. Objects/arrays are
- * rendered as indented JSON; a string is shown verbatim. Returns `null` when
- * there are no arguments to show (e.g. a tool called with no input, or a
- * transcript reopened from memory where args weren't persisted).
- */
-export function formatArgs(args: unknown): string | null {
- if (args == null) return null;
- if (typeof args === 'string') return args.length > 0 ? args : null;
- try {
- return JSON.stringify(args, null, 2);
- } catch {
- return String(args);
- }
-}
-
-/**
- * Drawer child calls use the exact assistant-ui card used by parent and inline
- * tools. The drawer no longer owns a parallel tool-call component hierarchy.
- */
-export function SubagentToolCallRow({ item }: { item: SubagentToolItem }) {
- return (
- <AssistantUiToolCallCard
- toolName={item.toolName}
- args={item.args}
- result={item.result}
- status={item.status}
- displayName={item.displayName}
- detail={item.detail}
- elapsedMs={item.elapsedMs}
- failure={item.failure}
- />
- );
-}
diff --git a/app/src/features/conversations/components/ToolTimelineBlock.tsx b/app/src/features/conversations/components/ToolTimelineBlock.tsx
index 61a8e54e68..345356c7b3 100644
--- a/app/src/features/conversations/components/ToolTimelineBlock.tsx
+++ b/app/src/features/conversations/components/ToolTimelineBlock.tsx
@@ -15,8 +15,8 @@ import type {
import { formatTimelineEntry, stripToolCallEnvelopes } from '../../../utils/toolTimelineFormatting';
import { parseWorkerThreadRef } from '../utils/workerThreadRef';
import { agentNameTone, AgentTimelineRail } from './AgentTimelineRail';
+import { AssistantUiSubagentCall } from './AssistantUiSubagentCall';
import { ProcessingTranscriptView } from './ProcessingTranscriptView';
-import { SubagentActivityBlock } from './SubagentActivityBlock';
import {
coalesceTimelineEntries,
normalizeToolBody,
@@ -25,13 +25,6 @@ import {
} from './toolTimelineRows';
import { WorkerThreadRefCard } from './WorkerThreadRefCard';
-/**
- * Re-exported so the historical import path keeps resolving. The component
- * itself moved to `./SubagentActivityBlock` when this file was split; it is a
- * pure move, no behaviour changed.
- */
-export { SubagentActivityBlock } from './SubagentActivityBlock';
-
/** Tail of the parent's in-flight response shown in the processing panel. */
const RESPONSE_PREVIEW_CHARS = 320;
@@ -426,8 +419,9 @@ export function ToolTimelineBlock({
transcript={transcript}
entries={ordered}
renderSubagent={subagent => (
- <SubagentActivityBlock
- subagent={subagent}
+ <AssistantUiSubagentCall
+ activity={subagent}
+ running={subagent.status !== 'completed'}
onView={onViewSubagent ? () => onViewSubagent(subagent) : undefined}
/>
)}
@@ -536,8 +530,9 @@ export function ToolTimelineBlock({
</pre>
) : null}
{subagent ? (
- <SubagentActivityBlock
- subagent={subagent}
+ <AssistantUiSubagentCall
+ activity={subagent}
+ running={entry.status === 'running' || entry.status === 'awaiting_user'}
onView={onViewSubagent ? () => onViewSubagent(subagent) : undefined}
/>
) : null}
diff --git a/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx b/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx
index 0518f6514a..6939bacb0b 100644
--- a/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx
+++ b/app/src/features/conversations/components/__tests__/ToolTimelineBlock.test.tsx
@@ -4,8 +4,19 @@ import { Provider } from 'react-redux';
import { describe, expect, it, vi } from 'vitest';
import { store } from '../../../../store';
-import type { ToolTimelineEntry } from '../../../../store/chatRuntimeSlice';
-import { SubagentActivityBlock, ToolTimelineBlock } from '../ToolTimelineBlock';
+import type { SubagentActivity, ToolTimelineEntry } from '../../../../store/chatRuntimeSlice';
+import { AssistantUiSubagentCall } from '../AssistantUiSubagentCall';
+import { ToolTimelineBlock } from '../ToolTimelineBlock';
+
+function SubagentActivityBlock({
+ subagent,
+ onView,
+}: {
+ subagent: SubagentActivity;
+ onView?: () => void;
+}) {
+ return <AssistantUiSubagentCall activity={subagent} onView={onView} defaultOpen />;
+}
// #1122 — guards the parent-thread live subagent rendering. The block
// always expands subagent rows so the activity stays visible while the
@@ -928,6 +939,10 @@ describe('ToolTimelineBlock — subagent rendering', () => {
};
renderInStore(<ToolTimelineBlock entries={[entry]} />);
+ const subagent = screen.getByTestId('assistant-ui-subagent-call');
+ const trigger = within(subagent).getByRole('button');
+ expect(trigger).toHaveAttribute('aria-expanded', 'false');
+ fireEvent.click(trigger);
const calls = screen.getAllByTestId('assistant-ui-tool-call');
expect(calls).toHaveLength(1);
expect(calls[0].textContent).toContain('Searching the web');
@@ -1033,7 +1048,7 @@ describe('ToolTimelineBlock — compact chat mode (onViewDetails)', () => {
},
];
- it('collapses finished steps to a "View details" link but keeps the running step expanded inline', () => {
+ it('collapses finished steps to a link and keeps the running delegation card inline', () => {
const onViewDetails = vi.fn();
renderInStore(<ToolTimelineBlock entries={entries} onViewDetails={onViewDetails} />);
@@ -1041,8 +1056,12 @@ describe('ToolTimelineBlock — compact chat mode (onViewDetails)', () => {
const links = screen.getAllByTestId('view-details');
expect(links).toHaveLength(1);
- // The currently-running sub-agent stays expanded inline in the main UI
- // (its activity is visible) — and shows no "View details" link itself.
+ // The running delegation remains inline but its assistant-ui disclosure is
+ // collapsed by default like every other delegation card.
+ const subagent = screen.getByTestId('assistant-ui-subagent-call');
+ const trigger = within(subagent).getByRole('button');
+ expect(trigger).toHaveAttribute('aria-expanded', 'false');
+ fireEvent.click(trigger);
const activity = screen.getByTestId('subagent-activity');
expect(activity.textContent).toContain('pondering');
// The finished step SUCCEEDED, so its raw output is no longer duplicated
@@ -1085,7 +1104,9 @@ describe('ToolTimelineBlock — compact chat mode (onViewDetails)', () => {
it('still expands inline (no compact link) when onViewDetails is omitted (panel mode)', () => {
renderInStore(<ToolTimelineBlock entries={entries} expandAllRows />);
- // Panel/expandable path: sub-agent activity is shown, no "View details" link.
+ const subagent = screen.getByTestId('assistant-ui-subagent-call');
+ fireEvent.click(within(subagent).getByRole('button'));
+ // Panel path uses the same delegation card, with no compact details link.
expect(screen.getByTestId('subagent-activity')).toBeInTheDocument();
expect(screen.queryByTestId('view-details')).toBeNull();
});
@@ -1398,6 +1419,8 @@ describe('ToolTimelineBlock — sub-agent activity survives the transcript path'
expect(screen.getByTestId('processing-transcript')).toBeInTheDocument();
// …and the nested child run is present, not collapsed to one line.
expect(screen.getByTestId('processing-subagent')).toBeInTheDocument();
+ const subagent = screen.getByTestId('assistant-ui-subagent-call');
+ fireEvent.click(within(subagent).getByRole('button'));
const calls = screen.getAllByTestId('assistant-ui-tool-call');
expect(calls).toHaveLength(2);
expect(calls[0].textContent).toContain('Searched the web');
@@ -1410,6 +1433,8 @@ describe('ToolTimelineBlock — sub-agent activity survives the transcript path'
it('still renders child tool calls on the legacy row path (no transcript)', () => {
renderInStore(<ToolTimelineBlock entries={[subagentEntry]} turnActive />);
expect(screen.queryByTestId('processing-transcript')).toBeNull();
+ const subagent = screen.getByTestId('assistant-ui-subagent-call');
+ fireEvent.click(within(subagent).getByRole('button'));
expect(screen.getAllByTestId('assistant-ui-tool-call')).toHaveLength(2);
});
diff --git a/app/src/features/conversations/derived/mapDisplayItems.ts b/app/src/features/conversations/derived/mapDisplayItems.ts
index 1d5c3233ee..e3dab1b56f 100644
--- a/app/src/features/conversations/derived/mapDisplayItems.ts
+++ b/app/src/features/conversations/derived/mapDisplayItems.ts
@@ -4,7 +4,7 @@
* models, keyed by producing `requestId` — the exact shapes
* `fetchAndHydrateTurnHistory` produces from the legacy `turn_state_history`
* snapshot ring, so `PastTurnInsights` / `ProcessingTranscriptView` /
- * `ToolTimelineBlock` / `SubagentActivityBlock` are reused unchanged.
+ * assistant-ui tool and delegation cards are reused unchanged.
*
* Division of labour (matches how `turnTimelinesByThread` / `PastTurnInsights`
* anchor today):
@@ -136,7 +136,7 @@ function stringifyArgs(args: unknown): string | undefined {
* Build a {@link SubagentActivity} from a `subagent` display item's nested
* items. The nested vocabulary (reasoning / assistantMessage / toolCall)
* projects onto the sub-agent transcript (`thinking` / `text` / `tool`) plus a
- * flat `toolCalls` list — exactly what `SubagentActivityBlock` reads.
+ * flat `toolCalls` list — exactly what the assistant-ui delegation card reads.
*/
function buildSubagentActivity(id: string, items: DerivedDisplayItem[]): SubagentActivity {
const toolCalls: SubagentToolCallEntry[] = [];
diff --git a/app/src/types/derivedTranscript.ts b/app/src/types/derivedTranscript.ts
index e683ee6985..c4e5743739 100644
--- a/app/src/types/derivedTranscript.ts
+++ b/app/src/types/derivedTranscript.ts
@@ -6,7 +6,7 @@
* The Rust core projects the append-only `session_raw/*.jsonl` source of truth
* into typed **display items** in the frontend's chat vocabulary. Phase C maps
* these onto the existing settled-turn renderers (`PastTurnInsights` /
- * `ProcessingTranscriptView` / `ToolTimelineBlock` / `SubagentActivityBlock`)
+ * `ProcessingTranscriptView` / assistant-ui tool and delegation cards)
* via `features/conversations/derived/mapDisplayItems.ts`.
*
* Serde is camelCase on the wire, so every field here is camelCase and mirrors