Skip to content

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

Merge upstream/main into conversations-ui-cleanup

Steven Enamakel39606772a661
diff --cc app/src/features/conversations/components/ChatToolParts.test.tsx
index 4819005a8d,f42528c6a7..a8bfa5b29b
--- a/app/src/features/conversations/components/ChatToolParts.test.tsx
+++ b/app/src/features/conversations/components/ChatToolParts.test.tsx
@@@ -215,51 -207,65 +215,109 @@@ describe('ChatToolParts', () =>
addResult={() => {}}
resume={() => {}}
respondToApproval={() => {}}
+ {...extra}
/>
);
+ return screen.getByTestId('assistant-ui-tool-call');
+ }
+
+ it('labels tool discovery as a tool search, not a web search', () => {
+ const card = renderTool('tool_search', { query: 'send an email with gmail' });
- expect(card).toHaveTextContent('Searching tools');
++ expect(card).toHaveTextContent('Finding the right tool');
+ expect(card).not.toHaveTextContent(/web/i);
+ });
+
+ it('labels a Composio action with a query argument by its service', () => {
+ const card = renderTool('GMAIL_FETCH_EMAILS', { query: 'from:broker' });
+ expect(card).toHaveTextContent('Making requests to your Gmail account');
+ expect(card).not.toHaveTextContent(/web/i);
+ });
+
+ it('labels a tool_call bridge by the tool it invokes', () => {
+ const card = renderTool('tool_call', {
+ name: 'GMAIL_SEND_EMAIL',
+ arguments: { recipient_email: '[email protected]', subject: 'AAPL' },
+ });
+ expect(card).toHaveTextContent('Making requests to your Gmail account');
+ expect(card).not.toHaveTextContent(/web/i);
+ });
+
+ it('labels memory searches as memory, not the web', () => {
+ const card = renderTool('memory_hybrid_search', { query: 'apple stock' });
+ expect(card).toHaveTextContent('Searching memory');
+ expect(card).not.toHaveTextContent(/web/i);
+ });
+
+ it('prefers the label the row carries on the part artifact', () => {
+ const card = renderTool(
+ 'stock_quote',
+ { symbol: 'AAPL' },
+ { artifact: { displayName: 'Stock quote', detail: 'AAPL' } }
+ );
+ expect(card).toHaveTextContent('Stock quote');
+ expect(card).toHaveTextContent('AAPL');
+ });
- expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Searched the web');
- expect(screen.getByTestId('assistant-ui-tool-call')).not.toHaveTextContent(/^Tool done$/);
+ it('humanises an unknown tool rather than guessing its category', () => {
+ const card = renderTool('tool', { query: 'latest world news' });
+ expect(card).not.toHaveTextContent(/web/i);
});
+
+ it('names the tool-discovery bridge for what it is, not a web search', () => {
+ // `tool_search` ranks the DEFERRED TOOL CATALOGUE — Composio actions, MCP
+ // tools — and never touches the network. It matched `looksLikeSearch`
+ // twice (its name contains "search" AND its argument is `query`), so a
+ // turn that fetched the user's own Google Calendar through Composio opened
+ // with "Searched the web".
+ render(
+ <ChatToolFallback
+ type="tool-call"
+ toolName="tool_search"
+ toolCallId="bridge-search"
+ args={{ query: 'list calendar events google calendar' } as never}
+ argsText={'{"query":"list calendar events google calendar"}'}
+ result="1 match(es). Invoke one with tool_call"
+ status={{ type: 'complete' }}
+ addResult={() => {}}
+ resume={() => {}}
+ respondToApproval={() => {}}
+ />
+ );
+
- expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Found the right tool');
- // The regression this pins: BOTH heuristic legs still match this row, so
- // dropping the explicit branch renders the web label again.
++ expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Finding the right tool');
++ // The regression this pins: the old name/argument-key heuristic matched
++ // this row on both legs.
+ expect(screen.getByTestId('assistant-ui-tool-call')).not.toHaveTextContent('Searched the web');
+ });
+
+ it('labels the tool_call wrapper by the tool it actually invoked', () => {
+ // `tool_call_schema()` declares `{name, arguments}`, both required, so the
+ // wrapped tool is always in `name`. The row used to show only the wrapper,
+ // so the one call that fetched the user's calendar rendered "Tool Call".
+ render(
+ <ChatToolFallback
+ type="tool-call"
+ toolName="tool_call"
+ toolCallId="bridge-call"
+ args={{ name: 'GOOGLECALENDAR_EVENTS_LIST', arguments: { calendarId: 'primary' } } as never}
+ argsText={'{"name":"GOOGLECALENDAR_EVENTS_LIST"}'}
+ result="Items: Product Team Standup"
+ status={{ type: 'complete' }}
+ addResult={() => {}}
+ resume={() => {}}
+ respondToApproval={() => {}}
+ />
+ );
+
+ // Composio slugs carry no separator inside the toolkit name, so this also
+ // pins the `googlecalendar` spelling in `KNOWN_TOOLKIT_RE`: without it the
+ // row degrades to the raw "GOOGLECALENDAR EVENTS LIST".
++ // Labelled like any direct Composio action: the service as the title, the
++ // action as the detail.
+ expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent(
- 'Google Calendar: Events list'
++ 'Updating your Google Calendar'
+ );
++ expect(screen.getByTestId('assistant-ui-tool-call')).toHaveTextContent('Events list');
+ expect(screen.getByTestId('assistant-ui-tool-call')).not.toHaveTextContent('Tool Call');
+ });
});
diff --cc app/src/providers/__tests__/assistantUiMessages.test.ts
index 7f1a08869a,6f00fbb725..5ab050830a
--- a/app/src/providers/__tests__/assistantUiMessages.test.ts
+++ b/app/src/providers/__tests__/assistantUiMessages.test.ts
@@@ -679,72 -681,29 +679,72 @@@ describe('one copy of the turn', () =>
[tool({ id: 'c1', name: 'file_read', status: 'success' })],
[
{ kind: 'thinking', round: 1, seq: 0, text: 'think' },
- { kind: 'narration', round: 1, seq: 1, text: 'narrate' },
- { kind: 'toolCall', round: 1, seq: 2, callId: 'c1' },
+ { kind: 'toolCall', round: 1, seq: 1, callId: 'c1' },
]
);
- expect(trailOf(converted)).toMatchObject({ steps: 3, tools: 1 });
+ expect(converted.content).toEqual([
+ { type: 'reasoning', text: 'think' },
+ expect.objectContaining({ type: 'tool-call', toolCallId: 'c1' }),
+ { type: 'text', text: 'done' },
+ ]);
+ expect(custom(converted)).not.toHaveProperty('processTrail');
});
- it('falls back to the tool rows for a legacy snapshot with no transcript', () => {
+ it('emits the pages the turn fetched as url source parts after the answer', () => {
const converted = toThreadMessageLike(msg({ id: 'a', sender: 'agent', content: 'done' }), [
- tool({ id: 'c1', status: 'success' }),
- tool({ id: 'c2', seq: 1, status: 'success' }),
+ tool({
+ id: 'f1',
+ name: 'web_fetch',
+ status: 'success',
+ argsBuffer: '{"url":"https://example.com/a"}',
+ }),
+ tool({
+ id: 'f2',
+ seq: 1,
+ name: 'web_fetch',
+ status: 'success',
+ argsBuffer: '{"url":"javascript:alert(1)"}',
+ }),
]);
- expect(trailOf(converted)).toMatchObject({ steps: 2, tools: 2 });
+ const parts = converted.content as unknown as { type: string }[];
+ expect(parts.at(-1)).toEqual({
+ type: 'source',
+ sourceType: 'url',
+ id: 'f1',
+ url: 'https://example.com/a',
+ title: 'example.com',
+ });
+ expect(parts.filter(part => part.type === 'source')).toHaveLength(1);
});
+});
- it('is null for a plain answer, so the footer renders no door', () => {
- expect(trailOf(toThreadMessageLike(msg({ id: 'a', sender: 'agent', content: 'hi' })))).toBe(
- null
- );
+describe('tool label on the part', () => {
+ const artifactOf = (converted: { content: unknown }) =>
+ (converted.content as { type: string; artifact?: unknown }[]).find(
+ part => part.type === 'tool-call'
+ )?.artifact;
+
+ it('carries the row label and detail the store resolved', () => {
+ const converted = toThreadMessageLike(msg({ id: 'a', sender: 'agent', content: 'done' }), [
+ tool({
+ id: 'c1',
+ name: 'GMAIL_SEND_EMAIL',
+ status: 'success',
+ displayName: 'Gmail send email',
+ detail: '[email protected]',
+ }),
+ ]);
+ expect(artifactOf(converted)).toEqual({
+ displayName: 'Gmail send email',
+ detail: '[email protected]',
+ });
});
- it('is absent on a user message', () => {
- expect(trailOf(toThreadMessageLike(msg({ id: 'u' })))).toBeUndefined();
+ it('formats a row that arrived with no label from the tool identity', () => {
+ const converted = toThreadMessageLike(msg({ id: 'a', sender: 'agent', content: 'done' }), [
+ tool({ id: 'c1', name: 'tool_search', status: 'success', argsBuffer: '{"query":"gmail"}' }),
+ ]);
- expect(artifactOf(converted)).toEqual({ displayName: 'Searching tools' });
++ expect(artifactOf(converted)).toEqual({ displayName: 'Finding the right tool' });
});
});
diff --cc app/src/utils/toolTimelineFormatting.ts
index 14f644bc9c,018fdc68fd..a1b9636faf
--- a/app/src/utils/toolTimelineFormatting.ts
+++ b/app/src/utils/toolTimelineFormatting.ts
@@@ -33,33 -29,20 +33,42 @@@ const TOOL_DISPLAY_NAMES: Record<string
// timeline row — without this entry a real search rendered as the
// humanized "Web Search Tool".
web_search_tool: 'Searching the web',
+ // The harness's tool-discovery bridge — NOT a web search.
+ // `vendor/tinyagents/crates/tinyagents-harness/src/tool/discover/bridge.rs`
+ // advertises two intrinsics: `tool_search` ranks the *deferred tool
+ // catalogue* (Composio actions, MCP tools) and `tool_call` invokes a hit by
+ // name. Neither reaches the network.
+ //
+ // They are `ToolSchema` values rather than `Tool` impls, so they carry no
+ // server `display_label` and there is nothing upstream to override — the
+ // label is the client's to get right. Without these entries `tool_search`
+ // fell through to a substring heuristic that fires on "search", and a
+ // Composio calendar fetch rendered as "Searched the web".
+ tool_search: 'Finding the right tool',
+ tool_call: 'Using a tool',
gitbooks_search: 'Searching docs',
+ // The other search engines the core registers (`search/`); each is a real
+ // web search, so they read the same as the canonical slot.
+ brave_news_search: 'Searching the news',
+ brave_image_search: 'Searching images',
+ brave_video_search: 'Searching videos',
+ searxng_search: 'Searching the web',
+ seltz_search: 'Searching the web',
+ tinyfish_search: 'Searching the web',
+ parallel_search: 'Searching the web',
+ google_places_search: 'Searching places',
- // Harness tool discovery. `tool_search` finds a deferred tool (a Composio
- // action, say) and is NOT a web search, whatever its name and `query` arg
- // suggest; `tool_call` is unwrapped to the tool it invokes in
- // `formatTimelineEntry`, this entry is only its fallback.
- tool_search: 'Searching tools',
- tool_call: 'Using a tool',
- search_tool_catalog: 'Searching tools',
++ // `tool_call` is unwrapped to the tool it invokes in `formatTimelineEntry`;
++ // its entry above is only the fallback for a call with no `name`.
++ search_tool_catalog: 'Finding the right tool',
+ mcp_registry_search: 'Searching MCP servers',
+ skill_registry_search: 'Searching skills',
+ // Memory reads. Named `*_search`, but they search the user's memory.
+ memory_recall: 'Recalling memory',
+ memory_hybrid_search: 'Searching memory',
+ memory_vector_search: 'Searching memory',
+ memory_store_raw_search: 'Searching memory',
+ memory_tree_search_entities: 'Searching memory',
+ flow_memory_recall: 'Recalling memory',
file_read: 'Reading file',
file_write: 'Writing file',
edit: 'Editing file',