ai 3.1.16 → 3.1.17

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/index.mjs CHANGED
@@ -3229,6 +3229,7 @@ async function parseComplexResponse({
3229
3229
  reader,
3230
3230
  abortControllerRef,
3231
3231
  update,
3232
+ onToolCall,
3232
3233
  onFinish,
3233
3234
  generateId: generateId2 = generateId,
3234
3235
  getCurrentDate = () => /* @__PURE__ */ new Date()
@@ -3269,6 +3270,14 @@ async function parseComplexResponse({
3269
3270
  prefixMap.text.toolInvocations = [];
3270
3271
  }
3271
3272
  prefixMap.text.toolInvocations.push(value);
3273
+ if (onToolCall) {
3274
+ console.log("onToolCall", value);
3275
+ const result = await onToolCall({ toolCall: value });
3276
+ console.log("onToolCall result", result);
3277
+ if (result != null) {
3278
+ prefixMap.text.toolInvocations[prefixMap.text.toolInvocations.length - 1] = { ...value, result };
3279
+ }
3280
+ }
3272
3281
  } else if (type === "tool_result") {
3273
3282
  if (prefixMap.text == null) {
3274
3283
  prefixMap.text = {