@ai-sdk/google 4.0.62 → 4.0.64

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
@@ -7,7 +7,7 @@ import {
7
7
  } from "@ai-sdk/provider-utils";
8
8
 
9
9
  // src/version.ts
10
- var VERSION = true ? "4.0.62" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.64" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -283,6 +283,7 @@ function getModelPath(modelId) {
283
283
  // src/google-language-model.ts
284
284
  import {
285
285
  combineHeaders as combineHeaders2,
286
+ createToolNameMapping,
286
287
  createEventSourceResponseHandler,
287
288
  createJsonResponseHandler as createJsonResponseHandler2,
288
289
  generateId,
@@ -379,6 +380,8 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
379
380
  format,
380
381
  const: constValue,
381
382
  minLength,
383
+ minItems,
384
+ maxItems,
382
385
  enum: enumValues
383
386
  } = jsonSchema;
384
387
  const result = {};
@@ -461,6 +464,12 @@ function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
461
464
  if (minLength !== void 0) {
462
465
  result.minLength = minLength;
463
466
  }
467
+ if (minItems !== void 0) {
468
+ result.minItems = minItems;
469
+ }
470
+ if (maxItems !== void 0) {
471
+ result.maxItems = maxItems;
472
+ }
464
473
  return result;
465
474
  }
466
475
  function convertJSONSchemaReference({
@@ -1956,6 +1965,12 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
1956
1965
  modelId: this.modelId,
1957
1966
  isVertexProvider
1958
1967
  });
1968
+ const toolNameMapping = createToolNameMapping({
1969
+ tools,
1970
+ providerToolNames: {
1971
+ "google.code_execution": "code_execution"
1972
+ }
1973
+ });
1959
1974
  const resolvedThinking = resolveThinkingConfig({
1960
1975
  reasoning,
1961
1976
  modelId: this.modelId,
@@ -2020,15 +2035,17 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2020
2035
  },
2021
2036
  warnings: [...warnings, ...toolWarnings],
2022
2037
  providerOptionsNames,
2023
- extraHeaders: vertexPaygoHeaders
2038
+ extraHeaders: vertexPaygoHeaders,
2039
+ toolNameMapping
2024
2040
  };
2025
2041
  }
2026
2042
  convertGenerateContentResponse({
2027
2043
  response,
2028
2044
  warnings,
2029
- providerOptionsNames
2045
+ providerOptionsNames,
2046
+ toolNameMapping
2030
2047
  }) {
2031
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s;
2048
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
2032
2049
  const wrapProviderMetadata = (payload) => Object.fromEntries(
2033
2050
  providerOptionsNames.map((name) => [name, payload])
2034
2051
  );
@@ -2048,7 +2065,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2048
2065
  content.push({
2049
2066
  type: "tool-call",
2050
2067
  toolCallId,
2051
- toolName: "code_execution",
2068
+ toolName: (_h = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _h : "code_execution",
2052
2069
  input: JSON.stringify(part.executableCode),
2053
2070
  providerExecuted: true
2054
2071
  });
@@ -2057,10 +2074,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2057
2074
  type: "tool-result",
2058
2075
  // Results correspond to the most recent executable code part.
2059
2076
  toolCallId: lastCodeExecutionToolCallId,
2060
- toolName: "code_execution",
2077
+ toolName: (_i = toolNameMapping == null ? void 0 : toolNameMapping.toCustomToolName("code_execution")) != null ? _i : "code_execution",
2061
2078
  result: {
2062
2079
  outcome: part.codeExecutionResult.outcome,
2063
- output: (_h = part.codeExecutionResult.output) != null ? _h : ""
2080
+ output: (_j = part.codeExecutionResult.output) != null ? _j : ""
2064
2081
  }
2065
2082
  });
2066
2083
  } else if ("text" in part && part.text != null) {
@@ -2084,7 +2101,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2084
2101
  type: "tool-call",
2085
2102
  toolCallId: part.functionCall.id || this.config.generateId(),
2086
2103
  toolName: part.functionCall.name,
2087
- input: JSON.stringify((_i = part.functionCall.args) != null ? _i : {}),
2104
+ input: JSON.stringify((_k = part.functionCall.args) != null ? _k : {}),
2088
2105
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
2089
2106
  thoughtSignature: part.thoughtSignature
2090
2107
  }) : void 0
@@ -2107,7 +2124,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2107
2124
  type: "tool-call",
