ai 4.1.22 → 4.1.24

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
+ ## 4.1.24
4
+
5
+ ### Patch Changes
6
+
7
+ - 38142b8: feat (ai/core): introduce streamText consumeStream
8
+
9
+ ## 4.1.23
10
+
11
+ ### Patch Changes
12
+
13
+ - b08f7c1: fix (ai/core): suppress errors in textStream
14
+
3
15
  ## 4.1.22
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2116,6 +2116,13 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2116
2116
  */
2117
2117
  readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2118
2118
  /**
2119
+ Consumes the stream without processing the parts.
2120
+ This is useful to force the stream to finish.
2121
+ It effectively removes the backpressure and allows the stream to finish,
2122
+ triggering the `onFinish` callback and the promise resolution.
2123
+ */
2124
+ consumeStream(): Promise<void>;
2125
+ /**
2119
2126
  Converts the result to a data stream.
2120
2127
 
2121
2128
  @param data an optional StreamData object that will be merged into the stream.
package/dist/index.d.ts CHANGED
@@ -2116,6 +2116,13 @@ interface StreamTextResult<TOOLS extends ToolSet, PARTIAL_OUTPUT> {
2116
2116
  */
2117
2117
  readonly experimental_partialOutputStream: AsyncIterableStream<PARTIAL_OUTPUT>;
2118
2118
  /**
2119
+ Consumes the stream without processing the parts.
2120
+ This is useful to force the stream to finish.
2121
+ It effectively removes the backpressure and allows the stream to finish,
2122
+ triggering the `onFinish` callback and the promise resolution.
2123
+ */
2124
+ consumeStream(): Promise<void>;
2125
+ /**
2119
2126
  Converts the result to a data stream.
2120
2127
 
2121
2128
  @param data an optional StreamData object that will be merged into the stream.
package/dist/index.js CHANGED
@@ -5504,8 +5504,6 @@ var DefaultStreamTextResult = class {
5504
5504
  transform({ part }, controller) {
5505
5505
  if (part.type === "text-delta") {
5506
5506
  controller.enqueue(part.textDelta);
5507
- } else if (part.type === "error") {
5508
- controller.error(part.error);
5509
5507
  }
5510
5508
  }
5511
5509
  })
@@ -5523,6 +5521,11 @@ var DefaultStreamTextResult = class {
5523
5521
  )
5524
5522
  );
5525
5523
  }
5524
+ async consumeStream() {
5525
+ const stream = this.fullStream;
5526
+ for await (const part of stream) {
5527
+ }
5528
+ }
5526
5529
  get experimental_partialOutputStream() {
5527
5530
  if (this.output == null) {
5528
5531
  throw new NoOutputSpecifiedError();