ai 3.1.2 → 3.1.3
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/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/react/dist/index.js +2 -0
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs +2 -0
- package/react/dist/index.mjs.map +1 -1
- package/rsc/dist/rsc-shared.mjs.map +1 -1
package/dist/index.mjs
CHANGED
@@ -658,6 +658,7 @@ function fixJson(input) {
|
|
658
658
|
break;
|
659
659
|
}
|
660
660
|
case "}": {
|
661
|
+
lastValidIndex = i;
|
661
662
|
stack.pop();
|
662
663
|
break;
|
663
664
|
}
|
@@ -1392,9 +1393,27 @@ var StreamTextResult = class {
|
|
1392
1393
|
warnings,
|
1393
1394
|
rawResponse
|
1394
1395
|
}) {
|
1395
|
-
this.originalStream = stream;
|
1396
1396
|
this.warnings = warnings;
|
1397
1397
|
this.rawResponse = rawResponse;
|
1398
|
+
let resolveUsage;
|
1399
|
+
this.usage = new Promise((resolve) => {
|
1400
|
+
resolveUsage = resolve;
|
1401
|
+
});
|
1402
|
+
let resolveFinishReason;
|
1403
|
+
this.finishReason = new Promise((resolve) => {
|
1404
|
+
resolveFinishReason = resolve;
|
1405
|
+
});
|
1406
|
+
this.originalStream = stream.pipeThrough(
|
1407
|
+
new TransformStream({
|
1408
|
+
async transform(chunk, controller) {
|
1409
|
+
controller.enqueue(chunk);
|
1410
|
+
if (chunk.type === "finish") {
|
1411
|
+
resolveUsage(chunk.usage);
|
1412
|
+
resolveFinishReason(chunk.finishReason);
|
1413
|
+
}
|
1414
|
+
}
|
1415
|
+
})
|
1416
|
+
);
|
1398
1417
|
}
|
1399
1418
|
/**
|
1400
1419
|
Split out a new stream from the original stream.
|