ai 5.0.272 → 5.0.274
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 +30 -0
- package/dist/index.d.mts +26 -3
- package/dist/index.d.ts +26 -3
- package/dist/index.js +225 -58
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -58
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 5.0.274
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f47f8e0: fix: resume interrupted chat streams when the page becomes visible again
|
|
8
|
+
|
|
9
|
+
`useChat` with `resume: true` no longer starts a second resume request on mount when the chat is already submitted or streaming, e.g. when remounting with a shared `Chat` instance mid-stream.
|
|
10
|
+
|
|
11
|
+
- ab0ecab: fix(ai): update tool outputs in the message containing the matching tool call
|
|
12
|
+
- dc561f0: fix(ai): prevent global type conflicts across SDK versions
|
|
13
|
+
- c060bd2: fix(ai): wait for chat stream cleanup when stopping
|
|
14
|
+
- dbf4338: fix(ai): update streaming chat messages by stable ID
|
|
15
|
+
- 99c9177: fix(ai): discard unrelated message state when reading resumed streams
|
|
16
|
+
- Updated dependencies [313a602]
|
|
17
|
+
- Updated dependencies [ae1ebda]
|
|
18
|
+
- @ai-sdk/gateway@2.0.165
|
|
19
|
+
|
|
20
|
+
## 5.0.273
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 223133e: fix(ai): prevent deleted tools named after Object.prototype properties from exposing persisted output to models
|
|
25
|
+
- 51e2b34: fix(ai): prevent unavailable tools from exposing persisted output to models
|
|
26
|
+
- 5f95b09: fix(ai): avoid duplicate slashes in chat reconnect URLs
|
|
27
|
+
- Updated dependencies [4a65dd5]
|
|
28
|
+
- Updated dependencies [8f63231]
|
|
29
|
+
- Updated dependencies [95c921d]
|
|
30
|
+
- Updated dependencies [c858a31]
|
|
31
|
+
- @ai-sdk/gateway@2.0.164
|
|
32
|
+
|
|
3
33
|
## 5.0.272
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -15,7 +15,15 @@ import { ServerResponse as ServerResponse$1 } from 'http';
|
|
|
15
15
|
type Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
|
|
16
16
|
type LogWarningsFunction = (warnings: Warning[]) => void;
|
|
17
17
|
|
|
18
|
+
declare const aiSdkGlobalsKey: unique symbol;
|
|
18
19
|
declare global {
|
|
20
|
+
interface AISDKGlobalTypes {
|
|
21
|
+
[aiSdkGlobalsKey]: {
|
|
22
|
+
provider: ProviderV2;
|
|
23
|
+
logWarnings: LogWarningsFunction;
|
|
24
|
+
telemetry: never;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
19
27
|
/**
|
|
20
28
|
* The default provider to use for the AI SDK.
|
|
21
29
|
* String model ids are resolved to the default provider and model id.
|
|
@@ -24,7 +32,7 @@ declare global {
|
|
|
24
32
|
*
|
|
25
33
|
* @see https://ai-sdk.dev/docs/ai-sdk-core/provider-management#global-provider-configuration
|
|
26
34
|
*/
|
|
27
|
-
var AI_SDK_DEFAULT_PROVIDER:
|
|
35
|
+
var AI_SDK_DEFAULT_PROVIDER: AISDKGlobalTypes[keyof AISDKGlobalTypes]['provider'] | undefined;
|
|
28
36
|
/**
|
|
29
37
|
* The warning logger to use for the AI SDK.
|
|
30
38
|
*
|
|
@@ -32,7 +40,7 @@ declare global {
|
|
|
32
40
|
*
|
|
33
41
|
* If set to false, no warnings are logged.
|
|
34
42
|
*/
|
|
35
|
-
var AI_SDK_LOG_WARNINGS:
|
|
43
|
+
var AI_SDK_LOG_WARNINGS: AISDKGlobalTypes[keyof AISDKGlobalTypes]['logWarnings'] | undefined | false;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
type CallSettings = {
|
|
@@ -1672,6 +1680,13 @@ type ToolUIPart<TOOLS extends UITools = UITools> = ValueOf<{
|
|
|
1672
1680
|
}>;
|
|
1673
1681
|
type DynamicToolUIPart = {
|
|
1674
1682
|
type: 'dynamic-tool';
|
|
1683
|
+
/**
|
|
1684
|
+
* `false` when a static tool part was normalized to a dynamic tool part
|
|
1685
|
+
* because its current tool schema was unavailable or incompatible.
|
|
1686
|
+
*
|
|
1687
|
+
* This preserves its static origin across persistence boundaries.
|
|
1688
|
+
*/
|
|
1689
|
+
dynamic?: false;
|
|
1675
1690
|
/**
|
|
1676
1691
|
* Name of the tool that is being called.
|
|
1677
1692
|
*/
|
|
@@ -3205,8 +3220,10 @@ type Job = () => Promise<void>;
|
|
|
3205
3220
|
declare class SerialJobExecutor {
|
|
3206
3221
|
private queue;
|
|
3207
3222
|
private isProcessing;
|
|
3223
|
+
private idleWaiters;
|
|
3208
3224
|
private processQueue;
|
|
3209
3225
|
run(job: Job): Promise<void>;
|
|
3226
|
+
waitForIdle(): Promise<void>;
|
|
3210
3227
|
}
|
|
3211
3228
|
|
|
3212
3229
|
/**
|
|
@@ -4181,6 +4198,8 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4181
4198
|
private activeResumeRequest;
|
|
4182
4199
|
private resumableStreamState;
|
|
4183
4200
|
private jobExecutor;
|
|
4201
|
+
private activeStopCount;
|
|
4202
|
+
private stopGeneration;
|
|
4184
4203
|
constructor({ generateId, id, transport, messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen, }: Omit<ChatInit<UI_MESSAGE>, 'messages'> & {
|
|
4185
4204
|
state: ChatState<UI_MESSAGE>;
|
|
4186
4205
|
});
|
|
@@ -4266,10 +4285,14 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4266
4285
|
errorText: string;
|
|
4267
4286
|
}) => Promise<void>;
|
|
4268
4287
|
/**
|
|
4269
|
-
* Abort the current request
|
|
4288
|
+
* Abort the current request, keep the generated tokens if any, and wait for
|
|
4289
|
+
* the request pipeline to finish.
|
|
4270
4290
|
*/
|
|
4271
4291
|
stop: () => Promise<void>;
|
|
4292
|
+
private shouldSendAutomatically;
|
|
4293
|
+
private runAutomaticRequest;
|
|
4272
4294
|
private makeRequest;
|
|
4295
|
+
private makeRequestImpl;
|
|
4273
4296
|
}
|
|
4274
4297
|
|
|
4275
4298
|
declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,15 @@ import { ServerResponse as ServerResponse$1 } from 'http';
|
|
|
15
15
|
type Warning = LanguageModelV2CallWarning | ImageModelV2CallWarning | SpeechModelV2CallWarning | TranscriptionModelV2CallWarning;
|
|
16
16
|
type LogWarningsFunction = (warnings: Warning[]) => void;
|
|
17
17
|
|
|
18
|
+
declare const aiSdkGlobalsKey: unique symbol;
|
|
18
19
|
declare global {
|
|
20
|
+
interface AISDKGlobalTypes {
|
|
21
|
+
[aiSdkGlobalsKey]: {
|
|
22
|
+
provider: ProviderV2;
|
|
23
|
+
logWarnings: LogWarningsFunction;
|
|
24
|
+
telemetry: never;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
19
27
|
/**
|
|
20
28
|
* The default provider to use for the AI SDK.
|
|
21
29
|
* String model ids are resolved to the default provider and model id.
|
|
@@ -24,7 +32,7 @@ declare global {
|
|
|
24
32
|
*
|
|
25
33
|
* @see https://ai-sdk.dev/docs/ai-sdk-core/provider-management#global-provider-configuration
|
|
26
34
|
*/
|
|
27
|
-
var AI_SDK_DEFAULT_PROVIDER:
|
|
35
|
+
var AI_SDK_DEFAULT_PROVIDER: AISDKGlobalTypes[keyof AISDKGlobalTypes]['provider'] | undefined;
|
|
28
36
|
/**
|
|
29
37
|
* The warning logger to use for the AI SDK.
|
|
30
38
|
*
|
|
@@ -32,7 +40,7 @@ declare global {
|
|
|
32
40
|
*
|
|
33
41
|
* If set to false, no warnings are logged.
|
|
34
42
|
*/
|
|
35
|
-
var AI_SDK_LOG_WARNINGS:
|
|
43
|
+
var AI_SDK_LOG_WARNINGS: AISDKGlobalTypes[keyof AISDKGlobalTypes]['logWarnings'] | undefined | false;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
type CallSettings = {
|
|
@@ -1672,6 +1680,13 @@ type ToolUIPart<TOOLS extends UITools = UITools> = ValueOf<{
|
|
|
1672
1680
|
}>;
|
|
1673
1681
|
type DynamicToolUIPart = {
|
|
1674
1682
|
type: 'dynamic-tool';
|
|
1683
|
+
/**
|
|
1684
|
+
* `false` when a static tool part was normalized to a dynamic tool part
|
|
1685
|
+
* because its current tool schema was unavailable or incompatible.
|
|
1686
|
+
*
|
|
1687
|
+
* This preserves its static origin across persistence boundaries.
|
|
1688
|
+
*/
|
|
1689
|
+
dynamic?: false;
|
|
1675
1690
|
/**
|
|
1676
1691
|
* Name of the tool that is being called.
|
|
1677
1692
|
*/
|
|
@@ -3205,8 +3220,10 @@ type Job = () => Promise<void>;
|
|
|
3205
3220
|
declare class SerialJobExecutor {
|
|
3206
3221
|
private queue;
|
|
3207
3222
|
private isProcessing;
|
|
3223
|
+
private idleWaiters;
|
|
3208
3224
|
private processQueue;
|
|
3209
3225
|
run(job: Job): Promise<void>;
|
|
3226
|
+
waitForIdle(): Promise<void>;
|
|
3210
3227
|
}
|
|
3211
3228
|
|
|
3212
3229
|
/**
|
|
@@ -4181,6 +4198,8 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4181
4198
|
private activeResumeRequest;
|
|
4182
4199
|
private resumableStreamState;
|
|
4183
4200
|
private jobExecutor;
|
|
4201
|
+
private activeStopCount;
|
|
4202
|
+
private stopGeneration;
|
|
4184
4203
|
constructor({ generateId, id, transport, messageMetadataSchema, dataPartSchemas, state, onError, onToolCall, onFinish, onData, sendAutomaticallyWhen, }: Omit<ChatInit<UI_MESSAGE>, 'messages'> & {
|
|
4185
4204
|
state: ChatState<UI_MESSAGE>;
|
|
4186
4205
|
});
|
|
@@ -4266,10 +4285,14 @@ declare abstract class AbstractChat<UI_MESSAGE extends UIMessage> {
|
|
|
4266
4285
|
errorText: string;
|
|
4267
4286
|
}) => Promise<void>;
|
|
4268
4287
|
/**
|
|
4269
|
-
* Abort the current request
|
|
4288
|
+
* Abort the current request, keep the generated tokens if any, and wait for
|
|
4289
|
+
* the request pipeline to finish.
|
|
4270
4290
|
*/
|
|
4271
4291
|
stop: () => Promise<void>;
|
|
4292
|
+
private shouldSendAutomatically;
|
|
4293
|
+
private runAutomaticRequest;
|
|
4272
4294
|
private makeRequest;
|
|
4295
|
+
private makeRequestImpl;
|
|
4273
4296
|
}
|
|
4274
4297
|
|
|
4275
4298
|
declare function convertFileListToFileUIParts(files: FileList | undefined): Promise<Array<FileUIPart>>;
|