@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.
package/dist/index.mjs CHANGED
@@ -21,15 +21,16 @@ import {
21
21
  zodSchema
22
22
  } from "@ai-sdk/provider-utils";
23
23
  import { z } from "zod/v4";
24
+ var getGoogleErrorSchema = () => z.object({
25
+ code: z.number().nullable(),
26
+ message: z.string(),
27
+ status: z.string(),
28
+ details: z.array(z.unknown()).nullish()
29
+ });
24
30
  var googleErrorDataSchema = lazySchema(
25
31
  () => zodSchema(
26
32
  z.object({
27
- error: z.object({
28
- code: z.number().nullable(),
29
- message: z.string(),
30
- status: z.string(),
31
- details: z.array(z.unknown()).nullish()
32
- })
33
+ error: getGoogleErrorSchema()
33
34
  })
34
35
  )
35
36
  );
@@ -37,6 +38,39 @@ var googleFailedResponseHandler = createJsonErrorResponseHandler({
37
38
  errorSchema: googleErrorDataSchema,
38
39
  errorToMessage: (data) => data.error.message
39
40
  });
41
+ function mapGoogleErrorStatusToHttpStatusCode(status) {
42
+ switch (status) {
43
+ case "CANCELLED":
44
+ return 499;
45
+ case "INVALID_ARGUMENT":
46
+ case "FAILED_PRECONDITION":
47
+ case "OUT_OF_RANGE":
48
+ return 400;
49
+ case "DEADLINE_EXCEEDED":
50
+ return 504;
51
+ case "NOT_FOUND":
52
+ return 404;
53
+ case "ALREADY_EXISTS":
54
+ case "ABORTED":
55
+ return 409;
56
+ case "PERMISSION_DENIED":
57
+ return 403;
58
+ case "UNAUTHENTICATED":
59
+ return 401;
60
+ case "RESOURCE_EXHAUSTED":
61
+ return 429;
62
+ case "UNIMPLEMENTED":
63
+ return 501;
64
+ case "UNKNOWN":
65
+ case "INTERNAL":
66
+ case "DATA_LOSS":
67
+ return 500;
68
+ case "UNAVAILABLE":
69
+ return 503;
70
+ default:
71
+ return void 0;
72
+ }
73
+ }
40
74
 
41
75
  // src/transcription/google-transcription-model-options.ts
42
76
  import {
@@ -238,7 +272,7 @@ import {
238
272
  } from "@ai-sdk/provider-utils";
239
273
 
240
274
  // src/version.ts
241
- var VERSION = true ? "3.0.139" : "0.0.0-test";
275
+ var VERSION = true ? "3.0.141" : "0.0.0-test";
242
276
 
243
277
  // src/google-generative-ai-embedding-model.ts
244
278
  import {
@@ -474,6 +508,9 @@ function validateMultimodalContentLength({
474
508
  }
475
509
 
476
510
  // src/google-generative-ai-language-model.ts
511
+ import {
512
+ APICallError
513
+ } from "@ai-sdk/provider";
477
514
  import {
478
515
  combineHeaders as combineHeaders3,
479
516
  createEventSourceResponseHandler,
@@ -485,7 +522,7 @@ import {
485
522
  resolve as resolve3,
486
523
  zodSchema as zodSchema7
487
524
  } from "@ai-sdk/provider-utils";
488
- import { z as z7 } from "zod/v4";
525
+ import { z as z8 } from "zod/v4";
489
526
 
490
527
  // src/continue-google-stream.ts
491
528
  function continueGoogleStream({
@@ -912,10 +949,24 @@ import {
912
949
  UnsupportedFunctionalityError as UnsupportedFunctionalityError2
913
950
  } from "@ai-sdk/provider";
914
951
  import {
952
+ stringifyWithBigIntAndCycles,
915
953
  convertToBase64 as convertToBase642,
916
954
  isUrlSupported,
917
955
  secureJsonParse
918
956
  } from "@ai-sdk/provider-utils";
957
+
958
+ // src/google-generative-ai-prompt.ts
959
+ import { z as z6 } from "zod/v4";
960
+ var googleVideoMetadataSchema = z6.object({
961
+ /** Start offset as a duration in seconds, e.g. `'3.5s'`. */
962
+ startOffset: z6.string().optional(),
963
+ /** End offset as a duration in seconds, e.g. `'10s'`. */
964
+ endOffset: z6.string().optional(),
965
+ /** Frames per second in the range (0, 24]. Defaults to 1. */
966
+ fps: z6.number().gt(0).max(24).optional()
967
+ });
968
+
969
+ // src/convert-to-google-generative-ai-messages.ts
919
970
  var SKIP_THOUGHT_SIGNATURE_VALIDATOR = "skip_thought_signature_validator";
920
971
  function getGoogleProviderOptions(providerOptions, providerOptionsName) {
921
972
  const namespaces = [
@@ -965,6 +1016,31 @@ function convertUrlToolResultPart(url, mediaType, supportedFunctionResponseUrls)
965
1016
  }
966
1017
  } : void 0;
967
1018
  }
1019
+ function serializeFunctionResponseContent(value) {
1020
+ return containsNonJsonValue(value) ? secureJsonParse(stringifyWithBigIntAndCycles(value)) : value;
1021
+ }
1022
+ function containsNonJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
1023
+ if (typeof value === "bigint") {
1024
+ return true;
1025
+ }
1026
+ if (typeof value !== "object" || value === null) {
1027
+ return false;
1028
+ }
1029
+ if (typeof value.toJSON === "function") {
1030
+ return true;
1031
+ }
1032
+ if (ancestors.has(value)) {
1033
+ return true;
1034
+ }
1035
+ ancestors.add(value);
1036
+ try {
1037
+ return Object.values(value).some(
1038
+ (item) => containsNonJsonValue(item, ancestors)
1039
+ );
1040
+ } finally {
1041
+ ancestors.delete(value);
1042
+ }
1043
+ }
968
1044
  function appendToolResultParts(parts, toolName, outputValue, toolCallId, includeFunctionCallIds = true, supportedFunctionResponseUrls = {}) {
969
1045
  const functionResponseParts = [];
970
1046
  const responseTextParts = [];
@@ -994,12 +1070,12 @@ function appendToolResultParts(parts, toolName, outputValue, toolCallId, include
994
1070
  if (functionResponsePart != null) {
995
1071
  functionResponseParts.push(functionResponsePart);
996
1072
  } else {
997
- responseTextParts.push(JSON.stringify(contentPart));
1073
+ responseTextParts.push(stringifyWithBigIntAndCycles(contentPart));
998
1074
  }
999
1075
  break;
1000
1076
  }
1001
1077
  default: {
1002
- responseTextParts.push(JSON.stringify(contentPart));
1078
+ responseTextParts.push(stringifyWithBigIntAndCycles(contentPart));
1003
1079
  break;
1004
1080
  }
1005
1081
  }
@@ -1048,13 +1124,13 @@ function appendLegacyToolResultParts(parts, toolName, outputValue, toolCallId, i
1048
1124
  break;
1049
1125
  }
1050
1126
  default:
1051
- parts.push({ text: JSON.stringify(contentPart) });
1127
+ parts.push({ text: stringifyWithBigIntAndCycles(contentPart) });
1052
1128
  break;
1053
1129
  }
1054
1130
  }
1055
1131
  }
1056
1132
  function convertToGoogleGenerativeAIMessages(prompt, options) {
1057
- var _a2, _b, _c, _d, _e, _f, _g;
1133
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
1058
1134
  const systemInstructionParts = [];
1059
1135
  const contents = [];
1060
1136
  let systemMessagesAllowed = true;
@@ -1094,17 +1170,24 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
1094
1170
  }
1095
1171
  case "file": {
1096
1172
  const mediaType = part.mediaType === "image/*" ? "image/jpeg" : part.mediaType;
1173
+ const rawVideoMetadata = (_g = getGoogleProviderOptions(
1174
+ part.providerOptions,
1175
+ providerOptionsName
1176
+ )) == null ? void 0 : _g.videoMetadata;
1177
+ const videoMetadata = rawVideoMetadata == null ? void 0 : googleVideoMetadataSchema.parse(rawVideoMetadata);
1097
1178
  parts.push(
1098
1179
  part.data instanceof URL ? {
1099
1180
  fileData: {
1100
1181
  mimeType: mediaType,
1101
1182
  fileUri: part.data.protocol === "gs:" && part.originalUrl != null ? part.originalUrl : part.data.toString()
1102
- }
1183
+ },
1184
+ ...videoMetadata != null ? { videoMetadata } : {}
1103
1185
  } : {
1104
1186
  inlineData: {
1105
1187
  mimeType: mediaType,
1106
1188
  data: convertToBase642(part.data)
1107
- }
1189
+ },
1190
+ ...videoMetadata != null ? { videoMetadata } : {}
1108
1191
  }
1109
1192
  );
1110
1193
  break;
@@ -1183,7 +1266,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
1183
1266
  functionCall: {
1184
1267
  ...includeFunctionCallIds && part.toolCallId != null ? { id: part.toolCallId } : {},
1185
1268
  name: part.toolName,
1186
- args: part.input
1269
+ args: parseToolCallInput(part.input)
1187
1270
  },
1188
1271
  thoughtSignature: effectiveThoughtSignature
1189
1272
  };
@@ -1265,7 +1348,7 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
1265
1348
  name: part.toolName,
1266
1349
  response: {
1267
1350
  name: part.toolName,
1268
- content: output.type === "execution-denied" ? (_g = output.reason) != null ? _g : "Tool call execution denied." : output.value
1351
+ content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool call execution denied." : serializeFunctionResponseContent(output.value)
1269
1352
  }
1270
1353
  }
1271
1354
  });
@@ -1295,6 +1378,16 @@ function convertToGoogleGenerativeAIMessages(prompt, options) {
1295
1378
  contents
1296
1379
  };
1297
1380
  }
1381
+ function parseToolCallInput(input) {
1382
+ if (typeof input !== "string") {
1383
+ return input;
1384
+ }
1385
+ try {
1386
+ return secureJsonParse(input);
1387
+ } catch (e) {
1388
+ return input;
1389
+ }
1390
+ }
1298
1391
 
1299
1392
  // src/download-tool-result-files.ts
