From aaf0522303bd6f807faced76e1f2ed82432a05bb Mon Sep 17 00:00:00 2001 From: Jiayuan Date: Sat, 31 Jan 2026 18:40:40 +0800 Subject: [PATCH] feat(cli): display real-time tool execution updates Handle tool_execution_update events in CLI output to show live progress while commands are running. Shows the last 60 characters of output on a single line that updates in place. This completes the real-time streaming feature added to exec tool. Co-Authored-By: Claude Opus 4.5 --- src/agent/output.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/agent/output.ts b/src/agent/output.ts index e14e546b..e5132fc2 100644 --- a/src/agent/output.ts +++ b/src/agent/output.ts @@ -120,7 +120,18 @@ export function createAgentOutput(params: { case "tool_execution_start": params.stderr.write(`${formatToolLine(event.toolName, event.args)}\n`); break; + case "tool_execution_update": { + // Show real-time output updates (e.g., from exec tool) + const updateText = extractText(event.partialResult); + if (updateText) { + // Clear line and show latest tail output + params.stderr.write(`\r\x1b[K ↳ ${updateText.slice(-60).replace(/\n/g, " ")}`); + } + break; + } case "tool_execution_end": + // Clear any update line from tool_execution_update + params.stderr.write("\r\x1b[K"); if (event.isError) { const errorText = extractText(event.result) || "Tool failed"; params.stderr.write(`• Tool error (${toolDisplayName(event.toolName)}): ${errorText}\n`);