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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.0-beta.156
4
+
5
+ ### Patch Changes
6
+
7
+ - 2406576: chore(agent): rename messages property on agent ui stream functions to uiMessages
8
+
9
+ ## 6.0.0-beta.155
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [c1efac4]
14
+ - @ai-sdk/provider-utils@4.0.0-beta.51
15
+ - @ai-sdk/gateway@2.0.0-beta.82
16
+
3
17
  ## 6.0.0-beta.154
4
18
 
5
19
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2975,13 +2975,13 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
2975
2975
  * Runs the agent and returns a response object with a UI message stream.
2976
2976
  *
2977
2977
  * @param agent - The agent to run.
2978
- * @param messages - The input UI messages.
2978
+ * @param uiMessages - The input UI messages.
2979
2979
  *
2980
2980
  * @returns The response object.
2981
2981
  */
2982
2982
  declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
2983
2983
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
2984
- messages: unknown[];
2984
+ uiMessages: unknown[];
2985
2985
  abortSignal?: AbortSignal;
2986
2986
  options?: CALL_OPTIONS;
2987
2987
  experimental_transform?: StreamTextTransform<TOOLS> | Array<StreamTextTransform<TOOLS>>;
@@ -3645,16 +3645,16 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
3645
3645
  * Runs the agent and stream the output as a UI message stream.
3646
3646
  *
3647
3647
  * @param agent - The agent to run.
3648
- * @param messages - The input UI messages.
3648
+ * @param uiMessages - The input UI messages.
3649
3649
  * @param abortSignal - The abort signal. Optional.
3650
3650
  * @param options - The options for the agent.
3651
3651
  * @param experimental_transform - The stream transformations. Optional.
3652
3652
  *
3653
3653
  * @returns The UI message stream.
3654
3654
  */
