| 1 | package pi |
| 2 | |
| 3 | import ( |
| 4 | "encoding/json" |
| 5 | "strings" |
| 6 | |
| 7 | "amadan.net/oficina/equipo/internal/runner/provider" |
| 8 | ) |
| 9 | |
| 10 | // Extension is Equipo's own Pi extension (provider.PiExtensionSource), whose |
| 11 | // digest every Pi policy pins. |
| 12 | func Extension() []byte { return provider.PiExtensionSource() } |
| 13 | |
| 14 | // ExtensionSHA256 is its digest. |
| 15 | func ExtensionSHA256() string { return provider.PiExtensionSHA256() } |
| 16 | |
| 17 | // Models is models.json for one provider behind Pi (provider.PiModels). |
| 18 | func Models(providerName, model string) json.RawMessage { |
| 19 | return provider.PiModels(providerName, model) |
| 20 | } |
| 21 | |
| 22 | // Settings and MCP are settings.json and mcp.json (the policy accepts |
| 23 | // exactly these). |
| 24 | var ( |
| 25 | Settings = provider.PiSettings |
| 26 | MCP = provider.PiMCP |
| 27 | ) |
| 28 | |
| 29 | // Tools are the tools a role pins: Review and a question read only |
| 30 | // (read, grep, find, ls), Engineering also writes and runs commands |
| 31 | // inside the namespace; then the step's own Equipo tools, each by name. |
| 32 | func Tools(action string, equipo []string) []string { |
| 33 | tools := []string{"read", "grep", "find", "ls"} |
| 34 | if action == "implement" { |
| 35 | tools = []string{"read", "bash", "edit", "write", "grep", "find", "ls"} |
| 36 | } |
| 37 | for _, name := range equipo { |
| 38 | tools = append(tools, "mcp__equipo__"+name) |
| 39 | } |
| 40 | return tools |
| 41 | } |
| 42 | |
| 43 | // EquipoTool is the step tool a Pi tool name stands for ("" if none). |
| 44 | func EquipoTool(name string) string { |
| 45 | t, _ := strings.CutPrefix(name, "mcp__equipo__") |
| 46 | if t == name { |
| 47 | return "" |
| 48 | } |
| 49 | return t |
| 50 | } |
| 51 | |