diff --git a/src/renderer/components/team/ToolApprovalSheet.tsx b/src/renderer/components/team/ToolApprovalSheet.tsx index c35a47ce..4a5a95b5 100644 --- a/src/renderer/components/team/ToolApprovalSheet.tsx +++ b/src/renderer/components/team/ToolApprovalSheet.tsx @@ -9,6 +9,7 @@ import { AlertTriangle, FileText, Search, Terminal } from 'lucide-react'; import { ToolApprovalDiffPreview } from './ToolApprovalDiffPreview'; import { ToolApprovalSettingsPanel } from './dialogs/ToolApprovalSettingsPanel'; +import { FileIcon } from './editor/FileIcon'; import type { ToolApprovalRequest } from '@shared/types'; @@ -341,6 +342,8 @@ export const ToolApprovalSheet: React.FC = () => { // Syntax-highlighted tool input preview // --------------------------------------------------------------------------- +const FILE_TOOLS = new Set(['Edit', 'Read', 'Write', 'NotebookEdit']); + const ToolInputPreview = ({ toolName, toolInput, @@ -353,6 +356,8 @@ const ToolInputPreview = ({ const text = renderToolInput(toolName, toolInput, projectPath); const fileName = getToolInputFileName(toolName, toolInput); const lines = useMemo(() => highlightLines(text, fileName), [text, fileName]); + const rawFilePath = typeof toolInput.file_path === 'string' ? toolInput.file_path : null; + const isFileTool = FILE_TOOLS.has(toolName) && rawFilePath; return (
@@ -364,16 +369,23 @@ const ToolInputPreview = ({ color: 'var(--color-text-secondary)', }} > - {/* highlightLines uses hljs which HTML-escapes all input text, producing only tags. - This is safe: the source is our own renderToolInput() output, not arbitrary user HTML. - Same pattern used in ReviewDiffContent.tsx and DiffViewer for syntax highlighting. */} - {lines.map((html, i) => ( -
- ))} + {isFileTool ? ( +
+ + {text} +
+ ) : ( + /* highlightLines uses hljs which HTML-escapes all input text, producing only tags. + This is safe: the source is our own renderToolInput() output, not arbitrary user HTML. + Same pattern used in ReviewDiffContent.tsx and DiffViewer for syntax highlighting. */ + lines.map((html, i) => ( +
+ )) + )}
);