toolsetDetails builds one ToolsetDetail per live toolset of the agent, combining the side-effect-free lifecycle status with tool names: live names for started toolsets, otherwise the declared `tools:` allow-list keyed by the same name the registry assigns (cmp.Or(name, type)).
(ctx context.Context, a *agent.Agent, cfg latest.AgentConfig, hasCfg bool)
| 880 | // for started toolsets, otherwise the declared `tools:` allow-list keyed by the |
| 881 | // same name the registry assigns (cmp.Or(name, type)). |
| 882 | func toolsetDetails(ctx context.Context, a *agent.Agent, cfg latest.AgentConfig, hasCfg bool) []ToolsetDetail { |
| 883 | toolSets := a.ToolSets() |
| 884 | if len(toolSets) == 0 { |
| 885 | return nil |
| 886 | } |
| 887 | var declared map[string][]string |
| 888 | if hasCfg { |
| 889 | declared = declaredToolNames(cfg) |
| 890 | } |
| 891 | infos := make([]ToolsetDetail, 0, len(toolSets)) |
| 892 | for _, ts := range toolSets { |
| 893 | status := toolsetStatusFor(ts) |
| 894 | info := ToolsetDetail{ |
| 895 | Name: status.Name, |
| 896 | Kind: status.Kind, |
| 897 | State: toolsetStateBucket(status.State), |
| 898 | } |
| 899 | if live, ok := startedToolNames(ctx, ts); ok { |
| 900 | info.Tools = live |
| 901 | } else if names, ok := declared[status.Name]; ok { |
| 902 | info.Tools = names |
| 903 | } |
| 904 | infos = append(infos, info) |
| 905 | } |
| 906 | return infos |
| 907 | } |
| 908 | |
| 909 | // toolsetStateBucket collapses the lifecycle state machine into the inspector's |
| 910 | // three buckets. Failed is the only error state; Stopped (including a |
no test coverage detected