1300
1393
  import {
@@ -1376,23 +1469,23 @@ import {
1376
1469
  lazySchema as lazySchema6,
1377
1470
  zodSchema as zodSchema6
1378
1471
  } from "@ai-sdk/provider-utils";
1379
- import { z as z6 } from "zod/v4";
1472
+ import { z as z7 } from "zod/v4";
1380
1473
  var googleLanguageModelOptions = lazySchema6(
1381
1474
  () => zodSchema6(
1382
- z6.object({
1383
- responseModalities: z6.array(z6.enum(["TEXT", "IMAGE"])).optional(),
1384
- thinkingConfig: z6.object({
1385
- thinkingBudget: z6.number().optional(),
1386
- includeThoughts: z6.boolean().optional(),
1475
+ z7.object({
1476
+ responseModalities: z7.array(z7.enum(["TEXT", "IMAGE"])).optional(),
1477
+ thinkingConfig: z7.object({
1478
+ thinkingBudget: z7.number().optional(),
1479
+ includeThoughts: z7.boolean().optional(),
1387
1480
  // https://ai.google.dev/gemini-api/docs/gemini-3?thinking=high#thinking_level
1388
- thinkingLevel: z6.enum(["minimal", "low", "medium", "high"]).optional()
1481
+ thinkingLevel: z7.enum(["minimal", "low", "medium", "high"]).optional()
1389
1482
  }).optional(),
1390
1483
  /**
1391
1484
  * Optional.
1392
1485
  * The name of the cached content used as context to serve the prediction.
1393
1486
  * Format: cachedContents/{cachedContent}
1394
1487
  */
1395
- cachedContent: z6.string().optional(),
1488
+ cachedContent: z7.string().optional(),
1396
1489
  /**
1397
1490
  * Optional. Enable structured output. Default is true.
1398
1491
  *
@@ -1401,13 +1494,13 @@ var googleLanguageModelOptions = lazySchema6(
1401
1494
  * Google Generative AI uses. You can use this to disable
1402
1495
  * structured outputs if you need to.
1403
1496
  */
1404
- structuredOutputs: z6.boolean().optional(),
1497
+ structuredOutputs: z7.boolean().optional(),
1405
1498
  /**
1406
1499
  * Optional. A list of unique safety settings for blocking unsafe content.
1407
1500
  */
1408
- safetySettings: z6.array(
1409
- z6.object({
1410
- category: z6.enum([
1501
+ safetySettings: z7.array(
1502
+ z7.object({
1503
+ category: z7.enum([
1411
1504
  "HARM_CATEGORY_UNSPECIFIED",
1412
1505
  "HARM_CATEGORY_HATE_SPEECH",
1413
1506
  "HARM_CATEGORY_DANGEROUS_CONTENT",
@@ -1415,7 +1508,7 @@ var googleLanguageModelOptions = lazySchema6(
1415
1508
  "HARM_CATEGORY_SEXUALLY_EXPLICIT",
1416
1509
  "HARM_CATEGORY_CIVIC_INTEGRITY"
1417
1510
  ]),
1418
- threshold: z6.enum([
1511
+ threshold: z7.enum([
1419
1512
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
1420
1513
  "BLOCK_LOW_AND_ABOVE",
1421
1514
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -1425,7 +1518,7 @@ var googleLanguageModelOptions = lazySchema6(
1425
1518
  ])
1426
1519
  })
1427
1520
  ).optional(),
1428
- threshold: z6.enum([
1521
+ threshold: z7.enum([
1429
1522
  "HARM_BLOCK_THRESHOLD_UNSPECIFIED",
1430
1523
  "BLOCK_LOW_AND_ABOVE",
1431
1524
  "BLOCK_MEDIUM_AND_ABOVE",
@@ -1438,19 +1531,19 @@ var googleLanguageModelOptions = lazySchema6(
1438
1531
  *
1439
1532
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/audio-understanding
1440
1533
  */
1441
- audioTimestamp: z6.boolean().optional(),
1534
+ audioTimestamp: z7.boolean().optional(),
1442
1535
  /**
1443
1536
  * Optional. Defines labels used in billing reports. Available on Vertex AI only.
1444
1537
  *
1445
1538
  * https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/add-labels-to-api-calls
1446
1539
  */
1447
- labels: z6.record(z6.string(), z6.string()).optional(),
1540
+ labels: z7.record(z7.string(), z7.string()).optional(),
1448
1541
  /**
1449
1542
  * Optional. If specified, the media resolution specified will be used.
1450
1543
  *
1451
1544
  * https://ai.google.dev/api/generate-content#MediaResolution
1452
1545
  */
1453
- mediaResolution: z6.enum([
1546
+ mediaResolution: z7.enum([
1454
1547
  "MEDIA_RESOLUTION_UNSPECIFIED",
1455
1548
  "MEDIA_RESOLUTION_LOW",
1456
1549
  "MEDIA_RESOLUTION_MEDIUM",
@@ -1461,8 +1554,8 @@ var googleLanguageModelOptions = lazySchema6(
1461
1554
  *
1462
1555
  * https://ai.google.dev/gemini-api/docs/image-generation#aspect_ratios
1463
1556
  */
1464
- imageConfig: z6.object({
1465
- aspectRatio: z6.enum([
1557
+ imageConfig: z7.object({
1558
+ aspectRatio: z7.enum([
1466
1559
  "1:1",
1467
1560
  "2:3",
1468
1561
  "3:2",
@@ -1478,12 +1571,12 @@ var googleLanguageModelOptions = lazySchema6(
1478
1571
  "1:4",
1479
1572
  "4:1"
1480
1573
  ]).optional(),
1481
- imageSize: z6.enum(["1K", "2K", "4K", "512"]).optional(),
1574
+ imageSize: z7.enum(["1K", "2K", "4K", "512"]).optional(),
1482
1575
  /**
1483
1576
  * Optional. Controls the generation of people in images.
1484
1577
  * Vertex AI only.
1485
1578
  */
1486
- personGeneration: z6.enum([
1579
+ personGeneration: z7.enum([
1487
1580
  "PERSON_GENERATION_UNSPECIFIED",
1488
1581
  "ALLOW_ALL",
1489
1582
  "ALLOW_ADULT",
@@ -1497,7 +1590,7 @@ var googleLanguageModelOptions = lazySchema6(
1497
1590
  *
1498
1591
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerationConfig
1499
1592
  */
1500
- prominentPeople: z6.enum([
1593
+ prominentPeople: z7.enum([
1501
1594
  "PROMINENT_PEOPLE_UNSPECIFIED",
1502
1595
  "ALLOW_PROMINENT_PEOPLE",
1503
1596
  "BLOCK_PROMINENT_PEOPLE"
@@ -1506,9 +1599,9 @@ var googleLanguageModelOptions = lazySchema6(
1506
1599
  * Optional. The image output format for generated images.
1507
1600
  * Vertex AI only.
1508
1601
  */
1509
- imageOutputOptions: z6.object({
1510
- mimeType: z6.enum(["image/jpeg", "image/png"]).optional(),
1511
- compressionQuality: z6.number().optional()
1602
+ imageOutputOptions: z7.object({
1603
+ mimeType: z7.enum(["image/jpeg", "image/png"]).optional(),
1604
+ compressionQuality: z7.number().optional()
1512
1605
  }).optional()
1513
1606
  }).optional(),
1514
1607
  /**
@@ -1517,10 +1610,10 @@ var googleLanguageModelOptions = lazySchema6(
1517
1610
  *
1518
1611
  * https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
1519
1612
  */
1520
- retrievalConfig: z6.object({
1521
- latLng: z6.object({
1522
- latitude: z6.number(),
1523
- longitude: z6.number()
1613
+ retrievalConfig: z7.object({
1614
+ latLng: z7.object({
1615
+ latitude: z7.number(),
1616
+ longitude: z7.number()
1524
1617
  }).optional()
1525
1618
  }).optional(),
1526
1619
  /**
@@ -1533,12 +1626,12 @@ var googleLanguageModelOptions = lazySchema6(
1533
1626
  *
1534
1627
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
1535
1628
  */
1536
- streamFunctionCallArguments: z6.boolean().optional(),
1629
+ streamFunctionCallArguments: z7.boolean().optional(),
1537
1630
  /**
1538
1631
  * Optional. The service tier to use for the request. Sent as the
1539
1632
  * `serviceTier` body field. Gemini API only.
1540
1633
  */
1541
- serviceTier: z6.enum(["standard", "flex", "priority"]).optional(),
1634
+ serviceTier: z7.enum(["standard", "flex", "priority"]).optional(),
1542
1635
  /**
1543
1636
  * Optional. Resumes a response that stopped with `MAX_TOKENS` because it
1544
1637
  * used up its `maxOutputTokens` budget (Gemini 4 long decode). Pass the
@@ -1548,7 +1641,7 @@ var googleLanguageModelOptions = lazySchema6(
1548
1641
  * per-request cap while budget remains (`CONTINUATION`) are continued
1549
1642
  * automatically. Sent as the `continuationToken` body field.
1550
1643
  */
1551
- continuationToken: z6.string().optional(),
1644
+ continuationToken: z7.string().optional(),
1552
1645
  /**
1553
1646
  * Optional. Vertex AI only. Sent as the
1554
1647
  * `X-Vertex-AI-LLM-Shared-Request-Type` request header to select a
@@ -1559,7 +1652,7 @@ var googleLanguageModelOptions = lazySchema6(
1559
1652
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
1560
1653
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/flex-paygo
1561
1654
  */
1562
- sharedRequestType: z6.enum(["priority", "flex", "standard"]).optional(),
1655
+ sharedRequestType: z7.enum(["priority", "flex", "standard"]).optional(),
1563
1656
  /**
1564
1657
  * Optional. Vertex AI only. Sent as the `X-Vertex-AI-LLM-Request-Type`
1565
1658
  * request header. Set to `'shared'` together with `sharedRequestType`
@@ -1567,7 +1660,7 @@ var googleLanguageModelOptions = lazySchema6(
1567
1660
  *
1568
1661
  * https://docs.cloud.google.com/vertex-ai/generative-ai/docs/priority-paygo
1569
1662
  */
1570
- requestType: z6.enum(["shared"]).optional()
1663
+ requestType: z7.enum(["shared"]).optional()
1571
1664
  })
1572
1665
  )
1573
1666
  );
@@ -2598,10 +2691,11 @@ var GoogleGenerativeAILanguageModel = class {
2598
2691
  options.headers,
2599
2692
  extraHeaders
2600
2693
  );
2694
+ const url = `${this.config.baseURL}/${getModelPath(
2695
+ this.modelId
2696
+ )}:streamGenerateContent?alt=sse`;
2601
2697
  const streamGenerateContent = (body) => postJsonToApi3({
2602
- url: `${this.config.baseURL}/${getModelPath(
2603
- this.modelId
2604
- )}:streamGenerateContent?alt=sse`,
2698
+ url,
2605
2699
  headers,
2606
2700
  body,
2607
2701
  failedResponseHandler: googleFailedResponseHandler,
@@ -2691,7 +2785,7 @@ var GoogleGenerativeAILanguageModel = class {
2691
2785
  controller.enqueue({ type: "stream-start", warnings });
2692
2786
  },
2693
2787
  transform(chunk, controller) {
2694
- var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
2788
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
2695
2789
  if (options.includeRawChunks) {
2696
2790
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2697
2791
  }
@@ -2700,6 +2794,23 @@ var GoogleGenerativeAILanguageModel = class {
2700
2794
  return;
2701
2795
  }
2702
2796
  const value = chunk.value;
2797
+ if (value.error != null) {
2798
+ finishReason = { unified: "error", raw: void 0 };
2799
+ const error = value.error;
2800
+ controller.enqueue({
2801
+ type: "error",
2802
+ error: new APICallError({
2803
+ message: error.message,
2804
+ url,
2805
+ requestBodyValues: args,
2806
+ statusCode: (_a2 = error.code) != null ? _a2 : mapGoogleErrorStatusToHttpStatusCode(error.status),
2807
+ responseHeaders,
2808
+ responseBody: JSON.stringify({ error }),
2809
+ data: error
2810
+ })
2811
+ });
2812
+ return;
2813
+ }
2703
2814
  if (!hasEmittedResponseMetadata && value.responseId != null) {
2704
2815
  hasEmittedResponseMetadata = true;
2705
2816
  controller.enqueue({
@@ -2721,7 +2832,7 @@ var GoogleGenerativeAILanguageModel = class {
2721
2832
  };
2722
2833
  }
2723
2834
  }
2724
- const candidate = (_a2 = value.candidates) == null ? void 0 : _a2[0];
2835
+ const candidate = (_b = value.candidates) == null ? void 0 : _b[0];
2725
2836
  if (candidate != null) {
2726
2837
  if (candidate.groundingMetadata != null) {
2727
2838
  lastGroundingMetadata = candidate.groundingMetadata;
@@ -2756,9 +2867,9 @@ var GoogleGenerativeAILanguageModel = class {
2756
2867
  }
2757
2868
  }
2758
2869
  if (content != null) {
2759
- const parts = (_b = content.parts) != null ? _b : [];
2870
+ const parts = (_c = content.parts) != null ? _c : [];
2760
2871
  for (const part of parts) {
2761
- if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
2872
+ if ("executableCode" in part && ((_d = part.executableCode) == null ? void 0 : _d.code)) {
2762
2873
  const toolCallId = generateId3();
2763
2874
  lastCodeExecutionToolCallId = toolCallId;
2764
2875
  controller.enqueue({
@@ -2777,7 +2888,7 @@ var GoogleGenerativeAILanguageModel = class {
2777
2888
  toolName: "code_execution",
2778
2889
  result: {
2779
2890
  outcome: part.codeExecutionResult.outcome,
2780
- output: (_d = part.codeExecutionResult.output) != null ? _d : ""
2891
+ output: (_e = part.codeExecutionResult.output) != null ? _e : ""
2781
2892
  }
2782
2893
  });
2783
2894
  }
@@ -2871,7 +2982,7 @@ var GoogleGenerativeAILanguageModel = class {
2871
2982
  providerMetadata: fileMeta
2872
2983
  });
2873
2984
  } else if ("toolCall" in part && part.toolCall) {
2874
- const toolCallId = (_e = part.toolCall.id) != null ? _e : generateId3();
2985
+ const toolCallId = (_f = part.toolCall.id) != null ? _f : generateId3();
2875
2986
  lastServerToolCallId = toolCallId;
2876
2987
  const serverMeta = {
2877
2988
  [providerOptionsName]: {
@@ -2884,13 +2995,13 @@ var GoogleGenerativeAILanguageModel = class {
2884
2995
  type: "tool-call",
2885
2996
  toolCallId,
2886
2997
  toolName: `server:${part.toolCall.toolType}`,
2887
- input: JSON.stringify((_f = part.toolCall.args) != null ? _f : {}),
2998
+ input: JSON.stringify((_g = part.toolCall.args) != null ? _g : {}),
2888
2999
  providerExecuted: true,
2889
3000
  dynamic: true,
2890
3001
  providerMetadata: serverMeta
2891
3002
  });
2892
3003
  } else if ("toolResponse" in part && part.toolResponse) {
2893
- const responseToolCallId = (_g = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _g : generateId3();
3004
+ const responseToolCallId = (_h = lastServerToolCallId != null ? lastServerToolCallId : part.toolResponse.id) != null ? _h : generateId3();
2894
3005
  const serverMeta = {
2895
3006
  [providerOptionsName]: {
2896
3007
  ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
@@ -2902,7 +3013,7 @@ var GoogleGenerativeAILanguageModel = class {
2902
3013
  type: "tool-result",
2903
3014
  toolCallId: responseToolCallId,
2904
3015
  toolName: `server:${part.toolResponse.toolType}`,
2905
- result: (_h = part.toolResponse.response) != null ? _h : {},
3016
+ result: (_i = part.toolResponse.response) != null ? _i : {},
2906
3017
  providerMetadata: serverMeta
2907
3018
  });
2908
3019
  lastServerToolCallId = void 0;
@@ -2921,7 +3032,7 @@ var GoogleGenerativeAILanguageModel = class {
2921
3032
  const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
2922
3033
  if (isStreamingChunk) {
2923
3034
  if (part.functionCall.name != null) {
2924
- const toolCallId = (_i = part.functionCall.id) != null ? _i : generateId3();
3035
+ const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId3();
2925
3036
  const accumulator = new GoogleJSONAccumulator();
2926
3037
  activeStreamingToolCalls.push({
2927
3038
  toolCallId,
@@ -2969,9 +3080,9 @@ var GoogleGenerativeAILanguageModel = class {
2969
3080
  } else if (isTerminalChunk && activeStreamingToolCalls.length > 0) {
2970
3081
  finishActiveStreamingToolCall(controller);
2971
3082
  } else if (isCompleteCall) {
2972
- const toolCallId = (_j = part.functionCall.id) != null ? _j : generateId3();
3083
+ const toolCallId = (_k = part.functionCall.id) != null ? _k : generateId3();
2973
3084
  const toolName = part.functionCall.name;
2974
- const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_k = part.functionCall.args) != null ? _k : {});
3085
+ const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_l = part.functionCall.args) != null ? _l : {});
2975
3086
  controller.enqueue({
2976
3087
  type: "tool-input-start",
2977
3088
  id: toolCallId,
@@ -2998,7 +3109,7 @@ var GoogleGenerativeAILanguageModel = class {
2998
3109
  });
2999
3110
  hasToolCalls = true;
3000
3111
  } else if (isNoArgsCompleteCall) {
3001
- const toolCallId = (_l = part.functionCall.id) != null ? _l : generateId3();
3112
+ const toolCallId = (_m = part.functionCall.id) != null ? _m : generateId3();
3002
3113
  const toolName = part.functionCall.name;
3003
3114
  controller.enqueue({
3004
3115
  type: "tool-input-start",
@@ -3186,205 +3297,206 @@ function extractSources({
3186
3297
  }
3187
3298
  return sources.length > 0 ? sources : void 0;
3188
3299
  }
3189
- var getGroundingMetadataSchema = () => z7.object({
3190
- webSearchQueries: z7.array(z7.string()).nullish(),
3191
- imageSearchQueries: z7.array(z7.string()).nullish(),
3192
- retrievalQueries: z7.array(z7.string()).nullish(),
3193
- searchEntryPoint: z7.object({ renderedContent: z7.string() }).nullish(),
3194
- groundingChunks: z7.array(
3195
- z7.object({
3196
- web: z7.object({ uri: z7.string(), title: z7.string().nullish() }).nullish(),
3197
- image: z7.object({
3198
- sourceUri: z7.string(),
3199
- imageUri: z7.string(),
3200
- title: z7.string().nullish(),
3201
- domain: z7.string().nullish()
3300
+ var getGroundingMetadataSchema = () => z8.object({
3301
+ webSearchQueries: z8.array(z8.string()).nullish(),
3302
+ imageSearchQueries: z8.array(z8.string()).nullish(),
3303
+ retrievalQueries: z8.array(z8.string()).nullish(),
3304
+ searchEntryPoint: z8.object({ renderedContent: z8.string() }).nullish(),
3305
+ groundingChunks: z8.array(
3306
+ z8.object({
3307
+ web: z8.object({ uri: z8.string(), title: z8.string().nullish() }).nullish(),
3308
+ image: z8.object({
3309
+ sourceUri: z8.string(),
3310
+ imageUri: z8.string(),
3311
+ title: z8.string().nullish(),
3312
+ domain: z8.string().nullish()
3202
3313
  }).nullish(),
3203
- retrievedContext: z7.object({
3204
- uri: z7.string().nullish(),
3205
- title: z7.string().nullish(),
3206
- text: z7.string().nullish(),
3207
- fileSearchStore: z7.string().nullish(),
3208
- customMetadata: z7.array(
3209
- z7.object({
3210
- key: z7.string(),
3211
- stringValue: z7.string().nullish(),
3212
- numericValue: z7.number().nullish(),
3213
- stringListValue: z7.object({ values: z7.array(z7.string()).nullish() }).nullish()
3314
+ retrievedContext: z8.object({
3315
+ uri: z8.string().nullish(),
3316
+ title: z8.string().nullish(),
3317
+ text: z8.string().nullish(),
3318
+ fileSearchStore: z8.string().nullish(),
3319
+ customMetadata: z8.array(
3320
+ z8.object({
3321
+ key: z8.string(),
3322
+ stringValue: z8.string().nullish(),
3323
+ numericValue: z8.number().nullish(),
3324
+ stringListValue: z8.object({ values: z8.array(z8.string()).nullish() }).nullish()
3214
3325
  })
3215
3326
  ).nullish()
3216
3327
  }).nullish(),
3217
- maps: z7.object({
3218
- uri: z7.string().nullish(),
3219
- title: z7.string().nullish(),
3220
- text: z7.string().nullish(),
3221
- placeId: z7.string().nullish()
3328
+ maps: z8.object({
3329
+ uri: z8.string().nullish(),
3330
+ title: z8.string().nullish(),
3331
+ text: z8.string().nullish(),
3332
+ placeId: z8.string().nullish()
3222
3333
  }).nullish()
3223
3334
  })
3224
3335
  ).nullish(),
3225
- groundingSupports: z7.array(
3226
- z7.object({
3227
- segment: z7.object({
3228
- startIndex: z7.number().nullish(),
3229
- endIndex: z7.number().nullish(),
3230
- text: z7.string().nullish()
3336
+ groundingSupports: z8.array(
3337
+ z8.object({
3338
+ segment: z8.object({
3339
+ startIndex: z8.number().nullish(),
3340
+ endIndex: z8.number().nullish(),
3341
+ text: z8.string().nullish()
3231
3342
  }).nullish(),
3232
- segment_text: z7.string().nullish(),
3233
- groundingChunkIndices: z7.array(z7.number()).nullish(),
3234
- supportChunkIndices: z7.array(z7.number()).nullish(),
3235
- confidenceScores: z7.array(z7.number()).nullish(),
3236
- confidenceScore: z7.array(z7.number()).nullish()
3343
+ segment_text: z8.string().nullish(),
3344
+ groundingChunkIndices: z8.array(z8.number()).nullish(),
3345
+ supportChunkIndices: z8.array(z8.number()).nullish(),
3346
+ confidenceScores: z8.array(z8.number()).nullish(),
3347
+ confidenceScore: z8.array(z8.number()).nullish()
3237
3348
  })
3238
3349
  ).nullish(),
3239
- retrievalMetadata: z7.union([
3240
- z7.object({
3241
- webDynamicRetrievalScore: z7.number()
3350
+ retrievalMetadata: z8.union([
3351
+ z8.object({
3352
+ webDynamicRetrievalScore: z8.number()
3242
3353
  }),
3243
- z7.object({})
3354
+ z8.object({})
3244
3355
  ]).nullish()
3245
3356
  });
3246
- var partialArgSchema = () => z7.object({
3247
- jsonPath: z7.string(),
3248
- stringValue: z7.string().nullish(),
3249
- numberValue: z7.number().nullish(),
3250
- boolValue: z7.boolean().nullish(),
3251
- nullValue: z7.unknown().nullish(),
3252
- willContinue: z7.boolean().nullish()
3357
+ var partialArgSchema = () => z8.object({
3358
+ jsonPath: z8.string(),
3359
+ stringValue: z8.string().nullish(),
3360
+ numberValue: z8.number().nullish(),
3361
+ boolValue: z8.boolean().nullish(),
3362
+ nullValue: z8.unknown().nullish(),
3363
+ willContinue: z8.boolean().nullish()
3253
3364
  });
3254
- var getContentSchema = () => z7.object({
3255
- parts: z7.array(
3256
- z7.union([
3365
+ var getContentSchema = () => z8.object({
3366
+ parts: z8.array(
3367
+ z8.union([
3257
3368
  // note: order matters since text can be fully empty
3258
- z7.object({
3259
- functionCall: z7.object({
3260
- id: z7.string().nullish(),
3261
- name: z7.string().nullish(),
3262
- args: z7.unknown().nullish(),
3263
- partialArgs: z7.array(partialArgSchema()).nullish(),
3264
- willContinue: z7.boolean().nullish()
3369
+ z8.object({
3370
+ functionCall: z8.object({
3371
+ id: z8.string().nullish(),
3372
+ name: z8.string().nullish(),
3373
+ args: z8.unknown().nullish(),
3374
+ partialArgs: z8.array(partialArgSchema()).nullish(),
3375
+ willContinue: z8.boolean().nullish()
3265
3376
  }),
3266
- thoughtSignature: z7.string().nullish()
3377
+ thoughtSignature: z8.string().nullish()
3267
3378
  }),
3268
- z7.object({
3269
- inlineData: z7.object({
3270
- mimeType: z7.string(),
3271
- data: z7.string()
3379
+ z8.object({
3380
+ inlineData: z8.object({
3381
+ mimeType: z8.string(),
3382
+ data: z8.string()
3272
3383
  }),
3273
- thought: z7.boolean().nullish(),
3274
- thoughtSignature: z7.string().nullish()
3384
+ thought: z8.boolean().nullish(),
3385
+ thoughtSignature: z8.string().nullish()
3275
3386
  }),
3276
- z7.object({
3277
- toolCall: z7.object({
3278
- toolType: z7.string(),
3279
- args: z7.unknown().nullish(),
3280
- id: z7.string()
3387
+ z8.object({
3388
+ toolCall: z8.object({
3389
+ toolType: z8.string(),
3390
+ args: z8.unknown().nullish(),
3391
+ id: z8.string()
3281
3392
  }),
3282
- thoughtSignature: z7.string().nullish()
3393
+ thoughtSignature: z8.string().nullish()
3283
3394
  }),
3284
- z7.object({
3285
- toolResponse: z7.object({
3286
- toolType: z7.string(),
3287
- response: z7.unknown().nullish(),
3288
- id: z7.string()
3395
+ z8.object({
3396
+ toolResponse: z8.object({
3397
+ toolType: z8.string(),
3398
+ response: z8.unknown().nullish(),
3399
+ id: z8.string()
3289
3400
  }),
3290
- thoughtSignature: z7.string().nullish()
3401
+ thoughtSignature: z8.string().nullish()
3291
3402
  }),
3292
- z7.object({
3293
- executableCode: z7.object({
3294
- language: z7.string(),
3295
- code: z7.string()
3403
+ z8.object({
3404
+ executableCode: z8.object({
3405
+ language: z8.string(),
3406
+ code: z8.string()
3296
3407
  }).nullish(),
3297
- codeExecutionResult: z7.object({
3298
- outcome: z7.string(),
3299
- output: z7.string().nullish()
3408
+ codeExecutionResult: z8.object({
3409
+ outcome: z8.string(),
3410
+ output: z8.string().nullish()
3300
3411
  }).nullish(),
3301
- text: z7.string().nullish(),
3302
- thought: z7.boolean().nullish(),
3303
- thoughtSignature: z7.string().nullish()
3412
+ text: z8.string().nullish(),
3413
+ thought: z8.boolean().nullish(),
3414
+ thoughtSignature: z8.string().nullish()
3304
3415
  })
3305
3416
  ])
3306
3417
  ).nullish()
3307
3418
  });
3308
- var getSafetyRatingSchema = () => z7.object({
3309
- category: z7.string().nullish(),
3310
- probability: z7.string().nullish(),
3311
- probabilityScore: z7.number().nullish(),
3312
- severity: z7.string().nullish(),
3313
- severityScore: z7.number().nullish(),
3314
- blocked: z7.boolean().nullish()
3419
+ var getSafetyRatingSchema = () => z8.object({
3420
+ category: z8.string().nullish(),
3421
+ probability: z8.string().nullish(),
3422
+ probabilityScore: z8.number().nullish(),
3423
+ severity: z8.string().nullish(),
3424
+ severityScore: z8.number().nullish(),
3425
+ blocked: z8.boolean().nullish()
3315
3426
  });
3316
- var tokenDetailsSchema = () => z7.array(
3317
- z7.object({
3318
- modality: z7.string(),
3319
- tokenCount: z7.number()
3320
- }).catchall(z7.json())
3427
+ var tokenDetailsSchema = () => z8.array(
3428
+ z8.object({
3429
+ modality: z8.string(),
3430
+ tokenCount: z8.number()
3431
+ }).catchall(z8.json())
3321
3432
  ).nullish();
3322
- var usageSchema = () => z7.object({
3323
- cachedContentTokenCount: z7.number().nullish(),
3324
- thoughtsTokenCount: z7.number().nullish(),
3325
- promptTokenCount: z7.number().nullish(),
3326
- candidatesTokenCount: z7.number().nullish(),
3327
- toolUsePromptTokenCount: z7.number().nullish(),
3328
- totalTokenCount: z7.number().nullish(),
3433
+ var usageSchema = () => z8.object({
3434
+ cachedContentTokenCount: z8.number().nullish(),
3435
+ thoughtsTokenCount: z8.number().nullish(),
3436
+ promptTokenCount: z8.number().nullish(),
3437
+ candidatesTokenCount: z8.number().nullish(),
3438
+ toolUsePromptTokenCount: z8.number().nullish(),
3439
+ totalTokenCount: z8.number().nullish(),
3329
3440
  // https://cloud.google.com/vertex-ai/generative-ai/docs/reference/rest/v1/GenerateContentResponse#TrafficType
3330
- trafficType: z7.string().nullish(),
3331
- serviceTier: z7.string().nullish(),
3441
+ trafficType: z8.string().nullish(),
3442
+ serviceTier: z8.string().nullish(),
3332
3443
  // https://ai.google.dev/api/generate-content#Modality
3333
3444
  promptTokensDetails: tokenDetailsSchema(),
3334
3445
  cacheTokensDetails: tokenDetailsSchema(),
3335
3446
  candidatesTokensDetails: tokenDetailsSchema(),
3336
3447
  toolUsePromptTokensDetails: tokenDetailsSchema()
3337
- }).catchall(z7.json());
3338
- var getUrlContextMetadataSchema = () => z7.object({
3339
- urlMetadata: z7.array(
3340
- z7.object({
3341
- retrievedUrl: z7.string(),
3342
- urlRetrievalStatus: z7.string()
3448
+ }).catchall(z8.json());
3449
+ var getUrlContextMetadataSchema = () => z8.object({
3450
+ urlMetadata: z8.array(
3451
+ z8.object({
3452
+ retrievedUrl: z8.string(),
3453
+ urlRetrievalStatus: z8.string()
3343
3454
  })
3344
3455
  ).nullish()
3345
3456
  });
3346
3457
  var responseSchema = lazySchema7(
3347
3458
  () => zodSchema7(
3348
- z7.object({
3349
- responseId: z7.string().nullish(),
3350
- candidates: z7.array(
3351
- z7.object({
3352
- content: getContentSchema().nullish().or(z7.object({}).strict()),
3353
- finishReason: z7.string().nullish(),
3354
- finishMessage: z7.string().nullish(),
3355
- continuationToken: z7.string().nullish(),
3356
- safetyRatings: z7.array(getSafetyRatingSchema()).nullish(),
3459
+ z8.object({
3460
+ responseId: z8.string().nullish(),
3461
+ candidates: z8.array(
3462
+ z8.object({
3463
+ content: getContentSchema().nullish().or(z8.object({}).strict()),
3464
+ finishReason: z8.string().nullish(),
3465
+ finishMessage: z8.string().nullish(),
3466
+ continuationToken: z8.string().nullish(),
3467
+ safetyRatings: z8.array(getSafetyRatingSchema()).nullish(),
3357
3468
  groundingMetadata: getGroundingMetadataSchema().nullish(),
3358
3469
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
3359
3470
  })
3360
3471
  ).nullish(),
3361
3472
  usageMetadata: usageSchema().nullish(),
3362
- promptFeedback: z7.object({
3363
- blockReason: z7.string().nullish(),
3364
- safetyRatings: z7.array(getSafetyRatingSchema()).nullish()
3473
+ promptFeedback: z8.object({
3474
+ blockReason: z8.string().nullish(),
3475
+ safetyRatings: z8.array(getSafetyRatingSchema()).nullish()
3365
3476
  }).nullish()
3366
3477
  })
3367
3478
  )
3368
3479
  );
3369
3480
  var chunkSchema = lazySchema7(
3370
3481
  () => zodSchema7(
3371
- z7.object({
3372
- responseId: z7.string().nullish(),
3373
- candidates: z7.array(
3374
- z7.object({
3482
+ z8.object({
3483
+ error: getGoogleErrorSchema().nullish(),
3484
+ responseId: z8.string().nullish(),
3485
+ candidates: z8.array(
3486
+ z8.object({
3375
3487
  content: getContentSchema().nullish(),
3376
- finishReason: z7.string().nullish(),
3377
- finishMessage: z7.string().nullish(),
3378
- continuationToken: z7.string().nullish(),
3379
- safetyRatings: z7.array(getSafetyRatingSchema()).nullish(),
3488
+ finishReason: z8.string().nullish(),
3489
+ finishMessage: z8.string().nullish(),
3490
+ continuationToken: z8.string().nullish(),
3491
+ safetyRatings: z8.array(getSafetyRatingSchema()).nullish(),
3380
3492
  groundingMetadata: getGroundingMetadataSchema().nullish(),
3381
3493
  urlContextMetadata: getUrlContextMetadataSchema().nullish()
3382
3494
  })
3383
3495
  ).nullish(),
3384
3496
  usageMetadata: usageSchema().nullish(),
3385
- promptFeedback: z7.object({
3386
- blockReason: z7.string().nullish(),
3387
- safetyRatings: z7.array(getSafetyRatingSchema()).nullish()
3497
+ promptFeedback: z8.object({
3498
+ blockReason: z8.string().nullish(),
3499
+ safetyRatings: z8.array(getSafetyRatingSchema()).nullish()
3388
3500
  }).nullish()
3389
3501
  })
3390
3502
  )
@@ -3395,16 +3507,16 @@ function isConfirmedPromptBlockReason(blockReason) {
3395
3507
 
3396
3508
  // src/tool/code-execution.ts
3397
3509
  import { createProviderToolFactoryWithOutputSchema } from "@ai-sdk/provider-utils";
3398
- import { z as z8 } from "zod/v4";
3510
+ import { z as z9 } from "zod/v4";
3399
3511
  var codeExecution = createProviderToolFactoryWithOutputSchema({
3400
3512
  id: "google.code_execution",
3401
- inputSchema: z8.object({
3402
- language: z8.string().describe("The programming language of the code."),
3403
- code: z8.string().describe("The code to be executed.")
3513
+ inputSchema: z9.object({
3514
+ language: z9.string().describe("The programming language of the code."),
3515
+ code: z9.string().describe("The code to be executed.")
3404
3516
  }),
3405
- outputSchema: z8.object({
3406
- outcome: z8.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
3407
- output: z8.string().describe("The output from the code execution.")
3517
+ outputSchema: z9.object({
3518
+ outcome: z9.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
3519
+ output: z9.string().describe("The output from the code execution.")
3408
3520
  })
3409
3521
  });
3410
3522
 
@@ -3414,10 +3526,10 @@ import {
3414
3526
  lazySchema as lazySchema8,
3415
3527
  zodSchema as zodSchema8
3416
3528
  } from "@ai-sdk/provider-utils";
3417
- import { z as z9 } from "zod/v4";
3529
+ import { z as z10 } from "zod/v4";
3418
3530
  var enterpriseWebSearch = createProviderToolFactory({
3419
3531
  id: "google.enterprise_web_search",
3420
- inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
3532
+ inputSchema: lazySchema8(() => zodSchema8(z10.object({})))
3421
3533
  });
3422
3534
 
3423
3535
  // src/tool/file-search.ts
@@ -3426,20 +3538,20 @@ import {
3426
3538
  lazySchema as lazySchema9,
3427
3539
  zodSchema as zodSchema9
3428
3540
  } from "@ai-sdk/provider-utils";
3429
- import { z as z10 } from "zod/v4";
3430
- var fileSearchArgsBaseSchema = () => z10.object({
3541
+ import { z as z11 } from "zod/v4";
3542
+ var fileSearchArgsBaseSchema = () => z11.object({
3431
3543
  /** The names of the file_search_stores to retrieve from.
3432
3544
  * Example: `fileSearchStores/my-file-search-store-123`
3433
3545
  */
3434
- fileSearchStoreNames: z10.array(z10.string()).describe(
3546
+ fileSearchStoreNames: z11.array(z11.string()).describe(
3435
3547
  "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
3436
3548
  ),
3437
3549
  /** The number of file search retrieval chunks to retrieve. */
3438
- topK: z10.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
3550
+ topK: z11.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
3439
3551
  /** Metadata filter to apply to the file search retrieval documents.
3440
3552
  * See https://google.aip.dev/160 for the syntax of the filter expression.
3441
3553
  */
3442
- metadataFilter: z10.string().describe(
3554
+ metadataFilter: z11.string().describe(
3443
3555
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
3444
3556
  ).optional()
3445
3557
  }).passthrough();
@@ -3457,10 +3569,10 @@ import {
3457
3569
  lazySchema as lazySchema10,
3458
3570
  zodSchema as zodSchema10
3459
3571
  } from "@ai-sdk/provider-utils";
3460
- import { z as z11 } from "zod/v4";
3572
+ import { z as z12 } from "zod/v4";
3461
3573
  var googleMaps = createProviderToolFactory3({
3462
3574
  id: "google.google_maps",
3463
- inputSchema: lazySchema10(() => zodSchema10(z11.object({})))
3575
+ inputSchema: lazySchema10(() => zodSchema10(z12.object({})))
3464
3576
  });
3465
3577
 
3466
3578
  // src/tool/google-search.ts
@@ -3469,15 +3581,15 @@ import {
3469
3581
  lazySchema as lazySchema11,
3470
3582
  zodSchema as zodSchema11
3471
3583
  } from "@ai-sdk/provider-utils";
3472
- import { z as z12 } from "zod/v4";
3473
- var googleSearchToolArgsBaseSchema = () => z12.object({
3474
- searchTypes: z12.object({
3475
- webSearch: z12.object({}).optional(),
3476
- imageSearch: z12.object({}).optional()
3584
+ import { z as z13 } from "zod/v4";
3585
+ var googleSearchToolArgsBaseSchema = () => z13.object({
3586
+ searchTypes: z13.object({
3587
+ webSearch: z13.object({}).optional(),
3588
+ imageSearch: z13.object({}).optional()
3477
3589
  }).optional(),
3478
- timeRangeFilter: z12.object({
3479
- startTime: z12.string(),
3480
- endTime: z12.string()
3590
+ timeRangeFilter: z13.object({
3591
+ startTime: z13.string(),
3592
+ endTime: z13.string()
3481
3593
  }).optional()
3482
3594
  }).passthrough();
3483
3595
  var googleSearchToolArgsSchema = lazySchema11(
@@ -3496,20 +3608,20 @@ import {
3496
3608
  lazySchema as lazySchema12,
3497
3609
  zodSchema as zodSchema12
3498
3610
  } from "@ai-sdk/provider-utils";
3499
- import { z as z13 } from "zod/v4";
3611
+ import { z as z14 } from "zod/v4";
3500
3612
  var urlContext = createProviderToolFactory5({
3501
3613
  id: "google.url_context",
3502
- inputSchema: lazySchema12(() => zodSchema12(z13.object({})))
3614
+ inputSchema: lazySchema12(() => zodSchema12(z14.object({})))
3503
3615
  });
3504
3616
 
3505
3617
  // src/tool/vertex-rag-store.ts
3506
3618
  import { createProviderToolFactory as createProviderToolFactory6 } from "@ai-sdk/provider-utils";
3507
- import { z as z14 } from "zod/v4";
3619
+ import { z as z15 } from "zod/v4";
3508
3620
  var vertexRagStore = createProviderToolFactory6({
3509
3621
  id: "google.vertex_rag_store",
3510
- inputSchema: z14.object({
3511
- ragCorpus: z14.string(),
3512
- topK: z14.number().optional()
3622
+ inputSchema: z15.object({
3623
+ ragCorpus: z15.string(),
3624
+ topK: z15.number().optional()
3513
3625
  })
3514
3626
  });
3515
3627
 
@@ -3585,7 +3697,7 @@ import {
3585
3697
  resolve as resolve4,
3586
3698
  zodSchema as zodSchema13
3587
3699
  } from "@ai-sdk/provider-utils";
3588
- import { z as z15 } from "zod/v4";
3700
+ import { z as z16 } from "zod/v4";
3589
3701
  var GoogleGenerativeAIImageModel = class {
3590
3702
  constructor(modelId, settings, config) {
3591
3703
  this.modelId = modelId;
@@ -3841,11 +3953,11 @@ function isGeminiModel(modelId) {
3841
3953
  }
3842
3954
  var googleImageResponseSchema = lazySchema13(
3843
3955
  () => zodSchema13(
3844
- z15.object({
3845
- predictions: z15.array(
3846
- z15.union([
3847
- z15.object({ bytesBase64Encoded: z15.string() }),
3848
- z15.object({ raiFilteredReason: z15.string() })
3956
+ z16.object({
3957
+ predictions: z16.array(
3958
+ z16.union([
3959
+ z16.object({ bytesBase64Encoded: z16.string() }),
3960
+ z16.object({ raiFilteredReason: z16.string() })
3849
3961
  ])
3850
3962
  ).default([])
3851
3963
  })
@@ -3853,9 +3965,9 @@ var googleImageResponseSchema = lazySchema13(
3853
3965
  );
3854
3966
  var googleImageModelOptionsSchema = lazySchema13(
3855
3967
  () => zodSchema13(
3856
- z15.object({
3857
- personGeneration: z15.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3858
- aspectRatio: z15.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
3968
+ z16.object({
3969
+ personGeneration: z16.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3970
+ aspectRatio: z16.enum(["1:1", "3:4", "4:3", "9:16", "16:9"]).nullish(),
3859
3971
  /**
3860
3972
  * Enable Google Search grounding for Gemini image models. The value is
3861
3973
  * forwarded as the args of the `google.tools.googleSearch` provider
@@ -3887,7 +3999,7 @@ import {
3887
3999
  resolve as resolve5,
3888
4000
  zodSchema as zodSchema14
3889
4001
  } from "@ai-sdk/provider-utils";
3890
- import { z as z16 } from "zod/v4";
4002
+ import { z as z17 } from "zod/v4";
3891
4003
  function getFirstFrameImage(options) {
3892
4004
  var _a2, _b;
3893
4005
  return (_b = (_a2 = options.frameImages) == null ? void 0 : _a2.find((frame) => frame.frameType === "first_frame")) == null ? void 0 : _b.image;
@@ -4154,20 +4266,20 @@ var GoogleGenerativeAIVideoModel = class {
4154
4266
  };
4155
4267
  var googleOperationSchema = lazySchema14(
4156
4268
  () => zodSchema14(
4157
- z16.object({
4158
- name: z16.string().nullish(),
4159
- done: z16.boolean().nullish(),
4160
- error: z16.object({
4161
- code: z16.number().nullish(),
4162
- message: z16.string(),
4163
- status: z16.string().nullish()
4269
+ z17.object({
4270
+ name: z17.string().nullish(),
4271
+ done: z17.boolean().nullish(),
4272
+ error: z17.object({
4273
+ code: z17.number().nullish(),
4274
+ message: z17.string(),
4275
+ status: z17.string().nullish()
4164
4276
  }).nullish(),
4165
- response: z16.object({
4166
- generateVideoResponse: z16.object({
4167
- generatedSamples: z16.array(
4168
- z16.object({
4169
- video: z16.object({
4170
- uri: z16.string().nullish()
4277
+ response: z17.object({
4278
+ generateVideoResponse: z17.object({
4279
+ generatedSamples: z17.array(
4280
+ z17.object({
4281
+ video: z17.object({
4282
+ uri: z17.string().nullish()
4171
4283
  }).nullish()
4172
4284
  })
4173
4285
  ).nullish()
@@ -4178,15 +4290,15 @@ var googleOperationSchema = lazySchema14(
4178
4290
  );
4179
4291
  var googleVideoModelOptionsSchema = lazySchema14(
4180
4292
  () => zodSchema14(
4181
- z16.object({
4182
- pollIntervalMs: z16.number().positive().nullish(),
4183
- pollTimeoutMs: z16.number().positive().nullish(),
4184
- personGeneration: z16.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
4185
- negativePrompt: z16.string().nullish(),
4186
- referenceImages: z16.array(
4187
- z16.object({
4188
- bytesBase64Encoded: z16.string().nullish(),
4189
- gcsUri: z16.string().nullish()
4293
+ z17.object({
4294
+ pollIntervalMs: z17.number().positive().nullish(),
4295
+ pollTimeoutMs: z17.number().positive().nullish(),
4296
+ personGeneration: z17.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
4297
+ negativePrompt: z17.string().nullish(),
4298
+ referenceImages: z17.array(
4299
+ z17.object({
4300
+ bytesBase64Encoded: z17.string().nullish(),
4301
+ gcsUri: z17.string().nullish()
4190
4302
  })
4191
4303
  ).nullish()
4192
4304
  }).passthrough()
@@ -5362,30 +5474,30 @@ import {
5362
5474
  lazySchema as lazySchema15,
5363
5475
  zodSchema as zodSchema15
5364
5476
  } from "@ai-sdk/provider-utils";
5365
- import { z as z17 } from "zod/v4";
5366
- var tokenByModalitySchema = () => z17.object({
5367
- modality: z17.string().nullish(),
5368
- tokens: z17.number().nullish()
5477
+ import { z as z18 } from "zod/v4";
5478
+ var tokenByModalitySchema = () => z18.object({
5479
+ modality: z18.string().nullish(),
5480
+ tokens: z18.number().nullish()
5369
5481
  }).loose();
5370
- var usageSchema2 = () => z17.object({
5371
- total_input_tokens: z17.number().nullish(),
5372
- total_output_tokens: z17.number().nullish(),
5373
- total_thought_tokens: z17.number().nullish(),
5374
- total_cached_tokens: z17.number().nullish(),
5375
- total_tool_use_tokens: z17.number().nullish(),
5376
- total_tokens: z17.number().nullish(),
5377
- input_tokens_by_modality: z17.array(tokenByModalitySchema()).nullish(),
5378
- output_tokens_by_modality: z17.array(tokenByModalitySchema()).nullish(),
5379
- cached_tokens_by_modality: z17.array(tokenByModalitySchema()).nullish(),
5380
- tool_use_tokens_by_modality: z17.array(tokenByModalitySchema()).nullish(),
5381
- grounding_tool_count: z17.array(
5382
- z17.object({
5383
- type: z17.string().nullish(),
5384
- count: z17.number().nullish()
5482
+ var usageSchema2 = () => z18.object({
5483
+ total_input_tokens: z18.number().nullish(),
5484
+ total_output_tokens: z18.number().nullish(),
5485
+ total_thought_tokens: z18.number().nullish(),
5486
+ total_cached_tokens: z18.number().nullish(),
5487
+ total_tool_use_tokens: z18.number().nullish(),
5488
+ total_tokens: z18.number().nullish(),
5489
+ input_tokens_by_modality: z18.array(tokenByModalitySchema()).nullish(),
5490
+ output_tokens_by_modality: z18.array(tokenByModalitySchema()).nullish(),
5491
+ cached_tokens_by_modality: z18.array(tokenByModalitySchema()).nullish(),
5492
+ tool_use_tokens_by_modality: z18.array(tokenByModalitySchema()).nullish(),
5493
+ grounding_tool_count: z18.array(
5494
+ z18.object({
5495
+ type: z18.string().nullish(),
5496
+ count: z18.number().nullish()
5385
5497
  }).loose()
5386
5498
  ).nullish()
5387
5499
  }).loose();
5388
- var interactionStatusSchema = () => z17.enum([
5500
+ var interactionStatusSchema = () => z18.enum([
5389
5501
  "in_progress",
5390
5502
  "requires_action",
5391
5503
  "completed",
@@ -5394,69 +5506,69 @@ var interactionStatusSchema = () => z17.enum([
5394
5506
  "incomplete"
5395
5507
  ]);
5396
5508
  var annotationSchema = () => {
5397
- const urlCitation = z17.object({
5398
- type: z17.literal("url_citation"),
5399
- url: z17.string().nullish(),
5400
- title: z17.string().nullish(),
5401
- start_index: z17.number().nullish(),
5402
- end_index: z17.number().nullish()
5509
+ const urlCitation = z18.object({
5510
+ type: z18.literal("url_citation"),
5511
+ url: z18.string().nullish(),
5512
+ title: z18.string().nullish(),
5513
+ start_index: z18.number().nullish(),
5514
+ end_index: z18.number().nullish()
5403
5515
  }).loose();
5404
- const fileCitation = z17.object({
5405
- type: z17.literal("file_citation"),
5406
- file_name: z17.string().nullish(),
5407
- document_uri: z17.string().nullish(),
5408
- url: z17.string().nullish(),
5409
- page_number: z17.number().nullish(),
5410
- media_id: z17.string().nullish(),
5411
- start_index: z17.number().nullish(),
5412
- end_index: z17.number().nullish(),
5413
- custom_metadata: z17.record(z17.string(), z17.unknown()).nullish()
5516
+ const fileCitation = z18.object({
5517
+ type: z18.literal("file_citation"),
5518
+ file_name: z18.string().nullish(),
5519
+ document_uri: z18.string().nullish(),
5520
+ url: z18.string().nullish(),
5521
+ page_number: z18.number().nullish(),
5522
+ media_id: z18.string().nullish(),
5523
+ start_index: z18.number().nullish(),
5524
+ end_index: z18.number().nullish(),
5525
+ custom_metadata: z18.record(z18.string(), z18.unknown()).nullish()
5414
5526
  }).loose();
5415
- const placeCitation = z17.object({
5416
- type: z17.literal("place_citation"),
5417
- name: z17.string().nullish(),
5418
- url: z17.string().nullish(),
5419
- place_id: z17.string().nullish(),
5420
- start_index: z17.number().nullish(),
5421
- end_index: z17.number().nullish()
5527
+ const placeCitation = z18.object({
5528
+ type: z18.literal("place_citation"),
5529
+ name: z18.string().nullish(),
5530
+ url: z18.string().nullish(),
5531
+ place_id: z18.string().nullish(),
5532
+ start_index: z18.number().nullish(),
5533
+ end_index: z18.number().nullish()
5422
5534
  }).loose();
5423
- return z17.union([
5535
+ return z18.union([
5424
5536
  urlCitation,
5425
5537
  fileCitation,
5426
5538
  placeCitation,
5427
- z17.object({ type: z17.string() }).loose()
5539
+ z18.object({ type: z18.string() }).loose()
5428
5540
  ]);
5429
5541
  };
5430
- var thoughtSummaryItemSchema = () => z17.object({
5431
- type: z17.string(),
5432
- text: z17.string().nullish(),
5433
- data: z17.string().nullish(),
5434
- mime_type: z17.string().nullish()
5542
+ var thoughtSummaryItemSchema = () => z18.object({
5543
+ type: z18.string(),
5544
+ text: z18.string().nullish(),
5545
+ data: z18.string().nullish(),
5546
+ mime_type: z18.string().nullish()
5435
5547
  }).loose();
5436
5548
  var contentBlockSchema = () => {
5437
- const textContent = z17.object({
5438
- type: z17.literal("text"),
5439
- text: z17.string(),
5440
- annotations: z17.array(annotationSchema()).nullish()
5549
+ const textContent = z18.object({
5550
+ type: z18.literal("text"),
5551
+ text: z18.string(),
5552
+ annotations: z18.array(annotationSchema()).nullish()
5441
5553
  }).loose();
5442
- const imageContent = z17.object({
5443
- type: z17.literal("image"),
5444
- data: z17.string().nullish(),
5445
- mime_type: z17.string().nullish(),
5446
- resolution: z17.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5447
- uri: z17.string().nullish()
5554
+ const imageContent = z18.object({
5555
+ type: z18.literal("image"),
5556
+ data: z18.string().nullish(),
5557
+ mime_type: z18.string().nullish(),
5558
+ resolution: z18.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5559
+ uri: z18.string().nullish()
5448
5560
  }).loose();
5449
- const videoContent = z17.object({
5450
- type: z17.literal("video"),
5451
- data: z17.string().nullish(),
5452
- mime_type: z17.string().nullish(),
5453
- uri: z17.string().nullish()
5561
+ const videoContent = z18.object({
5562
+ type: z18.literal("video"),
5563
+ data: z18.string().nullish(),
5564
+ mime_type: z18.string().nullish(),
5565
+ uri: z18.string().nullish()
5454
5566
  }).loose();
5455
- return z17.union([
5567
+ return z18.union([
5456
5568
  textContent,
5457
5569
  imageContent,
5458
5570
  videoContent,
5459
- z17.object({ type: z17.string() }).loose()
5571
+ z18.object({ type: z18.string() }).loose()
5460
5572
  ]);
5461
5573
  };
5462
5574
  var BUILTIN_TOOL_CALL_STEP_TYPES = [
@@ -5476,73 +5588,73 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
5476
5588
  "mcp_server_tool_result"
5477
5589
  ];
5478
5590
  var stepSchema = () => {
5479
- const userInputStep = z17.object({
5480
- type: z17.literal("user_input"),
5481
- content: z17.array(contentBlockSchema()).nullish()
5591
+ const userInputStep = z18.object({
5592
+ type: z18.literal("user_input"),
5593
+ content: z18.array(contentBlockSchema()).nullish()
5482
5594
  }).loose();
5483
- const modelOutputStep = z17.object({
5484
- type: z17.literal("model_output"),
5485
- content: z17.array(contentBlockSchema()).nullish()
5595
+ const modelOutputStep = z18.object({
5596
+ type: z18.literal("model_output"),
5597
+ content: z18.array(contentBlockSchema()).nullish()
5486
5598
  }).loose();
5487
- const functionCallStep = z17.object({
5488
- type: z17.literal("function_call"),
5489
- id: z17.string(),
5490
- name: z17.string(),
5491
- arguments: z17.record(z17.string(), z17.unknown()).nullish(),
5492
- signature: z17.string().nullish()
5599
+ const functionCallStep = z18.object({
5600
+ type: z18.literal("function_call"),
5601
+ id: z18.string(),
5602
+ name: z18.string(),
5603
+ arguments: z18.record(z18.string(), z18.unknown()).nullish(),
5604
+ signature: z18.string().nullish()
5493
5605
  }).loose();
5494
- const thoughtStep = z17.object({
5495
- type: z17.literal("thought"),
5496
- signature: z17.string().nullish(),
5497
- summary: z17.array(thoughtSummaryItemSchema()).nullish()
5606
+ const thoughtStep = z18.object({
5607
+ type: z18.literal("thought"),
5608
+ signature: z18.string().nullish(),
5609
+ summary: z18.array(thoughtSummaryItemSchema()).nullish()
5498
5610
  }).loose();
5499
- const builtinToolCallStep = z17.object({
5500
- type: z17.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5501
- id: z17.string(),
5502
- arguments: z17.record(z17.string(), z17.unknown()).nullish(),
5503
- name: z17.string().nullish(),
5504
- server_name: z17.string().nullish(),
5505
- search_type: z17.string().nullish(),
5506
- signature: z17.string().nullish()
5611
+ const builtinToolCallStep = z18.object({
5612
+ type: z18.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5613
+ id: z18.string(),
5614
+ arguments: z18.record(z18.string(), z18.unknown()).nullish(),
5615
+ name: z18.string().nullish(),
5616
+ server_name: z18.string().nullish(),
5617
+ search_type: z18.string().nullish(),
5618
+ signature: z18.string().nullish()
5507
5619
  }).loose();
5508
- const builtinToolResultStep = z17.object({
5509
- type: z17.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5510
- call_id: z17.string(),
5511
- result: z17.unknown().nullish(),
5512
- is_error: z17.boolean().nullish(),
5513
- name: z17.string().nullish(),
5514
- server_name: z17.string().nullish(),
5515
- signature: z17.string().nullish()
5620
+ const builtinToolResultStep = z18.object({
5621
+ type: z18.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5622
+ call_id: z18.string(),
5623
+ result: z18.unknown().nullish(),
5624
+ is_error: z18.boolean().nullish(),
5625
+ name: z18.string().nullish(),
5626
+ server_name: z18.string().nullish(),
5627
+ signature: z18.string().nullish()
5516
5628
  }).loose();
5517
- return z17.union([
5629
+ return z18.union([
5518
5630
  userInputStep,
5519
5631
  modelOutputStep,
5520
5632
  functionCallStep,
5521
5633
  thoughtStep,
5522
5634
  builtinToolCallStep,
5523
5635
  builtinToolResultStep,
5524
- z17.object({ type: z17.string() }).loose()
5636
+ z18.object({ type: z18.string() }).loose()
5525
5637
  ]);
5526
5638
  };
5527
5639
  var googleInteractionsResponseSchema = lazySchema15(
5528
5640
  () => zodSchema15(
5529
- z17.object({
5641
+ z18.object({
5530
5642
  /*
5531
5643
  * `id` is omitted from the response body when `store: false` (fully
5532
5644
  * stateless mode) — there is no server-side interaction record for the
5533
5645
  * client to reference. `nullish` lets the schema accept that shape.
5534
5646
  */
5535
- id: z17.string().nullish(),
5536
- created: z17.string().nullish(),
5537
- updated: z17.string().nullish(),
5647
+ id: z18.string().nullish(),
5648
+ created: z18.string().nullish(),
5649
+ updated: z18.string().nullish(),
5538
5650
  status: interactionStatusSchema(),
5539
- model: z17.string().nullish(),
5540
- agent: z17.string().nullish(),
5541
- steps: z17.array(stepSchema()).nullish(),
5651
+ model: z18.string().nullish(),
5652
+ agent: z18.string().nullish(),
5653
+ steps: z18.array(stepSchema()).nullish(),
5542
5654
  usage: usageSchema2().nullish(),
5543
- service_tier: z17.string().nullish(),
5544
- previous_interaction_id: z17.string().nullish(),
5545
- response_modalities: z17.array(z17.string()).nullish()
5655
+ service_tier: z18.string().nullish(),
5656
+ previous_interaction_id: z18.string().nullish(),
5657
+ response_modalities: z18.array(z18.string()).nullish()
5546
5658
  }).loose()
5547
5659
  )
5548
5660
  );
@@ -5552,82 +5664,82 @@ var googleInteractionsEventSchema = lazySchema15(
5552
5664
  const status = interactionStatusSchema();
5553
5665
  const annotation = annotationSchema();
5554
5666
  const thoughtSummaryItem = thoughtSummaryItemSchema();
5555
- const interactionCreatedEvent = z17.object({
5556
- event_type: z17.literal("interaction.created"),
5557
- event_id: z17.string().nullish(),
5558
- interaction: z17.object({
5667
+ const interactionCreatedEvent = z18.object({
5668
+ event_type: z18.literal("interaction.created"),
5669
+ event_id: z18.string().nullish(),
5670
+ interaction: z18.object({
5559
5671
  /*
5560
5672
  * `id` is omitted when `store: false` (fully stateless mode);
5561
5673
  * see the matching note on `googleInteractionsResponseSchema.id`.
5562
5674
  */
5563
- id: z17.string().nullish(),
5564
- created: z17.string().nullish(),
5565
- model: z17.string().nullish(),
5566
- agent: z17.string().nullish(),
5675
+ id: z18.string().nullish(),
5676
+ created: z18.string().nullish(),
5677
+ model: z18.string().nullish(),
5678
+ agent: z18.string().nullish(),
5567
5679
  status: status.nullish()
5568
5680
  }).loose()
5569
5681
  }).loose();
5570
- const stepStartEvent = z17.object({
5571
- event_type: z17.literal("step.start"),
5572
- event_id: z17.string().nullish(),
5573
- index: z17.number(),
5682
+ const stepStartEvent = z18.object({
5683
+ event_type: z18.literal("step.start"),
5684
+ event_id: z18.string().nullish(),
5685
+ index: z18.number(),
5574
5686
  step: stepSchema()
5575
5687
  }).loose();
5576
- const stepDeltaText = z17.object({
5577
- type: z17.literal("text"),
5578
- text: z17.string()
5688
+ const stepDeltaText = z18.object({
5689
+ type: z18.literal("text"),
5690
+ text: z18.string()
5579
5691
  }).loose();
5580
- const stepDeltaThoughtSummary = z17.object({
5581
- type: z17.literal("thought_summary"),
5692
+ const stepDeltaThoughtSummary = z18.object({
5693
+ type: z18.literal("thought_summary"),
5582
5694
  content: thoughtSummaryItem.nullish()
5583
5695
  }).loose();
5584
- const stepDeltaThoughtSignature = z17.object({
5585
- type: z17.literal("thought_signature"),
5586
- signature: z17.string().nullish()
5696
+ const stepDeltaThoughtSignature = z18.object({
5697
+ type: z18.literal("thought_signature"),
5698
+ signature: z18.string().nullish()
5587
5699
  }).loose();
5588
- const stepDeltaArgumentsDelta = z17.object({
5589
- type: z17.literal("arguments_delta"),
5590
- arguments: z17.string().nullish(),
5591
- id: z17.string().nullish(),
5592
- signature: z17.string().nullish()
5700
+ const stepDeltaArgumentsDelta = z18.object({
5701
+ type: z18.literal("arguments_delta"),
5702
+ arguments: z18.string().nullish(),
5703
+ id: z18.string().nullish(),
5704
+ signature: z18.string().nullish()
5593
5705
  }).loose();
5594
- const stepDeltaTextAnnotation = z17.object({
5595
- type: z17.enum(["text_annotation_delta", "text_annotation"]),
5596
- annotations: z17.array(annotation).nullish()
5706
+ const stepDeltaTextAnnotation = z18.object({
5707
+ type: z18.enum(["text_annotation_delta", "text_annotation"]),
5708
+ annotations: z18.array(annotation).nullish()
5597
5709
  }).loose();
5598
- const stepDeltaImage = z17.object({
5599
- type: z17.literal("image"),
5600
- data: z17.string().nullish(),
5601
- mime_type: z17.string().nullish(),
5602
- resolution: z17.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5603
- uri: z17.string().nullish()
5710
+ const stepDeltaImage = z18.object({
5711
+ type: z18.literal("image"),
5712
+ data: z18.string().nullish(),
5713
+ mime_type: z18.string().nullish(),
5714
+ resolution: z18.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5715
+ uri: z18.string().nullish()
5604
5716
  }).loose();
5605
- const stepDeltaVideo = z17.object({
5606
- type: z17.literal("video"),
5607
- data: z17.string().nullish(),
5608
- mime_type: z17.string().nullish(),
5609
- uri: z17.string().nullish()
5717
+ const stepDeltaVideo = z18.object({
5718
+ type: z18.literal("video"),
5719
+ data: z18.string().nullish(),
5720
+ mime_type: z18.string().nullish(),
5721
+ uri: z18.string().nullish()
5610
5722
  }).loose();
5611
- const stepDeltaBuiltinToolCall = z17.object({
5612
- type: z17.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5613
- id: z17.string().nullish(),
5614
- arguments: z17.record(z17.string(), z17.unknown()).nullish(),
5615
- name: z17.string().nullish(),
5616
- server_name: z17.string().nullish(),
5617
- search_type: z17.string().nullish(),
5618
- signature: z17.string().nullish()
5723
+ const stepDeltaBuiltinToolCall = z18.object({
5724
+ type: z18.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5725
+ id: z18.string().nullish(),
5726
+ arguments: z18.record(z18.string(), z18.unknown()).nullish(),
5727
+ name: z18.string().nullish(),
5728
+ server_name: z18.string().nullish(),
5729
+ search_type: z18.string().nullish(),
5730
+ signature: z18.string().nullish()
5619
5731
  }).loose();
5620
- const stepDeltaBuiltinToolResult = z17.object({
5621
- type: z17.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5622
- call_id: z17.string().nullish(),
5623
- result: z17.unknown().nullish(),
5624
- is_error: z17.boolean().nullish(),
5625
- name: z17.string().nullish(),
5626
- server_name: z17.string().nullish(),
5627
- signature: z17.string().nullish()
5732
+ const stepDeltaBuiltinToolResult = z18.object({
5733
+ type: z18.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5734
+ call_id: z18.string().nullish(),
5735
+ result: z18.unknown().nullish(),
5736
+ is_error: z18.boolean().nullish(),
5737
+ name: z18.string().nullish(),
5738
+ server_name: z18.string().nullish(),
5739
+ signature: z18.string().nullish()
5628
5740
  }).loose();
5629
- const stepDeltaUnknown = z17.object({ type: z17.string() }).loose();
5630
- const stepDeltaUnion = z17.union([
5741
+ const stepDeltaUnknown = z18.object({ type: z18.string() }).loose();
5742
+ const stepDeltaUnion = z18.union([
5631
5743
  stepDeltaText,
5632
5744
  stepDeltaImage,
5633
5745
  stepDeltaVideo,
@@ -5639,55 +5751,55 @@ var googleInteractionsEventSchema = lazySchema15(
5639
5751
  stepDeltaBuiltinToolResult,
5640
5752
  stepDeltaUnknown
5641
5753
  ]);
5642
- const stepDeltaEvent = z17.object({
5643
- event_type: z17.literal("step.delta"),
5644
- event_id: z17.string().nullish(),
5645
- index: z17.number(),
5754
+ const stepDeltaEvent = z18.object({
5755
+ event_type: z18.literal("step.delta"),
5756
+ event_id: z18.string().nullish(),
5757
+ index: z18.number(),
5646
5758
  delta: stepDeltaUnion
5647
5759
  }).loose();
5648
- const stepStopEvent = z17.object({
5649
- event_type: z17.literal("step.stop"),
5650
- event_id: z17.string().nullish(),
5651
- index: z17.number()
5760
+ const stepStopEvent = z18.object({
5761
+ event_type: z18.literal("step.stop"),
5762
+ event_id: z18.string().nullish(),
5763
+ index: z18.number()
5652
5764
  }).loose();
5653
- const interactionStatusUpdateEvent = z17.object({
5654
- event_type: z17.literal("interaction.status_update"),
5655
- event_id: z17.string().nullish(),
5656
- interaction_id: z17.string().nullish(),
5765
+ const interactionStatusUpdateEvent = z18.object({
5766
+ event_type: z18.literal("interaction.status_update"),
5767
+ event_id: z18.string().nullish(),
5768
+ interaction_id: z18.string().nullish(),
5657
5769
  status: status.nullish()
5658
5770
  }).loose();
5659
- const interactionInProgressEvent = z17.object({
5660
- event_type: z17.literal("interaction.in_progress"),
5661
- event_id: z17.string().nullish(),
5662
- interaction_id: z17.string().nullish(),
5771
+ const interactionInProgressEvent = z18.object({
5772
+ event_type: z18.literal("interaction.in_progress"),
5773
+ event_id: z18.string().nullish(),
5774
+ interaction_id: z18.string().nullish(),
5663
5775
  status: status.nullish()
5664
5776
  }).loose();
5665
- const interactionRequiresActionEvent = z17.object({
5666
- event_type: z17.literal("interaction.requires_action"),
5667
- event_id: z17.string().nullish(),
5668
- interaction_id: z17.string().nullish(),
5777
+ const interactionRequiresActionEvent = z18.object({
5778
+ event_type: z18.literal("interaction.requires_action"),
5779
+ event_id: z18.string().nullish(),
5780
+ interaction_id: z18.string().nullish(),
5669
5781
  status: status.nullish()
5670
5782
  }).loose();
5671
- const interactionCompletedEvent = z17.object({
5672
- event_type: z17.literal("interaction.completed"),
5673
- event_id: z17.string().nullish(),
5674
- interaction: z17.object({
5675
- id: z17.string().nullish(),
5783
+ const interactionCompletedEvent = z18.object({
5784
+ event_type: z18.literal("interaction.completed"),
5785
+ event_id: z18.string().nullish(),
5786
+ interaction: z18.object({
5787
+ id: z18.string().nullish(),
5676
5788
  status: status.nullish(),
5677
5789
  usage: usageSchema2().nullish(),
5678
- service_tier: z17.string().nullish()
5790
+ service_tier: z18.string().nullish()
5679
5791
  }).loose()
5680
5792
  }).loose();
5681
- const errorEvent = z17.object({
5682
- event_type: z17.literal("error"),
5683
- event_id: z17.string().nullish(),
5684
- error: z17.object({
5685
- code: z17.string().nullish(),
5686
- message: z17.string().nullish()
5793
+ const errorEvent = z18.object({
5794
+ event_type: z18.literal("error"),
5795
+ event_id: z18.string().nullish(),
5796
+ error: z18.object({
5797
+ code: z18.string().nullish(),
5798
+ message: z18.string().nullish()
5687
5799
  }).loose().nullish()
5688
5800
  }).loose();
5689
- const unknownEvent = z17.object({ event_type: z17.string() }).loose();
5690
- return z17.union([
5801
+ const unknownEvent = z18.object({ event_type: z18.string() }).loose();
5802
+ return z18.union([
5691
5803
  interactionCreatedEvent,
5692
5804
  stepStartEvent,
5693
5805
  stepDeltaEvent,
@@ -5708,26 +5820,26 @@ import {
5708
5820
  lazySchema as lazySchema16,
5709
5821
  zodSchema as zodSchema16
5710
5822
  } from "@ai-sdk/provider-utils";
5711
- import { z as z18 } from "zod/v4";
5823
+ import { z as z19 } from "zod/v4";
5712
5824
  var googleInteractionsLanguageModelOptions = lazySchema16(
5713
5825
  () => zodSchema16(
5714
- z18.object({
5715
- previousInteractionId: z18.string().nullish(),
5716
- store: z18.boolean().nullish(),
5717
- agent: z18.string().nullish(),
5718
- agentConfig: z18.union([
5719
- z18.object({
5720
- type: z18.literal("dynamic")
5826
+ z19.object({
5827
+ previousInteractionId: z19.string().nullish(),
5828
+ store: z19.boolean().nullish(),
5829
+ agent: z19.string().nullish(),
5830
+ agentConfig: z19.union([
5831
+ z19.object({
5832
+ type: z19.literal("dynamic")
5721
5833
  }).loose(),
5722
- z18.object({
5723
- type: z18.literal("deep-research"),
5724
- thinkingSummaries: z18.enum(["auto", "none"]).nullish(),
5725
- visualization: z18.enum(["off", "auto"]).nullish(),
5726
- collaborativePlanning: z18.boolean().nullish()
5834
+ z19.object({
5835
+ type: z19.literal("deep-research"),
5836
+ thinkingSummaries: z19.enum(["auto", "none"]).nullish(),
5837
+ visualization: z19.enum(["off", "auto"]).nullish(),
5838
+ collaborativePlanning: z19.boolean().nullish()
5727
5839
  })
5728
5840
  ]).nullish(),
5729
- thinkingLevel: z18.enum(["minimal", "low", "medium", "high"]).nullish(),
5730
- thinkingSummaries: z18.enum(["auto", "none"]).nullish(),
5841
+ thinkingLevel: z19.enum(["minimal", "low", "medium", "high"]).nullish(),
5842
+ thinkingSummaries: z19.enum(["auto", "none"]).nullish(),
5731
5843
  /**
5732
5844
  * Output-format entries that map directly to the API's `response_format`
5733
5845
  * array. Use this to request image, audio, video, or non-JSON text
@@ -5737,17 +5849,17 @@ var googleInteractionsLanguageModelOptions = lazySchema16(
5737
5849
  * type: 'json', schema }` still drives JSON-mode and adds a matching
5738
5850
  * text entry automatically; entries listed here are appended.
5739
5851
  */
5740
- responseFormat: z18.array(
5741
- z18.union([
5742
- z18.object({
5743
- type: z18.literal("text"),
5744
- mimeType: z18.string().nullish(),
5745
- schema: z18.unknown().nullish()
5852
+ responseFormat: z19.array(
5853
+ z19.union([
5854
+ z19.object({
5855
+ type: z19.literal("text"),
5856
+ mimeType: z19.string().nullish(),
5857
+ schema: z19.unknown().nullish()
5746
5858
  }).loose(),
5747
- z18.object({
5748
- type: z18.literal("image"),
5749
- mimeType: z18.string().nullish(),
5750
- aspectRatio: z18.enum([
5859
+ z19.object({
5860
+ type: z19.literal("image"),
5861
+ mimeType: z19.string().nullish(),
5862
+ aspectRatio: z19.enum([
5751
5863
  "1:1",
5752
5864
  "2:3",
5753
5865
  "3:2",
@@ -5763,19 +5875,19 @@ var googleInteractionsLanguageModelOptions = lazySchema16(
5763
5875
  "1:4",
5764
5876
  "4:1"
5765
5877
  ]).nullish(),
5766
- imageSize: z18.enum(["1K", "2K", "4K", "512"]).nullish()
5878
+ imageSize: z19.enum(["1K", "2K", "4K", "512"]).nullish()
5767
5879
  }).loose(),
5768
- z18.object({
5769
- type: z18.literal("audio"),
5770
- mimeType: z18.string().nullish()
5880
+ z19.object({
5881
+ type: z19.literal("audio"),
5882
+ mimeType: z19.string().nullish()
5771
5883
  }).loose(),
5772
- z18.object({
5773
- type: z18.literal("video"),
5774
- aspectRatio: z18.enum(["16:9", "9:16"]).nullish(),
5775
- resolution: z18.enum(["360p", "720p", "1080p", "4k"]).nullish(),
5776
- duration: z18.string().nullish(),
5777
- delivery: z18.enum(["inline", "uri"]).nullish(),
5778
- gcsUri: z18.string().nullish()
5884
+ z19.object({
5885
+ type: z19.literal("video"),
5886
+ aspectRatio: z19.enum(["16:9", "9:16"]).nullish(),
5887
+ resolution: z19.enum(["360p", "720p", "1080p", "4k"]).nullish(),
5888
+ duration: z19.string().nullish(),
5889
+ delivery: z19.enum(["inline", "uri"]).nullish(),
5890
+ gcsUri: z19.string().nullish()
5779
5891
  }).loose()
5780
5892
  ])
5781
5893
  ).nullish(),
@@ -5785,8 +5897,8 @@ var googleInteractionsLanguageModelOptions = lazySchema16(
5785
5897
  * translates it into a matching `response_format` image entry and
5786
5898
  * emits a warning when set.
5787
5899
  */
5788
- imageConfig: z18.object({
5789
- aspectRatio: z18.enum([
5900
+ imageConfig: z19.object({
5901
+ aspectRatio: z19.enum([
5790
5902
  "1:1",
5791
5903
  "2:3",
5792
5904
  "3:2",
@@ -5802,35 +5914,35 @@ var googleInteractionsLanguageModelOptions = lazySchema16(
5802
5914
  "1:4",
5803
5915
  "4:1"
5804
5916
  ]).nullish(),
5805
- imageSize: z18.enum(["1K", "2K", "4K", "512"]).nullish()
5917
+ imageSize: z19.enum(["1K", "2K", "4K", "512"]).nullish()
5806
5918
  }).nullish(),
5807
- mediaResolution: z18.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5808
- responseModalities: z18.array(z18.enum(["text", "image", "audio", "video", "document"])).nullish(),
5809
- serviceTier: z18.enum(["flex", "standard", "priority"]).nullish(),
5919
+ mediaResolution: z19.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5920
+ responseModalities: z19.array(z19.enum(["text", "image", "audio", "video", "document"])).nullish(),
5921
+ serviceTier: z19.enum(["flex", "standard", "priority"]).nullish(),
5810
5922
  /**
5811
5923
  * Alternative to AI SDK `system` message. If both are set, the AI SDK
5812
5924
  * `system` message wins and a warning is emitted.
5813
5925
  */
5814
- systemInstruction: z18.string().nullish(),
5926
+ systemInstruction: z19.string().nullish(),
5815
5927
  /**
5816
5928
  * Per-block signature for round-tripping `thought.signature` and
5817
5929
  * `function_call.signature` blocks. Set by the SDK on output reasoning /
5818
5930
  * tool-call parts; passed back unchanged on input parts so the API
5819
5931
  * accepts the prior turn.
5820
5932
  */
5821
- signature: z18.string().nullish(),
5933
+ signature: z19.string().nullish(),
5822
5934
  /**
5823
5935
  * Set by the SDK on output assistant messages. The converter uses it to
5824
5936
  * decide which messages to drop when compacting under
5825
5937
  * `previousInteractionId`.
5826
5938
  */
5827
- interactionId: z18.string().nullish(),
5939
+ interactionId: z19.string().nullish(),
5828
5940
  /**
5829
5941
  * Maximum time, in milliseconds, to poll a background interaction (agent
5830
5942
  * call) before giving up. Defaults to 30 minutes. Long-running agents
5831
5943
  * such as deep research can take tens of minutes — increase if needed.
5832
5944
  */
5833
- pollingTimeoutMs: z18.number().int().positive().nullish(),
5945
+ pollingTimeoutMs: z19.number().int().positive().nullish(),
5834
5946
  /**
5835
5947
  * Run the interaction in the background. Required for agents whose
5836
5948
  * server-side workflow cannot complete within a single request/response.
@@ -5839,7 +5951,7 @@ var googleInteractionsLanguageModelOptions = lazySchema16(
5839
5951
  * reject `true`; see the agent's documentation for which mode it
5840
5952
  * requires.
5841
5953
  */
5842
- background: z18.boolean().nullish(),
5954
+ background: z19.boolean().nullish(),
5843
5955
  /**
5844
5956
  * Environment configuration for the agent sandbox. Only applies to agent
5845
5957
  * calls (`google.interactions({ agent })`); ignored on model-id calls.
@@ -5849,36 +5961,36 @@ var googleInteractionsLanguageModelOptions = lazySchema16(
5849
5961
  * - object: provision a fresh sandbox and optionally preload `sources`
5850
5962
  * and/or constrain outbound traffic via `network`.
5851
5963
  */
5852
- environment: z18.union([
5853
- z18.string(),
5854
- z18.object({
5855
- type: z18.literal("remote"),
5856
- sources: z18.array(
5857
- z18.union([
5858
- z18.object({
5859
- type: z18.literal("gcs"),
5860
- source: z18.string(),
5861
- target: z18.string().nullish()
5964
+ environment: z19.union([
5965
+ z19.string(),
5966
+ z19.object({
5967
+ type: z19.literal("remote"),
5968
+ sources: z19.array(
5969
+ z19.union([
5970
+ z19.object({
5971
+ type: z19.literal("gcs"),
5972
+ source: z19.string(),
5973
+ target: z19.string().nullish()
5862
5974
  }),
5863
- z18.object({
5864
- type: z18.literal("repository"),
5865
- source: z18.string(),
5866
- target: z18.string().nullish()
5975
+ z19.object({
5976
+ type: z19.literal("repository"),
5977
+ source: z19.string(),
5978
+ target: z19.string().nullish()
5867
5979
  }),
5868
- z18.object({
5869
- type: z18.literal("inline"),
5870
- content: z18.string(),
5871
- target: z18.string()
5980
+ z19.object({
5981
+ type: z19.literal("inline"),
5982
+ content: z19.string(),
5983
+ target: z19.string()
5872
5984
  })
5873
5985
  ])
5874
5986
  ).nullish(),
5875
- network: z18.union([
5876
- z18.literal("disabled"),
5877
- z18.object({
5878
- allowlist: z18.array(
5879
- z18.object({
5880
- domain: z18.string(),
5881
- transform: z18.array(z18.record(z18.string(), z18.string())).nullish()
5987
+ network: z19.union([
5988
+ z19.literal("disabled"),
5989
+ z19.object({
5990
+ allowlist: z19.array(
5991
+ z19.object({
5992
+ domain: z19.string(),
5993
+ transform: z19.array(z19.record(z19.string(), z19.string())).nullish()
5882
5994
  })
5883
5995
  )
5884
5996
  })
@@ -6191,6 +6303,9 @@ function prepareGoogleInteractionsTools({
6191
6303
  }) {
6192
6304
  var _a2, _b, _c, _d;
6193
6305
  const toolWarnings = [];
6306
+ if ((toolChoice == null ? void 0 : toolChoice.type) === "none") {
6307
+ return { tools: void 0, toolChoice: void 0, toolWarnings };
6308
+ }
6194
6309
  const normalized = (tools == null ? void 0 : tools.length) ? tools : void 0;
6195
6310
  if (normalized == null) {
6196
6311
  return { tools: void 0, toolChoice: void 0, toolWarnings };
@@ -6312,9 +6427,6 @@ function prepareGoogleInteractionsTools({
6312
6427
  case "required":
6313
6428
  mappedToolChoice = "any";
6314
6429
  break;
6315
- case "none":
6316
- mappedToolChoice = "none";
6317
- break;
6318
6430
  case "tool":
6319
6431
  mappedToolChoice = {
6320
6432
  allowed_tools: {