ai 7.0.0-canary.176 → 7.0.1

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 (77) hide show
  1. package/CHANGELOG.md +424 -0
  2. package/dist/index.d.ts +49 -24
  3. package/dist/index.js +1397 -1104
  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/06-tool-approvals.mdx +6 -6
  15. package/docs/03-agents/07-workflow-agent.mdx +45 -3
  16. package/docs/03-agents/08-terminal-ui.mdx +25 -0
  17. package/docs/03-ai-sdk-core/17-mcp-apps.mdx +0 -4
  18. package/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +2 -2
  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 +40 -15
  24. package/docs/03-ai-sdk-core/65-devtools.mdx +3 -3
  25. package/docs/03-ai-sdk-harnesses/01-overview.mdx +2 -0
  26. package/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +43 -15
  27. package/docs/03-ai-sdk-harnesses/03-tools.mdx +2 -5
  28. package/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +4 -2
  29. package/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +342 -0
  30. package/docs/03-ai-sdk-harnesses/{06-ui.mdx → 07-ui.mdx} +1 -1
  31. package/docs/03-ai-sdk-harnesses/{07-terminal-ui.mdx → 08-terminal-ui.mdx} +4 -4
  32. package/docs/03-ai-sdk-harnesses/index.mdx +7 -2
  33. package/docs/04-ai-sdk-ui/02-chatbot.mdx +3 -3
  34. package/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +9 -9
  35. package/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +1 -1
  36. package/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +1 -1
  37. package/docs/04-ai-sdk-ui/21-error-handling.mdx +2 -2
  38. package/docs/04-ai-sdk-ui/25-message-metadata.mdx +2 -2
  39. package/docs/06-advanced/02-stopping-streams.mdx +5 -5
  40. package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +7 -1
  41. package/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +7 -0
  42. package/docs/07-reference/01-ai-sdk-core/23-get-realtime-tool-definitions.mdx +9 -0
  43. package/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +1 -1
  44. package/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +6 -2
  45. package/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +10 -6
  46. package/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +15 -1
  47. package/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +29 -0
  48. package/docs/08-migration-guides/23-migration-guide-7-0.mdx +399 -275
  49. package/docs/08-migration-guides/index.mdx +1 -0
  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 +183 -115
  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/src/telemetry/diagnostic-channel-publisher.ts +0 -50
  77. package/src/telemetry/diagnostic-channel.ts +0 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,429 @@
1
1
  # ai
2
2
 
