fix(botui): Send TOOL_EXEC (id=6) via WebSocket for direct tool invocation
Some checks failed
BotUI CI / build (push) Failing after 51m11s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-05 19:10:51 -03:00
parent 45f56f0f6e
commit 4c5f93fc71

View file

@ -1041,14 +1041,17 @@
console.log("Parsed action:", action); console.log("Parsed action:", action);
if (action.type === "invoke_tool") { if (action.type === "invoke_tool") {
// Check if tool needs parameters // Invoke tool directly via WebSocket - invisible to user
if (action.prompt_for_params) { ws.send(JSON.stringify({
// Need parameters, send text as message bot_id: currentBotId,
window.sendMessage(sugg.text); user_id: currentUserId,
} else { session_id: currentSessionId,
// No params needed - invoke tool directly channel: "web",
window.sendMessage("/tool " + action.tool); content: action.tool,
} message_type: 6, // TOOL_EXEC
timestamp: new Date().toISOString(),
}));
return;
} else if (action.type === "send_message") { } else if (action.type === "send_message") {
window.sendMessage( window.sendMessage(
action.message || sugg.text, action.message || sugg.text,