declaredToolNames maps each configured toolset's display name to its declared `tools:` allow-list. The key matches the registry's naming (cmp.Or(name, type)) so it lines up with the live toolset's Name. Toolsets with no explicit allow-list (serve all tools) are omitted.
(cfg latest.AgentConfig)
| 949 | // (cmp.Or(name, type)) so it lines up with the live toolset's Name. Toolsets |
| 950 | // with no explicit allow-list (serve all tools) are omitted. |
| 951 | func declaredToolNames(cfg latest.AgentConfig) map[string][]string { |
| 952 | m := make(map[string][]string, len(cfg.Toolsets)) |
| 953 | for i := range cfg.Toolsets { |
| 954 | t := cfg.Toolsets[i] |
| 955 | key := cmp.Or(t.Name, t.Type) |
| 956 | if key == "" || len(t.Tools) == 0 { |
| 957 | continue |
| 958 | } |
| 959 | m[key] = slices.Clone(t.Tools) |
| 960 | } |
| 961 | return m |
| 962 | } |
| 963 | |
| 964 | // uniqueNames drops empty entries and de-duplicates names. By default it keeps |
| 965 | // the first-seen order (meaningful for declaration/priority order); when sorted |