3
+ ## 7.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [b2791b3]
8
+ - Updated dependencies [330f6e2]
9
+ - @ai-sdk/gateway@4.0.1
10
+
11
+ ## 7.0.0
12
+
13
+ ### Major Changes
14
+
15
+ - 986c6fd: feat(ai): change type of experimental_context from unknown to generic
16
+ - b0c2869: chore(ai): remove deprecated `media` type part from `ToolResultOutput`
17
+ - 1949571: feat(ai): make experimental_telemetry stable
18
+ - 6542d93: feat(ai): change naming nomenclature for `*TelemetryIntegration` to `*Telemetry`
19
+ - 31f69de: fix(ai): carry prepareStep message overrides forward across steps
20
+ - 7c71ac6: fix(ai): limit response messages in StepResult to messages created in that step
21
+ - cf93359: feat(ai): remove/refactor event data sent via callbacks
22
+ - 776b617: feat(provider): adding new 'custom' content type
23
+ - 34bd95d: feat(ai): add support for uploading provider skills using the provider references abstraction
24
+ - 1f7db50: fix(ai): remove experimental_customProvider
25
+ - 3debdb7: feat(ai): rename `stepCountIs` to `isStepCount`
26
+ - fcc6869: refactor(ai/core): rename `ModelCallStreamPart` to `LanguageModelStreamPart` and align stream model call naming (`streamLanguageModelCall`, `experimental_streamLanguageModelCall`).
27
+
28
+ This updates experimental low-level stream primitives to use "language model call" terminology consistently.
29
+
30
+ - ef992f8: Remove CommonJS exports from all packages. All packages are now ESM-only (`"type": "module"`). Consumers using `require()` must switch to ESM `import` syntax.
31
+ - 493295c: Remove the deprecated `ToolCallOptions` export.
32
+
33
+ Use `ToolExecutionOptions` instead.
34
+
35
+ - 116c89f: feat(ai): remove telemetry data from the user-facing event data
36
+ - c29a26f: feat(provider): add support for provider references and uploading files as supported per provider
37
+ - 3887c70: feat(provider): add new top-level reasoning parameter to spec and support it in `generateText` and `streamText`
38
+ - 9bd6512: feat(provider): change file part data property to be tagged with a type and remove the image part type
39
+ - 4b46062: refactoring(ai): extract tool callback invocation into separate function and forward chunks before callback invocation
40
+ - 7e26e81: chore: rename experimental_context to context
41
+ - 8359612: Start v7 pre-release
42
+ - 5463d0d: feat(provider): align tool result output content file part types with top-level message file part types
43
+ - 72223e7: chore(ai): remove deprecated isToolOrDynamicToolUIPart function
44
+ - 57bf606: chore(ai): simplify unified telemetry creation
45
+ - b3c9f6a: feat(ai): create new opentelemetry package (@ai-sdk/otel)
46
+ - b9cf502: refactoring(ai): delay tool execution in stream text until model call is finished
47
+ - 5b8c58f: feat(ai): decouple otel from core functions
48
+ - 4e095b0: fix(ai): reject system messages in messages or prompt by default (opt-in)
49
+
50
+ ### Patch Changes
51
+
52
+ - e3d9c0e: Add `allowSystemInMessages` option to `ToolLoopAgent`.
53
+
54
+ 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.
55
+
56
+ ```ts
57
+ const agent = new ToolLoopAgent({
58
+ model,
59
+ allowSystemInMessages: true,
60
+ });
61
+
62
+ await agent.generate({
63
+ messages: [
64
+ { role: "system", content: "Server context" },
65
+ { role: "user", content: "Hello" },
66
+ ],
67
+ });
68
+ ```
69
+
70
+ The option can also be returned from `prepareCall` for dynamic per-call configuration.
71
+
72
+ - b56301c: feat(ai): decouple otel from generate/streamObject
73
+ - 2427d88: feat(ai): change Tool.sensitiveContext to telemetry.includeToolsContext and make it opt-in
74
+ - 38fc777: Add AI Gateway hint to provider READMEs
75
+ - 023550e: Deprecate `streamText` result `fullStream` in favor of `stream`.
76
+ - 38ca8dc: fix(gateway): enable retry support for gateway errors
77
+ - 19736ee: feat(ai): rename onStepFinish to onStepEnd
78
+ - 6d76710: fix URL of hero animation in README
79
+ - 5ceed7d: fix(ai): doStream should reflect transformed values
80
+ - 4757690: feat(ai): rename onObjectStepFinish to onObjectStepEnd
81
+ - bc47739: chore(ai): cleanup telemetry event data
82
+ - d1b3786: fix(ai): deprecate properties on result that have moved to finalStep
83
+ - 382d53b: refactoring: rename context to runtimeContext
84
+ - ff9ce30: feat(ai): introduce experimental callbacks for embed function
85
+ - ee798eb: chore(provider-utils): rename `Experimental_Sandbox` to `Experimental_SandboxSession`
86
+ - 4873966: chore(ai): allow general usage of `logWarnings` and emit them via Node API when available
87
+ - e67d80e: fix: rename onFinish to onEnd
88
+ - 7bf7d7f: feat(ai): enable:true for telemetry by default
89
+ - 99bf941: feat(ai): extract streamModelCall function for streaming text generation
90
+ - e95e38d: fix: Make `generateText` and `streamText` result `usage` report total usage across all steps and deprecate `totalUsage`.
91
+ - 6a3793e: chore(ai): add optional ChatRequestOptions to `addToolApprovalResponse` and `addToolOutput`
92
+ - 5f3749c: refactoring: rename toolNeedsApproval to toolApproval
93
+ - 016e877: feat(ai): add `instructions` as the primary prompt option and deprecate `system`
94
+ - 2fe1099: feat(ai): emit streaming chunks throught the onChunk callback
95
+ - f319fde: feat(ai): validate tool context against contextSchema at runtime
96
+
97
+ 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`.
98
+
99
+ - 31ee822: refactoring(ai): extract filterActiveTools and expose it as experimental_filterActiveTools
100
+ - b67525f: feat: instructions as prepareStep input
101
+ - e68be55: fix(ai): skip stringifying text when streaming partial text
102
+ - 1db29c8: feat(ai): break `CallSettings` apart into `LanguageModelCallOptions` and `RequestOptions`
103
+ - 0a51f7d: fix(ai): enforce `callOptionsSchema` at runtime in `ToolLoopAgent`
104
+
105
+ `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.
106
+
107
+ `ToolLoopAgent.prepareCall` now validates caller-supplied `options` against `callOptionsSchema` (when set) via `safeValidateTypes`, throwing `InvalidArgumentError` on failure before forwarding to `prepareCall` / `generateText` / `streamText`.
108
+
109
+ - d1a8bed: fix(ui): export `isDynamicToolUIPart` from `ai` package
110
+ - bcce2dd: feat(stream-text): expose standalone stream transformation helpers and deprecate the equivalent `streamText` result methods.
111
+
112
+ 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`.
113
+
114
+ `result.toUIMessageStreamResponse(options)` and `result.pipeUIMessageStreamToResponse(response, options)` can migrate by passing `toUIMessageStream({ stream: result.stream, ...options })` to `createUIMessageStreamResponse` or `pipeUIMessageStreamToResponse`.
115
+
116
+ 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 })`.
117
+
118
+ `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.
119
+
120
+ - 2a74d43: Remove the deprecated `experimental_prepareStep` option from `generateText`.
121
+
122
+ Use `prepareStep` instead.
123
+
124
+ - 71d3022: fix(ai): unify generate text event callbacks
125
+ - 6cca112: feat: add timeBetweenOutputTokensMs stats
126
+ - fd4f578: fix(ai): exclude request and response bodies from text generation results by default to reduce memory usage.
127
+ - 511902c: skip validation for tool parts in terminal states when tool schema is no longer registered
128
+ - a5018ab: fix(ai): return schema-transformed elements in array output mode
129
+
130
+ 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.
131
+
132
+ - 531251e: fix(security): validate redirect targets in download functions to prevent SSRF bypass
133
+
134
+ 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.
135
+
136
+ - eeefc3f: fix(ai): enforce `timeout.stepMs` for the whole step in `streamText`
137
+
138
+ 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.
139
+
140
+ - ec98264: feat(ai): allow multiple integrations to be registered at once
141
+ - 43a6750: fix(ai): preserve `allowSystemInMessages` across `streamText` retries
142
+ - 67df0a0: feat: add sensitiveContext property to Tool
143
+ - b79b6a8: fix(ai): add approval guard for denied tool outputs
144
+ - 81caa5d: fix(ai): remove ExtractLiteralUnion export
145
+ - 4181cfe: fix(ai): harden `getMediaTypeFromUrl` against prototype-property collisions
146
+
147
+ `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.
148
+
149
+ Switch to `Object.hasOwn(...)` so attacker-controlled extensions like `.constructor` cannot resolve to inherited `Object.prototype` keys.
150
+
151
+ - 208d045: fix(ai): skip global telemetry registration when local integration defined
152
+ - 5a6f514: feat(ai): support several tools in hasToolCall stop condition
153
+ - ed74dae: fix(ui): make `input` optional on `output-error` tool and dynamic-tool UI message parts
154
+
155
+ `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`.
156
+
157
+ - ca99fea: feat: expose `finalStep` on text generation results
158
+ - 9b47dea: fix(ai): remove otel Tracer api from telemetry settings
159
+ - 877bf12: fix(ai): flatten model attributes for telemetry
160
+ - eea8d98: refactoring: rename tool execution events
161
+ - d66ae02: Return validated elements from generateText array output
162
+ - 5d0f18e: feat(ai): move opentelemetry to new package
163
+ - 21d3d60: feat(harness): implement harness specification
164
+ - 1582efa: chore(ai): remove the metadata field from the telemetry settings
165
+ - 80d4dde: fix(ai): include tool input on tool result for provider executed dynamic tools
166
+ - 98627e5: feat(ai): remove onChunk event from telemetry
167
+ - 51ce232: feat(ai): add sensitiveRuntimeContext option
168
+ - 82fc0ab: fix(ai): pass all stream text parts to `onChunk`
169
+ - 1f509d4: fix(ai): force template check on 'kind' param
170
+ - ca446f8: feat: flexible tool descriptions
171
+ - 176466a: chore(provider): align V4 model return types to have their own definitions across all model interfaces
172
+ - c0c8ca2: fix(ai): remove deprecated LanguageModelUsage properties
173
+ - 75763b0: agents: tag outgoing requests with an ai-sdk-agent user-agent segment for usage attribution (tool-loop, workflow)
174
+ - 6ec57f5: feat(ai): make the experimental lifecycle callbacks stable
175
+ - 3ae1786: fix: better context type inference
176
+ - a7de9c9: fix: make sandbox experimental
177
+ - caf1b6f: feat(ai): introduce experimental callbacks for rerank function
178
+ - 9f0e36c: trigger release for all packages after provenance setup
179
+ - befb78c: refactoring: remove real-time delays in unit tests
180
+ - 6866afe: fix(ai): fix `lastAssistantMessageIsCompleteWithApprovalResponses` to no longer ignore `providerExecuted` tool approvals
181
+ - 29d8cf4: feat(ai): rename the core-event types
182
+ - 2e17091: fix(types): move shared tool set utility types into provider-utils
183
+
184
+ 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.
185
+
186
+ - 210ed3d: feat(ai): pass result provider metadata across the stream
187
+ - a3fd75b: feat(ai): expose Experimental_ModelCallStreamPart type
188
+ - f4cc8eb: feat: add performance statistics
189
+ - 2add429: fix(ai): skip passing invalid JSON inputs to response messages
190
+ - 5588abd: feat(ai): add experimental_refineToolInput option to ToolLoopAgent, generateText, streamText
191
+ - e80ada0: fix(ai): download tool-result file URLs
192
+ - 58a2ad7: fix: more precise default message for tool execution denial
193
+ - 62d6481: Post-publish release notifications now link to each package’s GitHub release and npm page.
194
+ - 1fe058b: fix(anthropic): preserve the error code returned by model
195
+ - 5c4d910: feat(ai): add new `isLoopFinished` stop condition helper for unlimited steps
196
+ - e4182bd: chore: rm export of OutputInterface
197
+ - 34fd051: feat(ai): add toolMs to timeout configuration
198
+ - 72cb801: feat(ai): concurrent event notification
199
+ - 2e98477: fix: retain stack traces on async errors
200
+ - add1126: refactoring: executeTool uses tool as parameter
201
+ - 81a284b: fix(ai): handle partial unicode escapes in fixJson
202
+ - 76fd58c: fix: consider file outputs and tool calls for time to first output
203
+ - 7392266: feat: move includeRawChunks to include.rawChunks
204
+ - 69aeb0e: feat: add deprecated tool call lifecycle callback aliases for AI SDK 6 compatibility.
205
+ - 37d69b2: feat(ai): access runtime context in tool approval functions
206
+ - 1043274: feat(ai): add a ModelCall start/end event
207
+ - 350ea38: refactoring: introduce Arrayable type
208
+ - 7f59f04: feat(ai): add approval reason to automatic tool approvals
209
+ - 7677c1e: feat(ai): allow tool approval functions to return undefined
210
+ - 476e1ca: feat(ai): remove telemetry dependency on onChunk callback
211
+ - 008271d: feat(openai-compatible): emit warning when using kebab-case instead of camelCase
212
+ - 7fc6bd6: Raise minimum supported Node.js version to 22. Supported versions: 22, 24, and 26.
213
+ - 594029e: feat(ai): wrap the model call in telemetry context
214
+ - 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.
215
+ - 25a64f8: Remove deprecated experimental generateImage exports.
216
+ - 75ef93e: remove the deprecated `experimental_output` alias and document the `output` migration for AI SDK 7
217
+ - c26ca8d: Remove custom User-Agent header from HttpChatTransport to fix CORS preflight failures in Safari and Firefox
218
+ - eaf849f: Rename rerank telemetry finish callback to `onRerankEnd`.
219
+ - 664a0eb: feat (ai/core): support plain string model IDs in `rerank()` function
220
+
221
+ 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.
222
+
223
+ - 08d2129: feat(mcp): propagate the server name through dynamic tool parts
224
+ - 5faf71c: feat: introduce responseMessages on GenerateTextResult and StreamTextResult
225
+ - 0c4c275: trigger initial canary release
226
+ - 118b953: feat(ai): decouple otel from embed functions
227
+ - 6fd51c0: fix(provider): preserve error type prefix in getErrorMessage
228
+ - 1dca341: fix: rename telemetry onFinish to onEnd
229
+ - ebd4da2: feat(ai): add missing usage attributes
230
+ - bc67b4f: feat(ai): add experimental callbacks for structured outputs
231
+ - f0b0b20: feat(ai): add per-tool timeout overrides via toolTimeouts
232
+ - 2852a84: fix(ai): make input optional on input-streaming UIMessagePart variants
233
+ - 2a9c144: feat(ai): add toolNeedsApproval option
234
+ - ce769dd: feat(provider): add experimental Realtime API support for voice conversations
235
+
236
+ Adds first-class support for realtime (speech-to-speech) APIs:
237
+
238
+ - `Experimental_RealtimeModelV4` spec in `@ai-sdk/provider` with normalized event types and factory
239
+ - OpenAI, Google, and xAI realtime provider implementations
240
+ - `openai.experimental_realtime()` / `google.experimental_realtime()` / `xai.experimental_realtime()` work in both server and browser
241
+ - `.getToken()` static method on each provider for server-side ephemeral token creation
242
+ - `experimental_getRealtimeToolDefinitions` helper for provider session tool definitions
243
+ - `experimental_useRealtime` hook in `@ai-sdk/react` returning `UIMessage[]` (aligned with `useChat`), with `onToolCall` and `addToolOutput` for client-driven tool execution
244
+ - `inputAudioTranscription` session config for showing transcribed user audio messages when supported by the provider
245
+
246
+ - e3a0419: fix(ai): default missing embedding warnings to an empty array
247
+ - f04adcb: feat(ai): refresh `customProvider` and `createProviderRegistry` to support file and skill upload abstractions
248
+ - 876fd3e: fix(ai): limit tool execution time duration to actual tool execution
249
+ - e311194: feat(ai): allow passing provider instance to `uploadFile` and `uploadSkill` as shorthand
250
+ - 989d3d2: fix(ai): include generated files in OTEL response attributes
251
+ - b5092f5: fix(ai): do not re-validate tool input for output-error parts in validateUIMessages
252
+ - 6dd6b83: feat(ai): change sensitiveRuntimeContext to telemetry.includeRuntimeContext and make it opt-in
253
+ - 69254e0: feat(ai): add toolMetadata for tool specific metdata
254
+ - 79b2468: feat: add request.messages to StepResult
255
+ - 6c93e36: feat(provider-utils): add `spawnCommand` method to `Experimental_Sandbox` to allow for detached command execution
256
+ - 2605e5f: fix test mocks to return the first array-backed result on the first call
257
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
258
+ - f58f9bc: fix(ai): remove stopWhen from onStart event
259
+ - 8565dcb: fix: rename onEmbedFinish to onEmbedEnd
260
+ - 6abd098: split `prepareToolsAndToolChoice()` into `prepareTools()` and `prepareToolChoice()`
261
+ - e1bfb9c: feat(ai): remove unnecessary data from events
262
+ - 375fdd7: fix: harden download URL SSRF guard against hostname and redirect bypasses
263
+
264
+ `validateDownloadUrl` and the file download helpers (`downloadBlob`, `download`) could be bypassed in several ways when handling untrusted URLs:
265
+
266
+ - A fully-qualified hostname with a trailing dot (e.g. `localhost.`, `myhost.local.`) skipped the localhost/`.local` blocklist.
267
+ - 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.
268
+ - 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.
269
+ - 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`).
270
+
271
+ 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.
272
+
273
+ - 89ad56f: Promote `generateSpeech` and `SpeechResult` to stable exports.
274
+ - f9a496f: Promote `transcribe` and `TranscriptionResult` to stable exports, with deprecated experimental aliases for backwards compatibility.
275
+ - 334ae5d: Update step performance metrics with explicit effective, input, output, and total token throughput fields.
276
+ - 3295831: Harden stream text processing and middleware against prototype pollution from stream part IDs.
277
+ - b097c52: feat(ai): use tracing channels to track parent-child context
278
+ - e79e644: chore(ai/core): remove `timeout` from `CallSettings` as it was effectively unused there
279
+ - 3015fc3: feat: sandbox shell execution abstraction
280
+ - b8396f0: trigger initial beta release
281
+ - 48e92f3: feat: make include stable
282
+ - 33d099c: fix(ai): omit reasoning-start/end when sendReasoning is false
283
+ - e87d71b: feat(ai): support automatic tool approval in ui messages
284
+ - a6617c5: feat(provider-utils): add `readFile` and `writeFile` plus convenience wrappers to `Experimental_Sandbox` abstraction
285
+ - eee1166: feat(ai): expose initial and response messages in prepareStep
286
+ - 9d486aa: feat(ai): generic tool approval function
287
+ - c3d4019: chore(ai): rename 'TelemetrySettings' to 'TelemetryOptions'
288
+ - 28dfa06: fix: support tools with optional context
289
+ - bcacd48: fix(ai): accumulative properties on StreamTextResult, GenerateTextResult
290
+ - e92fc45: feat(ai): introduce onAbort hook to close telemetry spans
291
+ - 083947b: feat(ai): separate toolsContext from context
292
+ - 47e65d6: fix(ai): tag step/chunk timeout aborts with `TimeoutError` reason
293
+
294
+ 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'`.
295
+
296
+ - 6a2caf9: Serialize `undefined` tool output to `null` in UI message chunks
297
+ - 202f107: feat(ai): create a diagnostics channel to push event data
298
+ - bae5e2b: fix(security): re-validate tool approvals from client message history before execution
299
+
300
+ 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.
301
+
302
+ 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.
303
+
304
+ - c907622: Add a `toolOrder` option to control the order in which tools are sent to provider APIs.
305
+ - 90e2d8a: chore: fix unused vars not being flagged by our lint tooling
306
+ - c4f4b5f: refactoring(ai): remove deprecated experimental_activeTools option
307
+ - f4cfccd: feat(ai): decouple otel from rerank function
308
+ - f5a6f89: README updates
309
+ - f18b08f: fix: redact server error details from UI message streams by default
310
+
311
+ `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.
312
+
313
+ 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.
314
+
315
+ - 7fd3360: Harden UI message stream processing against prototype pollution from chunk IDs.
316
+ - 0416e3e: feat (video): add first-class `generateAudio` call option
317
+ - d775a57: feat: introduce Instructions type
318
+ - b4507d5: fix(provider-utils): cancel response body on download rejection to prevent socket leak
319
+
320
+ 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.
321
+
322
+ - 6147cdf: fix(ai): fix auto-complete on provider registry and custom provider
323
+ - e93fa91: rename Sandbox.executeCommand to Sandbox.runCommand
324
+ - f32c750: refactoring(ai): simplify mergeAbortSignals
325
+ - 7dbf992: feat(ai): allow prepareStep to override sandbox per step
326
+ - 9b0bc8a: fix(mcp): prevent prototype pollution by using secureJsonParse
327
+ - 4bb4dbc: feat: introduce include.requestMessage option for step request message storage opt-in
328
+ - c22750c: fix(ai): move onToolExecutionStart and onToolExecutionEnd to stable
329
+ - 538c12b: feat: use instructions on ToolCallRepairFunction, parseToolCall, and events
330
+ - fc92055: feat(ai): automatic tool approval
331
+ - f372547: fix(ai): fix `providerExecuted` tool approvals being passed to language model twice
332
+ - 1e4b350: Honor `tool.toModelOutput` in `WorkflowAgent`.
333
+
334
+ `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`.
335
+
336
+ Internally exports the shared tool-result model-output helpers from `ai/internal`, and uses the shared `getErrorMessage` behavior for workflow tool error results.
337
+
338
+ - 69d7128: fix(workflow): reuse the core tool-approval validation in WorkflowAgent
339
+
340
+ `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`.
341
+
342
+ - ff5eba1: feat: roll `image-*` tool output types into their equivalent `file-*` types
343
+ - cc6ab90: feat(ai): rename ui message stream onFinish to onEnd
344
+ - e27ed76: feat(devtools): add new devtools integration for telemetry
345
+
346
+ ## 7.0.0-beta.187
347
+
348
+ ### Patch Changes
349
+
350
+ - Updated dependencies [77cc1af]
351
+ - @ai-sdk/gateway@4.0.0-beta.114
352
+
353
+ ## 7.0.0-beta.186
354
+
355
+ ### Patch Changes
356
+
357
+ - Updated dependencies [eb024b6]
358
+ - @ai-sdk/gateway@4.0.0-beta.113
359
+
360
+ ## 7.0.0-beta.185
361
+
362
+ ### Patch Changes
363
+
364
+ - 75763b0: agents: tag outgoing requests with an ai-sdk-agent user-agent segment for usage attribution (tool-loop, workflow)
365
+
366
+ ## 7.0.0-beta.184
367
+
368
+ ### Patch Changes
369
+
370
+ - 0416e3e: feat (video): add first-class `generateAudio` call option
371
+ - Updated dependencies [a403276]
372
+ - Updated dependencies [0416e3e]
373
+ - @ai-sdk/gateway@4.0.0-beta.112
374
+ - @ai-sdk/provider@4.0.0-beta.20
375
+ - @ai-sdk/provider-utils@5.0.0-beta.50
376
+
377
+ ## 7.0.0-beta.183
378
+
379
+ ### Patch Changes
380
+
381
+ - Updated dependencies [8e990ff]
382
+ - @ai-sdk/gateway@4.0.0-beta.111
383
+
384
+ ## 7.0.0-beta.182
385
+
386
+ ### Patch Changes
387
+
388
+ - cc6ab90: feat(ai): rename ui message stream onFinish to onEnd
389
+
390
+ ## 7.0.0-beta.181
391
+
392
+ ### Patch Changes
393
+
394
+ - 6a2caf9: Serialize `undefined` tool output to `null` in UI message chunks
395
+
396
+ ## 7.0.0-beta.180
397
+
398
+ ### Patch Changes
399
+
400
+ - 81a284b: fix(ai): handle partial unicode escapes in fixJson
401
+
402
+ ## 7.0.0-beta.179
403
+
404
+ ### Patch Changes
405
+
406
+ - Updated dependencies [987d9e4]
407
+ - @ai-sdk/gateway@4.0.0-beta.110
408
+
409
+ ## 7.0.0-beta.178
410
+
411
+ ### Patch Changes
412
+
413
+ - b097c52: feat(ai): use tracing channels to track parent-child context
414
+ - Updated dependencies [15eb253]
415
+ - @ai-sdk/gateway@4.0.0-beta.109
416
+
417
+ ## 7.0.0-beta.177
418
+
419
+ ### Patch Changes
420
+
421
+ - b8396f0: trigger initial beta release
422
+ - Updated dependencies [b8396f0]
423
+ - @ai-sdk/gateway@4.0.0-beta.108
424
+ - @ai-sdk/provider-utils@5.0.0-beta.49
425
+ - @ai-sdk/provider@4.0.0-beta.19
426
+
3
427
  ## 7.0.0-canary.176
4
428
 
5
429
  ### 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 };