ai 6.0.309 → 6.0.311

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,18 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.311
4
+
5
+ ### Patch Changes
6
+
7
+ - af9972b: fix(ai): stop emitting buffered stream parts after a `streamText` transform calls `stopStream`
8
+
9
+ ## 6.0.310
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [37be196]
14
+ - @ai-sdk/gateway@3.0.218
15
+
3
16
  ## 6.0.309
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1335,7 +1335,7 @@ function detectMediaType({
1335
1335
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1336
1336
 
1337
1337
  // src/version.ts
1338
- var VERSION = true ? "6.0.309" : "0.0.0-test";
1338
+ var VERSION = true ? "6.0.311" : "0.0.0-test";
1339
1339
 
1340
1340
  // src/util/download/download.ts
1341
1341
  var download = async ({
@@ -8028,12 +8028,23 @@ var DefaultStreamTextResult = class {
8028
8028
  return stitchableStream.stream.cancel(reason);
8029
8029
  }
8030
8030
  });
8031
+ let isRunning = true;
8032
+ stream = stream.pipeThrough(
8033
+ new TransformStream({
8034
+ async transform(chunk, controller) {
8035
+ if (isRunning) {
8036
+ controller.enqueue(chunk);
8037
+ }
8038
+ }
8039
+ })
8040
+ );
8031
8041
  for (const transform of transforms) {
8032
8042
  stream = stream.pipeThrough(
8033
8043
  transform({
8034
8044
  tools,
8035
8045
  stopStream() {
8036
8046
  stitchableStream.terminate();
8047
+ isRunning = false;
8037
8048
  }
8038
8049
  })
8039
8050
  );