ai 4.0.32 → 4.0.33
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 +6 -0
- package/dist/index.d.mts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -2714,12 +2714,27 @@ function createStitchableStream() {
|
|
2714
2714
|
innerStreamReaders.push(innerStream.getReader());
|
2715
2715
|
waitForNewStream.resolve();
|
2716
2716
|
},
|
2717
|
+
/**
|
2718
|
+
* Gracefully close the outer stream. This will let the inner streams
|
2719
|
+
* finish processing and then close the outer stream.
|
2720
|
+
*/
|
2717
2721
|
close: () => {
|
2718
2722
|
isClosed = true;
|
2719
2723
|
waitForNewStream.resolve();
|
2720
2724
|
if (innerStreamReaders.length === 0) {
|
2721
2725
|
controller == null ? void 0 : controller.close();
|
2722
2726
|
}
|
2727
|
+
},
|
2728
|
+
/**
|
2729
|
+
* Immediately close the outer stream. This will cancel all inner streams
|
2730
|
+
* and close the outer stream.
|
2731
|
+
*/
|
2732
|
+
terminate: () => {
|
2733
|
+
isClosed = true;
|
2734
|
+
waitForNewStream.resolve();
|
2735
|
+
innerStreamReaders.forEach((reader) => reader.cancel());
|
2736
|
+
innerStreamReaders = [];
|
2737
|
+
controller == null ? void 0 : controller.close();
|
2723
2738
|
}
|
2724
2739
|
};
|
2725
2740
|
}
|
@@ -4419,7 +4434,7 @@ function streamText({
|
|
4419
4434
|
tools,
|
4420
4435
|
toolChoice,
|
4421
4436
|
toolCallStreaming,
|
4422
|
-
transform
|
4437
|
+
transform,
|
4423
4438
|
activeTools,
|
4424
4439
|
repairToolCall,
|
4425
4440
|
maxSteps,
|
@@ -4693,7 +4708,14 @@ var DefaultStreamTextResult = class {
|
|
4693
4708
|
this.closeStream = stitchableStream.close;
|
4694
4709
|
let stream = stitchableStream.stream;
|
4695
4710
|
if (transform) {
|
4696
|
-
stream = stream.pipeThrough(
|
4711
|
+
stream = stream.pipeThrough(
|
4712
|
+
transform({
|
4713
|
+
tools,
|
4714
|
+
stopStream() {
|
4715
|
+
stitchableStream.terminate();
|
4716
|
+
}
|
4717
|
+
})
|
4718
|
+
);
|
4697
4719
|
}
|
4698
4720
|
this.baseStream = stream.pipeThrough(createOutputTransformStream(output)).pipeThrough(eventProcessor);
|
4699
4721
|
const { maxRetries, retry } = prepareRetries({
|