diff --git a/src/ui/ToolResultSummary.tsx b/src/ui/ToolResultSummary.tsx index 5229e140e..9b77650ad 100644 --- a/src/ui/ToolResultSummary.tsx +++ b/src/ui/ToolResultSummary.tsx @@ -42,6 +42,36 @@ const ToolResultSummary: React.FC = ({ } } + // Handle terminal command output specially + if (toolName === "run_terminal_command") { + const isStderr = content.startsWith("Stderr:"); + const actualOutput = isStderr ? content.slice(7).trim() : content; + const outputLines = actualOutput.split("\n").length; + + if (outputLines <= 16) { + // Show actual output for 16 lines or fewer + return ( + + + ⎿ + Terminal output: + + + {actualOutput} + + + ); + } else { + // Show summary for more than 16 lines + return ( + + ⎿ + Command output ({outputLines} lines) + + ); + } + } + // Handle all other cases with text summary const getSummary = () => { // Convert absolute paths to relative paths from workspace root @@ -74,9 +104,6 @@ const ToolResultSummary: React.FC = ({ case "search_code": return `Found ${lines} ${lines === 1 ? "match" : "matches"}`; - case "run_terminal_command": - return `Command output (${lines} lines)`; - case "view_diff": return `Diff output (${lines} lines)`; @@ -100,4 +127,4 @@ const ToolResultSummary: React.FC = ({ ); }; -export default ToolResultSummary; +export default ToolResultSummary; \ No newline at end of file