ai 6.0.304 → 6.0.306

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,22 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.306
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [d9244d1]
8
+ - @ai-sdk/gateway@3.0.214
9
+
10
+ ## 6.0.305
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [604b4d3]
15
+ - Updated dependencies [0a2b345]
16
+ - Updated dependencies [92ef6a5]
17
+ - @ai-sdk/provider-utils@4.0.58
18
+ - @ai-sdk/gateway@3.0.213
19
+
3
20
  ## 6.0.304
4
21
 
5
22
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1335,7 +1335,7 @@ function detectMediaType({
1335
1335
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1336
1336
 
1337
1337
  // src/version.ts
1338
- var VERSION = true ? "6.0.304" : "0.0.0-test";
1338
+ var VERSION = true ? "6.0.306" : "0.0.0-test";
1339
1339
 
1340
1340
  // src/util/download/download.ts
1341
1341
  var download = async ({
package/dist/index.mjs CHANGED
@@ -1225,7 +1225,7 @@ import {
1225
1225
  } from "@ai-sdk/provider-utils";
1226
1226
 
1227
1227
  // src/version.ts
1228
- var VERSION = true ? "6.0.304" : "0.0.0-test";
1228
+ var VERSION = true ? "6.0.306" : "0.0.0-test";
1229
1229
 
1230
1230
  // src/util/download/download.ts
1231
1231
  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.304" : "0.0.0-test";
167
+ var VERSION = true ? "6.0.306" : "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.304" : "0.0.0-test";
147
+ var VERSION = true ? "6.0.306" : "0.0.0-test";
148
148
 
149
149
  // src/util/download/download.ts
150
150
  var download = async ({
@@ -180,7 +180,7 @@ for (const part of result.content) {
180
180
  type: 'tool-approval-response',
181
181
  approvalId: part.approvalId,
182
182
  approved: true, // or false to deny
183
- reason: 'User confirmed the command', // Optional context for the model
183
+ reason: 'User confirmed the command', // Optional, see below
184
184
  };
185
185
  approvals.push(response);
186
186
  }
@@ -192,6 +192,19 @@ messages.push({ role: 'tool', content: approvals });
192
192
 
193
193
  Then call `generateText` again with the updated messages. If approved, the tool executes. If denied, the model receives the denial and can respond accordingly.
194
194
 
195
+ The optional `reason` is handled differently depending on the decision:
196
+
197
+ - **Denied**: the reason is included in the `execution-denied` tool result, so the model can see why the tool call was not executed.
198
+ - **Approved** (tools executed by the AI SDK): the reason remains in the approval response in your messages (e.g. for rendering in the UI or for audit logs). The SDK does not include it in the model prompt, modify the tool's input, or expose it through a dedicated execution option. The model only sees the tool result. In manual `generateText` and `streamText` continuations, the approval response is available to the tool's `execute` function through `options.messages`.
199
+
200
+ <Note>
201
+ The approval `reason` is not a channel for passing data to an approved tool.
202
+ If you need input from the user (for example, an answer to a question or a
203
+ corrected value), use a tool without an `execute` function and provide its
204
+ result from the client instead. See [Chatbot Tool
205
+ Usage](/docs/ai-sdk-ui/chatbot-tool-usage).
206
+ </Note>
207
+
195
208
  <Note>
196
209
  When a tool execution is denied, consider adding a system instruction like
197
210
  "When a tool execution is not approved, do not retry it" to prevent the model
@@ -480,6 +480,14 @@ export default function Chat() {
480
480
  }
481
481
  ```
482
482
 
483
+ `addToolApprovalResponse` also accepts an optional `reason`. When a reason is
484
+ supplied with a denial, it is included in the `execution-denied` tool result
485
+ that the model sees. When it is supplied with an approval for a tool executed
486
+ by the AI SDK, it is recorded on the message part, but the SDK does not include
487
+ it in the model prompt, modify the tool's input, or expose it through a
488
+ dedicated execution option. To collect input from the user for a tool, use a
489
+ client-side tool and `addToolOutput` instead.
490
+
483
491
  Approval request chunks can also include an `approvalDescriptor` with opaque
484
492
  application-specific metadata. UI message processing exposes it as
485
493
  `part.approval.descriptor` in the `approval-requested` state and preserves it in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "6.0.304",
3
+ "version": "6.0.306",
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,9 +45,9 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "@opentelemetry/api": "^1.9.0",
48
- "@ai-sdk/gateway": "3.0.212",
48
+ "@ai-sdk/gateway": "3.0.214",
49
49
  "@ai-sdk/provider": "3.0.18",
50
- "@ai-sdk/provider-utils": "4.0.57"
50
+ "@ai-sdk/provider-utils": "4.0.58"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@edge-runtime/vm": "^5.0.0",
@@ -58,7 +58,7 @@
58
58
  "tsx": "^4.19.2",
59
59
  "typescript": "5.8.3",
60
60
  "zod": "3.25.76",
61
- "@ai-sdk/google": "3.0.131",
61
+ "@ai-sdk/google": "3.0.132",
62
62
  "@ai-sdk/test-server": "1.0.6",
63
63
  "@vercel/ai-tsconfig": "0.0.0"
64
64
  },