Skip to content

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

refactor(conversations): remove timeline refactor scaffolding

Steven Enamakeld322c717078f
diff --git a/app/src/features/conversations/timeline/ConversationTimeline.test.tsx b/app/src/features/conversations/timeline/ConversationTimeline.test.tsx
deleted file mode 100644
index 0b1425740b..0000000000
--- a/app/src/features/conversations/timeline/ConversationTimeline.test.tsx
+++ /dev/null
@@ -1,126 +0,0 @@
-import { render, screen } from '@testing-library/react';
-import { Provider } from 'react-redux';
-import { describe, expect, it, vi } from 'vitest';
-
-import { store } from '../../../store';
-import type { StreamingAssistantState, ToolTimelineEntry } from '../../../store/chatRuntimeSlice';
-import type { ThreadMessage } from '../../../types/thread';
-import { ConversationTimeline } from './ConversationTimeline';
-import { buildThreadTimeline } from './selectors';
-
-function renderInStore(ui: React.ReactNode) {
- return render(<Provider store={store}>{ui}</Provider>);
-}
-
-function userMsg(id: string, content: string): ThreadMessage {
- return {
- id,
- content,
- type: 'text',
- extraMetadata: {},
- sender: 'user',
- createdAt: '2026-01-01T00:00:00Z',
- };
-}
-function agentMsg(id: string, content: string): ThreadMessage {
- return {
- id,
- content,
- type: 'text',
- extraMetadata: {},
- sender: 'agent',
- createdAt: '2026-01-01T00:00:01Z',
- };
-}
-function tool(id: string, name: string, round = 0): ToolTimelineEntry {
- return { id, name, round, seq: 0, status: 'success' };
-}
-function subagentRow(id: string, taskId: string): ToolTimelineEntry {
- return {
- id,
- name: 'subagent:researcher',
- round: 0,
- seq: 0,
- status: 'running',
- subagent: { taskId, agentId: 'researcher', toolCalls: [] },
- };
-}
-function stream(requestId: string, content: string, thinking = ''): StreamingAssistantState {
- return { requestId, content, thinking };
-}
-
-function timeline(over: Partial<Parameters<typeof buildThreadTimeline>[0]>) {
- return buildThreadTimeline({
- threadId: 't1',
- messages: [],
- toolTimeline: [],
- streaming: null,
- parallelStreams: [],
- hideAgentInsights: false,
- ...over,
- });
-}
-
-describe('ConversationTimeline', () => {
- it('renders user + assistant messages in order', () => {
- const items = timeline({ messages: [userMsg('u1', 'hello there'), agentMsg('a1', 'hi back')] });
- renderInStore(<ConversationTimeline items={items} />);
- expect(screen.getByTestId('conversation-timeline')).toBeTruthy();
- expect(screen.getByText('hello there')).toBeTruthy();
- expect(screen.getByText('hi back')).toBeTruthy();
- });
-
- it('coalesces a run of process items into a single ToolTimelineBlock', () => {
- const items = timeline({
- messages: [userMsg('u1', 'go')],
- toolTimeline: [tool('c1', 'read_file', 0), tool('c2', 'write_file', 1)],
- });
- const { container } = renderInStore(<ConversationTimeline items={items} />);
- // The two consecutive tool items coalesce into one ToolTimelineBlock (one
- // "Agentic task insights" disclosure group), not two separate blocks.
- expect(container.querySelectorAll('[data-testid="agent-task-insights"]')).toHaveLength(1);
- });
-
- it('invokes onOpenSubagent when a subagent row requests the drawer', () => {
- const onOpenSubagent = vi.fn();
- const items = timeline({
- messages: [userMsg('u1', 'go')],
- toolTimeline: [subagentRow('row1', 'sub-1')],
- });
- renderInStore(<ConversationTimeline items={items} handlers={{ onOpenSubagent }} />);
- // The subagent row renders within the block; the handler is wired through.
- expect(screen.getByTestId('conversation-timeline')).toBeTruthy();
- });
-
- it('renders a streaming tail with the 120-char slice and thinking details', () => {
- const long = 'x'.repeat(200);
- const items = timeline({
- messages: [userMsg('u1', 'go')],
- streaming: stream('req1', long, 'deliberating'),
- });
- renderInStore(<ConversationTimeline items={items} />);
- const primary = screen.getByTestId('stream-primary');
- // Truncation ellipsis is present and the thinking summary renders.
- expect(primary.textContent).toContain('…');
- expect(primary.textContent).toContain('deliberating');
- // Only the last 120 chars of the 200-char body render in the content bubble.
- const contentBubble = primary.querySelector('.font-mono.text-sm');
- expect(contentBubble?.textContent).toBe(`…${'x'.repeat(120)}`);
- });
-
- it('renders forked branch streams as branch tails', () => {
- const items = timeline({
- messages: [userMsg('u1', 'go')],
- parallelStreams: [stream('b1', 'branch answer')],
- });
- renderInStore(<ConversationTimeline items={items} />);
- expect(screen.getByTestId('stream-branch')).toBeTruthy();
- expect(screen.getByText('branch answer')).toBeTruthy();
- });
-
- it('renders nothing but the container for an empty timeline', () => {
- renderInStore(<ConversationTimeline items={[]} />);
- const container = screen.getByTestId('conversation-timeline');
- expect(container.children).toHaveLength(0);
- });
-});
diff --git a/app/src/features/conversations/timeline/ConversationTimeline.tsx b/app/src/features/conversations/timeline/ConversationTimeline.tsx
deleted file mode 100644
index 7ab6dff727..0000000000
--- a/app/src/features/conversations/timeline/ConversationTimeline.tsx
+++ /dev/null
@@ -1,98 +0,0 @@
-import type { SubagentActivity, ToolTimelineEntry } from '../../../store/chatRuntimeSlice';
-import { ToolTimelineBlock } from '../components/ToolTimelineBlock';
-import { AssistantMessageItem } from './items/AssistantMessageItem';
-import { StreamingTailItem } from './items/StreamingTailItem';
-import { UserMessageItem } from './items/UserMessageItem';
-import type { TimelineItem } from './types';
-
-interface ConversationTimelineHandlers {
- /** Opens the full-transcript drawer for a subagent row. */
- onOpenSubagent?: (subagent: SubagentActivity) => void;
- /** Opens the whole-run "Agent Process Source" panel. */
- onViewWholeRun?: () => void;
-}
-
-/** True for the process kinds that coalesce into one `ToolTimelineBlock`. */
-function isProcessItem(item: TimelineItem): item is TimelineItem & { entry: ToolTimelineEntry } {
- return item.kind === 'toolCall' || item.kind === 'subagentActivity';
-}
-
-/**
- * Pure renderer: `TimelineItem[]` → one element per kind, wrapping the existing
- * components (see `docs/plans/conversations-timeline-refactor.md` Phase 2).
- *
- * Consecutive process items (`toolCall`/`subagentActivity`) are coalesced into a
- * single `ToolTimelineBlock` so the timeline reads as one grouped block,
- * matching today's `agentInsights` anchor. Ordering, anchoring, and
- * `hideAgentInsights` filtering live upstream in the selector — this component
- * only maps items to UI.
- */
-export function ConversationTimeline({
- items,
- agentMessageViewMode = 'text',
- handlers = {},
-}: {
- items: TimelineItem[];
- agentMessageViewMode?: 'text' | 'bubbles';
- handlers?: ConversationTimelineHandlers;
-}) {
- const rendered: React.ReactNode[] = [];
-
- for (let i = 0; i < items.length; i += 1) {
- const item = items[i];
-
- // Coalesce a contiguous run of process items into one ToolTimelineBlock.
- if (isProcessItem(item)) {
- const run: ToolTimelineEntry[] = [];
- const startId = item.id;
- let j = i;
- while (j < items.length && isProcessItem(items[j])) {
- run.push((items[j] as TimelineItem & { entry: ToolTimelineEntry }).entry);
- j += 1;
- }
- rendered.push(
- <ToolTimelineBlock
- key={`process:${startId}`}
- entries={run}
- onViewSubagent={handlers.onOpenSubagent}
- onViewWholeRun={handlers.onViewWholeRun}
- />
- );
- i = j - 1;
- continue;
- }
-
- switch (item.kind) {
- case 'userMessage':
- rendered.push(<UserMessageItem key={item.id} content={item.message.content} />);
- break;
- case 'assistantMessage':
- rendered.push(
- <AssistantMessageItem
- key={item.id}
- content={item.message.content}
- viewMode={agentMessageViewMode}
- />
- );
- break;
- case 'streamingText':
- rendered.push(
- <StreamingTailItem
- key={item.id}
- text={item.text}
- thinking={item.thinking}
- branch={item.branch}
- />
- );
- break;
- default:
- break;
- }
- }
-
- return (
- <div data-testid="conversation-timeline" className="space-y-3">
- {rendered}
- </div>
- );
-}
diff --git a/app/src/features/conversations/timeline/items/AssistantMessageItem.tsx b/app/src/features/conversations/timeline/items/AssistantMessageItem.tsx
deleted file mode 100644
index 84ed15f1d6..0000000000
--- a/app/src/features/conversations/timeline/items/AssistantMessageItem.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import { Fragment } from 'react';
-
-import { splitAgentMessageIntoBubbles } from '../../../../utils/agentMessageBubbles';
-import { AgentMessageBubble, AgentMessageText } from '../../components/AgentMessageBubble';
-import type { AgentBubblePosition } from '../../utils/format';
-
-/**
- * Renders one assistant message. In `text` view mode the whole message is one
- * markdown block; otherwise it is split into positioned bubbles via
- * `splitAgentMessageIntoBubbles` (matching the current render loop).
- */
-export function AssistantMessageItem({
- content,
- viewMode = 'bubbles',
-}: {
- content: string;
- viewMode?: 'text' | 'bubbles';
-}) {
- if (viewMode === 'text') {
- return <AgentMessageText content={content} />;
- }
- const parts = splitAgentMessageIntoBubbles(content);
- return (
- <>
- {parts.map((segment, index) => {
- const position: AgentBubblePosition =
- parts.length === 1
- ? 'single'
- : index === 0
- ? 'first'
- : index === parts.length - 1
- ? 'last'
- : 'middle';
- return (
- <Fragment key={index}>
- <AgentMessageBubble content={segment} position={position} />
- </Fragment>
- );
- })}
- </>
- );
-}
diff --git a/app/src/features/conversations/timeline/items/StreamingTailItem.tsx b/app/src/features/conversations/timeline/items/StreamingTailItem.tsx
deleted file mode 100644
index 59186e7f23..0000000000
--- a/app/src/features/conversations/timeline/items/StreamingTailItem.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Ephemeral streaming preview (primary stream or a forked branch). Mirrors the
- * current 120-char tail-slice ticker: the full answer arrives as a durable
- * message on completion, this only signals progress without jumping scroll.
- */
-const STREAMING_PREVIEW_CHARS = 120;
-
-export function StreamingTailItem({
- text,
- thinking,
- branch = false,
-}: {
- text: string;
- thinking?: string;
- branch?: boolean;
-}) {
- const tail = text.slice(-STREAMING_PREVIEW_CHARS);
- const truncated = text.length > STREAMING_PREVIEW_CHARS;
- return (
- <div className="flex justify-start" data-testid={branch ? 'stream-branch' : 'stream-primary'}>
- <div className="max-w-[80%] space-y-1">
- {thinking && thinking.length > 0 ? (
- <details className="text-xs text-content-muted">
- <summary className="cursor-pointer select-none">Thinking…</summary>
- <p className="whitespace-pre-wrap font-mono">
- {thinking.slice(-STREAMING_PREVIEW_CHARS)}
- </p>
- </details>
- ) : null}
- <div className="rounded-2xl bg-surface-subtle px-4 py-2 font-mono text-sm text-content-secondary">
- {truncated ? '…' : ''}
- {tail}
- </div>
- </div>
- </div>
- );
-}
diff --git a/app/src/features/conversations/timeline/items/UserMessageItem.tsx b/app/src/features/conversations/timeline/items/UserMessageItem.tsx
deleted file mode 100644
index 813296a004..0000000000
--- a/app/src/features/conversations/timeline/items/UserMessageItem.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { BubbleMarkdown } from '../../components/AgentMessageBubble';
-
-/**
- * Renders one user message bubble (text only). Attachment/reaction chrome is
- * layered on by the panel at swap time; this keeps the pure renderer focused on
- * the message text.
- */
-export function UserMessageItem({ content }: { content: string }) {
- return (
- <div className="flex justify-end">
- <div className="max-w-[80%] rounded-2xl bg-primary-500 px-4 py-2 text-sm text-content-inverted">
- <BubbleMarkdown content={content} />
- </div>
- </div>
- );
-}