/** * @license * Copyright 2025 Google LLC * SPDX-License-Identifier: Apache-2.0 */ import React from 'react'; import { Box, Text } from 'ink'; import Spinner from 'ink-spinner'; import { IndividualToolCallDisplay, ToolCallStatus } from '../../types.js'; import { DiffRenderer } from './DiffRenderer.js'; import { Colors } from '../../colors.js'; import { MarkdownRenderer } from '../../utils/MarkdownRenderer.js'; export const ToolMessage: React.FC = ({ name, description, resultDisplay, status, }) => { const statusIndicatorWidth = 3; const hasResult = resultDisplay && resultDisplay.toString().trim().length > 0; return ( {/* Status Indicator */} {status === ToolCallStatus.Pending && } {status === ToolCallStatus.Success && ( )} {status === ToolCallStatus.Confirming && ( ? )} {status === ToolCallStatus.Canceled && ( - )} {status === ToolCallStatus.Error && ( x )} {name}{' '} {description} {hasResult && ( {/* Use default text color (white) or gray instead of dimColor */} {typeof resultDisplay === 'string' && ( {MarkdownRenderer.render(resultDisplay)} )} {typeof resultDisplay === 'object' && ( )} )} ); };