fix(agent): share agent tools with subagent manager

SubagentManager was created with an empty ToolRegistry, causing
subagents to have no access to file operations (read_file, write_file,
exec, etc.). This fix shares the parent agent's tools with subagents.
This commit is contained in:
codywon 2026-02-20 01:17:45 +08:00
parent 521359ed4f
commit 52f0c541b5

View file

@ -119,6 +119,8 @@ func registerSharedTools(cfg *config.Config, msgBus *bus.MessageBus, registry *A
// Spawn tool with allowlist checker // Spawn tool with allowlist checker
subagentManager := tools.NewSubagentManager(provider, agent.Model, agent.Workspace, msgBus) subagentManager := tools.NewSubagentManager(provider, agent.Model, agent.Workspace, msgBus)
// Share the agent's tools with subagent so it can execute file operations, etc.
subagentManager.SetTools(agent.Tools)
spawnTool := tools.NewSpawnTool(subagentManager) spawnTool := tools.NewSpawnTool(subagentManager)
currentAgentID := agentID currentAgentID := agentID
spawnTool.SetAllowlistChecker(func(targetAgentID string) bool { spawnTool.SetAllowlistChecker(func(targetAgentID string) bool {