ai 3.0.32 → 3.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/dist/index.mjs CHANGED
@@ -274,7 +274,7 @@ function convertZodToJSONSchema(zodSchema) {
274
274
 
275
275
  // core/util/retry-with-exponential-backoff.ts
276
276
  import { APICallError, RetryError } from "@ai-sdk/provider";
277
- import { getErrorMessage } from "@ai-sdk/provider-utils";
277
+ import { getErrorMessage, isAbortError } from "@ai-sdk/provider-utils";
278
278
 
279
279
  // core/util/delay.ts
280
280
  async function delay(delayInMs) {
@@ -299,7 +299,7 @@ async function _retryWithExponentialBackoff(f, {
299
299
  try {
300
300
  return await f();
301
301
  } catch (error) {
302
- if (error instanceof Error && error.name === "AbortError") {
302
+ if (isAbortError(error)) {
303
303
  throw error;
304
304
  }
305
305
  if (maxRetries === 0) {
@@ -1321,25 +1321,27 @@ function runToolsTransformation({
1321
1321
  });
1322
1322
  return new ReadableStream({
1323
1323
  async start(controller) {
1324
- generatorStream.pipeThrough(forwardStream).pipeTo(
1325
- new WritableStream({
1326
- write(chunk) {
1327
- controller.enqueue(chunk);
1328
- },
1329
- close() {
1330
- }
1331
- })
1332
- );
1333
- toolResultsStream.pipeTo(
1334
- new WritableStream({
1335
- write(chunk) {
1336
- controller.enqueue(chunk);
1337
- },
1338
- close() {
1339
- controller.close();
1340
- }
1341
- })
1342
- );
1324
+ return Promise.all([
1325
+ generatorStream.pipeThrough(forwardStream).pipeTo(
1326
+ new WritableStream({
1327
+ write(chunk) {
1328
+ controller.enqueue(chunk);
1329
+ },
1330
+ close() {
1331
+ }
1332
+ })
1333
+ ),
1334
+ toolResultsStream.pipeTo(
1335
+ new WritableStream({
1336
+ write(chunk) {
1337
+ controller.enqueue(chunk);
1338
+ },
1339
+ close() {
1340
+ controller.close();
1341
+ }
1342
+ })
1343
+ )
1344
+ ]);
1343
1345
  }
1344
1346
  });
1345
1347
  }
@@ -1915,7 +1917,7 @@ function readableFromAsyncIterable(iterable) {
1915
1917
  }
1916
1918
 
1917
1919
  // streams/stream-data.ts
1918
- var StreamData2 = class {
1920
+ var StreamData = class {
1919
1921
  constructor() {
1920
1922
  this.encoder = new TextEncoder();
1921
1923
  this.controller = null;
@@ -2011,7 +2013,7 @@ function createStreamDataTransformer() {
2011
2013
  }
2012
2014
  });
2013
2015
  }
2014
- var experimental_StreamData = class extends StreamData2 {
2016
+ var experimental_StreamData = class extends StreamData {
2015
2017
  };
2016
2018
 
2017
2019
  // streams/anthropic-stream.ts
@@ -2955,7 +2957,7 @@ export {
2955
2957
  MistralStream,
2956
2958
  OpenAIStream,
2957
2959
  ReplicateStream,
2958
- StreamData2 as StreamData,
2960
+ StreamData,
2959
2961
  StreamObjectResult,
2960
2962
  StreamTextResult,
2961
2963
  StreamingTextResponse,