@ai-sdk/google 3.0.139 → 3.0.141

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.
@@ -1,4 +1,7 @@
1
1
  // src/google-generative-ai-language-model.ts
2
+ import {
3
+ APICallError
4
+ } from "@ai-sdk/provider";
2
5
  import {
3
6
  combineHeaders,
4
7
  createEventSourceResponseHandler,
@@ -10,7 +13,7 @@ import {
10
13
  resolve,
11
14
  zodSchema as zodSchema3
12
15
  } from "@ai-sdk/provider-utils";
13
- import { z as z3 } from "zod/v4";
16
+ import { z as z4 } from "zod/v4";
14
17
 
15
18
  // src/continue-google-stream.ts
16
19
  function continueGoogleStream({
@@ -437,10 +440,24 @@ import {
437
440
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
438
441
  } from "@ai-sdk/provider";
439
442
  import {
443
+ stringifyWithBigIntAndCycles,
440
444
  convertToBase64,
441
445
  isUrlSupported,
442
446
  secureJsonParse
443
447
  } from "@ai-sdk/provider-utils";
448
+
449
+ // src/google-generative-ai-prompt.ts
450
+ import { z } from "zod/v4";
451
+ var googleVideoMetadataSchema = z.object({
452
+ /** Start offset as a duration in seconds, e.g. `'3.5s'`. */
453
+ startOffset: z.string().optional(),
454
+ /** End offset as a duration in seconds, e.g. `'10s'`. */
455
+ endOffset: z.string().optional(),
456
+ /** Frames per second in the range (0, 24]. Defaults to 1. */
457
+ fps: z.number().gt(0).max(24).optional()
458
+ });
459
+
460
+ // src/convert-to-google-generative-ai-messages.ts
444
461
  var SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
445
462
  function getGoogleProviderOptions(providerOptions, providerOptionsName) {
446
463
  const namespaces = [
@@ -490,6 +507,31 @@ function convertUrlToolResultPart(url, mediaType, supportedFunctionResponseUrls)
490
507
  }
491
508
  } : void 0;
492
509
  }
510
+ function serializeFunctionResponseContent(value) {
511
+ return containsNonJsonValue(value) ? secureJsonParse(stringifyWithBigIntAndCycles(value)) : value;
512
+ }
513
+ function containsNonJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
514
+ if (typeof value === "bigint") {
515
+ return true;
516
+ }
517
+ if (typeof value !== "object" || value === null) {
518
+ return false;
519
+ }
520
+ if (typeof value.toJSON === "function") {
521
+ return true;
522
+ }
523
+ if (ancestors.has(value)) {
524
+ return true;
525
+ }
526
+ ancestors.add(value);
527
+ try {
528
+ return Object.values(value).some(
529
+ (item) => containsNonJsonValue(item, ancestors)
530
+ );
531
+ } finally {
532
+ ancestors.delete(value);
533
+ }
534
+ }
493
535
  function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true, supportedFunctionResponseUrls = {}) {
494
536
  const functionResponseParts = [];
495
537
  const responseTextParts = [];
@@ -519,12 +561,12 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId, include
519
561
  if (functionResponsePart != null) {
520
562
  functionResponseParts.push(functionResponsePart);
521
563
  } else {
522
- responseTextParts.push(JSON.stringify(contentPart));
564
+ responseTextParts.push(stringifyWithBigIntAndCycles(contentPart));
523
565
  }
524
566
  break;
525
567
  }
526
568
  default: {
527
- responseTextParts.push(JSON.stringify(contentPart));
569
+ responseTextParts.push(stringifyWithBigIntAndCycles(contentPart));
528
570
  break;
529
571
  }
530
572
  }
@@ -573,13 +615,13 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, i
573
615
  break;
574
616
  }
575
617
  default:
576
- parts.push({ text: JSON.stringify(contentPart) });
618
+ parts.push({ text: stringifyWithBigIntAndCycles(contentPart) });
577
619
  break;
578
620
  }
579
621
  }
580
622
  }
581
623
  function convertToGoogleGenerativeAIMessages(prompt, options) {
582
- var _a, _b, _c, _d, _e, _f, _g;
624
+ var _a, _b, _c, _d, _e, _f, _g, _h;
583
625
  const systemInstructionParts = [];
584
626
  const contents = [];
585
627
  let systemMessagesAllowed = true;
@@ -619,17 +661,24 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
619
661
  }
620
662
  case "file": {
621
663
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
664
+ const rawVideoMetadata = (_g = getGoogleProviderOptions(
665
+ part.providerOptions,
666
+ providerOptionsName
667
+ )) == null ? void 0 : _g.videoMetadata;
668
+ const videoMetadata = rawVideoMetadata == null ? void 0 : googleVideoMetadataSchema.parse(rawVideoMetadata);
622
669
  parts.push(
623
670
  part.data instanceof URL ? {
624
671
  fileData: {
625
672
  mimeType: mediaType,
626
673
  fileUri: part.data.protocol === "gs:" && part.originalUrl != null ? part.originalUrl : part.data.toString()
627
- }
674
+ },
675
+ ...videoMetadata != null ? { videoMetadata } : {}
628
676
  } : {
629
677
  inlineData: {
630
678
  mimeType: mediaType,
631
679
  data: convertToBase64(part.data)
632
- }
680
+ },
681
+ ...videoMetadata != null ? { videoMetadata } : {}
633
682
  }
634
683
  );
635
684
  break;
@@ -708,7 +757,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
708
757
  functionCall: {
709
758
  ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
710
759
  name: part.toolName,
711
- args: part.input
760
+ args: parseToolCallInput(part.input)
712
761
  },
713
762
  thoughtSignature: effectiveThoughtSignature
714
763
  };
@@ -790,7 +839,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
790
839
  name: part.toolName,
791
840
  response: {
792
841
  name: part.toolName,
793
- content: output.type === "execution-denied" ? (_g = output.reason) != null ? _g : "Tool call execution denied." : output.value
842
+ content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool call execution denied." : serializeFunctionResponseContent(output.value)
794
843
  }
795
844
  }
796
845
  });
@@ -820,6 +869,16 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
820
869
  contents
821
870
  };
822
871
  }
872
+ function parseToolCallInput(input) {
873
+ if (typeof input !== "string") {
874
+ return input;
875
+ }
876
+ try {
877
+ return secureJsonParse(input);
878
+ } catch (e) {
879
+ return input;
880
+ }
881
+ }
823
882
 
824
883
  // src/download-tool-result-files.ts
