From 2f579b2284e038f575c3f1b326f97cf872b4e074 Mon Sep 17 00:00:00 2001 From: Lakshman Patel Date: Mon, 7 Sep 2026 13:31:25 +0530 Subject: [PATCH] feat: show tool activity on stderr in exec text mode exec text mode was silent about tool calls, unlike --print which surfaces [ToolName] on stderr. During an autonomous multi-turn run the user had no visibility into which tools the agent invoked (file writes, shell, web search). Emit [ToolName] on tool_use and a truncated [ToolName] on tool_result, gated on !IsQuiet() so --quiet/CI output stays clean and stdout stays machine-parseable. stream-json output is unchanged. --- cmd/exec.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/exec.go b/cmd/exec.go index d22bccf3..142d3d93 100644 --- a/cmd/exec.go +++ b/cmd/exec.go @@ -12,6 +12,7 @@ import ( "os/exec" "strings" "time" + "unicode/utf8" graycodeconfig "github.com/GrayCodeAI/graycode-cli/internal/config" "github.com/GrayCodeAI/graycode-cli/internal/engine" @@ -332,6 +333,9 @@ func runExec(_ *cobra.Command, args []string) error { }) } case "tool_use": + if execOutputFormat == "text" && !IsQuiet() { + _, _ = fmt.Fprintf(os.Stderr, "\n%s\n", auditTint("["+ev.ToolName+"]", infoSky)) + } if execOutputFormat == "stream-json" { _ = jsonEnc.Encode(map[string]interface{}{ "type": "tool_use", @@ -339,6 +343,13 @@ func runExec(_ *cobra.Command, args []string) error { }) } case "tool_result": + if execOutputFormat == "text" && !IsQuiet() { + content := ev.Content + if utf8.RuneCountInString(content) > 500 { + content = string([]rune(content)[:500]) + "..." + } + _, _ = fmt.Fprintf(os.Stderr, "%s %s\n", auditTint("["+ev.ToolName+"]", infoSky), content) + } if execOutputFormat == "stream-json" { _ = jsonEnc.Encode(map[string]interface{}{ "type": "tool_result",