ai 7.0.66 → 7.0.68

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
+ ## 7.0.68
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [257632b]
8
+ - @ai-sdk/gateway@4.0.54
9
+
10
+ ## 7.0.67
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [a0b1ffc]
15
+ - @ai-sdk/gateway@4.0.53
16
+
3
17
  ## 7.0.66
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1143,7 +1143,7 @@ import {
1143
1143
  } from "@ai-sdk/provider-utils";
1144
1144
 
1145
1145
  // src/version.ts
1146
- var VERSION = true ? "7.0.66" : "0.0.0-test";
1146
+ var VERSION = true ? "7.0.68" : "0.0.0-test";
1147
1147
 
1148
1148
  // src/util/download/download.ts
1149
1149
  var download = async ({
@@ -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.66" : "0.0.0-test";
95
+ var VERSION = true ? "7.0.68" : "0.0.0-test";
96
96
 
97
97
  // src/util/download/download.ts
98
98
  var download = async ({
@@ -97,6 +97,7 @@ The open-source community has created the following providers:
97
97
  - [ZeroEntropy Provider](/providers/community-providers/zeroentropy) (`zeroentropy-ai-provider`)
98
98
  - [Crusoe Provider](/providers/community-providers/crusoe) (`crusoe-ai-provider`)
99
99
  - [Neon AI Gateway Provider](/providers/community-providers/neon-ai-gateway) (`@neon/ai-sdk-provider`)
100
+ - [Interfaze Provider](/providers/community-providers/interfaze) (`@interfaze-ai/ai-sdk`)
100
101
 
101
102
  ## Self-Hosted Models
102
103
 
@@ -25,6 +25,12 @@ Create an MCP client using one of the following transport options:
25
25
  - SSE (Server-Sent Events): An alternative HTTP-based transport
26
26
  - `stdio`: For local development only. Uses standard input/output streams for local MCP servers
27
27
 
28
+ The AI SDK MCP client supports both legacy initialization-based protocol
29
+ versions and stateless MCP `2026-07-28`. The built-in stdio transport probes
30
+ with `server/discover` and automatically falls back to the legacy
31
+ `initialize` handshake for older servers. Custom transports can opt into this
32
+ negotiation with `supportsProtocolVersionDiscovery: true`.
33
+
28
34
  ### HTTP Transport (Recommended)
29
35
 
30
36
  For production deployments, we recommend using the HTTP transport. You can configure it directly on the client:
@@ -49,8 +55,9 @@ const mcpClient = await createMCPClient({
49
55
  });
50
56
  ```
51
57
 
52
- If the MCP server uses Streamable HTTP sessions, you can reattach to a saved
53
- session by restoring both the previous session id and initialize result:
58
+ If a legacy MCP server uses Streamable HTTP sessions, you can reattach to a
59
+ saved session by restoring both the previous session id and initialize result.
60
+ MCP `2026-07-28` is stateless and does not use these options:
54
61
 
55
62
  ```typescript
56
63
  import { createMCPClient } from '@ai-sdk/mcp';
@@ -203,6 +210,32 @@ This hook is called before the SDK fetches authorization server metadata, so a
203
210
  rejected URL is not requested. It is optional and does not change existing OAuth
204
211
  flows unless you implement it.
205
212
 
213
+ ### OAuth Callback Issuer Validation
214
+
215
+ When completing an OAuth authorization callback, pass the callback's `iss`
216
+ parameter to `auth` as `callbackIssuer`:
217
+
218
+ ```typescript
219
+ import { auth } from '@ai-sdk/mcp';
220
+
221
+ const callbackUrl = new URL(request.url);
222
+
223
+ await auth(myOAuthClientProvider, {
224
+ serverUrl: 'https://mcp.example.com',
225
+ authorizationCode: callbackUrl.searchParams.get('code')!,
226
+ callbackState: callbackUrl.searchParams.get('state') ?? undefined,
227
+ callbackIssuer: callbackUrl.searchParams.get('iss') ?? undefined,
228
+ });
229
+ ```
230
+
231
+ When `iss` is present, it must exactly match the discovered authorization
232
+ server issuer. The authorization code is not exchanged when it does not match.
233
+
234
+ Dynamic client registration requests include an OAuth `application_type`. The
235
+ client infers `native` for loopback, localhost, and custom-scheme redirects,
236
+ and `web` for remote HTTP(S) redirects. You can override this by setting
237
+ `application_type` in the provider's `clientMetadata`.
238
+
206
239
  ### Retrying Transient Tool Failures
207
240
 
208
241
  MCP tool calls can fail for transient transport reasons, such as rate limits,
@@ -180,6 +180,17 @@ const result = await runCodeMode({
180
180
  `runCodeMode` returns the value returned by the program. It uses the same
181
181
  sandbox and execution limits as the AI SDK tool.
182
182
 
183
+ ## Tool Approval
184
+
185
+ Code mode does not currently integrate with AI SDK tool approval flows. Tool
186
+ calls made by generated code are nested inside the code mode invocation, so
187
+ they cannot pause the generation and surface a tool approval request to your
188
+ application.
189
+
190
+ Do not expose tools that rely on user approval to code mode. Keep those tools
191
+ directly callable by the model instead. If a nested tool requires approval,
192
+ the call is rejected rather than executed.
193
+
183
194
  ## Execution Limits
184
195
 
185
196
  Every invocation has limits for runtime, memory, source size, results, tool
@@ -244,6 +255,3 @@ to code mode.
244
255
 
245
256
  Tool input schemas are validated before their `execute` functions run. Abort
246
257
  signals and AI SDK tool execution context are forwarded to nested tool calls.
247
-
248
- Code mode does not currently support approval flows for nested tool calls.
249
- Tools that require approval are rejected instead of being executed.
@@ -466,21 +466,22 @@ try {
466
466
 
467
467
  ## Video Models
468
468
 
469
- | Provider | Model | Features |
470
- | ----------------------------------------------------------------------- | --------------------------- | ----------------------------------------------------------------------------- |
471
- | [FAL](/providers/ai-sdk-providers/fal#video-models) | `luma-dream-machine/ray-2` | Text-to-video, image-to-video |
472
- | [FAL](/providers/ai-sdk-providers/fal#video-models) | `minimax-video` | Text-to-video |
473
- | [Google](/providers/ai-sdk-providers/google#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
474
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-generate-001` | Text-to-video, audio generation |
475
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-fast-generate-001` | Text-to-video, audio generation |
476
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-generate-001` | Text-to-video, audio generation |
477
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-fast-generate-001` | Text-to-video, audio generation |
478
- | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
479
- | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-t2v` | Text-to-video |
480
- | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-i2v` | Image-to-video |
481
- | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-motion-control` | Motion control |
482
- | [Replicate](/providers/ai-sdk-providers/replicate#video-models) | `minimax/video-01` | Text-to-video |
483
- | [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video` | Text-to-video, image-to-video, editing, extension, R2V |
484
- | [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video-1.5` | Text-to-video, image-to-video, editing, extension, R2V (with reference audio) |
469
+ | Provider | Model | Features |
470
+ | ------------------------------------------------------------------------------- | --------------------------- | ------------------------------------------------------------------------------ |
471
+ | [Black Forest Labs](/providers/ai-sdk-providers/black-forest-labs#video-models) | `flux-3-video` | Text-to-video, image-to-video, keyframes, video continuation, audio generation |
472
+ | [FAL](/providers/ai-sdk-providers/fal#video-models) | `luma-dream-machine/ray-2` | Text-to-video, image-to-video |
473
+ | [FAL](/providers/ai-sdk-providers/fal#video-models) | `minimax-video` | Text-to-video |
474
+ | [Google](/providers/ai-sdk-providers/google#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
475
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-generate-001` | Text-to-video, audio generation |
476
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.1-fast-generate-001` | Text-to-video, audio generation |
477
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-generate-001` | Text-to-video, audio generation |
478
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-3.0-fast-generate-001` | Text-to-video, audio generation |
479
+ | [Google Vertex](/providers/ai-sdk-providers/google-vertex#video-models) | `veo-2.0-generate-001` | Text-to-video, up to 4 videos per call |
480
+ | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-t2v` | Text-to-video |
481
+ | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-i2v` | Image-to-video |
482
+ | [Kling AI](/providers/ai-sdk-providers/klingai#video-models) | `kling-v2.6-motion-control` | Motion control |
483
+ | [Replicate](/providers/ai-sdk-providers/replicate#video-models) | `minimax/video-01` | Text-to-video |
484
+ | [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video` | Text-to-video, image-to-video, editing, extension, R2V |
485
+ | [xAI](/providers/ai-sdk-providers/xai#video-models) | `grok-imagine-video-1.5` | Text-to-video, image-to-video, editing, extension, R2V (with reference audio) |
485
486
 
486
487
  Above are a small subset of the video models supported by the AI SDK providers. For more, see the respective provider documentation.
@@ -93,6 +93,60 @@ try {
93
93
  }
94
94
  ```
95
95
 
96
+ ## Generate Structured Output
97
+
98
+ Set `output` when constructing `HarnessAgent` to require the same typed output
99
+ on every turn. The agent converts the output specification to JSON Schema for
100
+ the harness adapter, validates the completed response, and returns the parsed
101
+ value through `result.output`.
102
+
103
+ ```ts
104
+ import { HarnessAgent } from '@ai-sdk/harness/agent';
105
+ import { Output } from 'ai';
106
+ import { z } from 'zod';
107
+
108
+ const agent = new HarnessAgent({
109
+ harness: claudeCode,
110
+ sandbox,
111
+ output: Output.object({
112
+ schema: z.object({
113
+ recipe: z.object({
114
+ name: z.string(),
115
+ ingredients: z.array(
116
+ z.object({
117
+ name: z.string(),
118
+ amount: z.number(),
119
+ unit: z.enum(['oz', 'fl oz', 'cup', 'gallon']),
120
+ }),
121
+ ),
122
+ steps: z.array(z.string()),
123
+ }),
124
+ }),
125
+ }),
126
+ });
127
+
128
+ const session = await agent.createSession();
129
+ try {
130
+ const result = await agent.generate({
131
+ session,
132
+ prompt: 'Generate a lasagna recipe.',
133
+ });
134
+ console.dir(result.output, { depth: Infinity });
135
+ } finally {
136
+ await session.destroy();
137
+ }
138
+ ```
139
+
140
+ With `stream()`, read `partialOutputStream` for incrementally parsed values and
141
+ await `result.output` for the validated final value. Structured data also remains
142
+ available as JSON in the normal text and stream surfaces; adapters do not add it
143
+ to the `finish` part.
144
+
145
+ Harness structured output requires a schema. Schema-less `Output.json()` and
146
+ adapters or runtime configurations that cannot enforce the schema throw
147
+ `HarnessCapabilityUnsupportedError`; see the
148
+ [adapter capability table](/docs/ai-sdk-harnesses/harness-adapters#adapter-capabilities).
149
+
96
150
  ## Messages and History
97
151
 
98
152
  A harness session owns its native conversation history. When you pass `messages`
@@ -366,6 +420,7 @@ console.log(preparation.identity);
366
420
  - `id`: optional stable agent identifier.
367
421
  - `instructions`: instructions appended to the runtime's system or developer
368
422
  prompt when supported, or prepended to the first user prompt otherwise.
423
+ - `output`: typed output specification applied to every turn.
369
424
  - `stopWhen`: condition(s) for finishing a result slice after a completed
370
425
  harness tool step that can continue into another model step.
371
426
  - `tools`: AI SDK tools executed by the host when the harness calls them.
@@ -30,12 +30,16 @@ The AI SDK includes the following harness adapters:
30
30
 
31
31
  ## Adapter Capabilities
32
32
 
33
- | Adapter | Runtime location | Custom tools | Custom skills | Built-in tool approval | Built-in tool filtering |
34
- | ------------------------------------------------------ | ---------------- | ------------ | ------------- | ---------------------- | ---------------------------- |
35
- | [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> |
36
- | [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> |
37
- | [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Cross /> | <Cross /> |
38
- | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
39
- | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Cross /> |
40
- | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
41
- | [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Check /> | <Check /> |
33
+ | Adapter | Runtime location | Custom tools | Custom skills | Structured output | Built-in tool approval | Built-in tool filtering |
34
+ | ------------------------------------------------------ | ---------------- | ------------ | ------------- | ----------------- | ---------------------- | ---------------------------- |
35
+ | [Claude Code](/providers/ai-sdk-harnesses/claude-code) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
36
+ | [Cline](/providers/ai-sdk-harnesses/cline) | Host process | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> |
37
+ | [Codex](/providers/ai-sdk-harnesses/codex) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Cross /> | <Cross /> |
38
+ | [Deep Agents](/providers/ai-sdk-harnesses/deepagents) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
39
+ | [Grok Build](/providers/ai-sdk-harnesses/grok-build) | Sandbox via ACP | <Check /> | <Check /> | <Check /> | <Check /> | <Cross /> |
40
+ | [OpenCode](/providers/ai-sdk-harnesses/opencode) | Sandbox bridge | <Check /> | <Check /> | <Check /> | <Check /> | <Check /> via auto-rejection |
41
+ | [Pi](/providers/ai-sdk-harnesses/pi) | Host process | <Check /> | <Check /> | <Cross /> | <Check /> | <Check /> |
42
+
43
+ Generic ACP profiles do not support structured output unless they configure an
44
+ implementation-specific prompt metadata mapping; Grok Build includes the
45
+ required mapping, while Codex ACP does not expose one.
@@ -121,14 +121,14 @@ It currently does not support accepting notifications from an MCP server, and cu
121
121
  type: 'string',
122
122
  isOptional: true,
123
123
  description:
124
- 'Initial MCP session id to send with resumed Streamable HTTP requests after initialization. Pair with initialInitializeResult when using createMCPClient. Only used by the HTTP transport.',
124
+ 'Initial legacy MCP session id to send with resumed Streamable HTTP requests after initialization. Pair with initialInitializeResult when using createMCPClient. Only used by the HTTP transport and initialization-based protocol versions.',
125
125
  },
126
126
  {
127
127
  name: 'initialProtocolVersion',
128
128
  type: 'string',
129
129
  isOptional: true,
130
130
  description:
131
- 'Initial MCP protocol version to send before initialize negotiates one. Only used by the HTTP transport.',
131
+ 'Initial legacy MCP protocol version to send before initialize negotiates one. Only used by the HTTP transport.',
132
132
  },
133
133
  {
134
134
  name: 'onSessionIdChange',
@@ -167,7 +167,7 @@ It currently does not support accepting notifications from an MCP server, and cu
167
167
  type: 'RequestOptions',
168
168
  isOptional: true,
169
169
  description:
170
- 'Optional signal and timeout settings that bound transport startup and the initialize request. A timeout or abort closes the transport and rejects createMCPClient.',
170
+ 'Optional signal and timeout settings that bound transport startup and protocol negotiation. A timeout or abort closes the transport and rejects createMCPClient.',
171
171
  },
172
172
  {
173
173
  name: 'clientName',
@@ -206,14 +206,14 @@ It currently does not support accepting notifications from an MCP server, and cu
206
206
  type: 'InitializeResult',
207
207
  isOptional: true,
208
208
  description:
209
- 'Initialize result from a previous MCP session. When provided, the client starts the transport and reuses this metadata without sending a new initialize request.',
209
+ 'Initialize result from a previous legacy MCP session. When provided, the client starts the transport and reuses this metadata without sending a new initialize request.',
210
210
  },
211
211
  {
212
212
  name: 'capabilities',
213
213
  type: 'ClientCapabilities',
214
214
  isOptional: true,
215
215
  description:
216
- 'Optional client capabilities to advertise during initialization. For example, set { elicitation: {} } to enable handling elicitation requests from the server.',
216
+ 'Optional client capabilities to advertise during legacy initialization or on each stateless modern request. For example, set { elicitation: {} } to enable handling elicitation requests from the server.',
217
217
  },
218
218
  ],
219
219
  },
@@ -232,13 +232,13 @@ Returns a Promise that resolves to an `MCPClient` with the following properties
232
232
  name: 'initializeResult',
233
233
  type: 'InitializeResult',
234
234
  description:
235
- 'The full initialize result used by this client, either from the server during initialization or from initialInitializeResult.',
235
+ 'Connection metadata used by this client. For legacy servers this is the initialize result; for modern servers an equivalent value is derived from protocol discovery.',
236
236
  },
237
237
  {
238
238
  name: 'serverInfo',
239
239
  type: 'Configuration',
240
240
  description:
241
- 'Information about the connected MCP server (name, version, optional title), as reported during the initialize handshake.',
241
+ 'Information about the connected MCP server (name, version, optional title), as reported during initialization or protocol discovery.',
242
242
  },
243
243
  {
244
244
  name: 'instructions',
@@ -404,7 +404,8 @@ To see `WorkflowAgent` in action, check out [these examples](#examples).
404
404
  name: 'maxRetries',
405
405
  type: 'number',
406
406
  isOptional: true,
407
- description: 'How many times to retry on failure. Default: 2.',
407
+ description:
408
+ 'How many times to retry retryable model-call failures. Set to 0 to disable retries. Retry-After response headers are respected, and durable workflow step retries are not stacked. Default: 2.',
408
409
  },
409
410
  {
410
411
  name: 'headers',
@@ -678,6 +679,12 @@ Returns a `Promise<WorkflowAgentStreamResult>` with the following properties:
678
679
  description:
679
680
  'Tool results from the last step. Only includes results for tools that were executed.',
680
681
  },
682
+ {
683
+ name: 'error',
684
+ type: 'unknown | undefined',
685
+ description:
686
+ "The original value from a model stream error part. The property is present when an error part was emitted, even if its value is undefined; use `'error' in result` to distinguish that case.",
687
+ },
681
688
  {
682
689
  name: 'output',
683
690
  type: 'OUTPUT',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "7.0.66",
3
+ "version": "7.0.68",
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.52",
45
+ "@ai-sdk/gateway": "4.0.54",
46
46
  "@ai-sdk/provider": "4.0.7",
47
47
  "@ai-sdk/provider-utils": "5.0.27"
48
48
  },