ai 6.0.178 → 6.0.180

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
@@ -1144,7 +1144,7 @@ import {
1144
1144
  } from "@ai-sdk/provider-utils";
1145
1145
 
1146
1146
  // src/version.ts
1147
- var VERSION = true ? "6.0.178" : "0.0.0-test";
1147
+ var VERSION = true ? "6.0.180" : "0.0.0-test";
1148
1148
 
1149
1149
  // src/util/download/download.ts
1150
1150
  var download = async ({
@@ -2560,12 +2560,13 @@ function mergeObjects(base, overrides) {
2560
2560
 
2561
2561
  // src/util/retry-with-exponential-backoff.ts
2562
2562
  import { APICallError as APICallError2 } from "@ai-sdk/provider";
2563
+ import { GatewayError } from "@ai-sdk/gateway";
2563
2564
  import { delay, getErrorMessage as getErrorMessage4, isAbortError } from "@ai-sdk/provider-utils";
2564
2565
  function getRetryDelayInMs({
2565
2566
  error,
2566
2567
  exponentialBackoffDelay
2567
2568
  }) {
2568
- const headers = error.responseHeaders;
2569
+ const headers = APICallError2.isInstance(error) ? error.responseHeaders : APICallError2.isInstance(error.cause) ? error.cause.responseHeaders : void 0;
2569
2570
  if (!headers)
2570
2571
  return exponentialBackoffDelay;
2571
2572
  let ms;
@@ -2626,7 +2627,7 @@ async function _retryWithExponentialBackoff(f, {
2626
2627
  errors: newErrors
2627
2628
  });
2628
2629
  }
2629
- if (error instanceof Error && APICallError2.isInstance(error) && error.isRetryable === true && tryNumber <= maxRetries) {
2630
+ if (error instanceof Error && (APICallError2.isInstance(error) && error.isRetryable === true || GatewayError.isInstance(error) && error.isRetryable === true) && tryNumber <= maxRetries) {
2630
2631
  await delay(
2631
2632
  getRetryDelayInMs({
2632
2633
  error,