ai 7.0.155 → 7.0.157

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.
@@ -24,7 +24,7 @@ The `reasoning` parameter accepts the following values:
24
24
  | Value | Behavior |
25
25
  | -------------------- | -------------------------------------------------------------------- |
26
26
  | `'provider-default'` | Use the provider's default reasoning behavior (default when omitted) |
27
- | `'none'` | Disable reasoning |
27
+ | `'none'` | Disable reasoning (lowest reasoning level if it cannot be disabled) |
28
28
  | `'minimal'` | Bare-minimum reasoning |
29
29
  | `'low'` | Fast, concise reasoning |
30
30
  | `'medium'` | Balanced reasoning |
@@ -80,9 +80,15 @@ This design lets you use the portable `reasoning` parameter by default and fall
80
80
 
81
81
  The `reasoning` parameter is supported by providers including OpenAI, Anthropic, Google, xAI, Groq, DeepSeek, Moonshot AI, Fireworks, Amazon Bedrock, Mistral, Cohere, Alibaba, Open Responses, OpenAI Compatible, and Perplexity. Each provider translates the value to its native reasoning API.
82
82
 
83
- Providers with a distinct native maximum tier, such as supported OpenAI, Anthropic, DeepSeek, and Moonshot AI models, receive `'max'` directly. Amazon Bedrock preserves `'max'` for its Anthropic and OpenAI effort mappings, while Amazon Nova 2 maps `'xhigh'` and `'max'` to `'high'` with a compatibility warning. Providers whose highest native tier is lower coerce `'max'` to their closest supported tier and emit a compatibility warning when their adapter supports warning propagation. OpenAI-compatible and Open Responses endpoints receive `'max'` directly so compatible servers can interpret it.
83
+ ### How values are mapped
84
84
 
85
- Some providers use a numeric token budget instead of an enum for reasoning control. In those cases, `'max'` maps to 95% of the model's maximum output tokens by default, subject to the provider's minimum and maximum reasoning budget limits.
85
+ When a model does not support the requested value, the provider uses the closest supported value, rounding down. The values are ordered `none` < `minimal` < `low` < `medium` < `high` < `xhigh` < `max`, so `'xhigh'` becomes `'high'` on a model without an `xhigh` level. If there is no lower value, the next higher one is used.
86
+
87
+ Rounding never turns reasoning off: other values never map to `'none'`, and `'none'` on a model that cannot disable reasoning maps to the model's lowest level. Providers emit a `compatibility` warning whenever the value they send differs from the requested value. Values set in `providerOptions` are sent unchanged (see [Precedence Rules](#precedence-rules)).
88
+
89
+ Providers only round values for models and model families they recognize by model ID, so newer versions of a known family use that family's levels. Unrecognized model IDs, such as fine-tuned or custom models, and OpenAI-compatible and Open Responses endpoints receive the value directly and the API decides whether it is supported.
90
+
91
+ For providers that use a token budget, the value maps to a percentage of the model's maximum output tokens (`'max'` maps to 95% by default), within the provider's budget limits.
86
92
 
87
93
  Maximum reasoning can substantially increase token usage, latency, cost, and the chance of reaching request or output limits. Use it when the model's additional reasoning depth is worth those tradeoffs.
88
94
 
