ai 7.0.0-canary.175 → 7.0.0

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.
Files changed (78) hide show
  1. package/CHANGELOG.md +423 -0
  2. package/dist/index.d.ts +49 -24
  3. package/dist/index.js +1373 -1089
  4. package/dist/index.js.map +1 -1
  5. package/dist/internal/index.d.ts +32 -7
  6. package/dist/internal/index.js +163 -33
  7. package/dist/internal/index.js.map +1 -1
  8. package/docs/02-foundations/06-provider-options.mdx +2 -0
  9. package/docs/02-getting-started/04-svelte.mdx +3 -3
  10. package/docs/02-getting-started/05-nuxt.mdx +4 -4
  11. package/docs/02-getting-started/06-nodejs.mdx +3 -3
  12. package/docs/02-getting-started/07-expo.mdx +2 -2
  13. package/docs/02-getting-started/08-tanstack-start.mdx +4 -4
  14. package/docs/03-agents/02-building-agents.mdx +6 -9
  15. package/docs/03-agents/06-tool-approvals.mdx +6 -6
  16. package/docs/03-agents/07-workflow-agent.mdx +45 -3
  17. package/docs/03-agents/08-terminal-ui.mdx +25 -0
  18. package/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +3 -3
  19. package/docs/03-ai-sdk-core/20-prompt-engineering.mdx +1 -1
  20. package/docs/03-ai-sdk-core/36-realtime.mdx +69 -11
  21. package/docs/03-ai-sdk-core/38-video-generation.mdx +15 -0
  22. package/docs/03-ai-sdk-core/45-provider-management.mdx +3 -3
  23. package/docs/03-ai-sdk-core/60-telemetry.mdx +41 -16
  24. package/docs/03-ai-sdk-core/65-devtools.mdx +1 -1
  25. package/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +1136 -0
  26. package/docs/03-ai-sdk-harnesses/01-overview.mdx +2 -0
  27. package/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +43 -15
  28. package/docs/03-ai-sdk-harnesses/03-tools.mdx +2 -5
  29. package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +2 -1
  30. package/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +342 -0
  31. package/docs/03-ai-sdk-harnesses/{06-ui.mdx → 07-ui.mdx} +1 -1
  32. package/docs/03-ai-sdk-harnesses/{07-terminal-ui.mdx → 08-terminal-ui.mdx} +4 -4
  33. package/docs/03-ai-sdk-harnesses/index.mdx +7 -2
  34. package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
  35. package/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +9 -9
  36. package/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +1 -1
  37. package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +1 -1
  38. package/docs/04-ai-sdk-ui/21-error-handling.mdx +2 -2
  39. package/docs/04-ai-sdk-ui/25-message-metadata.mdx +2 -2
  40. package/docs/06-advanced/02-stopping-streams.mdx +5 -5
  41. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +7 -1
  42. package/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +7 -0
  43. package/docs/07-reference/01-ai-sdk-core/23-get-realtime-tool-definitions.mdx +9 -0
  44. package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +1 -1
  45. package/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +6 -2
  46. package/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +10 -6
  47. package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +15 -1
  48. package/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +29 -0
  49. package/docs/08-migration-guides/23-migration-guide-7-0.mdx +399 -275
  50. package/docs/09-troubleshooting/13-repeated-assistant-messages.mdx +1 -1
  51. package/docs/09-troubleshooting/14-stream-abort-handling.mdx +10 -10
  52. package/package.json +6 -6
  53. package/src/agent/tool-loop-agent.ts +17 -0
  54. package/src/embed/embed.ts +95 -78
  55. package/src/generate-text/execute-tool-call.ts +121 -108
  56. package/src/generate-text/execute-tools-from-stream.ts +6 -1
  57. package/src/generate-text/generate-text.ts +797 -745
  58. package/src/generate-text/stream-language-model-call.ts +15 -10
  59. package/src/generate-text/stream-text-result.ts +8 -3
  60. package/src/generate-text/stream-text.ts +155 -104
  61. package/src/generate-video/generate-video.ts +8 -0
  62. package/src/rerank/rerank.ts +117 -104
  63. package/src/telemetry/create-telemetry-dispatcher.ts +84 -58
  64. package/src/telemetry/index.ts +4 -4
  65. package/src/telemetry/telemetry.ts +40 -14
  66. package/src/telemetry/tracing-channel-publisher.ts +220 -0
  67. package/src/telemetry/tracing-channel.ts +15 -0
  68. package/src/ui-message-stream/create-ui-message-stream.ts +11 -4
  69. package/src/ui-message-stream/handle-ui-message-stream-finish.ts +15 -8
  70. package/src/ui-message-stream/index.ts +1 -0
  71. package/src/ui-message-stream/to-ui-message-chunk.ts +3 -1
  72. package/src/ui-message-stream/to-ui-message-stream.ts +3 -2
  73. package/src/ui-message-stream/ui-message-stream-on-end-callback.ts +32 -0
  74. package/src/ui-message-stream/ui-message-stream-on-finish-callback.ts +5 -29
  75. package/src/util/fix-json.ts +30 -1
  76. package/docs/03-ai-sdk-core/65-event-listeners.mdx +0 -1437
  77. package/src/telemetry/diagnostic-channel-publisher.ts +0 -50
  78. package/src/telemetry/diagnostic-channel.ts +0 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,428 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 986c6fd: feat(ai): change type of experimental_context from unknown to generic
