diff --git a/client/src/components/Chat/Messages/Content/Parts/__tests__/FileAuthoringCall.test.tsx b/client/src/components/Chat/Messages/Content/Parts/__tests__/FileAuthoringCall.test.tsx index 7fa74e2e96..27183855af 100644 --- a/client/src/components/Chat/Messages/Content/Parts/__tests__/FileAuthoringCall.test.tsx +++ b/client/src/components/Chat/Messages/Content/Parts/__tests__/FileAuthoringCall.test.tsx @@ -29,12 +29,17 @@ jest.mock('~/components/Chat/Messages/Content/ProgressText', () => ({ phase, inProgressText, finishedText, + icon, }: { phase: 'running' | 'completed' | 'cancelled' | 'failed'; inProgressText: string; finishedText: string; + icon: React.ReactNode; }) => ( -
{phase === 'running' ? inProgressText : finishedText}
+
+ {icon} + {phase === 'running' ? inProgressText : finishedText} +
), })); @@ -132,6 +137,7 @@ describe('FileAuthoringCall', () => { ); expect(screen.getByTestId('progress-text')).toHaveTextContent('Updated SKILL.md'); + expect(document.querySelector('.lucide-file-pen-line')).not.toBeNull(); }); it('prefers the output diff over the args preview after edit_file completes', () => { diff --git a/client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx b/client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx index 665b6335e0..8687c09bf9 100644 --- a/client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx +++ b/client/src/components/Chat/Messages/Content/ToolOutput/ToolIcon.tsx @@ -7,6 +7,8 @@ import { ArrowRightLeft, FileSearch, FileText, + FilePlus2, + FilePenLine, MessageCircleQuestion, ScrollText, Brain, @@ -32,6 +34,8 @@ export type ToolIconType = | 'file_search' | 'skill' | 'read_file' + | 'create_file' + | 'edit_file' | 'bash_tool' | 'background_tasks' | 'ask_user_question' @@ -49,6 +53,8 @@ const ICON_MAP: Record file_search: FileSearch, skill: ScrollText, read_file: FileText, + create_file: FilePlus2, + edit_file: FilePenLine, bash_tool: BashIcon, background_tasks: ListChecks, ask_user_question: MessageCircleQuestion, @@ -88,6 +94,9 @@ export function getToolIconType(name: string): ToolIconType { if (name === 'read_file') { return 'read_file'; } + if (name === 'create_file' || name === 'edit_file') { + return name; + } if (name === 'bash_tool' || name === Constants.BASH_PROGRAMMATIC_TOOL_CALLING) { return 'bash_tool'; } diff --git a/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx index 73bbfc989b..f768fa617d 100644 --- a/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx +++ b/client/src/components/Chat/Messages/Content/__tests__/ActivityPhaseGroup.test.tsx @@ -165,6 +165,45 @@ describe('ActivityPhaseGroup', () => { expect(screen.getByText(LABEL).parentElement).toHaveClass('flex-1', 'text-left'); }); + test.each([ + ['create_file', '', 'lucide-file-plus-2'], + ['edit_file', '', 'lucide-file-pen-line'], + ['create_file', 'Created skills/demo/SKILL.md', 'lucide-file-plus-2'], + ['create_file', 'Updated AGENTS.md with safe diagnostic guidance', 'lucide-file-pen-line'], + ['edit_file', 'Edited AGENTS.md', 'lucide-file-pen-line'], + ])( + 'shows the file-row glyph on settled and live phase headers for %s: %s', + (name, output, glyph) => { + const part = { + type: ContentTypes.TOOL_CALL, + [ContentTypes.TOOL_CALL]: { + id: 'file-1', + name, + args: '{"path":"AGENTS.md"}', + output, + type: 'tool_call', + }, + } as unknown as TMessageContentParts; + const { rerender } = render( + +
+ , + ); + + expect(screen.getByRole('button', { name: LABEL }).querySelector(`.${glyph}`)).not.toBeNull(); + expect( + screen.getByRole('button', { name: LABEL }).querySelector('.lucide-wrench'), + ).toBeNull(); + + rerender( + +
+ , + ); + expect(screen.getByRole('button').querySelector(`.${glyph}`)).not.toBeNull(); + }, + ); + test('keeps the focus ring inside the clipped header', () => { render( diff --git a/client/src/components/Chat/Messages/Content/__tests__/StackedToolIcons.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/StackedToolIcons.test.tsx index b04b25b894..93e5434921 100644 --- a/client/src/components/Chat/Messages/Content/__tests__/StackedToolIcons.test.tsx +++ b/client/src/components/Chat/Messages/Content/__tests__/StackedToolIcons.test.tsx @@ -48,6 +48,15 @@ describe('shared header glyphs', () => { }, ); + it.each([ + ['create_file', 'lucide-file-plus-2'], + ['edit_file', 'lucide-file-pen-line'], + ])('renders %s with the same glyph as its file row', (name, glyph) => { + const { container } = render(); + expect(container.querySelector(`.${glyph}`)).not.toBeNull(); + expect(container.querySelector('.lucide-wrench')).toBeNull(); + }); + it('retains a bounded stack and overflow count', () => { const { container } = render( { expect(screen.queryByText(/web_search|file_search|retrieval/)).not.toBeInTheDocument(); }); + it('uses the edit glyph for a create_file overwrite without changing its tool label', () => { + renderGroup({ + ...baseProps, + parts: [ + { + part: makePart( + 'file-1', + 'Updated AGENTS.md with safe diagnostic guidance', + 'create_file', + ), + idx: 0, + }, + ], + lastContentIdx: 0, + }); + + expect(screen.getByTestId('stacked-icons')).toHaveAttribute('data-tool-names', 'edit_file'); + expect(screen.getByRole('button', { name: 'Create File' })).toBeInTheDocument(); + }); + it('keeps repeated action counts and failed-call status in the compact summary', () => { renderGroup({ ...baseProps, diff --git a/client/src/components/Chat/Messages/Content/__tests__/ToolIcon.test.tsx b/client/src/components/Chat/Messages/Content/__tests__/ToolIcon.test.tsx index 2734ccb44e..f0c92f96d5 100644 --- a/client/src/components/Chat/Messages/Content/__tests__/ToolIcon.test.tsx +++ b/client/src/components/Chat/Messages/Content/__tests__/ToolIcon.test.tsx @@ -26,6 +26,13 @@ describe('getToolIconType - ACTN-01: Action delimiter detection', () => { expect(getToolIconType('some_plain_tool')).toBe('generic'); }); + it('gives native file authoring tools their row glyphs without changing MCP identity', () => { + expect(getToolIconType('create_file')).toBe('create_file'); + expect(getToolIconType('edit_file')).toBe('edit_file'); + expect(getToolIconType(`create_file${Constants.mcp_delimiter}remote`)).toBe('mcp'); + expect(getToolIconType(`edit_file${Constants.mcp_delimiter}remote`)).toBe('mcp'); + }); + it('gives the native background-task tool its own icon while preserving MCP identity', () => { expect(getToolIconType(Constants.CHECK_BACKGROUND_TASK)).toBe('background_tasks'); expect( diff --git a/client/src/components/Chat/Messages/Content/live.ts b/client/src/components/Chat/Messages/Content/live.ts index 216cc2e4c1..8d9bcaabf5 100644 --- a/client/src/components/Chat/Messages/Content/live.ts +++ b/client/src/components/Chat/Messages/Content/live.ts @@ -1,4 +1,4 @@ -import { Tools, Constants, ContentTypes, stripToolCallErrorPrefix } from 'librechat-data-provider'; +import { Constants, ContentTypes, stripToolCallErrorPrefix } from 'librechat-data-provider'; import type { Agents, TAttachment, @@ -12,9 +12,8 @@ import { getBatchActivityLabelPart, getActivityLabelText } from '~/utils/activit import { hasPendingApprovalInPart, hasPendingAuthInPart } from '~/utils/groupToolCalls'; import { ASK_USER_QUESTION, getSubmittedAskAnswer } from '~/utils/approval'; import { getToolDisplayLabel, parseToolName } from '~/utils/toolLabels'; +import { getToolIconName, getToolMeta, summarizeSpan } from './outcome'; import { boundIntentLabel, getToolCallIntent } from './Parts/intent'; -import { isBashProgrammaticToolCall } from './routing'; -import { getToolMeta, summarizeSpan } from './outcome'; import { isError } from './ToolOutput'; /** How often a live fold's header may repaint. A streamed intent moves the @@ -246,7 +245,7 @@ export function getSpanIconNames(parts: ReadonlyArray, + output?: string | null, +): string { + if (name === 'create_file' && output?.startsWith('Updated ')) { + return 'edit_file'; + } + return isBashProgrammaticToolCall(name, args) ? Tools.bash_tool : name; +} + /** * Group metadata must agree with the individual card, which resolves its * outcome from the run step's terminal verdict through `resolveToolCallPhase`. @@ -105,7 +118,7 @@ export function getToolMeta( * agents" on completion even when the child returned no text. */ const completed = !!tc.output || tc.progress === 1; const name = tc.name ?? ''; - const iconName = isBashProgrammaticToolCall(name, tc.args) ? Tools.bash_tool : name; + const iconName = getToolIconName(name, tc.args, tc.output); /** Memory tools report failure in prose ("Invalid key ...") that generic * `isError` parsing does not recognize, so `MemoryCall` classifies it with * its own predicate. Reuse that here or a persisted call with no terminal