(t *testing.T)
| 322 | } |
| 323 | |
| 324 | func TestTaskTool_Metadata(t *testing.T) { |
| 325 | t.Skip("Skipping: TaskTool doesn't include metadata field in response") |
| 326 | tool, err := NewTaskTool(nil) |
| 327 | if err != nil { |
| 328 | t.Fatalf("Failed to create Task tool: %v", err) |
| 329 | } |
| 330 | |
| 331 | input := map[string]any{ |
| 332 | "subagent_type": "general-purpose", |
| 333 | "prompt": "Task with metadata", |
| 334 | "model": "gpt-3.5-turbo", |
| 335 | } |
| 336 | |
| 337 | result := ExecuteToolWithInput(t, tool, input) |
| 338 | result = AssertToolSuccess(t, result) |
| 339 | |
| 340 | // 验证subagent配置信息 |
| 341 | if subagentConfig, exists := result["subagent_config"]; !exists { |
| 342 | t.Error("Result should contain 'subagent_config' field") |
| 343 | } else if configMap, ok := subagentConfig.(map[string]any); !ok { |
| 344 | t.Error("subagent_config should be a map") |
| 345 | } else { |
| 346 | // 验证配置字段 |
| 347 | expectedFields := []string{"timeout", "max_tokens", "temperature", "work_dir"} |
| 348 | for _, field := range expectedFields { |
| 349 | if _, exists := configMap[field]; !exists { |
| 350 | t.Logf("Subagent config field '%s' not found (may be optional)", field) |
| 351 | } |
| 352 | } |
| 353 | } |
| 354 | |
| 355 | // 验证元数据 |
| 356 | if _, exists := result["metadata"]; !exists { |
| 357 | t.Error("Result should contain 'metadata' field") |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | func BenchmarkTaskTool_LaunchSubagent(b *testing.B) { |
| 362 | tool, err := NewTaskTool(nil) |
nothing calls this directly
no test coverage detected