| 1 | package agent |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | |
| 6 | "reasonix/internal/tool" |
| 7 | ) |
| 8 | |
| 9 | // ask is deliberately absent: a planner that needs a user-owned decision asks |
| 10 | // for it with the real tool, so the answer shapes the plan instead of being |
| 11 | // stapled onto a finished one. |
| 12 | var plannerNonResearchTools = []string{ |
| 13 | "job_output", |
| 14 | "bash_output", |
| 15 | "slash_command", |
| 16 | "todo_write", |
| 17 | "wait", |
| 18 | } |
| 19 | |
| 20 | // PlannerToolRegistry returns read-only research tools, submit_plan, and an |
| 21 | // isolated use_capability proxy. Direct MCP schemas and selected workflow tools |
| 22 | // stay hidden. submit_plan is added only here, so the planner gaining a |
| 23 | // structured exit leaves the executor's cache-stable tool prefix untouched. |
| 24 | func PlannerToolRegistry(parent *tool.Registry) *tool.Registry { |
| 25 | exclude := append(SubagentMetaTools(), plannerNonResearchTools...) |
| 26 | base := FilterReadOnlyRegistry(parent, exclude...) |
| 27 | sub := tool.NewRegistry() |
| 28 | sub.Add(NewSubmitPlanTool()) |
| 29 | if base != nil { |
| 30 | for _, name := range base.Names() { |
| 31 | if name == "use_capability" || strings.HasPrefix(name, tool.MCPNamePrefix) { |
| 32 | continue |
| 33 | } |
| 34 | if tl, ok := base.Get(name); ok { |
| 35 | sub.Add(tl) |
| 36 | } |
| 37 | } |
| 38 | } |
| 39 | if parent != nil { |
| 40 | if tl, ok := parent.Get("use_capability"); ok { |
| 41 | if cloned := cloneCapabilityFrontend(tl); cloned != nil { |
| 42 | sub.Add(cloned) |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | return sub |
| 47 | } |
| 48 |