ai 6.0.0-beta.153 → 6.0.0-beta.154

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
@@ -866,7 +866,7 @@ import {
866
866
  } from "@ai-sdk/provider-utils";
867
867
 
868
868
  // src/version.ts
869
- var VERSION = true ? "6.0.0-beta.153" : "0.0.0-test";
869
+ var VERSION = true ? "6.0.0-beta.154" : "0.0.0-test";
870
870
 
871
871
  // src/util/download/download.ts
872
872
  var download = async ({ url }) => {
@@ -1280,6 +1280,7 @@ function mapToolResultOutput(output) {
1280
1280
  // src/prompt/create-tool-model-output.ts
1281
1281
  import { getErrorMessage as getErrorMessage3 } from "@ai-sdk/provider";
1282
1282
  async function createToolModelOutput({
1283
+ toolCallId,
1283
1284
  output,
1284
1285
  tool: tool2,
1285
1286
  errorMode
@@ -1290,7 +1291,7 @@ async function createToolModelOutput({
1290
1291
  return { type: "error-json", value: toJSONValue(output) };
1291
1292
  }
1292
1293
  if (tool2 == null ? void 0 : tool2.toModelOutput) {
1293
- return await tool2.toModelOutput({ output });
1294
+ return await tool2.toModelOutput({ toolCallId, output });
1294
1295
  }
1295
1296
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
1296
1297
  }
@@ -3318,6 +3319,7 @@ async function toResponseMessages({
3318
3319
  break;
3319
3320
  case "tool-result": {
3320
3321
  const output = await createToolModelOutput({
3322
+ toolCallId: part.toolCallId,
3321
3323
  tool: tools == null ? void 0 : tools[part.toolName],
3322
3324
  output: part.output,
3323
3325
  errorMode: "none"
@@ -3333,6 +3335,7 @@ async function toResponseMessages({
3333
3335
  }
3334
3336
  case "tool-error": {
3335
3337
  const output = await createToolModelOutput({
3338
+ toolCallId: part.toolCallId,
3336
3339
  tool: tools == null ? void 0 : tools[part.toolName],
3337
3340
  output: part.error,
3338
3341
  errorMode: "json"
@@ -3367,6 +3370,7 @@ async function toResponseMessages({
3367
3370
  continue;
3368
3371
  }
3369
3372
  const output = await createToolModelOutput({
3373
+ toolCallId: part.toolCallId,
3370
3374
  tool: tools == null ? void 0 : tools[part.toolName],
3371
3375
  output: part.type === "tool-result" ? part.output : part.error,
3372
3376
  errorMode: part.type === "tool-error" ? "text" : "none"
@@ -3487,6 +3491,7 @@ async function generateText({
3487
3491
  const toolContent = [];
3488
3492
  for (const output2 of toolOutputs) {
3489
3493
  const modelOutput = await createToolModelOutput({
3494
+ toolCallId: output2.toolCallId,
3490
3495
  tool: tools == null ? void 0 : tools[output2.toolName],
3491
3496
  output: output2.type === "tool-result" ? output2.output : output2.error,
3492
3497
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -5892,6 +5897,7 @@ var DefaultStreamTextResult = class {
5892
5897
  toolCallId: output2.toolCallId,
5893
5898
  toolName: output2.toolName,
5894
5899
  output: await createToolModelOutput({
5900
+ toolCallId: output2.toolCallId,
5895
5901
  tool: tools == null ? void 0 : tools[output2.toolName],
5896
5902
  output: output2.type === "tool-result" ? output2.output : output2.error,
5897
5903
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -7106,6 +7112,7 @@ async function convertToModelMessages(messages, options) {
7106
7112
  toolCallId: part.toolCallId,
7107
7113
  toolName,
7108
7114
  output: await createToolModelOutput({
7115
+ toolCallId: part.toolCallId,
7109
7116
  output: part.state === "output-error" ? part.errorText : part.output,
7110
7117
  tool: (_b = options == null ? void 0 : options.tools) == null ? void 0 : _b[toolName],
7111
7118
  errorMode: part.state === "output-error" ? "json" : "none"
@@ -7168,6 +7175,7 @@ async function convertToModelMessages(messages, options) {
7168
7175
  toolCallId: toolPart.toolCallId,
7169
7176
  toolName,
7170
7177
  output: await createToolModelOutput({
7178
+ toolCallId: toolPart.toolCallId,
7171
7179
  output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,
7172
7180
  tool: (_f = options == null ? void 0 : options.tools) == null ? void 0 : _f[toolName],
7173
7181
  errorMode: toolPart.state === "output-error" ? "text" : "none"