From 887e842717857896f4bf227cc5fe7f94d8981636 Mon Sep 17 00:00:00 2001 From: Kynan Ware <47394200+BagToad@users.noreply.github.com> Date: Mon, 15 Sep 2025 14:18:42 -0600 Subject: [PATCH] Enable Bash session tool handling in log rendering Uncomments and activates support for Bash session tool calls (write_bash, read_bash, stop_bash, async_bash, read_async_bash, stop_async_bash) in the renderLogEntry function. Also defines the corresponding argument structs, enabling proper handling and display of these tool calls in the log output. --- pkg/cmd/agent-task/shared/log.go | 103 +++++++++++++++---------------- 1 file changed, 50 insertions(+), 53 deletions(-) diff --git a/pkg/cmd/agent-task/shared/log.go b/pkg/cmd/agent-task/shared/log.go index e5c362437..f1dfc7640 100644 --- a/pkg/cmd/agent-task/shared/log.go +++ b/pkg/cmd/agent-task/shared/log.go @@ -158,38 +158,36 @@ func renderLogEntry(entry chatCompletionChunkEntry, w io.Writer, io *iostreams.I return false, fmt.Errorf("failed to render bash command output: %w", err) } } - - // TODO: GUI does not currently support these. - // case "write_bash": - // if v := unmarshal[writeBashToolArgs](args); v != nil { - // renderToolCallTitle("Send input to Bash session " + v.SessionID) - // continue - // } - // case "read_bash": - // if v := unmarshal[readBashToolArgs](args); v != nil { - // renderToolCallTitle("Read logs from Bash session " + v.SessionID) - // continue - // } - // case "stop_bash": - // if v := unmarshal[stopBashToolArgs](args); v != nil { - // renderToolCallTitle("Stop Bash session " + v.SessionID) - // continue - // } - // case "async_bash": - // if v := unmarshal[asyncBashToolArgs](args); v != nil { - // renderToolCallTitle("Start or send input to long-running Bash session " + v.SessionID) - // continue - // } - // case "read_async_bash": - // if v := unmarshal[readAsyncBashToolArgs](args); v != nil { - // renderToolCallTitle("View logs from long-running Bash session " + v.SessionID) - // continue - // } - // case "stop_async_bash": - // if v := unmarshal[stopAsyncBashToolArgs](args); v != nil { - // renderToolCallTitle("Stop long-running Bash session " + v.SessionID) - // continue - // } + case "write_bash": + if v := unmarshal[writeBashToolArgs](args); v != nil { + renderToolCallTitle(w, cs, "Send input to Bash session", "") + continue + } + case "read_bash": + if v := unmarshal[readBashToolArgs](args); v != nil { + renderToolCallTitle(w, cs, "Read logs from Bash session", "") + continue + } + case "stop_bash": + if v := unmarshal[stopBashToolArgs](args); v != nil { + renderToolCallTitle(w, cs, "Stop Bash session", "") + continue + } + case "async_bash": + if v := unmarshal[asyncBashToolArgs](args); v != nil { + renderToolCallTitle(w, cs, "Start or send input to long-running Bash session", "") + continue + } + case "read_async_bash": + if v := unmarshal[readAsyncBashToolArgs](args); v != nil { + renderToolCallTitle(w, cs, "View logs from long-running Bash session", "") + continue + } + case "stop_async_bash": + if v := unmarshal[stopAsyncBashToolArgs](args); v != nil { + renderToolCallTitle(w, cs, "Stop long-running Bash session", "") + continue + } case "think": args := thinkToolArgs{} if err := json.Unmarshal([]byte(tc.Function.Arguments), &args); err != nil { @@ -519,32 +517,31 @@ type bashToolArgs struct { Description string `json:"description"` } -// TODO: GUI does not currently support these. -// type readBashToolArgs struct { -// SessionID string `json:"sessionId"` -// } +type readBashToolArgs struct { + SessionID string `json:"sessionId"` +} -// type writeBashToolArgs struct { -// SessionID string `json:"sessionId"` -// Input string `json:"input"` -// } +type writeBashToolArgs struct { + SessionID string `json:"sessionId"` + Input string `json:"input"` +} -// type stopBashToolArgs struct { -// SessionID string `json:"sessionId"` -// } +type stopBashToolArgs struct { + SessionID string `json:"sessionId"` +} -// type asyncBashToolArgs struct { -// Command string `json:"command"` -// SessionID string `json:"sessionId"` -// } +type asyncBashToolArgs struct { + Command string `json:"command"` + SessionID string `json:"sessionId"` +} -// type readAsyncBashToolArgs struct { -// SessionID string `json:"sessionId"` -// } +type readAsyncBashToolArgs struct { + SessionID string `json:"sessionId"` +} -// type stopAsyncBashToolArgs struct { -// SessionID string `json:"sessionId"` -// } +type stopAsyncBashToolArgs struct { + SessionID string `json:"sessionId"` +} type viewToolArgs struct { Path string `json:"path"`