@ai-sdk/gateway 4.0.14 → 4.0.16

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.js CHANGED
@@ -61,13 +61,13 @@ import {
61
61
  withoutTrailingSlash,
62
62
  withUserAgentSuffix
63
63
  } from "@ai-sdk/provider-utils";
64
- import { z as z17 } from "zod/v4";
64
+ import { z as z18 } from "zod/v4";
65
65
 
66
66
  // src/errors/as-gateway-error.ts
67
67
  import { APICallError } from "@ai-sdk/provider";
68
68
 
69
69
  // src/errors/create-gateway-error.ts
70
- import { z as z2 } from "zod/v4";
70
+ import { z as z3 } from "zod/v4";
71
71
 
72
72
  // src/errors/gateway-error.ts
73
73
  var marker = "vercel.ai.gateway.error";
@@ -299,22 +299,33 @@ var GatewayFailedDependencyError = class extends (_b7 = GatewayError, _a7 = symb
299
299
  };
300
300
 
301
301
  // src/errors/gateway-forbidden-error.ts
302
+ import { z as z2 } from "zod/v4";
303
+ import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
302
304
  var name7 = "GatewayForbiddenError";
303
305
  var marker8 = `vercel.ai.gateway.error.${name7}`;
304
306
  var symbol8 = Symbol.for(marker8);
307
+ var forbiddenParamSchema = lazySchema2(
308
+ () => zodSchema2(
309
+ z2.object({
310
+ ruleId: z2.string()
311
+ })
312
+ )
313
+ );
305
314
  var _a8, _b8;