2108
2125
  toolCallId,
2109
2126
  toolName: `server:${part.toolCall.toolType}`,
2110
- input: JSON.stringify((_j = part.toolCall.args) != null ? _j : {}),
2127
+ input: JSON.stringify((_l = part.toolCall.args) != null ? _l : {}),
2111
2128
  providerExecuted: true,
2112
2129
  dynamic: true,
2113
2130
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
@@ -2125,7 +2142,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2125
2142
  type: "tool-result",
2126
2143
  toolCallId: responseToolCallId,
2127
2144
  toolName: `server:${part.toolResponse.toolType}`,
2128
- result: (_k = part.toolResponse.response) != null ? _k : {},
2145
+ result: (_m = part.toolResponse.response) != null ? _m : {},
2129
2146
  providerMetadata: part.thoughtSignature ? wrapProviderMetadata({
2130
2147
  thoughtSignature: part.thoughtSignature,
2131
2148
  serverToolCallId: responseToolCallId,
@@ -2138,10 +2155,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2138
2155
  lastServerToolCallId = void 0;
2139
2156
  }
2140
2157
  }
2141
- const sources = (_l = extractSources({
2158
+ const sources = (_n = extractSources({
2142
2159
  groundingMetadata: candidate == null ? void 0 : candidate.groundingMetadata,
2143
2160
  generateId: this.config.generateId
2144
- })) != null ? _l : [];
2161
+ })) != null ? _n : [];
2145
2162
  for (const source of sources) {
2146
2163
  content.push(source);
2147
2164
  }
@@ -2160,22 +2177,28 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2160
2177
  usage: convertGoogleUsage(usageMetadata),
2161
2178
  warnings,
2162
2179
  providerMetadata: wrapProviderMetadata({
2163
- promptFeedback: (_m = response.promptFeedback) != null ? _m : null,
2164
- groundingMetadata: (_n = candidate == null ? void 0 : candidate.groundingMetadata) != null ? _n : null,
2165
- urlContextMetadata: (_o = candidate == null ? void 0 : candidate.urlContextMetadata) != null ? _o : null,
2166
- safetyRatings: (_p = candidate == null ? void 0 : candidate.safetyRatings) != null ? _p : null,
2180
+ promptFeedback: (_o = response.promptFeedback) != null ? _o : null,
2181
+ groundingMetadata: (_p = candidate == null ? void 0 : candidate.groundingMetadata) != null ? _p : null,
2182
+ urlContextMetadata: (_q = candidate == null ? void 0 : candidate.urlContextMetadata) != null ? _q : null,
2183
+ safetyRatings: (_r = candidate == null ? void 0 : candidate.safetyRatings) != null ? _r : null,
2167
2184
  usageMetadata: usageMetadata != null ? usageMetadata : null,
2168
- finishMessage: (_q = candidate == null ? void 0 : candidate.finishMessage) != null ? _q : null,
2169
- serviceTier: (_r = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _r : null
2185
+ finishMessage: (_s = candidate == null ? void 0 : candidate.finishMessage) != null ? _s : null,
2186
+ serviceTier: (_t = usageMetadata == null ? void 0 : usageMetadata.serviceTier) != null ? _t : null
2170
2187
  }),
2171
2188
  response: {
2172
2189
  // TODO timestamp, model id
2173
- id: (_s = response.responseId) != null ? _s : void 0
2190
+ id: (_u = response.responseId) != null ? _u : void 0
2174
2191
  }
2175
2192
  };
2176
2193
  }
