ai 4.0.6 → 4.0.8

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
@@ -3530,8 +3530,8 @@ async function executeTools({
3530
3530
  abortSignal
3531
3531
  }) {
3532
3532
  const toolResults = await Promise.all(
3533
- toolCalls.map(async (toolCall) => {
3534
- const tool2 = tools[toolCall.toolName];
3533
+ toolCalls.map(async ({ toolCallId, toolName, args }) => {
3534
+ const tool2 = tools[toolName];
3535
3535
  if ((tool2 == null ? void 0 : tool2.execute) == null) {
3536
3536
  return void 0;
3537
3537
  }
@@ -3544,16 +3544,17 @@ async function executeTools({
3544
3544
  operationId: "ai.toolCall",
3545
3545
  telemetry
3546
3546
  }),
3547
- "ai.toolCall.name": toolCall.toolName,
3548
- "ai.toolCall.id": toolCall.toolCallId,
3547
+ "ai.toolCall.name": toolName,
3548
+ "ai.toolCall.id": toolCallId,
3549
3549
  "ai.toolCall.args": {
3550
- output: () => JSON.stringify(toolCall.args)
3550
+ output: () => JSON.stringify(args)
3551
3551
  }
3552
3552
  }
3553
3553
  }),
3554
3554
  tracer,
3555
3555
  fn: async (span) => {
3556
- const result2 = await tool2.execute(toolCall.args, {
3556
+ const result2 = await tool2.execute(args, {
3557
+ toolCallId,
3557
3558
  messages,
3558
3559
  abortSignal
3559
3560
  });
@@ -3574,9 +3575,9 @@ async function executeTools({
3574
3575
  }
3575
3576
  });
3576
3577
  return {
3577
- toolCallId: toolCall.toolCallId,
3578
- toolName: toolCall.toolName,
3579
- args: toolCall.args,
3578
+ toolCallId,
3579
+ toolName,
3580
+ args,
3580
3581
  result
3581
3582
  };
3582
3583
  })
@@ -3799,6 +3800,7 @@ function runToolsTransformation({
3799
3800
  }),
3800
3801
  tracer,
3801
3802
  fn: async (span) => tool2.execute(toolCall.args, {
3803
+ toolCallId: toolCall.toolCallId,
3802
3804
  messages,
3803
3805
  abortSignal
3804
3806
  }).then(
@@ -4524,7 +4526,7 @@ var DefaultStreamTextResult = class {
4524
4526
  });
4525
4527
  }
4526
4528
  toDataStreamInternal({
4527
- getErrorMessage: getErrorMessage3 = () => "",
4529
+ getErrorMessage: getErrorMessage3 = () => "An error occurred.",
4528
4530
  // mask error messages for safety by default
4529
4531
  sendUsage = true
4530
4532
  } = {}) {