306
315
  var GatewayForbiddenError = class extends (_b8 = GatewayError, _a8 = symbol8, _b8) {
307
316
  constructor({
308
317
  message = "Forbidden",
309
318
  statusCode = 403,
310
319
  cause,
311
- generationId
320
+ generationId,
321
+ ruleId
312
322
  } = {}) {
313
323
  super({ message, statusCode, cause, generationId });
314
324
  this[_a8] = true;
315
325
  // used in isInstance
316
326
  this.name = name7;
317
327
  this.type = "forbidden";
328
+ this.ruleId = ruleId;
318
329
  }
319
330
  static isInstance(error) {
320
331
  return GatewayError.hasMarker(error) && symbol8 in error;
@@ -350,9 +361,9 @@ var GatewayResponseError = class extends (_b9 = GatewayError, _a9 = symbol9, _b9
350
361
 
351
362
  // src/errors/create-gateway-error.ts
352
363
  import {
353
- lazySchema as lazySchema2,
364
+ lazySchema as lazySchema3,
354
365
  safeValidateTypes,
355
- zodSchema as zodSchema2
366
+ zodSchema as zodSchema3
356
367
  } from "@ai-sdk/provider-utils";
357
368
  async function createGatewayErrorFromResponse({
358
369
  response,
@@ -431,13 +442,19 @@ async function createGatewayErrorFromResponse({
431
442
  cause,
432
443
  generationId
433
444
  });
434
- case "forbidden":
445
+ case "forbidden": {
446
+ const ruleResult = await safeValidateTypes({
447
+ value: validatedResponse.error.param,
448
+ schema: forbiddenParamSchema
449
+ });
435
450
  return new GatewayForbiddenError({
436
451
  message,
437
452
  statusCode,
438
453
  cause,
439
- generationId
454
+ generationId,
455
+ ruleId: ruleResult.success ? ruleResult.value.ruleId : void 0
440
456
  });
457
+ }
441
458
  default:
442
459
  return new GatewayInternalServerError({
443
460
  message,
@@ -447,16 +464,16 @@ async function createGatewayErrorFromResponse({
447
464
  });
448
465
  }
449
466
  }
450
- var gatewayErrorResponseSchema = lazySchema2(
451
- () => zodSchema2(
452
- z2.object({
453
- error: z2.object({
454
- message: z2.string(),
455
- type: z2.string().nullish(),
456
- param: z2.unknown().nullish(),
457
- code: z2.union([z2.string(), z2.number()]).nullish()
467
+ var gatewayErrorResponseSchema = lazySchema3(
468
+ () => zodSchema3(
469
+ z3.object({
470
+ error: z3.object({
471
+ message: z3.string(),
472
+ type: z3.string().nullish(),
473
+ param: z3.unknown().nullish(),
474
+ code: z3.union([z3.string(), z3.number()]).nullish()
458
475
  }),
459
- generationId: z2.string().nullish()
476
+ generationId: z3.string().nullish()
460
477
  })
461
478
  )
462
479
  );
@@ -575,11 +592,11 @@ var GATEWAY_AUTH_METHOD_HEADER = "ai-gateway-auth-method";
575
592
  var VERCEL_AI_GATEWAY_TEAM_HEADER = "x-vercel-ai-gateway-team";
576
593
 
577
594
  // src/errors/parse-auth-method.ts
578
- import { z as z3 } from "zod/v4";
595
+ import { z as z4 } from "zod/v4";
579
596
  import {
580
- lazySchema as lazySchema3,
597
+ lazySchema as lazySchema4,
581
598
  safeValidateTypes as safeValidateTypes2,
582
- zodSchema as zodSchema3
599
+ zodSchema as zodSchema4
583
600
  } from "@ai-sdk/provider-utils";
584
601
  async function parseAuthMethod(headers) {
585
602
  const result = await safeValidateTypes2({
@@ -588,8 +605,8 @@ async function parseAuthMethod(headers) {
588
605
  });
589
606
  return result.success ? result.value : void 0;
590
607
  }
591
- var gatewayAuthMethodSchema = lazySchema3(
592
- () => zodSchema3(z3.union([z3.literal("api-key"), z3.literal("oidc")]))
608
+ var gatewayAuthMethodSchema = lazySchema4(
609
+ () => zodSchema4(z4.union([z4.literal("api-key"), z4.literal("oidc")]))
593
610
  );
594
611
 
595
612
  // src/gateway-fetch-metadata.ts
@@ -597,11 +614,11 @@ import {
597
614
  createJsonErrorResponseHandler,
598
615
  createJsonResponseHandler,
599
616
  getFromApi,
600
- lazySchema as lazySchema4,
617
+ lazySchema as lazySchema5,
601
618
  resolve,
602
- zodSchema as zodSchema4
619
+ zodSchema as zodSchema5
603
620
  } from "@ai-sdk/provider-utils";
604
- import { z as z4 } from "zod/v4";
621
+ import { z as z5 } from "zod/v4";
605
622
 
606
623
  // src/gateway-model-entry.ts
607
624
  var KNOWN_MODEL_TYPES = [
@@ -629,7 +646,7 @@ var GatewayFetchMetadata = class {
629
646
  gatewayAvailableModelsResponseSchema
630
647
  ),
631
648
  failedResponseHandler: createJsonErrorResponseHandler({
632
- errorSchema: z4.any(),
649
+ errorSchema: z5.any(),
633
650
  errorToMessage: (data) => data
634
651
  }),
635
652
  fetch: this.config.fetch
@@ -649,7 +666,7 @@ var GatewayFetchMetadata = class {
649
666
  gatewayCreditsResponseSchema
650
667
  ),
651
668
  failedResponseHandler: createJsonErrorResponseHandler({
652
- errorSchema: z4.any(),
669
+ errorSchema: z5.any(),
653
670
  errorToMessage: (data) => data
654
671
  }),
655
672
  fetch: this.config.fetch
@@ -660,19 +677,19 @@ var GatewayFetchMetadata = class {
660
677
  }
661
678
  }
662
679
  };
663
- var gatewayAvailableModelsResponseSchema = lazySchema4(
664
- () => zodSchema4(
665
- z4.object({
666
- models: z4.array(
667
- z4.object({
668
- id: z4.string(),
669
- name: z4.string(),
670
- description: z4.string().nullish(),
671
- pricing: z4.object({
672
- input: z4.string(),
673
- output: z4.string(),
674
- input_cache_read: z4.string().nullish(),
675
- input_cache_write: z4.string().nullish()
680
+ var gatewayAvailableModelsResponseSchema = lazySchema5(
681
+ () => zodSchema5(
682
+ z5.object({
683
+ models: z5.array(
684
+ z5.object({
685
+ id: z5.string(),
686
+ name: z5.string(),
687
+ description: z5.string().nullish(),
688
+ pricing: z5.object({
689
+ input: z5.string(),
690
+ output: z5.string(),
691
+ input_cache_read: z5.string().nullish(),
692
+ input_cache_write: z5.string().nullish()
676
693
  }).transform(
677
694
  ({ input, output, input_cache_read, input_cache_write }) => ({
678
695
  input,
@@ -681,12 +698,12 @@ var gatewayAvailableModelsResponseSchema = lazySchema4(
681
698
  ...input_cache_write ? { cacheCreationInputTokens: input_cache_write } : {}
682
699
  })
683
700
  ).nullish(),
684
- specification: z4.object({
685
- specificationVersion: z4.literal("v4"),
686
- provider: z4.string(),
687
- modelId: z4.string()
701
+ specification: z5.object({
702
+ specificationVersion: z5.literal("v4"),
703
+ provider: z5.string(),
704
+ modelId: z5.string()
688
705
  }),
689
- modelType: z4.string().nullish()
706
+ modelType: z5.string().nullish()
690
707
  })
691
708
  ).transform(
692
709
  (models) => models.filter(
@@ -696,11 +713,11 @@ var gatewayAvailableModelsResponseSchema = lazySchema4(
696
713
  })
697
714
  )
698
715
  );
699
- var gatewayCreditsResponseSchema = lazySchema4(
700
- () => zodSchema4(
701
- z4.object({
702
- balance: z4.string(),
703
- total_used: z4.string()
716
+ var gatewayCreditsResponseSchema = lazySchema5(
717
+ () => zodSchema5(
718
+ z5.object({
719
+ balance: z5.string(),
720
+ total_used: z5.string()
704
721
  }).transform(({ balance, total_used }) => ({
705
722
  balance,
706
723
  totalUsed: total_used
@@ -713,11 +730,11 @@ import {
713
730
  createJsonErrorResponseHandler as createJsonErrorResponseHandler2,
714
731
  createJsonResponseHandler as createJsonResponseHandler2,
715
732
  getFromApi as getFromApi2,
716
- lazySchema as lazySchema5,
733
+ lazySchema as lazySchema6,
717
734
  resolve as resolve2,
718
- zodSchema as zodSchema5
735
+ zodSchema as zodSchema6
719
736
  } from "@ai-sdk/provider-utils";
720
- import { z as z5 } from "zod/v4";
737
+ import { z as z6 } from "zod/v4";
721
738
  var GatewaySpendReport = class {
722
739
  constructor(config) {
723
740
  this.config = config;
@@ -756,7 +773,7 @@ var GatewaySpendReport = class {
756
773
  gatewaySpendReportResponseSchema
757
774
  ),
758
775
  failedResponseHandler: createJsonErrorResponseHandler2({
759
- errorSchema: z5.any(),
776
+ errorSchema: z6.any(),
760
777
  errorToMessage: (data) => data
761
778
  }),
762
779
  fetch: this.config.fetch
@@ -767,26 +784,26 @@ var GatewaySpendReport = class {
767
784
  }
768
785
  }
769
786
  };
770
- var gatewaySpendReportResponseSchema = lazySchema5(
771
- () => zodSchema5(
772
- z5.object({
773
- results: z5.array(
774
- z5.object({
775
- day: z5.string().optional(),
776
- hour: z5.string().optional(),
777
- user: z5.string().optional(),
778
- model: z5.string().optional(),
779
- tag: z5.string().optional(),
780
- provider: z5.string().optional(),
781
- credential_type: z5.enum(["byok", "system"]).optional(),
782
- total_cost: z5.number(),
783
- market_cost: z5.number().optional(),
784
- input_tokens: z5.number().optional(),
785
- output_tokens: z5.number().optional(),
786
- cached_input_tokens: z5.number().optional(),
787
- cache_creation_input_tokens: z5.number().optional(),
788
- reasoning_tokens: z5.number().optional(),
789
- request_count: z5.number().optional()
787
+ var gatewaySpendReportResponseSchema = lazySchema6(
788
+ () => zodSchema6(
789
+ z6.object({
790
+ results: z6.array(
791
+ z6.object({
792
+ day: z6.string().optional(),
793
+ hour: z6.string().optional(),
794
+ user: z6.string().optional(),
795
+ model: z6.string().optional(),
796
+ tag: z6.string().optional(),
797
+ provider: z6.string().optional(),
798
+ credential_type: z6.enum(["byok", "system"]).optional(),
799
+ total_cost: z6.number(),
800
+ market_cost: z6.number().optional(),
801
+ input_tokens: z6.number().optional(),
802
+ output_tokens: z6.number().optional(),
803
+ cached_input_tokens: z6.number().optional(),
804
+ cache_creation_input_tokens: z6.number().optional(),
805
+ reasoning_tokens: z6.number().optional(),
806
+ request_count: z6.number().optional()
790
807
  }).transform(
791
808
  ({
792
809
  credential_type,
@@ -822,11 +839,11 @@ import {
822
839
  createJsonErrorResponseHandler as createJsonErrorResponseHandler3,
823
840
  createJsonResponseHandler as createJsonResponseHandler3,
824
841
  getFromApi as getFromApi3,
825
- lazySchema as lazySchema6,
842
+ lazySchema as lazySchema7,
826
843
  resolve as resolve3,
827
- zodSchema as zodSchema6
844
+ zodSchema as zodSchema7
828
845
  } from "@ai-sdk/provider-utils";
829
- import { z as z6 } from "zod/v4";
846
+ import { z as z7 } from "zod/v4";
830
847
  var GatewayGenerationInfoFetcher = class {
831
848
  constructor(config) {
832
849
  this.config = config;
@@ -841,7 +858,7 @@ var GatewayGenerationInfoFetcher = class {
841
858
  gatewayGenerationInfoResponseSchema
842
859
  ),
843
860
  failedResponseHandler: createJsonErrorResponseHandler3({
844
- errorSchema: z6.any(),
861
+ errorSchema: z7.any(),
845
862
  errorToMessage: (data) => data
846
863
  }),
847
864
  fetch: this.config.fetch
@@ -852,28 +869,28 @@ var GatewayGenerationInfoFetcher = class {
852
869
  }
853
870
  }
854
871
  };
855
- var gatewayGenerationInfoResponseSchema = lazySchema6(
856
- () => zodSchema6(
857
- z6.object({
858
- data: z6.object({
859
- id: z6.string(),
860
- total_cost: z6.number(),
861
- upstream_inference_cost: z6.number(),
862
- usage: z6.number(),
863
- created_at: z6.string(),
864
- model: z6.string(),
865
- is_byok: z6.boolean(),
866
- provider_name: z6.string(),
867
- streamed: z6.boolean(),
868
- finish_reason: z6.string(),
869
- latency: z6.number(),
870
- generation_time: z6.number(),
871
- native_tokens_prompt: z6.number(),
872
- native_tokens_completion: z6.number(),
873
- native_tokens_reasoning: z6.number(),
874
- native_tokens_cached: z6.number(),
875
- native_tokens_cache_creation: z6.number(),
876
- billable_web_search_calls: z6.number()
872
+ var gatewayGenerationInfoResponseSchema = lazySchema7(
873
+ () => zodSchema7(
874
+ z7.object({
875
+ data: z7.object({
876
+ id: z7.string(),
877
+ total_cost: z7.number(),
878
+ upstream_inference_cost: z7.number(),
879
+ usage: z7.number(),
880
+ created_at: z7.string(),
881
+ model: z7.string(),
882
+ is_byok: z7.boolean(),
883
+ provider_name: z7.string(),
884
+ streamed: z7.boolean(),
885
+ finish_reason: z7.string(),
886
+ latency: z7.number(),
887
+ generation_time: z7.number(),
888
+ native_tokens_prompt: z7.number(),
889
+ native_tokens_completion: z7.number(),
890
+ native_tokens_reasoning: z7.number(),
891
+ native_tokens_cached: z7.number(),
892
+ native_tokens_cache_creation: z7.number(),
893
+ billable_web_search_calls: z7.number()
877
894
  }).transform(
878
895
  ({
879
896
  total_cost,
@@ -923,7 +940,7 @@ import {
923
940
  WORKFLOW_SERIALIZE,
924
941
  WORKFLOW_DESERIALIZE
925
942
  } from "@ai-sdk/provider-utils";
926
- import { z as z7 } from "zod/v4";
943
+ import { z as z8 } from "zod/v4";
927
944
  var GatewayLanguageModel = class _GatewayLanguageModel {
928
945
  constructor(modelId, config) {
929
946
  this.modelId = modelId;
@@ -968,9 +985,9 @@ var GatewayLanguageModel = class _GatewayLanguageModel {
968
985
  await resolve4(this.config.o11yHeaders)
969
986
  ),
970
987
  body: args,
971
- successfulResponseHandler: createJsonResponseHandler4(z7.any()),
988
+ successfulResponseHandler: createJsonResponseHandler4(z8.any()),
972
989
  failedResponseHandler: createJsonErrorResponseHandler4({
973
- errorSchema: z7.any(),
990
+ errorSchema: z8.any(),
974
991
  errorToMessage: (data) => data
975
992
  }),
976
993
  ...abortSignal && { abortSignal },
@@ -1003,9 +1020,9 @@ var GatewayLanguageModel = class _GatewayLanguageModel {
1003
1020
  await resolve4(this.config.o11yHeaders)
1004
1021
  ),
1005
1022
  body: args,
1006
- successfulResponseHandler: createEventSourceResponseHandler(z7.any()),
1023
+ successfulResponseHandler: createEventSourceResponseHandler(z8.any()),
1007
1024
  failedResponseHandler: createJsonErrorResponseHandler4({
1008
- errorSchema: z7.any(),
1025
+ errorSchema: z8.any(),
1009
1026
  errorToMessage: (data) => data
1010
1027
  }),
1011
1028
  ...abortSignal && { abortSignal },
@@ -1097,15 +1114,15 @@ import {
1097
1114
  combineHeaders as combineHeaders2,
1098
1115
  createJsonErrorResponseHandler as createJsonErrorResponseHandler5,
1099
1116
  createJsonResponseHandler as createJsonResponseHandler5,
1100
- lazySchema as lazySchema7,
1117
+ lazySchema as lazySchema8,
1101
1118
  postJsonToApi as postJsonToApi2,
1102
1119
  resolve as resolve5,
1103
1120
  serializeModelOptions as serializeModelOptions2,
1104
1121
  WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE2,
1105
1122
  WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE2,
1106
- zodSchema as zodSchema7
1123
+ zodSchema as zodSchema8
1107
1124
  } from "@ai-sdk/provider-utils";
1108
- import { z as z8 } from "zod/v4";
1125
+ import { z as z9 } from "zod/v4";
1109
1126
  var GatewayEmbeddingModel = class _GatewayEmbeddingModel {
1110
1127
  constructor(modelId, config) {
1111
1128
  this.modelId = modelId;
@@ -1155,7 +1172,7 @@ var GatewayEmbeddingModel = class _GatewayEmbeddingModel {
1155
1172
  gatewayEmbeddingResponseSchema
1156
1173
  ),
1157
1174
  failedResponseHandler: createJsonErrorResponseHandler5({
1158
- errorSchema: z8.any(),
1175
+ errorSchema: z9.any(),
1159
1176
  errorToMessage: (data) => data
1160
1177
  }),
1161
1178
  ...abortSignal && { abortSignal },
@@ -1185,34 +1202,34 @@ var GatewayEmbeddingModel = class _GatewayEmbeddingModel {
1185
1202
  };
1186
1203
  }
1187
1204
  };
1188
- var gatewayEmbeddingWarningSchema = z8.discriminatedUnion("type", [
1189
- z8.object({
1190
- type: z8.literal("unsupported"),
1191
- feature: z8.string(),
1192
- details: z8.string().optional()
1205
+ var gatewayEmbeddingWarningSchema = z9.discriminatedUnion("type", [
1206
+ z9.object({
1207
+ type: z9.literal("unsupported"),
1208
+ feature: z9.string(),
1209
+ details: z9.string().optional()
1193
1210
  }),
1194
- z8.object({
1195
- type: z8.literal("compatibility"),
1196
- feature: z8.string(),
1197
- details: z8.string().optional()
1211
+ z9.object({
1212
+ type: z9.literal("compatibility"),
1213
+ feature: z9.string(),
1214
+ details: z9.string().optional()
1198
1215
  }),
1199
- z8.object({
1200
- type: z8.literal("deprecated"),
1201
- setting: z8.string(),
1202
- message: z8.string()
1216
+ z9.object({
1217
+ type: z9.literal("deprecated"),
1218
+ setting: z9.string(),
1219
+ message: z9.string()
1203
1220
  }),
1204
- z8.object({
1205
- type: z8.literal("other"),
1206
- message: z8.string()
1221
+ z9.object({
1222
+ type: z9.literal("other"),
1223
+ message: z9.string()
1207
1224
  })
1208
1225
  ]);
1209
- var gatewayEmbeddingResponseSchema = lazySchema7(
1210
- () => zodSchema7(
1211
- z8.object({
1212
- embeddings: z8.array(z8.array(z8.number())),
1213
- usage: z8.object({ tokens: z8.number() }).nullish(),
1214
- warnings: z8.array(gatewayEmbeddingWarningSchema).optional(),
1215
- providerMetadata: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())).optional()
1226
+ var gatewayEmbeddingResponseSchema = lazySchema8(
1227
+ () => zodSchema8(
1228
+ z9.object({
1229
+ embeddings: z9.array(z9.array(z9.number())),
1230
+ usage: z9.object({ tokens: z9.number() }).nullish(),
1231
+ warnings: z9.array(gatewayEmbeddingWarningSchema).optional(),
1232
+ providerMetadata: z9.record(z9.string(), z9.record(z9.string(), z9.unknown())).optional()
1216
1233
  })
1217
1234
  )
1218
1235
  );
@@ -1229,7 +1246,7 @@ import {
1229
1246
  WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
1230
1247
  WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3
1231
1248
  } from "@ai-sdk/provider-utils";
1232
- import { z as z9 } from "zod/v4";
1249
+ import { z as z10 } from "zod/v4";
1233
1250
  var GatewayImageModel = class _GatewayImageModel {
1234
1251
  constructor(modelId, config) {
1235
1252
  this.modelId = modelId;
@@ -1289,7 +1306,7 @@ var GatewayImageModel = class _GatewayImageModel {
1289
1306
  gatewayImageResponseSchema
1290
1307
  ),
1291
1308
  failedResponseHandler: createJsonErrorResponseHandler6({
1292
- errorSchema: z9.any(),
1309
+ errorSchema: z10.any(),
1293
1310
  errorToMessage: (data) => data
1294
1311
  }),
1295
1312
  ...abortSignal && { abortSignal },
@@ -1339,40 +1356,40 @@ function maybeEncodeImageFile(file) {
1339
1356
  }
1340
1357
  return file;
1341
1358
  }
1342
- var providerMetadataEntrySchema = z9.object({
1343
- images: z9.array(z9.unknown()).optional()
1344
- }).catchall(z9.unknown());
1345
- var gatewayImageWarningSchema = z9.discriminatedUnion("type", [
1346
- z9.object({
1347
- type: z9.literal("unsupported"),
1348
- feature: z9.string(),
1349
- details: z9.string().optional()
1359
+ var providerMetadataEntrySchema = z10.object({
1360
+ images: z10.array(z10.unknown()).optional()
1361
+ }).catchall(z10.unknown());
1362
+ var gatewayImageWarningSchema = z10.discriminatedUnion("type", [
1363
+ z10.object({
1364
+ type: z10.literal("unsupported"),
1365
+ feature: z10.string(),
1366
+ details: z10.string().optional()
1350
1367
  }),
1351
- z9.object({
1352
- type: z9.literal("compatibility"),
1353
- feature: z9.string(),
1354
- details: z9.string().optional()
1368
+ z10.object({
1369
+ type: z10.literal("compatibility"),
1370
+ feature: z10.string(),
1371
+ details: z10.string().optional()
1355
1372
  }),
1356
- z9.object({
1357
- type: z9.literal("deprecated"),
1358
- setting: z9.string(),
1359
- message: z9.string()
1373
+ z10.object({
1374
+ type: z10.literal("deprecated"),
1375
+ setting: z10.string(),
1376
+ message: z10.string()
1360
1377
  }),
1361
- z9.object({
1362
- type: z9.literal("other"),
1363
- message: z9.string()
1378
+ z10.object({
1379
+ type: z10.literal("other"),
1380
+ message: z10.string()
1364
1381
  })
1365
1382
  ]);
1366
- var gatewayImageUsageSchema = z9.object({
1367
- inputTokens: z9.number().nullish(),
1368
- outputTokens: z9.number().nullish(),
1369
- totalTokens: z9.number().nullish()
1383
+ var gatewayImageUsageSchema = z10.object({
1384
+ inputTokens: z10.number().nullish(),
1385
+ outputTokens: z10.number().nullish(),
1386
+ totalTokens: z10.number().nullish()
1370
1387
  });
1371
- var gatewayImageResponseSchema = z9.object({
1372
- images: z9.array(z9.string()),
1388
+ var gatewayImageResponseSchema = z10.object({
1389
+ images: z10.array(z10.string()),
1373
1390
  // Always base64 strings over the wire
1374
- warnings: z9.array(gatewayImageWarningSchema).optional(),
1375
- providerMetadata: z9.record(z9.string(), providerMetadataEntrySchema).optional(),
1391
+ warnings: z10.array(gatewayImageWarningSchema).optional(),
1392
+ providerMetadata: z10.record(z10.string(), providerMetadataEntrySchema).optional(),
1376
1393
  usage: gatewayImageUsageSchema.optional()
1377
1394
  });
1378
1395
 
@@ -1388,7 +1405,7 @@ import {
1388
1405
  postJsonToApi as postJsonToApi4,
1389
1406
  resolve as resolve7
1390
1407
  } from "@ai-sdk/provider-utils";
1391
- import { z as z10 } from "zod/v4";
1408
+ import { z as z11 } from "zod/v4";
1392
1409
  var GatewayVideoModel = class {
1393
1410
  constructor(modelId, config) {
1394
1411
  this.modelId = modelId;
@@ -1516,7 +1533,7 @@ var GatewayVideoModel = class {
1516
1533
  };
1517
1534
  },
1518
1535
  failedResponseHandler: createJsonErrorResponseHandler7({
1519
- errorSchema: z10.any(),
1536
+ errorSchema: z11.any(),
1520
1537
  errorToMessage: (data) => data
1521
1538
  }),
1522
1539
  ...abortSignal && { abortSignal },
@@ -1558,55 +1575,55 @@ function maybeEncodeVideoFile(file) {
1558
1575
  }
1559
1576
  return file;
1560
1577
  }
1561
- var providerMetadataEntrySchema2 = z10.object({
1562
- videos: z10.array(z10.unknown()).optional()
1563
- }).catchall(z10.unknown());
1564
- var gatewayVideoDataSchema = z10.union([
1565
- z10.object({
1566
- type: z10.literal("url"),
1567
- url: z10.string(),
1568
- mediaType: z10.string()
1578
+ var providerMetadataEntrySchema2 = z11.object({
1579
+ videos: z11.array(z11.unknown()).optional()
1580
+ }).catchall(z11.unknown());
1581
+ var gatewayVideoDataSchema = z11.union([
1582
+ z11.object({
1583
+ type: z11.literal("url"),
1584
+ url: z11.string(),
1585
+ mediaType: z11.string()
1569
1586
  }),
1570
- z10.object({
1571
- type: z10.literal("base64"),
1572
- data: z10.string(),
1573
- mediaType: z10.string()
1587
+ z11.object({
1588
+ type: z11.literal("base64"),
1589
+ data: z11.string(),
1590
+ mediaType: z11.string()
1574
1591
  })
1575
1592
  ]);
1576
- var gatewayVideoWarningSchema = z10.discriminatedUnion("type", [
1577
- z10.object({
1578
- type: z10.literal("unsupported"),
1579
- feature: z10.string(),
1580
- details: z10.string().optional()
1593
+ var gatewayVideoWarningSchema = z11.discriminatedUnion("type", [
1594
+ z11.object({
1595
+ type: z11.literal("unsupported"),
1596
+ feature: z11.string(),
1597
+ details: z11.string().optional()
1581
1598
  }),
1582
- z10.object({
1583
- type: z10.literal("compatibility"),
1584
- feature: z10.string(),
1585
- details: z10.string().optional()
1599
+ z11.object({
1600
+ type: z11.literal("compatibility"),
1601
+ feature: z11.string(),
1602
+ details: z11.string().optional()
1586
1603
  }),
1587
- z10.object({
1588
- type: z10.literal("deprecated"),
1589
- setting: z10.string(),
1590
- message: z10.string()
1604
+ z11.object({
1605
+ type: z11.literal("deprecated"),
1606
+ setting: z11.string(),
1607
+ message: z11.string()
1591
1608
  }),
1592
- z10.object({
1593
- type: z10.literal("other"),
1594
- message: z10.string()
1609
+ z11.object({
1610
+ type: z11.literal("other"),
1611
+ message: z11.string()
1595
1612
  })
1596
1613
  ]);
1597
- var gatewayVideoEventSchema = z10.discriminatedUnion("type", [
1598
- z10.object({
1599
- type: z10.literal("result"),
1600
- videos: z10.array(gatewayVideoDataSchema),
1601
- warnings: z10.array(gatewayVideoWarningSchema).optional(),
1602
- providerMetadata: z10.record(z10.string(), providerMetadataEntrySchema2).optional()
1614
+ var gatewayVideoEventSchema = z11.discriminatedUnion("type", [
1615
+ z11.object({
1616
+ type: z11.literal("result"),
1617
+ videos: z11.array(gatewayVideoDataSchema),
1618
+ warnings: z11.array(gatewayVideoWarningSchema).optional(),
1619
+ providerMetadata: z11.record(z11.string(), providerMetadataEntrySchema2).optional()
1603
1620
  }),
1604
- z10.object({
1605
- type: z10.literal("error"),
1606
- message: z10.string(),
1607
- errorType: z10.string(),
1608
- statusCode: z10.number(),
1609
- param: z10.unknown().nullable()
1621
+ z11.object({
1622
+ type: z11.literal("error"),
1623
+ message: z11.string(),
1624
+ errorType: z11.string(),
1625
+ statusCode: z11.number(),
1626
+ param: z11.unknown().nullable()
1610
1627
  })
1611
1628
  ]);
1612
1629
 
@@ -1615,12 +1632,12 @@ import {
1615
1632
  combineHeaders as combineHeaders5,
1616
1633
  createJsonErrorResponseHandler as createJsonErrorResponseHandler8,
1617
1634
  createJsonResponseHandler as createJsonResponseHandler7,
1618
- lazySchema as lazySchema8,
1635
+ lazySchema as lazySchema9,
1619
1636
  postJsonToApi as postJsonToApi5,
1620
1637
  resolve as resolve8,
1621
- zodSchema as zodSchema8
1638
+ zodSchema as zodSchema9
1622
1639
  } from "@ai-sdk/provider-utils";
1623
- import { z as z11 } from "zod/v4";
1640
+ import { z as z12 } from "zod/v4";
1624
1641
  var GatewayRerankingModel = class {
1625
1642
  constructor(modelId, config) {
1626
1643
  this.modelId = modelId;
@@ -1663,7 +1680,7 @@ var GatewayRerankingModel = class {
1663
1680
  gatewayRerankingResponseSchema
1664
1681
  ),
1665
1682
  failedResponseHandler: createJsonErrorResponseHandler8({
1666
- errorSchema: z11.any(),
1683
+ errorSchema: z12.any(),
1667
1684
  errorToMessage: (data) => data
1668
1685
  }),
1669
1686
  ...abortSignal && { abortSignal },
@@ -1692,38 +1709,38 @@ var GatewayRerankingModel = class {
1692
1709
  };
1693
1710
  }
1694
1711
  };
1695
- var gatewayRerankingWarningSchema = z11.discriminatedUnion("type", [
1696
- z11.object({
1697
- type: z11.literal("unsupported"),
1698
- feature: z11.string(),
1699
- details: z11.string().optional()
1712
+ var gatewayRerankingWarningSchema = z12.discriminatedUnion("type", [
1713
+ z12.object({
1714
+ type: z12.literal("unsupported"),
1715
+ feature: z12.string(),
1716
+ details: z12.string().optional()
1700
1717
  }),
1701
- z11.object({
1702
- type: z11.literal("compatibility"),
1703
- feature: z11.string(),
1704
- details: z11.string().optional()
1718
+ z12.object({
1719
+ type: z12.literal("compatibility"),
1720
+ feature: z12.string(),
1721
+ details: z12.string().optional()
1705
1722
  }),
1706
- z11.object({
1707
- type: z11.literal("deprecated"),
1708
- setting: z11.string(),
1709
- message: z11.string()
1723
+ z12.object({
1724
+ type: z12.literal("deprecated"),
1725
+ setting: z12.string(),
1726
+ message: z12.string()
1710
1727
  }),
1711
- z11.object({
1712
- type: z11.literal("other"),
1713
- message: z11.string()
1728
+ z12.object({
1729
+ type: z12.literal("other"),
1730
+ message: z12.string()
1714
1731
  })
1715
1732
  ]);
1716
- var gatewayRerankingResponseSchema = lazySchema8(
1717
- () => zodSchema8(
1718
- z11.object({
1719
- ranking: z11.array(
1720
- z11.object({
1721
- index: z11.number(),
1722
- relevanceScore: z11.number()
1733
+ var gatewayRerankingResponseSchema = lazySchema9(
1734
+ () => zodSchema9(
1735
+ z12.object({
1736
+ ranking: z12.array(
1737
+ z12.object({
1738
+ index: z12.number(),
1739
+ relevanceScore: z12.number()
1723
1740
  })
1724
1741
  ),
1725
- warnings: z11.array(gatewayRerankingWarningSchema).optional(),
1726
- providerMetadata: z11.record(z11.string(), z11.record(z11.string(), z11.unknown())).optional()
1742
+ warnings: z12.array(gatewayRerankingWarningSchema).optional(),
1743
+ providerMetadata: z12.record(z12.string(), z12.record(z12.string(), z12.unknown())).optional()
1727
1744
  })
1728
1745
  )
1729
1746
  );
@@ -1736,7 +1753,7 @@ import {
1736
1753
  postJsonToApi as postJsonToApi6,
1737
1754
  resolve as resolve9
1738
1755
  } from "@ai-sdk/provider-utils";
1739
- import { z as z12 } from "zod/v4";
1756
+ import { z as z13 } from "zod/v4";
1740
1757
  var GatewaySpeechModel = class {
1741
1758
  constructor(modelId, config) {
1742
1759
  this.modelId = modelId;
@@ -1785,7 +1802,7 @@ var GatewaySpeechModel = class {
1785
1802
  gatewaySpeechResponseSchema
1786
1803
  ),
1787
1804
  failedResponseHandler: createJsonErrorResponseHandler9({
1788
- errorSchema: z12.any(),
1805
+ errorSchema: z13.any(),
1789
1806
  errorToMessage: (data) => data
1790
1807
  }),
1791
1808
  ...abortSignal && { abortSignal },
@@ -1819,32 +1836,32 @@ var GatewaySpeechModel = class {
1819
1836
  };
1820
1837
  }
1821
1838
  };
1822
- var providerMetadataEntrySchema3 = z12.object({}).catchall(z12.unknown());
1823
- var gatewaySpeechWarningSchema = z12.discriminatedUnion("type", [
1824
- z12.object({
1825
- type: z12.literal("unsupported"),
1826
- feature: z12.string(),
1827
- details: z12.string().optional()
1839
+ var providerMetadataEntrySchema3 = z13.object({}).catchall(z13.unknown());
1840
+ var gatewaySpeechWarningSchema = z13.discriminatedUnion("type", [
1841
+ z13.object({
1842
+ type: z13.literal("unsupported"),
1843
+ feature: z13.string(),
1844
+ details: z13.string().optional()
1828
1845
  }),
1829
- z12.object({
1830
- type: z12.literal("compatibility"),
1831
- feature: z12.string(),
1832
- details: z12.string().optional()
1846
+ z13.object({
1847
+ type: z13.literal("compatibility"),
1848
+ feature: z13.string(),
1849
+ details: z13.string().optional()
1833
1850
  }),
1834
- z12.object({
1835
- type: z12.literal("deprecated"),
1836
- setting: z12.string(),
1837
- message: z12.string()
1851
+ z13.object({
1852
+ type: z13.literal("deprecated"),
1853
+ setting: z13.string(),
1854
+ message: z13.string()
1838
1855
  }),
1839
- z12.object({
1840
- type: z12.literal("other"),
1841
- message: z12.string()
1856
+ z13.object({
1857
+ type: z13.literal("other"),
1858
+ message: z13.string()
1842
1859
  })
1843
1860
  ]);
1844
- var gatewaySpeechResponseSchema = z12.object({
1845
- audio: z12.string(),
1846
- warnings: z12.array(gatewaySpeechWarningSchema).optional(),
1847
- providerMetadata: z12.record(z12.string(), providerMetadataEntrySchema3).optional()
1861
+ var gatewaySpeechResponseSchema = z13.object({
1862
+ audio: z13.string(),
1863
+ warnings: z13.array(gatewaySpeechWarningSchema).optional(),
1864
+ providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema3).optional()
1848
1865
  });
1849
1866
 
1850
1867
  // src/gateway-transcription-model.ts
@@ -1856,7 +1873,7 @@ import {
1856
1873
  postJsonToApi as postJsonToApi7,
1857
1874
  resolve as resolve10
1858
1875
  } from "@ai-sdk/provider-utils";
1859
- import { z as z13 } from "zod/v4";
1876
+ import { z as z14 } from "zod/v4";
1860
1877
  var GatewayTranscriptionModel = class {
1861
1878
  constructor(modelId, config) {
1862
1879
  this.modelId = modelId;
@@ -1897,7 +1914,7 @@ var GatewayTranscriptionModel = class {
1897
1914
  gatewayTranscriptionResponseSchema
1898
1915
  ),
1899
1916
  failedResponseHandler: createJsonErrorResponseHandler10({
1900
- errorSchema: z13.any(),
1917
+ errorSchema: z14.any(),
1901
1918
  errorToMessage: (data) => data
1902
1919
  }),
1903
1920
  ...abortSignal && { abortSignal },
@@ -1934,41 +1951,41 @@ var GatewayTranscriptionModel = class {
1934
1951
  };
1935
1952
  }
1936
1953
  };
1937
- var providerMetadataEntrySchema4 = z13.object({}).catchall(z13.unknown());
1938
- var gatewayTranscriptionWarningSchema = z13.discriminatedUnion("type", [
1939
- z13.object({
1940
- type: z13.literal("unsupported"),
1941
- feature: z13.string(),
1942
- details: z13.string().optional()
1954
+ var providerMetadataEntrySchema4 = z14.object({}).catchall(z14.unknown());
1955
+ var gatewayTranscriptionWarningSchema = z14.discriminatedUnion("type", [
1956
+ z14.object({
1957
+ type: z14.literal("unsupported"),
1958
+ feature: z14.string(),
1959
+ details: z14.string().optional()
1943
1960
  }),
1944
- z13.object({
1945
- type: z13.literal("compatibility"),
1946
- feature: z13.string(),
1947
- details: z13.string().optional()
1961
+ z14.object({
1962
+ type: z14.literal("compatibility"),
1963
+ feature: z14.string(),
1964
+ details: z14.string().optional()
1948
1965
  }),
1949
- z13.object({
1950
- type: z13.literal("deprecated"),
1951
- setting: z13.string(),
1952
- message: z13.string()
1966
+ z14.object({
1967
+ type: z14.literal("deprecated"),
1968
+ setting: z14.string(),
1969
+ message: z14.string()
1953
1970
  }),
1954
- z13.object({
1955
- type: z13.literal("other"),
1956
- message: z13.string()
1971
+ z14.object({
1972
+ type: z14.literal("other"),
1973
+ message: z14.string()
1957
1974
  })
1958
1975
  ]);
1959
- var gatewayTranscriptionResponseSchema = z13.object({
1960
- text: z13.string(),
1961
- segments: z13.array(
1962
- z13.object({
1963
- text: z13.string(),
1964
- startSecond: z13.number(),
1965
- endSecond: z13.number()
1976
+ var gatewayTranscriptionResponseSchema = z14.object({
1977
+ text: z14.string(),
1978
+ segments: z14.array(
1979
+ z14.object({
1980
+ text: z14.string(),
1981
+ startSecond: z14.number(),
1982
+ endSecond: z14.number()
1966
1983
  })
1967
1984
  ).optional(),
1968
- language: z13.string().nullish(),
1969
- durationInSeconds: z13.number().nullish(),
1970
- warnings: z13.array(gatewayTranscriptionWarningSchema).optional(),
1971
- providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema4).optional()
1985
+ language: z14.string().nullish(),
1986
+ durationInSeconds: z14.number().nullish(),
1987
+ warnings: z14.array(gatewayTranscriptionWarningSchema).optional(),
1988
+ providerMetadata: z14.record(z14.string(), providerMetadataEntrySchema4).optional()
1972
1989
  });
1973
1990
 
1974
1991
  // src/gateway-realtime-model.ts
@@ -2029,19 +2046,19 @@ function toGatewayRealtimeUrl(baseURL, modelId) {
2029
2046
  // src/tool/exa-search.ts
2030
2047
  import {
2031
2048
  createProviderExecutedToolFactory,
2032
- lazySchema as lazySchema9,
2033
- zodSchema as zodSchema9
2049
+ lazySchema as lazySchema10,
2050
+ zodSchema as zodSchema10
2034
2051
  } from "@ai-sdk/provider-utils";
2035
- import { z as z14 } from "zod";
2036
- var exaSearchInputSchema = lazySchema9(
2037
- () => zodSchema9(
2038
- z14.object({
2039
- query: z14.string().describe("Natural-language web search query. This is required."),
2040
- type: z14.enum(["auto", "fast", "instant"]).optional().describe(
2052
+ import { z as z15 } from "zod/v4";
2053
+ var exaSearchInputSchema = lazySchema10(
2054
+ () => zodSchema10(
2055
+ z15.object({
2056
+ query: z15.string().describe("Natural-language web search query. This is required."),
2057
+ type: z15.enum(["auto", "fast", "instant"]).optional().describe(
2041
2058
  "Search method. Use auto for the default balance of speed and quality."
2042
2059
  ),
2043
- num_results: z14.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
2044
- category: z14.enum([
2060
+ num_results: z15.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
2061
+ category: z15.enum([
2045
2062
  "company",
2046
2063
  "people",
2047
2064
  "research paper",
@@ -2049,20 +2066,20 @@ var exaSearchInputSchema = lazySchema9(
2049
2066
  "personal site",
2050
2067
  "financial report"
2051
2068
  ]).optional().describe("Optional content category to focus results."),
2052
- user_location: z14.string().optional().describe("Two-letter ISO country code such as 'US'."),
2053
- include_domains: z14.array(z14.string()).optional().describe("Only return results from these domains."),
2054
- exclude_domains: z14.array(z14.string()).optional().describe("Exclude results from these domains."),
2055
- start_published_date: z14.string().optional().describe("Only return links published after this ISO 8601 date."),
2056
- end_published_date: z14.string().optional().describe("Only return links published before this ISO 8601 date."),
2057
- contents: z14.object({
2058
- text: z14.union([
2059
- z14.boolean(),
2060
- z14.object({
2061
- max_characters: z14.number().optional(),
2062
- include_html_tags: z14.boolean().optional(),
2063
- verbosity: z14.enum(["compact", "standard", "full"]).optional(),
2064
- include_sections: z14.array(
2065
- z14.enum([
2069
+ user_location: z15.string().optional().describe("Two-letter ISO country code such as 'US'."),
2070
+ include_domains: z15.array(z15.string()).optional().describe("Only return results from these domains."),
2071
+ exclude_domains: z15.array(z15.string()).optional().describe("Exclude results from these domains."),
2072
+ start_published_date: z15.string().optional().describe("Only return links published after this ISO 8601 date."),
2073
+ end_published_date: z15.string().optional().describe("Only return links published before this ISO 8601 date."),
2074
+ contents: z15.object({
2075
+ text: z15.union([
2076
+ z15.boolean(),
2077
+ z15.object({
2078
+ max_characters: z15.number().optional(),
2079
+ include_html_tags: z15.boolean().optional(),
2080
+ verbosity: z15.enum(["compact", "standard", "full"]).optional(),
2081
+ include_sections: z15.array(
2082
+ z15.enum([
2066
2083
  "header",
2067
2084
  "navigation",
2068
2085
  "banner",
@@ -2072,8 +2089,8 @@ var exaSearchInputSchema = lazySchema9(
2072
2089
  "metadata"
2073
2090
  ])
2074
2091
  ).optional(),
2075
- exclude_sections: z14.array(
2076
- z14.enum([
2092
+ exclude_sections: z15.array(
2093
+ z15.enum([
2077
2094
  "header",
2078
2095
  "navigation",
2079
2096
  "banner",
@@ -2085,59 +2102,59 @@ var exaSearchInputSchema = lazySchema9(
2085
2102
  ).optional()
2086
2103
  })
2087
2104
  ]).optional(),
2088
- highlights: z14.union([
2089
- z14.boolean(),
2090
- z14.object({
2091
- query: z14.string().optional(),
2092
- max_characters: z14.number().optional()
2105
+ highlights: z15.union([
2106
+ z15.boolean(),
2107
+ z15.object({
2108
+ query: z15.string().optional(),
2109
+ max_characters: z15.number().optional()
2093
2110
  })
2094
2111
  ]).optional(),
2095
- max_age_hours: z14.number().optional(),
2096
- livecrawl_timeout: z14.number().optional(),
2097
- subpages: z14.number().optional(),
2098
- subpage_target: z14.union([z14.string(), z14.array(z14.string())]).optional(),
2099
- extras: z14.object({
2100
- links: z14.number().optional(),
2101
- image_links: z14.number().optional()
2112
+ max_age_hours: z15.number().optional(),
2113
+ livecrawl_timeout: z15.number().optional(),
2114
+ subpages: z15.number().optional(),
2115
+ subpage_target: z15.union([z15.string(), z15.array(z15.string())]).optional(),
2116
+ extras: z15.object({
2117
+ links: z15.number().optional(),
2118
+ image_links: z15.number().optional()
2102
2119
  }).optional()
2103
2120
  }).optional().describe("Controls extracted page content and freshness.")
2104
2121
  })
2105
2122
  )
2106
2123
  );
2107
- var exaSearchOutputSchema = lazySchema9(
2108
- () => zodSchema9(
2109
- z14.union([
2110
- z14.object({
2111
- requestId: z14.string(),
2112
- searchType: z14.string().optional(),
2113
- resolvedSearchType: z14.string().optional(),
2114
- results: z14.array(
2115
- z14.object({
2116
- title: z14.string(),
2117
- url: z14.string(),
2118
- id: z14.string(),
2119
- publishedDate: z14.string().nullable().optional(),
2120
- author: z14.string().nullable().optional(),
2121
- image: z14.string().nullable().optional(),
2122
- favicon: z14.string().nullable().optional(),
2123
- text: z14.string().optional(),
2124
- highlights: z14.array(z14.string()).optional(),
2125
- highlightScores: z14.array(z14.number()).optional(),
2126
- summary: z14.string().optional(),
2127
- subpages: z14.array(z14.any()).optional(),
2128
- extras: z14.object({
2129
- links: z14.array(z14.string()).optional(),
2130
- imageLinks: z14.array(z14.string()).optional()
2124
+ var exaSearchOutputSchema = lazySchema10(
2125
+ () => zodSchema10(
2126
+ z15.union([
2127
+ z15.object({
2128
+ requestId: z15.string(),
2129
+ searchType: z15.string().optional(),
2130
+ resolvedSearchType: z15.string().optional(),
2131
+ results: z15.array(
2132
+ z15.object({
2133
+ title: z15.string(),
2134
+ url: z15.string(),
2135
+ id: z15.string(),
2136
+ publishedDate: z15.string().nullable().optional(),
2137
+ author: z15.string().nullable().optional(),
2138
+ image: z15.string().nullable().optional(),
2139
+ favicon: z15.string().nullable().optional(),
2140
+ text: z15.string().optional(),
2141
+ highlights: z15.array(z15.string()).optional(),
2142
+ highlightScores: z15.array(z15.number()).optional(),
2143
+ summary: z15.string().optional(),
2144
+ subpages: z15.array(z15.any()).optional(),
2145
+ extras: z15.object({
2146
+ links: z15.array(z15.string()).optional(),
2147
+ imageLinks: z15.array(z15.string()).optional()
2131
2148
  }).optional()
2132
2149
  })
2133
2150
  ),
2134
- costDollars: z14.object({
2135
- total: z14.number().optional(),
2136
- search: z14.record(z14.number()).optional()
2151
+ costDollars: z15.object({
2152
+ total: z15.number().optional(),
2153
+ search: z15.record(z15.string(), z15.number()).optional()
2137
2154
  }).optional()
2138
2155
  }),
2139
- z14.object({
2140
- error: z14.enum([
2156
+ z15.object({
2157
+ error: z15.enum([
2141
2158
  "api_error",
2142
2159
  "rate_limit",
2143
2160
  "timeout",
@@ -2146,8 +2163,8 @@ var exaSearchOutputSchema = lazySchema9(
2146
2163
  "execution_error",
2147
2164
  "unknown"
2148
2165
  ]),
2149
- statusCode: z14.number().optional(),
2150
- message: z14.string()
2166
+ statusCode: z15.number().optional(),
2167
+ message: z15.string()
2151
2168
  })
2152
2169
  ])
2153
2170
  )
@@ -2162,69 +2179,69 @@ var exaSearch = (config = {}) => exaSearchToolFactory(config);
2162
2179
  // src/tool/parallel-search.ts
2163
2180
  import {
2164
2181
  createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
2165
- lazySchema as lazySchema10,
2166
- zodSchema as zodSchema10
2182
+ lazySchema as lazySchema11,
2183
+ zodSchema as zodSchema11
2167
2184
  } from "@ai-sdk/provider-utils";
2168
- import { z as z15 } from "zod";
2169
- var parallelSearchInputSchema = lazySchema10(
2170
- () => zodSchema10(
2171
- z15.object({
2172
- objective: z15.string().describe(
2185
+ import { z as z16 } from "zod/v4";
2186
+ var parallelSearchInputSchema = lazySchema11(
2187
+ () => zodSchema11(
2188
+ z16.object({
2189
+ objective: z16.string().describe(
2173
2190
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
2174
2191
  ),
2175
- search_queries: z15.array(z15.string()).optional().describe(
2192
+ search_queries: z16.array(z16.string()).optional().describe(
2176
2193
  "Optional search queries to supplement the objective. Maximum 200 characters per query."
2177
2194
  ),
2178
- mode: z15.enum(["one-shot", "agentic"]).optional().describe(
2195
+ mode: z16.enum(["one-shot", "agentic"]).optional().describe(
2179
2196
  'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
2180
2197
  ),
2181
- max_results: z15.number().optional().describe(
2198
+ max_results: z16.number().optional().describe(
2182
2199
  "Maximum number of results to return (1-20). Defaults to 10 if not specified."
2183
2200
  ),
2184
- source_policy: z15.object({
2185
- include_domains: z15.array(z15.string()).optional().describe(
2201
+ source_policy: z16.object({
2202
+ include_domains: z16.array(z16.string()).optional().describe(
2186
2203
  "Limit results to these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
2187
2204
  ),
2188
- exclude_domains: z15.array(z15.string()).optional().describe(
2205
+ exclude_domains: z16.array(z16.string()).optional().describe(
2189
2206
  "Exclude results from these domains. Use plain domain names only \u2014 e.g. example.com or sub.example.gov, or a bare extension like .edu. Do not include a scheme, path, or port (e.g. not https://example.com/page)."
2190
2207
  ),
2191
- after_date: z15.string().optional().describe(
2208
+ after_date: z16.string().optional().describe(
2192
2209
  "Only include results published after this date. Use an ISO 8601 calendar date formatted YYYY-MM-DD (e.g. 2025-01-01); do not include a time."
2193
2210
  )
2194
2211
  }).optional().describe(
2195
2212
  "Source policy for controlling which domains to include/exclude and freshness."
2196
2213
  ),
2197
- excerpts: z15.object({
2198
- max_chars_per_result: z15.number().optional().describe("Maximum characters per result."),
2199
- max_chars_total: z15.number().optional().describe("Maximum total characters across all results.")
2214
+ excerpts: z16.object({
2215
+ max_chars_per_result: z16.number().optional().describe("Maximum characters per result."),
2216
+ max_chars_total: z16.number().optional().describe("Maximum total characters across all results.")
2200
2217
  }).optional().describe("Excerpt configuration for controlling result length."),
2201
- fetch_policy: z15.object({
2202
- max_age_seconds: z15.number().optional().describe(
2218
+ fetch_policy: z16.object({
2219
+ max_age_seconds: z16.number().optional().describe(
2203
2220
  "Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
2204
2221
  )
2205
2222
  }).optional().describe("Fetch policy for controlling content freshness.")
2206
2223
  })
2207
2224
  )
2208
2225
  );
2209
- var parallelSearchOutputSchema = lazySchema10(
2210
- () => zodSchema10(
2211
- z15.union([
2226
+ var parallelSearchOutputSchema = lazySchema11(
2227
+ () => zodSchema11(
2228
+ z16.union([
2212
2229
  // Success response
2213
- z15.object({
2214
- searchId: z15.string(),
2215
- results: z15.array(
2216
- z15.object({
2217
- url: z15.string(),
2218
- title: z15.string(),
2219
- excerpt: z15.string(),
2220
- publishDate: z15.string().nullable().optional(),
2221
- relevanceScore: z15.number().optional()
2230
+ z16.object({
2231
+ searchId: z16.string(),
2232
+ results: z16.array(
2233
+ z16.object({
2234
+ url: z16.string(),
2235
+ title: z16.string(),
2236
+ excerpt: z16.string(),
2237
+ publishDate: z16.string().nullable().optional(),
2238
+ relevanceScore: z16.number().optional()
2222
2239
  })
2223
2240
  )
2224
2241
  }),
2225
2242
  // Error response
2226
- z15.object({
2227
- error: z15.enum([
2243
+ z16.object({
2244
+ error: z16.enum([
2228
2245
  "api_error",
2229
2246
  "rate_limit",
2230
2247
  "timeout",
@@ -2232,8 +2249,8 @@ var parallelSearchOutputSchema = lazySchema10(
2232
2249
  "configuration_error",
2233
2250
  "unknown"
2234
2251
  ]),
2235
- statusCode: z15.number().optional(),
2236
- message: z15.string()
2252
+ statusCode: z16.number().optional(),
2253
+ message: z16.string()
2237
2254
  })
2238
2255
  ])
2239
2256
  )
@@ -2248,79 +2265,79 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
2248
2265
  // src/tool/perplexity-search.ts
2249
2266
  import {
2250
2267
  createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
2251
- lazySchema as lazySchema11,
2252
- zodSchema as zodSchema11
2268
+ lazySchema as lazySchema12,
2269
+ zodSchema as zodSchema12
2253
2270
  } from "@ai-sdk/provider-utils";
2254
- import { z as z16 } from "zod";
2255
- var perplexitySearchInputSchema = lazySchema11(
2256
- () => zodSchema11(
2257
- z16.object({
2258
- query: z16.union([z16.string(), z16.array(z16.string())]).describe(
2271
+ import { z as z17 } from "zod/v4";
2272
+ var perplexitySearchInputSchema = lazySchema12(
2273
+ () => zodSchema12(
2274
+ z17.object({
2275
+ query: z17.union([z17.string(), z17.array(z17.string())]).describe(
2259
2276
  "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
2260
2277
  ),
2261
- max_results: z16.number().optional().describe(
2278
+ max_results: z17.number().optional().describe(
2262
2279
  "Maximum number of search results to return (1-20, default: 10)"
2263
2280
  ),
2264
- max_tokens_per_page: z16.number().optional().describe(
2281
+ max_tokens_per_page: z17.number().optional().describe(
2265
2282
  "Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
2266
2283
  ),
2267
- max_tokens: z16.number().optional().describe(
2284
+ max_tokens: z17.number().optional().describe(
2268
2285
  "Maximum total tokens across all search results (default: 25000, max: 1000000)"
2269
2286
  ),
2270
- country: z16.string().optional().describe(
2287
+ country: z17.string().optional().describe(
2271
2288
  "Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
2272
2289
  ),
2273
- search_domain_filter: z16.array(z16.string()).optional().describe(
2290
+ search_domain_filter: z17.array(z17.string()).optional().describe(
2274
2291
  "List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
2275
2292
  ),
2276
- search_language_filter: z16.array(z16.string()).optional().describe(
2293
+ search_language_filter: z17.array(z17.string()).optional().describe(
2277
2294
  "List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
2278
2295
  ),
2279
- search_after_date: z16.string().optional().describe(
2296
+ search_after_date: z17.string().optional().describe(
2280
2297
  "Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
2281
2298
  ),
2282
- search_before_date: z16.string().optional().describe(
2299
+ search_before_date: z17.string().optional().describe(
2283
2300
  "Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
2284
2301
  ),
2285
- last_updated_after_filter: z16.string().optional().describe(
2302
+ last_updated_after_filter: z17.string().optional().describe(
2286
2303
  "Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
2287
2304
  ),
2288
- last_updated_before_filter: z16.string().optional().describe(
2305
+ last_updated_before_filter: z17.string().optional().describe(
2289
2306
  "Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
2290
2307
  ),
2291
- search_recency_filter: z16.enum(["day", "week", "month", "year"]).optional().describe(
2308
+ search_recency_filter: z17.enum(["day", "week", "month", "year"]).optional().describe(
2292
2309
  "Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
2293
2310
  )
2294
2311
  })
2295
2312
  )
2296
2313
  );
2297
- var perplexitySearchOutputSchema = lazySchema11(
2298
- () => zodSchema11(
2299
- z16.union([
2314
+ var perplexitySearchOutputSchema = lazySchema12(
2315
+ () => zodSchema12(
2316
+ z17.union([
2300
2317
  // Success response
2301
- z16.object({
2302
- results: z16.array(
2303
- z16.object({
2304
- title: z16.string(),
2305
- url: z16.string(),
2306
- snippet: z16.string(),
2307
- date: z16.string().optional(),
2308
- lastUpdated: z16.string().optional()
2318
+ z17.object({
2319
+ results: z17.array(
2320
+ z17.object({
2321
+ title: z17.string(),
2322
+ url: z17.string(),
2323
+ snippet: z17.string(),
2324
+ date: z17.string().optional(),
2325
+ lastUpdated: z17.string().optional()
2309
2326
  })
2310
2327
  ),
2311
- id: z16.string()
2328
+ id: z17.string()
2312
2329
  }),
2313
2330
  // Error response
2314
- z16.object({
2315
- error: z16.enum([
2331
+ z17.object({
2332
+ error: z17.enum([
2316
2333
  "api_error",
2317
2334
  "rate_limit",
2318
2335
  "timeout",
2319
2336
  "invalid_input",
2320
2337
  "unknown"
2321
2338
  ]),
2322
- statusCode: z16.number().optional(),
2323
- message: z16.string()
2339
+ statusCode: z17.number().optional(),
2340
+ message: z17.string()
2324
2341
  })
2325
2342
  ])
2326
2343
  )
@@ -2370,13 +2387,13 @@ async function getVercelRequestId() {
2370
2387
  }
2371
2388
 
2372
2389
  // src/version.ts
2373
- var VERSION = true ? "4.0.14" : "0.0.0-test";
2390
+ var VERSION = true ? "4.0.16" : "0.0.0-test";
2374
2391
 
2375
2392
  // src/gateway-provider.ts
2376
2393
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
2377
- var gatewayClientSecretResponseSchema = z17.object({
2378
- token: z17.string(),
2379
- expiresAt: z17.number().nullish()
2394
+ var gatewayClientSecretResponseSchema = z18.object({
2395
+ token: z18.string(),
2396
+ expiresAt: z18.number().nullish()
2380
2397
  });
2381
2398
  function createGateway(options = {}) {
2382
2399
  var _a11, _b11;
@@ -2438,7 +2455,7 @@ function createGateway(options = {}) {
2438
2455
  gatewayClientSecretResponseSchema
2439
2456
  ),
2440
2457
  failedResponseHandler: createJsonErrorResponseHandler11({
2441
- errorSchema: z17.any(),
2458
+ errorSchema: z18.any(),
2442
2459
  errorToMessage: (data) => data
2443
2460
  }),
2444
2461
  fetch: options.fetch