@ai-sdk/google 4.0.49 → 4.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  // src/google-provider.ts
2
2
  import {
3
- generateId as generateId2,
3
+ generateId as generateId3,
4
4
  loadApiKey,
5
5
  withoutTrailingSlash,
6
6
  withUserAgentSuffix as withUserAgentSuffix2
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "4.0.49" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.51" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -251,6 +251,35 @@ var googleGenerativeAISingleEmbeddingResponseSchema = lazySchema3(
251
251
  )
252
252
  );
253
253
 
254
+ // src/google-batch.ts
255
+ import {
256
+ EmptyResponseBodyError,
257
+ InvalidArgumentError,
258
+ InvalidResponseDataError
259
+ } from "@ai-sdk/provider";
260
+ import {
261
+ combineHeaders as combineHeaders3,
262
+ convertAsyncIteratorToReadableStream,
263
+ createJsonResponseHandler as createJsonResponseHandler3,
264
+ generateId as generateId2,
265
+ getFromApi,
266
+ lazySchema as lazySchema6,
267
+ parseJSON,
268
+ postJsonToApi as postJsonToApi3,
269
+ postToApi,
270
+ resolve as resolve3,
271
+ safeValidateTypes,
272
+ WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3,
273
+ WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
274
+ zodSchema as zodSchema6
275
+ } from "@ai-sdk/provider-utils";
276
+ import { z as z6 } from "zod/v4";
277
+
278
+ // src/get-model-path.ts
279
+ function getModelPath(modelId) {
280
+ return modelId.includes("/") ? modelId : `models/${modelId}`;
281
+ }
282
+
254
283
  // src/google-language-model.ts
255
284
  import {
256
285
  combineHeaders as combineHeaders2,
@@ -1027,11 +1056,6 @@ function convertToGoogleMessages(prompt, options) {
1027
1056
  };
1028
1057
  }
1029
1058
 
1030
- // src/get-model-path.ts
1031
- function getModelPath(modelId) {
1032
- return modelId.includes("/") ? modelId : `models/${modelId}`;
1033
- }
1034
-
1035
1059
  // src/google-language-model-options.ts
1036
1060
  import {
1037
1061
  lazySchema as lazySchema4,
@@ -1969,32 +1993,15 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1969
1993
  extraHeaders: vertexPaygoHeaders
1970
1994
  };
1971
1995
  }
