ai 6.0.266 → 6.0.268

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
@@ -1193,7 +1193,7 @@ import {
1193
1193
  } from "@ai-sdk/provider-utils";
1194
1194
 
1195
1195
  // src/version.ts
1196
- var VERSION = true ? "6.0.266" : "0.0.0-test";
1196
+ var VERSION = true ? "6.0.268" : "0.0.0-test";
1197
1197
 
1198
1198
  // src/util/download/download.ts
1199
1199
  var download = async ({
@@ -2908,6 +2908,7 @@ async function executeToolCall({
2908
2908
  onToolCallStart,
2909
2909
  onToolCallFinish
2910
2910
  }) {
2911
+ var _a22;
2911
2912
  const { toolName, toolCallId, input } = toolCall;
2912
2913
  const tool2 = tools == null ? void 0 : tools[toolName];
2913
2914
  if ((tool2 == null ? void 0 : tool2.execute) == null) {
@@ -2932,6 +2933,12 @@ async function executeToolCall({
2932
2933
  operationId: "ai.toolCall",
2933
2934
  telemetry
2934
2935
  }),
2936
+ ...Object.fromEntries(
2937
+ Object.entries((_a22 = telemetry == null ? void 0 : telemetry.metadata) != null ? _a22 : {}).map(([key, value]) => [
2938
+ `ai.telemetry.metadata.${key}`,
2939
+ value
2940
+ ])
2941
+ ),
2935
2942
  "ai.toolCall.name": toolName,
2936
2943
  "ai.toolCall.id": toolCallId,
2937
2944
  "ai.toolCall.args": {
@@ -5121,7 +5128,7 @@ async function generateText({
5121
5128
  ]
5122
5129
  });
5123
5130
  let resolvedOutput;
5124
- if (lastStep.finishReason === "stop") {
5131
+ if (lastStep.finishReason === "stop" || lastStep.finishReason !== "tool-calls" && lastStep.text.length > 0) {
5125
5132
  const outputSpecification = output != null ? output : text();
5126
5133
  resolvedOutput = await outputSpecification.parseCompleteOutput(
5127
5134
  { text: lastStep.text },