(t *testing.T)
| 374 | } |
| 375 | |
| 376 | func TestActiveToolNamesForTurn(t *testing.T) { |
| 377 | t.Parallel() |
| 378 | |
| 379 | makeTools := func(names ...string) []fantasy.AgentTool { |
| 380 | tools := make([]fantasy.AgentTool, 0, len(names)) |
| 381 | for _, name := range names { |
| 382 | tools = append(tools, newTestAgentTool(name)) |
| 383 | } |
| 384 | return tools |
| 385 | } |
| 386 | |
| 387 | planMode := database.NullChatPlanMode{ |
| 388 | ChatPlanMode: database.ChatPlanModePlan, |
| 389 | Valid: true, |
| 390 | } |
| 391 | |
| 392 | t.Run("NormalModeReturnsAllRegisteredTools", func(t *testing.T) { |
| 393 | t.Parallel() |
| 394 | |
| 395 | got := activeToolNamesForTurn(makeTools( |
| 396 | "read_file", |
| 397 | "propose_plan", |
| 398 | "custom_tool", |
| 399 | "execute", |
| 400 | ), database.NullChatPlanMode{}, uuid.NullUUID{}, nil) |
| 401 | |
| 402 | require.Equal(t, []string{ |
| 403 | "read_file", |
| 404 | "propose_plan", |
| 405 | "custom_tool", |
| 406 | "execute", |
| 407 | }, got) |
| 408 | }) |
| 409 | |
| 410 | t.Run("PlanModeIncludesOnlyAllowlistedBuiltIns", func(t *testing.T) { |
| 411 | t.Parallel() |
| 412 | |
| 413 | got := activeToolNamesForTurn(makeTools( |
| 414 | "read_file", |
| 415 | "write_file", |
| 416 | "edit_files", |
| 417 | "execute", |
| 418 | "process_output", |
| 419 | "process_list", |
| 420 | "process_signal", |
| 421 | "list_templates", |
| 422 | "read_template", |
| 423 | "create_workspace", |
| 424 | "start_workspace", |
| 425 | "stop_workspace", |
| 426 | "propose_plan", |
| 427 | "spawn_agent", |
| 428 | "wait_agent", |
| 429 | "message_agent", |
| 430 | "close_agent", |
| 431 | "read_skill", |
| 432 | "read_skill_file", |
| 433 | "ask_user_question", |
nothing calls this directly
no test coverage detected