| 347 | } |
| 348 | |
| 349 | func agentBundle(item AgentRecord) outputBundle { |
| 350 | return outputBundle{ |
| 351 | jsonValue: item, |
| 352 | human: func() (string, error) { |
| 353 | base := renderHumanSection("Agent", []keyValue{ |
| 354 | {Label: automationNameValue, Value: stringOrDash(item.Name)}, |
| 355 | {Label: agentKernelProviderValue, Value: stringOrDash(item.Provider)}, |
| 356 | {Label: cliCommandValue, Value: stringOrDash(item.Command)}, |
| 357 | {Label: agentKernelModelValue, Value: stringOrDash(item.Model)}, |
| 358 | {Label: agentCategoryValue, Value: stringOrDash(agentCategoryLabel(item.CategoryPath))}, |
| 359 | {Label: toolOperatorToolsValue, Value: stringOrDash(strings.Join(item.Tools, ", "))}, |
| 360 | {Label: installPermissionsValue, Value: stringOrDash(item.Permissions)}, |
| 361 | }) |
| 362 | |
| 363 | servers := make([][]string, 0, len(item.MCPServers)) |
| 364 | for _, server := range item.MCPServers { |
| 365 | servers = append(servers, []string{ |
| 366 | stringOrDash(server.Name), |
| 367 | stringOrDash(server.Command), |
| 368 | stringOrDash(strings.Join(server.Args, " ")), |
| 369 | }) |
| 370 | } |
| 371 | mcp := renderHumanTable("MCP Servers", []string{automationNameValue, cliCommandValue, "Args"}, servers) |
| 372 | prompt := renderHumanSection( |
| 373 | "Prompt", |
| 374 | []keyValue{{Label: agentBodyValue, Value: stringOrDash(item.Prompt)}}, |
| 375 | ) |
| 376 | return renderHumanBlocks(base, mcp, prompt), nil |
| 377 | }, |
| 378 | toon: func() (string, error) { |
| 379 | // Detail output emits tool names; list output keeps the table dense with tool_count. |
| 380 | return renderToonObject(agentAgentKey, []string{ |
| 381 | automationNameKey, |
| 382 | cliProviderKey, |
| 383 | agentCommandKey, |
| 384 | agentModelKey, |
| 385 | agentCategoryKey, |
| 386 | "tools", |
| 387 | configPermissionsKey, |
| 388 | "prompt", |
| 389 | }, []string{ |
| 390 | item.Name, |
| 391 | item.Provider, |
| 392 | item.Command, |
| 393 | item.Model, |
| 394 | agentCategoryLabel(item.CategoryPath), |
| 395 | strings.Join(item.Tools, "|"), |
| 396 | item.Permissions, |
| 397 | item.Prompt, |
| 398 | }), nil |
| 399 | }, |
| 400 | } |
| 401 | } |
| 402 | |
| 403 | func agentCategoryLabel(path []string) string { |
| 404 | if len(path) == 0 { |