@ai-sdk/gateway 3.0.145 → 3.0.146

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
@@ -9,7 +9,7 @@ import {
9
9
  import { APICallError } from "@ai-sdk/provider";
10
10
 
11
11
  // src/errors/create-gateway-error.ts
12
- import { z as z2 } from "zod/v4";
12
+ import { z as z3 } from "zod/v4";
13
13
 
14
14
  // src/errors/gateway-error.ts
15
15
  var marker = "vercel.ai.gateway.error";
@@ -238,22 +238,33 @@ var GatewayFailedDependencyError = class extends (_b7 = GatewayError, _a7 = symb
238
238
  };
239
239
 
240
240
  // src/errors/gateway-forbidden-error.ts
241
+ import { z as z2 } from "zod/v4";
242
+ import { lazySchema as lazySchema2, zodSchema as zodSchema2 } from "@ai-sdk/provider-utils";
241
243
  var name7 = "GatewayForbiddenError";
242
244
  var marker8 = `vercel.ai.gateway.error.${name7}`;
243
245
  var symbol8 = Symbol.for(marker8);
246
+ var forbiddenParamSchema = lazySchema2(
247
+ () => zodSchema2(
248
+ z2.object({
249
+ ruleId: z2.string()
250
+ })
251
+ )
252
+ );
244
253
  var _a8, _b8;
245
254
  var GatewayForbiddenError = class extends (_b8 = GatewayError, _a8 = symbol8, _b8) {
246
255
  constructor({
247
256
  message = "Forbidden",
248
257
  statusCode = 403,
249
258
  cause,
250
- generationId
259
+ generationId,
260
+ ruleId
251
261
  } = {}) {
252
262
  super({ message, statusCode, cause, generationId });
253
263
  this[_a8] = true;
254
264
  // used in isInstance
255
265
  this.name = name7;
256
266
  this.type = "forbidden";
267
+ this.ruleId = ruleId;
257
268
  }
258
269
  static isInstance(error) {
259
270
  return GatewayError.hasMarker(error) && symbol8 in error;
@@ -289,9 +300,9 @@ var GatewayResponseError = class extends (_b9 = GatewayError, _a9 = symbol9, _b9
289
300
 
290
301
  // src/errors/create-gateway-error.ts
291
302
  import {
292
- lazySchema as lazySchema2,
303
+ lazySchema as lazySchema3,
293
304
  safeValidateTypes,
294
- zodSchema as zodSchema2
305
+ zodSchema as zodSchema3
295
306
  } from "@ai-sdk/provider-utils";
296
307
  async function createGatewayErrorFromResponse({
297
308
  response,
@@ -370,13 +381,19 @@ async function createGatewayErrorFromResponse({
370
381
  cause,
371
382
  generationId
372
383
  });
373
- case "forbidden":
384
+ case "forbidden": {
385
+ const ruleResult = await safeValidateTypes({
386
+ value: validatedResponse.error.param,
387
+ schema: forbiddenParamSchema
388
+ });
374
389
  return new GatewayForbiddenError({
375
390
  message,
376
391
  statusCode,
377
392
  cause,
378
- generationId
393
+ generationId,
394
+ ruleId: ruleResult.success ? ruleResult.value.ruleId : void 0
379
395
  });
396
+ }
380
397
  default:
381
398
  return new GatewayInternalServerError({
382
399
  message,
@@ -386,16 +403,16 @@ async function createGatewayErrorFromResponse({
386
403
  });
387
404
  }
388
405
  }
389
- var gatewayErrorResponseSchema = lazySchema2(
390
- () => zodSchema2(
391
- z2.object({
392
- error: z2.object({
393
- message: z2.string(),
394
- type: z2.string().nullish(),
395
- param: z2.unknown().nullish(),
396
- code: z2.union([z2.string(), z2.number()]).nullish()
406
+ var gatewayErrorResponseSchema = lazySchema3(
407
+ () => zodSchema3(
408
+ z3.object({
409
+ error: z3.object({
410
+ message: z3.string(),
411
+ type: z3.string().nullish(),
412
+ param: z3.unknown().nullish(),
413
+ code: z3.union([z3.string(), z3.number()]).nullish()
397
414
  }),
398
- generationId: z2.string().nullish()
415
+ generationId: z3.string().nullish()
399
416
  })
400
417
  )
401
418
  );
@@ -510,11 +527,11 @@ async function asGatewayError(error, authMethod) {
510
527
  }
511
528
 
512
529
  // src/errors/parse-auth-method.ts
513
- import { z as z3 } from "zod/v4";
530
+ import { z as z4 } from "zod/v4";
514
531
  import {
515
- lazySchema as lazySchema3,
532
+ lazySchema as lazySchema4,
516
533
  safeValidateTypes as safeValidateTypes2,
517
- zodSchema as zodSchema3
534
+ zodSchema as zodSchema4
518
535
  } from "@ai-sdk/provider-utils";
519
536
  var GATEWAY_AUTH_METHOD_HEADER = "ai-gateway-auth-method";
520
537
  async function parseAuthMethod(headers) {
@@ -524,8 +541,8 @@ async function parseAuthMethod(headers) {
524
541
  });
525
542
  return result.success ? result.value : void 0;
526
543
  }
527
- var gatewayAuthMethodSchema = lazySchema3(
528
- () => zodSchema3(z3.union([z3.literal("api-key"), z3.literal("oidc")]))
544
+ var gatewayAuthMethodSchema = lazySchema4(
545
+ () => zodSchema4(z4.union([z4.literal("api-key"), z4.literal("oidc")]))
529
546
  );
530
547
 
531
548
  // src/gateway-fetch-metadata.ts
@@ -533,11 +550,11 @@ import {
533
550
  createJsonErrorResponseHandler,
534
551
  createJsonResponseHandler,
535
552
  getFromApi,
536
- lazySchema as lazySchema4,
553
+ lazySchema as lazySchema5,
537
554
  resolve,
538
- zodSchema as zodSchema4
555
+ zodSchema as zodSchema5
539
556
  } from "@ai-sdk/provider-utils";
540
- import { z as z4 } from "zod/v4";
557
+ import { z as z5 } from "zod/v4";
541
558
 
542
559
  // src/gateway-model-entry.ts
543
560
  var KNOWN_MODEL_TYPES = [
@@ -564,7 +581,7 @@ var GatewayFetchMetadata = class {
564
581
  gatewayAvailableModelsResponseSchema
565
582
  ),
566
583
  failedResponseHandler: createJsonErrorResponseHandler({
567
- errorSchema: z4.any(),
584
+ errorSchema: z5.any(),
568
585
  errorToMessage: (data) => data
569
586
  }),
570
587
  fetch: this.config.fetch
@@ -584,7 +601,7 @@ var GatewayFetchMetadata = class {
584
601
  gatewayCreditsResponseSchema
585
602
  ),
586
603
  failedResponseHandler: createJsonErrorResponseHandler({
587
- errorSchema: z4.any(),
604
+ errorSchema: z5.any(),
588
605
  errorToMessage: (data) => data
589
606
  }),
590
607
  fetch: this.config.fetch
@@ -595,19 +612,19 @@ var GatewayFetchMetadata = class {
595
612
  }
596
613
  }
597
614
  };
598
- var gatewayAvailableModelsResponseSchema = lazySchema4(
599
- () => zodSchema4(
600
- z4.object({
601
- models: z4.array(
602
- z4.object({
603
- id: z4.string(),
604
- name: z4.string(),
605
- description: z4.string().nullish(),
606
- pricing: z4.object({
607
- input: z4.string(),
608
- output: z4.string(),
609
- input_cache_read: z4.string().nullish(),
610
- input_cache_write: z4.string().nullish()
615
+ var gatewayAvailableModelsResponseSchema = lazySchema5(
616
+ () => zodSchema5(
617
+ z5.object({
618
+ models: z5.array(
619
+ z5.object({
620
+ id: z5.string(),
621
+ name: z5.string(),
622
+ description: z5.string().nullish(),
623
+ pricing: z5.object({
624
+ input: z5.string(),
625
+ output: z5.string(),
626
+ input_cache_read: z5.string().nullish(),
627
+ input_cache_write: z5.string().nullish()
611
628
  }).transform(
612
629
  ({ input, output, input_cache_read, input_cache_write }) => ({
613
630
  input,
@@ -616,12 +633,12 @@ var gatewayAvailableModelsResponseSchema = lazySchema4(
616
633
  ...input_cache_write ? { cacheCreationInputTokens: input_cache_write } : {}
617
634
  })
618
635
  ).nullish(),
619
- specification: z4.object({
620
- specificationVersion: z4.literal("v3"),
621
- provider: z4.string(),
622
- modelId: z4.string()
636
+ specification: z5.object({
637
+ specificationVersion: z5.literal("v3"),
638
+ provider: z5.string(),
639
+ modelId: z5.string()
623
640
  }),
624
- modelType: z4.string().nullish()
641
+ modelType: z5.string().nullish()
625
642
  })
626
643
  ).transform(
627
644
  (models) => models.filter(
@@ -631,11 +648,11 @@ var gatewayAvailableModelsResponseSchema = lazySchema4(
631
648
  })
632
649
  )
633
650
  );
634
- var gatewayCreditsResponseSchema = lazySchema4(
635
- () => zodSchema4(
636
- z4.object({
637
- balance: z4.string(),
638
- total_used: z4.string()
651
+ var gatewayCreditsResponseSchema = lazySchema5(
652
+ () => zodSchema5(
653
+ z5.object({
654
+ balance: z5.string(),
655
+ total_used: z5.string()
639
656
  }).transform(({ balance, total_used }) => ({
640
657
  balance,
641
658
  totalUsed: total_used
@@ -648,11 +665,11 @@ import {
648
665
  createJsonErrorResponseHandler as createJsonErrorResponseHandler2,
649
666
  createJsonResponseHandler as createJsonResponseHandler2,
650
667
  getFromApi as getFromApi2,
651
- lazySchema as lazySchema5,
668
+ lazySchema as lazySchema6,
652
669
  resolve as resolve2,
653
- zodSchema as zodSchema5
670
+ zodSchema as zodSchema6
654
671
  } from "@ai-sdk/provider-utils";
655
- import { z as z5 } from "zod/v4";
672
+ import { z as z6 } from "zod/v4";
656
673
  var GatewaySpendReport = class {
657
674
  constructor(config) {
658
675
  this.config = config;
@@ -691,7 +708,7 @@ var GatewaySpendReport = class {
691
708
  gatewaySpendReportResponseSchema
692
709
  ),
693
710
  failedResponseHandler: createJsonErrorResponseHandler2({
694
- errorSchema: z5.any(),
711
+ errorSchema: z6.any(),
695
712
  errorToMessage: (data) => data
696
713
  }),
697
714
  fetch: this.config.fetch
@@ -702,26 +719,26 @@ var GatewaySpendReport = class {
702
719
  }
703
720
  }
704
721
  };
705
- var gatewaySpendReportResponseSchema = lazySchema5(
706
- () => zodSchema5(
707
- z5.object({
708
- results: z5.array(
709
- z5.object({
710
- day: z5.string().optional(),
711
- hour: z5.string().optional(),
712
- user: z5.string().optional(),
713
- model: z5.string().optional(),
714
- tag: z5.string().optional(),
715
- provider: z5.string().optional(),
716
- credential_type: z5.enum(["byok", "system"]).optional(),
717
- total_cost: z5.number(),
718
- market_cost: z5.number().optional(),
719
- input_tokens: z5.number().optional(),
720
- output_tokens: z5.number().optional(),
721
- cached_input_tokens: z5.number().optional(),
722
- cache_creation_input_tokens: z5.number().optional(),
723
- reasoning_tokens: z5.number().optional(),
724
- request_count: z5.number().optional()
722
+ var gatewaySpendReportResponseSchema = lazySchema6(
723
+ () => zodSchema6(
724
+ z6.object({
725
+ results: z6.array(
726
+ z6.object({
727
+ day: z6.string().optional(),
728
+ hour: z6.string().optional(),
729
+ user: z6.string().optional(),
730
+ model: z6.string().optional(),
731
+ tag: z6.string().optional(),
732
+ provider: z6.string().optional(),
733
+ credential_type: z6.enum(["byok", "system"]).optional(),
734
+ total_cost: z6.number(),
735
+ market_cost: z6.number().optional(),
736
+ input_tokens: z6.number().optional(),
737
+ output_tokens: z6.number().optional(),
738
+ cached_input_tokens: z6.number().optional(),
739
+ cache_creation_input_tokens: z6.number().optional(),
740
+ reasoning_tokens: z6.number().optional(),
741
+ request_count: z6.number().optional()
725
742
  }).transform(
726
743
  ({
727
744
  credential_type,
@@ -757,11 +774,11 @@ import {
757
774
  createJsonErrorResponseHandler as createJsonErrorResponseHandler3,
758
775
  createJsonResponseHandler as createJsonResponseHandler3,
759
776
  getFromApi as getFromApi3,
760
- lazySchema as lazySchema6,
777
+ lazySchema as lazySchema7,
761
778
  resolve as resolve3,
762
- zodSchema as zodSchema6
779
+ zodSchema as zodSchema7
763
780
  } from "@ai-sdk/provider-utils";
764
- import { z as z6 } from "zod/v4";
781
+ import { z as z7 } from "zod/v4";
765
782
  var GatewayGenerationInfoFetcher = class {
766
783
  constructor(config) {
767
784
  this.config = config;
@@ -776,7 +793,7 @@ var GatewayGenerationInfoFetcher = class {
776
793
  gatewayGenerationInfoResponseSchema
777
794
  ),
778
795
  failedResponseHandler: createJsonErrorResponseHandler3({
779
- errorSchema: z6.any(),
796
+ errorSchema: z7.any(),
780
797
  errorToMessage: (data) => data
781
798
  }),
782
799
  fetch: this.config.fetch
@@ -787,28 +804,28 @@ var GatewayGenerationInfoFetcher = class {
787
804
  }
788
805
  }
789
806
  };
790
- var gatewayGenerationInfoResponseSchema = lazySchema6(
791
- () => zodSchema6(
792
- z6.object({
793
- data: z6.object({
794
- id: z6.string(),
795
- total_cost: z6.number(),
796
- upstream_inference_cost: z6.number(),
797
- usage: z6.number(),
798
- created_at: z6.string(),
799
- model: z6.string(),
800
- is_byok: z6.boolean(),
801
- provider_name: z6.string(),
802
- streamed: z6.boolean(),
803
- finish_reason: z6.string(),
804
- latency: z6.number(),
805
- generation_time: z6.number(),
806
- native_tokens_prompt: z6.number(),
807
- native_tokens_completion: z6.number(),
808
- native_tokens_reasoning: z6.number(),
809
- native_tokens_cached: z6.number(),
810
- native_tokens_cache_creation: z6.number(),
811
- billable_web_search_calls: z6.number()
807
+ var gatewayGenerationInfoResponseSchema = lazySchema7(
808
+ () => zodSchema7(
809
+ z7.object({
810
+ data: z7.object({
811
+ id: z7.string(),
812
+ total_cost: z7.number(),
813
+ upstream_inference_cost: z7.number(),
814
+ usage: z7.number(),
815
+ created_at: z7.string(),
816
+ model: z7.string(),
817
+ is_byok: z7.boolean(),
818
+ provider_name: z7.string(),
819
+ streamed: z7.boolean(),
820
+ finish_reason: z7.string(),
821
+ latency: z7.number(),
822
+ generation_time: z7.number(),
823
+ native_tokens_prompt: z7.number(),
824
+ native_tokens_completion: z7.number(),
825
+ native_tokens_reasoning: z7.number(),
826
+ native_tokens_cached: z7.number(),
827
+ native_tokens_cache_creation: z7.number(),
828
+ billable_web_search_calls: z7.number()
812
829
  }).transform(
813
830
  ({
814
831
  total_cost,
@@ -855,7 +872,7 @@ import {
855
872
  postJsonToApi,
856
873
  resolve as resolve4
857
874
  } from "@ai-sdk/provider-utils";
858
- import { z as z7 } from "zod/v4";
875
+ import { z as z8 } from "zod/v4";
859
876
  var GatewayLanguageModel = class {
860
877
  constructor(modelId, config) {
861
878
  this.modelId = modelId;
@@ -891,9 +908,9 @@ var GatewayLanguageModel = class {
891
908
  await resolve4(this.config.o11yHeaders)
892
909
  ),
893
910
  body: args,
894
- successfulResponseHandler: createJsonResponseHandler4(z7.any()),
911
+ successfulResponseHandler: createJsonResponseHandler4(z8.any()),
895
912
  failedResponseHandler: createJsonErrorResponseHandler4({
896
- errorSchema: z7.any(),
913
+ errorSchema: z8.any(),
897
914
  errorToMessage: (data) => data
898
915
  }),
899
916
  ...abortSignal && { abortSignal },
@@ -923,9 +940,9 @@ var GatewayLanguageModel = class {
923
940
  await resolve4(this.config.o11yHeaders)
924
941
  ),
925
942
  body: args,
926
- successfulResponseHandler: createEventSourceResponseHandler(z7.any()),
943
+ successfulResponseHandler: createEventSourceResponseHandler(z8.any()),
927
944
  failedResponseHandler: createJsonErrorResponseHandler4({
928
- errorSchema: z7.any(),
945
+ errorSchema: z8.any(),
929
946
  errorToMessage: (data) => data
930
947
  }),
931
948
  ...abortSignal && { abortSignal },
@@ -1007,12 +1024,12 @@ import {
1007
1024
  combineHeaders as combineHeaders2,
1008
1025
  createJsonErrorResponseHandler as createJsonErrorResponseHandler5,
1009
1026
  createJsonResponseHandler as createJsonResponseHandler5,
1010
- lazySchema as lazySchema7,
1027
+ lazySchema as lazySchema8,
1011
1028
  postJsonToApi as postJsonToApi2,
1012
1029
  resolve as resolve5,
1013
- zodSchema as zodSchema7
1030
+ zodSchema as zodSchema8
1014
1031
  } from "@ai-sdk/provider-utils";
1015
- import { z as z8 } from "zod/v4";
1032
+ import { z as z9 } from "zod/v4";
1016
1033
  var GatewayEmbeddingModel = class {
1017
1034
  constructor(modelId, config) {
1018
1035
  this.modelId = modelId;
@@ -1053,7 +1070,7 @@ var GatewayEmbeddingModel = class {
1053
1070
  gatewayEmbeddingResponseSchema
1054
1071
  ),
1055
1072
  failedResponseHandler: createJsonErrorResponseHandler5({
1056
- errorSchema: z8.any(),
1073
+ errorSchema: z9.any(),
1057
1074
  errorToMessage: (data) => data
1058
1075
  }),
1059
1076
  ...abortSignal && { abortSignal },
@@ -1080,29 +1097,29 @@ var GatewayEmbeddingModel = class {
1080
1097
  };
1081
1098
  }
1082
1099
  };
1083
- var gatewayEmbeddingWarningSchema = z8.discriminatedUnion("type", [
1084
- z8.object({
1085
- type: z8.literal("unsupported"),
1086
- feature: z8.string(),
1087
- details: z8.string().optional()
1100
+ var gatewayEmbeddingWarningSchema = z9.discriminatedUnion("type", [
1101
+ z9.object({
1102
+ type: z9.literal("unsupported"),
1103
+ feature: z9.string(),
1104
+ details: z9.string().optional()
1088
1105
  }),
1089
- z8.object({
1090
- type: z8.literal("compatibility"),
1091
- feature: z8.string(),
1092
- details: z8.string().optional()
1106
+ z9.object({
1107
+ type: z9.literal("compatibility"),
1108
+ feature: z9.string(),
1109
+ details: z9.string().optional()
1093
1110
  }),
1094
- z8.object({
1095
- type: z8.literal("other"),
1096
- message: z8.string()
1111
+ z9.object({
1112
+ type: z9.literal("other"),
1113
+ message: z9.string()
1097
1114
  })
1098
1115
  ]);
1099
- var gatewayEmbeddingResponseSchema = lazySchema7(
1100
- () => zodSchema7(
1101
- z8.object({
1102
- embeddings: z8.array(z8.array(z8.number())),
1103
- usage: z8.object({ tokens: z8.number() }).nullish(),
1104
- warnings: z8.array(gatewayEmbeddingWarningSchema).optional(),
1105
- providerMetadata: z8.record(z8.string(), z8.record(z8.string(), z8.unknown())).optional()
1116
+ var gatewayEmbeddingResponseSchema = lazySchema8(
1117
+ () => zodSchema8(
1118
+ z9.object({
1119
+ embeddings: z9.array(z9.array(z9.number())),
1120
+ usage: z9.object({ tokens: z9.number() }).nullish(),
1121
+ warnings: z9.array(gatewayEmbeddingWarningSchema).optional(),
1122
+ providerMetadata: z9.record(z9.string(), z9.record(z9.string(), z9.unknown())).optional()
1106
1123
  })
1107
1124
  )
1108
1125
  );
@@ -1116,7 +1133,7 @@ import {
1116
1133
  postJsonToApi as postJsonToApi3,
1117
1134
  resolve as resolve6
1118
1135
  } from "@ai-sdk/provider-utils";
1119
- import { z as z9 } from "zod/v4";
1136
+ import { z as z10 } from "zod/v4";
1120
1137
 
1121
1138
  // src/map-gateway-warnings.ts
1122
1139
  function mapGatewayWarnings(warnings) {
@@ -1180,7 +1197,7 @@ var GatewayImageModel = class {
1180
1197
  gatewayImageResponseSchema
1181
1198
  ),
1182
1199
  failedResponseHandler: createJsonErrorResponseHandler6({
1183
- errorSchema: z9.any(),
1200
+ errorSchema: z10.any(),
1184
1201
  errorToMessage: (data) => data
1185
1202
  }),
1186
1203
  ...abortSignal && { abortSignal },
@@ -1227,40 +1244,40 @@ function maybeEncodeImageFile(file) {
1227
1244
  }
1228
1245
  return file;
1229
1246
  }
1230
- var providerMetadataEntrySchema = z9.object({
1231
- images: z9.array(z9.unknown()).optional()
1232
- }).catchall(z9.unknown());
1233
- var gatewayImageWarningSchema = z9.discriminatedUnion("type", [
1234
- z9.object({
1235
- type: z9.literal("unsupported"),
1236
- feature: z9.string(),
1237
- details: z9.string().optional()
1247
+ var providerMetadataEntrySchema = z10.object({
1248
+ images: z10.array(z10.unknown()).optional()
1249
+ }).catchall(z10.unknown());
1250
+ var gatewayImageWarningSchema = z10.discriminatedUnion("type", [
1251
+ z10.object({
1252
+ type: z10.literal("unsupported"),
1253
+ feature: z10.string(),
1254
+ details: z10.string().optional()
1238
1255
  }),
1239
- z9.object({
1240
- type: z9.literal("compatibility"),
1241
- feature: z9.string(),
1242
- details: z9.string().optional()
1256
+ z10.object({
1257
+ type: z10.literal("compatibility"),
1258
+ feature: z10.string(),
1259
+ details: z10.string().optional()
1243
1260
  }),
1244
- z9.object({
1245
- type: z9.literal("deprecated"),
1246
- setting: z9.string(),
1247
- message: z9.string()
1261
+ z10.object({
1262
+ type: z10.literal("deprecated"),
1263
+ setting: z10.string(),
1264
+ message: z10.string()
1248
1265
  }),
1249
- z9.object({
1250
- type: z9.literal("other"),
1251
- message: z9.string()
1266
+ z10.object({
1267
+ type: z10.literal("other"),
1268
+ message: z10.string()
1252
1269
  })
1253
1270
  ]);
1254
- var gatewayImageUsageSchema = z9.object({
1255
- inputTokens: z9.number().nullish(),
1256
- outputTokens: z9.number().nullish(),
1257
- totalTokens: z9.number().nullish()
1271
+ var gatewayImageUsageSchema = z10.object({
1272
+ inputTokens: z10.number().nullish(),
1273
+ outputTokens: z10.number().nullish(),
1274
+ totalTokens: z10.number().nullish()
1258
1275
  });
1259
- var gatewayImageResponseSchema = z9.object({
1260
- images: z9.array(z9.string()),
1276
+ var gatewayImageResponseSchema = z10.object({
1277
+ images: z10.array(z10.string()),
1261
1278
  // Always base64 strings over the wire
1262
- warnings: z9.array(gatewayImageWarningSchema).optional(),
1263
- providerMetadata: z9.record(z9.string(), providerMetadataEntrySchema).optional(),
1279
+ warnings: z10.array(gatewayImageWarningSchema).optional(),
1280
+ providerMetadata: z10.record(z10.string(), providerMetadataEntrySchema).optional(),
1264
1281
  usage: gatewayImageUsageSchema.optional()
1265
1282
  });
1266
1283
 
@@ -1276,7 +1293,7 @@ import {
1276
1293
  postJsonToApi as postJsonToApi4,
1277
1294
  resolve as resolve7
1278
1295
  } from "@ai-sdk/provider-utils";
1279
- import { z as z10 } from "zod/v4";
1296
+ import { z as z11 } from "zod/v4";
1280
1297
  var GatewayVideoModel = class {
1281
1298
  constructor(modelId, config) {
1282
1299
  this.modelId = modelId;
@@ -1403,7 +1420,7 @@ var GatewayVideoModel = class {
1403
1420
  };
1404
1421
  },
1405
1422
  failedResponseHandler: createJsonErrorResponseHandler7({
1406
- errorSchema: z10.any(),
1423
+ errorSchema: z11.any(),
1407
1424
  errorToMessage: (data) => data
1408
1425
  }),
1409
1426
  ...abortSignal && { abortSignal },
@@ -1442,55 +1459,55 @@ function maybeEncodeVideoFile(file) {
1442
1459
  }
1443
1460
  return file;
1444
1461
  }
1445
- var providerMetadataEntrySchema2 = z10.object({
1446
- videos: z10.array(z10.unknown()).optional()
1447
- }).catchall(z10.unknown());
1448
- var gatewayVideoDataSchema = z10.union([
1449
- z10.object({
1450
- type: z10.literal("url"),
1451
- url: z10.string(),
1452
- mediaType: z10.string()
1462
+ var providerMetadataEntrySchema2 = z11.object({
1463
+ videos: z11.array(z11.unknown()).optional()
1464
+ }).catchall(z11.unknown());
1465
+ var gatewayVideoDataSchema = z11.union([
1466
+ z11.object({
1467
+ type: z11.literal("url"),
1468
+ url: z11.string(),
1469
+ mediaType: z11.string()
1453
1470
  }),
1454
- z10.object({
1455
- type: z10.literal("base64"),
1456
- data: z10.string(),
1457
- mediaType: z10.string()
1471
+ z11.object({
1472
+ type: z11.literal("base64"),
1473
+ data: z11.string(),
1474
+ mediaType: z11.string()
1458
1475
  })
1459
1476
  ]);
1460
- var gatewayVideoWarningSchema = z10.discriminatedUnion("type", [
1461
- z10.object({
1462
- type: z10.literal("unsupported"),
1463
- feature: z10.string(),
1464
- details: z10.string().optional()
1477
+ var gatewayVideoWarningSchema = z11.discriminatedUnion("type", [
1478
+ z11.object({
1479
+ type: z11.literal("unsupported"),
1480
+ feature: z11.string(),
1481
+ details: z11.string().optional()
1465
1482
  }),
1466
- z10.object({
1467
- type: z10.literal("compatibility"),
1468
- feature: z10.string(),
1469
- details: z10.string().optional()
1483
+ z11.object({
1484
+ type: z11.literal("compatibility"),
1485
+ feature: z11.string(),
1486
+ details: z11.string().optional()
1470
1487
  }),
1471
- z10.object({
1472
- type: z10.literal("deprecated"),
1473
- setting: z10.string(),
1474
- message: z10.string()
1488
+ z11.object({
1489
+ type: z11.literal("deprecated"),
1490
+ setting: z11.string(),
1491
+ message: z11.string()
1475
1492
  }),
1476
- z10.object({
1477
- type: z10.literal("other"),
1478
- message: z10.string()
1493
+ z11.object({
1494
+ type: z11.literal("other"),
1495
+ message: z11.string()
1479
1496
  })
1480
1497
  ]);
1481
- var gatewayVideoEventSchema = z10.discriminatedUnion("type", [
1482
- z10.object({
1483
- type: z10.literal("result"),
1484
- videos: z10.array(gatewayVideoDataSchema),
1485
- warnings: z10.array(gatewayVideoWarningSchema).optional(),
1486
- providerMetadata: z10.record(z10.string(), providerMetadataEntrySchema2).optional()
1498
+ var gatewayVideoEventSchema = z11.discriminatedUnion("type", [
1499
+ z11.object({
1500
+ type: z11.literal("result"),
1501
+ videos: z11.array(gatewayVideoDataSchema),
1502
+ warnings: z11.array(gatewayVideoWarningSchema).optional(),
1503
+ providerMetadata: z11.record(z11.string(), providerMetadataEntrySchema2).optional()
1487
1504
  }),
1488
- z10.object({
1489
- type: z10.literal("error"),
1490
- message: z10.string(),
1491
- errorType: z10.string(),
1492
- statusCode: z10.number(),
1493
- param: z10.unknown().nullable()
1505
+ z11.object({
1506
+ type: z11.literal("error"),
1507
+ message: z11.string(),
1508
+ errorType: z11.string(),
1509
+ statusCode: z11.number(),
1510
+ param: z11.unknown().nullable()
1494
1511
  })
1495
1512
  ]);
1496
1513
 
@@ -1499,12 +1516,12 @@ import {
1499
1516
  combineHeaders as combineHeaders5,
1500
1517
  createJsonErrorResponseHandler as createJsonErrorResponseHandler8,
1501
1518
  createJsonResponseHandler as createJsonResponseHandler7,
1502
- lazySchema as lazySchema8,
1519
+ lazySchema as lazySchema9,
1503
1520
  postJsonToApi as postJsonToApi5,
1504
1521
  resolve as resolve8,
1505
- zodSchema as zodSchema8
1522
+ zodSchema as zodSchema9
1506
1523
  } from "@ai-sdk/provider-utils";
1507
- import { z as z11 } from "zod/v4";
1524
+ import { z as z12 } from "zod/v4";
1508
1525
  var GatewayRerankingModel = class {
1509
1526
  constructor(modelId, config) {
1510
1527
  this.modelId = modelId;
@@ -1547,7 +1564,7 @@ var GatewayRerankingModel = class {
1547
1564
  gatewayRerankingResponseSchema
1548
1565
  ),
1549
1566
  failedResponseHandler: createJsonErrorResponseHandler8({
1550
- errorSchema: z11.any(),
1567
+ errorSchema: z12.any(),
1551
1568
  errorToMessage: (data) => data
1552
1569
  }),
1553
1570
  ...abortSignal && { abortSignal },
@@ -1573,33 +1590,33 @@ var GatewayRerankingModel = class {
1573
1590
  };
1574
1591
  }
1575
1592
  };
1576
- var gatewayRerankingWarningSchema = z11.discriminatedUnion("type", [
1577
- z11.object({
1578
- type: z11.literal("unsupported"),
1579
- feature: z11.string(),
1580
- details: z11.string().optional()
1593
+ var gatewayRerankingWarningSchema = z12.discriminatedUnion("type", [
1594
+ z12.object({
1595
+ type: z12.literal("unsupported"),
1596
+ feature: z12.string(),
1597
+ details: z12.string().optional()
1581
1598
  }),
1582
- z11.object({
1583
- type: z11.literal("compatibility"),
1584
- feature: z11.string(),
1585
- details: z11.string().optional()
1599
+ z12.object({
1600
+ type: z12.literal("compatibility"),
1601
+ feature: z12.string(),
1602
+ details: z12.string().optional()
1586
1603
  }),
1587
- z11.object({
1588
- type: z11.literal("other"),
1589
- message: z11.string()
1604
+ z12.object({
1605
+ type: z12.literal("other"),
1606
+ message: z12.string()
1590
1607
  })
1591
1608
  ]);
1592
- var gatewayRerankingResponseSchema = lazySchema8(
1593
- () => zodSchema8(
1594
- z11.object({
1595
- ranking: z11.array(
1596
- z11.object({
1597
- index: z11.number(),
1598
- relevanceScore: z11.number()
1609
+ var gatewayRerankingResponseSchema = lazySchema9(
1610
+ () => zodSchema9(
1611
+ z12.object({
1612
+ ranking: z12.array(
1613
+ z12.object({
1614
+ index: z12.number(),
1615
+ relevanceScore: z12.number()
1599
1616
  })
1600
1617
  ),
1601
- warnings: z11.array(gatewayRerankingWarningSchema).optional(),
1602
- providerMetadata: z11.record(z11.string(), z11.record(z11.string(), z11.unknown())).optional()
1618
+ warnings: z12.array(gatewayRerankingWarningSchema).optional(),
1619
+ providerMetadata: z12.record(z12.string(), z12.record(z12.string(), z12.unknown())).optional()
1603
1620
  })
1604
1621
  )
1605
1622
  );
@@ -1612,7 +1629,7 @@ import {
1612
1629
  postJsonToApi as postJsonToApi6,
1613
1630
  resolve as resolve9
1614
1631
  } from "@ai-sdk/provider-utils";
1615
- import { z as z12 } from "zod/v4";
1632
+ import { z as z13 } from "zod/v4";
1616
1633
  var GatewaySpeechModel = class {
1617
1634
  constructor(modelId, config) {
1618
1635
  this.modelId = modelId;
@@ -1660,7 +1677,7 @@ var GatewaySpeechModel = class {
1660
1677
  gatewaySpeechResponseSchema
1661
1678
  ),
1662
1679
  failedResponseHandler: createJsonErrorResponseHandler9({
1663
- errorSchema: z12.any(),
1680
+ errorSchema: z13.any(),
1664
1681
  errorToMessage: (data) => data
1665
1682
  }),
1666
1683
  ...abortSignal && { abortSignal },
@@ -1694,32 +1711,32 @@ var GatewaySpeechModel = class {
1694
1711
  };
1695
1712
  }
1696
1713
  };
1697
- var providerMetadataEntrySchema3 = z12.object({}).catchall(z12.unknown());
1698
- var gatewaySpeechWarningSchema = z12.discriminatedUnion("type", [
1699
- z12.object({
1700
- type: z12.literal("unsupported"),
1701
- feature: z12.string(),
1702
- details: z12.string().optional()
1714
+ var providerMetadataEntrySchema3 = z13.object({}).catchall(z13.unknown());
1715
+ var gatewaySpeechWarningSchema = z13.discriminatedUnion("type", [
1716
+ z13.object({
1717
+ type: z13.literal("unsupported"),
1718
+ feature: z13.string(),
1719
+ details: z13.string().optional()
1703
1720
  }),
1704
- z12.object({
1705
- type: z12.literal("compatibility"),
1706
- feature: z12.string(),
1707
- details: z12.string().optional()
1721
+ z13.object({
1722
+ type: z13.literal("compatibility"),
1723
+ feature: z13.string(),
1724
+ details: z13.string().optional()
1708
1725
  }),
1709
- z12.object({
1710
- type: z12.literal("deprecated"),
1711
- setting: z12.string(),
1712
- message: z12.string()
1726
+ z13.object({
1727
+ type: z13.literal("deprecated"),
1728
+ setting: z13.string(),
1729
+ message: z13.string()
1713
1730
  }),
1714
- z12.object({
1715
- type: z12.literal("other"),
1716
- message: z12.string()
1731
+ z13.object({
1732
+ type: z13.literal("other"),
1733
+ message: z13.string()
1717
1734
  })
1718
1735
  ]);
1719
- var gatewaySpeechResponseSchema = z12.object({
1720
- audio: z12.string(),
1721
- warnings: z12.array(gatewaySpeechWarningSchema).optional(),
1722
- providerMetadata: z12.record(z12.string(), providerMetadataEntrySchema3).optional()
1736
+ var gatewaySpeechResponseSchema = z13.object({
1737
+ audio: z13.string(),
1738
+ warnings: z13.array(gatewaySpeechWarningSchema).optional(),
1739
+ providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema3).optional()
1723
1740
  });
1724
1741
 
1725
1742
  // src/gateway-transcription-model.ts
@@ -1731,7 +1748,7 @@ import {
1731
1748
  postJsonToApi as postJsonToApi7,
1732
1749
  resolve as resolve10
1733
1750
  } from "@ai-sdk/provider-utils";
1734
- import { z as z13 } from "zod/v4";
1751
+ import { z as z14 } from "zod/v4";
1735
1752
  var GatewayTranscriptionModel = class {
1736
1753
  constructor(modelId, config) {
1737
1754
  this.modelId = modelId;
@@ -1772,7 +1789,7 @@ var GatewayTranscriptionModel = class {
1772
1789
  gatewayTranscriptionResponseSchema
1773
1790
  ),
1774
1791
  failedResponseHandler: createJsonErrorResponseHandler10({
1775
- errorSchema: z13.any(),
1792
+ errorSchema: z14.any(),
1776
1793
  errorToMessage: (data) => data
1777
1794
  }),
1778
1795
  ...abortSignal && { abortSignal },
@@ -1809,59 +1826,59 @@ var GatewayTranscriptionModel = class {
1809
1826
  };
1810
1827
  }
1811
1828
  };
1812
- var providerMetadataEntrySchema4 = z13.object({}).catchall(z13.unknown());
1813
- var gatewayTranscriptionWarningSchema = z13.discriminatedUnion("type", [
1814
- z13.object({
1815
- type: z13.literal("unsupported"),
1816
- feature: z13.string(),
1817
- details: z13.string().optional()
1829
+ var providerMetadataEntrySchema4 = z14.object({}).catchall(z14.unknown());
1830
+ var gatewayTranscriptionWarningSchema = z14.discriminatedUnion("type", [
1831
+ z14.object({
1832
+ type: z14.literal("unsupported"),
1833
+ feature: z14.string(),
1834
+ details: z14.string().optional()
1818
1835
  }),
1819
- z13.object({
1820
- type: z13.literal("compatibility"),
1821
- feature: z13.string(),
1822
- details: z13.string().optional()
1836
+ z14.object({
1837
+ type: z14.literal("compatibility"),
1838
+ feature: z14.string(),
1839
+ details: z14.string().optional()
1823
1840
  }),
1824
- z13.object({
1825
- type: z13.literal("deprecated"),
1826
- setting: z13.string(),
1827
- message: z13.string()
1841
+ z14.object({
1842
+ type: z14.literal("deprecated"),
1843
+ setting: z14.string(),
1844
+ message: z14.string()
1828
1845
  }),
1829
- z13.object({
1830
- type: z13.literal("other"),
1831
- message: z13.string()
1846
+ z14.object({
1847
+ type: z14.literal("other"),
1848
+ message: z14.string()
1832
1849
  })
1833
1850
  ]);
1834
- var gatewayTranscriptionResponseSchema = z13.object({
1835
- text: z13.string(),
1836
- segments: z13.array(
1837
- z13.object({
1838
- text: z13.string(),
1839
- startSecond: z13.number(),
1840
- endSecond: z13.number()
1851
+ var gatewayTranscriptionResponseSchema = z14.object({
1852
+ text: z14.string(),
1853
+ segments: z14.array(
1854
+ z14.object({
1855
+ text: z14.string(),
1856
+ startSecond: z14.number(),
1857
+ endSecond: z14.number()
1841
1858
  })
1842
1859
  ).optional(),
1843
- language: z13.string().nullish(),
1844
- durationInSeconds: z13.number().nullish(),
1845
- warnings: z13.array(gatewayTranscriptionWarningSchema).optional(),
1846
- providerMetadata: z13.record(z13.string(), providerMetadataEntrySchema4).optional()
1860
+ language: z14.string().nullish(),
1861
+ durationInSeconds: z14.number().nullish(),
1862
+ warnings: z14.array(gatewayTranscriptionWarningSchema).optional(),
1863
+ providerMetadata: z14.record(z14.string(), providerMetadataEntrySchema4).optional()
1847
1864
  });
1848
1865
 
1849
1866
  // src/tool/exa-search.ts
1850
1867
  import {
1851
1868
  createProviderToolFactoryWithOutputSchema,
1852
- lazySchema as lazySchema9,
1853
- zodSchema as zodSchema9
1869
+ lazySchema as lazySchema10,
1870
+ zodSchema as zodSchema10
1854
1871
  } from "@ai-sdk/provider-utils";
1855
- import { z as z14 } from "zod";
1856
- var exaSearchInputSchema = lazySchema9(
1857
- () => zodSchema9(
1858
- z14.object({
1859
- query: z14.string().describe("Natural-language web search query. This is required."),
1860
- type: z14.enum(["auto", "fast", "instant"]).optional().describe(
1872
+ import { z as z15 } from "zod";
1873
+ var exaSearchInputSchema = lazySchema10(
1874
+ () => zodSchema10(
1875
+ z15.object({
1876
+ query: z15.string().describe("Natural-language web search query. This is required."),
1877
+ type: z15.enum(["auto", "fast", "instant"]).optional().describe(
1861
1878
  "Search method. Use auto for the default balance of speed and quality."
1862
1879
  ),
1863
- num_results: z14.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
1864
- category: z14.enum([
1880
+ num_results: z15.number().optional().describe("Maximum number of results to return (1-100, default: 10)."),
1881
+ category: z15.enum([
1865
1882
  "company",
1866
1883
  "people",
1867
1884
  "research paper",
@@ -1869,20 +1886,20 @@ var exaSearchInputSchema = lazySchema9(
1869
1886
  "personal site",
1870
1887
  "financial report"
1871
1888
  ]).optional().describe("Optional content category to focus results."),
1872
- user_location: z14.string().optional().describe("Two-letter ISO country code such as 'US'."),
1873
- include_domains: z14.array(z14.string()).optional().describe("Only return results from these domains."),
1874
- exclude_domains: z14.array(z14.string()).optional().describe("Exclude results from these domains."),
1875
- start_published_date: z14.string().optional().describe("Only return links published after this ISO 8601 date."),
1876
- end_published_date: z14.string().optional().describe("Only return links published before this ISO 8601 date."),
1877
- contents: z14.object({
1878
- text: z14.union([
1879
- z14.boolean(),
1880
- z14.object({
1881
- max_characters: z14.number().optional(),
1882
- include_html_tags: z14.boolean().optional(),
1883
- verbosity: z14.enum(["compact", "standard", "full"]).optional(),
1884
- include_sections: z14.array(
1885
- z14.enum([
1889
+ user_location: z15.string().optional().describe("Two-letter ISO country code such as 'US'."),
1890
+ include_domains: z15.array(z15.string()).optional().describe("Only return results from these domains."),
1891
+ exclude_domains: z15.array(z15.string()).optional().describe("Exclude results from these domains."),
1892
+ start_published_date: z15.string().optional().describe("Only return links published after this ISO 8601 date."),
1893
+ end_published_date: z15.string().optional().describe("Only return links published before this ISO 8601 date."),
1894
+ contents: z15.object({
1895
+ text: z15.union([
1896
+ z15.boolean(),
1897
+ z15.object({
1898
+ max_characters: z15.number().optional(),
1899
+ include_html_tags: z15.boolean().optional(),
1900
+ verbosity: z15.enum(["compact", "standard", "full"]).optional(),
1901
+ include_sections: z15.array(
1902
+ z15.enum([
1886
1903
  "header",
1887
1904
  "navigation",
1888
1905
  "banner",
@@ -1892,8 +1909,8 @@ var exaSearchInputSchema = lazySchema9(
1892
1909
  "metadata"
1893
1910
  ])
1894
1911
  ).optional(),
1895
- exclude_sections: z14.array(
1896
- z14.enum([
1912
+ exclude_sections: z15.array(
1913
+ z15.enum([
1897
1914
  "header",
1898
1915
  "navigation",
1899
1916
  "banner",
@@ -1905,59 +1922,59 @@ var exaSearchInputSchema = lazySchema9(
1905
1922
  ).optional()
1906
1923
  })
1907
1924
  ]).optional(),
1908
- highlights: z14.union([
1909
- z14.boolean(),
1910
- z14.object({
1911
- query: z14.string().optional(),
1912
- max_characters: z14.number().optional()
1925
+ highlights: z15.union([
1926
+ z15.boolean(),
1927
+ z15.object({
1928
+ query: z15.string().optional(),
1929
+ max_characters: z15.number().optional()
1913
1930
  })
1914
1931
  ]).optional(),
1915
- max_age_hours: z14.number().optional(),
1916
- livecrawl_timeout: z14.number().optional(),
1917
- subpages: z14.number().optional(),
1918
- subpage_target: z14.union([z14.string(), z14.array(z14.string())]).optional(),
1919
- extras: z14.object({
1920
- links: z14.number().optional(),
1921
- image_links: z14.number().optional()
1932
+ max_age_hours: z15.number().optional(),
1933
+ livecrawl_timeout: z15.number().optional(),
1934
+ subpages: z15.number().optional(),
1935
+ subpage_target: z15.union([z15.string(), z15.array(z15.string())]).optional(),
1936
+ extras: z15.object({
1937
+ links: z15.number().optional(),
1938
+ image_links: z15.number().optional()
1922
1939
  }).optional()
1923
1940
  }).optional().describe("Controls extracted page content and freshness.")
1924
1941
  })
1925
1942
  )
1926
1943
  );
1927
- var exaSearchOutputSchema = lazySchema9(
1928
- () => zodSchema9(
1929
- z14.union([
1930
- z14.object({
1931
- requestId: z14.string(),
1932
- searchType: z14.string().optional(),
1933
- resolvedSearchType: z14.string().optional(),
1934
- results: z14.array(
1935
- z14.object({
1936
- title: z14.string(),
1937
- url: z14.string(),
1938
- id: z14.string(),
1939
- publishedDate: z14.string().nullable().optional(),
1940
- author: z14.string().nullable().optional(),
1941
- image: z14.string().nullable().optional(),
1942
- favicon: z14.string().nullable().optional(),
1943
- text: z14.string().optional(),
1944
- highlights: z14.array(z14.string()).optional(),
1945
- highlightScores: z14.array(z14.number()).optional(),
1946
- summary: z14.string().optional(),
1947
- subpages: z14.array(z14.any()).optional(),
1948
- extras: z14.object({
1949
- links: z14.array(z14.string()).optional(),
1950
- imageLinks: z14.array(z14.string()).optional()
1944
+ var exaSearchOutputSchema = lazySchema10(
1945
+ () => zodSchema10(
1946
+ z15.union([
1947
+ z15.object({
1948
+ requestId: z15.string(),
1949
+ searchType: z15.string().optional(),
1950
+ resolvedSearchType: z15.string().optional(),
1951
+ results: z15.array(
1952
+ z15.object({
1953
+ title: z15.string(),
1954
+ url: z15.string(),
1955
+ id: z15.string(),
1956
+ publishedDate: z15.string().nullable().optional(),
1957
+ author: z15.string().nullable().optional(),
1958
+ image: z15.string().nullable().optional(),
1959
+ favicon: z15.string().nullable().optional(),
1960
+ text: z15.string().optional(),
1961
+ highlights: z15.array(z15.string()).optional(),
1962
+ highlightScores: z15.array(z15.number()).optional(),
1963
+ summary: z15.string().optional(),
1964
+ subpages: z15.array(z15.any()).optional(),
1965
+ extras: z15.object({
1966
+ links: z15.array(z15.string()).optional(),
1967
+ imageLinks: z15.array(z15.string()).optional()
1951
1968
  }).optional()
1952
1969
  })
1953
1970
  ),
1954
- costDollars: z14.object({
1955
- total: z14.number().optional(),
1956
- search: z14.record(z14.number()).optional()
1971
+ costDollars: z15.object({
1972
+ total: z15.number().optional(),
1973
+ search: z15.record(z15.number()).optional()
1957
1974
  }).optional()
1958
1975
  }),
1959
- z14.object({
1960
- error: z14.enum([
1976
+ z15.object({
1977
+ error: z15.enum([
1961
1978
  "api_error",
1962
1979
  "rate_limit",
1963
1980
  "timeout",
@@ -1966,8 +1983,8 @@ var exaSearchOutputSchema = lazySchema9(
1966
1983
  "execution_error",
1967
1984
  "unknown"
1968
1985
  ]),
1969
- statusCode: z14.number().optional(),
1970
- message: z14.string()
1986
+ statusCode: z15.number().optional(),
1987
+ message: z15.string()
1971
1988
  })
1972
1989
  ])
1973
1990
  )
@@ -1982,69 +1999,69 @@ var exaSearch = (config = {}) => exaSearchToolFactory(config);
1982
1999
  // src/tool/parallel-search.ts
1983
2000
  import {
1984
2001
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema2,
1985
- lazySchema as lazySchema10,
1986
- zodSchema as zodSchema10
2002
+ lazySchema as lazySchema11,
2003
+ zodSchema as zodSchema11
1987
2004
  } from "@ai-sdk/provider-utils";
1988
- import { z as z15 } from "zod";
1989
- var parallelSearchInputSchema = lazySchema10(
1990
- () => zodSchema10(
1991
- z15.object({
1992
- objective: z15.string().describe(
2005
+ import { z as z16 } from "zod";
2006
+ var parallelSearchInputSchema = lazySchema11(
2007
+ () => zodSchema11(
2008
+ z16.object({
2009
+ objective: z16.string().describe(
1993
2010
  "Natural-language description of the web research goal, including source or freshness guidance and broader context from the task. Maximum 5000 characters."
1994
2011
  ),
1995
- search_queries: z15.array(z15.string()).optional().describe(
2012
+ search_queries: z16.array(z16.string()).optional().describe(
1996
2013
  "Optional search queries to supplement the objective. Maximum 200 characters per query."
1997
2014
  ),
1998
- mode: z15.enum(["one-shot", "agentic"]).optional().describe(
2015
+ mode: z16.enum(["one-shot", "agentic"]).optional().describe(
1999
2016
  'Mode preset: "one-shot" for comprehensive results with longer excerpts (default), "agentic" for concise, token-efficient results for multi-step workflows.'
2000
2017
  ),
2001
- max_results: z15.number().optional().describe(
2018
+ max_results: z16.number().optional().describe(
2002
2019
  "Maximum number of results to return (1-20). Defaults to 10 if not specified."
2003
2020
  ),
2004
- source_policy: z15.object({
2005
- include_domains: z15.array(z15.string()).optional().describe(
2021
+ source_policy: z16.object({
2022
+ include_domains: z16.array(z16.string()).optional().describe(
2006
2023
  "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)."
2007
2024
  ),
2008
- exclude_domains: z15.array(z15.string()).optional().describe(
2025
+ exclude_domains: z16.array(z16.string()).optional().describe(
2009
2026
  "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)."
2010
2027
  ),
2011
- after_date: z15.string().optional().describe(
2028
+ after_date: z16.string().optional().describe(
2012
2029
  "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."
2013
2030
  )
2014
2031
  }).optional().describe(
2015
2032
  "Source policy for controlling which domains to include/exclude and freshness."
2016
2033
  ),
2017
- excerpts: z15.object({
2018
- max_chars_per_result: z15.number().optional().describe("Maximum characters per result."),
2019
- max_chars_total: z15.number().optional().describe("Maximum total characters across all results.")
2034
+ excerpts: z16.object({
2035
+ max_chars_per_result: z16.number().optional().describe("Maximum characters per result."),
2036
+ max_chars_total: z16.number().optional().describe("Maximum total characters across all results.")
2020
2037
  }).optional().describe("Excerpt configuration for controlling result length."),
2021
- fetch_policy: z15.object({
2022
- max_age_seconds: z15.number().optional().describe(
2038
+ fetch_policy: z16.object({
2039
+ max_age_seconds: z16.number().optional().describe(
2023
2040
  "Maximum age in seconds for cached content. Set to 0 to always fetch fresh content."
2024
2041
  )
2025
2042
  }).optional().describe("Fetch policy for controlling content freshness.")
2026
2043
  })
2027
2044
  )
2028
2045
  );
2029
- var parallelSearchOutputSchema = lazySchema10(
2030
- () => zodSchema10(
2031
- z15.union([
2046
+ var parallelSearchOutputSchema = lazySchema11(
2047
+ () => zodSchema11(
2048
+ z16.union([
2032
2049
  // Success response
2033
- z15.object({
2034
- searchId: z15.string(),
2035
- results: z15.array(
2036
- z15.object({
2037
- url: z15.string(),
2038
- title: z15.string(),
2039
- excerpt: z15.string(),
2040
- publishDate: z15.string().nullable().optional(),
2041
- relevanceScore: z15.number().optional()
2050
+ z16.object({
2051
+ searchId: z16.string(),
2052
+ results: z16.array(
2053
+ z16.object({
2054
+ url: z16.string(),
2055
+ title: z16.string(),
2056
+ excerpt: z16.string(),
2057
+ publishDate: z16.string().nullable().optional(),
2058
+ relevanceScore: z16.number().optional()
2042
2059
  })
2043
2060
  )
2044
2061
  }),
2045
2062
  // Error response
2046
- z15.object({
2047
- error: z15.enum([
2063
+ z16.object({
2064
+ error: z16.enum([
2048
2065
  "api_error",
2049
2066
  "rate_limit",
2050
2067
  "timeout",
@@ -2052,8 +2069,8 @@ var parallelSearchOutputSchema = lazySchema10(
2052
2069
  "configuration_error",
2053
2070
  "unknown"
2054
2071
  ]),
2055
- statusCode: z15.number().optional(),
2056
- message: z15.string()
2072
+ statusCode: z16.number().optional(),
2073
+ message: z16.string()
2057
2074
  })
2058
2075
  ])
2059
2076
  )
@@ -2068,79 +2085,79 @@ var parallelSearch = (config = {}) => parallelSearchToolFactory(config);
2068
2085
  // src/tool/perplexity-search.ts
2069
2086
  import {
2070
2087
  createProviderToolFactoryWithOutputSchema as createProviderToolFactoryWithOutputSchema3,
2071
- lazySchema as lazySchema11,
2072
- zodSchema as zodSchema11
2088
+ lazySchema as lazySchema12,
2089
+ zodSchema as zodSchema12
2073
2090
  } from "@ai-sdk/provider-utils";
2074
- import { z as z16 } from "zod";
2075
- var perplexitySearchInputSchema = lazySchema11(
2076
- () => zodSchema11(
2077
- z16.object({
2078
- query: z16.union([z16.string(), z16.array(z16.string())]).describe(
2091
+ import { z as z17 } from "zod";
2092
+ var perplexitySearchInputSchema = lazySchema12(
2093
+ () => zodSchema12(
2094
+ z17.object({
2095
+ query: z17.union([z17.string(), z17.array(z17.string())]).describe(
2079
2096
  "Search query (string) or multiple queries (array of up to 5 strings). Multi-query searches return combined results from all queries."
2080
2097
  ),
2081
- max_results: z16.number().optional().describe(
2098
+ max_results: z17.number().optional().describe(
2082
2099
  "Maximum number of search results to return (1-20, default: 10)"
2083
2100
  ),
2084
- max_tokens_per_page: z16.number().optional().describe(
2101
+ max_tokens_per_page: z17.number().optional().describe(
2085
2102
  "Maximum number of tokens to extract per search result page (256-2048, default: 2048)"
2086
2103
  ),
2087
- max_tokens: z16.number().optional().describe(
2104
+ max_tokens: z17.number().optional().describe(
2088
2105
  "Maximum total tokens across all search results (default: 25000, max: 1000000)"
2089
2106
  ),
2090
- country: z16.string().optional().describe(
2107
+ country: z17.string().optional().describe(
2091
2108
  "Two-letter ISO 3166-1 alpha-2 country code for regional search results (e.g., 'US', 'GB', 'FR')"
2092
2109
  ),
2093
- search_domain_filter: z16.array(z16.string()).optional().describe(
2110
+ search_domain_filter: z17.array(z17.string()).optional().describe(
2094
2111
  "List of domains to include or exclude from search results (max 20). To include: ['nature.com', 'science.org']. To exclude: ['-example.com', '-spam.net']"
2095
2112
  ),
2096
- search_language_filter: z16.array(z16.string()).optional().describe(
2113
+ search_language_filter: z17.array(z17.string()).optional().describe(
2097
2114
  "List of ISO 639-1 language codes to filter results (max 10, lowercase). Examples: ['en', 'fr', 'de']"
2098
2115
  ),
2099
- search_after_date: z16.string().optional().describe(
2116
+ search_after_date: z17.string().optional().describe(
2100
2117
  "Include only results published after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
2101
2118
  ),
2102
- search_before_date: z16.string().optional().describe(
2119
+ search_before_date: z17.string().optional().describe(
2103
2120
  "Include only results published before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
2104
2121
  ),
2105
- last_updated_after_filter: z16.string().optional().describe(
2122
+ last_updated_after_filter: z17.string().optional().describe(
2106
2123
  "Include only results last updated after this date. Format: 'MM/DD/YYYY' (e.g., '3/1/2025'). Cannot be used with search_recency_filter."
2107
2124
  ),
2108
- last_updated_before_filter: z16.string().optional().describe(
2125
+ last_updated_before_filter: z17.string().optional().describe(
2109
2126
  "Include only results last updated before this date. Format: 'MM/DD/YYYY' (e.g., '3/15/2025'). Cannot be used with search_recency_filter."
2110
2127
  ),
2111
- search_recency_filter: z16.enum(["day", "week", "month", "year"]).optional().describe(
2128
+ search_recency_filter: z17.enum(["day", "week", "month", "year"]).optional().describe(
2112
2129
  "Filter results by relative time period. Cannot be used with search_after_date or search_before_date."
2113
2130
  )
2114
2131
  })
2115
2132
  )
2116
2133
  );
2117
- var perplexitySearchOutputSchema = lazySchema11(
2118
- () => zodSchema11(
2119
- z16.union([
2134
+ var perplexitySearchOutputSchema = lazySchema12(
2135
+ () => zodSchema12(
2136
+ z17.union([
2120
2137
  // Success response
2121
- z16.object({
2122
- results: z16.array(
2123
- z16.object({
2124
- title: z16.string(),
2125
- url: z16.string(),
2126
- snippet: z16.string(),
2127
- date: z16.string().optional(),
2128
- lastUpdated: z16.string().optional()
2138
+ z17.object({
2139
+ results: z17.array(
2140
+ z17.object({
2141
+ title: z17.string(),
2142
+ url: z17.string(),
2143
+ snippet: z17.string(),
2144
+ date: z17.string().optional(),
2145
+ lastUpdated: z17.string().optional()
2129
2146
  })
2130
2147
  ),
2131
- id: z16.string()
2148
+ id: z17.string()
2132
2149
  }),
2133
2150
  // Error response
2134
- z16.object({
2135
- error: z16.enum([
2151
+ z17.object({
2152
+ error: z17.enum([
2136
2153
  "api_error",
2137
2154
  "rate_limit",
2138
2155
  "timeout",
2139
2156
  "invalid_input",
2140
2157
  "unknown"
2141
2158
  ]),
2142
- statusCode: z16.number().optional(),
2143
- message: z16.string()
2159
+ statusCode: z17.number().optional(),
2160
+ message: z17.string()
2144
2161
  })
2145
2162
  ])
2146
2163
  )
@@ -2190,7 +2207,7 @@ async function getVercelRequestId() {
2190
2207
  }
2191
2208
 
2192
2209
  // src/version.ts
2193
- var VERSION = true ? "3.0.145" : "0.0.0-test";
2210
+ var VERSION = true ? "3.0.146" : "0.0.0-test";
2194
2211
 
2195
2212
  // src/gateway-provider.ts
2196
2213
  var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";