ai 5.0.278 → 5.0.279

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # ai
2
2
 
3
+ ## 5.0.279
4
+
5
+ ### Patch Changes
6
+
7
+ - 11b886a: Stop forwarding buffered source stream parts after a transform calls `stopStream()`. This prevents text and errors from appearing after the transform emits its finish events.
8
+ - Updated dependencies [d7b0ffa]
9
+ - Updated dependencies [5a96038]
10
+ - Updated dependencies [fd50c4d]
11
+ - Updated dependencies [4146790]
12
+ - @ai-sdk/provider-utils@3.0.42
13
+ - @ai-sdk/gateway@2.0.170
14
+
3
15
  ## 5.0.278
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -817,7 +817,7 @@ function detectMediaType({
817
817
  var import_provider_utils2 = require("@ai-sdk/provider-utils");
818
818
 
819
819
  // src/version.ts
820
- var VERSION = true ? "5.0.278" : "0.0.0-test";
820
+ var VERSION = true ? "5.0.279" : "0.0.0-test";
821
821
 
822
822
  // src/util/download/download.ts
823
823
  var download = async ({
@@ -5415,12 +5415,23 @@ var DefaultStreamTextResult = class {
5415
5415
  return stitchableStream.stream.cancel(reason);
5416
5416
  }
5417
5417
  });
5418
+ let isRunning = true;
5419
+ stream = stream.pipeThrough(
5420
+ new TransformStream({
5421
+ async transform(chunk, controller) {
5422
+ if (isRunning) {
5423
+ controller.enqueue(chunk);
5424
+ }
5425
+ }
5426
+ })
5427
+ );
5418
5428
  for (const transform of transforms) {
5419
5429
  stream = stream.pipeThrough(
5420
5430
  transform({
5421
5431
  tools,
5422
5432
  stopStream() {
5423
5433
  stitchableStream.terminate();
5434
+ isRunning = false;
5424
5435
  }
5425
5436
  })
5426
5437
  );