refactor: Share tool registry with subagent and add note

This commit is contained in:
leozeli 2026-03-04 10:27:11 +08:00
parent d9e900cf29
commit 0e85bdf79c

View file

@ -179,6 +179,8 @@ func registerSharedTools(
// Spawn tool with allowlist checker
subagentManager := tools.NewSubagentManager(provider, agent.Model, agent.Workspace, msgBus)
subagentManager.SetLLMOptions(agent.MaxTokens, agent.Temperature)
// CRITICAL: Share the same tool registry with subagent so it has access to all tools
subagentManager.SetTools(agent.Tools)
spawnTool := tools.NewSpawnTool(subagentManager)
currentAgentID := agentID
spawnTool.SetAllowlistChecker(func(targetAgentID string) bool {