| 226 | t.Fatalf("expected backgrounded command output, got %q", out) |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | func TestExecuteBashWrapsResult(t *testing.T) { |
| 231 | call := chmctx.ToolCall{ |
| 232 | ID: "call_1", Name: "bash", |
| 233 | Arguments: map[string]any{"cmd": "echo hi"}, |
| 234 | } |
| 235 | msg := Execute(context.Background(), call) |
| 236 | if msg.Role != chmctx.RoleTool || msg.ToolCallID != "call_1" || msg.ToolName != "bash" { |
| 237 | t.Fatalf("bad message: %+v", msg) |
| 238 | } |
| 239 | if !strings.Contains(msg.Content, "hi") { |
| 240 | t.Fatalf("content missing: %q", msg.Content) |
| 241 | } |
| 242 | } |
| 243 | |