diff --git a/src/core/tools/ReadCommandOutputTool.ts b/src/core/tools/ReadCommandOutputTool.ts index 7d83c16fba..e7aaf91135 100644 --- a/src/core/tools/ReadCommandOutputTool.ts +++ b/src/core/tools/ReadCommandOutputTool.ts @@ -159,15 +159,34 @@ export class ReadCommandOutputTool extends BaseTool<"read_command_output"> { } let result: string + let readStart = 0 + let readEnd = 0 if (search) { // Search mode: filter lines matching the pattern result = await this.searchInArtifact(artifactPath, search, totalSize, limit) + // For search, we're scanning the whole file + readStart = 0 + readEnd = totalSize } else { // Normal read mode with offset/limit result = await this.readArtifact(artifactPath, offset, limit, totalSize) + // Calculate actual read range + readStart = offset + readEnd = Math.min(offset + limit, totalSize) } + // Report to UI that we read command output + await task.say( + "tool", + JSON.stringify({ + tool: "readCommandOutput", + readStart, + readEnd, + totalBytes: totalSize, + }), + ) + task.consecutiveMistakeCount = 0 pushToolResult(result) } catch (error) { diff --git a/webview-ui/src/components/chat/ChatRow.tsx b/webview-ui/src/components/chat/ChatRow.tsx index 6a6d5c3f6d..c79dd11a86 100644 --- a/webview-ui/src/components/chat/ChatRow.tsx +++ b/webview-ui/src/components/chat/ChatRow.tsx @@ -1470,7 +1470,6 @@ export const ChatRowContent = ({ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB` return `${(bytes / (1024 * 1024)).toFixed(1)} MB` } - // Determine if this is a search operation const isSearch = sayTool.searchPattern !== undefined