3655
- declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, messages, options, abortSignal, experimental_transform, ...uiMessageStreamOptions }: {
3655
+ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, uiMessages, options, abortSignal, experimental_transform, ...uiMessageStreamOptions }: {
3656
3656
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
3657
- messages: unknown[];
3657
+ uiMessages: unknown[];
3658
3658
  abortSignal?: AbortSignal;
3659
3659
  options?: CALL_OPTIONS;
3660
3660
  experimental_transform?: StreamTextTransform<TOOLS> | Array<StreamTextTransform<TOOLS>>;
@@ -3664,12 +3664,12 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
3664
3664
  * Pipes the agent UI message stream to a Node.js ServerResponse object.
3665
3665
  *
3666
3666
  * @param agent - The agent to run.
3667
- * @param messages - The input UI messages.
3667
+ * @param uiMessages - The input UI messages.
3668
3668
  */
3669
3669
  declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
3670
3670
  response: ServerResponse;
3671
3671
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
3672
- messages: unknown[];
3672
+ uiMessages: unknown[];
3673
3673
  abortSignal?: AbortSignal;
3674
3674
  options?: CALL_OPTIONS;
3675
3675
  experimental_transform?: StreamTextTransform<TOOLS> | Array<StreamTextTransform<TOOLS>>;
package/dist/index.d.ts CHANGED
@@ -2975,13 +2975,13 @@ type InferAgentUIMessage<AGENT, MESSAGE_METADATA = unknown> = UIMessage<MESSAGE_
2975
2975
  * Runs the agent and returns a response object with a UI message stream.
2976
2976
  *
2977
2977
  * @param agent - The agent to run.
2978
- * @param messages - The input UI messages.
2978
+ * @param uiMessages - The input UI messages.
2979
2979
  *
2980
2980
  * @returns The response object.
2981
2981
  */
2982
2982
  declare function createAgentUIStreamResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ headers, status, statusText, consumeSseStream, ...options }: {
2983
2983
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
2984
- messages: unknown[];
2984
+ uiMessages: unknown[];
2985
2985
  abortSignal?: AbortSignal;
2986
2986
  options?: CALL_OPTIONS;
2987
2987
  experimental_transform?: StreamTextTransform<TOOLS> | Array<StreamTextTransform<TOOLS>>;
@@ -3645,16 +3645,16 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
3645
3645
  * Runs the agent and stream the output as a UI message stream.
3646
3646
  *
3647
3647
  * @param agent - The agent to run.
3648
- * @param messages - The input UI messages.
3648
+ * @param uiMessages - The input UI messages.
3649
3649
  * @param abortSignal - The abort signal. Optional.
3650
3650
  * @param options - The options for the agent.
3651
3651
  * @param experimental_transform - The stream transformations. Optional.
3652
3652
  *
3653
3653
  * @returns The UI message stream.
3654
3654
  */
3655
- declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, messages, options, abortSignal, experimental_transform, ...uiMessageStreamOptions }: {
3655
+ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ agent, uiMessages, options, abortSignal, experimental_transform, ...uiMessageStreamOptions }: {
3656
3656
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
3657
- messages: unknown[];
3657
+ uiMessages: unknown[];
3658
3658
  abortSignal?: AbortSignal;
3659
3659
  options?: CALL_OPTIONS;
3660
3660
  experimental_transform?: StreamTextTransform<TOOLS> | Array<StreamTextTransform<TOOLS>>;
@@ -3664,12 +3664,12 @@ declare function createAgentUIStream<CALL_OPTIONS = never, TOOLS extends ToolSet
3664
3664
  * Pipes the agent UI message stream to a Node.js ServerResponse object.
3665
3665
  *
3666
3666
  * @param agent - The agent to run.
3667
- * @param messages - The input UI messages.
3667
+ * @param uiMessages - The input UI messages.
3668
3668
  */
3669
3669
  declare function pipeAgentUIStreamToResponse<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, OUTPUT extends Output = never, MESSAGE_METADATA = unknown>({ response, headers, status, statusText, consumeSseStream, ...options }: {
3670
3670
  response: ServerResponse;
3671
3671
  agent: Agent<CALL_OPTIONS, TOOLS, OUTPUT>;
3672
- messages: unknown[];
3672
+ uiMessages: unknown[];
3673
3673
  abortSignal?: AbortSignal;
3674
3674
  options?: CALL_OPTIONS;
3675
3675
  experimental_transform?: StreamTextTransform<TOOLS> | Array<StreamTextTransform<TOOLS>>;
package/dist/index.js CHANGED
@@ -964,7 +964,7 @@ function detectMediaType({
964
964
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
965
965
 
966
966
  // src/version.ts
967
- var VERSION = true ? "6.0.0-beta.154" : "0.0.0-test";
967
+ var VERSION = true ? "6.0.0-beta.156" : "0.0.0-test";
968
968
 
969
969
  // src/util/download/download.ts
970
970
  var download = async ({ url }) => {
@@ -1376,6 +1376,7 @@ function mapToolResultOutput(output) {
1376
1376
  var import_provider18 = require("@ai-sdk/provider");
1377
1377
  async function createToolModelOutput({
1378
1378
  toolCallId,
1379
+ input,
1379
1380
  output,
1380
1381
  tool: tool2,
1381
1382
  errorMode
@@ -1386,7 +1387,7 @@ async function createToolModelOutput({
1386
1387
  return { type: "error-json", value: toJSONValue(output) };
1387
1388
  }
1388
1389
  if (tool2 == null ? void 0 : tool2.toModelOutput) {
1389
- return await tool2.toModelOutput({ toolCallId, output });
1390
+ return await tool2.toModelOutput({ toolCallId, input, output });
1390
1391
  }
1391
1392
  return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
1392
1393
  }
@@ -3399,6 +3400,7 @@ async function toResponseMessages({
3399
3400
  case "tool-result": {
3400
3401
  const output = await createToolModelOutput({
3401
3402
  toolCallId: part.toolCallId,
3403
+ input: part.input,
3402
3404
  tool: tools == null ? void 0 : tools[part.toolName],
3403
3405
  output: part.output,
3404
3406
  errorMode: "none"
@@ -3415,6 +3417,7 @@ async function toResponseMessages({
3415
3417
  case "tool-error": {
3416
3418
  const output = await createToolModelOutput({
3417
3419
  toolCallId: part.toolCallId,
3420
+ input: part.input,
3418
3421
  tool: tools == null ? void 0 : tools[part.toolName],
3419
3422
  output: part.error,
3420
3423
  errorMode: "json"
@@ -3450,6 +3453,7 @@ async function toResponseMessages({
3450
3453
  }
3451
3454
  const output = await createToolModelOutput({
3452
3455
  toolCallId: part.toolCallId,
3456
+ input: part.input,
3453
3457
  tool: tools == null ? void 0 : tools[part.toolName],
3454
3458
  output: part.type === "tool-result" ? part.output : part.error,
3455
3459
  errorMode: part.type === "tool-error" ? "text" : "none"
@@ -3571,6 +3575,7 @@ async function generateText({
3571
3575
  for (const output2 of toolOutputs) {
3572
3576
  const modelOutput = await createToolModelOutput({
3573
3577
  toolCallId: output2.toolCallId,
3578
+ input: output2.input,
3574
3579
  tool: tools == null ? void 0 : tools[output2.toolName],
3575
3580
  output: output2.type === "tool-result" ? output2.output : output2.error,
3576
3581
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -5969,6 +5974,7 @@ var DefaultStreamTextResult = class {
5969
5974
  toolName: output2.toolName,
5970
5975
  output: await createToolModelOutput({
5971
5976
  toolCallId: output2.toolCallId,
5977
+ input: output2.input,
5972
5978
  tool: tools == null ? void 0 : tools[output2.toolName],
5973
5979
  output: output2.type === "tool-result" ? output2.output : output2.error,
5974
5980
  errorMode: output2.type === "tool-error" ? "json" : "none"
@@ -7179,6 +7185,7 @@ async function convertToModelMessages(messages, options) {
7179
7185
  toolName,
7180
7186
  output: await createToolModelOutput({
7181
7187
  toolCallId: part.toolCallId,
7188
+ input: part.input,
7182
7189
  output: part.state === "output-error" ? part.errorText : part.output,
7183
7190
  tool: (_b = options == null ? void 0 : options.tools) == null ? void 0 : _b[toolName],
7184
7191
  errorMode: part.state === "output-error" ? "json" : "none"
@@ -7242,6 +7249,7 @@ async function convertToModelMessages(messages, options) {
7242
7249
  toolName,
7243
7250
  output: await createToolModelOutput({
7244
7251
  toolCallId: toolPart.toolCallId,
7252
+ input: toolPart.input,
7245
7253
  output: toolPart.state === "output-error" ? toolPart.errorText : toolPart.output,
7246
7254
  tool: (_f = options == null ? void 0 : options.tools) == null ? void 0 : _f[toolName],
7247
7255
  errorMode: toolPart.state === "output-error" ? "text" : "none"
@@ -7663,14 +7671,14 @@ async function validateUIMessages({
7663
7671
  // src/agent/create-agent-ui-stream.ts
7664
7672
  async function createAgentUIStream({
7665
7673
  agent,
7666
- messages,
7674
+ uiMessages,
7667
7675
  options,
7668
7676
  abortSignal,
7669
7677
  experimental_transform,
7670
7678
  ...uiMessageStreamOptions
7671
7679
  }) {
7672
7680
  const validatedMessages = await validateUIMessages({
7673
- messages,
7681
+ messages: uiMessages,
7674
7682
  tools: agent.tools
7675
7683
  });
7676
7684
  const modelMessages = await convertToModelMessages(validatedMessages, {