ai 6.0.234 → 6.0.236

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.236
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [8418710]
8
+ - @ai-sdk/gateway@3.0.158
9
+
10
+ ## 6.0.235
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [5d7b986]
15
+ - @ai-sdk/gateway@3.0.157
16
+
3
17
  ## 6.0.234
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1304,7 +1304,7 @@ function detectMediaType({
1304
1304
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1305
1305
 
1306
1306
  // src/version.ts
1307
- var VERSION = true ? "6.0.234" : "0.0.0-test";
1307
+ var VERSION = true ? "6.0.236" : "0.0.0-test";
1308
1308
 
1309
1309
  // src/util/download/download.ts
1310
1310
  var download = async ({
package/dist/index.mjs CHANGED
@@ -1193,7 +1193,7 @@ import {
1193
1193
  } from "@ai-sdk/provider-utils";
1194
1194
 
1195
1195
  // src/version.ts
1196
- var VERSION = true ? "6.0.234" : "0.0.0-test";
1196
+ var VERSION = true ? "6.0.236" : "0.0.0-test";
1197
1197
 
1198
1198
  // src/util/download/download.ts
1199
1199
  var download = async ({
@@ -164,7 +164,7 @@ function detectMediaType({
164
164
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
165
165
 
166
166
  // src/version.ts
167
- var VERSION = true ? "6.0.234" : "0.0.0-test";
167
+ var VERSION = true ? "6.0.236" : "0.0.0-test";
168
168
 
169
169
  // src/util/download/download.ts
170
170
  var download = async ({
@@ -144,7 +144,7 @@ import {
144
144
  } from "@ai-sdk/provider-utils";
145
145
 
146
146
  // src/version.ts
147
- var VERSION = true ? "6.0.234" : "0.0.0-test";
147
+ var VERSION = true ? "6.0.236" : "0.0.0-test";
148
148
 
149
149
  // src/util/download/download.ts
150
150
  var download = async ({
@@ -92,6 +92,7 @@ The open-source community has created the following providers:
92
92
  - [Zhipu (Z.AI) Provider](/providers/community-providers/zhipu) (`zhipu-ai-provider`)
93
93
  - [OLLM Provider](/providers/community-providers/ollm) (`@ofoundation/ollm`)
94
94
  - [ZeroEntropy Provider](/providers/community-providers/zeroentropy) (`zeroentropy-ai-provider`)
95
+ - [Neon AI Gateway Provider](/providers/community-providers/neon-ai-gateway) (`@neon/ai-sdk-provider`)
95
96
 
96
97
  ## Self-Hosted Models
97
98
 
@@ -120,6 +120,11 @@ There are three things worth mentioning:
120
120
  It asks the user for confirmation and displays the result once the user confirms or denies the execution.
121
121
  The result is added to the chat using `addToolOutput` with the `tool` parameter for type safety.
122
122
 
123
+ Typed tool parts also include the `approval-requested`, `approval-responded`,
124
+ and `output-denied` states. Include these states when handling `part.state`
125
+ exhaustively, even when a tool does not require approval. See
126
+ [Tool execution approval](#tool-execution-approval) for a complete approval UI.
127
+
123
128
  ```tsx filename='app/page.tsx' highlight="6,11,16,19-23,25-26,28-33,51,66-70,77-81"
124
129
  'use client';
125
130
 
@@ -209,6 +214,10 @@ export default function Chat() {
209
214
  </div>
210
215
  </div>
211
216
  );
217
+ case 'approval-requested':
218
+ return <div key={callId}>Approval requested.</div>;
219
+ case 'approval-responded':
220
+ return <div key={callId}>Approval response received.</div>;
212
221
  case 'output-available':
213
222
  return (
214
223
  <div key={callId}>
@@ -217,6 +226,8 @@ export default function Chat() {
217
226
  );
218
227
  case 'output-error':
219
228
  return <div key={callId}>Error: {part.errorText}</div>;
229
+ case 'output-denied':
230
+ return <div key={callId}>Tool call denied.</div>;
220
231
  }
221
232
  break;
222
233
  }
@@ -231,6 +242,10 @@ export default function Chat() {
231
242
  );
232
243
  case 'input-available':
233
244
  return <div key={callId}>Getting location...</div>;
245
+ case 'approval-requested':
246
+ return <div key={callId}>Approval requested.</div>;
247
+ case 'approval-responded':
248
+ return <div key={callId}>Approval response received.</div>;
234
249
  case 'output-available':
235
250
  return <div key={callId}>Location: {part.output}</div>;
236
251
  case 'output-error':
@@ -239,6 +254,8 @@ export default function Chat() {
239
254
  Error getting location: {part.errorText}
240
255
  </div>
241
256
  );
257
+ case 'output-denied':
258
+ return <div key={callId}>Location request denied.</div>;
242
259
  }
243
260
  break;
244
261
  }
@@ -258,6 +275,10 @@ export default function Chat() {
258
275
  Getting weather information for {part.input.city}...
259
276
  </div>
260
277
  );
278
+ case 'approval-requested':
279
+ return <div key={callId}>Approval requested.</div>;
280
+ case 'approval-responded':
281
+ return <div key={callId}>Approval response received.</div>;
261
282
  case 'output-available':
262
283
  return (
263
284
  <div key={callId}>
@@ -271,6 +292,8 @@ export default function Chat() {
271
292
  {part.errorText}
272
293
  </div>
273
294
  );
295
+ case 'output-denied':
296
+ return <div key={callId}>Weather request denied.</div>;
274
297
  }
275
298
  break;
276
299
  }
@@ -556,10 +579,16 @@ export default function Chat() {
556
579
  return <pre>{JSON.stringify(part.input, null, 2)}</pre>;
557
580
  case 'input-available':
558
581
  return <pre>{JSON.stringify(part.input, null, 2)}</pre>;
582
+ case 'approval-requested':
583
+ return <div>Approval requested.</div>;
584
+ case 'approval-responded':
585
+ return <div>Approval response received.</div>;
559
586
  case 'output-available':
560
587
  return <pre>{JSON.stringify(part.output, null, 2)}</pre>;
561
588
  case 'output-error':
562
589
  return <div>Error: {part.errorText}</div>;
590
+ case 'output-denied':
591
+ return <div>Tool call denied.</div>;
563
592
  }
564
593
  }
565
594
  })}
@@ -525,6 +525,34 @@ The `unknown` finish reason has been removed. It is now returned as `other`.
525
525
 
526
526
  ## AI SDK UI
527
527
 
528
+ ### Tool UI Part Approval States
529
+
530
+ AI SDK 6 adds `approval-requested`, `approval-responded`, and `output-denied`
531
+ to the tool UI part `state` union. Update exhaustive `switch` statements and
532
+ other state handling to cover the three approval states.
533
+
534
+ ```tsx filename="AI SDK 6"
535
+ switch (part.state) {
536
+ case 'input-streaming':
537
+ return 'Loading input';
538
+ case 'input-available':
539
+ return 'Input ready';
540
+ case 'approval-requested':
541
+ return 'Approval requested';
542
+ case 'approval-responded':
543
+ return 'Approval response received';
544
+ case 'output-available':
545
+ return 'Output ready';
546
+ case 'output-error':
547
+ return part.errorText;
548
+ case 'output-denied':
549
+ return 'Tool call denied';
550
+ }
551
+ ```
552
+
553
+ See [Tool execution approval](/docs/ai-sdk-ui/chatbot-tool-usage#tool-execution-approval)
554
+ for handling approval requests and responses in a chat UI.
555
+
528
556
  ### Tool UI Part Helper Functions Rename
529
557
 
530
558
  The tool UI part helper functions have been renamed to better reflect their purpose and to accommodate both static and dynamic tool parts ([PR #XXXX](https://github.com/vercel/ai/pull/XXXX)).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "6.0.234",
3
+ "version": "6.0.236",
4
4
  "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.",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@opentelemetry/api": "^1.9.0",
48
- "@ai-sdk/gateway": "3.0.156",
48
+ "@ai-sdk/gateway": "3.0.158",
49
49
  "@ai-sdk/provider": "3.0.14",
50
50
  "@ai-sdk/provider-utils": "4.0.40"
51
51
  },
@@ -58,8 +58,8 @@
58
58
  "tsx": "^4.19.2",
59
59
  "typescript": "5.8.3",
60
60
  "zod": "3.25.76",
61
- "@vercel/ai-tsconfig": "0.0.0",
62
- "@ai-sdk/test-server": "1.0.6"
61
+ "@ai-sdk/test-server": "1.0.6",
62
+ "@vercel/ai-tsconfig": "0.0.0"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "zod": "^3.25.76 || ^4.1.8"