1972
- async doGenerate(options) {
1996
+ convertGenerateContentResponse({
1997
+ response,
1998
+ warnings,
1999
+ providerOptionsNames
2000
+ }) {
1973
2001
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
1974
- const { args, warnings, providerOptionsNames, extraHeaders } = await this.getArgs(options);
1975
2002
  const wrapProviderMetadata = (payload) => Object.fromEntries(
1976
2003
  providerOptionsNames.map((name) => [name, payload])
1977
2004
  );
1978
- const mergedHeaders = combineHeaders2(
1979
- this.config.headers ? await resolve2(this.config.headers) : void 0,
1980
- options.headers,
1981
- extraHeaders
1982
- );
1983
- const {
1984
- responseHeaders,
1985
- value: response,
1986
- rawValue: rawResponse
1987
- } = await postJsonToApi2({
1988
- url: `${this.config.baseURL}/${getModelPath(
1989
- this.modelId
1990
- )}:generateContent`,
1991
- headers: mergedHeaders,
1992
- body: args,
1993
- failedResponseHandler: googleFailedResponseHandler,
1994
- successfulResponseHandler: createJsonResponseHandler2(responseSchema),
1995
- abortSignal: options.abortSignal,
1996
- fetch: this.config.fetch
1997
- });
1998
2005
  const candidate = response.candidates[0];
1999
2006
  const content = [];
2000
2007
  const parts = (_b = (_a = candidate.content) == null ? void 0 : _a.parts) != null ? _b : [];
@@ -2128,10 +2135,44 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2128
2135
  finishMessage: (_n = candidate.finishMessage) != null ? _n : null,
2129
2136
  serviceTier: (_o = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _o : null
2130
2137
  }),
2131
- request: { body: args },
2132
2138
  response: {
2133
2139
  // TODO timestamp, model id
2134
- id: (_p = response.responseId) != null ? _p : void 0,
2140
+ id: (_p = response.responseId) != null ? _p : void 0
2141
+ }
2142
+ };
2143
+ }
2144
+ async doGenerate(options) {
2145
+ const { args, warnings, providerOptionsNames, extraHeaders } = await this.getArgs(options);
2146
+ const mergedHeaders = combineHeaders2(
2147
+ this.config.headers ? await resolve2(this.config.headers) : void 0,
2148
+ options.headers,
2149
+ extraHeaders
2150
+ );
2151
+ const {
2152
+ responseHeaders,
2153
+ value: response,
2154
+ rawValue: rawResponse
2155
+ } = await postJsonToApi2({
2156
+ url: `${this.config.baseURL}/${getModelPath(
2157
+ this.modelId
2158
+ )}:generateContent`,
2159
+ headers: mergedHeaders,
2160
+ body: args,
2161
+ failedResponseHandler: googleFailedResponseHandler,
2162
+ successfulResponseHandler: createJsonResponseHandler2(responseSchema),
2163
+ abortSignal: options.abortSignal,
2164
+ fetch: this.config.fetch
2165
+ });
2166
+ const result = this.convertGenerateContentResponse({
2167
+ response,
2168
+ warnings,
2169
+ providerOptionsNames
2170
+ });
2171
+ return {
2172
+ ...result,
2173
+ request: { body: args },
2174
+ response: {
2175
+ ...result.response,
2135
2176
  headers: responseHeaders,
2136
2177
  body: rawResponse
2137
2178
  }
@@ -2166,7 +2207,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2166
2207
  let providerMetadata = void 0;
2167
2208
  let lastGroundingMetadata = null;
2168
2209
  let lastUrlContextMetadata = null;
2169
- const generateId3 = this.config.generateId;
2210
+ const generateId4 = this.config.generateId;
2170
2211
  let hasToolCalls = false;
2171
2212
  let hasEmittedResponseMetadata = false;
2172
2213
  let currentTextBlockId = null;
@@ -2244,7 +2285,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2244
2285
  }
2245
2286
  const sources = extractSources({
2246
2287
  groundingMetadata: candidate.groundingMetadata,
2247
- generateId: generateId3
2288
+ generateId: generateId4
2248
2289
  });
2249
2290
  if (sources != null) {
2250
2291
  for (const source of sources) {
@@ -2258,7 +2299,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2258
2299
  const parts = (_b = content.parts) != null ? _b : [];
2259
2300
  for (const part of parts) {
2260
2301
  if ("executableCode" in part && ((_c = part.executableCode) == null ? void 0 : _c.code)) {
2261
- const toolCallId = generateId3();
2302
+ const toolCallId = generateId4();
2262
2303
  lastCodeExecutionToolCallId = toolCallId;
2263
2304
  controller.enqueue({
2264
2305
  type: "tool-call",
@@ -2365,7 +2406,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2365
2406
  providerMetadata: fileMeta
2366
2407
  });
2367
2408
  } else if ("toolCall" in part && part.toolCall) {
2368
- const toolCallId = part.toolCall.id || generateId3();
2409
+ const toolCallId = part.toolCall.id || generateId4();
2369
2410
  lastServerToolCallId = toolCallId;
2370
2411
  const serverMeta = wrapProviderMetadata({
2371
2412
  ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
@@ -2382,7 +2423,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2382
2423
  providerMetadata: serverMeta
2383
2424
  });
2384
2425
  } else if ("toolResponse" in part && part.toolResponse) {
2385
- const responseToolCallId = lastServerToolCallId || part.toolResponse.id || generateId3();
2426
+ const responseToolCallId = lastServerToolCallId || part.toolResponse.id || generateId4();
2386
2427
  const serverMeta = wrapProviderMetadata({
2387
2428
  ...part.thoughtSignature ? { thoughtSignature: part.thoughtSignature } : {},
2388
2429
  serverToolCallId: responseToolCallId,
@@ -2409,7 +2450,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2409
2450
  const isNoArgsCompleteCall = part.functionCall.name != null && part.functionCall.args == null && part.functionCall.partialArgs == null && part.functionCall.willContinue !== true;
2410
2451
  if (isStreamingChunk) {
2411
2452
  if (part.functionCall.name != null) {
2412
- const toolCallId = part.functionCall.id || generateId3();
2453
+ const toolCallId = part.functionCall.id || generateId4();
2413
2454
  const accumulator = new GoogleJSONAccumulator();
2414
2455
  activeStreamingToolCalls.push({
2415
2456
  toolCallId,
@@ -2457,7 +2498,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2457
2498
  } else if (isTerminalChunk && activeStreamingToolCalls.length > 0) {
2458
2499
  finishActiveStreamingToolCall(controller);
2459
2500
  } else if (isCompleteCall) {
2460
- const toolCallId = part.functionCall.id || generateId3();
2501
+ const toolCallId = part.functionCall.id || generateId4();
2461
2502
  const toolName = part.functionCall.name;
2462
2503
  const args2 = typeof part.functionCall.args === "string" ? part.functionCall.args : JSON.stringify((_g = part.functionCall.args) != null ? _g : {});
2463
2504
  controller.enqueue({
@@ -2486,7 +2527,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2486
2527
  });
2487
2528
  hasToolCalls = true;
2488
2529
  } else if (isNoArgsCompleteCall) {
2489
- const toolCallId = part.functionCall.id || generateId3();
2530
+ const toolCallId = part.functionCall.id || generateId4();
2490
2531
  const toolName = part.functionCall.name;
2491
2532
  controller.enqueue({
2492
2533
  type: "tool-input-start",
@@ -2642,7 +2683,7 @@ function resolveGemini25ThinkingConfig({
2642
2683
  }
2643
2684
  function extractSources({
2644
2685
  groundingMetadata,
2645
- generateId: generateId3
2686
+ generateId: generateId4
2646
2687
  }) {
2647
2688
  var _a, _b, _c, _d, _e, _f;
2648
2689
  if (!(groundingMetadata == null ? void 0 : groundingMetadata.groundingChunks)) {
@@ -2654,7 +2695,7 @@ function extractSources({
2654
2695
  sources.push({
2655
2696
  type: "source",
2656
2697
  sourceType: "url",
2657
- id: generateId3(),
2698
+ id: generateId4(),
2658
2699
  url: chunk.web.uri,
2659
2700
  title: (_a = chunk.web.title) != null ? _a : void 0
2660
2701
  });
@@ -2662,7 +2703,7 @@ function extractSources({
2662
2703
  sources.push({
2663
2704
  type: "source",
2664
2705
  sourceType: "url",
2665
- id: generateId3(),
2706
+ id: generateId4(),
2666
2707
  // Google requires attribution to the source URI, not the actual image URI.
2667
2708
  // TODO: add another type in v7 to allow both the image and source URL to be included separately
2668
2709
  url: chunk.image.sourceUri,
@@ -2675,7 +2716,7 @@ function extractSources({
2675
2716
  sources.push({
2676
2717
  type: "source",
2677
2718
  sourceType: "url",
2678
- id: generateId3(),
2719
+ id: generateId4(),
2679
2720
  url: uri,
2680
2721
  title: (_c = chunk.retrievedContext.title) != null ? _c : void 0
2681
2722
  });
@@ -2704,7 +2745,7 @@ function extractSources({
2704
2745
  sources.push({
2705
2746
  type: "source",
2706
2747
  sourceType: "document",
2707
- id: generateId3(),
2748
+ id: generateId4(),
2708
2749
  mediaType,
2709
2750
  title,
2710
2751
  filename
@@ -2714,7 +2755,7 @@ function extractSources({
2714
2755
  sources.push({
2715
2756
  type: "source",
2716
2757
  sourceType: "document",
2717
- id: generateId3(),
2758
+ id: generateId4(),
2718
2759
  mediaType: "application/octet-stream",
2719
2760
  title,
2720
2761
  filename: fileSearchStore.split("/").pop()
@@ -2725,7 +2766,7 @@ function extractSources({
2725
2766
  sources.push({
2726
2767
  type: "source",
2727
2768
  sourceType: "url",
2728
- id: generateId3(),
2769
+ id: generateId4(),
2729
2770
  url: chunk.maps.uri,
2730
2771
  title: (_f = chunk.maps.title) != null ? _f : void 0
2731
2772
  });
@@ -2925,123 +2966,670 @@ var chunkSchema = lazySchema5(
2925
2966
  )
2926
2967
  );
2927
2968
 
2969
+ // src/google-batch.ts
2970
+ var googleBatchInputFileMaxBytes = 2 * 1024 * 1024 * 1024;
2971
+ var googleBatchInlineCreationMaxBytes = 2e7;
2972
+ var supportedGoogleBatchContentTypes = /* @__PURE__ */ new Set(["text", "reasoning", "source"]);
2973
+ var googleRpcStatusSchema = z6.object({
2974
+ code: z6.union([z6.number(), z6.string()]).nullish(),
2975
+ message: z6.string().nullish(),
2976
+ status: z6.string().nullish()
2977
+ });
2978
+ var googleBatchStatsSchema = z6.object({
2979
+ requestCount: z6.union([z6.string(), z6.number()]).nullish(),
2980
+ successfulRequestCount: z6.union([z6.string(), z6.number()]).nullish(),
2981
+ failedRequestCount: z6.union([z6.string(), z6.number()]).nullish(),
2982
+ pendingRequestCount: z6.union([z6.string(), z6.number()]).nullish()
2983
+ });
2984
+ var googleBatchOutputSchema = z6.object({
2985
+ responsesFile: z6.string().nullish(),
2986
+ inlinedResponses: z6.object({
2987
+ inlinedResponses: z6.array(
2988
+ z6.object({
2989
+ metadata: z6.object({
2990
+ key: z6.string()
2991
+ }),
2992
+ response: z6.unknown().nullish(),
2993
+ error: googleRpcStatusSchema.nullish()
2994
+ })
2995
+ )
2996
+ }).nullish()
2997
+ });
2998
+ var googleBatchOperationSchema = lazySchema6(
2999
+ () => zodSchema6(
3000
+ z6.object({
3001
+ name: z6.string(),
3002
+ metadata: z6.object({
3003
+ state: z6.string().nullish(),
3004
+ createTime: z6.string().nullish(),
3005
+ batchStats: googleBatchStatsSchema.nullish(),
3006
+ output: googleBatchOutputSchema.nullish()
3007
+ }).nullish(),
3008
+ done: z6.boolean().nullish(),
3009
+ error: googleRpcStatusSchema.nullish(),
3010
+ response: googleBatchOutputSchema.nullish()
3011
+ })
3012
+ )
3013
+ );
3014
+ var googleFileUploadResponseSchema = lazySchema6(
3015
+ () => zodSchema6(
3016
+ z6.object({
3017
+ file: z6.object({
3018
+ name: z6.string()
3019
+ })
3020
+ })
3021
+ )
3022
+ );
3023
+ var googleBatchResultLineSchema = lazySchema6(
3024
+ () => zodSchema6(
3025
+ z6.object({
3026
+ key: z6.string(),
3027
+ response: z6.unknown().nullish(),
3028
+ error: googleRpcStatusSchema.nullish()
3029
+ })
3030
+ )
3031
+ );
3032
+ var googleBatchResponsePreviewSchema = lazySchema6(
3033
+ () => zodSchema6(
3034
+ z6.object({
3035
+ candidates: z6.array(z6.unknown()).nullish(),
3036
+ promptFeedback: z6.object({
3037
+ blockReason: z6.string().nullish()
3038
+ }).nullish()
3039
+ })
3040
+ )
3041
+ );
3042
+ var GoogleBatchLanguageModel = class _GoogleBatchLanguageModel extends GoogleLanguageModel {
3043
+ static [WORKFLOW_SERIALIZE3](model) {
3044
+ return GoogleLanguageModel[WORKFLOW_SERIALIZE3](model);
3045
+ }
3046
+ static [WORKFLOW_DESERIALIZE3](options) {
3047
+ return new _GoogleBatchLanguageModel(options.modelId, options.config);
3048
+ }
3049
+ constructor(modelId, config) {
3050
+ var _a;
3051
+ super(modelId, config);
3052
+ this.batchConfig = config;
3053
+ this.batchGenerateId = (_a = config.generateId) != null ? _a : generateId2;
3054
+ }
3055
+ async experimental_doStartBatch(options) {
3056
+ const warnings = [];
3057
+ const displayName = `ai-sdk-batch-${this.batchGenerateId()}`;
3058
+ const inlinedRequests = [];
3059
+ const inlineBatchBody = {
3060
+ batch: {
3061
+ displayName,
3062
+ ...options.webhookUrl != null && {
3063
+ webhookConfig: { uris: [options.webhookUrl] }
3064
+ },
3065
+ inputConfig: {
3066
+ requests: { requests: inlinedRequests }
3067
+ }
3068
+ }
3069
+ };
3070
+ const textEncoder = new TextEncoder();
3071
+ let inlineInputBytes = textEncoder.encode(
3072
+ JSON.stringify(inlineBatchBody)
3073
+ ).byteLength;
3074
+ let fileParts;
3075
+ for (const request of options.requests) {
3076
+ const preparedRequest = await this.getArgs(request.options);
3077
+ const inlinedRequest = {
3078
+ request: preparedRequest.args,
3079
+ metadata: { key: request.id }
3080
+ };
3081
+ if (fileParts == null) {
3082
+ const requestBytes = textEncoder.encode(
3083
+ JSON.stringify(inlinedRequest)
3084
+ ).byteLength;
3085
+ const nextInlineInputBytes = inlineInputBytes + requestBytes + (inlinedRequests.length > 0 ? 1 : 0);
3086
+ if (nextInlineInputBytes < googleBatchInlineCreationMaxBytes) {
3087
+ inlinedRequests.push(inlinedRequest);
3088
+ inlineInputBytes = nextInlineInputBytes;
3089
+ } else {
3090
+ fileParts = [];
3091
+ for (const previousRequest of inlinedRequests) {
3092
+ fileParts.push(
3093
+ JSON.stringify({
3094
+ key: previousRequest.metadata.key,
3095
+ request: previousRequest.request
3096
+ }),
3097
+ "\n"
3098
+ );
3099
+ }
3100
+ inlinedRequests.length = 0;
3101
+ fileParts.push(
3102
+ JSON.stringify({
3103
+ key: request.id,
3104
+ request: preparedRequest.args
3105
+ }),
3106
+ "\n"
3107
+ );
3108
+ }
3109
+ } else {
3110
+ fileParts.push(
3111
+ JSON.stringify({
3112
+ key: request.id,
3113
+ request: preparedRequest.args
3114
+ }),
3115
+ "\n"
3116
+ );
3117
+ }
3118
+ for (const warning of preparedRequest.warnings) {
3119
+ warnings.push({ requestId: request.id, warning });
3120
+ }
3121
+ }
3122
+ const headers = await this.getHeaders(options.headers);
3123
+ const createUrl = `${this.batchConfig.baseURL}/${getModelPath(
3124
+ this.modelId
3125
+ )}:batchGenerateContent`;
3126
+ let operation;
3127
+ if (fileParts == null) {
3128
+ const { value } = await postJsonToApi3({
3129
+ url: createUrl,
3130
+ headers,
3131
+ body: inlineBatchBody,
3132
+ failedResponseHandler: googleFailedResponseHandler,
3133
+ successfulResponseHandler: createJsonResponseHandler3(
3134
+ googleBatchOperationSchema
3135
+ ),
3136
+ abortSignal: options.abortSignal,
3137
+ fetch: this.batchConfig.fetch
3138
+ });
3139
+ operation = value;
3140
+ } else {
3141
+ const inputFile = new Blob(fileParts, { type: "application/jsonl" });
3142
+ fileParts.length = 0;
3143
+ if (inputFile.size > googleBatchInputFileMaxBytes) {
3144
+ throw new InvalidArgumentError({
3145
+ argument: "requests",
3146
+ message: "Google batch input files must not exceed 2 GB."
3147
+ });
3148
+ }
3149
+ const { value: uploadUrl } = await postJsonToApi3({
3150
+ url: `${this.getBaseOrigin()}/upload/v1beta/files`,
3151
+ headers: combineHeaders3(headers, {
3152
+ "X-Goog-Upload-Protocol": "resumable",
3153
+ "X-Goog-Upload-Command": "start",
3154
+ "X-Goog-Upload-Header-Content-Length": String(inputFile.size),
3155
+ "X-Goog-Upload-Header-Content-Type": "application/jsonl"
3156
+ }),
3157
+ body: {
3158
+ file: {
3159
+ display_name: `${displayName}-input`
3160
+ }
3161
+ },
3162
+ failedResponseHandler: googleFailedResponseHandler,
3163
+ successfulResponseHandler: googleUploadUrlResponseHandler,
3164
+ abortSignal: options.abortSignal,
3165
+ fetch: this.batchConfig.fetch
3166
+ });
3167
+ const { value: uploadedFile } = await postToApi({
3168
+ url: uploadUrl,
3169
+ headers: {
3170
+ "X-Goog-Upload-Offset": "0",
3171
+ "X-Goog-Upload-Command": "upload, finalize",
3172
+ "Content-Type": "application/jsonl"
3173
+ },
3174
+ body: {
3175
+ content: inputFile,
3176
+ values: {
3177
+ byteLength: inputFile.size,
3178
+ mediaType: "application/jsonl"
3179
+ }
3180
+ },
3181
+ failedResponseHandler: googleFailedResponseHandler,
3182
+ successfulResponseHandler: createJsonResponseHandler3(
3183
+ googleFileUploadResponseSchema
3184
+ ),
3185
+ abortSignal: options.abortSignal,
3186
+ fetch: this.batchConfig.fetch
3187
+ });
3188
+ const { value } = await postJsonToApi3({
3189
+ url: createUrl,
3190
+ headers,
3191
+ body: {
3192
+ batch: {
3193
+ displayName,
3194
+ ...options.webhookUrl != null && {
3195
+ webhookConfig: { uris: [options.webhookUrl] }
3196
+ },
3197
+ inputConfig: {
3198
+ fileName: uploadedFile.file.name
3199
+ }
3200
+ }
3201
+ },
3202
+ failedResponseHandler: googleFailedResponseHandler,
3203
+ successfulResponseHandler: createJsonResponseHandler3(
3204
+ googleBatchOperationSchema
3205
+ ),
3206
+ abortSignal: options.abortSignal,
3207
+ fetch: this.batchConfig.fetch
3208
+ });
3209
+ operation = value;
3210
+ }
3211
+ return {
3212
+ batchId: operation.name,
3213
+ ...convertGoogleBatchStatus(operation),
3214
+ warnings
3215
+ };
3216
+ }
3217
+ async experimental_doGetBatchStatus(options) {
3218
+ return convertGoogleBatchStatus(await this.retrieveBatch(options));
3219
+ }
3220
+ async experimental_doGetBatchResults(options) {
3221
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
3222
+ const operation = await this.retrieveBatch(options);
3223
+ const batchStatus = convertGoogleBatchStatus(operation);
3224
+ if (batchStatus.status === "pending") {
3225
+ throw new InvalidArgumentError({
3226
+ argument: "batchId",
3227
+ message: `Google batch "${options.batchId}" is not complete.`
3228
+ });
3229
+ }
3230
+ const inlinedResponses = (_f = (_c = (_b = (_a = operation.metadata) == null ? void 0 : _a.output) == null ? void 0 : _b.inlinedResponses) == null ? void 0 : _c.inlinedResponses) != null ? _f : (_e = (_d = operation.response) == null ? void 0 : _d.inlinedResponses) == null ? void 0 : _e.inlinedResponses;
3231
+ if (inlinedResponses != null) {
3232
+ return convertAsyncIteratorToReadableStream(
3233
+ this.iterateBatchResults(
3234
+ inlinedResponses.map((result) => ({
3235
+ key: result.metadata.key,
3236
+ response: result.response,
3237
+ error: result.error
3238
+ }))
3239
+ )
3240
+ );
3241
+ }
3242
+ const responsesFile = (_j = (_h = (_g = operation.metadata) == null ? void 0 : _g.output) == null ? void 0 : _h.responsesFile) != null ? _j : (_i = operation.response) == null ? void 0 : _i.responsesFile;
3243
+ if (responsesFile == null) {
3244
+ if (batchStatus.status === "completed") {
3245
+ throw new InvalidResponseDataError({
3246
+ data: operation,
3247
+ message: `Google batch "${options.batchId}" completed without batch output.`
3248
+ });
3249
+ }
3250
+ return new ReadableStream({
3251
+ start(controller) {
3252
+ controller.close();
3253
+ }
3254
+ });
3255
+ }
3256
+ const encodedResponsesFile = responsesFile.split("/").map((segment) => encodeURIComponent(segment)).join("/");
3257
+ const { value: stream } = await getFromApi({
3258
+ url: `${this.getBaseOrigin()}/download/v1beta/${encodedResponsesFile}:download?alt=media`,
3259
+ headers: await this.getHeaders(options.headers),
3260
+ failedResponseHandler: googleFailedResponseHandler,
3261
+ successfulResponseHandler: rawStreamResponseHandler,
3262
+ abortSignal: options.abortSignal,
3263
+ fetch: this.batchConfig.fetch,
3264
+ validateUrl: false
3265
+ });
3266
+ return convertAsyncIteratorToReadableStream(
3267
+ this.iterateBatchResults(parseJsonLines(stream))
3268
+ );
3269
+ }
3270
+ async retrieveBatch(options) {
3271
+ const { value: operation } = await getFromApi({
3272
+ url: `${this.batchConfig.baseURL}/${options.batchId}`,
3273
+ headers: await this.getHeaders(options.headers),
3274
+ failedResponseHandler: googleFailedResponseHandler,
3275
+ successfulResponseHandler: createJsonResponseHandler3(
3276
+ googleBatchOperationSchema
3277
+ ),
3278
+ abortSignal: options.abortSignal,
3279
+ fetch: this.batchConfig.fetch,
3280
+ validateUrl: false
3281
+ });
3282
+ return operation;
3283
+ }
3284
+ async *iterateBatchResults(results) {
3285
+ var _a, _b, _c;
3286
+ for await (const line of results) {
3287
+ if (line.error != null) {
3288
+ const error = convertGoogleRpcError(
3289
+ line.error,
3290
+ "Google batch request failed."
3291
+ );
3292
+ const status = line.error.status === "CANCELLED" || String(line.error.code) === "1" ? "cancelled" : "failed";
3293
+ yield { id: line.key, status, error };
3294
+ continue;
3295
+ }
3296
+ if (line.response == null) {
3297
+ yield {
3298
+ id: line.key,
3299
+ status: "failed",
3300
+ error: {
3301
+ message: "Google returned a batch result without a response or error.",
3302
+ code: "invalid_batch_result"
3303
+ }
3304
+ };
3305
+ continue;
3306
+ }
3307
+ const preview = await safeValidateTypes({
3308
+ value: line.response,
3309
+ schema: googleBatchResponsePreviewSchema
3310
+ });
3311
+ if (preview.success && (preview.value.candidates == null || preview.value.candidates.length === 0)) {
3312
+ const promptFeedback = (_a = preview.value.promptFeedback) != null ? _a : void 0;
3313
+ const blockReason = (_b = promptFeedback == null ? void 0 : promptFeedback.blockReason) != null ? _b : void 0;
3314
+ yield {
3315
+ id: line.key,
3316
+ status: "failed",
3317
+ error: {
3318
+ message: blockReason == null ? "Google returned a batch response without any candidates." : `Google blocked the batch request (${blockReason}).`,
3319
+ code: blockReason == null ? "invalid_response" : "prompt_blocked",
3320
+ ...blockReason != null ? { type: blockReason } : {}
3321
+ },
3322
+ ...promptFeedback != null ? {
3323
+ providerMetadata: {
3324
+ google: {
3325
+ promptFeedback: {
3326
+ blockReason: (_c = promptFeedback.blockReason) != null ? _c : null
3327
+ }
3328
+ }
3329
+ }
3330
+ } : {}
3331
+ };
3332
+ continue;
3333
+ }
3334
+ const response = await safeValidateTypes({
3335
+ value: line.response,
3336
+ schema: responseSchema
3337
+ });
3338
+ if (!response.success) {
3339
+ yield {
3340
+ id: line.key,
3341
+ status: "failed",
3342
+ error: {
3343
+ message: "Google returned an invalid GenerateContent batch result.",
3344
+ code: "invalid_response"
3345
+ }
3346
+ };
3347
+ continue;
3348
+ }
3349
+ const result = this.convertGenerateContentResponse({
3350
+ response: response.value,
3351
+ warnings: [],
3352
+ providerOptionsNames: ["google"]
3353
+ });
3354
+ const unsupportedPart = result.content.find(
3355
+ (part) => !supportedGoogleBatchContentTypes.has(part.type)
3356
+ );
3357
+ if (unsupportedPart != null) {
3358
+ yield {
3359
+ id: line.key,
3360
+ status: "failed",
3361
+ error: {
3362
+ message: `Google returned a "${unsupportedPart.type}" content block, but that content is not supported in AI SDK text batches.`,
3363
+ code: "unsupported_content"
3364
+ }
3365
+ };
3366
+ continue;
3367
+ }
3368
+ yield { id: line.key, status: "succeeded", result };
3369
+ }
3370
+ }
3371
+ async getHeaders(headers) {
3372
+ return combineHeaders3(
3373
+ this.batchConfig.headers ? await resolve3(this.batchConfig.headers) : void 0,
3374
+ headers
3375
+ );
3376
+ }
3377
+ getBaseOrigin() {
3378
+ return this.batchConfig.baseURL.replace(/\/v1beta$/, "");
3379
+ }
3380
+ };
3381
+ function convertGoogleBatchStatus(operation) {
3382
+ var _a, _b, _c, _d, _e, _f;
3383
+ const rawStatus = (_b = (_a = operation.metadata) == null ? void 0 : _a.state) != null ? _b : void 0;
3384
+ const requestCounts = convertGoogleRequestCounts(
3385
+ (_c = operation.metadata) == null ? void 0 : _c.batchStats
3386
+ );
3387
+ const createdAt = (_e = (_d = operation.metadata) == null ? void 0 : _d.createTime) != null ? _e : void 0;
3388
+ const error = operation.error != null ? convertGoogleRpcError(operation.error, "Google batch failed.") : void 0;
3389
+ return {
3390
+ status: mapGoogleBatchStatus({
3391
+ rawStatus,
3392
+ done: (_f = operation.done) != null ? _f : void 0,
3393
+ hasError: error != null
3394
+ }),
3395
+ ...rawStatus != null ? { rawStatus } : {},
3396
+ ...requestCounts != null ? { requestCounts } : {},
3397
+ ...error != null ? { error } : {},
3398
+ ...createdAt != null ? { createdAt } : {}
3399
+ };
3400
+ }
3401
+ function mapGoogleBatchStatus({
3402
+ rawStatus,
3403
+ done,
3404
+ hasError
3405
+ }) {
3406
+ if (hasError) {
3407
+ return "failed";
3408
+ }
3409
+ if (rawStatus == null) {
3410
+ return done ? "completed" : "pending";
3411
+ }
3412
+ const normalizedStatus = rawStatus.replace(/^(?:BATCH|JOB)_STATE_/, "");
3413
+ switch (normalizedStatus) {
3414
+ case "SUCCEEDED":
3415
+ return "completed";
3416
+ case "FAILED":
3417
+ case "CANCELLED":
3418
+ case "EXPIRED":
3419
+ return "failed";
3420
+ case "UNSPECIFIED":
3421
+ case "PENDING":
3422
+ case "RUNNING":
3423
+ default:
3424
+ return "pending";
3425
+ }
3426
+ }
3427
+ function convertGoogleRequestCounts(counts) {
3428
+ var _a, _b, _c;
3429
+ const total = parseCount(counts == null ? void 0 : counts.requestCount);
3430
+ const completed = parseCount((_a = counts == null ? void 0 : counts.successfulRequestCount) != null ? _a : 0);
3431
+ const failed = parseCount((_b = counts == null ? void 0 : counts.failedRequestCount) != null ? _b : 0);
3432
+ const pending = parseCount((_c = counts == null ? void 0 : counts.pendingRequestCount) != null ? _c : 0);
3433
+ if (total == null || completed == null || failed == null || pending == null || completed + failed + pending !== total) {
3434
+ return void 0;
3435
+ }
3436
+ return {
3437
+ total,
3438
+ pending,
3439
+ completed,
3440
+ failed
3441
+ };
3442
+ }
3443
+ function parseCount(value) {
3444
+ const count = typeof value === "string" && /^\d+$/.test(value) ? Number(value) : value;
3445
+ return typeof count === "number" && Number.isSafeInteger(count) && count >= 0 ? count : void 0;
3446
+ }
3447
+ function convertGoogleRpcError(error, fallbackMessage) {
3448
+ var _a;
3449
+ return {
3450
+ message: (_a = error.message) != null ? _a : fallbackMessage,
3451
+ ...error.status != null ? { type: error.status } : {},
3452
+ ...error.code != null ? { code: String(error.code) } : {}
3453
+ };
3454
+ }
3455
+ var googleUploadUrlResponseHandler = async ({
3456
+ response
3457
+ }) => {
3458
+ const uploadUrl = response.headers.get("x-goog-upload-url");
3459
+ if (uploadUrl == null) {
3460
+ throw new InvalidResponseDataError({
3461
+ data: response.headers,
3462
+ message: "Google did not return a resumable upload URL."
3463
+ });
3464
+ }
3465
+ return { value: uploadUrl };
3466
+ };
3467
+ var rawStreamResponseHandler = async ({ response }) => {
3468
+ if (response.body == null) {
3469
+ throw new EmptyResponseBodyError();
3470
+ }
3471
+ return { value: response.body };
3472
+ };
3473
+ async function* parseJsonLines(stream) {
3474
+ const reader = stream.getReader();
3475
+ const decoder = new TextDecoder();
3476
+ let buffer = "";
3477
+ let finished = false;
3478
+ try {
3479
+ while (true) {
3480
+ const { done, value } = await reader.read();
3481
+ if (done) {
3482
+ finished = true;
3483
+ buffer += decoder.decode();
3484
+ break;
3485
+ }
3486
+ buffer += decoder.decode(value, { stream: true });
3487
+ let lineEnd = buffer.indexOf("\n");
3488
+ while (lineEnd !== -1) {
3489
+ const line = buffer.slice(0, lineEnd).replace(/\r$/, "");
3490
+ buffer = buffer.slice(lineEnd + 1);
3491
+ if (line.trim().length > 0) {
3492
+ yield await parseJSON({
3493
+ text: line,
3494
+ schema: googleBatchResultLineSchema
3495
+ });
3496
+ }
3497
+ lineEnd = buffer.indexOf("\n");
3498
+ }
3499
+ }
3500
+ const finalLine = buffer.replace(/\r$/, "");
3501
+ if (finalLine.trim().length > 0) {
3502
+ yield await parseJSON({
3503
+ text: finalLine,
3504
+ schema: googleBatchResultLineSchema
3505
+ });
3506
+ }
3507
+ } finally {
3508
+ if (!finished) {
3509
+ await reader.cancel().catch(() => {
3510
+ });
3511
+ }
3512
+ reader.releaseLock();
3513
+ }
3514
+ }
3515
+
2928
3516
  // src/tool/code-execution.ts
2929
3517
  import { createProviderExecutedToolFactory } from "@ai-sdk/provider-utils";
2930
- import { z as z6 } from "zod/v4";
3518
+ import { z as z7 } from "zod/v4";
2931
3519
  var codeExecution = createProviderExecutedToolFactory({
2932
3520
  id: "google.code_execution",
2933
- inputSchema: z6.object({
2934
- language: z6.string().describe("The programming language of the code."),
2935
- code: z6.string().describe("The code to be executed.")
3521
+ inputSchema: z7.object({
3522
+ language: z7.string().describe("The programming language of the code."),
3523
+ code: z7.string().describe("The code to be executed.")
2936
3524
  }),
2937
- outputSchema: z6.object({
2938
- outcome: z6.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
2939
- output: z6.string().describe("The output from the code execution.")
3525
+ outputSchema: z7.object({
3526
+ outcome: z7.string().describe('The outcome of the execution (e.g., "OUTCOME_OK").'),
3527
+ output: z7.string().describe("The output from the code execution.")
2940
3528
  })
2941
3529
  });
2942
3530
 
2943
3531
  // src/tool/enterprise-web-search.ts
2944
3532
  import {
2945
3533
  createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
2946
- lazySchema as lazySchema6,
2947
- zodSchema as zodSchema6
3534
+ lazySchema as lazySchema7,
3535
+ zodSchema as zodSchema7
2948
3536
  } from "@ai-sdk/provider-utils";
2949
- import { z as z7 } from "zod/v4";
3537
+ import { z as z8 } from "zod/v4";
2950
3538
  var enterpriseWebSearch = createProviderExecutedToolFactory2({
2951
3539
  id: "google.enterprise_web_search",
2952
- inputSchema: lazySchema6(() => zodSchema6(z7.object({}))),
2953
- outputSchema: lazySchema6(() => zodSchema6(z7.object({})))
3540
+ inputSchema: lazySchema7(() => zodSchema7(z8.object({}))),
3541
+ outputSchema: lazySchema7(() => zodSchema7(z8.object({})))
2954
3542
  });
2955
3543
 
2956
3544
  // src/tool/file-search.ts
2957
3545
  import {
2958
3546
  createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
2959
- lazySchema as lazySchema7,
2960
- zodSchema as zodSchema7
3547
+ lazySchema as lazySchema8,
3548
+ zodSchema as zodSchema8
2961
3549
  } from "@ai-sdk/provider-utils";
2962
- import { z as z8 } from "zod/v4";
2963
- var fileSearchArgsBaseSchema = z8.looseObject({
3550
+ import { z as z9 } from "zod/v4";
3551
+ var fileSearchArgsBaseSchema = z9.looseObject({
2964
3552
  /** The names of the file_search_stores to retrieve from.
2965
3553
  * Example: `fileSearchStores/my-file-search-store-123`
2966
3554
  */
2967
- fileSearchStoreNames: z8.array(z8.string()).describe(
3555
+ fileSearchStoreNames: z9.array(z9.string()).describe(
2968
3556
  "The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`"
2969
3557
  ),
2970
3558
  /** The number of file search retrieval chunks to retrieve. */
2971
- topK: z8.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
3559
+ topK: z9.number().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
2972
3560
  /** Metadata filter to apply to the file search retrieval documents.
2973
3561
  * See https://google.aip.dev/160 for the syntax of the filter expression.
2974
3562
  */
2975
- metadataFilter: z8.string().describe(
3563
+ metadataFilter: z9.string().describe(
2976
3564
  "Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
2977
3565
  ).optional()
2978
3566
  });
2979
3567
  var fileSearch = createProviderExecutedToolFactory3({
2980
3568
  id: "google.file_search",
2981
- inputSchema: lazySchema7(() => zodSchema7(z8.object({}))),
2982
- outputSchema: lazySchema7(() => zodSchema7(z8.object({})))
3569
+ inputSchema: lazySchema8(() => zodSchema8(z9.object({}))),
3570
+ outputSchema: lazySchema8(() => zodSchema8(z9.object({})))
2983
3571
  });
2984
3572
 
2985
3573
  // src/tool/google-maps.ts
2986
3574
  import {
2987
3575
  createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
2988
- lazySchema as lazySchema8,
2989
- zodSchema as zodSchema8
3576
+ lazySchema as lazySchema9,
3577
+ zodSchema as zodSchema9
2990
3578
  } from "@ai-sdk/provider-utils";
2991
- import { z as z9 } from "zod/v4";
3579
+ import { z as z10 } from "zod/v4";
2992
3580
  var googleMaps = createProviderExecutedToolFactory4({
2993
3581
  id: "google.google_maps",
2994
- inputSchema: lazySchema8(() => zodSchema8(z9.object({}))),
2995
- outputSchema: lazySchema8(() => zodSchema8(z9.object({})))
3582
+ inputSchema: lazySchema9(() => zodSchema9(z10.object({}))),
3583
+ outputSchema: lazySchema9(() => zodSchema9(z10.object({})))
2996
3584
  });
2997
3585
 
2998
3586
  // src/tool/google-search.ts
2999
3587
  import {
3000
3588
  createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
3001
- lazySchema as lazySchema9,
3002
- zodSchema as zodSchema9
3589
+ lazySchema as lazySchema10,
3590
+ zodSchema as zodSchema10
3003
3591
  } from "@ai-sdk/provider-utils";
3004
- import { z as z10 } from "zod/v4";
3005
- var googleSearchToolArgsBaseSchema = z10.looseObject({
3006
- searchTypes: z10.object({
3007
- webSearch: z10.object({}).optional(),
3008
- imageSearch: z10.object({}).optional()
3592
+ import { z as z11 } from "zod/v4";
3593
+ var googleSearchToolArgsBaseSchema = z11.looseObject({
3594
+ searchTypes: z11.object({
3595
+ webSearch: z11.object({}).optional(),
3596
+ imageSearch: z11.object({}).optional()
3009
3597
  }).optional(),
3010
- timeRangeFilter: z10.object({
3011
- startTime: z10.string(),
3012
- endTime: z10.string()
3598
+ timeRangeFilter: z11.object({
3599
+ startTime: z11.string(),
3600
+ endTime: z11.string()
3013
3601
  }).optional()
3014
3602
  });
3015
3603
  var googleSearch = createProviderExecutedToolFactory5({
3016
3604
  id: "google.google_search",
3017
- inputSchema: lazySchema9(() => zodSchema9(z10.object({}))),
3018
- outputSchema: lazySchema9(() => zodSchema9(z10.object({})))
3605
+ inputSchema: lazySchema10(() => zodSchema10(z11.object({}))),
3606
+ outputSchema: lazySchema10(() => zodSchema10(z11.object({})))
3019
3607
  });
3020
3608
 
3021
3609
  // src/tool/url-context.ts
3022
3610
  import {
3023
3611
  createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
3024
- lazySchema as lazySchema10,
3025
- zodSchema as zodSchema10
3612
+ lazySchema as lazySchema11,
3613
+ zodSchema as zodSchema11
3026
3614
  } from "@ai-sdk/provider-utils";
3027
- import { z as z11 } from "zod/v4";
3615
+ import { z as z12 } from "zod/v4";
3028
3616
  var urlContext = createProviderExecutedToolFactory6({
3029
3617
  id: "google.url_context",
3030
- inputSchema: lazySchema10(() => zodSchema10(z11.object({}))),
3031
- outputSchema: lazySchema10(() => zodSchema10(z11.object({})))
3618
+ inputSchema: lazySchema11(() => zodSchema11(z12.object({}))),
3619
+ outputSchema: lazySchema11(() => zodSchema11(z12.object({})))
3032
3620
  });
3033
3621
 
3034
3622
  // src/tool/vertex-rag-store.ts
3035
3623
  import {
3036
3624
  createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
3037
- lazySchema as lazySchema11,
3038
- zodSchema as zodSchema11
3625
+ lazySchema as lazySchema12,
3626
+ zodSchema as zodSchema12
3039
3627
  } from "@ai-sdk/provider-utils";
3040
- import { z as z12 } from "zod/v4";
3628
+ import { z as z13 } from "zod/v4";
3041
3629
  var vertexRagStore = createProviderExecutedToolFactory7({
3042
3630
  id: "google.vertex_rag_store",
3043
- inputSchema: lazySchema11(() => zodSchema11(z12.object({}))),
3044
- outputSchema: lazySchema11(() => zodSchema11(z12.object({})))
3631
+ inputSchema: lazySchema12(() => zodSchema12(z13.object({}))),
3632
+ outputSchema: lazySchema12(() => zodSchema12(z13.object({})))
3045
3633
  });
3046
3634
 
3047
3635
  // src/google-tools.ts
@@ -3110,16 +3698,16 @@ import {
3110
3698
  generateId as defaultGenerateId,
3111
3699
  parseProviderOptions as parseProviderOptions3,
3112
3700
  serializeModelOptions as serializeModelOptions3,
3113
- WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE3,
3114
- WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE3
3701
+ WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE4,
3702
+ WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE4
3115
3703
  } from "@ai-sdk/provider-utils";
3116
3704
 
3117
3705
  // src/google-image-model-options.ts
3118
- import { lazySchema as lazySchema12, zodSchema as zodSchema12 } from "@ai-sdk/provider-utils";
3119
- import { z as z13 } from "zod/v4";
3120
- var googleImageModelOptionsSchema = lazySchema12(
3121
- () => zodSchema12(
3122
- z13.object({
3706
+ import { lazySchema as lazySchema13, zodSchema as zodSchema13 } from "@ai-sdk/provider-utils";
3707
+ import { z as z14 } from "zod/v4";
3708
+ var googleImageModelOptionsSchema = lazySchema13(
3709
+ () => zodSchema13(
3710
+ z14.object({
3123
3711
  /**
3124
3712
  * Enable Google Search grounding for Gemini image models. The value is
3125
3713
  * forwarded as the args of the `google.tools.googleSearch` provider
@@ -3142,13 +3730,13 @@ var GoogleImageModel = class _GoogleImageModel {
3142
3730
  this.config = config;
3143
3731
  this.specificationVersion = "v4";
3144
3732
  }
3145
- static [WORKFLOW_SERIALIZE3](model) {
3733
+ static [WORKFLOW_SERIALIZE4](model) {
3146
3734
  return serializeModelOptions3({
3147
3735
  modelId: model.modelId,
3148
3736
  config: model.config
3149
3737
  });
3150
3738
  }
3151
- static [WORKFLOW_DESERIALIZE3](options) {
3739
+ static [WORKFLOW_DESERIALIZE4](options) {
3152
3740
  return new _GoogleImageModel(options.modelId, {}, options.config);
3153
3741
  }
3154
3742
  get maxImagesPerCall() {
@@ -3304,16 +3892,16 @@ import {
3304
3892
  AISDKError
3305
3893
  } from "@ai-sdk/provider";
3306
3894
  import {
3307
- combineHeaders as combineHeaders3,
3895
+ combineHeaders as combineHeaders4,
3308
3896
  convertInlineFileDataToUint8Array,
3309
- createJsonResponseHandler as createJsonResponseHandler3,
3897
+ createJsonResponseHandler as createJsonResponseHandler4,
3310
3898
  delay,
3311
- lazySchema as lazySchema13,
3899
+ lazySchema as lazySchema14,
3312
3900
  parseProviderOptions as parseProviderOptions4,
3313
- zodSchema as zodSchema13,
3314
- getFromApi
3901
+ zodSchema as zodSchema14,
3902
+ getFromApi as getFromApi2
3315
3903
  } from "@ai-sdk/provider-utils";
3316
- import { z as z14 } from "zod/v4";
3904
+ import { z as z15 } from "zod/v4";
3317
3905
  var GoogleFiles = class {
3318
3906
  constructor(config) {
3319
3907
  this.config = config;
@@ -3397,11 +3985,11 @@ var GoogleFiles = class {
3397
3985
  });
3398
3986
  }
3399
3987
  await delay(pollIntervalMs);
3400
- const { value: fileStatus } = await getFromApi({
3988
+ const { value: fileStatus } = await getFromApi2({
3401
3989
  url: `${this.config.baseURL}/${file.name}`,
3402
3990
  validateUrl: false,
3403
- headers: combineHeaders3(resolvedHeaders),
3404
- successfulResponseHandler: createJsonResponseHandler3(
3991
+ headers: combineHeaders4(resolvedHeaders),
3992
+ successfulResponseHandler: createJsonResponseHandler4(
3405
3993
  googleFileResponseSchema
3406
3994
  ),
3407
3995
  failedResponseHandler: googleFailedResponseHandler,
@@ -3436,28 +4024,28 @@ var GoogleFiles = class {
3436
4024
  };
3437
4025
  }
3438
4026
  };
3439
- var googleFileResponseSchema = lazySchema13(
3440
- () => zodSchema13(
3441
- z14.object({
3442
- name: z14.string(),
3443
- displayName: z14.string().nullish(),
3444
- mimeType: z14.string(),
3445
- sizeBytes: z14.string().nullish(),
3446
- createTime: z14.string().nullish(),
3447
- updateTime: z14.string().nullish(),
3448
- expirationTime: z14.string().nullish(),
3449
- sha256Hash: z14.string().nullish(),
3450
- uri: z14.string(),
3451
- state: z14.string()
4027
+ var googleFileResponseSchema = lazySchema14(
4028
+ () => zodSchema14(
4029
+ z15.object({
4030
+ name: z15.string(),
4031
+ displayName: z15.string().nullish(),
4032
+ mimeType: z15.string(),
4033
+ sizeBytes: z15.string().nullish(),
4034
+ createTime: z15.string().nullish(),
4035
+ updateTime: z15.string().nullish(),
4036
+ expirationTime: z15.string().nullish(),
4037
+ sha256Hash: z15.string().nullish(),
4038
+ uri: z15.string(),
4039
+ state: z15.string()
3452
4040
  })
3453
4041
  )
3454
4042
  );
3455
- var googleFilesUploadOptionsSchema = lazySchema13(
3456
- () => zodSchema13(
3457
- z14.looseObject({
3458
- displayName: z14.string().nullish(),
3459
- pollIntervalMs: z14.number().positive().nullish(),
3460
- pollTimeoutMs: z14.number().positive().nullish()
4043
+ var googleFilesUploadOptionsSchema = lazySchema14(
4044
+ () => zodSchema14(
4045
+ z15.looseObject({
4046
+ displayName: z15.string().nullish(),
4047
+ pollIntervalMs: z15.number().positive().nullish(),
4048
+ pollTimeoutMs: z15.number().positive().nullish()
3461
4049
  })
3462
4050
  )
3463
4051
  );
@@ -3467,31 +4055,31 @@ import {
3467
4055
  AISDKError as AISDKError2
3468
4056
  } from "@ai-sdk/provider";
3469
4057
  import {
3470
- combineHeaders as combineHeaders4,
4058
+ combineHeaders as combineHeaders5,
3471
4059
  convertUint8ArrayToBase64,
3472
- createJsonResponseHandler as createJsonResponseHandler4,
3473
- getFromApi as getFromApi2,
4060
+ createJsonResponseHandler as createJsonResponseHandler5,
4061
+ getFromApi as getFromApi3,
3474
4062
  isSameOrigin,
3475
4063
  parseProviderOptions as parseProviderOptions5,
3476
- postJsonToApi as postJsonToApi3,
3477
- resolve as resolve3
4064
+ postJsonToApi as postJsonToApi4,
4065
+ resolve as resolve4
3478
4066
  } from "@ai-sdk/provider-utils";
3479
- import { z as z16 } from "zod/v4";
4067
+ import { z as z17 } from "zod/v4";
3480
4068
 
3481
4069
  // src/google-video-model-options.ts
3482
- import { lazySchema as lazySchema14, zodSchema as zodSchema14 } from "@ai-sdk/provider-utils";
3483
- import { z as z15 } from "zod/v4";
3484
- var googleVideoModelOptionsSchema = lazySchema14(
3485
- () => zodSchema14(
3486
- z15.looseObject({
3487
- pollIntervalMs: z15.number().positive().nullish(),
3488
- pollTimeoutMs: z15.number().positive().nullish(),
3489
- personGeneration: z15.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
3490
- negativePrompt: z15.string().nullish(),
3491
- referenceImages: z15.array(
3492
- z15.object({
3493
- bytesBase64Encoded: z15.string().nullish(),
3494
- gcsUri: z15.string().nullish()
4070
+ import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
4071
+ import { z as z16 } from "zod/v4";
4072
+ var googleVideoModelOptionsSchema = lazySchema15(
4073
+ () => zodSchema15(
4074
+ z16.looseObject({
4075
+ pollIntervalMs: z16.number().positive().nullish(),
4076
+ pollTimeoutMs: z16.number().positive().nullish(),
4077
+ personGeneration: z16.enum(["dont_allow", "allow_adult", "allow_all"]).nullish(),
4078
+ negativePrompt: z16.string().nullish(),
4079
+ referenceImages: z16.array(
4080
+ z16.object({
4081
+ bytesBase64Encoded: z16.string().nullish(),
4082
+ gcsUri: z16.string().nullish()
3495
4083
  })
3496
4084
  ).nullish()
3497
4085
  })
@@ -3665,7 +4253,7 @@ var GoogleVideoModel = class {
3665
4253
  }
3666
4254
  const videos = [];
3667
4255
  const videoMetadata = [];
3668
- const resolvedHeaders = await resolve3(this.config.headers);
4256
+ const resolvedHeaders = await resolve4(this.config.headers);
3669
4257
  const apiKey = resolvedHeaders == null ? void 0 : resolvedHeaders["x-goog-api-key"];
3670
4258
  for (const generatedSample of response.generateVideoResponse.generatedSamples) {
3671
4259
  if ((_b = generatedSample.video) == null ? void 0 : _b.uri) {
@@ -3706,17 +4294,17 @@ var GoogleVideoModel = class {
3706
4294
  var _a, _b, _c;
3707
4295
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
3708
4296
  const { instances, parameters, warnings } = await this.buildRequest(options);
3709
- const { value: operation, responseHeaders } = await postJsonToApi3({
4297
+ const { value: operation, responseHeaders } = await postJsonToApi4({
3710
4298
  url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
3711
- headers: combineHeaders4(
3712
- await resolve3(this.config.headers),
4299
+ headers: combineHeaders5(
4300
+ await resolve4(this.config.headers),
3713
4301
  options.headers
3714
4302
  ),
3715
4303
  body: {
3716
4304
  instances,
3717
4305
  parameters
3718
4306
  },
3719
- successfulResponseHandler: createJsonResponseHandler4(
4307
+ successfulResponseHandler: createJsonResponseHandler5(
3720
4308
  googleOperationSchema
3721
4309
  ),
3722
4310
  failedResponseHandler: googleFailedResponseHandler,
@@ -3744,14 +4332,14 @@ var GoogleVideoModel = class {
3744
4332
  var _a, _b, _c;
3745
4333
  const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
3746
4334
  const { operationName } = options.operation;
3747
- const { value: statusOperation, responseHeaders } = await getFromApi2({
4335
+ const { value: statusOperation, responseHeaders } = await getFromApi3({
3748
4336
  url: `${this.config.baseURL}/${operationName}`,
3749
4337
  validateUrl: false,
3750
- headers: combineHeaders4(
3751
- await resolve3(this.config.headers),
4338
+ headers: combineHeaders5(
4339
+ await resolve4(this.config.headers),
3752
4340
  options.headers
3753
4341
  ),
3754
- successfulResponseHandler: createJsonResponseHandler4(
4342
+ successfulResponseHandler: createJsonResponseHandler5(
3755
4343
  googleOperationSchema
3756
4344
  ),
3757
4345
  failedResponseHandler: googleFailedResponseHandler,
@@ -3787,20 +4375,20 @@ var GoogleVideoModel = class {
3787
4375
  );
3788
4376
  }
3789
4377
  };
3790
- var googleOperationSchema = z16.object({
3791
- name: z16.string().nullish(),
3792
- done: z16.boolean().nullish(),
3793
- error: z16.object({
3794
- code: z16.number().nullish(),
3795
- message: z16.string(),
3796
- status: z16.string().nullish()
4378
+ var googleOperationSchema = z17.object({
4379
+ name: z17.string().nullish(),
4380
+ done: z17.boolean().nullish(),
4381
+ error: z17.object({
4382
+ code: z17.number().nullish(),
4383
+ message: z17.string(),
4384
+ status: z17.string().nullish()
3797
4385
  }).nullish(),
3798
- response: z16.object({
3799
- generateVideoResponse: z16.object({
3800
- generatedSamples: z16.array(
3801
- z16.object({
3802
- video: z16.object({
3803
- uri: z16.string().nullish()
4386
+ response: z17.object({
4387
+ generateVideoResponse: z17.object({
4388
+ generatedSamples: z17.array(
4389
+ z17.object({
4390
+ video: z17.object({
4391
+ uri: z17.string().nullish()
3804
4392
  }).nullish()
3805
4393
  })
3806
4394
  ).nullish()
@@ -3810,31 +4398,31 @@ var googleOperationSchema = z16.object({
3810
4398
 
3811
4399
  // src/google-speech-model.ts
3812
4400
  import {
3813
- combineHeaders as combineHeaders5,
4401
+ combineHeaders as combineHeaders6,
3814
4402
  convertBase64ToUint8Array,
3815
- createJsonResponseHandler as createJsonResponseHandler5,
4403
+ createJsonResponseHandler as createJsonResponseHandler6,
3816
4404
  parseProviderOptions as parseProviderOptions6,
3817
- postJsonToApi as postJsonToApi4,
3818
- resolve as resolve4,
4405
+ postJsonToApi as postJsonToApi5,
4406
+ resolve as resolve5,
3819
4407
  serializeModelOptions as serializeModelOptions4,
3820
- WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE4,
3821
- WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE4
4408
+ WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE5,
4409
+ WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE5
3822
4410
  } from "@ai-sdk/provider-utils";
3823
4411
 
3824
4412
  // src/google-speech-api.ts
3825
- import { lazySchema as lazySchema15, zodSchema as zodSchema15 } from "@ai-sdk/provider-utils";
3826
- import { z as z17 } from "zod/v4";
3827
- var googleSpeechResponseSchema = lazySchema15(
3828
- () => zodSchema15(
3829
- z17.object({
3830
- candidates: z17.array(
3831
- z17.object({
3832
- content: z17.object({
3833
- parts: z17.array(
3834
- z17.object({
3835
- inlineData: z17.object({
3836
- mimeType: z17.string().nullish(),
3837
- data: z17.string().nullish()
4413
+ import { lazySchema as lazySchema16, zodSchema as zodSchema16 } from "@ai-sdk/provider-utils";
4414
+ import { z as z18 } from "zod/v4";
4415
+ var googleSpeechResponseSchema = lazySchema16(
4416
+ () => zodSchema16(
4417
+ z18.object({
4418
+ candidates: z18.array(
4419
+ z18.object({
4420
+ content: z18.object({
4421
+ parts: z18.array(
4422
+ z18.object({
4423
+ inlineData: z18.object({
4424
+ mimeType: z18.string().nullish(),
4425
+ data: z18.string().nullish()
3838
4426
  }).nullish()
3839
4427
  })
3840
4428
  ).nullish()
@@ -3847,19 +4435,19 @@ var googleSpeechResponseSchema = lazySchema15(
3847
4435
 
3848
4436
  // src/google-speech-model-options.ts
3849
4437
  import {
3850
- lazySchema as lazySchema16,
3851
- zodSchema as zodSchema16
4438
+ lazySchema as lazySchema17,
4439
+ zodSchema as zodSchema17
3852
4440
  } from "@ai-sdk/provider-utils";
3853
- import { z as z18 } from "zod/v4";
3854
- var prebuiltVoiceConfigSchema = z18.object({
3855
- voiceName: z18.string()
4441
+ import { z as z19 } from "zod/v4";
4442
+ var prebuiltVoiceConfigSchema = z19.object({
4443
+ voiceName: z19.string()
3856
4444
  });
3857
- var voiceConfigSchema = z18.object({
4445
+ var voiceConfigSchema = z19.object({
3858
4446
  prebuiltVoiceConfig: prebuiltVoiceConfigSchema
3859
4447
  });
3860
- var googleSpeechProviderOptionsSchema = lazySchema16(
3861
- () => zodSchema16(
3862
- z18.object({
4448
+ var googleSpeechProviderOptionsSchema = lazySchema17(
4449
+ () => zodSchema17(
4450
+ z19.object({
3863
4451
  /**
3864
4452
  * Multi-speaker configuration for dialogue audio. When provided, this
3865
4453
  * overrides the top-level `voice`. The Gemini TTS API supports up to two
@@ -3867,10 +4455,10 @@ var googleSpeechProviderOptionsSchema = lazySchema16(
3867
4455
  *
3868
4456
  * https://ai.google.dev/gemini-api/docs/speech-generation#multi-speaker
3869
4457
  */
3870
- multiSpeakerVoiceConfig: z18.object({
3871
- speakerVoiceConfigs: z18.array(
3872
- z18.object({
3873
- speaker: z18.string(),
4458
+ multiSpeakerVoiceConfig: z19.object({
4459
+ speakerVoiceConfigs: z19.array(
4460
+ z19.object({
4461
+ speaker: z19.string(),
3874
4462
  voiceConfig: voiceConfigSchema
3875
4463
  })
3876
4464
  )
@@ -3888,13 +4476,13 @@ var GoogleSpeechModel = class _GoogleSpeechModel {
3888
4476
  this.config = config;
3889
4477
  this.specificationVersion = "v4";
3890
4478
  }
3891
- static [WORKFLOW_SERIALIZE4](model) {
4479
+ static [WORKFLOW_SERIALIZE5](model) {
3892
4480
  return serializeModelOptions4({
3893
4481
  modelId: model.modelId,
3894
4482
  config: model.config
3895
4483
  });
3896
4484
  }
3897
- static [WORKFLOW_DESERIALIZE4](options) {
4485
+ static [WORKFLOW_DESERIALIZE5](options) {
3898
4486
  return new _GoogleSpeechModel(options.modelId, options.config);
3899
4487
  }
3900
4488
  get provider() {
@@ -3984,15 +4572,15 @@ var GoogleSpeechModel = class _GoogleSpeechModel {
3984
4572
  value: response,
3985
4573
  responseHeaders,
3986
4574
  rawValue: rawResponse
3987
- } = await postJsonToApi4({
4575
+ } = await postJsonToApi5({
3988
4576
  url: `${this.config.baseURL}/models/${this.modelId}:generateContent`,
3989
- headers: combineHeaders5(
3990
- this.config.headers ? await resolve4(this.config.headers) : void 0,
4577
+ headers: combineHeaders6(
4578
+ this.config.headers ? await resolve5(this.config.headers) : void 0,
3991
4579
  options.headers
3992
4580
  ),
3993
4581
  body: requestBody,
3994
4582
  failedResponseHandler: googleFailedResponseHandler,
3995
- successfulResponseHandler: createJsonResponseHandler5(
4583
+ successfulResponseHandler: createJsonResponseHandler6(
3996
4584
  googleSpeechResponseSchema
3997
4585
  ),
3998
4586
  abortSignal: options.abortSignal,
@@ -4083,16 +4671,16 @@ function writeAscii(view, offset, text) {
4083
4671
 
4084
4672
  // src/interactions/google-interactions-language-model.ts
4085
4673
  import {
4086
- combineHeaders as combineHeaders7,
4674
+ combineHeaders as combineHeaders8,
4087
4675
  createEventSourceResponseHandler as createEventSourceResponseHandler3,
4088
- createJsonResponseHandler as createJsonResponseHandler7,
4676
+ createJsonResponseHandler as createJsonResponseHandler8,
4089
4677
  generateId as defaultGenerateId2,
4090
4678
  parseProviderOptions as parseProviderOptions7,
4091
- postJsonToApi as postJsonToApi5,
4092
- resolve as resolve5,
4679
+ postJsonToApi as postJsonToApi6,
4680
+ resolve as resolve6,
4093
4681
  serializeModelOptions as serializeModelOptions5,
4094
- WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE5,
4095
- WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE5
4682
+ WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE6,
4683
+ WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE6
4096
4684
  } from "@ai-sdk/provider-utils";
4097
4685
 
4098
4686
  // src/interactions/convert-google-interactions-usage.ts
@@ -4158,7 +4746,7 @@ function basename(uriOrName) {
4158
4746
  }
4159
4747
  function annotationToSource({
4160
4748
  annotation,
4161
- generateId: generateId3
4749
+ generateId: generateId4
4162
4750
  }) {
4163
4751
  var _a, _b, _c, _d, _e;
4164
4752
  switch (annotation.type) {
@@ -4170,7 +4758,7 @@ function annotationToSource({
4170
4758
  return {
4171
4759
  type: "source",
4172
4760
  sourceType: "url",
4173
- id: generateId3(),
4761
+ id: generateId4(),
4174
4762
  url: urlCitation.url,
4175
4763
  ...urlCitation.title != null ? { title: urlCitation.title } : {}
4176
4764
  };
@@ -4183,7 +4771,7 @@ function annotationToSource({
4183
4771
  return {
4184
4772
  type: "source",
4185
4773
  sourceType: "url",
4186
- id: generateId3(),
4774
+ id: generateId4(),
4187
4775
  url: uri,
4188
4776
  ...fileCitation.file_name != null ? { title: fileCitation.file_name } : {}
4189
4777
  };
@@ -4193,7 +4781,7 @@ function annotationToSource({
4193
4781
  return {
4194
4782
  type: "source",
4195
4783
  sourceType: "document",
4196
- id: generateId3(),
4784
+ id: generateId4(),
4197
4785
  mediaType,
4198
4786
  title: (_e = (_d = fileCitation.file_name) != null ? _d : filename) != null ? _e : uri,
4199
4787
  ...filename != null ? { filename } : {}
@@ -4207,7 +4795,7 @@ function annotationToSource({
4207
4795
  return {
4208
4796
  type: "source",
4209
4797
  sourceType: "url",
4210
- id: generateId3(),
4798
+ id: generateId4(),
4211
4799
  url: placeCitation.url,
4212
4800
  ...placeCitation.name != null ? { title: placeCitation.name } : {}
4213
4801
  };
@@ -4218,7 +4806,7 @@ function annotationToSource({
4218
4806
  }
4219
4807
  function builtinToolResultToSources({
4220
4808
  block,
4221
- generateId: generateId3
4809
+ generateId: generateId4
4222
4810
  }) {
4223
4811
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
4224
4812
  const sources = [];
@@ -4231,7 +4819,7 @@ function builtinToolResultToSources({
4231
4819
  sources.push({
4232
4820
  type: "source",
4233
4821
  sourceType: "url",
4234
- id: generateId3(),
4822
+ id: generateId4(),
4235
4823
  url: entry.url
4236
4824
  });
4237
4825
  }
@@ -4245,7 +4833,7 @@ function builtinToolResultToSources({
4245
4833
  sources.push({
4246
4834
  type: "source",
4247
4835
  sourceType: "url",
4248
- id: generateId3(),
4836
+ id: generateId4(),
4249
4837
  url,
4250
4838
  ...entry.title != null ? { title: entry.title } : {}
4251
4839
  });
@@ -4260,7 +4848,7 @@ function builtinToolResultToSources({
4260
4848
  sources.push({
4261
4849
  type: "source",
4262
4850
  sourceType: "url",
4263
- id: generateId3(),
4851
+ id: generateId4(),
4264
4852
  url: place.url,
4265
4853
  ...place.name != null ? { title: place.name } : {}
4266
4854
  });
@@ -4279,7 +4867,7 @@ function builtinToolResultToSources({
4279
4867
  sources.push({
4280
4868
  type: "source",
4281
4869
  sourceType: "url",
4282
- id: generateId3(),
4870
+ id: generateId4(),
4283
4871
  url: uri,
4284
4872
  ...entry.title != null ? { title: entry.title } : {}
4285
4873
  });
@@ -4290,7 +4878,7 @@ function builtinToolResultToSources({
4290
4878
  sources.push({
4291
4879
  type: "source",
4292
4880
  sourceType: "document",
4293
- id: generateId3(),
4881
+ id: generateId4(),
4294
4882
  mediaType,
4295
4883
  title: (_k = (_j = (_i = entry.title) != null ? _i : entry.file_name) != null ? _j : filename) != null ? _k : uri,
4296
4884
  ...filename != null ? { filename } : {}
@@ -4305,14 +4893,14 @@ function builtinToolResultToSources({
4305
4893
  }
4306
4894
  function annotationsToSources({
4307
4895
  annotations,
4308
- generateId: generateId3
4896
+ generateId: generateId4
4309
4897
  }) {
4310
4898
  var _a;
4311
4899
  if (annotations == null) return [];
4312
4900
  const seen = /* @__PURE__ */ new Set();
4313
4901
  const sources = [];
4314
4902
  for (const annotation of annotations) {
4315
- const source = annotationToSource({ annotation, generateId: generateId3 });
4903
+ const source = annotationToSource({ annotation, generateId: generateId4 });
4316
4904
  if (source == null) continue;
4317
4905
  const key = source.sourceType === "url" ? `url:${source.url}` : `doc:${(_a = source.filename) != null ? _a : source.title}`;
4318
4906
  if (seen.has(key)) continue;
@@ -4369,7 +4957,7 @@ function builtinToolNameFromResultType(type) {
4369
4957
  }
4370
4958
  function buildGoogleInteractionsStreamTransform({
4371
4959
  warnings,
4372
- generateId: generateId3,
4960
+ generateId: generateId4,
4373
4961
  includeRawChunks,
4374
4962
  serviceTier: headerServiceTier
4375
4963
  }) {
@@ -4438,7 +5026,7 @@ function buildGoogleInteractionsStreamTransform({
4438
5026
  controller.enqueue({ type: "text-start", id: blockId });
4439
5027
  const initialSources = annotationsToSources({
4440
5028
  annotations: initial.annotations,
4441
- generateId: generateId3
5029
+ generateId: generateId4
4442
5030
  });
4443
5031
  for (const source of initialSources) {
4444
5032
  const key = sourceKey(source);
@@ -4607,7 +5195,7 @@ function buildGoogleInteractionsStreamTransform({
4607
5195
  } else if (open.kind === "text" && ((delta == null ? void 0 : delta.type) === "text_annotation" || (delta == null ? void 0 : delta.type) === "text_annotation_delta")) {
4608
5196
  const sources = annotationsToSources({
4609
5197
  annotations: delta.annotations,
4610
- generateId: generateId3
5198
+ generateId: generateId4
4611
5199
  });
4612
5200
  for (const source of sources) {
4613
5201
  const key = sourceKey(source);
@@ -4755,7 +5343,7 @@ function buildGoogleInteractionsStreamTransform({
4755
5343
  call_id: open.callId,
4756
5344
  result: open.result
4757
5345
  },
4758
- generateId: generateId3
5346
+ generateId: generateId4
4759
5347
  });
4760
5348
  for (const source of sources) {
4761
5349
  const key = sourceKey(source);
@@ -5225,33 +5813,33 @@ ${block.text}`
5225
5813
 
5226
5814
  // src/interactions/google-interactions-api.ts
5227
5815
  import {
5228
- lazySchema as lazySchema17,
5229
- zodSchema as zodSchema17
5816
+ lazySchema as lazySchema18,
5817
+ zodSchema as zodSchema18
5230
5818
  } from "@ai-sdk/provider-utils";
5231
- import { z as z19 } from "zod/v4";
5232
- var tokenByModalitySchema = () => z19.object({
5233
- modality: z19.string().nullish(),
5234
- tokens: z19.number().nullish()
5819
+ import { z as z20 } from "zod/v4";
5820
+ var tokenByModalitySchema = () => z20.object({
5821
+ modality: z20.string().nullish(),
5822
+ tokens: z20.number().nullish()
5235
5823
  }).loose();
5236
- var usageSchema2 = () => z19.object({
5237
- total_input_tokens: z19.number().nullish(),
5238
- total_output_tokens: z19.number().nullish(),
5239
- total_thought_tokens: z19.number().nullish(),
5240
- total_cached_tokens: z19.number().nullish(),
5241
- total_tool_use_tokens: z19.number().nullish(),
5242
- total_tokens: z19.number().nullish(),
5243
- input_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
5244
- output_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
5245
- cached_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
5246
- tool_use_tokens_by_modality: z19.array(tokenByModalitySchema()).nullish(),
5247
- grounding_tool_count: z19.array(
5248
- z19.object({
5249
- type: z19.string().nullish(),
5250
- count: z19.number().nullish()
5824
+ var usageSchema2 = () => z20.object({
5825
+ total_input_tokens: z20.number().nullish(),
5826
+ total_output_tokens: z20.number().nullish(),
5827
+ total_thought_tokens: z20.number().nullish(),
5828
+ total_cached_tokens: z20.number().nullish(),
5829
+ total_tool_use_tokens: z20.number().nullish(),
5830
+ total_tokens: z20.number().nullish(),
5831
+ input_tokens_by_modality: z20.array(tokenByModalitySchema()).nullish(),
5832
+ output_tokens_by_modality: z20.array(tokenByModalitySchema()).nullish(),
5833
+ cached_tokens_by_modality: z20.array(tokenByModalitySchema()).nullish(),
5834
+ tool_use_tokens_by_modality: z20.array(tokenByModalitySchema()).nullish(),
5835
+ grounding_tool_count: z20.array(
5836
+ z20.object({
5837
+ type: z20.string().nullish(),
5838
+ count: z20.number().nullish()
5251
5839
  }).loose()
5252
5840
  ).nullish()
5253
5841
  }).loose();
5254
- var interactionStatusSchema = () => z19.enum([
5842
+ var interactionStatusSchema = () => z20.enum([
5255
5843
  "in_progress",
5256
5844
  "requires_action",
5257
5845
  "completed",
@@ -5260,69 +5848,69 @@ var interactionStatusSchema = () => z19.enum([
5260
5848
  "incomplete"
5261
5849
  ]);
5262
5850
  var annotationSchema = () => {
5263
- const urlCitation = z19.object({
5264
- type: z19.literal("url_citation"),
5265
- url: z19.string().nullish(),
5266
- title: z19.string().nullish(),
5267
- start_index: z19.number().nullish(),
5268
- end_index: z19.number().nullish()
5851
+ const urlCitation = z20.object({
5852
+ type: z20.literal("url_citation"),
5853
+ url: z20.string().nullish(),
5854
+ title: z20.string().nullish(),
5855
+ start_index: z20.number().nullish(),
5856
+ end_index: z20.number().nullish()
5269
5857
  }).loose();
5270
- const fileCitation = z19.object({
5271
- type: z19.literal("file_citation"),
5272
- file_name: z19.string().nullish(),
5273
- document_uri: z19.string().nullish(),
5274
- url: z19.string().nullish(),
5275
- page_number: z19.number().nullish(),
5276
- media_id: z19.string().nullish(),
5277
- start_index: z19.number().nullish(),
5278
- end_index: z19.number().nullish(),
5279
- custom_metadata: z19.record(z19.string(), z19.unknown()).nullish()
5858
+ const fileCitation = z20.object({
5859
+ type: z20.literal("file_citation"),
5860
+ file_name: z20.string().nullish(),
5861
+ document_uri: z20.string().nullish(),
5862
+ url: z20.string().nullish(),
5863
+ page_number: z20.number().nullish(),
5864
+ media_id: z20.string().nullish(),
5865
+ start_index: z20.number().nullish(),
5866
+ end_index: z20.number().nullish(),
5867
+ custom_metadata: z20.record(z20.string(), z20.unknown()).nullish()
5280
5868
  }).loose();
5281
- const placeCitation = z19.object({
5282
- type: z19.literal("place_citation"),
5283
- name: z19.string().nullish(),
5284
- url: z19.string().nullish(),
5285
- place_id: z19.string().nullish(),
5286
- start_index: z19.number().nullish(),
5287
- end_index: z19.number().nullish()
5869
+ const placeCitation = z20.object({
5870
+ type: z20.literal("place_citation"),
5871
+ name: z20.string().nullish(),
5872
+ url: z20.string().nullish(),
5873
+ place_id: z20.string().nullish(),
5874
+ start_index: z20.number().nullish(),
5875
+ end_index: z20.number().nullish()
5288
5876
  }).loose();
5289
- return z19.union([
5877
+ return z20.union([
5290
5878
  urlCitation,
5291
5879
  fileCitation,
5292
5880
  placeCitation,
5293
- z19.object({ type: z19.string() }).loose()
5881
+ z20.object({ type: z20.string() }).loose()
5294
5882
  ]);
5295
5883
  };
5296
- var thoughtSummaryItemSchema = () => z19.object({
5297
- type: z19.string(),
5298
- text: z19.string().nullish(),
5299
- data: z19.string().nullish(),
5300
- mime_type: z19.string().nullish()
5884
+ var thoughtSummaryItemSchema = () => z20.object({
5885
+ type: z20.string(),
5886
+ text: z20.string().nullish(),
5887
+ data: z20.string().nullish(),
5888
+ mime_type: z20.string().nullish()
5301
5889
  }).loose();
5302
5890
  var contentBlockSchema = () => {
5303
- const textContent = z19.object({
5304
- type: z19.literal("text"),
5305
- text: z19.string(),
5306
- annotations: z19.array(annotationSchema()).nullish()
5891
+ const textContent = z20.object({
5892
+ type: z20.literal("text"),
5893
+ text: z20.string(),
5894
+ annotations: z20.array(annotationSchema()).nullish()
5307
5895
  }).loose();
5308
- const imageContent = z19.object({
5309
- type: z19.literal("image"),
5310
- data: z19.string().nullish(),
5311
- mime_type: z19.string().nullish(),
5312
- resolution: z19.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5313
- uri: z19.string().nullish()
5896
+ const imageContent = z20.object({
5897
+ type: z20.literal("image"),
5898
+ data: z20.string().nullish(),
5899
+ mime_type: z20.string().nullish(),
5900
+ resolution: z20.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5901
+ uri: z20.string().nullish()
5314
5902
  }).loose();
5315
- const videoContent = z19.object({
5316
- type: z19.literal("video"),
5317
- data: z19.string().nullish(),
5318
- mime_type: z19.string().nullish(),
5319
- uri: z19.string().nullish()
5903
+ const videoContent = z20.object({
5904
+ type: z20.literal("video"),
5905
+ data: z20.string().nullish(),
5906
+ mime_type: z20.string().nullish(),
5907
+ uri: z20.string().nullish()
5320
5908
  }).loose();
5321
- return z19.union([
5909
+ return z20.union([
5322
5910
  textContent,
5323
5911
  imageContent,
5324
5912
  videoContent,
5325
- z19.object({ type: z19.string() }).loose()
5913
+ z20.object({ type: z20.string() }).loose()
5326
5914
  ]);
5327
5915
  };
5328
5916
  var BUILTIN_TOOL_CALL_STEP_TYPES = [
@@ -5342,158 +5930,158 @@ var BUILTIN_TOOL_RESULT_STEP_TYPES = [
5342
5930
  "mcp_server_tool_result"
5343
5931
  ];
5344
5932
  var stepSchema = () => {
5345
- const userInputStep = z19.object({
5346
- type: z19.literal("user_input"),
5347
- content: z19.array(contentBlockSchema()).nullish()
5933
+ const userInputStep = z20.object({
5934
+ type: z20.literal("user_input"),
5935
+ content: z20.array(contentBlockSchema()).nullish()
5348
5936
  }).loose();
5349
- const modelOutputStep = z19.object({
5350
- type: z19.literal("model_output"),
5351
- content: z19.array(contentBlockSchema()).nullish()
5937
+ const modelOutputStep = z20.object({
5938
+ type: z20.literal("model_output"),
5939
+ content: z20.array(contentBlockSchema()).nullish()
5352
5940
  }).loose();
5353
- const functionCallStep = z19.object({
5354
- type: z19.literal("function_call"),
5355
- id: z19.string(),
5356
- name: z19.string(),
5357
- arguments: z19.record(z19.string(), z19.unknown()).nullish(),
5358
- signature: z19.string().nullish()
5941
+ const functionCallStep = z20.object({
5942
+ type: z20.literal("function_call"),
5943
+ id: z20.string(),
5944
+ name: z20.string(),
5945
+ arguments: z20.record(z20.string(), z20.unknown()).nullish(),
5946
+ signature: z20.string().nullish()
5359
5947
  }).loose();
5360
- const thoughtStep = z19.object({
5361
- type: z19.literal("thought"),
5362
- signature: z19.string().nullish(),
5363
- summary: z19.array(thoughtSummaryItemSchema()).nullish()
5948
+ const thoughtStep = z20.object({
5949
+ type: z20.literal("thought"),
5950
+ signature: z20.string().nullish(),
5951
+ summary: z20.array(thoughtSummaryItemSchema()).nullish()
5364
5952
  }).loose();
5365
- const builtinToolCallStep = z19.object({
5366
- type: z19.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5367
- id: z19.string(),
5368
- arguments: z19.record(z19.string(), z19.unknown()).nullish(),
5369
- name: z19.string().nullish(),
5370
- server_name: z19.string().nullish(),
5371
- search_type: z19.string().nullish(),
5372
- signature: z19.string().nullish()
5953
+ const builtinToolCallStep = z20.object({
5954
+ type: z20.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5955
+ id: z20.string(),
5956
+ arguments: z20.record(z20.string(), z20.unknown()).nullish(),
5957
+ name: z20.string().nullish(),
5958
+ server_name: z20.string().nullish(),
5959
+ search_type: z20.string().nullish(),
5960
+ signature: z20.string().nullish()
5373
5961
  }).loose();
5374
- const builtinToolResultStep = z19.object({
5375
- type: z19.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5376
- call_id: z19.string(),
5377
- result: z19.unknown().nullish(),
5378
- is_error: z19.boolean().nullish(),
5379
- name: z19.string().nullish(),
5380
- server_name: z19.string().nullish(),
5381
- signature: z19.string().nullish()
5962
+ const builtinToolResultStep = z20.object({
5963
+ type: z20.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5964
+ call_id: z20.string(),
5965
+ result: z20.unknown().nullish(),
5966
+ is_error: z20.boolean().nullish(),
5967
+ name: z20.string().nullish(),
5968
+ server_name: z20.string().nullish(),
5969
+ signature: z20.string().nullish()
5382
5970
  }).loose();
5383
- return z19.union([
5971
+ return z20.union([
5384
5972
  userInputStep,
5385
5973
  modelOutputStep,
5386
5974
  functionCallStep,
5387
5975
  thoughtStep,
5388
5976
  builtinToolCallStep,
5389
5977
  builtinToolResultStep,
5390
- z19.object({ type: z19.string() }).loose()
5978
+ z20.object({ type: z20.string() }).loose()
5391
5979
  ]);
5392
5980
  };
5393
- var googleInteractionsResponseSchema = lazySchema17(
5394
- () => zodSchema17(
5395
- z19.object({
5981
+ var googleInteractionsResponseSchema = lazySchema18(
5982
+ () => zodSchema18(
5983
+ z20.object({
5396
5984
  /*
5397
5985
  * `id` is omitted from the response body when `store: false` (fully
5398
5986
  * stateless mode) — there is no server-side interaction record for the
5399
5987
  * client to reference. `nullish` lets the schema accept that shape.
5400
5988
  */
5401
- id: z19.string().nullish(),
5402
- created: z19.string().nullish(),
5403
- updated: z19.string().nullish(),
5989
+ id: z20.string().nullish(),
5990
+ created: z20.string().nullish(),
5991
+ updated: z20.string().nullish(),
5404
5992
  status: interactionStatusSchema(),
5405
- model: z19.string().nullish(),
5406
- agent: z19.string().nullish(),
5407
- steps: z19.array(stepSchema()).nullish(),
5993
+ model: z20.string().nullish(),
5994
+ agent: z20.string().nullish(),
5995
+ steps: z20.array(stepSchema()).nullish(),
5408
5996
  usage: usageSchema2().nullish(),
5409
- service_tier: z19.string().nullish(),
5410
- previous_interaction_id: z19.string().nullish(),
5411
- response_modalities: z19.array(z19.string()).nullish()
5997
+ service_tier: z20.string().nullish(),
5998
+ previous_interaction_id: z20.string().nullish(),
5999
+ response_modalities: z20.array(z20.string()).nullish()
5412
6000
  }).loose()
5413
6001
  )
5414
6002
  );
5415
- var googleInteractionsEventSchema = lazySchema17(
5416
- () => zodSchema17(
6003
+ var googleInteractionsEventSchema = lazySchema18(
6004
+ () => zodSchema18(
5417
6005
  (() => {
5418
6006
  const status = interactionStatusSchema();
5419
6007
  const annotation = annotationSchema();
5420
6008
  const thoughtSummaryItem = thoughtSummaryItemSchema();
5421
- const interactionCreatedEvent = z19.object({
5422
- event_type: z19.literal("interaction.created"),
5423
- event_id: z19.string().nullish(),
5424
- interaction: z19.object({
6009
+ const interactionCreatedEvent = z20.object({
6010
+ event_type: z20.literal("interaction.created"),
6011
+ event_id: z20.string().nullish(),
6012
+ interaction: z20.object({
5425
6013
  /*
5426
6014
  * `id` is omitted when `store: false` (fully stateless mode);
5427
6015
  * see the matching note on `googleInteractionsResponseSchema.id`.
5428
6016
  */
5429
- id: z19.string().nullish(),
5430
- created: z19.string().nullish(),
5431
- model: z19.string().nullish(),
5432
- agent: z19.string().nullish(),
6017
+ id: z20.string().nullish(),
6018
+ created: z20.string().nullish(),
6019
+ model: z20.string().nullish(),
6020
+ agent: z20.string().nullish(),
5433
6021
  status: status.nullish()
5434
6022
  }).loose()
5435
6023
  }).loose();
5436
- const stepStartEvent = z19.object({
5437
- event_type: z19.literal("step.start"),
5438
- event_id: z19.string().nullish(),
5439
- index: z19.number(),
6024
+ const stepStartEvent = z20.object({
6025
+ event_type: z20.literal("step.start"),
6026
+ event_id: z20.string().nullish(),
6027
+ index: z20.number(),
5440
6028
  step: stepSchema()
5441
6029
  }).loose();
5442
- const stepDeltaText = z19.object({
5443
- type: z19.literal("text"),
5444
- text: z19.string()
6030
+ const stepDeltaText = z20.object({
6031
+ type: z20.literal("text"),
6032
+ text: z20.string()
5445
6033
  }).loose();
5446
- const stepDeltaThoughtSummary = z19.object({
5447
- type: z19.literal("thought_summary"),
6034
+ const stepDeltaThoughtSummary = z20.object({
6035
+ type: z20.literal("thought_summary"),
5448
6036
  content: thoughtSummaryItem.nullish()
5449
6037
  }).loose();
5450
- const stepDeltaThoughtSignature = z19.object({
5451
- type: z19.literal("thought_signature"),
5452
- signature: z19.string().nullish()
6038
+ const stepDeltaThoughtSignature = z20.object({
6039
+ type: z20.literal("thought_signature"),
6040
+ signature: z20.string().nullish()
5453
6041
  }).loose();
5454
- const stepDeltaArgumentsDelta = z19.object({
5455
- type: z19.literal("arguments_delta"),
5456
- arguments: z19.string().nullish(),
5457
- id: z19.string().nullish(),
5458
- signature: z19.string().nullish()
6042
+ const stepDeltaArgumentsDelta = z20.object({
6043
+ type: z20.literal("arguments_delta"),
6044
+ arguments: z20.string().nullish(),
6045
+ id: z20.string().nullish(),
6046
+ signature: z20.string().nullish()
5459
6047
  }).loose();
5460
- const stepDeltaTextAnnotation = z19.object({
5461
- type: z19.enum(["text_annotation_delta", "text_annotation"]),
5462
- annotations: z19.array(annotation).nullish()
6048
+ const stepDeltaTextAnnotation = z20.object({
6049
+ type: z20.enum(["text_annotation_delta", "text_annotation"]),
6050
+ annotations: z20.array(annotation).nullish()
5463
6051
  }).loose();
5464
- const stepDeltaImage = z19.object({
5465
- type: z19.literal("image"),
5466
- data: z19.string().nullish(),
5467
- mime_type: z19.string().nullish(),
5468
- resolution: z19.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5469
- uri: z19.string().nullish()
6052
+ const stepDeltaImage = z20.object({
6053
+ type: z20.literal("image"),
6054
+ data: z20.string().nullish(),
6055
+ mime_type: z20.string().nullish(),
6056
+ resolution: z20.enum(["low", "medium", "high", "ultra_high"]).nullish(),
6057
+ uri: z20.string().nullish()
5470
6058
  }).loose();
5471
- const stepDeltaVideo = z19.object({
5472
- type: z19.literal("video"),
5473
- data: z19.string().nullish(),
5474
- mime_type: z19.string().nullish(),
5475
- uri: z19.string().nullish()
6059
+ const stepDeltaVideo = z20.object({
6060
+ type: z20.literal("video"),
6061
+ data: z20.string().nullish(),
6062
+ mime_type: z20.string().nullish(),
6063
+ uri: z20.string().nullish()
5476
6064
  }).loose();
5477
- const stepDeltaBuiltinToolCall = z19.object({
5478
- type: z19.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5479
- id: z19.string().nullish(),
5480
- arguments: z19.record(z19.string(), z19.unknown()).nullish(),
5481
- name: z19.string().nullish(),
5482
- server_name: z19.string().nullish(),
5483
- search_type: z19.string().nullish(),
5484
- signature: z19.string().nullish()
6065
+ const stepDeltaBuiltinToolCall = z20.object({
6066
+ type: z20.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
6067
+ id: z20.string().nullish(),
6068
+ arguments: z20.record(z20.string(), z20.unknown()).nullish(),
6069
+ name: z20.string().nullish(),
6070
+ server_name: z20.string().nullish(),
6071
+ search_type: z20.string().nullish(),
6072
+ signature: z20.string().nullish()
5485
6073
  }).loose();
5486
- const stepDeltaBuiltinToolResult = z19.object({
5487
- type: z19.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
5488
- call_id: z19.string().nullish(),
5489
- result: z19.unknown().nullish(),
5490
- is_error: z19.boolean().nullish(),
5491
- name: z19.string().nullish(),
5492
- server_name: z19.string().nullish(),
5493
- signature: z19.string().nullish()
6074
+ const stepDeltaBuiltinToolResult = z20.object({
6075
+ type: z20.enum(BUILTIN_TOOL_RESULT_STEP_TYPES),
6076
+ call_id: z20.string().nullish(),
6077
+ result: z20.unknown().nullish(),
6078
+ is_error: z20.boolean().nullish(),
6079
+ name: z20.string().nullish(),
6080
+ server_name: z20.string().nullish(),
6081
+ signature: z20.string().nullish()
5494
6082
  }).loose();
5495
- const stepDeltaUnknown = z19.object({ type: z19.string() }).loose();
5496
- const stepDeltaUnion = z19.union([
6083
+ const stepDeltaUnknown = z20.object({ type: z20.string() }).loose();
6084
+ const stepDeltaUnion = z20.union([
5497
6085
  stepDeltaText,
5498
6086
  stepDeltaImage,
5499
6087
  stepDeltaVideo,
@@ -5505,55 +6093,55 @@ var googleInteractionsEventSchema = lazySchema17(
5505
6093
  stepDeltaBuiltinToolResult,
5506
6094
  stepDeltaUnknown
5507
6095
  ]);
5508
- const stepDeltaEvent = z19.object({
5509
- event_type: z19.literal("step.delta"),
5510
- event_id: z19.string().nullish(),
5511
- index: z19.number(),
6096
+ const stepDeltaEvent = z20.object({
6097
+ event_type: z20.literal("step.delta"),
6098
+ event_id: z20.string().nullish(),
6099
+ index: z20.number(),
5512
6100
  delta: stepDeltaUnion
5513
6101
  }).loose();
5514
- const stepStopEvent = z19.object({
5515
- event_type: z19.literal("step.stop"),
5516
- event_id: z19.string().nullish(),
5517
- index: z19.number()
6102
+ const stepStopEvent = z20.object({
6103
+ event_type: z20.literal("step.stop"),
6104
+ event_id: z20.string().nullish(),
6105
+ index: z20.number()
5518
6106
  }).loose();
5519
- const interactionStatusUpdateEvent = z19.object({
5520
- event_type: z19.literal("interaction.status_update"),
5521
- event_id: z19.string().nullish(),
5522
- interaction_id: z19.string().nullish(),
6107
+ const interactionStatusUpdateEvent = z20.object({
6108
+ event_type: z20.literal("interaction.status_update"),
6109
+ event_id: z20.string().nullish(),
6110
+ interaction_id: z20.string().nullish(),
5523
6111
  status: status.nullish()
5524
6112
  }).loose();
5525
- const interactionInProgressEvent = z19.object({
5526
- event_type: z19.literal("interaction.in_progress"),
5527
- event_id: z19.string().nullish(),
5528
- interaction_id: z19.string().nullish(),
6113
+ const interactionInProgressEvent = z20.object({
6114
+ event_type: z20.literal("interaction.in_progress"),
6115
+ event_id: z20.string().nullish(),
6116
+ interaction_id: z20.string().nullish(),
5529
6117
  status: status.nullish()
5530
6118
  }).loose();
5531
- const interactionRequiresActionEvent = z19.object({
5532
- event_type: z19.literal("interaction.requires_action"),
5533
- event_id: z19.string().nullish(),
5534
- interaction_id: z19.string().nullish(),
6119
+ const interactionRequiresActionEvent = z20.object({
6120
+ event_type: z20.literal("interaction.requires_action"),
6121
+ event_id: z20.string().nullish(),
6122
+ interaction_id: z20.string().nullish(),
5535
6123
  status: status.nullish()
5536
6124
  }).loose();
5537
- const interactionCompletedEvent = z19.object({
5538
- event_type: z19.literal("interaction.completed"),
5539
- event_id: z19.string().nullish(),
5540
- interaction: z19.object({
5541
- id: z19.string().nullish(),
6125
+ const interactionCompletedEvent = z20.object({
6126
+ event_type: z20.literal("interaction.completed"),
6127
+ event_id: z20.string().nullish(),
6128
+ interaction: z20.object({
6129
+ id: z20.string().nullish(),
5542
6130
  status: status.nullish(),
5543
6131
  usage: usageSchema2().nullish(),
5544
- service_tier: z19.string().nullish()
6132
+ service_tier: z20.string().nullish()
5545
6133
  }).loose()
5546
6134
  }).loose();
5547
- const errorEvent = z19.object({
5548
- event_type: z19.literal("error"),
5549
- event_id: z19.string().nullish(),
5550
- error: z19.object({
5551
- code: z19.string().nullish(),
5552
- message: z19.string().nullish()
6135
+ const errorEvent = z20.object({
6136
+ event_type: z20.literal("error"),
6137
+ event_id: z20.string().nullish(),
6138
+ error: z20.object({
6139
+ code: z20.string().nullish(),
6140
+ message: z20.string().nullish()
5553
6141
  }).loose().nullish()
5554
6142
  }).loose();
5555
- const unknownEvent = z19.object({ event_type: z19.string() }).loose();
5556
- return z19.union([
6143
+ const unknownEvent = z20.object({ event_type: z20.string() }).loose();
6144
+ return z20.union([
5557
6145
  interactionCreatedEvent,
5558
6146
  stepStartEvent,
5559
6147
  stepDeltaEvent,
@@ -5571,29 +6159,29 @@ var googleInteractionsEventSchema = lazySchema17(
5571
6159
 
5572
6160
  // src/interactions/google-interactions-language-model-options.ts
5573
6161
  import {
5574
- lazySchema as lazySchema18,
5575
- zodSchema as zodSchema18
6162
+ lazySchema as lazySchema19,
6163
+ zodSchema as zodSchema19
5576
6164
  } from "@ai-sdk/provider-utils";
5577
- import { z as z20 } from "zod/v4";
5578
- var googleInteractionsLanguageModelOptions = lazySchema18(
5579
- () => zodSchema18(
5580
- z20.object({
5581
- previousInteractionId: z20.string().nullish(),
5582
- store: z20.boolean().nullish(),
5583
- agent: z20.string().nullish(),
5584
- agentConfig: z20.union([
5585
- z20.object({
5586
- type: z20.literal("dynamic")
6165
+ import { z as z21 } from "zod/v4";
6166
+ var googleInteractionsLanguageModelOptions = lazySchema19(
6167
+ () => zodSchema19(
6168
+ z21.object({
6169
+ previousInteractionId: z21.string().nullish(),
6170
+ store: z21.boolean().nullish(),
6171
+ agent: z21.string().nullish(),
6172
+ agentConfig: z21.union([
6173
+ z21.object({
6174
+ type: z21.literal("dynamic")
5587
6175
  }).loose(),
5588
- z20.object({
5589
- type: z20.literal("deep-research"),
5590
- thinkingSummaries: z20.enum(["auto", "none"]).nullish(),
5591
- visualization: z20.enum(["off", "auto"]).nullish(),
5592
- collaborativePlanning: z20.boolean().nullish()
6176
+ z21.object({
6177
+ type: z21.literal("deep-research"),
6178
+ thinkingSummaries: z21.enum(["auto", "none"]).nullish(),
6179
+ visualization: z21.enum(["off", "auto"]).nullish(),
6180
+ collaborativePlanning: z21.boolean().nullish()
5593
6181
  })
5594
6182
  ]).nullish(),
5595
- thinkingLevel: z20.enum(["minimal", "low", "medium", "high"]).nullish(),
5596
- thinkingSummaries: z20.enum(["auto", "none"]).nullish(),
6183
+ thinkingLevel: z21.enum(["minimal", "low", "medium", "high"]).nullish(),
6184
+ thinkingSummaries: z21.enum(["auto", "none"]).nullish(),
5597
6185
  /**
5598
6186
  * Output-format entries that map directly to the API's `response_format`
5599
6187
  * array. Use this to request image, audio, or non-JSON text outputs
@@ -5603,17 +6191,17 @@ var googleInteractionsLanguageModelOptions = lazySchema18(
5603
6191
  * type: 'json', schema }` still drives JSON-mode and adds a matching
5604
6192
  * text entry automatically; entries listed here are appended.
5605
6193
  */
5606
- responseFormat: z20.array(
5607
- z20.union([
5608
- z20.object({
5609
- type: z20.literal("text"),
5610
- mimeType: z20.string().nullish(),
5611
- schema: z20.unknown().nullish()
6194
+ responseFormat: z21.array(
6195
+ z21.union([
6196
+ z21.object({
6197
+ type: z21.literal("text"),
6198
+ mimeType: z21.string().nullish(),
6199
+ schema: z21.unknown().nullish()
5612
6200
  }).loose(),
5613
- z20.object({
5614
- type: z20.literal("image"),
5615
- mimeType: z20.string().nullish(),
5616
- aspectRatio: z20.enum([
6201
+ z21.object({
6202
+ type: z21.literal("image"),
6203
+ mimeType: z21.string().nullish(),
6204
+ aspectRatio: z21.enum([
5617
6205
  "1:1",
5618
6206
  "2:3",
5619
6207
  "3:2",
@@ -5629,11 +6217,11 @@ var googleInteractionsLanguageModelOptions = lazySchema18(
5629
6217
  "1:4",
5630
6218
  "4:1"
5631
6219
  ]).nullish(),
5632
- imageSize: z20.enum(["1K", "2K", "4K", "512"]).nullish()
6220
+ imageSize: z21.enum(["1K", "2K", "4K", "512"]).nullish()
5633
6221
  }).loose(),
5634
- z20.object({
5635
- type: z20.literal("audio"),
5636
- mimeType: z20.string().nullish()
6222
+ z21.object({
6223
+ type: z21.literal("audio"),
6224
+ mimeType: z21.string().nullish()
5637
6225
  }).loose()
5638
6226
  ])
5639
6227
  ).nullish(),
@@ -5643,8 +6231,8 @@ var googleInteractionsLanguageModelOptions = lazySchema18(
5643
6231
  * translates it into a matching `response_format` image entry and
5644
6232
  * emits a warning when set.
5645
6233
  */
5646
- imageConfig: z20.object({
5647
- aspectRatio: z20.enum([
6234
+ imageConfig: z21.object({
6235
+ aspectRatio: z21.enum([
5648
6236
  "1:1",
5649
6237
  "2:3",
5650
6238
  "3:2",
@@ -5660,35 +6248,35 @@ var googleInteractionsLanguageModelOptions = lazySchema18(
5660
6248
  "1:4",
5661
6249
  "4:1"
5662
6250
  ]).nullish(),
5663
- imageSize: z20.enum(["1K", "2K", "4K", "512"]).nullish()
6251
+ imageSize: z21.enum(["1K", "2K", "4K", "512"]).nullish()
5664
6252
  }).nullish(),
5665
- mediaResolution: z20.enum(["low", "medium", "high", "ultra_high"]).nullish(),
5666
- responseModalities: z20.array(z20.enum(["text", "image", "audio", "video", "document"])).nullish(),
5667
- serviceTier: z20.enum(["flex", "standard", "priority"]).nullish(),
6253
+ mediaResolution: z21.enum(["low", "medium", "high", "ultra_high"]).nullish(),
6254
+ responseModalities: z21.array(z21.enum(["text", "image", "audio", "video", "document"])).nullish(),
6255
+ serviceTier: z21.enum(["flex", "standard", "priority"]).nullish(),
5668
6256
  /**
5669
6257
  * Alternative to AI SDK `system` message. If both are set, the AI SDK
5670
6258
  * `system` message wins and a warning is emitted.
5671
6259
  */
5672
- systemInstruction: z20.string().nullish(),
6260
+ systemInstruction: z21.string().nullish(),
5673
6261
  /**
5674
6262
  * Per-block signature for round-tripping `thought.signature` and
5675
6263
  * `function_call.signature` blocks. Set by the SDK on output reasoning /
5676
6264
  * tool-call parts; passed back unchanged on input parts so the API
5677
6265
  * accepts the prior turn.
5678
6266
  */
5679
- signature: z20.string().nullish(),
6267
+ signature: z21.string().nullish(),
5680
6268
  /**
5681
6269
  * Set by the SDK on output assistant messages. The converter uses it to
5682
6270
  * decide which messages to drop when compacting under
5683
6271
  * `previousInteractionId`.
5684
6272
  */
5685
- interactionId: z20.string().nullish(),
6273
+ interactionId: z21.string().nullish(),
5686
6274
  /**
5687
6275
  * Maximum time, in milliseconds, to poll a background interaction (agent
5688
6276
  * call) before giving up. Defaults to 30 minutes. Long-running agents
5689
6277
  * such as deep research can take tens of minutes — increase if needed.
5690
6278
  */
5691
- pollingTimeoutMs: z20.number().int().positive().nullish(),
6279
+ pollingTimeoutMs: z21.number().int().positive().nullish(),
5692
6280
  /**
5693
6281
  * Run the interaction in the background. Required for agents whose
5694
6282
  * server-side workflow cannot complete within a single request/response.
@@ -5697,7 +6285,7 @@ var googleInteractionsLanguageModelOptions = lazySchema18(
5697
6285
  * reject `true`; see the agent's documentation for which mode it
5698
6286
  * requires.
5699
6287
  */
5700
- background: z20.boolean().nullish(),
6288
+ background: z21.boolean().nullish(),
5701
6289
  /**
5702
6290
  * Environment configuration for the agent sandbox. Only applies to agent
5703
6291
  * calls (`google.interactions({ agent })`); ignored on model-id calls.
@@ -5707,36 +6295,36 @@ var googleInteractionsLanguageModelOptions = lazySchema18(
5707
6295
  * - object: provision a fresh sandbox and optionally preload `sources`
5708
6296
  * and/or constrain outbound traffic via `network`.
5709
6297
  */
5710
- environment: z20.union([
5711
- z20.string(),
5712
- z20.object({
5713
- type: z20.literal("remote"),
5714
- sources: z20.array(
5715
- z20.union([
5716
- z20.object({
5717
- type: z20.literal("gcs"),
5718
- source: z20.string(),
5719
- target: z20.string().nullish()
6298
+ environment: z21.union([
6299
+ z21.string(),
6300
+ z21.object({
6301
+ type: z21.literal("remote"),
6302
+ sources: z21.array(
6303
+ z21.union([
6304
+ z21.object({
6305
+ type: z21.literal("gcs"),
6306
+ source: z21.string(),
6307
+ target: z21.string().nullish()
5720
6308
  }),
5721
- z20.object({
5722
- type: z20.literal("repository"),
5723
- source: z20.string(),
5724
- target: z20.string().nullish()
6309
+ z21.object({
6310
+ type: z21.literal("repository"),
6311
+ source: z21.string(),
6312
+ target: z21.string().nullish()
5725
6313
  }),
5726
- z20.object({
5727
- type: z20.literal("inline"),
5728
- content: z20.string(),
5729
- target: z20.string()
6314
+ z21.object({
6315
+ type: z21.literal("inline"),
6316
+ content: z21.string(),
6317
+ target: z21.string()
5730
6318
  })
5731
6319
  ])
5732
6320
  ).nullish(),
5733
- network: z20.union([
5734
- z20.literal("disabled"),
5735
- z20.object({
5736
- allowlist: z20.array(
5737
- z20.object({
5738
- domain: z20.string(),
5739
- transform: z20.array(z20.record(z20.string(), z20.string())).nullish()
6321
+ network: z21.union([
6322
+ z21.literal("disabled"),
6323
+ z21.object({
6324
+ allowlist: z21.array(
6325
+ z21.object({
6326
+ domain: z21.string(),
6327
+ transform: z21.array(z21.record(z21.string(), z21.string())).nullish()
5740
6328
  })
5741
6329
  )
5742
6330
  })
@@ -5785,7 +6373,7 @@ function builtinToolNameFromResultType2(type) {
5785
6373
  }
5786
6374
  function parseGoogleInteractionsOutputs({
5787
6375
  steps,
5788
- generateId: generateId3,
6376
+ generateId: generateId4,
5789
6377
  interactionId
5790
6378
  }) {
5791
6379
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
@@ -5815,7 +6403,7 @@ function parseGoogleInteractionsOutputs({
5815
6403
  text,
5816
6404
  ...googleProviderMetadata({ interactionId })
5817
6405
  });
5818
- const sources = annotationsToSources({ annotations, generateId: generateId3 });
6406
+ const sources = annotationsToSources({ annotations, generateId: generateId4 });
5819
6407
  for (const source of sources) {
5820
6408
  content.push(source);
5821
6409
  }
@@ -5895,7 +6483,7 @@ function parseGoogleInteractionsOutputs({
5895
6483
  const input = JSON.stringify((_i = call.arguments) != null ? _i : {});
5896
6484
  content.push({
5897
6485
  type: "tool-call",
5898
- toolCallId: call.id || generateId3(),
6486
+ toolCallId: call.id || generateId4(),
5899
6487
  toolName,
5900
6488
  input,
5901
6489
  providerExecuted: true
@@ -5905,13 +6493,13 @@ function parseGoogleInteractionsOutputs({
5905
6493
  const toolName = type === "mcp_server_tool_result" ? (_j = result.name) != null ? _j : "mcp_server_tool" : builtinToolNameFromResultType2(type);
5906
6494
  content.push({
5907
6495
  type: "tool-result",
5908
- toolCallId: result.call_id || generateId3(),
6496
+ toolCallId: result.call_id || generateId4(),
5909
6497
  toolName,
5910
6498
  result: (_k = result.result) != null ? _k : null
5911
6499
  });
5912
6500
  const sources = builtinToolResultToSources({
5913
6501
  block: step,
5914
- generateId: generateId3
6502
+ generateId: generateId4
5915
6503
  });
5916
6504
  for (const source of sources) {
5917
6505
  content.push(source);
@@ -5926,15 +6514,15 @@ function parseGoogleInteractionsOutputs({
5926
6514
 
5927
6515
  // src/interactions/poll-google-interactions.ts
5928
6516
  import {
5929
- createJsonResponseHandler as createJsonResponseHandler6,
6517
+ createJsonResponseHandler as createJsonResponseHandler7,
5930
6518
  delay as delay2,
5931
- getFromApi as getFromApi3,
6519
+ getFromApi as getFromApi4,
5932
6520
  isAbortError
5933
6521
  } from "@ai-sdk/provider-utils";
5934
6522
 
5935
6523
  // src/interactions/cancel-google-interaction.ts
5936
6524
  import {
5937
- combineHeaders as combineHeaders6,
6525
+ combineHeaders as combineHeaders7,
5938
6526
  getRuntimeEnvironmentUserAgent,
5939
6527
  withUserAgentSuffix
5940
6528
  } from "@ai-sdk/provider-utils";
@@ -5953,7 +6541,7 @@ async function cancelGoogleInteraction({
5953
6541
  const response = await fetch2(url, {
5954
6542
  method: "POST",
5955
6543
  headers: withUserAgentSuffix(
5956
- combineHeaders6({ "Content-Type": "application/json" }, headers),
6544
+ combineHeaders7({ "Content-Type": "application/json" }, headers),
5957
6545
  getRuntimeEnvironmentUserAgent()
5958
6546
  ),
5959
6547
  body: "{}"
@@ -6009,12 +6597,12 @@ async function pollGoogleInteractionUntilTerminal({
6009
6597
  value: response,
6010
6598
  rawValue: rawResponse,
6011
6599
  responseHeaders
6012
- } = await getFromApi3({
6600
+ } = await getFromApi4({
6013
6601
  url,
6014
6602
  validateUrl: false,
6015
6603
  headers,
6016
6604
  failedResponseHandler: googleFailedResponseHandler,
6017
- successfulResponseHandler: createJsonResponseHandler6(
6605
+ successfulResponseHandler: createJsonResponseHandler7(
6018
6606
  googleInteractionsResponseSchema
6019
6607
  ),
6020
6608
  abortSignal,
@@ -6185,7 +6773,7 @@ function prepareGoogleInteractionsTools({
6185
6773
  import {
6186
6774
  createEventSourceResponseHandler as createEventSourceResponseHandler2,
6187
6775
  delay as delay3,
6188
- getFromApi as getFromApi4,
6776
+ getFromApi as getFromApi5,
6189
6777
  isAbortError as isAbortError2
6190
6778
  } from "@ai-sdk/provider-utils";
6191
6779
  var DEFAULT_MAX_RETRIES = 3;
@@ -6234,7 +6822,7 @@ function streamGoogleInteractionEvents({
6234
6822
  return `${base}?${params.toString()}`;
6235
6823
  }
6236
6824
  async function openReader() {
6237
- const { value: stream } = await getFromApi4({
6825
+ const { value: stream } = await getFromApi5({
6238
6826
  url: buildUrl(),
6239
6827
  validateUrl: false,
6240
6828
  headers: eventSourceHeaders,
@@ -6354,7 +6942,7 @@ function streamGoogleInteractionEvents({
6354
6942
  function synthesizeGoogleInteractionsAgentStream({
6355
6943
  response,
6356
6944
  warnings,
6357
- generateId: generateId3,
6945
+ generateId: generateId4,
6358
6946
  includeRawChunks,
6359
6947
  headerServiceTier
6360
6948
  }) {
@@ -6382,7 +6970,7 @@ function synthesizeGoogleInteractionsAgentStream({
6382
6970
  }
6383
6971
  const { content, hasFunctionCall } = parseGoogleInteractionsOutputs({
6384
6972
  steps: (_b = response.steps) != null ? _b : null,
6385
- generateId: generateId3,
6973
+ generateId: generateId4,
6386
6974
  interactionId
6387
6975
  });
6388
6976
  let blockCounter = 0;
@@ -6507,7 +7095,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
6507
7095
  }
6508
7096
  this.config = config;
6509
7097
  }
6510
- static [WORKFLOW_SERIALIZE5](model) {
7098
+ static [WORKFLOW_SERIALIZE6](model) {
6511
7099
  return {
6512
7100
  ...serializeModelOptions5({
6513
7101
  modelId: model.modelId,
@@ -6516,7 +7104,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
6516
7104
  agent: model.agent
6517
7105
  };
6518
7106
  }
6519
- static [WORKFLOW_DESERIALIZE5](options) {
7107
+ static [WORKFLOW_DESERIALIZE6](options) {
6520
7108
  return new _GoogleInteractionsLanguageModel(
6521
7109
  options.agent != null ? { agent: options.agent } : options.modelId,
6522
7110
  options.config
@@ -6790,16 +7378,16 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
6790
7378
  var _a, _b, _c, _d, _e, _f;
6791
7379
  const { args, warnings, isAgent, pollingTimeoutMs } = await this.getArgs(options);
6792
7380
  const url = `${this.config.baseURL}/interactions`;
6793
- const mergedHeaders = combineHeaders7(
6794
- this.config.headers ? await resolve5(this.config.headers) : void 0,
7381
+ const mergedHeaders = combineHeaders8(
7382
+ this.config.headers ? await resolve6(this.config.headers) : void 0,
6795
7383
  options.headers
6796
7384
  );
6797
- const postResult = await postJsonToApi5({
7385
+ const postResult = await postJsonToApi6({
6798
7386
  url,
6799
7387
  headers: mergedHeaders,
6800
7388
  body: args,
6801
7389
  failedResponseHandler: googleFailedResponseHandler,
6802
- successfulResponseHandler: createJsonResponseHandler7(
7390
+ successfulResponseHandler: createJsonResponseHandler8(
6803
7391
  googleInteractionsResponseSchema
6804
7392
  ),
6805
7393
  abortSignal: options.abortSignal,
@@ -6874,8 +7462,8 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
6874
7462
  var _a;
6875
7463
  const { args, warnings, isBackground, pollingTimeoutMs } = await this.getArgs(options);
6876
7464
  const url = `${this.config.baseURL}/interactions`;
6877
- const mergedHeaders = combineHeaders7(
6878
- this.config.headers ? await resolve5(this.config.headers) : void 0,
7465
+ const mergedHeaders = combineHeaders8(
7466
+ this.config.headers ? await resolve6(this.config.headers) : void 0,
6879
7467
  options.headers
6880
7468
  );
6881
7469
  if (isBackground) {
@@ -6889,7 +7477,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
6889
7477
  });
6890
7478
  }
6891
7479
  const body = { ...args, stream: true };
6892
- const { responseHeaders, value: response } = await postJsonToApi5({
7480
+ const { responseHeaders, value: response } = await postJsonToApi6({
6893
7481
  url,
6894
7482
  headers: mergedHeaders,
6895
7483
  body,
@@ -6940,12 +7528,12 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
6940
7528
  pollingTimeoutMs
6941
7529
  }) {
6942
7530
  var _a, _b;
6943
- const postResult = await postJsonToApi5({
7531
+ const postResult = await postJsonToApi6({
6944
7532
  url,
6945
7533
  headers: mergedHeaders,
6946
7534
  body: args,
6947
7535
  failedResponseHandler: googleFailedResponseHandler,
6948
- successfulResponseHandler: createJsonResponseHandler7(
7536
+ successfulResponseHandler: createJsonResponseHandler8(
6949
7537
  googleInteractionsResponseSchema
6950
7538
  ),
6951
7539
  abortSignal: options.abortSignal,
@@ -7428,35 +8016,35 @@ var GoogleRealtimeModel = class {
7428
8016
 
7429
8017
  // src/speech-translation/google-speech-translation-model.ts
7430
8018
  import {
7431
- InvalidArgumentError
8019
+ InvalidArgumentError as InvalidArgumentError2
7432
8020
  } from "@ai-sdk/provider";
7433
8021
  import {
7434
8022
  connectToWebSocket,
7435
- combineHeaders as combineHeaders8,
8023
+ combineHeaders as combineHeaders9,
7436
8024
  convertBase64ToUint8Array as convertBase64ToUint8Array2,
7437
8025
  convertToBase64 as convertToBase644,
7438
8026
  parseProviderOptions as parseProviderOptions8,
7439
8027
  safeParseJSON as safeParseJSON2,
7440
8028
  serializeModelOptions as serializeModelOptions6,
7441
- WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE6,
7442
- WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE6,
8029
+ WORKFLOW_DESERIALIZE as WORKFLOW_DESERIALIZE7,
8030
+ WORKFLOW_SERIALIZE as WORKFLOW_SERIALIZE7,
7443
8031
  waitForWebSocketBufferDrain
7444
8032
  } from "@ai-sdk/provider-utils";
7445
8033
 
7446
8034
  // src/speech-translation/google-speech-translation-model-options.ts
7447
8035
  import {
7448
- lazySchema as lazySchema19,
7449
- zodSchema as zodSchema19
8036
+ lazySchema as lazySchema20,
8037
+ zodSchema as zodSchema20
7450
8038
  } from "@ai-sdk/provider-utils";
7451
- import { z as z21 } from "zod/v4";
7452
- var googleSpeechTranslationModelOptions = lazySchema19(
7453
- () => zodSchema19(
7454
- z21.object({
8039
+ import { z as z22 } from "zod/v4";
8040
+ var googleSpeechTranslationModelOptions = lazySchema20(
8041
+ () => zodSchema20(
8042
+ z22.object({
7455
8043
  /**
7456
8044
  * Whether input audio already in the target language should be echoed
7457
8045
  * instead of producing silence.
7458
8046
  */
7459
- echoTargetLanguage: z21.boolean().optional()
8047
+ echoTargetLanguage: z22.boolean().optional()
7460
8048
  })
7461
8049
  )
7462
8050
  );
@@ -7477,13 +8065,13 @@ var GoogleSpeechTranslationModel = class _GoogleSpeechTranslationModel {
7477
8065
  this.modelId = modelId;
7478
8066
  this.config = config;
7479
8067
  }
7480
- static [WORKFLOW_SERIALIZE6](model) {
8068
+ static [WORKFLOW_SERIALIZE7](model) {
7481
8069
  return serializeModelOptions6({
7482
8070
  modelId: model.modelId,
7483
8071
  config: model.config
7484
8072
  });
7485
8073
  }
7486
- static [WORKFLOW_DESERIALIZE6](options) {
8074
+ static [WORKFLOW_DESERIALIZE7](options) {
7487
8075
  return new _GoogleSpeechTranslationModel(options.modelId, options.config);
7488
8076
  }
7489
8077
  get provider() {
@@ -7492,7 +8080,7 @@ var GoogleSpeechTranslationModel = class _GoogleSpeechTranslationModel {
7492
8080
  async doStream(options) {
7493
8081
  var _a, _b, _c, _d, _e, _f;
7494
8082
  if (options.targetLanguage == null) {
7495
- throw new InvalidArgumentError({
8083
+ throw new InvalidArgumentError2({
7496
8084
  argument: "targetLanguage",
7497
8085
  message: `targetLanguage is required for translation model '${this.modelId}'.`
7498
8086
  });
@@ -7519,7 +8107,7 @@ var GoogleSpeechTranslationModel = class _GoogleSpeechTranslationModel {
7519
8107
  details: "The Gemini Live API always outputs 24kHz 16-bit PCM audio and does not accept an output audio format."
7520
8108
  });
7521
8109
  }
7522
- const headers = combineHeaders8(this.config.headers(), options.headers);
8110
+ const headers = combineHeaders9(this.config.headers(), options.headers);
7523
8111
  let apiKey;
7524
8112
  for (const [key, value] of Object.entries(headers)) {
7525
8113
  if (key.toLowerCase() === "x-goog-api-key" && value != null) {
@@ -7582,8 +8170,8 @@ function createGoogleLiveSpeechTranslationStream({
7582
8170
  let audioReader;
7583
8171
  let connection;
7584
8172
  let resolveSetupComplete;
7585
- const setupComplete = new Promise((resolve6) => {
7586
- resolveSetupComplete = resolve6;
8173
+ const setupComplete = new Promise((resolve7) => {
8174
+ resolveSetupComplete = resolve7;
7587
8175
  });
7588
8176
  let turnCounter = 0;
7589
8177
  let sourceText = "";
@@ -7872,7 +8460,7 @@ function buildGoogleLiveSpeechTranslationSetup({
7872
8460
  }
7873
8461
  function validateGoogleSpeechTranslationInputAudioFormat(inputAudioFormat) {
7874
8462
  if (inputAudioFormat.type !== "audio/pcm" || inputAudioFormat.rate != null && inputAudioFormat.rate !== 16e3) {
7875
- throw new InvalidArgumentError({
8463
+ throw new InvalidArgumentError2({
7876
8464
  argument: "inputAudioFormat",
7877
8465
  message: "The Gemini Live translation API only supports 16kHz 16-bit PCM input audio."
7878
8466
  });
@@ -7925,11 +8513,11 @@ function createGoogle(options = {}) {
7925
8513
  );
7926
8514
  const createChatModel = (modelId) => {
7927
8515
  var _a2;
7928
- return new GoogleLanguageModel(modelId, {
8516
+ return new GoogleBatchLanguageModel(modelId, {
7929
8517
  provider: providerName,
7930
8518
  baseURL,
7931
8519
  headers: getHeaders,
7932
- generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
8520
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId3,
7933
8521
  supportedUrls: () => ({
7934
8522
  "*": [
7935
8523
  // Google Generative Language "files" endpoint
@@ -7976,7 +8564,7 @@ function createGoogle(options = {}) {
7976
8564
  baseURL,
7977
8565
  headers: getHeaders,
7978
8566
  fetch: options.fetch,
7979
- generateId: (_a2 = options.generateId) != null ? _a2 : generateId2
8567
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId3
7980
8568
  });
7981
8569
  };
7982
8570
  const createRealtimeModel = (modelId) => new GoogleRealtimeModel(modelId, {
@@ -8022,7 +8610,7 @@ function createGoogle(options = {}) {
8022
8610
  provider: `${providerName}.interactions`,
8023
8611
  baseURL,
8024
8612
  headers: getHeaders,
8025
- generateId: (_a2 = options.generateId) != null ? _a2 : generateId2,
8613
+ generateId: (_a2 = options.generateId) != null ? _a2 : generateId3,
8026
8614
  fetch: options.fetch
8027
8615
  }
8028
8616
  );