ai 5.0.241 → 5.0.243
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 +15 -0
- package/dist/index.js +27 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +27 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/dist/test/index.js +2 -2
- package/dist/test/index.js.map +1 -1
- package/dist/test/index.mjs +2 -2
- package/dist/test/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -727,7 +727,7 @@ import {
|
|
|
727
727
|
} from "@ai-sdk/provider-utils";
|
|
728
728
|
|
|
729
729
|
// src/version.ts
|
|
730
|
-
var VERSION = true ? "5.0.
|
|
730
|
+
var VERSION = true ? "5.0.243" : "0.0.0-test";
|
|
731
731
|
|
|
732
732
|
// src/util/download/download.ts
|
|
733
733
|
var download = async ({
|
|
@@ -4362,6 +4362,16 @@ function createStitchableStream() {
|
|
|
4362
4362
|
};
|
|
4363
4363
|
}
|
|
4364
4364
|
|
|
4365
|
+
// src/util/notify.ts
|
|
4366
|
+
async function notify(options) {
|
|
4367
|
+
for (const callback of asArray(options.callbacks)) {
|
|
4368
|
+
try {
|
|
4369
|
+
await callback(options.event);
|
|
4370
|
+
} catch (_ignored) {
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4374
|
+
|
|
4365
4375
|
// src/util/now.ts
|
|
4366
4376
|
function now() {
|
|
4367
4377
|
var _a16, _b;
|
|
@@ -4853,10 +4863,16 @@ var DefaultStreamTextResult = class {
|
|
|
4853
4863
|
controller.enqueue(chunk);
|
|
4854
4864
|
const { part } = chunk;
|
|
4855
4865
|
if (part.type === "text-delta" || part.type === "reasoning-delta" || part.type === "source" || part.type === "tool-call" || part.type === "tool-result" || part.type === "tool-input-start" || part.type === "tool-input-delta" || part.type === "raw") {
|
|
4856
|
-
await (
|
|
4866
|
+
await notify({
|
|
4867
|
+
event: { chunk: part },
|
|
4868
|
+
callbacks: onChunk
|
|
4869
|
+
});
|
|
4857
4870
|
}
|
|
4858
4871
|
if (part.type === "error") {
|
|
4859
|
-
await
|
|
4872
|
+
await notify({
|
|
4873
|
+
event: { error: wrapGatewayError(part.error) },
|
|
4874
|
+
callbacks: onError
|
|
4875
|
+
});
|
|
4860
4876
|
}
|
|
4861
4877
|
if (part.type === "text-start") {
|
|
4862
4878
|
activeTextContent[part.id] = {
|
|
@@ -7722,7 +7738,10 @@ var DefaultStreamObjectResult = class {
|
|
|
7722
7738
|
transform(chunk, controller) {
|
|
7723
7739
|
controller.enqueue(chunk);
|
|
7724
7740
|
if (chunk.type === "error") {
|
|
7725
|
-
|
|
7741
|
+
void notify({
|
|
7742
|
+
event: { error: wrapGatewayError(chunk.error) },
|
|
7743
|
+
callbacks: onError
|
|
7744
|
+
});
|
|
7726
7745
|
}
|
|
7727
7746
|
}
|
|
7728
7747
|
});
|
|
@@ -8044,7 +8063,10 @@ var DefaultStreamObjectResult = class {
|
|
|
8044
8063
|
onError(error2) {
|
|
8045
8064
|
const wrappedError = wrapGatewayError(error2);
|
|
8046
8065
|
self.rejectResultPromises(wrappedError);
|
|
8047
|
-
void
|
|
8066
|
+
void notify({
|
|
8067
|
+
event: { error: wrappedError },
|
|
8068
|
+
callbacks: onError
|
|
8069
|
+
});
|
|
8048
8070
|
}
|
|
8049
8071
|
});
|
|
8050
8072
|
}
|