ai 6.0.0-beta.93 → 6.0.0-beta.95

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,17 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.0-beta.95
4
+
5
+ ### Patch Changes
6
+
7
+ - eb8d1cb: fix not catching of empty arrays in validateUIMessage
8
+
9
+ ## 6.0.0-beta.94
10
+
11
+ ### Patch Changes
12
+
13
+ - ab1087b: feat(ai): `chat.addToolResult()` is now `chat.addToolOutput()`
14
+
3
15
  ## 6.0.0-beta.93
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -207,7 +207,7 @@ We've built [templates](https://ai-sdk.dev/docs/introduction#templates) that inc
207
207
 
208
208
  ## Community
209
209
 
210
- The AI SDK community can be found on [GitHub Discussions](https://github.com/vercel/ai/discussions) where you can ask questions, voice ideas, and share your projects with other people.
210
+ The AI SDK community can be found on [the Vercel Community](https://community.vercel.com/c/ai-sdk/62) where you can ask questions, voice ideas, and share your projects with other people.
211
211
 
212
212
  ## Contributing
213
213
 
package/dist/index.d.mts CHANGED
@@ -3020,6 +3020,20 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
3020
3020
  */
3021
3021
  clearError: () => void;
3022
3022
  addToolApprovalResponse: ChatAddToolApproveResponseFunction;
3023
+ addToolOutput: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
3024
+ state?: "output-available";
3025
+ tool: TOOL;
3026
+ toolCallId: string;
3027
+ output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
3028
+ errorText?: never;
3029
+ } | {
3030
+ state: "output-error";
3031
+ tool: TOOL;
3032
+ toolCallId: string;
3033
+ output?: never;
3034
+ errorText: string;
3035
+ }) => Promise<void>;
3036
+ /** @deprecated Use addToolOutput */
3023
3037
  addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
3024
3038
  state?: "output-available";
3025
3039
  tool: TOOL;
package/dist/index.d.ts CHANGED
@@ -3020,6 +3020,20 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
3020
3020
  */
3021
3021
  clearError: () => void;
3022
3022
  addToolApprovalResponse: ChatAddToolApproveResponseFunction;
3023
+ addToolOutput: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
3024
+ state?: "output-available";
3025
+ tool: TOOL;
3026
+ toolCallId: string;
3027
+ output: InferUIMessageTools<UI_MESSAGE>[TOOL]["output"];
3028
+ errorText?: never;
3029
+ } | {
3030
+ state: "output-error";
3031
+ tool: TOOL;
3032
+ toolCallId: string;
3033
+ output?: never;
3034
+ errorText: string;
3035
+ }) => Promise<void>;
3036
+ /** @deprecated Use addToolOutput */
3023
3037
  addToolResult: <TOOL extends keyof InferUIMessageTools<UI_MESSAGE>>({ state, tool, toolCallId, output, errorText, }: {
3024
3038
  state?: "output-available";
3025
3039
  tool: TOOL;
package/dist/index.js CHANGED
@@ -858,7 +858,7 @@ function detectMediaType({
858
858
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
859
859
 
860
860
  // src/version.ts
861
- var VERSION = true ? "6.0.0-beta.93" : "0.0.0-test";
861
+ var VERSION = true ? "6.0.0-beta.95" : "0.0.0-test";
862
862
 
863
863
  // src/util/download/download.ts
864
864
  var download = async ({ url }) => {
@@ -7308,9 +7308,9 @@ var uiMessagesSchema = (0, import_provider_utils20.lazySchema)(
7308
7308
  })
7309
7309
  })
7310
7310
  ])
7311
- )
7311
+ ).nonempty("Message must contain at least one part")
7312
7312
  })
7313
- )
7313
+ ).nonempty("Messages array must not be empty")
7314
7314
  )
7315
7315
  );
7316
7316
  async function safeValidateUIMessages({
@@ -10921,7 +10921,7 @@ var AbstractChat = class {
10921
10921
  });
10922
10922
  }
10923
10923
  });
10924
- this.addToolResult = async ({
10924
+ this.addToolOutput = async ({
10925
10925
  state = "output-available",
10926
10926
  tool: tool2,
10927
10927
  toolCallId,
@@ -10946,6 +10946,8 @@ var AbstractChat = class {
10946
10946
  });
10947
10947
  }
10948
10948
  });
10949
+ /** @deprecated Use addToolOutput */
10950
+ this.addToolResult = this.addToolOutput;
10949
10951
  /**
10950
10952
  * Abort the current request immediately, keep the generated tokens if any.
10951
10953
  */