2177
2194
  async doGenerate(options) {
2178
- const { args, warnings, providerOptionsNames, extraHeaders } = await this.getArgs(options);
2195
+ const {
2196
+ args,
2197
+ warnings,
2198
+ providerOptionsNames,
2199
+ extraHeaders,
2200
+ toolNameMapping
2201
+ } = await this.getArgs(options);
2179
2202
  const mergedHeaders = combineHeaders2(
2180
2203
  this.config.headers ? await resolve2(this.config.headers) : void 0,
2181
2204
  options.headers,
@@ -2199,7 +2222,8 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2199
2222
  const result = this.convertGenerateContentResponse({
2200
2223
  response,
2201
2224
  warnings,
2202
- providerOptionsNames
2225
+ providerOptionsNames,
2226
+ toolNameMapping
2203
2227
  });
2204
2228
  return {
2205
2229
  ...result,
@@ -2212,7 +2236,13 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2212
2236
  };
2213
2237
  }
2214
2238
  async doStream(options) {
2215
- const { args, warnings, providerOptionsNames, extraHeaders } = await this.getArgs(options, { isStreaming: true });
2239
+ const {
2240
+ args,
2241
+ warnings,
2242
+ providerOptionsNames,
2243
+ extraHeaders,
2244
+ toolNameMapping
2245
+ } = await this.getArgs(options, { isStreaming: true });
2216
2246
  const wrapProviderMetadata = (payload) => Object.fromEntries(
2217
2247
  providerOptionsNames.map((name) => [name, payload])
2218
2248
  );
@@ -2353,7 +2383,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2353
2383
  controller.enqueue({
2354
2384
  type: "tool-call",
2355
2385
  toolCallId,
2356
- toolName: "code_execution",
2386
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
2357
2387
  input: JSON.stringify(part.executableCode),
2358
2388
  providerExecuted: true
2359
2389
  });
@@ -2363,7 +2393,7 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2363
2393
  controller.enqueue({
2364
2394
  type: "tool-result",
2365
2395
  toolCallId,
2366
- toolName: "code_execution",
2396
+ toolName: toolNameMapping.toCustomToolName("code_execution"),
2367
2397
  result: {
2368
2398
  outcome: part.codeExecutionResult.outcome,
2369
2399
  output: (_g = part.codeExecutionResult.output) != null ? _g : ""
@@ -3070,7 +3100,8 @@ var googleFileUploadResponseSchema = lazySchema6(
3070
3100
  () => zodSchema6(
3071
3101
  z6.object({
3072
3102
  file: z6.object({
3073
- name: z6.string()
3103
+ name: z6.string(),
3104
+ expirationTime: z6.string().nullish()
3074
3105
  })
3075
3106
  })
3076
3107
  )
@@ -3178,9 +3209,8 @@ var GoogleBatchLanguageModel = class _GoogleBatchLanguageModel extends GoogleLan
3178
3209
  const createUrl = `${this.batchConfig.baseURL}/${getModelPath(
3179
3210
  this.modelId
3180
3211
  )}:batchGenerateContent`;
3181
- let operation;
3182
3212
  if (fileParts == null) {
3183
- const { value } = await postJsonToApi3({
3213
+ const { value: operation2 } = await postJsonToApi3({
3184
3214
  url: createUrl,
3185
3215
  headers,
3186
3216
  body: inlineBatchBody,
@@ -3191,81 +3221,89 @@ var GoogleBatchLanguageModel = class _GoogleBatchLanguageModel extends GoogleLan
3191
3221
  abortSignal: options.abortSignal,
3192
3222
  fetch: this.batchConfig.fetch
3193
3223
  });
3194
- operation = value;
3195
- } else {
3196
- const inputFile = new Blob(fileParts, { type: "application/jsonl" });
3197
- fileParts.length = 0;
3198
- if (inputFile.size > googleBatchInputFileMaxBytes) {
3199
- throw new InvalidArgumentError({
3200
- argument: "requests",
3201
- message: "Google batch input files must not exceed 2 GB."
3202
- });
3203
- }
3204
- const { value: uploadUrl } = await postJsonToApi3({
3205
- url: `${this.getBaseOrigin()}/upload/v1beta/files`,
3206
- headers: combineHeaders3(headers, {
3207
- "X-Goog-Upload-Protocol": "resumable",
3208
- "X-Goog-Upload-Command": "start",
3209
- "X-Goog-Upload-Header-Content-Length": String(inputFile.size),
3210
- "X-Goog-Upload-Header-Content-Type": "application/jsonl"
3211
- }),
3212
- body: {
3213
- file: {
3214
- display_name: `${displayName}-input`
3215
- }
3216
- },
3217
- failedResponseHandler: googleFailedResponseHandler,
3218
- successfulResponseHandler: googleUploadUrlResponseHandler,
3219
- abortSignal: options.abortSignal,
3220
- fetch: this.batchConfig.fetch
3221
- });
3222
- const { value: uploadedFile } = await postToApi({
3223
- url: uploadUrl,
3224
- headers: {
3225
- "X-Goog-Upload-Offset": "0",
3226
- "X-Goog-Upload-Command": "upload, finalize",
3227
- "Content-Type": "application/jsonl"
3228
- },
3229
- body: {
3230
- content: inputFile,
3231
- values: {
3232
- byteLength: inputFile.size,
3233
- mediaType: "application/jsonl"
3234
- }
3235
- },
3236
- failedResponseHandler: googleFailedResponseHandler,
3237
- successfulResponseHandler: createJsonResponseHandler3(
3238
- googleFileUploadResponseSchema
3239
- ),
3240
- abortSignal: options.abortSignal,
3241
- fetch: this.batchConfig.fetch
3242
- });
3243
- const { value } = await postJsonToApi3({
3244
- url: createUrl,
3245
- headers,
3246
- body: {
3247
- batch: {
3248
- displayName,
3249
- ...options.webhookUrl != null && {
3250
- webhookConfig: { uris: [options.webhookUrl] }
3251
- },
3252
- inputConfig: {
3253
- fileName: uploadedFile.file.name
3254
- }
3255
- }
3256
- },
3257
- failedResponseHandler: googleFailedResponseHandler,
3258
- successfulResponseHandler: createJsonResponseHandler3(
3259
- googleBatchOperationSchema
3260
- ),
3261
- abortSignal: options.abortSignal,
3262
- fetch: this.batchConfig.fetch
3224
+ return {
3225
+ batchId: operation2.name,
3226
+ ...convertGoogleBatchStatus(operation2),
3227
+ warnings
3228
+ };
3229
+ }
3230
+ const inputFile = new Blob(fileParts, { type: "application/jsonl" });
3231
+ fileParts.length = 0;
3232
+ if (inputFile.size > googleBatchInputFileMaxBytes) {
3233
+ throw new InvalidArgumentError({
3234
+ argument: "requests",
3235
+ message: "Google batch input files must not exceed 2 GB."
3263
3236
  });
3264
- operation = value;
3265
3237
  }
3238
+ const { value: uploadUrl } = await postJsonToApi3({
3239
+ url: `${this.getBaseOrigin()}/upload/v1beta/files`,
3240
+ headers: combineHeaders3(headers, {
3241
+ "X-Goog-Upload-Protocol": "resumable",
3242
+ "X-Goog-Upload-Command": "start",
3243
+ "X-Goog-Upload-Header-Content-Length": String(inputFile.size),
3244
+ "X-Goog-Upload-Header-Content-Type": "application/jsonl"
3245
+ }),
3246
+ body: {
3247
+ file: {
3248
+ display_name: `${displayName}-input`
3249
+ }
3250
+ },
3251
+ failedResponseHandler: googleFailedResponseHandler,
3252
+ successfulResponseHandler: googleUploadUrlResponseHandler,
3253
+ abortSignal: options.abortSignal,
3254
+ fetch: this.batchConfig.fetch
3255
+ });
3256
+ const { value: uploadedFile } = await postToApi({
3257
+ url: uploadUrl,
3258
+ headers: {
3259
+ "X-Goog-Upload-Offset": "0",
3260
+ "X-Goog-Upload-Command": "upload, finalize",
3261
+ "Content-Type": "application/jsonl"
3262
+ },
3263
+ body: {
3264
+ content: inputFile,
3265
+ values: {
3266
+ byteLength: inputFile.size,
3267
+ mediaType: "application/jsonl"
3268
+ }
3269
+ },
3270
+ failedResponseHandler: googleFailedResponseHandler,
3271
+ successfulResponseHandler: createJsonResponseHandler3(
3272
+ googleFileUploadResponseSchema
3273
+ ),
3274
+ abortSignal: options.abortSignal,
3275
+ fetch: this.batchConfig.fetch
3276
+ });
3277
+ const { value: operation } = await postJsonToApi3({
3278
+ url: createUrl,
3279
+ headers,
3280
+ body: {
3281
+ batch: {
3282
+ displayName,
3283
+ ...options.webhookUrl != null && {
3284
+ webhookConfig: { uris: [options.webhookUrl] }
3285
+ },
3286
+ inputConfig: {
3287
+ fileName: uploadedFile.file.name
3288
+ }
3289
+ }
3290
+ },
3291
+ failedResponseHandler: googleFailedResponseHandler,
3292
+ successfulResponseHandler: createJsonResponseHandler3(
3293
+ googleBatchOperationSchema
3294
+ ),
3295
+ abortSignal: options.abortSignal,
3296
+ fetch: this.batchConfig.fetch
3297
+ });
3266
3298
  return {
3267
3299
  batchId: operation.name,
3268
3300
  ...convertGoogleBatchStatus(operation),
3301
+ providerMetadata: {
3302
+ google: {
3303
+ inputFileId: uploadedFile.file.name,
3304
+ ...uploadedFile.file.expirationTime != null ? { inputFileExpiresAt: uploadedFile.file.expirationTime } : {}
3305
+ }
3306
+ },
3269
3307
  warnings
3270
3308
  };
3271
3309
  }
@@ -5096,6 +5134,21 @@ function buildGoogleInteractionsStreamTransform({
5096
5134
  }
5097
5135
  }
5098
5136
  }
5137
+ } else if (stepType === "processing_call" || stepType === "processing_result") {
5138
+ const google2 = {};
5139
+ if ((step == null ? void 0 : step.signature) != null) google2.signature = step.signature;
5140
+ if (interactionId != null) google2.interactionId = interactionId;
5141
+ if (stepType === "processing_call") {
5142
+ google2.processingId = (step == null ? void 0 : step.id) || blockId;
5143
+ } else {
5144
+ google2.processingCallId = (step == null ? void 0 : step.call_id) || blockId;
5145
+ }
5146
+ openBlocks.set(index, {
5147
+ kind: "custom",
5148
+ id: blockId,
5149
+ customKind: `google.${stepType}`,
5150
+ google: google2
5151
+ });
5099
5152
  } else if (stepType === "function_call") {
5100
5153
  const toolCallId = (step == null ? void 0 : step.id) || blockId;
5101
5154
  const toolName = (_b = step == null ? void 0 : step.name) != null ? _b : "unknown";
@@ -5212,7 +5265,16 @@ function buildGoogleInteractionsStreamTransform({
5212
5265
  break;
5213
5266
  }
5214
5267
  const delta = event.delta;
5215
- if (open.kind === "text" && (delta == null ? void 0 : delta.type) === "text") {
5268
+ if (open.kind === "custom" && ((delta == null ? void 0 : delta.type) === "processing_call" || (delta == null ? void 0 : delta.type) === "processing_result")) {
5269
+ if (delta.signature != null)
5270
+ open.google.signature = delta.signature;
5271
+ if (delta.type === "processing_call" && delta.id != null && delta.id.length > 0) {
5272
+ open.google.processingId = delta.id;
5273
+ }
5274
+ if (delta.type === "processing_result" && delta.call_id != null && delta.call_id.length > 0) {
5275
+ open.google.processingCallId = delta.call_id;
5276
+ }
5277
+ } else if (open.kind === "text" && (delta == null ? void 0 : delta.type) === "text") {
5216
5278
  const text = (_l = delta.text) != null ? _l : "";
5217
5279
  if (text.length > 0) {
5218
5280
  controller.enqueue({
@@ -5349,6 +5411,12 @@ function buildGoogleInteractionsStreamTransform({
5349
5411
  input: accumulated,
5350
5412
  ...providerMetadata ? { providerMetadata } : {}
5351
5413
  });
5414
+ } else if (open.kind === "custom") {
5415
+ controller.enqueue({
5416
+ type: "custom",
5417
+ kind: open.customKind,
5418
+ providerMetadata: { google: open.google }
5419
+ });
5352
5420
  } else if (open.kind === "builtin_tool_call" && !open.callEmitted) {
5353
5421
  controller.enqueue({
5354
5422
  type: "tool-call",
@@ -5473,7 +5541,7 @@ function convertToGoogleInteractionsInput({
5473
5541
  store,
5474
5542
  mediaResolution
5475
5543
  }) {
5476
- var _a, _b, _c, _d, _e, _f, _g;
5544
+ var _a, _b, _c, _d, _e, _f, _g, _h;
5477
5545
  const warnings = [];
5478
5546
  const incoherentCombo = previousInteractionId != null && store === false;
5479
5547
  const shouldCompact = previousInteractionId != null && store !== false;
@@ -5545,10 +5613,32 @@ function convertToGoogleInteractionsInput({
5545
5613
  if (fileBlock != null) {
5546
5614
  pendingModelOutput.push(fileBlock);
5547
5615
  }
5616
+ } else if (part.type === "custom") {
5617
+ flushModelOutput();
5618
+ const google2 = (_c = part.providerOptions) == null ? void 0 : _c.google;
5619
+ const signature = typeof (google2 == null ? void 0 : google2.signature) === "string" ? google2.signature : void 0;
5620
+ if (part.kind === "google.processing_call" && typeof (google2 == null ? void 0 : google2.processingId) === "string") {
5621
+ steps.push({
5622
+ type: "processing_call",
5623
+ id: google2.processingId,
5624
+ ...signature != null ? { signature } : {}
5625
+ });
5626
+ } else if (part.kind === "google.processing_result" && typeof (google2 == null ? void 0 : google2.processingCallId) === "string") {
5627
+ steps.push({
5628
+ type: "processing_result",
5629
+ call_id: google2.processingCallId,
5630
+ ...signature != null ? { signature } : {}
5631
+ });
5632
+ } else {
5633
+ warnings.push({
5634
+ type: "other",
5635
+ message: `google.interactions: unsupported or invalid custom assistant content part "${part.kind}"; part dropped.`
5636
+ });
5637
+ }
5548
5638
  } else if (part.type === "tool-call") {
5549
5639
  flushModelOutput();
5550
- const signature = (_d = (_c = part.providerOptions) == null ? void 0 : _c.google) == null ? void 0 : _d.signature;
5551
- const args = typeof part.input === "string" ? safeParseToolArgs(part.input) : (_e = part.input) != null ? _e : {};
5640
+ const signature = (_e = (_d = part.providerOptions) == null ? void 0 : _d.google) == null ? void 0 : _e.signature;
5641
+ const args = typeof part.input === "string" ? safeParseToolArgs(part.input) : (_f = part.input) != null ? _f : {};
5552
5642
  steps.push({
5553
5643
  type: "function_call",
5554
5644
  id: part.toolCallId,
@@ -5580,7 +5670,7 @@ function convertToGoogleInteractionsInput({
5580
5670
  toolCallId: part.toolCallId,
5581
5671
  toolName: part.toolName,
5582
5672
  output: part.output,
5583
- signature: (_g = (_f = part.providerOptions) == null ? void 0 : _f.google) == null ? void 0 : _g.signature,
5673
+ signature: (_h = (_g = part.providerOptions) == null ? void 0 : _g.google) == null ? void 0 : _h.signature,
5584
5674
  warnings
5585
5675
  });
5586
5676
  content.push(block);
@@ -5633,6 +5723,7 @@ function convertFilePartToContent({
5633
5723
  return void 0;
5634
5724
  }
5635
5725
  const resolutionField = mediaResolution != null && (kind === "image" || kind === "video") ? { resolution: mediaResolution } : {};
5726
+ const processingField = kind === "video" ? getVideoProcessingField({ part, warnings }) : {};
5636
5727
  switch (part.data.type) {
5637
5728
  case "data": {
5638
5729
  const mimeType = resolveFullMediaType2({ part });
@@ -5640,7 +5731,8 @@ function convertFilePartToContent({
5640
5731
  type: kind,
5641
5732
  data: convertToBase643(part.data.data),
5642
5733
  mime_type: mimeType,
5643
- ...resolutionField
5734
+ ...resolutionField,
5735
+ ...processingField
5644
5736
  };
5645
5737
  }
5646
5738
  case "url": {
@@ -5648,7 +5740,8 @@ function convertFilePartToContent({
5648
5740
  type: kind,
5649
5741
  uri: part.data.url.toString(),
5650
5742
  ...isFullMediaType2(part.mediaType) ? { mime_type: part.mediaType } : {},
5651
- ...resolutionField
5743
+ ...resolutionField,
5744
+ ...processingField
5652
5745
  };
5653
5746
  }
5654
5747
  case "reference": {
@@ -5660,11 +5753,41 @@ function convertFilePartToContent({
5660
5753
  type: kind,
5661
5754
  uri,
5662
5755
  ...isFullMediaType2(part.mediaType) ? { mime_type: part.mediaType } : {},
5663
- ...resolutionField
5756
+ ...resolutionField,
5757
+ ...processingField
5664
5758
  };
5665
5759
  }
5666
5760
  }
5667
5761
  }
5762
+ function getVideoProcessingField({
5763
+ part,
5764
+ warnings
5765
+ }) {
5766
+ var _a, _b;
5767
+ const processing = (_b = (_a = part.providerOptions) == null ? void 0 : _a.google) == null ? void 0 : _b.processing;
5768
+ if (processing == null) {
5769
+ return {};
5770
+ }
5771
+ if (processing === "agentic" || processing === "static") {
5772
+ return { processing };
5773
+ }
5774
+ if (typeof processing === "object" && !Array.isArray(processing) && processing.type === "static") {
5775
+ const config = processing;
5776
+ return {
5777
+ processing: {
5778
+ type: "static",
5779
+ ...typeof config.startOffset === "number" ? { start_offset: config.startOffset } : {},
5780
+ ...typeof config.endOffset === "number" ? { end_offset: config.endOffset } : {},
5781
+ ...typeof config.fps === "number" ? { fps: config.fps } : {}
5782
+ }
5783
+ };
5784
+ }
5785
+ warnings.push({
5786
+ type: "other",
5787
+ message: 'google.interactions: invalid providerOptions.google.processing on video file part; expected "agentic", "static", or a static processing configuration. Option dropped.'
5788
+ });
5789
+ return {};
5790
+ }
5668
5791
  function compactPromptForPreviousInteraction({
5669
5792
  prompt,
5670
5793
  previousInteractionId
@@ -5984,6 +6107,16 @@ var stepSchema = () => {
5984
6107
  signature: z20.string().nullish(),
5985
6108
  summary: z20.array(thoughtSummaryItemSchema()).nullish()
5986
6109
  }).loose();
6110
+ const processingCallStep = z20.object({
6111
+ type: z20.literal("processing_call"),
6112
+ id: z20.string(),
6113
+ signature: z20.string().nullish()
6114
+ }).loose();
6115
+ const processingResultStep = z20.object({
6116
+ type: z20.literal("processing_result"),
6117
+ call_id: z20.string(),
6118
+ signature: z20.string().nullish()
6119
+ }).loose();
5987
6120
  const builtinToolCallStep = z20.object({
5988
6121
  type: z20.enum(BUILTIN_TOOL_CALL_STEP_TYPES),
5989
6122
  id: z20.string(),
@@ -6007,6 +6140,8 @@ var stepSchema = () => {
6007
6140
  modelOutputStep,
6008
6141
  functionCallStep,
6009
6142
  thoughtStep,
6143
+ processingCallStep,
6144
+ processingResultStep,
6010
6145
  builtinToolCallStep,
6011
6146
  builtinToolResultStep,
6012
6147
  z20.object({ type: z20.string() }).loose()
@@ -6380,7 +6515,9 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
6380
6515
  // src/interactions/parse-google-interactions-outputs.ts
6381
6516
  function googleProviderMetadata({
6382
6517
  signature,
6383
- interactionId
6518
+ interactionId,
6519
+ processingId,
6520
+ processingCallId
6384
6521
  }) {
6385
6522
  const google2 = {};
6386
6523
  if (signature != null) {
@@ -6389,6 +6526,12 @@ function googleProviderMetadata({
6389
6526
  if (interactionId != null) {
6390
6527
  google2.interactionId = interactionId;
6391
6528
  }
6529
+ if (processingId != null) {
6530
+ google2.processingId = processingId;
6531
+ }
6532
+ if (processingCallId != null) {
6533
+ google2.processingCallId = processingCallId;
6534
+ }
6392
6535
  return Object.keys(google2).length > 0 ? { providerMetadata: { google: google2 } } : {};
6393
6536
  }
6394
6537
  var BUILTIN_TOOL_CALL_TYPES2 = /* @__PURE__ */ new Set([
@@ -6503,6 +6646,34 @@ function parseGoogleInteractionsOutputs({
6503
6646
  });
6504
6647
  break;
6505
6648
  }
6649
+ case "processing_call": {
6650
+ const call = step;
6651
+ const processingId = call.id || generateId4();
6652
+ content.push({
6653
+ type: "custom",
6654
+ kind: "google.processing_call",
6655
+ ...googleProviderMetadata({
6656
+ signature: call.signature,
6657
+ interactionId,
6658
+ processingId
6659
+ })
6660
+ });
6661
+ break;
6662
+ }
6663
+ case "processing_result": {
6664
+ const result = step;
6665
+ const processingCallId = result.call_id || generateId4();
6666
+ content.push({
6667
+ type: "custom",
6668
+ kind: "google.processing_result",
6669
+ ...googleProviderMetadata({
6670
+ signature: result.signature,
6671
+ interactionId,
6672
+ processingCallId
6673
+ })
6674
+ });
6675
+ break;
6676
+ }
6506
6677
  case "function_call": {
6507
6678
  hasFunctionCall = true;
6508
6679
  const call = step;