fix: critical tool registration bug - ChatPanel.setAgent() was overwriting all tools
Some checks are pending
CI / build-check-test (push) Waiting to run

ROOT CAUSE: agent.setTools() registered 8 tools (bash, browser, web-search,
image-gen, tts, memory, repl), then chatPanel.setAgent(agent) with no config
called this.agent.setTools([artifactsTool]) internally, OVERWRITING all tools.

FIX: Pass tools via toolsFactory config parameter so ChatPanel merges them
with its own artifacts tool instead of replacing them.

This fixes all 'Tool X not found' errors in the web UI.
This commit is contained in:
JAE 2026-03-27 04:59:26 +00:00
parent 11af96265a
commit 6c0037f8a1

View file

@ -406,19 +406,20 @@ Persist information across sessions. Use to save important context, user prefere
renderApp(); renderApp();
}, },
}); });
// Register tools with the agent // Register tools via toolsFactory so ChatPanel includes them alongside its artifacts tool
const replTool = createJavaScriptReplTool(); const replTool = createJavaScriptReplTool();
agent.setTools([
replTool,
createWebSearchTool(),
createBashTool(),
createBrowserTool(),
createImageGenTool(),
createTTSTool(),
...createMemoryTools(),
]);
costTracker.bindAgent(agent); costTracker.bindAgent(agent);
chatPanel?.setAgent(agent); chatPanel?.setAgent(agent, {
toolsFactory: () => [
replTool,
createWebSearchTool(),
createBashTool(),
createBrowserTool(),
createImageGenTool(),
createTTSTool(),
...createMemoryTools(),
],
});
// Hook: live model badge + immediate empty state hide // Hook: live model badge + immediate empty state hide
requestAnimationFrame(() => { requestAnimationFrame(() => {
if (chatPanel?.agentInterface) { if (chatPanel?.agentInterface) {