ai 7.0.63 → 7.0.65

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.
@@ -92,7 +92,7 @@ import {
92
92
  } from "@ai-sdk/provider-utils";
93
93
 
94
94
  // src/version.ts
95
- var VERSION = true ? "7.0.63" : "0.0.0-test";
95
+ var VERSION = true ? "7.0.65" : "0.0.0-test";
96
96
 
97
97
  // src/util/download/download.ts
98
98
  var download = async ({
@@ -121,7 +121,6 @@ Here are the capabilities of popular models:
121
121
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-4` | <Cross /> | <Check /> | <Check /> | <Check /> |
122
122
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3` | <Cross /> | <Check /> | <Check /> | <Check /> |
123
123
  | [xAI Grok](/providers/ai-sdk-providers/xai) | `grok-3-mini` | <Cross /> | <Check /> | <Check /> | <Check /> |
124
- | [Vercel](/providers/ai-sdk-providers/vercel) | `v0-1.0-md` | <Check /> | <Check /> | <Check /> | <Check /> |
125
124
  | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6` | <Check /> | <Check /> | <Check /> | <Check /> |
126
125
  | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6-luna` | <Check /> | <Check /> | <Check /> | <Check /> |
127
126
  | [OpenAI](/providers/ai-sdk-providers/openai) | `gpt-5.6-sol` | <Check /> | <Check /> | <Check /> | <Check /> |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.63",
3
+ "version": "7.0.65",
4
4
  "type": "module",
5
5
  "description": "AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.",
6
6
  "license": "Apache-2.0",
@@ -42,7 +42,7 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@ai-sdk/gateway": "4.0.50",
45
+ "@ai-sdk/gateway": "4.0.52",
46
46
  "@ai-sdk/provider": "4.0.7",
47
47
  "@ai-sdk/provider-utils": "5.0.27"
48
48
  },
@@ -140,11 +140,20 @@ const arrayOutputStrategy = <ELEMENT>(
140
140
  // be able to generate an array directly:
141
141
  // possible future optimization: use arrays directly when model supports grammar-guided generation
142
142
  jsonSchema: async () => {
143
- // remove $schema from schema.jsonSchema:
144
- const { $schema: _$schema, ...itemSchema } = await schema.jsonSchema;
143
+ // keep root-level definitions available to root-relative references:
144
+ const {
145
+ $schema: _$schema,
146
+ definitions,
147
+ $defs,
148
+ ...itemSchema
149
+ } = (await schema.jsonSchema) as JSONSchema7 & {
150
+ $defs?: JSONSchema7['definitions'];
151
+ };
145
152
 
146
153
  return {
147
154
  $schema: 'http://json-schema.org/draft-07/schema#',
155
+ ...(definitions != null && { definitions }),
156
+ ...($defs != null && { $defs }),
148
157
  type: 'object',
149
158
  properties: {
150
159
  elements: { type: 'array', items: itemSchema },
@@ -1,5 +1,6 @@
1
1
  import {
2
2
  TypeValidationError,
3
+ type JSONSchema7,
3
4
  type JSONValue,
4
5
  type LanguageModelV4CallOptions,
5
6
  } from '@ai-sdk/provider';
@@ -217,13 +218,22 @@ export const array = <ELEMENT>({
217
218
 
218
219
  // JSON schema that describes an array of elements:
219
220
  responseFormat: resolve(elementSchema.jsonSchema).then(jsonSchema => {
220
- // remove $schema from schema.jsonSchema:
221
- const { $schema: _$schema, ...itemSchema } = jsonSchema;
221
+ // keep root-level definitions available to root-relative references:
222
+ const {
223
+ $schema: _$schema,
224
+ definitions,
225
+ $defs,
226
+ ...itemSchema
227
+ } = jsonSchema as JSONSchema7 & {
228
+ $defs?: JSONSchema7['definitions'];
229
+ };
222
230
 
223
231
  return {
224
232
  type: 'json' as const,
225
233
  schema: {
226
234
  $schema: 'http://json-schema.org/draft-07/schema#',
235
+ ...(definitions != null && { definitions }),
236
+ ...($defs != null && { $defs }),
227
237
  type: 'object',
228
238
  properties: {
229
239
  elements: { type: 'array', items: itemSchema },
package/src/ui/chat.ts CHANGED
@@ -861,15 +861,13 @@ export abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
861
861
  finishReason: activeResponse.state.finishReason,
862
862
  });
863
863
  }
864
- } catch (err) {
865
- console.error(err);
866
- }
864
+ } finally {
865
+ if (this.activeResponse === activeResponse) {
866
+ this.activeResponse = undefined;
867
+ }
867
868
 
868
- if (this.activeResponse === activeResponse) {
869
- this.activeResponse = undefined;
869
+ clearActiveResumeRequest();
870
870
  }
871
-
872
- clearActiveResumeRequest();
873
871
  }
874
872
 
875
873
  // automatically send the message if the sendAutomaticallyWhen function returns true
@@ -11,6 +11,35 @@ import {
11
11
  } from '../util/async-iterable-stream';
12
12
  import { consumeStream } from '../util/consume-stream';
13
13
 
14
+ function createUIMessageSnapshot<UI_MESSAGE extends UIMessage>(
15
+ message: UI_MESSAGE,
16
+ ): UI_MESSAGE {
17
+ const textByPartIndex = new Map<number, string>();
18
+ const messageWithoutText = {
19
+ ...message,
20
+ parts: message.parts.map((part, index) => {
21
+ if (part.type === 'text' || part.type === 'reasoning') {
22
+ textByPartIndex.set(index, part.text);
23
+ return { ...part, text: '' };
24
+ }
25
+
26
+ return part;
27
+ }),
28
+ };
29
+
30
+ const snapshot = structuredClone(messageWithoutText) as UI_MESSAGE;
31
+
32
+ for (const [index, text] of textByPartIndex) {
33
+ const part = snapshot.parts[index];
34
+
35
+ if (part.type === 'text' || part.type === 'reasoning') {
36
+ part.text = text;
37
+ }
38
+ }
39
+
40
+ return snapshot;
41
+ }
42
+
14
43
  /**
15
44
  * Transforms a stream of `UIMessageChunk`s into an `AsyncIterableStream` of `UIMessage`s.
16
45
  *
@@ -68,7 +97,7 @@ export function readUIMessageStream<UI_MESSAGE extends UIMessage>({
68
97
  return job({
69
98
  state,
70
99
  write: () => {
71
- controller?.enqueue(structuredClone(state.message));
100
+ controller?.enqueue(createUIMessageSnapshot(state.message));
72
101
  },
73
102
  });
74
103
  },