feat: show line count summary for Read tool results (#507)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-09 14:57:15 -08:00
committed by GitHub
parent 3342ab0d06
commit a6640e9ef2

View File

@@ -13,6 +13,7 @@ import {
import { import {
getDisplayToolName, getDisplayToolName,
isFileEditTool, isFileEditTool,
isFileReadTool,
isFileWriteTool, isFileWriteTool,
isMemoryTool, isMemoryTool,
isPatchTool, isPatchTool,
@@ -547,6 +548,28 @@ export const ToolCallMessage = memo(
} }
} }
// Check if this is a file read tool - show line count summary
if (
isFileReadTool(rawName) &&
line.resultOk !== false &&
line.resultText
) {
// Count lines in the result (the content returned by Read tool)
const lineCount = line.resultText.split("\n").length;
return (
<Box flexDirection="row">
<Box width={prefixWidth} flexShrink={0}>
<Text>{prefix}</Text>
</Box>
<Box flexGrow={1} width={contentWidth}>
<Text>
Read <Text bold>{lineCount}</Text> lines
</Text>
</Box>
</Box>
);
}
// Regular result handling // Regular result handling
const isError = line.resultOk === false; const isError = line.resultOk === false;