ai 4.2.3 → 4.2.4

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,11 @@
1
1
  # ai
2
2
 
3
+ ## 4.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - 3d6d96d: fix (ai/core): validate that messages are not empty
8
+
3
9
  ## 4.2.3
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2175,6 +2175,12 @@ function standardizePrompt({
2175
2175
  const messages = promptType === "ui-messages" ? convertToCoreMessages(prompt.messages, {
2176
2176
  tools
2177
2177
  }) : prompt.messages;
2178
+ if (messages.length === 0) {
2179
+ throw new import_provider10.InvalidPromptError({
2180
+ prompt,
2181
+ message: "messages must not be empty"
2182
+ });
2183
+ }
2178
2184
  const validationResult = (0, import_provider_utils4.safeValidateTypes)({
2179
2185
  value: messages,
2180
2186
  schema: import_zod7.z.array(coreMessageSchema)