ai 6.0.0-beta.154 → 6.0.0-beta.156

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.154" : "0.0.0-test";
869
+ var VERSION = true ? "6.0.0-beta.156" : "0.0.0-test";
870
870
 
871
871
  // src/util/download/download.ts
872
872
  var download = async ({ url }) => {
@@ -1281,6 +1281,7 @@ function mapToolResultOutput(output) {
1281
1281
  import { getErrorMessage as getErrorMessage3 } from "@ai-sdk/provider";
1282
1282
  async function createToolModelOutput({
1283
1283
  toolCallId,
1284
+ input,
1284
1285
  output,
1285
1286
  tool: tool2,
1286
1287
  errorMode
@@ -1291,7 +1292,7 @@ async function createToolModelOutput({
1291
1292
  return { type: "error-json", value: toJSONValue(output) };
1292
1293
  }
1293
1294
  if (tool2 == null ? void 0 : tool2.toModelOutput) {
1294
- return await tool2.toModelOutput({ toolCallId, output });
1295
+ return await tool2.toModelOutput({ toolCallId, input, output });
1295
1296
  }
1296
1297
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
1297
1298
  }
@@ -3320,6 +3321,7 @@ async function toResponseMessages({
3320
3321
  case "tool-result": {
3321
3322
  const output = await createToolModelOutput({
3322
3323
  toolCallId: part.toolCallId,
3324
+ input: part.input,
3323
3325
  tool: tools == null ? void 0 : tools[part.toolName],
3324
3326
  output: part.output,
3325
3327
  errorMode: "none"
@@ -3336,6 +3338,7 @@ async function toResponseMessages({
3336
3338
  case "tool-error": {
3337
3339
  const output = await createToolModelOutput({
3338
3340
  toolCallId: part.toolCallId,
3341
+ input: part.input,
3339
3342
  tool: tools == null ? void 0 : tools[part.toolName],
3340
3343
  output: part.error,
3341
3344
  errorMode: "json"
@@ -3371,6 +3374,7 @@ async function toResponseMessages({
3371
3374
  }
3372
3375
  const output = await createToolModelOutput({
3373
3376
  toolCallId: part.toolCallId,
3377
+ input: part.input,
3374
3378
  tool: tools == null ? void 0 : tools[part.toolName],
3375
3379
  output: part.type === "tool-result" ? part.output : part.error,
3376
3380
  errorMode: part.type === "tool-error" ? "text" : "none"
@@ -3492,6 +3496,7 @@ async function generateText({
3492
3496
  for (const output2 of toolOutputs) {
3493
3497
  const modelOutput = await createToolModelOutput({
3494
3498
  toolCallId: output2.toolCallId,
3499
+ input: output2.input,
3495
3500
  tool: tools == null ? void 0 : tools[output2.toolName],
3496
3501
  output: output2.type === "tool-result" ? output2.output : output2.error,
3497
3502
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -5898,6 +5903,7 @@ var DefaultStreamTextResult = class {
5898
5903
  toolName: output2.toolName,
5899
5904
  output: await createToolModelOutput({
5900
5905
  toolCallId: output2.toolCallId,
5906
+ input: output2.input,
5901
5907
  tool: tools == null ? void 0 : tools[output2.toolName],
5902
5908
  output: output2.type === "tool-result" ? output2.output : output2.error,
5903
5909
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -7113,6 +7119,7 @@ async function convertToModelMessages(messages, options) {
7113
7119
  toolName,
7114
7120
  output: await createToolModelOutput({
7115
7121
  toolCallId: part.toolCallId,
7122
+ input: part.input,
7116
7123
  output: part.state === "output-error" ? part.errorText : part.output,
7117
7124
  tool: (_b = options == null ? void 0 : options.tools) == null ? void 0 : _b[toolName],
7118
7125
  errorMode: part.state === "output-error" ? "json" : "none"
@@ -7176,6 +7183,7 @@ async function convertToModelMessages(messages, options) {
7176
7183
  toolName,
7177
7184
  output: await createToolModelOutput({
7178
7185
  toolCallId: toolPart.toolCallId,
7186
+ input: toolPart.input,
7179
7187
  output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,
7180
7188
  tool: (_f = options == null ? void 0 : options.tools) == null ? void 0 : _f[toolName],
7181
7189
  errorMode: toolPart.state === "output-error" ? "text" : "none"
@@ -7601,14 +7609,14 @@ async function validateUIMessages({
7601
7609
  // src/agent/create-agent-ui-stream.ts
7602
7610
  async function createAgentUIStream({
7603
7611
  agent,
7604
- messages,
7612
+ uiMessages,
7605
7613
  options,
7606
7614
  abortSignal,
7607
7615
  experimental_transform,
7608
7616
  ...uiMessageStreamOptions
7609
7617
  }) {
7610
7618
  const validatedMessages = await validateUIMessages({
7611
- messages,
7619
+ messages: uiMessages,
7612
7620
  tools: agent.tools
7613
7621
  });
7614
7622
  const modelMessages = await convertToModelMessages(validatedMessages, {