ai 5.0.259 → 5.0.261
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 +12 -0
- package/dist/index.js +18 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# ai
|
|
2
2
|
|
|
3
|
+
## 5.0.261
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 69879fe: fix(ai): prevent unhandled rejections when UI message stream reading stops early
|
|
8
|
+
|
|
9
|
+
## 5.0.260
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- ab8aa35: fix(ai): preserve provider metadata when simulating text streams
|
|
14
|
+
|
|
3
15
|
## 5.0.259
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -816,7 +816,7 @@ function detectMediaType({
|
|
|
816
816
|
var import_provider_utils2 = require("@ai-sdk/provider-utils");
|
|
817
817
|
|
|
818
818
|
// src/version.ts
|
|
819
|
-
var VERSION = true ? "5.0.
|
|
819
|
+
var VERSION = true ? "5.0.261" : "0.0.0-test";
|
|
820
820
|
|
|
821
821
|
// src/util/download/download.ts
|
|
822
822
|
var download = async ({
|
|
@@ -8976,7 +8976,11 @@ function simulateStreamingMiddleware() {
|
|
|
8976
8976
|
switch (part.type) {
|
|
8977
8977
|
case "text": {
|
|
8978
8978
|
if (part.text.length > 0) {
|
|
8979
|
-
controller.enqueue({
|
|
8979
|
+
controller.enqueue({
|
|
8980
|
+
type: "text-start",
|
|
8981
|
+
id: String(id),
|
|
8982
|
+
...part.providerMetadata != null ? { providerMetadata: part.providerMetadata } : {}
|
|
8983
|
+
});
|
|
8980
8984
|
controller.enqueue({
|
|
8981
8985
|
type: "text-delta",
|
|
8982
8986
|
id: String(id),
|
|
@@ -10671,9 +10675,15 @@ function readUIMessageStream({
|
|
|
10671
10675
|
var _a16;
|
|
10672
10676
|
let controller;
|
|
10673
10677
|
let hasErrored = false;
|
|
10678
|
+
let isCancelled = false;
|
|
10679
|
+
const abortController = new AbortController();
|
|
10674
10680
|
const outputStream = new ReadableStream({
|
|
10675
10681
|
start(controllerParam) {
|
|
10676
10682
|
controller = controllerParam;
|
|
10683
|
+
},
|
|
10684
|
+
cancel() {
|
|
10685
|
+
isCancelled = true;
|
|
10686
|
+
abortController.abort();
|
|
10677
10687
|
}
|
|
10678
10688
|
});
|
|
10679
10689
|
const state = createStreamingUIMessageState({
|
|
@@ -10694,15 +10704,18 @@ function readUIMessageStream({
|
|
|
10694
10704
|
return job({
|
|
10695
10705
|
state,
|
|
10696
10706
|
write: () => {
|
|
10697
|
-
|
|
10707
|
+
if (!isCancelled) {
|
|
10708
|
+
controller == null ? void 0 : controller.enqueue(createUIMessageSnapshot(state.message));
|
|
10709
|
+
}
|
|
10698
10710
|
}
|
|
10699
10711
|
});
|
|
10700
10712
|
},
|
|
10701
10713
|
onError: handleError
|
|
10702
10714
|
}),
|
|
10703
|
-
onError: handleError
|
|
10715
|
+
onError: handleError,
|
|
10716
|
+
abortSignal: abortController.signal
|
|
10704
10717
|
}).finally(() => {
|
|
10705
|
-
if (!hasErrored) {
|
|
10718
|
+
if (!hasErrored && !isCancelled) {
|
|
10706
10719
|
controller == null ? void 0 : controller.close();
|
|
10707
10720
|
}
|
|
10708
10721
|
});
|