8
+ - b0c2869: chore(ai): remove deprecated `media` type part from `ToolResultOutput`
9
+ - 1949571: feat(ai): make experimental_telemetry stable
10
+ - 6542d93: feat(ai): change naming nomenclature for `*TelemetryIntegration` to `*Telemetry`
11
+ - 31f69de: fix(ai): carry prepareStep message overrides forward across steps
12
+ - 7c71ac6: fix(ai): limit response messages in StepResult to messages created in that step
13
+ - cf93359: feat(ai): remove/refactor event data sent via callbacks
14
+ - 776b617: feat(provider): adding new 'custom' content type
15
+ - 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
16
+ - 1f7db50: fix(ai): remove experimental_customProvider
17
+ - 3debdb7: feat(ai): rename `stepCountIs` to `isStepCount`
18
+ - fcc6869: refactor(ai/core): rename `ModelCallStreamPart` to `LanguageModelStreamPart` and align stream model call naming (`streamLanguageModelCall`, `experimental_streamLanguageModelCall`).
19
+
20
+ This updates experimental low-level stream primitives to use "language model call" terminology consistently.
21
+
22
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
23
+ - 493295c: Remove the deprecated `ToolCallOptions` export.
24
+
25
+ Use `ToolExecutionOptions` instead.
26
+
27
+ - 116c89f: feat(ai): remove telemetry data from the user-facing event data
28
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
29
+ - 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
30
+ - 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
31
+ - 4b46062: refactoring(ai): extract tool callback invocation into separate function and forward chunks before callback invocation
32
+ - 7e26e81: chore: rename experimental_context to context
33
+ - 8359612: Start v7 pre-release
34
+ - 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
35
+ - 72223e7: chore(ai): remove deprecated isToolOrDynamicToolUIPart function
36
+ - 57bf606: chore(ai): simplify unified telemetry creation
37
+ - b3c9f6a: feat(ai): create new opentelemetry package (@ai-sdk/otel)
38
+ - b9cf502: refactoring(ai): delay tool execution in stream text until model call is finished
39
+ - 5b8c58f: feat(ai): decouple otel from core functions
40
+ - 4e095b0: fix(ai): reject system messages in messages or prompt by default (opt-in)
41
+
42
+ ### Patch Changes
43
+
44
+ - e3d9c0e: Add `allowSystemInMessages` option to `ToolLoopAgent`.
45
+
46
+ This exposes the same option that exists on `streamText` and `generateText`, whether `role: "system"` messages are allowed in the `prompt` or `messages` fields. When unset, system messages are rejected because they can create a prompt injection attack risk. Ideally, use the `instructions` option instead. Set to `true` to allow system messages, or `false` to explicitly reject them.
47
+
48
+ ```ts
49
+ const agent = new ToolLoopAgent({
50
+ model,
51
+ allowSystemInMessages: true,
52
+ });
53
+
54
+ await agent.generate({
55
+ messages: [
56
+ { role: "system", content: "Server context" },
57
+ { role: "user", content: "Hello" },
58
+ ],
59
+ });
60
+ ```
61
+
62
+ The option can also be returned from `prepareCall` for dynamic per-call configuration.
63
+
64
+ - b56301c: feat(ai): decouple otel from generate/streamObject
65
+ - 2427d88: feat(ai): change Tool.sensitiveContext to telemetry.includeToolsContext and make it opt-in
66
+ - 38fc777: Add AI Gateway hint to provider READMEs
67
+ - 023550e: Deprecate `streamText` result `fullStream` in favor of `stream`.
68
+ - 38ca8dc: fix(gateway): enable retry support for gateway errors
69
+ - 19736ee: feat(ai): rename onStepFinish to onStepEnd
70
+ - 6d76710: fix URL of hero animation in README
71
+ - 5ceed7d: fix(ai): doStream should reflect transformed values
72
+ - 4757690: feat(ai): rename onObjectStepFinish to onObjectStepEnd
73
+ - bc47739: chore(ai): cleanup telemetry event data
74
+ - d1b3786: fix(ai): deprecate properties on result that have moved to finalStep
75
+ - 382d53b: refactoring: rename context to runtimeContext
76
+ - ff9ce30: feat(ai): introduce experimental callbacks for embed function
77
+ - ee798eb: chore(provider-utils): rename `Experimental_Sandbox` to `Experimental_SandboxSession`
78
+ - 4873966: chore(ai): allow general usage of `logWarnings` and emit them via Node API when available
79
+ - e67d80e: fix: rename onFinish to onEnd
80
+ - 7bf7d7f: feat(ai): enable:true for telemetry by default
81
+ - 99bf941: feat(ai): extract streamModelCall function for streaming text generation
82
+ - e95e38d: fix: Make `generateText` and `streamText` result `usage` report total usage across all steps and deprecate `totalUsage`.
83
+ - 6a3793e: chore(ai): add optional ChatRequestOptions to `addToolApprovalResponse` and `addToolOutput`
84
+ - 5f3749c: refactoring: rename toolNeedsApproval to toolApproval
85
+ - 016e877: feat(ai): add `instructions` as the primary prompt option and deprecate `system`
86
+ - 2fe1099: feat(ai): emit streaming chunks throught the onChunk callback
87
+ - f319fde: feat(ai): validate tool context against contextSchema at runtime
88
+
89
+ Tool execution and approval callbacks now validate each tool's `toolsContext` entry against its `contextSchema`. Invalid tool context now throws `TypeValidationError` with tool-context validation metadata in `error.context`.
90
+
91
+ - 31ee822: refactoring(ai): extract filterActiveTools and expose it as experimental_filterActiveTools
92
+ - b67525f: feat: instructions as prepareStep input
93
+ - e68be55: fix(ai): skip stringifying text when streaming partial text
94
+ - 1db29c8: feat(ai): break `CallSettings` apart into `LanguageModelCallOptions` and `RequestOptions`
95
+ - 0a51f7d: fix(ai): enforce `callOptionsSchema` at runtime in `ToolLoopAgent`
96
+
97
+ `ToolLoopAgentSettings.callOptionsSchema` was declared and documented as a runtime schema for `options`, but `tool-loop-agent.ts` never invoked it. Any invariant a developer encoded in the schema was silently bypassed at runtime, and unchecked `options` flowed straight into `prepareCall` and any `instructions` template that interpolated them.
98
+
99
+ `ToolLoopAgent.prepareCall` now validates caller-supplied `options` against `callOptionsSchema` (when set) via `safeValidateTypes`, throwing `InvalidArgumentError` on failure before forwarding to `prepareCall` / `generateText` / `streamText`.
100
+
101
+ - d1a8bed: fix(ui): export `isDynamicToolUIPart` from `ai` package
102
+ - bcce2dd: feat(stream-text): expose standalone stream transformation helpers and deprecate the equivalent `streamText` result methods.
103
+
104
+ The new `toUIMessageChunk` and `toUIMessageStream` helpers let you convert a `streamText` `stream` (or any compatible `ReadableStream<TextStreamPart<TOOLS>>`) into UI message chunks without going through the result object — useful for custom transports, tests, and other producers of `TextStreamPart`.
105
+
106
+ `result.toUIMessageStreamResponse(options)` and `result.pipeUIMessageStreamToResponse(response, options)` can migrate by passing `toUIMessageStream({ stream: result.stream, ...options })` to `createUIMessageStreamResponse` or `pipeUIMessageStreamToResponse`.
107
+
108
+ The new `toTextStream` helper extracts text deltas from a `streamText` `stream`, so `result.toTextStreamResponse(options)` and `result.pipeTextStreamToResponse(response, options)` can migrate to `createTextStreamResponse({ stream: toTextStream({ stream: result.stream }), ...options })` and `pipeTextStreamToResponse({ response, stream: toTextStream({ stream: result.stream }), ...options })`.
109
+
110
+ `result.toUIMessageStream`, `result.toUIMessageStreamResponse`, `result.pipeUIMessageStreamToResponse`, `result.toTextStreamResponse`, and `result.pipeTextStreamToResponse` are now `@deprecated`. They still work in v7 and will be removed in the next major release. Migration snippets are in the v6 → v7 migration guide.
111
+
112
+ - 2a74d43: Remove the deprecated `experimental_prepareStep` option from `generateText`.
113
+
114
+ Use `prepareStep` instead.
115
+
116
+ - 71d3022: fix(ai): unify generate text event callbacks
117
+ - 6cca112: feat: add timeBetweenOutputTokensMs stats
118
+ - fd4f578: fix(ai): exclude request and response bodies from text generation results by default to reduce memory usage.
119
+ - 511902c: skip validation for tool parts in terminal states when tool schema is no longer registered
120
+ - a5018ab: fix(ai): return schema-transformed elements in array output mode
121
+
122
+ Previously final array output validation checked each element against the schema but returned the raw model output. Array output now returns the validated values so Zod transforms, coercions, defaults, and pipes are applied consistently with object output.
123
+
124
+ - 531251e: fix(security): validate redirect targets in download functions to prevent SSRF bypass
125
+
126
+ Both `downloadBlob` and `download` now validate the final URL after following HTTP redirects, preventing attackers from bypassing SSRF protections via open redirects to internal/private addresses.
127
+
128
+ - eeefc3f: fix(ai): enforce `timeout.stepMs` for the whole step in `streamText`
129
+
130
+ Previously `streamText`'s step timer was cleared synchronously right after the step's stream was registered, before the stream produced anything, so `stepMs` never aborted a step that stalled before emitting content. The step timer now survives until the step's stream finishes or aborts, matching `generateText`. `chunkMs`/`totalMs` and normal step-finish cleanup are unchanged.
131
+
132
+ - ec98264: feat(ai): allow multiple integrations to be registered at once
133
+ - 43a6750: fix(ai): preserve `allowSystemInMessages` across `streamText` retries
134
+ - 67df0a0: feat: add sensitiveContext property to Tool
135
+ - b79b6a8: fix(ai): add approval guard for denied tool outputs
136
+ - 81caa5d: fix(ai): remove ExtractLiteralUnion export
137
+ - 4181cfe: fix(ai): harden `getMediaTypeFromUrl` against prototype-property collisions
138
+
139
+ `getMediaTypeFromUrl` (used to infer media types for `file-url` / `image-url` parts) used `ext in URL_EXTENSION_TO_MEDIA_TYPE` against a plain object literal. A URL ending in `.constructor` therefore resolved through the prototype chain and returned the `Object` constructor function, violating the helper's `: string` return type and forwarding a non-string value to provider adapters.
140
+
141
+ Switch to `Object.hasOwn(...)` so attacker-controlled extensions like `.constructor` cannot resolve to inherited `Object.prototype` keys.
142
+
143
+ - 208d045: fix(ai): skip global telemetry registration when local integration defined
144
+ - 5a6f514: feat(ai): support several tools in hasToolCall stop condition
145
+ - ed74dae: fix(ui): make `input` optional on `output-error` tool and dynamic-tool UI message parts
146
+
147
+ `validateUIMessages` rejected persisted assistant messages whose `output-error` tool parts had no `input` key. This happened for any errored tool call where the SDK set `input: undefined` (e.g. `NoSuchToolError` / `InvalidToolInputError`): JSON serialization stripped the `undefined` value, and Zod 4.4+ treats a missing `z.unknown()` key as a validation failure (previously it was implicitly optional). The schema now matches the runtime shape produced by `process-ui-message-stream`, so reloading a thread that contains an errored tool call no longer throws `AI_TypeValidationError`.
148
+
149
+ - ca99fea: feat: expose `finalStep` on text generation results
150
+ - 9b47dea: fix(ai): remove otel Tracer api from telemetry settings
151
+ - 877bf12: fix(ai): flatten model attributes for telemetry
152
+ - eea8d98: refactoring: rename tool execution events
153
+ - d66ae02: Return validated elements from generateText array output
154
+ - 5d0f18e: feat(ai): move opentelemetry to new package
155
+ - 21d3d60: feat(harness): implement harness specification
156
+ - 1582efa: chore(ai): remove the metadata field from the telemetry settings
157
+ - 80d4dde: fix(ai): include tool input on tool result for provider executed dynamic tools
158
+ - 98627e5: feat(ai): remove onChunk event from telemetry
159
+ - 51ce232: feat(ai): add sensitiveRuntimeContext option
160
+ - 82fc0ab: fix(ai): pass all stream text parts to `onChunk`
161
+ - 1f509d4: fix(ai): force template check on 'kind' param
162
+ - ca446f8: feat: flexible tool descriptions
163
+ - 176466a: chore(provider): align V4 model return types to have their own definitions across all model interfaces
164
+ - c0c8ca2: fix(ai): remove deprecated LanguageModelUsage properties
165
+ - 75763b0: agents: tag outgoing requests with an ai-sdk-agent user-agent segment for usage attribution (tool-loop, workflow)
166
+ - 6ec57f5: feat(ai): make the experimental lifecycle callbacks stable
167
+ - 3ae1786: fix: better context type inference
168
+ - a7de9c9: fix: make sandbox experimental
169
+ - caf1b6f: feat(ai): introduce experimental callbacks for rerank function
170
+ - 9f0e36c: trigger release for all packages after provenance setup
171
+ - befb78c: refactoring: remove real-time delays in unit tests
172
+ - 6866afe: fix(ai): fix `lastAssistantMessageIsCompleteWithApprovalResponses` to no longer ignore `providerExecuted` tool approvals
173
+ - 29d8cf4: feat(ai): rename the core-event types
174
+ - 2e17091: fix(types): move shared tool set utility types into provider-utils
175
+
176
+ Moved `ToolSet`, `InferToolSetContext`, and `UnionToIntersection` into `@ai-sdk/provider-utils` and updated `ai` internals to import them directly from there. This keeps the shared tool typing utilities colocated with the core tool type definitions.
177
+
178
+ - 210ed3d: feat(ai): pass result provider metadata across the stream
179
+ - a3fd75b: feat(ai): expose Experimental_ModelCallStreamPart type
180
+ - f4cc8eb: feat: add performance statistics
181
+ - 2add429: fix(ai): skip passing invalid JSON inputs to response messages
182
+ - 5588abd: feat(ai): add experimental_refineToolInput option to ToolLoopAgent, generateText, streamText
183
+ - e80ada0: fix(ai): download tool-result file URLs
184
+ - 58a2ad7: fix: more precise default message for tool execution denial
185
+ - 62d6481: Post-publish release notifications now link to each package’s GitHub release and npm page.
186
+ - 1fe058b: fix(anthropic): preserve the error code returned by model
187
+ - 5c4d910: feat(ai): add new `isLoopFinished` stop condition helper for unlimited steps
188
+ - e4182bd: chore: rm export of OutputInterface
189
+ - 34fd051: feat(ai): add toolMs to timeout configuration
190
+ - 72cb801: feat(ai): concurrent event notification
191
+ - 2e98477: fix: retain stack traces on async errors
192
+ - add1126: refactoring: executeTool uses tool as parameter
193
+ - 81a284b: fix(ai): handle partial unicode escapes in fixJson
194
+ - 76fd58c: fix: consider file outputs and tool calls for time to first output
195
+ - 7392266: feat: move includeRawChunks to include.rawChunks
196
+ - 69aeb0e: feat: add deprecated tool call lifecycle callback aliases for AI SDK 6 compatibility.
197
+ - 37d69b2: feat(ai): access runtime context in tool approval functions
198
+ - 1043274: feat(ai): add a ModelCall start/end event
199
+ - 350ea38: refactoring: introduce Arrayable type
200
+ - 7f59f04: feat(ai): add approval reason to automatic tool approvals
201
+ - 7677c1e: feat(ai): allow tool approval functions to return undefined
202
+ - 476e1ca: feat(ai): remove telemetry dependency on onChunk callback
203
+ - 008271d: feat(openai-compatible): emit warning when using kebab-case instead of camelCase
204
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
205
+ - 594029e: feat(ai): wrap the model call in telemetry context
206
+ - 426dbbb: fix(ai): reject `streamText` result promises with `NoOutputGeneratedError` when the model stream ends without producing any output. Previously such streams resolved with an empty step. Incomplete streams with partial output still resolve with the partial result.
207
+ - 25a64f8: Remove deprecated experimental generateImage exports.
208
+ - 75ef93e: remove the deprecated `experimental_output` alias and document the `output` migration for AI SDK 7
209
+ - c26ca8d: Remove custom User-Agent header from HttpChatTransport to fix CORS preflight failures in Safari and Firefox
210
+ - eaf849f: Rename rerank telemetry finish callback to `onRerankEnd`.
211
+ - 664a0eb: feat (ai/core): support plain string model IDs in `rerank()` function
212
+
213
+ The `rerank()` function now accepts plain model strings (e.g., `'cohere/rerank-v3.5'`) in addition to `RerankingModel` objects, matching the behavior of `generateText`, `embed`, and other core functions.
214
+
215
+ - 08d2129: feat(mcp): propagate the server name through dynamic tool parts
216
+ - 5faf71c: feat: introduce responseMessages on GenerateTextResult and StreamTextResult
217
+ - 0c4c275: trigger initial canary release
218
+ - 118b953: feat(ai): decouple otel from embed functions
219
+ - 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
220
+ - 1dca341: fix: rename telemetry onFinish to onEnd
221
+ - ebd4da2: feat(ai): add missing usage attributes
222
+ - bc67b4f: feat(ai): add experimental callbacks for structured outputs
223
+ - f0b0b20: feat(ai): add per-tool timeout overrides via toolTimeouts
224
+ - 2852a84: fix(ai): make input optional on input-streaming UIMessagePart variants
225
+ - 2a9c144: feat(ai): add toolNeedsApproval option
226
+ - ce769dd: feat(provider): add experimental Realtime API support for voice conversations
227
+
228
+ Adds first-class support for realtime (speech-to-speech) APIs:
229
+
230
+ - `Experimental_RealtimeModelV4` spec in `@ai-sdk/provider` with normalized event types and factory
231
+ - OpenAI, Google, and xAI realtime provider implementations
232
+ - `openai.experimental_realtime()` / `google.experimental_realtime()` / `xai.experimental_realtime()` work in both server and browser
233
+ - `.getToken()` static method on each provider for server-side ephemeral token creation
234
+ - `experimental_getRealtimeToolDefinitions` helper for provider session tool definitions
235
+ - `experimental_useRealtime` hook in `@ai-sdk/react` returning `UIMessage[]` (aligned with `useChat`), with `onToolCall` and `addToolOutput` for client-driven tool execution
236
+ - `inputAudioTranscription` session config for showing transcribed user audio messages when supported by the provider
237
+
238
+ - e3a0419: fix(ai): default missing embedding warnings to an empty array
239
+ - f04adcb: feat(ai): refresh `customProvider` and `createProviderRegistry` to support file and skill upload abstractions
240
+ - 876fd3e: fix(ai): limit tool execution time duration to actual tool execution
241
+ - e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
242
+ - 989d3d2: fix(ai): include generated files in OTEL response attributes
243
+ - b5092f5: fix(ai): do not re-validate tool input for output-error parts in validateUIMessages
244
+ - 6dd6b83: feat(ai): change sensitiveRuntimeContext to telemetry.includeRuntimeContext and make it opt-in
245
+ - 69254e0: feat(ai): add toolMetadata for tool specific metdata
246
+ - 79b2468: feat: add request.messages to StepResult
247
+ - 6c93e36: feat(provider-utils): add `spawnCommand` method to `Experimental_Sandbox` to allow for detached command execution
248
+ - 2605e5f: fix test mocks to return the first array-backed result on the first call
249
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
250
+ - f58f9bc: fix(ai): remove stopWhen from onStart event
251
+ - 8565dcb: fix: rename onEmbedFinish to onEmbedEnd
252
+ - 6abd098: split `prepareToolsAndToolChoice()` into `prepareTools()` and `prepareToolChoice()`
253
+ - e1bfb9c: feat(ai): remove unnecessary data from events
254
+ - 375fdd7: fix: harden download URL SSRF guard against hostname and redirect bypasses
255
+
256
+ `validateDownloadUrl` and the file download helpers (`downloadBlob`, `download`) could be bypassed in several ways when handling untrusted URLs:
257
+
258
+ - A fully-qualified hostname with a trailing dot (e.g. `localhost.`, `myhost.local.`) skipped the localhost/`.local` blocklist.
259
+ - IPv6 addresses that embed an IPv4 address in their last 32 bits — IPv4-compatible (`::127.0.0.1`), IPv4-translated (`::ffff:0:127.0.0.1`), and NAT64 (`64:ff9b::127.0.0.1`, including the `64:ff9b:1::/48` local-use prefix) — were not decoded and checked against the private IPv4 ranges.
260
+ - Redirects were validated only _after_ `fetch` had already followed them, so the request to a redirect target (e.g. an internal/metadata address) had already been issued before the check ran.
261
+ - Several reserved/internal address ranges were not blocked: CGNAT (`100.64.0.0/10`, used by some cloud providers for internal traffic), benchmarking (`198.18.0.0/15`), IETF protocol assignments (`192.0.0.0/24`), the reserved `240.0.0.0/4` block (including the `255.255.255.255` broadcast address), and IPv6 site-local (`fec0::/10`) and multicast (`ff00::/8`).
262
+
263
+ The validator now strips trailing dots before the hostname checks and fully expands IPv6 addresses to detect embedded private IPv4 targets. The download helpers now follow redirects manually (`redirect: 'manual'`), re-validating each hop before requesting it, so an unsafe redirect target is never fetched. When a redirect cannot be inspected because the runtime returns an opaque response, the helpers fail closed (reject the redirect) on the server; only in a real browser — where SSRF is not reachable (fetch is constrained by CORS and cannot reach a server's internal network or cloud-metadata endpoints) — is the redirect followed natively so legitimate redirected downloads keep working.
264
+
265
+ - 89ad56f: Promote `generateSpeech` and `SpeechResult` to stable exports.
266
+ - f9a496f: Promote `transcribe` and `TranscriptionResult` to stable exports, with deprecated experimental aliases for backwards compatibility.
267
+ - 334ae5d: Update step performance metrics with explicit effective, input, output, and total token throughput fields.
268
+ - 3295831: Harden stream text processing and middleware against prototype pollution from stream part IDs.
269
+ - b097c52: feat(ai): use tracing channels to track parent-child context
270
+ - e79e644: chore(ai/core): remove `timeout` from `CallSettings` as it was effectively unused there
271
+ - 3015fc3: feat: sandbox shell execution abstraction
272
+ - b8396f0: trigger initial beta release
273
+ - 48e92f3: feat: make include stable
274
+ - 33d099c: fix(ai): omit reasoning-start/end when sendReasoning is false
275
+ - e87d71b: feat(ai): support automatic tool approval in ui messages
276
+ - a6617c5: feat(provider-utils): add `readFile` and `writeFile` plus convenience wrappers to `Experimental_Sandbox` abstraction
277
+ - eee1166: feat(ai): expose initial and response messages in prepareStep
278
+ - 9d486aa: feat(ai): generic tool approval function
279
+ - c3d4019: chore(ai): rename 'TelemetrySettings' to 'TelemetryOptions'
280
+ - 28dfa06: fix: support tools with optional context
281
+ - bcacd48: fix(ai): accumulative properties on StreamTextResult, GenerateTextResult
282
+ - e92fc45: feat(ai): introduce onAbort hook to close telemetry spans
283
+ - 083947b: feat(ai): separate toolsContext from context
284
+ - 47e65d6: fix(ai): tag step/chunk timeout aborts with `TimeoutError` reason
285
+
286
+ When `timeout: { stepMs }` or `timeout: { chunkMs }` fires, the abort reason is now a `TimeoutError` `DOMException`, matching what `AbortSignal.timeout()` produces natively. Consumers can distinguish a framework timeout from a user-initiated cancel via `signal.reason.name === 'TimeoutError'`.
287
+
288
+ - 6a2caf9: Serialize `undefined` tool output to `null` in UI message chunks
289
+ - 202f107: feat(ai): create a diagnostics channel to push event data
290
+ - bae5e2b: fix(security): re-validate tool approvals from client message history before execution
291
+
292
+ The approval-replay path in `generateText`/`streamText` (and `WorkflowAgent.stream`) reconstructed approved tool calls from the client-supplied messages array and executed them without re-validating input against the tool's schema or re-applying the approval policy. A client could forge an assistant message with a pre-approved tool-call part and have the server execute a tool with attacker-chosen arguments.
293
+
294
+ The replay path now validates HMAC signature (when `experimental_toolApprovalSecret` is configured), re-validates tool-call input against the tool's input schema, and re-resolves the approval policy before execution.
295
+
296
+ - c907622: Add a `toolOrder` option to control the order in which tools are sent to provider APIs.
297
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
298
+ - c4f4b5f: refactoring(ai): remove deprecated experimental_activeTools option
299
+ - f4cfccd: feat(ai): decouple otel from rerank function
300
+ - f5a6f89: README updates
301
+ - f18b08f: fix: redact server error details from UI message streams by default
302
+
303
+ `toUIMessageStream`, `createUIMessageStream`, and `toUIMessageChunk` defaulted their `onError` callback to `getErrorMessage`, which serializes the raw error (`error.toString()` / `JSON.stringify(error)`) into the client-facing `{ type: 'error', errorText }` chunk — and also into `tool-output-error` parts. The documented default was `() => 'An error occurred.'`, so applications relying on the documented behavior were unknowingly streaming server exception details (internal hostnames, paths, provider request data, validation inputs) to end users.
304
+
305
+ The default `onError` now returns the documented generic `'An error occurred.'`. Raw error details are only emitted when the developer explicitly supplies an `onError` handler. This also redacts `tool-output-error` and invalid-tool-input error text by default; pass an `onError` to surface richer messages.
306
+
307
+ - 7fd3360: Harden UI message stream processing against prototype pollution from chunk IDs.
308
+ - 0416e3e: feat (video): add first-class `generateAudio` call option
309
+ - d775a57: feat: introduce Instructions type
310
+ - b4507d5: fix(provider-utils): cancel response body on download rejection to prevent socket leak
311
+
312
+ When a download was rejected early — because the `Content-Length` header exceeded the size limit, the response status was not ok, or a redirect resolved to a blocked URL — the fetch response body was left unconsumed and uncancelled. With WHATWG Fetch/undici this leaves the underlying TCP socket open instead of returning it to the connection pool, allowing an attacker-controlled origin to exhaust file descriptors and cause a denial of service. The body is now cancelled on all early-rejection paths in `readResponseWithSizeLimit`, `download`, and `downloadBlob`, and `fetchWithValidatedRedirects` cancels each redirect hop's body before following or rejecting the next hop.
313
+
314
+ - 6147cdf: fix(ai): fix auto-complete on provider registry and custom provider
315
+ - e93fa91: rename Sandbox.executeCommand to Sandbox.runCommand
316
+ - f32c750: refactoring(ai): simplify mergeAbortSignals
317
+ - 7dbf992: feat(ai): allow prepareStep to override sandbox per step
318
+ - 9b0bc8a: fix(mcp): prevent prototype pollution by using secureJsonParse
319
+ - 4bb4dbc: feat: introduce include.requestMessage option for step request message storage opt-in
320
+ - c22750c: fix(ai): move onToolExecutionStart and onToolExecutionEnd to stable
321
+ - 538c12b: feat: use instructions on ToolCallRepairFunction, parseToolCall, and events
322
+ - fc92055: feat(ai): automatic tool approval
323
+ - f372547: fix(ai): fix `providerExecuted` tool approvals being passed to language model twice
324
+ - 1e4b350: Honor `tool.toModelOutput` in `WorkflowAgent`.
325
+
326
+ `WorkflowAgent` now routes successful local, provider-executed, and approved tool results through each tool's optional `toModelOutput` hook, matching `generateText`, `streamText`, and `ToolLoopAgent`. Previously the hook was ignored and results were always serialized as `text` or `json`.
327
+
328
+ Internally exports the shared tool-result model-output helpers from `ai/internal`, and uses the shared `getErrorMessage` behavior for workflow tool error results.
329
+
330
+ - 69d7128: fix(workflow): reuse the core tool-approval validation in WorkflowAgent
331
+
332
+ `WorkflowAgent.stream` previously reconstructed approved tool calls with a copy of the core collection logic and validated them inline. Because the logic was duplicated, it could drift from the hardened `generateText`/`streamText` implementation. WorkflowAgent now collects approvals via the shared `collectToolApprovals` and re-validates each one through the shared `validateApprovedToolApprovals` (input-schema re-validation, HMAC signature verification when configured, and approval-policy re-resolution) in addition to its existing `needsApproval` guard, so a client-forged approval cannot execute a tool with unvalidated input. The duplicated collector was removed; `collectToolApprovals` and `validateApprovedToolApprovals` are now exported from `ai/internal`.
333
+
334
+ - ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
335
+ - cc6ab90: feat(ai): rename ui message stream onFinish to onEnd
336
+ - e27ed76: feat(devtools): add new devtools integration for telemetry
337
+
338
+ ## 7.0.0-beta.187
339
+
340
+ ### Patch Changes
341
+
342
+ - Updated dependencies [77cc1af]
343
+ - @ai-sdk/gateway@4.0.0-beta.114
344
+
345
+ ## 7.0.0-beta.186
346
+
347
+ ### Patch Changes
348
+
349
+ - Updated dependencies [eb024b6]
350
+ - @ai-sdk/gateway@4.0.0-beta.113
351
+
352
+ ## 7.0.0-beta.185
353
+
354
+ ### Patch Changes
355
+
356
+ - 75763b0: agents: tag outgoing requests with an ai-sdk-agent user-agent segment for usage attribution (tool-loop, workflow)
357
+
358
+ ## 7.0.0-beta.184
359
+
360
+ ### Patch Changes
361
+
362
+ - 0416e3e: feat (video): add first-class `generateAudio` call option
363
+ - Updated dependencies [a403276]
364
+ - Updated dependencies [0416e3e]
365
+ - @ai-sdk/gateway@4.0.0-beta.112
366
+ - @ai-sdk/provider@4.0.0-beta.20
367
+ - @ai-sdk/provider-utils@5.0.0-beta.50
368
+
369
+ ## 7.0.0-beta.183
370
+
371
+ ### Patch Changes
372
+
373
+ - Updated dependencies [8e990ff]
374
+ - @ai-sdk/gateway@4.0.0-beta.111
375
+
376
+ ## 7.0.0-beta.182
377
+
378
+ ### Patch Changes
379
+
380
+ - cc6ab90: feat(ai): rename ui message stream onFinish to onEnd
381
+
382
+ ## 7.0.0-beta.181
383
+
384
+ ### Patch Changes
385
+
386
+ - 6a2caf9: Serialize `undefined` tool output to `null` in UI message chunks
387
+
388
+ ## 7.0.0-beta.180
389
+
390
+ ### Patch Changes
391
+
392
+ - 81a284b: fix(ai): handle partial unicode escapes in fixJson
393
+
394
+ ## 7.0.0-beta.179
395
+
396
+ ### Patch Changes
397
+
398
+ - Updated dependencies [987d9e4]
399
+ - @ai-sdk/gateway@4.0.0-beta.110
400
+
401
+ ## 7.0.0-beta.178
402
+
403
+ ### Patch Changes
404
+
405
+ - b097c52: feat(ai): use tracing channels to track parent-child context
406
+ - Updated dependencies [15eb253]
407
+ - @ai-sdk/gateway@4.0.0-beta.109
408
+
409
+ ## 7.0.0-beta.177
410
+
411
+ ### Patch Changes
412
+
413
+ - b8396f0: trigger initial beta release
414
+ - Updated dependencies [b8396f0]
415
+ - @ai-sdk/gateway@4.0.0-beta.108
416
+ - @ai-sdk/provider-utils@5.0.0-beta.49
417
+ - @ai-sdk/provider@4.0.0-beta.19
418
+
419
+ ## 7.0.0-canary.176
420
+
421
+ ### Patch Changes
422
+
423
+ - Updated dependencies [d5b8263]
424
+ - @ai-sdk/gateway@4.0.0-canary.107
425
+
3
426
  ## 7.0.0-canary.175
4
427
 
5
428
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -2542,7 +2542,7 @@ type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIDataTypes = UIDataT
2542
2542
  };
