Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 4125869

Browse files
committed
feat(ui): add read_command_output activity indicator
Show read progress in chat when read_command_output tool is used: - Display 'Roo read command output (0 B - 100 KB of 263.3 KB)' - Shows the specific byte range being read each call - Uses same visual style as read_file tool - Add 'tool' to ClineSay types - Add readCommandOutput to ClineSayTool with readStart/readEnd/totalBytes
1 parent 33bff28 commit 4125869

5 files changed

Lines changed: 56 additions & 0 deletions

File tree

packages/types/src/message.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ export const clineSays = [
182182
"codebase_search_result",
183183
"user_edit_todos",
184184
"too_many_tools_warning",
185+
"tool",
185186
] as const
186187

187188
export const clineSaySchema = z.enum(clineSays)

packages/types/src/vscode-extension-host.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ export interface ClineSayTool {
780780
| "newFileCreated"
781781
| "codebaseSearch"
782782
| "readFile"
783+
| "readCommandOutput"
783784
| "fetchInstructions"
784785
| "listFilesTopLevel"
785786
| "listFilesRecursive"
@@ -792,6 +793,10 @@ export interface ClineSayTool {
792793
| "runSlashCommand"
793794
| "updateTodoList"
794795
path?: string
796+
// For readCommandOutput
797+
readStart?: number
798+
readEnd?: number
799+
totalBytes?: number
795800
diff?: string
796801
content?: string
797802
// Unified diff statistics computed by the extension

src/core/tools/ReadCommandOutputTool.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,15 +159,34 @@ export class ReadCommandOutputTool extends BaseTool<"read_command_output"> {
159159
}
160160

161161
let result: string
162+
let readStart = 0
163+
let readEnd = 0
162164

163165
if (search) {
164166
// Search mode: filter lines matching the pattern
165167
result = await this.searchInArtifact(artifactPath, search, totalSize, limit)
168+
// For search, we're scanning the whole file
169+
readStart = 0
170+
readEnd = totalSize
166171
} else {
167172
// Normal read mode with offset/limit
168173
result = await this.readArtifact(artifactPath, offset, limit, totalSize)
174+
// Calculate actual read range
175+
readStart = offset
176+
readEnd = Math.min(offset + limit, totalSize)
169177
}
170178

179+
// Report to UI that we read command output
180+
await task.say(
181+
"tool",
182+
JSON.stringify({
183+
tool: "readCommandOutput",
184+
readStart,
185+
readEnd,
186+
totalBytes: totalSize,
187+
}),
188+
)
189+
171190
task.consecutiveMistakeCount = 0
172191
pushToolResult(result)
173192
} catch (error) {

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,34 @@ export const ChatRowContent = ({
14641464
</>
14651465
)
14661466
}
1467+
case "readCommandOutput": {
1468+
const formatBytes = (bytes: number) => {
1469+
if (bytes < 1024) return `${bytes} B`
1470+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`
1471+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`
1472+
}
1473+
const rangeInfo =
1474+
sayTool.readStart !== undefined &&
1475+
sayTool.readEnd !== undefined &&
1476+
sayTool.totalBytes !== undefined
1477+
? `${formatBytes(sayTool.readStart)} - ${formatBytes(sayTool.readEnd)} of ${formatBytes(sayTool.totalBytes)}`
1478+
: sayTool.totalBytes !== undefined
1479+
? formatBytes(sayTool.totalBytes)
1480+
: ""
1481+
return (
1482+
<div style={headerStyle}>
1483+
<FileCode2 className="w-4 shrink-0" aria-label="Read command output icon" />
1484+
<span style={{ fontWeight: "bold" }}>{t("chat:readCommandOutput.title")}</span>
1485+
{rangeInfo && (
1486+
<span
1487+
className="text-xs ml-1"
1488+
style={{ color: "var(--vscode-descriptionForeground)" }}>
1489+
({rangeInfo})
1490+
</span>
1491+
)}
1492+
</div>
1493+
)
1494+
}
14671495
default:
14681496
return null
14691497
}

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,5 +495,8 @@
495495
"serversPart_other": "{{count}} MCP servers",
496496
"messageTemplate": "You have {{tools}} enabled via {{servers}}. Such a high number can confuse the model and lead to errors. Try to keep it below {{threshold}}.",
497497
"openMcpSettings": "Open MCP Settings"
498+
},
499+
"readCommandOutput": {
500+
"title": "Roo read command output"
498501
}
499502
}

0 commit comments

Comments
 (0)