825
884
  import {
@@ -902,16 +961,17 @@ import {
902
961
  lazySchema,
903
962
  zodSchema
904
963
  } from "@ai-sdk/provider-utils";
905
- import { z } from "zod/v4";
964
+ import { z as z2 } from "zod/v4";
965
+ var getGoogleErrorSchema = () => z2.object({
966
+ code: z2.number().nullable(),
967
+ message: z2.string(),
968
+ status: z2.string(),
969
+ details: z2.array(z2.unknown()).nullish()
970
+ });
906
971
  var googleErrorDataSchema = lazySchema(
907
972
  () => zodSchema(
908
- z.object({
909
- error: z.object({
910
- code: z.number().nullable(),
911
- message: z.string(),
912
- status: z.string(),
913
- details: z.array(z.unknown()).nullish()
914
- })
973
+ z2.object({
974
+ error: getGoogleErrorSchema()
915
975
  })
916
976
  )
917
977
  );
@@ -919,29 +979,62 @@ var googleFailedResponseHandler = createJsonErrorResponseHandler({
919
979
  errorSchema: googleErrorDataSchema,
920
980
  errorToMessage: (data) => data.error.message
921
981
  });
982
+ function mapGoogleErrorStatusToHttpStatusCode(status) {
983
+ switch (status) {
984
+ case "CANCELLED":
985
+ return 499;
986
+ case "INVALID_ARGUMENT":
987
+ case "FAILED_PRECONDITION":
988
+ case "OUT_OF_RANGE":
989
+ return 400;
990
+ case "DEADLINE_EXCEEDED":
991
+ return 504;
992
+ case "NOT_FOUND":
993
+ return 404;
994
+ case "ALREADY_EXISTS":
995
+ case "ABORTED":
996
+ return 409;
997
+ case "PERMISSION_DENIED":
998
+ return 403;
999
+ case "UNAUTHENTICATED":
1000
+ return 401;
1001
+ case "RESOURCE_EXHAUSTED":
1002
+ return 429;
1003
+ case "UNIMPLEMENTED":
1004
+ return 501;
1005
+ case "UNKNOWN":
1006
+ case "INTERNAL":
1007
+ case "DATA_LOSS":
1008
+ return 500;
1009
+ case "UNAVAILABLE":
1010
+ return 503;
1011
+ default:
1012
+ return void 0;
1013
+ }
1014
+ }
922
1015
 
923
1016
  // src/google-generative-ai-options.ts
924
1017
  import {
925
1018
  lazySchema as lazySchema2,
926
1019
  zodSchema as zodSchema2
927
1020
  } from "@ai-sdk/provider-utils";
928
- import { z as z2 } from "zod/v4";
1021
+ import { z as z3 } from "zod/v4";
929
1022
  var googleLanguageModelOptions = lazySchema2(
930
1023
  () => zodSchema2(
931
- z2.object({
932
- responseModalities: z2.array(z2.enum(["TEXT", "IMAGE"])).optional(),
933
- thinkingConfig: z2.object({
934
- thinkingBudget: z2.number().optional(),
935
- includeThoughts: z2.boolean().optional(),
1024
+ z3.object({
1025
+ responseModalities: z3.array(z3.enum(["TEXT", "IMAGE"])).optional(),
1026
+ thinkingConfig: z3.object({
1027
+ thinkingBudget: z3.number().optional(),
1028
+ includeThoughts: z3.boolean().optional(),
936
1029
  // https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
937
- thinkingLevel: z2.enum(["minimal", "low", "medium", "high"]).optional()
1030
+ thinkingLevel: z3.enum(["minimal", "low", "medium", "high"]).optional()
938
1031
  }).optional(),
939
1032
  /**
940
1033
  * Optional.
941
1034
  * The name of the cached content used as context to serve the prediction.
942
1035
  * Format: cachedContents/{cachedContent}
943
1036
  */
944
- cachedContent: z2.string().optional(),
1037
+ cachedContent: z3.string().optional(),
945
1038
  /**
946
1039
  * Optional. Enable structured output. Default is true.
947
1040
  *
@@ -950,13 +1043,13 @@ var googleLanguageModelOptions = lazySchema2(
950
1043
  * Google Generative AI uses. You can use this to disable
951
1044
  * structured outputs if you need to.
952
1045
  */
953
- structuredOutputs: z2.boolean().optional(),
1046
+ structuredOutputs: z3.boolean().optional(),
954
1047
  /**
955
1048
  * Optional. A list of unique safety settings for blocking unsafe content.
956
1049
  */
957
- safetySettings: z2.array(
958
- z2.object({
959
- category: z2.enum([
1050
+ safetySettings: z3.array(
1051
+ z3.object({
1052
+ category: z3.enum([
960
1053
  "HARM_CATEGORY_UNSPECIFIED",
961
1054
  "HARM_CATEGORY_HATE_SPEECH",
962
1055
  "HARM_CATEGORY_DANGEROUS_CONTENT",
@@ -964,7 +1057,7 @@ var googleLanguageModelOptions = lazySchema2(
964
1057
  "HARM_CATEGORY_SEXUALLY_EXPLICIT",
965
1058
  "HARM_CATEGORY_CIVIC_INTEGRITY"
966
1059
  ]),
967
- threshold: z2.enum([
1060
+ threshold: z3.enum([
968
1061
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
969
1062
  "BLOCK_LOW_AND_ABOVE",
970
1063
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -974,7 +1067,7 @@ var googleLanguageModelOptions = lazySchema2(
974
1067
  ])
975
1068
  })
976
1069
  ).optional(),
977
- threshold: z2.enum([
1070
+ threshold: z3.enum([
978
1071
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
979
1072
  "BLOCK_LOW_AND_ABOVE",
980
1073
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -987,19 +1080,19 @@ var googleLanguageModelOptions = lazySchema2(
987
1080
  *
988
1081
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
989
1082
  */
990
- audioTimestamp: z2.boolean().optional(),
1083
+ audioTimestamp: z3.boolean().optional(),
991
1084
  /**
992
1085
  * Optional. Defines labels used in billing reports. Available on Vertex AI only.
993
1086
  *
994
1087
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
995
1088
  */
996
- labels: z2.record(z2.string(), z2.string()).optional(),
1089
+ labels: z3.record(z3.string(), z3.string()).optional(),
997
1090
  /**
998
1091
  * Optional. If specified, the media resolution specified will be used.
999
1092
  *
1000
1093
  * https://ai.google.dev/api/generate-content#MediaResolution
1001
1094
  */
1002
- mediaResolution: z2.enum([
1095
+ mediaResolution: z3.enum([
1003
1096
  "MEDIA_RESOLUTION_UNSPECIFIED",
1004
1097
  "MEDIA_RESOLUTION_LOW",
1005
1098
  "MEDIA_RESOLUTION_MEDIUM",
@@ -1010,8 +1103,8 @@ var googleLanguageModelOptions = lazySchema2(
1010
1103
  *
1011
1104
  * https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
1012
1105
  */
1013
- imageConfig: z2.object({
1014
- aspectRatio: z2.enum([
1106
+ imageConfig: z3.object({
1107
+ aspectRatio: z3.enum([
1015
1108
  "1:1",
1016
1109
  "2:3",
1017
1110
  "3:2",
@@ -1027,12 +1120,12 @@ var googleLanguageModelOptions = lazySchema2(
1027
1120
  "1:4",
1028
1121
  "4:1"
1029
1122
  ]).optional(),
1030
- imageSize: z2.enum(["1K", "2K", "4K", "512"]).optional(),
1123
+ imageSize: z3.enum(["1K", "2K", "4K", "512"]).optional(),
1031
1124
  /**
1032
1125
  * Optional. Controls the generation of people in images.
1033
1126
  * Vertex AI only.
1034
1127
  */
1035
- personGeneration: z2.enum([
1128
+ personGeneration: z3.enum([
1036
1129
  "PERSON_GENERATION_UNSPECIFIED",
1037
1130
  "ALLOW_ALL",
1038
1131
  "ALLOW_ADULT",
@@ -1046,7 +1139,7 @@ var googleLanguageModelOptions = lazySchema2(
1046
1139
  *
1047
1140
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
1048
1141
  */
1049
- prominentPeople: z2.enum([
1142
+ prominentPeople: z3.enum([
1050
1143
  "PROMINENT_PEOPLE_UNSPECIFIED",
1051
1144
  "ALLOW_PROMINENT_PEOPLE",
1052
1145
  "BLOCK_PROMINENT_PEOPLE"
@@ -1055,9 +1148,9 @@ var googleLanguageModelOptions = lazySchema2(
1055
1148
  * Optional. The image output format for generated images.
1056
1149
  * Vertex AI only.
1057
1150
  */
1058
- imageOutputOptions: z2.object({
1059
- mimeType: z2.enum(["image/jpeg", "image/png"]).optional(),
1060
- compressionQuality: z2.number().optional()
1151
+ imageOutputOptions: z3.object({
1152
+ mimeType: z3.enum(["image/jpeg", "image/png"]).optional(),
1153
+ compressionQuality: z3.number().optional()
1061
1154
  }).optional()
1062
1155
  }).optional(),
1063
1156
  /**
@@ -1066,10 +1159,10 @@ var googleLanguageModelOptions = lazySchema2(
1066
1159
  *
1067
1160
  * https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
1068
1161
  */
1069
- retrievalConfig: z2.object({
1070
- latLng: z2.object({
1071
- latitude: z2.number(),
1072
- longitude: z2.number()
1162
+ retrievalConfig: z3.object({
1163
+ latLng: z3.object({
1164
+ latitude: z3.number(),
1165
+ longitude: z3.number()
1073
1166
  }).optional()
1074
1167
  }).optional(),
1075
1168
  /**
@@ -1082,12 +1175,12 @@ var googleLanguageModelOptions = lazySchema2(
1082
1175
  *
1083
1176
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
1084
1177
  */
1085
- streamFunctionCallArguments: z2.boolean().optional(),
1178
+ streamFunctionCallArguments: z3.boolean().optional(),
1086
1179
  /**
1087
1180
  * Optional. The service tier to use for the request. Sent as the
1088
1181
  * `serviceTier` body field. Gemini API only.
1089
1182
  */
1090
- serviceTier: z2.enum(["standard", "flex", "priority"]).optional(),
1183
+ serviceTier: z3.enum(["standard", "flex", "priority"]).optional(),
1091
1184
  /**
1092
1185
  * Optional. Resumes a response that stopped with `MAX_TOKENS` because it
1093
1186
  * used up its `maxOutputTokens` budget (Gemini 4 long decode). Pass the
@@ -1097,7 +1190,7 @@ var googleLanguageModelOptions = lazySchema2(
1097
1190
  * per-request cap while budget remains (`CONTINUATION`) are continued
1098
1191
  * automatically. Sent as the `continuationToken` body field.
1099
1192
  */
1100
- continuationToken: z2.string().optional(),
1193
+ continuationToken: z3.string().optional(),
1101
1194
  /**
1102
1195
  * Optional. Vertex AI only. Sent as the
1103
1196
  * `X-Vertex-AI-LLM-Shared-Request-Type` request header to select a
@@ -1108,7 +1201,7 @@ var googleLanguageModelOptions = lazySchema2(
1108
1201
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
1109
1202
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/flex-paygo
1110
1203
  */
1111
- sharedRequestType: z2.enum(["priority", "flex", "standard"]).optional(),
1204
+ sharedRequestType: z3.enum(["priority", "flex", "standard"]).optional(),
1112
1205
  /**
1113
1206
  * Optional. Vertex AI only. Sent as the `X-Vertex-AI-LLM-Request-Type`
1114
1207
  * request header. Set to `'shared'` together with `sharedRequestType`
@@ -1116,7 +1209,7 @@ var googleLanguageModelOptions = lazySchema2(
1116
1209
  *
1117
1210
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
1118
1211
  */
1119
- requestType: z2.enum(["shared"]).optional()
1212
+ requestType: z3.enum(["shared"]).optional()
1120
1213
  })
1121
1214
  )
1122
1215
  );
@@ -2147,10 +2240,11 @@ var GoogleGenerativeAILanguageModel = class {
2147
2240
  options.headers,
2148
2241
  extraHeaders
2149
2242
  );
2243
+ const url = `${this.config.baseURL}/${getModelPath(
2244
+ this.modelId
2245
+ )}:streamGenerateContent?alt=sse`;
2150
2246
  const streamGenerateContent = (body) => postJsonToApi({
2151
- url: `${this.config.baseURL}/${getModelPath(
2152
- this.modelId
2153
- )}:streamGenerateContent?alt=sse`,
2247
+ url,
2154
2248
  headers,
2155
2249
  body,
2156
2250
  failedResponseHandler: googleFailedResponseHandler,
@@ -2240,7 +2334,7 @@ var GoogleGenerativeAILanguageModel = class {
2240
2334
  controller.enqueue({ type: "stream-start", warnings });
2241
2335
  },
2242
2336
  transform(chunk, controller) {
2243
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2337
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2244
2338
  if (options.includeRawChunks) {
2245
2339
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2246
2340
  }
@@ -2249,6 +2343,23 @@ var GoogleGenerativeAILanguageModel = class {
2249
2343
  return;
2250
2344
  }
2251
2345
  const value = chunk.value;
2346
+ if (value.error != null) {
2347
+ finishReason = { unified: "error", raw: void 0 };
2348
+ const error = value.error;
2349
+ controller.enqueue({
2350
+ type: "error",
2351
+ error: new APICallError({
2352
+ message: error.message,
2353
+ url,
2354
+ requestBodyValues: args,
2355
+ statusCode: (_a = error.code) != null ? _a : mapGoogleErrorStatusToHttpStatusCode(error.status),
2356
+ responseHeaders,
2357
+ responseBody: JSON.stringify({ error }),
2358
+ data: error
2359
+ })
2360
+ });
2361
+ return;
2362
+ }
2252
2363
  if (!hasEmittedResponseMetadata && value.responseId != null) {
2253
2364
  hasEmittedResponseMetadata = true;
2254
2365
  controller.enqueue({
@@ -2270,7 +2381,7 @@ var GoogleGenerativeAILanguageModel = class {
2270
2381
  };
2271
2382
  }
2272
2383
  }
2273
- const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
2384
+ const candidate = (_b = value.candidates) == null ? void 0 : _b[0];
2274
2385
  if (candidate != null) {
2275
2386
  if (candidate.groundingMetadata != null) {
2276
2387
  lastGroundingMetadata = candidate.groundingMetadata;
@@ -2305,9 +2416,9 @@ var GoogleGenerativeAILanguageModel = class {
2305
2416
  }
2306
2417
  }
2307
2418
  if (content != null) {
2308
- const parts = (_b = content.parts) != null ? _b : [];
2419
+ const parts = (_c = content.parts) != null ? _c : [];
2309
2420
  for (const part of parts) {
2310
- if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
2421
+ if ("executableCode" in part && ((_d = part.executableCode) == null ? void 0 : _d.code)) {
2311
2422
  const toolCallId = generateId2();
2312
2423
  lastCodeExecutionToolCallId = toolCallId;
2313
2424
  controller.enqueue({
@@ -2326,7 +2437,7 @@ var GoogleGenerativeAILanguageModel = class {
2326
2437
  toolName: "code_execution",
2327
2438
  result: {
2328
2439
  outcome: part.codeExecutionResult.outcome,
2329
- output: (_d = part.codeExecutionResult.output) != null ? _d : ""
2440
+ output: (_e = part.codeExecutionResult.output) != null ? _e : ""
2330
2441
  }
2331
2442
  });
2332
2443
  }
@@ -2420,7 +2531,7 @@ var GoogleGenerativeAILanguageModel = class {
2420
2531
  providerMetadata: fileMeta
2421
2532
  });
2422
2533
  } else if ("toolCall" in part && part.toolCall) {
2423
- const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId2();
2534
+ const toolCallId = (_f = part.toolCall.id) != null ? _f : generateId2();
2424
2535
  lastServerToolCallId = toolCallId;
2425
2536
  const serverMeta = {
2426
2537
  [providerOptionsName]: {
@@ -2433,13 +2544,13 @@ var GoogleGenerativeAILanguageModel = class {
2433
2544
  type: "tool-call",
2434
2545
  toolCallId,
2435
2546
  toolName: `server:${part.toolCall.toolType}`,
2436
- input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
2547
+ input: JSON.stringify((_g = part.toolCall.args) != null ? _g : {}),
2437
2548
  providerExecuted: true,
2438
2549
  dynamic: true,
2439
2550
  providerMetadata: serverMeta
2440
2551
  });
2441
2552
  } else if ("toolResponse" in part && part.toolResponse) {
2442
- const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId2();
2553
+ const responseToolCallId = (_h = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _h : generateId2();
2443
2554
  const serverMeta = {
2444
2555
  [providerOptionsName]: {
2445
2556
  ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
@@ -2451,7 +2562,7 @@ var GoogleGenerativeAILanguageModel = class {
2451
2562
  type: "tool-result",
2452
2563
  toolCallId: responseToolCallId,
2453
2564
  toolName: `server:${part.toolResponse.toolType}`,
2454
- result: (_h = part.toolResponse.response) != null ? _h : {},
2565
+ result: (_i = part.toolResponse.response) != null ? _i : {},
2455
2566
  providerMetadata: serverMeta
2456
2567
  });
2457
2568
  lastServerToolCallId = void 0;
@@ -2470,7 +2581,7 @@ var GoogleGenerativeAILanguageModel = class {
2470
2581
  const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
2471
2582
  if (isStreamingChunk) {
2472
2583
  if (part.functionCall.name != null) {
2473
- const toolCallId = (_i = part.functionCall.id) != null ? _i : generateId2();
2584
+ const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId2();
2474
2585
  const accumulator = new GoogleJSONAccumulator();
2475
2586
  activeStreamingToolCalls.push({
2476
2587
  toolCallId,
@@ -2518,9 +2629,9 @@ var GoogleGenerativeAILanguageModel = class {
2518
2629
  } else if (isTerminalChunk && activeStreamingToolCalls.length > 0) {
2519
2630
  finishActiveStreamingToolCall(controller);
2520
2631
  } else if (isCompleteCall) {
2521
- const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId2();
2632
+ const toolCallId = (_k = part.functionCall.id) != null ? _k : generateId2();
2522
2633
  const toolName = part.functionCall.name;
2523
- const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_k = part.functionCall.args) != null ? _k : {});
2634
+ const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_l = part.functionCall.args) != null ? _l : {});
2524
2635
  controller.enqueue({
2525
2636
  type: "tool-input-start",
2526
2637
  id: toolCallId,
@@ -2547,7 +2658,7 @@ var GoogleGenerativeAILanguageModel = class {
2547
2658
  });
2548
2659
  hasToolCalls = true;
2549
2660
  } else if (isNoArgsCompleteCall) {
2550
- const toolCallId = (_l = part.functionCall.id) != null ? _l : generateId2();
2661
+ const toolCallId = (_m = part.functionCall.id) != null ? _m : generateId2();
2551
2662
  const toolName = part.functionCall.name;
2552
2663
  controller.enqueue({
2553
2664
  type: "tool-input-start",
@@ -2735,205 +2846,206 @@ function extractSources({
2735
2846
  }
2736
2847
  return sources.length > 0 ? sources : void 0;
2737
2848
  }
2738
- var getGroundingMetadataSchema = () => z3.object({
2739
- webSearchQueries: z3.array(z3.string()).nullish(),
2740
- imageSearchQueries: z3.array(z3.string()).nullish(),
2741
- retrievalQueries: z3.array(z3.string()).nullish(),
2742
- searchEntryPoint: z3.object({ renderedContent: z3.string() }).nullish(),
2743
- groundingChunks: z3.array(
2744
- z3.object({
2745
- web: z3.object({ uri: z3.string(), title: z3.string().nullish() }).nullish(),
2746
- image: z3.object({
2747
- sourceUri: z3.string(),
2748
- imageUri: z3.string(),
2749
- title: z3.string().nullish(),
2750
- domain: z3.string().nullish()
2849
+ var getGroundingMetadataSchema = () => z4.object({
2850
+ webSearchQueries: z4.array(z4.string()).nullish(),
2851
+ imageSearchQueries: z4.array(z4.string()).nullish(),
2852
+ retrievalQueries: z4.array(z4.string()).nullish(),
2853
+ searchEntryPoint: z4.object({ renderedContent: z4.string() }).nullish(),
2854
+ groundingChunks: z4.array(
2855
+ z4.object({
2856
+ web: z4.object({ uri: z4.string(), title: z4.string().nullish() }).nullish(),
2857
+ image: z4.object({
2858
+ sourceUri: z4.string(),
2859
+ imageUri: z4.string(),
2860
+ title: z4.string().nullish(),
2861
+ domain: z4.string().nullish()
2751
2862
  }).nullish(),
2752
- retrievedContext: z3.object({
2753
- uri: z3.string().nullish(),
2754
- title: z3.string().nullish(),
2755
- text: z3.string().nullish(),
2756
- fileSearchStore: z3.string().nullish(),
2757
- customMetadata: z3.array(
2758
- z3.object({
2759
- key: z3.string(),
2760
- stringValue: z3.string().nullish(),
2761
- numericValue: z3.number().nullish(),
2762
- stringListValue: z3.object({ values: z3.array(z3.string()).nullish() }).nullish()
2863
+ retrievedContext: z4.object({
2864
+ uri: z4.string().nullish(),
2865
+ title: z4.string().nullish(),
2866
+ text: z4.string().nullish(),
2867
+ fileSearchStore: z4.string().nullish(),
2868
+ customMetadata: z4.array(
2869
+ z4.object({
2870
+ key: z4.string(),
2871
+ stringValue: z4.string().nullish(),
2872
+ numericValue: z4.number().nullish(),
2873
+ stringListValue: z4.object({ values: z4.array(z4.string()).nullish() }).nullish()
2763
2874
  })
2764
2875
  ).nullish()
2765
2876
  }).nullish(),
2766
- maps: z3.object({
2767
- uri: z3.string().nullish(),
2768
- title: z3.string().nullish(),
2769
- text: z3.string().nullish(),
2770
- placeId: z3.string().nullish()
2877
+ maps: z4.object({
2878
+ uri: z4.string().nullish(),
2879
+ title: z4.string().nullish(),
2880
+ text: z4.string().nullish(),
2881
+ placeId: z4.string().nullish()
2771
2882
  }).nullish()
2772
2883
  })
2773
2884
  ).nullish(),
2774
- groundingSupports: z3.array(
2775
- z3.object({
2776
- segment: z3.object({
2777
- startIndex: z3.number().nullish(),
2778
- endIndex: z3.number().nullish(),
2779
- text: z3.string().nullish()
2885
+ groundingSupports: z4.array(
2886
+ z4.object({
2887
+ segment: z4.object({
2888
+ startIndex: z4.number().nullish(),
2889
+ endIndex: z4.number().nullish(),
2890
+ text: z4.string().nullish()
2780
2891
  }).nullish(),
2781
- segment_text: z3.string().nullish(),
2782
- groundingChunkIndices: z3.array(z3.number()).nullish(),
2783
- supportChunkIndices: z3.array(z3.number()).nullish(),
2784
- confidenceScores: z3.array(z3.number()).nullish(),
2785
- confidenceScore: z3.array(z3.number()).nullish()
2892
+ segment_text: z4.string().nullish(),
2893
+ groundingChunkIndices: z4.array(z4.number()).nullish(),
2894
+ supportChunkIndices: z4.array(z4.number()).nullish(),
2895
+ confidenceScores: z4.array(z4.number()).nullish(),
2896
+ confidenceScore: z4.array(z4.number()).nullish()
2786
2897
  })
2787
2898
  ).nullish(),
2788
- retrievalMetadata: z3.union([
2789
- z3.object({
2790
- webDynamicRetrievalScore: z3.number()
2899
+ retrievalMetadata: z4.union([
2900
+ z4.object({
2901
+ webDynamicRetrievalScore: z4.number()
2791
2902
  }),
2792
- z3.object({})
2903
+ z4.object({})
2793
2904
  ]).nullish()
2794
2905
  });
2795
- var partialArgSchema = () => z3.object({
2796
- jsonPath: z3.string(),
2797
- stringValue: z3.string().nullish(),
2798
- numberValue: z3.number().nullish(),
2799
- boolValue: z3.boolean().nullish(),
2800
- nullValue: z3.unknown().nullish(),
2801
- willContinue: z3.boolean().nullish()
2906
+ var partialArgSchema = () => z4.object({
2907
+ jsonPath: z4.string(),
2908
+ stringValue: z4.string().nullish(),
2909
+ numberValue: z4.number().nullish(),
2910
+ boolValue: z4.boolean().nullish(),
2911
+ nullValue: z4.unknown().nullish(),
2912
+ willContinue: z4.boolean().nullish()
2802
2913
  });
2803
- var getContentSchema = () => z3.object({
2804
- parts: z3.array(
2805
- z3.union([
2914
+ var getContentSchema = () => z4.object({
2915
+ parts: z4.array(
2916
+ z4.union([
2806
2917
  // note: order matters since text can be fully empty
2807
- z3.object({
2808
- functionCall: z3.object({
2809
- id: z3.string().nullish(),
2810
- name: z3.string().nullish(),
2811
- args: z3.unknown().nullish(),
2812
- partialArgs: z3.array(partialArgSchema()).nullish(),
2813
- willContinue: z3.boolean().nullish()
2918
+ z4.object({
2919
+ functionCall: z4.object({
2920
+ id: z4.string().nullish(),
2921
+ name: z4.string().nullish(),
2922
+ args: z4.unknown().nullish(),
2923
+ partialArgs: z4.array(partialArgSchema()).nullish(),
2924
+ willContinue: z4.boolean().nullish()
2814
2925
  }),
2815
- thoughtSignature: z3.string().nullish()
2926
+ thoughtSignature: z4.string().nullish()
2816
2927
  }),
2817
- z3.object({
2818
- inlineData: z3.object({
2819
- mimeType: z3.string(),
2820
- data: z3.string()
2928
+ z4.object({
2929
+ inlineData: z4.object({
2930
+ mimeType: z4.string(),
2931
+ data: z4.string()
2821
2932
  }),
2822
- thought: z3.boolean().nullish(),
2823
- thoughtSignature: z3.string().nullish()
2933
+ thought: z4.boolean().nullish(),
2934
+ thoughtSignature: z4.string().nullish()
2824
2935
  }),
2825
- z3.object({
2826
- toolCall: z3.object({
2827
- toolType: z3.string(),
2828
- args: z3.unknown().nullish(),
2829
- id: z3.string()
2936
+ z4.object({
2937
+ toolCall: z4.object({
2938
+ toolType: z4.string(),
2939
+ args: z4.unknown().nullish(),
2940
+ id: z4.string()
2830
2941
  }),
2831
- thoughtSignature: z3.string().nullish()
2942
+ thoughtSignature: z4.string().nullish()
2832
2943
  }),
2833
- z3.object({
2834
- toolResponse: z3.object({
2835
- toolType: z3.string(),
2836
- response: z3.unknown().nullish(),
2837
- id: z3.string()
2944
+ z4.object({
2945
+ toolResponse: z4.object({
2946
+ toolType: z4.string(),
2947
+ response: z4.unknown().nullish(),
2948
+ id: z4.string()
2838
2949
  }),
2839
- thoughtSignature: z3.string().nullish()
2950
+ thoughtSignature: z4.string().nullish()
2840
2951
  }),
2841
- z3.object({
2842
- executableCode: z3.object({
2843
- language: z3.string(),
2844
- code: z3.string()
2952
+ z4.object({
2953
+ executableCode: z4.object({
2954
+ language: z4.string(),
2955
+ code: z4.string()
2845
2956
  }).nullish(),
2846
- codeExecutionResult: z3.object({
2847
- outcome: z3.string(),
2848
- output: z3.string().nullish()
2957
+ codeExecutionResult: z4.object({
2958
+ outcome: z4.string(),
2959
+ output: z4.string().nullish()
2849
2960
  }).nullish(),
2850
- text: z3.string().nullish(),
2851
- thought: z3.boolean().nullish(),
2852
- thoughtSignature: z3.string().nullish()
2961
+ text: z4.string().nullish(),
2962
+ thought: z4.boolean().nullish(),
2963
+ thoughtSignature: z4.string().nullish()
2853
2964
  })
2854
2965
  ])
2855
2966
  ).nullish()
2856
2967
  });
2857
- var getSafetyRatingSchema = () => z3.object({
2858
- category: z3.string().nullish(),
2859
- probability: z3.string().nullish(),
2860
- probabilityScore: z3.number().nullish(),
2861
- severity: z3.string().nullish(),
2862
- severityScore: z3.number().nullish(),
2863
- blocked: z3.boolean().nullish()
2968
+ var getSafetyRatingSchema = () => z4.object({
2969
+ category: z4.string().nullish(),
2970
+ probability: z4.string().nullish(),
2971
+ probabilityScore: z4.number().nullish(),
2972
+ severity: z4.string().nullish(),
2973
+ severityScore: z4.number().nullish(),
2974
+ blocked: z4.boolean().nullish()
2864
2975
  });
2865
- var tokenDetailsSchema = () => z3.array(
2866
- z3.object({
2867
- modality: z3.string(),
2868
- tokenCount: z3.number()
2869
- }).catchall(z3.json())
2976
+ var tokenDetailsSchema = () => z4.array(
2977
+ z4.object({
2978
+ modality: z4.string(),
2979
+ tokenCount: z4.number()
2980
+ }).catchall(z4.json())
2870
2981
  ).nullish();
2871
- var usageSchema = () => z3.object({
2872
- cachedContentTokenCount: z3.number().nullish(),
2873
- thoughtsTokenCount: z3.number().nullish(),
2874
- promptTokenCount: z3.number().nullish(),
2875
- candidatesTokenCount: z3.number().nullish(),
2876
- toolUsePromptTokenCount: z3.number().nullish(),
2877
- totalTokenCount: z3.number().nullish(),
2982
+ var usageSchema = () => z4.object({
2983
+ cachedContentTokenCount: z4.number().nullish(),
2984
+ thoughtsTokenCount: z4.number().nullish(),
2985
+ promptTokenCount: z4.number().nullish(),
2986
+ candidatesTokenCount: z4.number().nullish(),
2987
+ toolUsePromptTokenCount: z4.number().nullish(),
2988
+ totalTokenCount: z4.number().nullish(),
2878
2989
  // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
2879
- trafficType: z3.string().nullish(),
2880
- serviceTier: z3.string().nullish(),
2990
+ trafficType: z4.string().nullish(),
2991
+ serviceTier: z4.string().nullish(),
2881
2992
  // https://ai.google.dev/api/generate-content#Modality
2882
2993
  promptTokensDetails: tokenDetailsSchema(),
2883
2994
  cacheTokensDetails: tokenDetailsSchema(),
2884
2995
  candidatesTokensDetails: tokenDetailsSchema(),
2885
2996
  toolUsePromptTokensDetails: tokenDetailsSchema()
2886
- }).catchall(z3.json());
2887
- var getUrlContextMetadataSchema = () => z3.object({
2888
- urlMetadata: z3.array(
2889
- z3.object({
2890
- retrievedUrl: z3.string(),
2891
- urlRetrievalStatus: z3.string()
2997
+ }).catchall(z4.json());
2998
+ var getUrlContextMetadataSchema = () => z4.object({
2999
+ urlMetadata: z4.array(
3000
+ z4.object({
3001
+ retrievedUrl: z4.string(),
3002
+ urlRetrievalStatus: z4.string()
2892
3003
  })
2893
3004
  ).nullish()
2894
3005
  });
2895
3006
  var responseSchema = lazySchema3(
2896
3007
  () => zodSchema3(
2897
- z3.object({
2898
- responseId: z3.string().nullish(),
2899
- candidates: z3.array(
2900
- z3.object({
2901
- content: getContentSchema().nullish().or(z3.object({}).strict()),
2902
- finishReason: z3.string().nullish(),
2903
- finishMessage: z3.string().nullish(),
2904
- continuationToken: z3.string().nullish(),
2905
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
3008
+ z4.object({
3009
+ responseId: z4.string().nullish(),
3010
+ candidates: z4.array(
3011
+ z4.object({
3012
+ content: getContentSchema().nullish().or(z4.object({}).strict()),
3013
+ finishReason: z4.string().nullish(),
3014
+ finishMessage: z4.string().nullish(),
3015
+ continuationToken: z4.string().nullish(),
3016
+ safetyRatings: z4.array(getSafetyRatingSchema()).nullish(),
2906
3017
  groundingMetadata: getGroundingMetadataSchema().nullish(),
2907
3018
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
2908
3019
  })
2909
3020
  ).nullish(),
2910
3021
  usageMetadata: usageSchema().nullish(),
2911
- promptFeedback: z3.object({
2912
- blockReason: z3.string().nullish(),
2913
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
3022
+ promptFeedback: z4.object({
3023
+ blockReason: z4.string().nullish(),
3024
+ safetyRatings: z4.array(getSafetyRatingSchema()).nullish()
2914
3025
  }).nullish()
2915
3026
  })
2916
3027
  )
2917
3028
  );
2918
3029
  var chunkSchema = lazySchema3(
2919
3030
  () => zodSchema3(
2920
- z3.object({
2921
- responseId: z3.string().nullish(),
2922
- candidates: z3.array(
2923
- z3.object({
3031
+ z4.object({
3032
+ error: getGoogleErrorSchema().nullish(),
3033
+ responseId: z4.string().nullish(),
3034
+ candidates: z4.array(
3035
+ z4.object({
2924
3036
  content: getContentSchema().nullish(),
2925
- finishReason: z3.string().nullish(),
2926
- finishMessage: z3.string().nullish(),
2927
- continuationToken: z3.string().nullish(),
2928
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish(),
3037
+ finishReason: z4.string().nullish(),
3038
+ finishMessage: z4.string().nullish(),
3039
+ continuationToken: z4.string().nullish(),
3040
+ safetyRatings: z4.array(getSafetyRatingSchema()).nullish(),
2929
3041
  groundingMetadata: getGroundingMetadataSchema().nullish(),
2930
3042
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
2931
3043
  })
2932
3044
  ).nullish(),
2933
3045
  usageMetadata: usageSchema().nullish(),
2934
- promptFeedback: z3.object({
2935
- blockReason: z3.string().nullish(),
2936
- safetyRatings: z3.array(getSafetyRatingSchema()).nullish()
3046
+ promptFeedback: z4.object({
3047
+ blockReason: z4.string().nullish(),
3048
+ safetyRatings: z4.array(getSafetyRatingSchema()).nullish()
2937
3049
  }).nullish()
2938
3050
  })
2939
3051
  )
@@ -2944,16 +3056,16 @@ function isConfirmedPromptBlockReason(blockReason) {
2944
3056
 
2945
3057
  // src/tool/code-execution.ts
2946
3058
  import { createProviderToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
2947
- import { z as z4 } from "zod/v4";
3059
+ import { z as z5 } from "zod/v4";
2948
3060
  var codeExecution = createProviderToolFactoryWithOutputSchema({
2949
3061
  id: "google.code_execution",
2950
- inputSchema: z4.object({
2951
- language: z4.string().describe("The programming language of the code."),
2952
- code: z4.string().describe("The code to be executed.")
3062
+ inputSchema: z5.object({
3063
+ language: z5.string().describe("The programming language of the code."),
3064
+ code: z5.string().describe("The code to be executed.")
2953
3065
  }),
2954
- outputSchema: z4.object({
2955
- outcome: z4.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
2956
- output: z4.string().describe("The output from the code execution.")
3066
+ outputSchema: z5.object({
3067
+ outcome: z5.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
3068
+ output: z5.string().describe("The output from the code execution.")
2957
3069
  })
2958
3070
  });
2959
3071
 
@@ -2963,10 +3075,10 @@ import {
2963
3075
  lazySchema as lazySchema4,
2964
3076
  zodSchema as zodSchema4
2965
3077
  } from "@ai-sdk/provider-utils";
2966
- import { z as z5 } from "zod/v4";
3078
+ import { z as z6 } from "zod/v4";
2967
3079
  var enterpriseWebSearch = createProviderToolFactory({
2968
3080
  id: "google.enterprise_web_search",
2969
- inputSchema: lazySchema4(() => zodSchema4(z5.object({})))
3081
+ inputSchema: lazySchema4(() => zodSchema4(z6.object({})))
2970
3082
  });
2971
3083
 
2972
3084
  // src/tool/file-search.ts
@@ -2975,20 +3087,20 @@ import {
2975
3087
  lazySchema as lazySchema5,
2976
3088
  zodSchema as zodSchema5
2977
3089
  } from "@ai-sdk/provider-utils";
2978
- import { z as z6 } from "zod/v4";
2979
- var fileSearchArgsBaseSchema = () => z6.object({
3090
+ import { z as z7 } from "zod/v4";
3091
+ var fileSearchArgsBaseSchema = () => z7.object({
2980
3092
  /** The names of the file_search_stores to retrieve from.
2981
3093
  * Example: `fileSearchStores/my-file-search-store-123`
2982
3094
  */
2983
- fileSearchStoreNames: z6.array(z6.string()).describe(
3095
+ fileSearchStoreNames: z7.array(z7.string()).describe(
2984
3096
  "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
2985
3097
  ),
2986
3098
  /** The number of file search retrieval chunks to retrieve. */
2987
- topK: z6.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
3099
+ topK: z7.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
2988
3100
  /** Metadata filter to apply to the file search retrieval documents.
2989
3101
  * See https://google.aip.dev/160 for the syntax of the filter expression.
2990
3102
  */
2991
- metadataFilter: z6.string().describe(
3103
+ metadataFilter: z7.string().describe(
2992
3104
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
2993
3105
  ).optional()
2994
3106
  }).passthrough();
@@ -3006,10 +3118,10 @@ import {
3006
3118
  lazySchema as lazySchema6,
3007
3119
  zodSchema as zodSchema6
3008
3120
  } from "@ai-sdk/provider-utils";
3009
- import { z as z7 } from "zod/v4";
3121
+ import { z as z8 } from "zod/v4";
3010
3122
  var googleMaps = createProviderToolFactory3({
3011
3123
  id: "google.google_maps",
3012
- inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
3124
+ inputSchema: lazySchema6(() => zodSchema6(z8.object({})))
3013
3125
  });
3014
3126
 
3015
3127
  // src/tool/google-search.ts
@@ -3018,15 +3130,15 @@ import {
3018
3130
  lazySchema as lazySchema7,
3019
3131
  zodSchema as zodSchema7
3020
3132
  } from "@ai-sdk/provider-utils";
3021
- import { z as z8 } from "zod/v4";
3022
- var googleSearchToolArgsBaseSchema = () => z8.object({
3023
- searchTypes: z8.object({
3024
- webSearch: z8.object({}).optional(),
3025
- imageSearch: z8.object({}).optional()
3133
+ import { z as z9 } from "zod/v4";
3134
+ var googleSearchToolArgsBaseSchema = () => z9.object({
3135
+ searchTypes: z9.object({
3136
+ webSearch: z9.object({}).optional(),
3137
+ imageSearch: z9.object({}).optional()
3026
3138
  }).optional(),
3027
- timeRangeFilter: z8.object({
3028
- startTime: z8.string(),
3029
- endTime: z8.string()
3139
+ timeRangeFilter: z9.object({
3140
+ startTime: z9.string(),
3141
+ endTime: z9.string()
3030
3142
  }).optional()
3031
3143
  }).passthrough();
3032
3144
  var googleSearchToolArgsSchema = lazySchema7(
@@ -3045,20 +3157,20 @@ import {
3045
3157
  lazySchema as lazySchema8,
3046
3158
  zodSchema as zodSchema8
3047
3159
  } from "@ai-sdk/provider-utils";
3048
- import { z as z9 } from "zod/v4";
3160
+ import { z as z10 } from "zod/v4";
3049
3161
  var urlContext = createProviderToolFactory5({
3050
3162
  id: "google.url_context",
3051
- inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
3163
+ inputSchema: lazySchema8(() => zodSchema8(z10.object({})))
3052
3164
  });
3053
3165
 
3054
3166
  // src/tool/vertex-rag-store.ts
3055
3167
  import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
3056
- import { z as z10 } from "zod/v4";
3168
+ import { z as z11 } from "zod/v4";
3057
3169
  var vertexRagStore = createProviderToolFactory6({
3058
3170
  id: "google.vertex_rag_store",
3059
- inputSchema: z10.object({
3060
- ragCorpus: z10.string(),
3061
- topK: z10.number().optional()
3171
+ inputSchema: z11.object({
3172
+ ragCorpus: z11.string(),
3173
+ topK: z11.number().optional()
3062
3174
  })
3063
3175
  });
3064
3176
 
@@ -4291,30 +4403,30 @@ import {
4291
4403
  lazySchema as lazySchema9,
4292
4404
  zodSchema as zodSchema9
4293
4405
  } from "@ai-sdk/provider-utils";
4294
- import { z as z11 } from "zod/v4";
4295
- var tokenByModalitySchema = () => z11.object({
4296
- modality: z11.string().nullish(),
4297
- tokens: z11.number().nullish()
4406
+ import { z as z12 } from "zod/v4";
4407
+ var tokenByModalitySchema = () => z12.object({
4408
+ modality: z12.string().nullish(),
4409
+ tokens: z12.number().nullish()
4298
4410
  }).loose();
4299
- var usageSchema2 = () => z11.object({
4300
- total_input_tokens: z11.number().nullish(),
4301
- total_output_tokens: z11.number().nullish(),
4302
- total_thought_tokens: z11.number().nullish(),
4303
- total_cached_tokens: z11.number().nullish(),
4304
- total_tool_use_tokens: z11.number().nullish(),
4305
- total_tokens: z11.number().nullish(),
4306
- input_tokens_by_modality: z11.array(tokenByModalitySchema()).nullish(),
4307
- output_tokens_by_modality: z11.array(tokenByModalitySchema()).nullish(),
4308
- cached_tokens_by_modality: z11.array(tokenByModalitySchema()).nullish(),
4309
- tool_use_tokens_by_modality: z11.array(tokenByModalitySchema()).nullish(),
4310
- grounding_tool_count: z11.array(
4311
- z11.object({
4312
- type: z11.string().nullish(),
4313
- count: z11.number().nullish()
4411
+ var usageSchema2 = () => z12.object({
4412
+ total_input_tokens: z12.number().nullish(),
4413
+ total_output_tokens: z12.number().nullish(),
4414
+ total_thought_tokens: z12.number().nullish(),
4415
+ total_cached_tokens: z12.number().nullish(),
4416
+ total_tool_use_tokens: z12.number().nullish(),
4417
+ total_tokens: z12.number().nullish(),
4418
+ input_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
4419
+ output_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
4420
+ cached_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
4421
+ tool_use_tokens_by_modality: z12.array(tokenByModalitySchema()).nullish(),
4422
+ grounding_tool_count: z12.array(
4423
+ z12.object({
4424
+ type: z12.string().nullish(),
4425
+ count: z12.number().nullish()
4314
4426
  }).loose()
4315
4427
  ).nullish()
4316
4428
  }).loose();
4317
- var interactionStatusSchema = () => z11.enum([
4429
+ var interactionStatusSchema = () => z12.enum([
4318
4430
  "in_progress",
4319
4431
  "requires_action",
4320
4432
  "completed",
@@ -4323,69 +4435,69 @@ var interactionStatusSchema = () => z11.enum([
4323
4435
  "incomplete"
4324
4436
  ]);
4325
4437
  var annotationSchema = () => {
4326
- const urlCitation = z11.object({
4327
- type: z11.literal("url_citation"),
4328
- url: z11.string().nullish(),
4329
- title: z11.string().nullish(),
4330
- start_index: z11.number().nullish(),
4331
- end_index: z11.number().nullish()
4438
+ const urlCitation = z12.object({
4439
+ type: z12.literal("url_citation"),
4440
+ url: z12.string().nullish(),
4441
+ title: z12.string().nullish(),
4442
+ start_index: z12.number().nullish(),
4443
+ end_index: z12.number().nullish()
4332
4444
  }).loose();
4333
- const fileCitation = z11.object({
4334
- type: z11.literal("file_citation"),
4335
- file_name: z11.string().nullish(),
4336
- document_uri: z11.string().nullish(),
4337
- url: z11.string().nullish(),
4338
- page_number: z11.number().nullish(),
4339
- media_id: z11.string().nullish(),
4340
- start_index: z11.number().nullish(),
4341
- end_index: z11.number().nullish(),
4342
- custom_metadata: z11.record(z11.string(), z11.unknown()).nullish()
4445
+ const fileCitation = z12.object({
4446
+ type: z12.literal("file_citation"),
4447
+ file_name: z12.string().nullish(),
4448
+ document_uri: z12.string().nullish(),
4449
+ url: z12.string().nullish(),
4450
+ page_number: z12.number().nullish(),
4451
+ media_id: z12.string().nullish(),
4452
+ start_index: z12.number().nullish(),
4453
+ end_index: z12.number().nullish(),
4454
+ custom_metadata: z12.record(z12.string(), z12.unknown()).nullish()
4343
4455
  }).loose();
4344
- const placeCitation = z11.object({
4345
- type: z11.literal("place_citation"),
4346
- name: z11.string().nullish(),
4347
- url: z11.string().nullish(),
4348
- place_id: z11.string().nullish(),
4349
- start_index: z11.number().nullish(),
4350
- end_index: z11.number().nullish()
4456
+ const placeCitation = z12.object({
4457
+ type: z12.literal("place_citation"),
4458
+ name: z12.string().nullish(),
4459
+ url: z12.string().nullish(),
4460
+ place_id: z12.string().nullish(),
4461
+ start_index: z12.number().nullish(),
4462
+ end_index: z12.number().nullish()
4351
4463
  }).loose();
4352
- return z11.union([
4464
+ return z12.union([
4353
4465
  urlCitation,
4354
4466
  fileCitation,
4355
4467
  placeCitation,
4356
- z11.object({ type: z11.string() }).loose()
4468
+ z12.object({ type: z12.string() }).loose()
4357
4469
  ]);
4358
4470
  };
4359
- var thoughtSummaryItemSchema = () => z11.object({
4360
- type: z11.string(),
4361
- text: z11.string().nullish(),
4362
- data: z11.string().nullish(),
4363
- mime_type: z11.string().nullish()
4471
+ var thoughtSummaryItemSchema = () => z12.object({
4472
+ type: z12.string(),
4473
+ text: z12.string().nullish(),
4474
+ data: z12.string().nullish(),
4475
+ mime_type: z12.string().nullish()
4364
4476
  }).loose();
4365
4477
  var contentBlockSchema = () => {
4366
- const textContent = z11.object({
4367
- type: z11.literal("text"),
4368
- text: z11.string(),
4369
- annotations: z11.array(annotationSchema()).nullish()
4478
+ const textContent = z12.object({
4479
+ type: z12.literal("text"),
4480
+ text: z12.string(),
4481
+ annotations: z12.array(annotationSchema()).nullish()
4370
4482
  }).loose();
4371
- const imageContent = z11.object({
4372
- type: z11.literal("image"),
4373
- data: z11.string().nullish(),
4374
- mime_type: z11.string().nullish(),
4375
- resolution: z11.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4376
- uri: z11.string().nullish()
4483
+ const imageContent = z12.object({
4484
+ type: z12.literal("image"),
4485
+ data: z12.string().nullish(),
4486
+ mime_type: z12.string().nullish(),
4487
+ resolution: z12.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4488
+ uri: z12.string().nullish()
4377
4489
  }).loose();
4378
- const videoContent = z11.object({
4379
- type: z11.literal("video"),
4380
- data: z11.string().nullish(),
4381
- mime_type: z11.string().nullish(),
4382
- uri: z11.string().nullish()
4490
+ const videoContent = z12.object({
4491
+ type: z12.literal("video"),
4492
+ data: z12.string().nullish(),
4493
+ mime_type: z12.string().nullish(),
4494
+ uri: z12.string().nullish()
4383
4495
  }).loose();
4384
- return z11.union([
4496
+ return z12.union([
4385
4497
  textContent,
4386
4498
  imageContent,
4387
4499
  videoContent,
4388
- z11.object({ type: z11.string() }).loose()
4500
+ z12.object({ type: z12.string() }).loose()
4389
4501
  ]);
4390
4502
  };
4391
4503
  var BUILTIN_TOOL_CALL_STEP_TYPES = [
@@ -4405,73 +4517,73 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
4405
4517
  "mcp_server_tool_result"
4406
4518
  ];
4407
4519
  var stepSchema = () => {
4408
- const userInputStep = z11.object({
4409
- type: z11.literal("user_input"),
4410
- content: z11.array(contentBlockSchema()).nullish()
4520
+ const userInputStep = z12.object({
4521
+ type: z12.literal("user_input"),
4522
+ content: z12.array(contentBlockSchema()).nullish()
4411
4523
  }).loose();
4412
- const modelOutputStep = z11.object({
4413
- type: z11.literal("model_output"),
4414
- content: z11.array(contentBlockSchema()).nullish()
4524
+ const modelOutputStep = z12.object({
4525
+ type: z12.literal("model_output"),
4526
+ content: z12.array(contentBlockSchema()).nullish()
4415
4527
  }).loose();
4416
- const functionCallStep = z11.object({
4417
- type: z11.literal("function_call"),
4418
- id: z11.string(),
4419
- name: z11.string(),
4420
- arguments: z11.record(z11.string(), z11.unknown()).nullish(),
4421
- signature: z11.string().nullish()
4528
+ const functionCallStep = z12.object({
4529
+ type: z12.literal("function_call"),
4530
+ id: z12.string(),
4531
+ name: z12.string(),
4532
+ arguments: z12.record(z12.string(), z12.unknown()).nullish(),
4533
+ signature: z12.string().nullish()
4422
4534
  }).loose();
4423
- const thoughtStep = z11.object({
4424
- type: z11.literal("thought"),
4425
- signature: z11.string().nullish(),
4426
- summary: z11.array(thoughtSummaryItemSchema()).nullish()
4535
+ const thoughtStep = z12.object({
4536
+ type: z12.literal("thought"),
4537
+ signature: z12.string().nullish(),
4538
+ summary: z12.array(thoughtSummaryItemSchema()).nullish()
4427
4539
  }).loose();
4428
- const builtinToolCallStep = z11.object({
4429
- type: z11.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
4430
- id: z11.string(),
4431
- arguments: z11.record(z11.string(), z11.unknown()).nullish(),
4432
- name: z11.string().nullish(),
4433
- server_name: z11.string().nullish(),
4434
- search_type: z11.string().nullish(),
4435
- signature: z11.string().nullish()
4540
+ const builtinToolCallStep = z12.object({
4541
+ type: z12.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
4542
+ id: z12.string(),
4543
+ arguments: z12.record(z12.string(), z12.unknown()).nullish(),
4544
+ name: z12.string().nullish(),
4545
+ server_name: z12.string().nullish(),
4546
+ search_type: z12.string().nullish(),
4547
+ signature: z12.string().nullish()
4436
4548
  }).loose();
4437
- const builtinToolResultStep = z11.object({
4438
- type: z11.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
4439
- call_id: z11.string(),
4440
- result: z11.unknown().nullish(),
4441
- is_error: z11.boolean().nullish(),
4442
- name: z11.string().nullish(),
4443
- server_name: z11.string().nullish(),
4444
- signature: z11.string().nullish()
4549
+ const builtinToolResultStep = z12.object({
4550
+ type: z12.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
4551
+ call_id: z12.string(),
4552
+ result: z12.unknown().nullish(),
4553
+ is_error: z12.boolean().nullish(),
4554
+ name: z12.string().nullish(),
4555
+ server_name: z12.string().nullish(),
4556
+ signature: z12.string().nullish()
4445
4557
  }).loose();
4446
- return z11.union([
4558
+ return z12.union([
4447
4559
  userInputStep,
4448
4560
  modelOutputStep,
4449
4561
  functionCallStep,
4450
4562
  thoughtStep,
4451
4563
  builtinToolCallStep,
4452
4564
  builtinToolResultStep,
4453
- z11.object({ type: z11.string() }).loose()
4565
+ z12.object({ type: z12.string() }).loose()
4454
4566
  ]);
4455
4567
  };
4456
4568
  var googleInteractionsResponseSchema = lazySchema9(
4457
4569
  () => zodSchema9(
4458
- z11.object({
4570
+ z12.object({
4459
4571
  /*
4460
4572
  * `id` is omitted from the response body when `store: false` (fully
4461
4573
  * stateless mode) — there is no server-side interaction record for the
4462
4574
  * client to reference. `nullish` lets the schema accept that shape.
4463
4575
  */
4464
- id: z11.string().nullish(),
4465
- created: z11.string().nullish(),
4466
- updated: z11.string().nullish(),
4576
+ id: z12.string().nullish(),
4577
+ created: z12.string().nullish(),
4578
+ updated: z12.string().nullish(),
4467
4579
  status: interactionStatusSchema(),
4468
- model: z11.string().nullish(),
4469
- agent: z11.string().nullish(),
4470
- steps: z11.array(stepSchema()).nullish(),
4580
+ model: z12.string().nullish(),
4581
+ agent: z12.string().nullish(),
4582
+ steps: z12.array(stepSchema()).nullish(),
4471
4583
  usage: usageSchema2().nullish(),
4472
- service_tier: z11.string().nullish(),
4473
- previous_interaction_id: z11.string().nullish(),
4474
- response_modalities: z11.array(z11.string()).nullish()
4584
+ service_tier: z12.string().nullish(),
4585
+ previous_interaction_id: z12.string().nullish(),
4586
+ response_modalities: z12.array(z12.string()).nullish()
4475
4587
  }).loose()
4476
4588
  )
4477
4589
  );
@@ -4481,82 +4593,82 @@ var googleInteractionsEventSchema = lazySchema9(
4481
4593
  const status = interactionStatusSchema();
4482
4594
  const annotation = annotationSchema();
4483
4595
  const thoughtSummaryItem = thoughtSummaryItemSchema();
4484
- const interactionCreatedEvent = z11.object({
4485
- event_type: z11.literal("interaction.created"),
4486
- event_id: z11.string().nullish(),
4487
- interaction: z11.object({
4596
+ const interactionCreatedEvent = z12.object({
4597
+ event_type: z12.literal("interaction.created"),
4598
+ event_id: z12.string().nullish(),
4599
+ interaction: z12.object({
4488
4600
  /*
4489
4601
  * `id` is omitted when `store: false` (fully stateless mode);
4490
4602
  * see the matching note on `googleInteractionsResponseSchema.id`.
4491
4603
  */
4492
- id: z11.string().nullish(),
4493
- created: z11.string().nullish(),
4494
- model: z11.string().nullish(),
4495
- agent: z11.string().nullish(),
4604
+ id: z12.string().nullish(),
4605
+ created: z12.string().nullish(),
4606
+ model: z12.string().nullish(),
4607
+ agent: z12.string().nullish(),
4496
4608
  status: status.nullish()
4497
4609
  }).loose()
4498
4610
  }).loose();
4499
- const stepStartEvent = z11.object({
4500
- event_type: z11.literal("step.start"),
4501
- event_id: z11.string().nullish(),
4502
- index: z11.number(),
4611
+ const stepStartEvent = z12.object({
4612
+ event_type: z12.literal("step.start"),
4613
+ event_id: z12.string().nullish(),
4614
+ index: z12.number(),
4503
4615
  step: stepSchema()
4504
4616
  }).loose();
4505
- const stepDeltaText = z11.object({
4506
- type: z11.literal("text"),
4507
- text: z11.string()
4617
+ const stepDeltaText = z12.object({
4618
+ type: z12.literal("text"),
4619
+ text: z12.string()
4508
4620
  }).loose();
4509
- const stepDeltaThoughtSummary = z11.object({
4510
- type: z11.literal("thought_summary"),
4621
+ const stepDeltaThoughtSummary = z12.object({
4622
+ type: z12.literal("thought_summary"),
4511
4623
  content: thoughtSummaryItem.nullish()
4512
4624
  }).loose();
4513
- const stepDeltaThoughtSignature = z11.object({
4514
- type: z11.literal("thought_signature"),
4515
- signature: z11.string().nullish()
4625
+ const stepDeltaThoughtSignature = z12.object({
4626
+ type: z12.literal("thought_signature"),
4627
+ signature: z12.string().nullish()
4516
4628
  }).loose();
4517
- const stepDeltaArgumentsDelta = z11.object({
4518
- type: z11.literal("arguments_delta"),
4519
- arguments: z11.string().nullish(),
4520
- id: z11.string().nullish(),
4521
- signature: z11.string().nullish()
4629
+ const stepDeltaArgumentsDelta = z12.object({
4630
+ type: z12.literal("arguments_delta"),
4631
+ arguments: z12.string().nullish(),
4632
+ id: z12.string().nullish(),
4633
+ signature: z12.string().nullish()
4522
4634
  }).loose();
4523
- const stepDeltaTextAnnotation = z11.object({
4524
- type: z11.enum(["text_annotation_delta", "text_annotation"]),
4525
- annotations: z11.array(annotation).nullish()
4635
+ const stepDeltaTextAnnotation = z12.object({
4636
+ type: z12.enum(["text_annotation_delta", "text_annotation"]),
4637
+ annotations: z12.array(annotation).nullish()
4526
4638
  }).loose();
4527
- const stepDeltaImage = z11.object({
4528
- type: z11.literal("image"),
4529
- data: z11.string().nullish(),
4530
- mime_type: z11.string().nullish(),
4531
- resolution: z11.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4532
- uri: z11.string().nullish()
4639
+ const stepDeltaImage = z12.object({
4640
+ type: z12.literal("image"),
4641
+ data: z12.string().nullish(),
4642
+ mime_type: z12.string().nullish(),
4643
+ resolution: z12.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4644
+ uri: z12.string().nullish()
4533
4645
  }).loose();
4534
- const stepDeltaVideo = z11.object({
4535
- type: z11.literal("video"),
4536
- data: z11.string().nullish(),
4537
- mime_type: z11.string().nullish(),
4538
- uri: z11.string().nullish()
4646
+ const stepDeltaVideo = z12.object({
4647
+ type: z12.literal("video"),
4648
+ data: z12.string().nullish(),
4649
+ mime_type: z12.string().nullish(),
4650
+ uri: z12.string().nullish()
4539
4651
  }).loose();
4540
- const stepDeltaBuiltinToolCall = z11.object({
4541
- type: z11.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
4542
- id: z11.string().nullish(),
4543
- arguments: z11.record(z11.string(), z11.unknown()).nullish(),
4544
- name: z11.string().nullish(),
4545
- server_name: z11.string().nullish(),
4546
- search_type: z11.string().nullish(),
4547
- signature: z11.string().nullish()
4652
+ const stepDeltaBuiltinToolCall = z12.object({
4653
+ type: z12.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
4654
+ id: z12.string().nullish(),
4655
+ arguments: z12.record(z12.string(), z12.unknown()).nullish(),
4656
+ name: z12.string().nullish(),
4657
+ server_name: z12.string().nullish(),
4658
+ search_type: z12.string().nullish(),
4659
+ signature: z12.string().nullish()
4548
4660
  }).loose();
4549
- const stepDeltaBuiltinToolResult = z11.object({
4550
- type: z11.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
4551
- call_id: z11.string().nullish(),
4552
- result: z11.unknown().nullish(),
4553
- is_error: z11.boolean().nullish(),
4554
- name: z11.string().nullish(),
4555
- server_name: z11.string().nullish(),
4556
- signature: z11.string().nullish()
4661
+ const stepDeltaBuiltinToolResult = z12.object({
4662
+ type: z12.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
4663
+ call_id: z12.string().nullish(),
4664
+ result: z12.unknown().nullish(),
4665
+ is_error: z12.boolean().nullish(),
4666
+ name: z12.string().nullish(),
4667
+ server_name: z12.string().nullish(),
4668
+ signature: z12.string().nullish()
4557
4669
  }).loose();
4558
- const stepDeltaUnknown = z11.object({ type: z11.string() }).loose();
4559
- const stepDeltaUnion = z11.union([
4670
+ const stepDeltaUnknown = z12.object({ type: z12.string() }).loose();
4671
+ const stepDeltaUnion = z12.union([
4560
4672
  stepDeltaText,
4561
4673
  stepDeltaImage,
4562
4674
  stepDeltaVideo,
@@ -4568,55 +4680,55 @@ var googleInteractionsEventSchema = lazySchema9(
4568
4680
  stepDeltaBuiltinToolResult,
4569
4681
  stepDeltaUnknown
4570
4682
  ]);
4571
- const stepDeltaEvent = z11.object({
4572
- event_type: z11.literal("step.delta"),
4573
- event_id: z11.string().nullish(),
4574
- index: z11.number(),
4683
+ const stepDeltaEvent = z12.object({
4684
+ event_type: z12.literal("step.delta"),
4685
+ event_id: z12.string().nullish(),
4686
+ index: z12.number(),
4575
4687
  delta: stepDeltaUnion
4576
4688
  }).loose();
4577
- const stepStopEvent = z11.object({
4578
- event_type: z11.literal("step.stop"),
4579
- event_id: z11.string().nullish(),
4580
- index: z11.number()
4689
+ const stepStopEvent = z12.object({
4690
+ event_type: z12.literal("step.stop"),
4691
+ event_id: z12.string().nullish(),
4692
+ index: z12.number()
4581
4693
  }).loose();
4582
- const interactionStatusUpdateEvent = z11.object({
4583
- event_type: z11.literal("interaction.status_update"),
4584
- event_id: z11.string().nullish(),
4585
- interaction_id: z11.string().nullish(),
4694
+ const interactionStatusUpdateEvent = z12.object({
4695
+ event_type: z12.literal("interaction.status_update"),
4696
+ event_id: z12.string().nullish(),
4697
+ interaction_id: z12.string().nullish(),
4586
4698
  status: status.nullish()
4587
4699
  }).loose();
4588
- const interactionInProgressEvent = z11.object({
4589
- event_type: z11.literal("interaction.in_progress"),
4590
- event_id: z11.string().nullish(),
4591
- interaction_id: z11.string().nullish(),
4700
+ const interactionInProgressEvent = z12.object({
4701
+ event_type: z12.literal("interaction.in_progress"),
4702
+ event_id: z12.string().nullish(),
4703
+ interaction_id: z12.string().nullish(),
4592
4704
  status: status.nullish()
4593
4705
  }).loose();
4594
- const interactionRequiresActionEvent = z11.object({
4595
- event_type: z11.literal("interaction.requires_action"),
4596
- event_id: z11.string().nullish(),
4597
- interaction_id: z11.string().nullish(),
4706
+ const interactionRequiresActionEvent = z12.object({
4707
+ event_type: z12.literal("interaction.requires_action"),
4708
+ event_id: z12.string().nullish(),
4709
+ interaction_id: z12.string().nullish(),
4598
4710
  status: status.nullish()
4599
4711
  }).loose();
4600
- const interactionCompletedEvent = z11.object({
4601
- event_type: z11.literal("interaction.completed"),
4602
- event_id: z11.string().nullish(),
4603
- interaction: z11.object({
4604
- id: z11.string().nullish(),
4712
+ const interactionCompletedEvent = z12.object({
4713
+ event_type: z12.literal("interaction.completed"),
4714
+ event_id: z12.string().nullish(),
4715
+ interaction: z12.object({
4716
+ id: z12.string().nullish(),
4605
4717
  status: status.nullish(),
4606
4718
  usage: usageSchema2().nullish(),
4607
- service_tier: z11.string().nullish()
4719
+ service_tier: z12.string().nullish()
4608
4720
  }).loose()
4609
4721
  }).loose();
4610
- const errorEvent = z11.object({
4611
- event_type: z11.literal("error"),
4612
- event_id: z11.string().nullish(),
4613
- error: z11.object({
4614
- code: z11.string().nullish(),
4615
- message: z11.string().nullish()
4722
+ const errorEvent = z12.object({
4723
+ event_type: z12.literal("error"),
4724
+ event_id: z12.string().nullish(),
4725
+ error: z12.object({
4726
+ code: z12.string().nullish(),
4727
+ message: z12.string().nullish()
4616
4728
  }).loose().nullish()
4617
4729
  }).loose();
4618
- const unknownEvent = z11.object({ event_type: z11.string() }).loose();
4619
- return z11.union([
4730
+ const unknownEvent = z12.object({ event_type: z12.string() }).loose();
4731
+ return z12.union([
4620
4732
  interactionCreatedEvent,
4621
4733
  stepStartEvent,
4622
4734
  stepDeltaEvent,
@@ -4637,26 +4749,26 @@ import {
4637
4749
  lazySchema as lazySchema10,
4638
4750
  zodSchema as zodSchema10
4639
4751
  } from "@ai-sdk/provider-utils";
4640
- import { z as z12 } from "zod/v4";
4752
+ import { z as z13 } from "zod/v4";
4641
4753
  var googleInteractionsLanguageModelOptions = lazySchema10(
4642
4754
  () => zodSchema10(
4643
- z12.object({
4644
- previousInteractionId: z12.string().nullish(),
4645
- store: z12.boolean().nullish(),
4646
- agent: z12.string().nullish(),
4647
- agentConfig: z12.union([
4648
- z12.object({
4649
- type: z12.literal("dynamic")
4755
+ z13.object({
4756
+ previousInteractionId: z13.string().nullish(),
4757
+ store: z13.boolean().nullish(),
4758
+ agent: z13.string().nullish(),
4759
+ agentConfig: z13.union([
4760
+ z13.object({
4761
+ type: z13.literal("dynamic")
4650
4762
  }).loose(),
4651
- z12.object({
4652
- type: z12.literal("deep-research"),
4653
- thinkingSummaries: z12.enum(["auto", "none"]).nullish(),
4654
- visualization: z12.enum(["off", "auto"]).nullish(),
4655
- collaborativePlanning: z12.boolean().nullish()
4763
+ z13.object({
4764
+ type: z13.literal("deep-research"),
4765
+ thinkingSummaries: z13.enum(["auto", "none"]).nullish(),
4766
+ visualization: z13.enum(["off", "auto"]).nullish(),
4767
+ collaborativePlanning: z13.boolean().nullish()
4656
4768
  })
4657
4769
  ]).nullish(),
4658
- thinkingLevel: z12.enum(["minimal", "low", "medium", "high"]).nullish(),
4659
- thinkingSummaries: z12.enum(["auto", "none"]).nullish(),
4770
+ thinkingLevel: z13.enum(["minimal", "low", "medium", "high"]).nullish(),
4771
+ thinkingSummaries: z13.enum(["auto", "none"]).nullish(),
4660
4772
  /**
4661
4773
  * Output-format entries that map directly to the API's `response_format`
4662
4774
  * array. Use this to request image, audio, video, or non-JSON text
@@ -4666,17 +4778,17 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
4666
4778
  * type: 'json', schema }` still drives JSON-mode and adds a matching
4667
4779
  * text entry automatically; entries listed here are appended.
4668
4780
  */
4669
- responseFormat: z12.array(
4670
- z12.union([
4671
- z12.object({
4672
- type: z12.literal("text"),
4673
- mimeType: z12.string().nullish(),
4674
- schema: z12.unknown().nullish()
4781
+ responseFormat: z13.array(
4782
+ z13.union([
4783
+ z13.object({
4784
+ type: z13.literal("text"),
4785
+ mimeType: z13.string().nullish(),
4786
+ schema: z13.unknown().nullish()
4675
4787
  }).loose(),
4676
- z12.object({
4677
- type: z12.literal("image"),
4678
- mimeType: z12.string().nullish(),
4679
- aspectRatio: z12.enum([
4788
+ z13.object({
4789
+ type: z13.literal("image"),
4790
+ mimeType: z13.string().nullish(),
4791
+ aspectRatio: z13.enum([
4680
4792
  "1:1",
4681
4793
  "2:3",
4682
4794
  "3:2",
@@ -4692,19 +4804,19 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
4692
4804
  "1:4",
4693
4805
  "4:1"
4694
4806
  ]).nullish(),
4695
- imageSize: z12.enum(["1K", "2K", "4K", "512"]).nullish()
4807
+ imageSize: z13.enum(["1K", "2K", "4K", "512"]).nullish()
4696
4808
  }).loose(),
4697
- z12.object({
4698
- type: z12.literal("audio"),
4699
- mimeType: z12.string().nullish()
4809
+ z13.object({
4810
+ type: z13.literal("audio"),
4811
+ mimeType: z13.string().nullish()
4700
4812
  }).loose(),
4701
- z12.object({
4702
- type: z12.literal("video"),
4703
- aspectRatio: z12.enum(["16:9", "9:16"]).nullish(),
4704
- resolution: z12.enum(["360p", "720p", "1080p", "4k"]).nullish(),
4705
- duration: z12.string().nullish(),
4706
- delivery: z12.enum(["inline", "uri"]).nullish(),
4707
- gcsUri: z12.string().nullish()
4813
+ z13.object({
4814
+ type: z13.literal("video"),
4815
+ aspectRatio: z13.enum(["16:9", "9:16"]).nullish(),
4816
+ resolution: z13.enum(["360p", "720p", "1080p", "4k"]).nullish(),
4817
+ duration: z13.string().nullish(),
4818
+ delivery: z13.enum(["inline", "uri"]).nullish(),
4819
+ gcsUri: z13.string().nullish()
4708
4820
  }).loose()
4709
4821
  ])
4710
4822
  ).nullish(),
@@ -4714,8 +4826,8 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
4714
4826
  * translates it into a matching `response_format` image entry and
4715
4827
  * emits a warning when set.
4716
4828
  */
4717
- imageConfig: z12.object({
4718
- aspectRatio: z12.enum([
4829
+ imageConfig: z13.object({
4830
+ aspectRatio: z13.enum([
4719
4831
  "1:1",
4720
4832
  "2:3",
4721
4833
  "3:2",
@@ -4731,35 +4843,35 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
4731
4843
  "1:4",
4732
4844
  "4:1"
4733
4845
  ]).nullish(),
4734
- imageSize: z12.enum(["1K", "2K", "4K", "512"]).nullish()
4846
+ imageSize: z13.enum(["1K", "2K", "4K", "512"]).nullish()
4735
4847
  }).nullish(),
4736
- mediaResolution: z12.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4737
- responseModalities: z12.array(z12.enum(["text", "image", "audio", "video", "document"])).nullish(),
4738
- serviceTier: z12.enum(["flex", "standard", "priority"]).nullish(),
4848
+ mediaResolution: z13.enum(["low", "medium", "high", "ultra_high"]).nullish(),
4849
+ responseModalities: z13.array(z13.enum(["text", "image", "audio", "video", "document"])).nullish(),
4850
+ serviceTier: z13.enum(["flex", "standard", "priority"]).nullish(),
4739
4851
  /**
4740
4852
  * Alternative to AI SDK `system` message. If both are set, the AI SDK
4741
4853
  * `system` message wins and a warning is emitted.
4742
4854
  */
4743
- systemInstruction: z12.string().nullish(),
4855
+ systemInstruction: z13.string().nullish(),
4744
4856
  /**
4745
4857
  * Per-block signature for round-tripping `thought.signature` and
4746
4858
  * `function_call.signature` blocks. Set by the SDK on output reasoning /
4747
4859
  * tool-call parts; passed back unchanged on input parts so the API
4748
4860
  * accepts the prior turn.
4749
4861
  */
4750
- signature: z12.string().nullish(),
4862
+ signature: z13.string().nullish(),
4751
4863
  /**
4752
4864
  * Set by the SDK on output assistant messages. The converter uses it to
4753
4865
  * decide which messages to drop when compacting under
4754
4866
  * `previousInteractionId`.
4755
4867
  */
4756
- interactionId: z12.string().nullish(),
4868
+ interactionId: z13.string().nullish(),
4757
4869
  /**
4758
4870
  * Maximum time, in milliseconds, to poll a background interaction (agent
4759
4871
  * call) before giving up. Defaults to 30 minutes. Long-running agents
4760
4872
  * such as deep research can take tens of minutes — increase if needed.
4761
4873
  */
4762
- pollingTimeoutMs: z12.number().int().positive().nullish(),
4874
+ pollingTimeoutMs: z13.number().int().positive().nullish(),
4763
4875
  /**
4764
4876
  * Run the interaction in the background. Required for agents whose
4765
4877
  * server-side workflow cannot complete within a single request/response.
@@ -4768,7 +4880,7 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
4768
4880
  * reject `true`; see the agent's documentation for which mode it
4769
4881
  * requires.
4770
4882
  */
4771
- background: z12.boolean().nullish(),
4883
+ background: z13.boolean().nullish(),
4772
4884
  /**
4773
4885
  * Environment configuration for the agent sandbox. Only applies to agent
4774
4886
  * calls (`google.interactions({ agent })`); ignored on model-id calls.
@@ -4778,36 +4890,36 @@ var googleInteractionsLanguageModelOptions = lazySchema10(
4778
4890
  * - object: provision a fresh sandbox and optionally preload `sources`
4779
4891
  * and/or constrain outbound traffic via `network`.
4780
4892
  */
4781
- environment: z12.union([
4782
- z12.string(),
4783
- z12.object({
4784
- type: z12.literal("remote"),
4785
- sources: z12.array(
4786
- z12.union([
4787
- z12.object({
4788
- type: z12.literal("gcs"),
4789
- source: z12.string(),
4790
- target: z12.string().nullish()
4893
+ environment: z13.union([
4894
+ z13.string(),
4895
+ z13.object({
4896
+ type: z13.literal("remote"),
4897
+ sources: z13.array(
4898
+ z13.union([
4899
+ z13.object({
4900
+ type: z13.literal("gcs"),
4901
+ source: z13.string(),
4902
+ target: z13.string().nullish()
4791
4903
  }),
4792
- z12.object({
4793
- type: z12.literal("repository"),
4794
- source: z12.string(),
4795
- target: z12.string().nullish()
4904
+ z13.object({
4905
+ type: z13.literal("repository"),
4906
+ source: z13.string(),
4907
+ target: z13.string().nullish()
4796
4908
  }),
4797
- z12.object({
4798
- type: z12.literal("inline"),
4799
- content: z12.string(),
4800
- target: z12.string()
4909
+ z13.object({
4910
+ type: z13.literal("inline"),
4911
+ content: z13.string(),
4912
+ target: z13.string()
4801
4913
  })
4802
4914
  ])
4803
4915
  ).nullish(),
4804
- network: z12.union([
4805
- z12.literal("disabled"),
4806
- z12.object({
4807
- allowlist: z12.array(
4808
- z12.object({
4809
- domain: z12.string(),
4810
- transform: z12.array(z12.record(z12.string(), z12.string())).nullish()
4916
+ network: z13.union([
4917
+ z13.literal("disabled"),
4918
+ z13.object({
4919
+ allowlist: z13.array(
4920
+ z13.object({
4921
+ domain: z13.string(),
4922
+ transform: z13.array(z13.record(z13.string(), z13.string())).nullish()
4811
4923
  })
4812
4924
  )
4813
4925
  })
@@ -5120,6 +5232,9 @@ function prepareGoogleInteractionsTools({
5120
5232
  }) {
5121
5233
  var _a, _b, _c, _d;
5122
5234
  const toolWarnings = [];
5235
+ if ((toolChoice == null ? void 0 : toolChoice.type) === "none") {
5236
+ return { tools: void 0, toolChoice: void 0, toolWarnings };
5237
+ }
5123
5238
  const normalized = (tools == null ? void 0 : tools.length) ? tools : void 0;
5124
5239
  if (normalized == null) {
5125
5240
  return { tools: void 0, toolChoice: void 0, toolWarnings };
@@ -5241,9 +5356,6 @@ function prepareGoogleInteractionsTools({
5241
5356
  case "required":
5242
5357
  mappedToolChoice = "any";
5243
5358
  break;
5244
- case "none":
5245
- mappedToolChoice = "none";
5246
- break;
5247
5359
  case "tool":
5248
5360
  mappedToolChoice = {
5249
5361
  allowed_tools: {