2543
2543
  type InferUIMessageChunk<T extends UIMessage> = UIMessageChunk<InferUIMessageMetadata<T>, InferUIMessageData<T>>;
2544
2544
 
2545
- type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage> = (event: {
2545
+ type UIMessageStreamOnEndCallback<UI_MESSAGE extends UIMessage> = (event: {
2546
2546
  /**
2547
2547
  * The updated list of UI messages.
2548
2548
  */
@@ -2633,9 +2633,13 @@ type UIMessageStreamOptions<UI_MESSAGE extends UIMessage> = {
2633
2633
  * the original messages are provided and the last message is an assistant message).
2634
2634
  */
2635
2635
  generateMessageId?: IdGenerator;
2636
- onFinish?: UIMessageStreamOnFinishCallback<UI_MESSAGE>;
2636
+ onEnd?: UIMessageStreamOnEndCallback<UI_MESSAGE>;
2637
2637
  /**
2638
- * Extracts message metadata that will be send to the client.
2638
+ * @deprecated Use `onEnd` instead.
2639
+ */
2640
+ onFinish?: UIMessageStreamOnEndCallback<UI_MESSAGE>;
2641
+ /**
2642
+ * Extracts message metadata that will be sent to the client.
2639
2643
  *
2640
2644
  * Called on `start` and `finish` events.
2641
2645
  */
@@ -4263,6 +4267,13 @@ type RerankingModelCallEndEvent = {
4263
4267
  }>;
4264
4268
  };
4265
4269
 
4270
+ declare const AI_SDK_TELEMETRY_TRACING_CHANNEL = "ai:telemetry";
4271
+ type TelemetryTracingEventType = 'generateText' | 'streamText' | 'step' | 'languageModelCall' | 'executeTool' | 'embed' | 'rerank';
4272
+ type TelemetryTracingChannelMessage<EVENT = unknown> = {
4273
+ readonly type: TelemetryTracingEventType;
4274
+ readonly event: EVENT;
4275
+ };
4276
+
4266
4277
  type InferTelemetryEvent<EVENT> = EVENT & Omit<TelemetryOptions, 'integrations' | 'isEnabled' | 'includeRuntimeContext'>;
4267
4278
  type OperationStartEvent = GenerateTextStartEvent | GenerateObjectStartEvent | EmbedStartEvent | RerankStartEvent;
4268
4279
  type OperationEndEvent = GenerateTextEndEvent<ToolSet> | GenerateObjectEndEvent<unknown> | EmbedEndEvent | RerankEndEvent;
@@ -4387,10 +4398,11 @@ interface Telemetry {
4387
4398
  * auto-instrumented model provider requests to become children of the current
4388
4399
  * model-call span.
4389
4400
  *
4390
- * @param options.callId - The call ID of the generation.
4391
- * @param options.execute - The function that performs the model call.
4401
+ * The options carry the model-call start-event content as context (the event
4402
+ * fields are optional), alongside the always-present `callId` and the
4403
+ * `execute` function that performs the model call.
4392
4404
  */
4393
- executeLanguageModelCall?: <T>(options: {
4405
+ executeLanguageModelCall?: <T>(options: Partial<InferTelemetryEvent<LanguageModelCallStartEvent>> & {
4394
4406
  callId: string;
4395
4407
  execute: () => PromiseLike<T>;
4396
4408
  }) => PromiseLike<T>;
@@ -4399,11 +4411,11 @@ interface Telemetry {
4399
4411
  * nested traces — e.g. when a tool's `execute` function calls `generateText`,
4400
4412
  * the inner call's spans become children of the tool span.
4401
4413
  *
4402
- * @param options.callId - The call ID of the tool call.
4403
- * @param options.toolCallId - The tool call ID.
4404
- * @param options.execute - The function to execute.
4414
+ * The options carry the tool-execution start-event content as context (the
4415
+ * event fields are optional), alongside the always-present `callId`,
4416
+ * `toolCallId`, and the `execute` function to run.
4405
4417
  */
4406
- executeTool?: <T>(options: {
4418
+ executeTool?: <T>(options: Partial<InferTelemetryEvent<ToolExecutionStartEvent>> & {
4407
4419
  callId: string;
4408
4420
  toolCallId: string;
4409
4421
  execute: () => PromiseLike<T>;
@@ -5209,6 +5221,12 @@ declare class ToolLoopAgent<CALL_OPTIONS = never, TOOLS extends ToolSet = {}, RU
5209
5221
  */
5210
5222
  get tools(): TOOLS;
5211
5223
  private prepareCall;
5224
+ /**
5225
+ * Tags outgoing requests so usage can be attributed to ToolLoopAgent. Chains
5226
+ * with the `ai/<version>` and `ai-sdk/<provider>/<version>` suffixes added
5227
+ * downstream by generateText/streamText and the provider.
5228
+ */
5229
+ private agentHeaders;
5212
5230
  /**
5213
5231
  * Generates an output from the agent (non-streaming).
5214
5232
  */
@@ -5944,13 +5962,14 @@ interface UIMessageStreamWriter<UI_MESSAGE extends UIMessage = UIMessage> {
5944
5962
  * and a message ID is provided for the response message.
5945
5963
  * @param options.onStepEnd - A callback that is called when each step ends. Useful for persisting intermediate messages.
5946
5964
  * @param options.onStepFinish - Deprecated alias for `onStepEnd`.
5947
- * @param options.onFinish - A callback that is called when the stream finishes.
5965
+ * @param options.onEnd - A callback that is called when the stream ends.
5966
+ * @param options.onFinish - Deprecated alias for `onEnd`.
5948
5967
  * @param options.generateId - A function that generates a unique ID. Defaults to the built-in ID generator.
5949
5968
  *
5950
5969
  * @returns A `ReadableStream` of UI message chunks.
5951
5970
  */
5952
5971
  declare function createUIMessageStream<UI_MESSAGE extends UIMessage>({ execute, onError, // prevent leaking server error details to the client by default
5953
- originalMessages, onStepEnd, onStepFinish, onFinish, generateId, }: {
5972
+ originalMessages, onStepEnd, onStepFinish, onEnd, onFinish, generateId, }: {
5954
5973
  execute: (options: {
5955
5974
  writer: UIMessageStreamWriter<UI_MESSAGE>;
5956
5975
  }) => Promise<void> | void;
@@ -5970,7 +5989,11 @@ originalMessages, onStepEnd, onStepFinish, onFinish, generateId, }: {
5970
5989
  * @deprecated Use `onStepEnd` instead.
5971
5990
  */
5972
5991
  onStepFinish?: UIMessageStreamOnStepFinishCallback<UI_MESSAGE>;
5973
- onFinish?: UIMessageStreamOnFinishCallback<UI_MESSAGE>;
5992
+ onEnd?: UIMessageStreamOnEndCallback<UI_MESSAGE>;
5993
+ /**
5994
+ * @deprecated Use `onEnd` instead.
5995
+ */
5996
+ onFinish?: UIMessageStreamOnEndCallback<UI_MESSAGE>;
5974
5997
  generateId?: IdGenerator;
5975
5998
  }): ReadableStream<InferUIMessageChunk<UI_MESSAGE>>;
5976
5999
 
@@ -6056,10 +6079,10 @@ messageMetadata, responseMessageId, }?: ToUIMessageChunkOptions<TOOLS, UI_MESSAG
6056
6079
  * Converts a stream of `TextStreamPart<TOOLS>` chunks (as emitted by
6057
6080
  * `streamText`'s `stream`) into a stream of `UIMessageChunk`s suitable for
6058
6081
  * UI message streaming, including response message ID injection and
6059
- * `onFinish` handling.
6082
+ * `onEnd` handling.
6060
6083
  */
6061
6084
  declare function toUIMessageStream<TOOLS extends ToolSet = ToolSet, UI_MESSAGE extends UIMessage = UIMessage>({ stream, tools, sendReasoning, sendSources, sendStart, sendFinish, onError, // prevent leaking server error details to the client by default
6062
- messageMetadata, originalMessages, generateMessageId, onFinish, }: {
6085
+ messageMetadata, originalMessages, generateMessageId, onEnd, onFinish, }: {
6063
6086
  stream: ReadableStream<TextStreamPart<TOOLS>>;
6064
6087
  tools?: TOOLS;
6065
6088
  } & UIMessageStreamOptions<UI_MESSAGE>): ReadableStream<InferUIMessageChunk<UI_MESSAGE>>;
@@ -6072,6 +6095,11 @@ declare const UI_MESSAGE_STREAM_HEADERS: {
6072
6095
  'x-accel-buffering': string;
6073
6096
  };
6074
6097
 
6098
+ /**
6099
+ * @deprecated Use `UIMessageStreamOnEndCallback` instead.
6100
+ */
6101
+ type UIMessageStreamOnFinishCallback<UI_MESSAGE extends UIMessage> = UIMessageStreamOnEndCallback<UI_MESSAGE>;
6102
+
6075
6103
  /**
6076
6104
  * Runs the agent and stream the output as a UI message stream.
6077
6105
  *
@@ -7839,7 +7867,7 @@ type GenerateVideoPrompt = string | {
7839
7867
  image: DataContent;
7840
7868
  text?: string;
7841
7869
  };
7842
- declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
7870
+ declare function experimental_generateVideo({ model: modelArg, prompt: promptArg, n, maxVideosPerCall, aspectRatio, resolution, duration, fps, seed, generateAudio, providerOptions, maxRetries: maxRetriesArg, abortSignal, headers, download: downloadFn, }: {
7843
7871
  /**
7844
7872
  * The video model to use.
7845
7873
  */
@@ -7876,6 +7904,10 @@ declare function experimental_generateVideo({ model: modelArg, prompt: promptArg
7876
7904
  * Seed for the video generation.
7877
7905
  */
7878
7906
  seed?: number;
7907
+ /**
7908
+ * Whether the model should generate audio alongside the video.
7909
+ */
7910
+ generateAudio?: boolean;
7879
7911
  /**
7880
7912
  * Additional provider-specific options that are passed through to the provider
7881
7913
  * as body parameters.
@@ -8518,13 +8550,6 @@ declare function rerank<VALUE extends JSONObject | string>({ model: modelArg, do
8518
8550
  */
8519
8551
  declare function registerTelemetry(...integrations: Telemetry[]): void;
8520
8552
 
8521
- declare const AI_SDK_TELEMETRY_DIAGNOSTIC_CHANNEL = "aisdk:telemetry";
8522
- type TelemetryDiagnosticEventType = 'onStart' | 'onStepStart' | 'onLanguageModelCallStart' | 'onLanguageModelCallEnd' | 'onToolExecutionStart' | 'onToolExecutionEnd' | 'onStepEnd' | 'onStepFinish' | 'onObjectStepStart' | 'onObjectStepEnd' | 'onEmbedStart' | 'onEmbedEnd' | 'onRerankStart' | 'onRerankEnd' | 'onEnd' | 'onAbort' | 'onError';
8523
- type TelemetryDiagnosticChannelMessage<EVENT = unknown> = {
8524
- readonly type: TelemetryDiagnosticEventType;
8525
- readonly event: EVENT;
8526
- };
8527
-
8528
8553
  /**
8529
8554
  * Creates a Response object from a text stream.
8530
8555
  * Each text chunk is encoded as UTF-8 and sent as a separate chunk.
@@ -8737,4 +8762,4 @@ declare function uploadSkill({ api, files, displayTitle, providerOptions, }: {
8737
8762
  files: UploadSkillFile[];
8738
8763
  }): Promise<UploadSkillResult>;
8739
8764
 
8740
- export { AI_SDK_TELEMETRY_DIAGNOSTIC_CHANNEL, AbstractChat, ActiveTools, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, Experimental_SpeechResult, Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, Telemetry, TelemetryDiagnosticChannelMessage, TelemetryDiagnosticEventType, TelemetryOptions, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, ToolApprovalConfiguration, ToolApprovalRequestOutput, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolExecutionEndEvent, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolOrder, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, resampleAudio as experimental_resampleAudio, streamLanguageModelCall as experimental_streamLanguageModelCall, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };
8765
+ export { AI_SDK_TELEMETRY_TRACING_CHANNEL, AbstractChat, ActiveTools, Agent, AgentCallParameters, AgentStreamParameters, AsyncIterableStream, CallSettings, CallWarning, ChatAddToolApproveResponseFunction, ChatAddToolOutputFunction, ChatInit, ChatOnDataCallback, ChatOnErrorCallback, ChatOnFinishCallback, ChatOnToolCallCallback, ChatRequestOptions, ChatState, ChatStatus, ChatTransport, ChunkDetector, CompletionRequestOptions, ContentPart, CreateUIMessage, CustomContentUIPart, DataUIPart, DeepPartial, DefaultChatTransport, DefaultGeneratedFile, DirectChatTransport, DirectChatTransportOptions, DynamicToolCall, DynamicToolError, DynamicToolResult, DynamicToolUIPart, EmbedEndEvent, EmbedManyResult, EmbedResult, EmbedStartEvent, Embedding, EmbeddingModel, EmbeddingModelCallEndEvent, EmbeddingModelCallStartEvent, EmbeddingModelMiddleware, EmbeddingModelUsage, ErrorHandler, AbstractRealtimeSession as Experimental_AbstractRealtimeSession, ToolLoopAgent as Experimental_Agent, ToolLoopAgentSettings as Experimental_AgentSettings, DownloadFunction as Experimental_DownloadFunction, GeneratedFile as Experimental_GeneratedImage, InferAgentUIMessage as Experimental_InferAgentUIMessage, LanguageModelStreamPart as Experimental_LanguageModelStreamPart, LogWarningsFunction as Experimental_LogWarningsFunction, RealtimeClientEvent as Experimental_RealtimeClientEvent, RealtimeFactory as Experimental_RealtimeFactory, RealtimeFactoryGetTokenOptions as Experimental_RealtimeFactoryGetTokenOptions, RealtimeFactoryGetTokenResult as Experimental_RealtimeFactoryGetTokenResult, RealtimeModel as Experimental_RealtimeModel, RealtimeServerEvent as Experimental_RealtimeServerEvent, RealtimeSessionConfig as Experimental_RealtimeSessionConfig, RealtimeSessionOptions as Experimental_RealtimeSessionOptions, RealtimeSetupResponse as Experimental_RealtimeSetupResponse, RealtimeState as Experimental_RealtimeState, RealtimeStatus as Experimental_RealtimeStatus, RealtimeToolDefinition as Experimental_RealtimeToolDefinition, Experimental_SpeechResult, Experimental_TranscriptionResult, FileUIPart, FinishReason, GenerateImageResult, GenerateObjectEndEvent, GenerateObjectResult, GenerateObjectStartEvent, GenerateObjectStepEndEvent, GenerateObjectStepStartEvent, GenerateTextAbortEvent, GenerateTextEndEvent, GenerateTextInclude, GenerateTextOnAbortCallback, GenerateTextOnEndCallback, GenerateTextOnFinishCallback, GenerateTextOnStartCallback, GenerateTextOnStepEndCallback, GenerateTextOnStepFinishCallback, GenerateTextOnStepStartCallback, GenerateTextResult, GenerateTextStartEvent, GenerateTextStepEndEvent, GenerateTextStepStartEvent, GenerateVideoPrompt, GenerateVideoResult, GeneratedAudioFile, GeneratedFile, GenericToolApprovalFunction, HttpChatTransport, HttpChatTransportInitOptions, ImageModel, ImageModelMiddleware, ImageModelProviderMetadata, ImageModelResponseMetadata, ImageModelUsage, InferAgentUIMessage, InferCompleteOutput as InferGenerateOutput, InferPartialOutput as InferStreamOutput, InferTelemetryEvent, InferUIDataParts, InferUIMessageChunk, InferUITool, InferUITools, Instructions, InvalidArgumentError, InvalidDataContentError, InvalidMessageRoleError, InvalidStreamPartError, InvalidToolApprovalError, InvalidToolApprovalSignatureError, InvalidToolInputError, JSONValue, JsonToSseTransformStream, LanguageModel, LanguageModelCallEndEvent, LanguageModelCallOptions, LanguageModelCallStartEvent, LanguageModelMiddleware, LanguageModelRequestMetadata, LanguageModelResponseMetadata, LanguageModelUsage, LogWarningsFunction, MessageConversionError, MissingToolResultsError, ModelInfo, NoImageGeneratedError, NoObjectGeneratedError, NoOutputGeneratedError, NoSpeechGeneratedError, NoSuchProviderError, NoSuchToolError, NoTranscriptGeneratedError, NoVideoGeneratedError, ObjectStreamPart, OnFinishEvent, OnLanguageModelCallEndCallback, OnLanguageModelCallStartCallback, OnStartEvent, OnStepFinishEvent, OnStepStartEvent, OnToolCallFinishEvent, OnToolCallStartEvent, OnToolExecutionEndCallback, OnToolExecutionStartCallback, output as Output, OutputChunkTimingStats, PrepareReconnectToStreamRequest, PrepareSendMessagesRequest, PrepareStepFunction, PrepareStepResult, Prompt, Provider, ProviderMetadata, ProviderReference, ProviderRegistryProvider, ReasoningFileOutput, ReasoningFileUIPart, ReasoningOutput, ReasoningUIPart, RepairTextFunction, RequestOptions, RerankEndEvent, RerankResult, RerankStartEvent, RerankingModel, RerankingModelCallEndEvent, RerankingModelCallStartEvent, RetryError, SafeValidateUIMessagesResult, SerialJobExecutor, SingleToolApprovalFunction, SourceDocumentUIPart, SourceUrlUIPart, SpeechModel, SpeechModelResponseMetadata, SpeechResult, StaticToolCall, StaticToolError, StaticToolOutputDenied, StaticToolResult, StepResult, StepResultPerformance, StepStartUIPart, StopCondition, StreamObjectOnFinishCallback, StreamObjectResult, StreamTextInclude, StreamTextOnChunkCallback, StreamTextOnErrorCallback, StreamTextResult, StreamTextTransform, Telemetry, TelemetryOptions, TelemetryTracingChannelMessage, TelemetryTracingEventType, TextStreamChatTransport, TextStreamPart, TextUIPart, TimeoutConfiguration, ToUIMessageChunkOptions, ToolApprovalConfiguration, ToolApprovalRequestOutput, ToolApprovalResponseOutput, ToolApprovalStatus, ToolCallNotFoundForApprovalError, ToolCallRepairError, ToolCallRepairFunction, ToolChoice, ToolExecutionEndEvent, ToolExecutionStartEvent, ToolInputRefinement, ToolLoopAgent, ToolLoopAgentSettings, ToolOrder, ToolUIPart, TranscriptionModel, TranscriptionModelResponseMetadata, TranscriptionResult, TypedToolCall, TypedToolError, TypedToolOutputDenied, TypedToolResult, UIDataPartSchemas, UIDataTypes, UIMessage, UIMessageChunk, UIMessagePart, UIMessageStreamError, UIMessageStreamOnEndCallback, UIMessageStreamOnFinishCallback, UIMessageStreamOnStepEndCallback, UIMessageStreamOnStepFinishCallback, UIMessageStreamOptions, UIMessageStreamWriter, UITool, UIToolInvocation, UITools, UI_MESSAGE_STREAM_HEADERS, UnsupportedModelVersionError, UploadFileResult, UploadSkillResult, UseCompletionOptions, Warning, addToolInputExamplesMiddleware, assistantModelMessageSchema, callCompletionApi, consumeStream, convertDataContentToBase64String, convertFileListToFileUIParts, convertToModelMessages, cosineSimilarity, createAgentUIStream, createAgentUIStreamResponse, createDownload, createProviderRegistry, createTextStreamResponse, createUIMessageStream, createUIMessageStreamResponse, customProvider, defaultEmbeddingSettingsMiddleware, defaultSettingsMiddleware, embed, embedMany, experimental_createProviderRegistry, decodeRealtimeAudio as experimental_decodeRealtimeAudio, encodeRealtimeAudio as experimental_encodeRealtimeAudio, filterActiveTools as experimental_filterActiveTools, experimental_generateSpeech, experimental_generateVideo, getRealtimeToolDefinitions as experimental_getRealtimeToolDefinitions, resampleAudio as experimental_resampleAudio, streamLanguageModelCall as experimental_streamLanguageModelCall, experimental_transcribe, extractJsonMiddleware, extractReasoningMiddleware, generateImage, generateObject, generateSpeech, generateText, getChunkTimeoutMs, getStaticToolName, getStepTimeoutMs, getTextFromDataUrl, getToolName, getToolOrDynamicToolName, getToolTimeoutMs, getTotalTimeoutMs, hasToolCall, isCustomContentUIPart, isDataUIPart, isDeepEqualData, isDynamicToolUIPart, isFileUIPart, isLoopFinished, isReasoningFileUIPart, isReasoningUIPart, isStaticToolUIPart, isStepCount, isTextUIPart, isToolUIPart, lastAssistantMessageIsCompleteWithApprovalResponses, lastAssistantMessageIsCompleteWithToolCalls, modelMessageSchema, parsePartialJson, pipeAgentUIStreamToResponse, pipeTextStreamToResponse, pipeUIMessageStreamToResponse, pruneMessages, readUIMessageStream, registerTelemetry, rerank, safeValidateUIMessages, simulateReadableStream, simulateStreamingMiddleware, smoothStream, isStepCount as stepCountIs, streamObject, streamText, systemModelMessageSchema, toTextStream, toUIMessageChunk, toUIMessageStream, toolModelMessageSchema, transcribe, uiMessageChunkSchema, uploadFile, uploadSkill, userModelMessageSchema, validateUIMessages, wrapEmbeddingModel, wrapImageModel, wrapLanguageModel, wrapProvider };