diff --git a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx index ca6e9f76..f90cc693 100644 --- a/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx +++ b/packages/cli/src/ui/components/messages/ToolGroupMessage.test.tsx @@ -13,6 +13,7 @@ import type { Config, ToolCallConfirmationDetails, } from '@google/gemini-cli-core'; +import { TOOL_STATUS } from '../../constants.js'; // Mock child components to isolate ToolGroupMessage behavior vi.mock('./ToolMessage.js', () => ({ @@ -29,14 +30,16 @@ vi.mock('./ToolMessage.js', () => ({ status: ToolCallStatus; emphasis: string; }) { - const statusSymbol = { - [ToolCallStatus.Success]: '✓', - [ToolCallStatus.Pending]: 'o', - [ToolCallStatus.Executing]: '⊷', - [ToolCallStatus.Confirming]: '?', - [ToolCallStatus.Canceled]: '-', - [ToolCallStatus.Error]: 'x', - }[status]; + // Use the same constants as the real component + const statusSymbolMap: Record = { + [ToolCallStatus.Success]: TOOL_STATUS.SUCCESS, + [ToolCallStatus.Pending]: TOOL_STATUS.PENDING, + [ToolCallStatus.Executing]: TOOL_STATUS.EXECUTING, + [ToolCallStatus.Confirming]: TOOL_STATUS.CONFIRMING, + [ToolCallStatus.Canceled]: TOOL_STATUS.CANCELED, + [ToolCallStatus.Error]: TOOL_STATUS.ERROR, + }; + const statusSymbol = statusSymbolMap[status] || '?'; return ( MockTool[{callId}]: {statusSymbol} {name} - {description} ({emphasis}) diff --git a/packages/cli/src/ui/components/messages/ToolMessage.tsx b/packages/cli/src/ui/components/messages/ToolMessage.tsx index 1a578f37..203ab986 100644 --- a/packages/cli/src/ui/components/messages/ToolMessage.tsx +++ b/packages/cli/src/ui/components/messages/ToolMessage.tsx @@ -13,6 +13,7 @@ import { Colors } from '../../colors.js'; import { MarkdownDisplay } from '../../utils/MarkdownDisplay.js'; import { GeminiRespondingSpinner } from '../GeminiRespondingSpinner.js'; import { MaxSizedBox } from '../shared/MaxSizedBox.js'; +import { TOOL_STATUS } from '../../constants.js'; const STATIC_HEIGHT = 1; const RESERVED_LINE_COUNT = 5; // for tool name, status, padding etc. @@ -119,28 +120,28 @@ const ToolStatusIndicator: React.FC = ({ }) => ( {status === ToolCallStatus.Pending && ( - o + {TOOL_STATUS.PENDING} )} {status === ToolCallStatus.Executing && ( )} {status === ToolCallStatus.Success && ( - + {TOOL_STATUS.SUCCESS} )} {status === ToolCallStatus.Confirming && ( - ? + {TOOL_STATUS.CONFIRMING} )} {status === ToolCallStatus.Canceled && ( - - + {TOOL_STATUS.CANCELED} )} {status === ToolCallStatus.Error && ( - x + {TOOL_STATUS.ERROR} )} diff --git a/packages/cli/src/ui/constants.ts b/packages/cli/src/ui/constants.ts index 6a1047dc..38a0f162 100644 --- a/packages/cli/src/ui/constants.ts +++ b/packages/cli/src/ui/constants.ts @@ -19,3 +19,13 @@ export const SHELL_COMMAND_NAME = 'Shell Command'; export const SCREEN_READER_USER_PREFIX = 'User: '; export const SCREEN_READER_MODEL_PREFIX = 'Model: '; + +// Tool status symbols used in ToolMessage component +export const TOOL_STATUS = { + SUCCESS: '✓', + PENDING: 'o', + EXECUTING: '⊷', + CONFIRMING: '?', + CANCELED: '-', + ERROR: 'x', +} as const;