diff --git a/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx b/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx index 259aa193fd..cdd4a929d2 100644 --- a/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx +++ b/apps/code/src/renderer/features/sessions/components/session-update/ToolCallView.tsx @@ -50,6 +50,16 @@ const toolNameIcons: Record = { Skill: Command, }; +// Tools that render a friendly " `` " line instead of +// the raw JSON input preview. `inputKey` is the rawInput field to highlight. +const toolNameDisplays: Record< + string, + { prefix: string; suffix: string; inputKey: string } +> = { + Skill: { prefix: "Reading", suffix: "skill", inputKey: "skill" }, + ToolSearch: { prefix: "Searching", suffix: "tools", inputKey: "query" }, +}; + interface ToolCallViewProps extends ToolViewProps { agentToolName?: string; } @@ -74,13 +84,27 @@ export function ToolCallView({ Wrench; const filePath = kind === "read" && locations?.[0]?.path; - const displayText = filePath - ? `Read ${getFilename(filePath)}` - : title - ? compactHomePath(title) + const toolDisplay = agentToolName + ? toolNameDisplays[agentToolName] + : undefined; + const highlightValue = + toolDisplay && rawInput && typeof rawInput === "object" + ? (rawInput as Record)[toolDisplay.inputKey] : undefined; + const specialDisplay = + toolDisplay && typeof highlightValue === "string" + ? { ...toolDisplay, value: highlightValue } + : undefined; + + const displayText = specialDisplay + ? specialDisplay.prefix + : filePath + ? `Read ${getFilename(filePath)}` + : title + ? compactHomePath(title) + : undefined; - const inputPreview = compactInput(rawInput); + const inputPreview = specialDisplay?.value ?? compactInput(rawInput); const fullInput = formatInput(rawInput); const output = stripCodeFences(getContentText(content) ?? ""); @@ -115,6 +139,7 @@ export function ToolCallView({ {inputPreview} )} + {specialDisplay && {specialDisplay.suffix}}