| 1 | package agent |
| 2 | |
| 3 | import "reasonix/internal/tool" |
| 4 | |
| 5 | // normalizeSubagentShellNames keeps legacy skill/profile allowlists working |
| 6 | // when Windows exposes only the canonical pwsh tool. The parent registry is |
| 7 | // authoritative: aliases select its platform shell and never add a second |
| 8 | // executor or bypass its sandbox wrapper. |
| 9 | func normalizeSubagentShellNames(parent *tool.Registry, names []string) []string { |
| 10 | if parent == nil || len(names) == 0 { |
| 11 | return names |
| 12 | } |
| 13 | shellName := "" |
| 14 | if _, ok := parent.Get("pwsh"); ok { |
| 15 | shellName = "pwsh" |
| 16 | } else if _, ok := parent.Get("bash"); ok { |
| 17 | shellName = "bash" |
| 18 | } |
| 19 | if shellName == "" { |
| 20 | return names |
| 21 | } |
| 22 | out := append([]string(nil), names...) |
| 23 | for i, name := range out { |
| 24 | if tool.IsShellToolName(name) { |
| 25 | out[i] = shellName |
| 26 | } |
| 27 | } |
| 28 | return out |
| 29 | } |
| 30 |