@meetsmore-oss/use-ai-client 1.9.1 → 1.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/bundled.js CHANGED
@@ -23576,6 +23576,19 @@ var UseAIClient = class {
23576
23576
  }
23577
23577
  });
23578
23578
  }
23579
+ } else if (event.type === export_EventType.TOOL_CALL_RESULT) {
23580
+ const e = event;
23581
+ const alreadyTracked = this._pendingToolResults.some(
23582
+ (r) => "toolCallId" in r && r.toolCallId === e.toolCallId
23583
+ );
23584
+ if (!alreadyTracked) {
23585
+ this._pendingToolResults.push({
23586
+ id: e.messageId,
23587
+ role: "tool",
23588
+ content: e.content,
23589
+ toolCallId: e.toolCallId
23590
+ });
23591
+ }
23579
23592
  } else if (event.type === export_EventType.RUN_FINISHED) {
23580
23593
  if (this._currentAssistantMessage) {
23581
23594
  if (this._currentAssistantToolCalls.length > 0) {
@@ -39287,7 +39300,15 @@ function UseAIProvider({
39287
39300
  const lastRegisteredToolsRef = useRef12("");
39288
39301
  useEffect11(() => {
39289
39302
  const client = clientRef.current;
39290
- if (!client || !client.isConnected() || !toolSystem.hasTools) return;
39303
+ if (!client || !client.isConnected()) return;
39304
+ if (!toolSystem.hasTools) {
39305
+ if (lastRegisteredToolsRef.current !== "") {
39306
+ lastRegisteredToolsRef.current = "";
39307
+ client.registerTools([]);
39308
+ console.log("[Provider] All tools unregistered, clearing client tools");
39309
+ }
39310
+ return;
39311
+ }
39291
39312
  const toolKeys = Object.keys(toolSystem.aggregatedTools).sort().join(",");
39292
39313
  if (toolKeys === lastRegisteredToolsRef.current) {
39293
39314
  console.log("[Provider] Skipping re-registration, tools unchanged");