mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 23:01:30 +00:00
fix(tools): wrap ALL registry tools with hooks, not just active ones
wrappedToolRegistry was only containing activeToolsArray (4 tools). Now wraps all tools from the registry so hooks can enable any tool.
This commit is contained in:
parent
2849623afc
commit
31438fdf2a
1 changed files with 4 additions and 2 deletions
|
|
@ -656,9 +656,11 @@ export async function createAgentSession(options: CreateAgentSessionOptions = {}
|
|||
let wrappedToolRegistry: Map<string, AgentTool> | undefined;
|
||||
if (hookRunner) {
|
||||
activeToolsArray = wrapToolsWithHooks(activeToolsArray as AgentTool[], hookRunner);
|
||||
// Also create a wrapped version of the registry for setTools
|
||||
// Wrap ALL registry tools (not just active) so hooks can enable any
|
||||
const allRegistryTools = Array.from(toolRegistry.values());
|
||||
const wrappedAllTools = wrapToolsWithHooks(allRegistryTools, hookRunner);
|
||||
wrappedToolRegistry = new Map<string, AgentTool>();
|
||||
for (const tool of activeToolsArray as AgentTool[]) {
|
||||
for (const tool of wrappedAllTools) {
|
||||
wrappedToolRegistry.set(tool.name, tool);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue