ai 7.0.111 → 7.0.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +41 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +345 -222
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +2 -1
- package/dist/internal/index.js +125 -31
- package/dist/internal/index.js.map +1 -1
- package/docs/03-agents/06-tool-approvals.mdx +16 -0
- package/docs/03-ai-sdk-core/37-speech.mdx +2 -0
- package/docs/03-ai-sdk-core/40-middleware.mdx +92 -7
- package/docs/06-advanced/02-stopping-streams.mdx +8 -0
- package/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +3 -3
- package/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +1 -1
- package/docs/07-reference/01-ai-sdk-core/32-validate-ui-messages.mdx +18 -0
- package/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +9 -3
- package/package.json +12 -12
- package/src/embed/embed-many.ts +18 -2
- package/src/generate-speech/generate-speech.ts +15 -4
- package/src/generate-speech/generated-audio-file.ts +0 -8
- package/src/generate-text/execute-tools-from-stream.ts +0 -2
- package/src/generate-text/generate-text.ts +1 -0
- package/src/generate-text/generated-file.ts +0 -8
- package/src/generate-text/invoke-tool-callbacks-from-stream.ts +9 -8
- package/src/generate-text/output.ts +0 -2
- package/src/generate-text/parse-tool-call.ts +38 -25
- package/src/generate-text/prune-messages.ts +3 -1
- package/src/generate-text/stream-text.ts +1 -0
- package/src/generate-text/to-response-messages.ts +7 -0
- package/src/generate-text/tool-call.ts +26 -0
- package/src/generate-text/validate-tool-approvals.ts +39 -3
- package/src/generate-video/generate-video.ts +0 -2
- package/src/middleware/extract-reasoning-middleware.ts +1 -1
- package/src/middleware/wrap-embedding-model.ts +9 -1
- package/src/model/get-embedding-model-provider-options-transformer.ts +17 -0
- package/src/prompt/content-part.ts +3 -0
- package/src/prompt/convert-to-language-model-prompt.ts +12 -2
- package/src/prompt/file-part-data.ts +11 -1
- package/src/registry/custom-provider.ts +12 -5
- package/src/ui/chat.ts +108 -17
- package/src/ui/convert-to-model-messages.ts +8 -0
- package/src/ui/direct-chat-transport.ts +2 -0
- package/src/ui/process-ui-message-stream.ts +6 -0
- package/src/ui/ui-messages.ts +10 -0
- package/src/ui/validate-ui-messages.ts +100 -134
- package/src/ui-message-stream/handle-ui-message-stream-finish.ts +5 -3
- package/src/ui-message-stream/to-ui-message-chunk.ts +7 -0
- package/src/ui-message-stream/ui-message-chunks.ts +2 -0
- package/src/ui-message-stream/ui-message-stream-on-end-callback.ts +8 -0
- package/src/ui-message-stream/ui-message-stream-outcome.ts +4 -0
- package/src/util/write-to-server-response.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 7.0.113
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- dcdb011: fix(ai): route completed streamed tool input callbacks to repaired tools
|
|
8
|
+
- 8f72832: fix(ai): preserve video models from legacy fallback providers
|
|
9
|
+
- fe07867: Fix Google `embedMany` calls with more than 100 values by keeping per-value multimodal content aligned across automatic batches, including text-only entries. Validate content length before sending requests and validate each batch's provider options after middleware transforms them.
|
|
10
|
+
- b74c0cb: fix(ai): resume tool approvals from earlier messages
|
|
11
|
+
- a4b0940: fix(ai): execute manually approved tool inputs produced by schema transforms
|
|
12
|
+
|
|
13
|
+
Preserve approved inputs during revalidation and reject histories whose reconstructed schema output differs, including signed approvals with missing original input. Validate transformed UI tool inputs against the reconstructed output before returning them as static tool parts.
|
|
14
|
+
|
|
15
|
+
- 2693319: Add Gemini 3.8 TTS support with structured speech metadata and per-turn speaker and style controls for prebuilt voices. Preserve native WAV responses without adding a second header, support explicit raw PCM, mu-law, and A-law output, and identify headerless audio formats correctly. Add the Gemini 3.8 speech model IDs to Google and Gateway types.
|
|
16
|
+
|
|
17
|
+
Share transcript and custom-voice inspection through the Google provider internal export, and reject empty speech transcripts before sending a request. Default newer and custom model IDs to structured speech while preserving the legacy format for Gemini 2.5 and 3.1.
|
|
18
|
+
|
|
19
|
+
- c93ee90: fix(ai): preserve message history for direct transport stream callbacks
|
|
20
|
+
- 771e74b: chore: enable dead code lint rules
|
|
21
|
+
- Updated dependencies [fe07867]
|
|
22
|
+
- Updated dependencies [a4b0940]
|
|
23
|
+
- Updated dependencies [2693319]
|
|
24
|
+
- Updated dependencies [b73f2f9]
|
|
25
|
+
- Updated dependencies [771e74b]
|
|
26
|
+
- @ai-sdk/provider-utils@5.0.47
|
|
27
|
+
- @ai-sdk/gateway@4.0.91
|
|
28
|
+
|
|
29
|
+
## 7.0.112
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- 9a98fd9: fix(ai): prune reasoning file parts when removing reasoning
|
|
34
|
+
- a0553d6: feat(ai): report consumer cancellation in UI message stream end callbacks
|
|
35
|
+
- ffb0e76: fix(provider): preserve opaque file URI strings for provider serialization
|
|
36
|
+
- fde0d66: fix(ai): preserve parsed metadata and data values when validating UI messages
|
|
37
|
+
- Updated dependencies [ed5a1d7]
|
|
38
|
+
- Updated dependencies [ffb0e76]
|
|
39
|
+
- Updated dependencies [618dc11]
|
|
40
|
+
- @ai-sdk/gateway@4.0.90
|
|
41
|
+
- @ai-sdk/provider@4.0.18
|
|
42
|
+
- @ai-sdk/provider-utils@5.0.46
|
|
43
|
+
|
|
3
44
|
## 7.0.111
|
|
4
45
|
|
|
5
46
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -2186,6 +2186,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
2186
2186
|
reason?: never;
|
|
2187
2187
|
isAutomatic?: boolean;
|
|
2188
2188
|
signature?: string;
|
|
2189
|
+
inputSchemaInput?: unknown;
|
|
2189
2190
|
};
|
|
2190
2191
|
} | {
|
|
2191
2192
|
state: 'approval-responded';
|
|
@@ -2201,6 +2202,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
2201
2202
|
reason?: string;
|
|
2202
2203
|
isAutomatic?: boolean;
|
|
2203
2204
|
signature?: string;
|
|
2205
|
+
inputSchemaInput?: unknown;
|
|
2204
2206
|
};
|
|
2205
2207
|
} | {
|
|
2206
2208
|
state: 'output-available';
|
|
@@ -2218,6 +2220,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
2218
2220
|
reason?: string;
|
|
2219
2221
|
isAutomatic?: boolean;
|
|
2220
2222
|
signature?: string;
|
|
2223
|
+
inputSchemaInput?: unknown;
|
|
2221
2224
|
};
|
|
2222
2225
|
} | {
|
|
2223
2226
|
state: 'output-error';
|
|
@@ -2239,6 +2242,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
2239
2242
|
reason?: string;
|
|
2240
2243
|
isAutomatic?: boolean;
|
|
2241
2244
|
signature?: string;
|
|
2245
|
+
inputSchemaInput?: unknown;
|
|
2242
2246
|
};
|
|
2243
2247
|
} | {
|
|
2244
2248
|
state: 'output-denied';
|
|
@@ -2254,6 +2258,7 @@ type UIToolInvocation<TOOL extends UITool | Tool> = {
|
|
|
2254
2258
|
reason?: string;
|
|
2255
2259
|
isAutomatic?: boolean;
|
|
2256
2260
|
signature?: string;
|
|
2261
|
+
inputSchemaInput?: unknown;
|
|
2257
2262
|
};
|
|
2258
2263
|
});
|
|
2259
2264
|
type ToolUIPart<TOOLS extends UITools = UITools> = ValueOf<{
|
|
@@ -2305,6 +2310,7 @@ type DynamicToolUIPart = {
|
|
|
2305
2310
|
reason?: never;
|
|
2306
2311
|
isAutomatic?: boolean;
|
|
2307
2312
|
signature?: string;
|
|
2313
|
+
inputSchemaInput?: unknown;
|
|
2308
2314
|
};
|
|
2309
2315
|
} | {
|
|
2310
2316
|
state: 'approval-responded';
|
|
@@ -2320,6 +2326,7 @@ type DynamicToolUIPart = {
|
|
|
2320
2326
|
reason?: string;
|
|
2321
2327
|
isAutomatic?: boolean;
|
|
2322
2328
|
signature?: string;
|
|
2329
|
+
inputSchemaInput?: unknown;
|
|
2323
2330
|
};
|
|
2324
2331
|
} | {
|
|
2325
2332
|
state: 'output-available';
|
|
@@ -2337,6 +2344,7 @@ type DynamicToolUIPart = {
|
|
|
2337
2344
|
reason?: string;
|
|
2338
2345
|
isAutomatic?: boolean;
|
|
2339
2346
|
signature?: string;
|
|
2347
|
+
inputSchemaInput?: unknown;
|
|
2340
2348
|
};
|
|
2341
2349
|
} | {
|
|
2342
2350
|
state: 'output-error';
|
|
@@ -2353,6 +2361,7 @@ type DynamicToolUIPart = {
|
|
|
2353
2361
|
reason?: string;
|
|
2354
2362
|
isAutomatic?: boolean;
|
|
2355
2363
|
signature?: string;
|
|
2364
|
+
inputSchemaInput?: unknown;
|
|
2356
2365
|
};
|
|
2357
2366
|
} | {
|
|
2358
2367
|
state: 'output-denied';
|
|
@@ -2368,6 +2377,7 @@ type DynamicToolUIPart = {
|
|
|
2368
2377
|
reason?: string;
|
|
2369
2378
|
isAutomatic?: boolean;
|
|
2370
2379
|
signature?: string;
|
|
2380
|
+
inputSchemaInput?: unknown;
|
|
2371
2381
|
};
|
|
2372
2382
|
});
|
|
2373
2383
|
/**
|
|
@@ -2523,6 +2533,7 @@ type UIMessageChunk<METADATA = unknown, DATA_TYPES extends UIDataTypes = UIDataT
|
|
|
2523
2533
|
approvalId: string;
|
|
2524
2534
|
toolCallId: string;
|
|
2525
2535
|
approvalDescriptor?: unknown;
|
|
2536
|
+
inputSchemaInput?: unknown;
|
|
2526
2537
|
reason?: string;
|
|
2527
2538
|
isAutomatic?: boolean;
|
|
2528
2539
|
signature?: string;
|
|
@@ -2621,6 +2632,10 @@ type InferUIMessageChunk<T extends UIMessage> = UIMessageChunk<InferUIMessageMet
|
|
|
2621
2632
|
* This is separate from model finish reasons and individual stream chunks.
|
|
2622
2633
|
* Fatal stream-processing failures override outcomes declared by the stream
|
|
2623
2634
|
* owner.
|
|
2635
|
+
*
|
|
2636
|
+
* Consumer cancellation before an outcome is declared keeps the `unknown`
|
|
2637
|
+
* status and is reported separately through the end callback's `isCancelled`
|
|
2638
|
+
* property.
|
|
2624
2639
|
*/
|
|
2625
2640
|
type UIMessageStreamOutcome = {
|
|
2626
2641
|
status: 'completed';
|
|
@@ -2647,6 +2662,13 @@ type UIMessageStreamOnEndCallback<UI_MESSAGE extends UIMessage> = (event: {
|
|
|
2647
2662
|
* Indicates whether the stream was aborted.
|
|
2648
2663
|
*/
|
|
2649
2664
|
isAborted: boolean;
|
|
2665
|
+
/**
|
|
2666
|
+
* Indicates that the consumer cancelled the stream before an outcome was
|
|
2667
|
+
* declared, for example because the client disconnected.
|
|
2668
|
+
*
|
|
2669
|
+
* This property is only present when it is `true`.
|
|
2670
|
+
*/
|
|
2671
|
+
isCancelled?: true;
|
|
2650
2672
|
/**
|
|
2651
2673
|
* The operation-level outcome of the stream. Fatal stream-processing
|
|
2652
2674
|
* failures override outcomes declared by the stream owner.
|
|
@@ -5791,6 +5813,7 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
5791
5813
|
private onData?;
|
|
5792
5814
|
private sendAutomaticallyWhen?;
|
|
5793
5815
|
private pendingMessagePreparations;
|
|
5816
|
+
private pendingApprovalMessageId;
|
|
5794
5817
|
private activeResponse;
|
|
5795
5818
|
private activeResumeRequest;
|
|
5796
5819
|
private jobExecutor;
|
|
@@ -5860,6 +5883,7 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
5860
5883
|
*/
|
|
5861
5884
|
stop: () => Promise<void>;
|
|
5862
5885
|
private shouldSendAutomatically;
|
|
5886
|
+
private makeRequestForToolApproval;
|
|
5863
5887
|
private makeRequest;
|
|
5864
5888
|
}
|
|
5865
5889
|
|
|
@@ -6151,6 +6175,9 @@ type ValidateUIMessagesOptions<UI_MESSAGE extends UIMessage> = {
|
|
|
6151
6175
|
outputSchema?: FlexibleSchema<InferUIMessageTools<UI_MESSAGE>[NAME]['output']>;
|
|
6152
6176
|
};
|
|
6153
6177
|
};
|
|
6178
|
+
experimental_refineToolInput?: {
|
|
6179
|
+
[NAME in keyof InferUIMessageTools<UI_MESSAGE> & string]?: (input: InferUIMessageTools<UI_MESSAGE>[NAME]['input']) => MaybePromiseLike<InferUIMessageTools<UI_MESSAGE>[NAME]['input']>;
|
|
6180
|
+
};
|
|
6154
6181
|
};
|
|
6155
6182
|
/**
|
|
6156
6183
|
* Validates a list of UI messages like `validateUIMessages`,
|