@@ -272,12 +272,42 @@ const agent = new HarnessAgent({
272
272
  `toolApproval` accepts the same status values as AI SDK tool approval status
273
273
  objects: `not-applicable`, `approved`, `user-approval`, and `denied`.
274
274
 
275
+ When a host tool call is denied, the model and response messages receive an
276
+ `execution-denied` tool result with the denial reason, if provided. The tool's
277
+ `execute` and `toModelOutput` functions are not called for the denial.
278
+
275
279
  When approval is required, the stream pauses after a `tool-approval-request`.
276
280
  Continue the same session by sending a tool approval response message. In UI
277
281
  flows, `useChat` sends those messages for you when you add the approval result.
278
282
  In direct agent code, pass the approval response as `messages` on the next
279
283
  `stream()` or `generate()` call.
280
284
 
285
+ ### Native Tool Names
286
+
287
+ Built-in tool calls use the harness tool name, such as `bash`, `write`, or
288
+ `edit`, while their input follows the underlying runtime's schema. When an
289
+ adapter supplies a different native name, `HarnessAgent` exposes it as
290
+ `providerMetadata[harnessId].nativeToolName` on the streamed `tool-call` and
291
+ on the `toolCall` inside a `tool-approval-request`.
292
+
293
+ For example, a Claude Code approval request for `bash` includes
294
+ `toolCall.providerMetadata['claude-code'].nativeToolName: 'Bash'`. An approval
295
+ gate that works with Claude Code's native tool names can read it without
296
+ changing the harness-facing `toolName` or interpreting the input shape:
297
+
298
+ ```ts
299
+ for await (const part of result.fullStream) {
300
+ if (part.type === 'tool-approval-request') {
301
+ const nativeToolName =
302
+ part.toolCall.providerMetadata?.['claude-code']?.nativeToolName;
303
+ console.log(nativeToolName ?? part.toolCall.toolName, part.toolCall.input);
304
+ }
305
+ }
306
+ ```
307
+
308
+ The metadata field is omitted when the adapter does not supply a native name
309
+ or when it matches `toolName`. Existing provider metadata is preserved.
310
+
281
311
  ## Built-in Approval Support
282
312
 
283
313
  Most adapters can pause built-in tool calls for approval. Adapters that do not
@@ -5,8 +5,6 @@ description: Filter a tool set to the currently active tools (API Reference)
5
5
 
6
6
  # `filterActiveTools()`
7
7
 
8
- <Note type="warning">`filterActiveTools` is an experimental feature.</Note>
9
-
10
8
  `filterActiveTools` filters a tool set to only the string tool names listed in `activeTools`.
11
9
  If `activeTools` is `undefined`, it returns the original tool set.
12
10
  If `tools` is `undefined`, it returns `undefined`.
@@ -14,7 +12,7 @@ If `tools` is `undefined`, it returns `undefined`.
14
12
  `filterActiveTools` is useful for limiting which tools are sent to a model in a particular step.
15
13
 
16
14
  ```ts
17
- import { experimental_filterActiveTools as filterActiveTools, tool } from 'ai';
15
+ import { filterActiveTools, tool } from 'ai';
18
16
  import { z } from 'zod';
19
17
 
20
18
  const tools = {
@@ -38,10 +36,7 @@ const filteredTools = filterActiveTools({
38
36
 
39
37
  ## Import
40
38
 
41
- <Snippet
42
- text={`import { experimental_filterActiveTools as filterActiveTools } from "ai"`}
43
- prompt={false}
44
- />
39
+ <Snippet text={`import { filterActiveTools } from "ai"`} prompt={false} />
45
40
 
46
41
  ## API Signature
47
42
 
@@ -143,7 +143,7 @@ It also contains the following helper functions:
143
143
  href: '/docs/reference/ai-sdk-core/sandbox',
144
144
  },
145
145
  {
146
- title: 'experimental_filterActiveTools()',
146
+ title: 'filterActiveTools()',
147
147
  description: 'Filters a tool set to only the currently active tools.',
148
148
  href: '/docs/reference/ai-sdk-core/filter-active-tools',
149
149
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.155",
3
+ "version": "7.0.157",
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,20 +42,20 @@
42
42
  }
43
43
  },
44
44
  "dependencies": {
45
- "@ai-sdk/gateway": "4.0.128",
45
+ "@ai-sdk/gateway": "4.0.130",
46
46
  "@ai-sdk/provider": "4.0.34",
47
- "@ai-sdk/provider-utils": "5.0.70"
47
+ "@ai-sdk/provider-utils": "5.0.71"
48
48
  },
49
49
  "devDependencies": {
50
- "@ai-sdk/amazon-bedrock": "5.0.126",
51
- "@ai-sdk/deepseek": "3.0.75",
52
- "@ai-sdk/google": "4.0.107",
53
- "@ai-sdk/groq": "4.0.72",
54
- "@ai-sdk/huggingface": "2.0.80",
55
- "@ai-sdk/moonshotai": "3.0.80",
56
- "@ai-sdk/openai": "4.0.104",
50
+ "@ai-sdk/amazon-bedrock": "5.0.128",
51
+ "@ai-sdk/deepseek": "3.0.76",
52
+ "@ai-sdk/google": "4.0.108",
53
+ "@ai-sdk/groq": "4.0.73",
54
+ "@ai-sdk/huggingface": "2.0.81",
55
+ "@ai-sdk/moonshotai": "3.0.81",
56
+ "@ai-sdk/openai": "4.0.105",
57
57
  "@ai-sdk/test-server": "2.0.4",
58
- "@ai-sdk/xai": "5.0.32",
58
+ "@ai-sdk/xai": "5.0.33",
59
59
  "@edge-runtime/vm": "^5.0.0",
60
60
  "@smithy/eventstream-codec": "^4.3.3",
61
61
  "@smithy/util-utf8": "^4.3.3",
@@ -1,6 +1,13 @@
1
1
  export type { ActiveTools } from './active-tools';
2
2
  export type { ContentPart } from './content-part';
3
- export { filterActiveTools as experimental_filterActiveTools } from './filter-active-tools';
3
+ export {
4
+ filterActiveTools,
5
+
6
+ /**
7
+ * @deprecated Use `filterActiveTools` instead.
8
+ */
9
+ filterActiveTools as experimental_filterActiveTools,
10
+ } from './filter-active-tools';
4
11
  export { generateText, type GenerateTextInclude } from './generate-text';
5
12
  export type {
6
13
  GenerateTextAbortEvent,
@@ -69,6 +76,11 @@ export {
69
76
  } from './stop-condition';
70
77
  export {
71
78
  streamLanguageModelCall as experimental_streamLanguageModelCall,
79
+ type LanguageModelStreamPart,
80
+
81
+ /**
82
+ * @deprecated Use `LanguageModelStreamPart` instead. This alias will be removed in v8.
83
+ */
72
84
  type LanguageModelStreamPart as Experimental_LanguageModelStreamPart,
73
85
  } from './stream-language-model-call';
74
86
  export {
@@ -1,3 +1,5 @@
1
1
  export function isNodeRuntime(): boolean {
2
- return typeof process !== 'undefined' && process.release?.name === 'node';
2
+ // Access the optional global directly so Edge bundlers do not treat this
3
+ // runtime check as an unsupported use of the Node.js process API.
4
+ return globalThis.process?.release?.name === 'node';
3
5
  }