@depup/ai-sdk__google 4.0.69-depup.0 → 4.0.72-depup.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.72
4
+
5
+ ### Patch Changes
6
+
7
+ - 4a994ad: feat(google): realtime session options for Gemini 3.8 Live
8
+
9
+ Add `thinkingConfig` (`thinkingLevel`, `thinkingBudget`, `includeThoughts`) and
10
+ `defaultToolBehavior` to `GoogleRealtimeModelOptions`. `thinkingConfig` is merged
11
+ into the Live `setup.generationConfig`. Background-reasoning Live models such as
12
+ `gemini-3.8-live-extended-thinking` require exactly one of `thinkingLevel` or
13
+ `thinkingBudget`, so the provider sends `thinkingLevel: 'low'` on those models
14
+ when neither is set. `defaultToolBehavior` stamps `behavior` on every function
15
+ declaration in the setup.
16
+
17
+ Forward the Live `interactionStatus` and `waitingForInput` server messages as
18
+ custom events so applications can tell when a background-reasoning model is idle,
19
+ since `turnComplete` alone no longer means that.
20
+
21
+ ## 4.0.71
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [5c0054d]
26
+ - Updated dependencies [39535af]
27
+ - @ai-sdk/provider@4.0.15
28
+ - @ai-sdk/provider-utils@5.0.41
29
+
30
+ ## 4.0.70
31
+
32
+ ### Patch Changes
33
+
34
+ - 2a32459: fix(google): preserve JSON Schema instead of converting to OpenAPI schema
35
+ - d93e295: fix(google): keep a realtime `functionResponse.response` an object
36
+
37
+ Gemini types that field as a `google.protobuf.Struct`, which accepts an object and
38
+ nothing else. `onToolCall` returns `unknown` and `addToolOutput` takes `unknown`, so a
39
+ string, number, array or `null` tool result reached the wire unwrapped, Gemini closed
40
+ the socket with `1007`, and the close code was dropped on the way back so the
41
+ application saw a plain disconnect. A non-object result is now wrapped under the
42
+ `output` key the field's own docstring prescribes; an object is passed through
43
+ unchanged, as before.
44
+
45
+ An `output` that is not valid JSON no longer becomes `{}`. That branch told the model
46
+ the tool had returned an empty object, with nothing thrown and the socket still up, so
47
+ the answer was wrong with nothing to notice. The text is kept instead.
48
+
3
49
  ## 4.0.69
4
50
 
5
51
  ### Patch Changes
package/README.md CHANGED
@@ -13,8 +13,8 @@ npm install @depup/ai-sdk__google
13
13
 
14
14
  | Field | Value |
15
15
  |-------|-------|
16
- | Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.69 |
17
- | Processed | 2026-09-12 |
16
+ | Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.72 |
17
+ | Processed | 2026-09-16 |
18
18
  | Smoke test | failed |
19
19
  | Deps updated | 0 |
20
20
 
package/changes.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "bumped": {},
3
- "timestamp": "2026-09-12T08:09:52.486Z",
3
+ "timestamp": "2026-09-16T00:30:55.501Z",
4
4
  "totalUpdated": 0
5
5
  }
package/dist/index.d.ts CHANGED
@@ -762,6 +762,41 @@ type GoogleRealtimeModelOptions = {
762
762
  */
763
763
  echoTargetLanguage?: boolean;
764
764
  };
765
+ /**
766
+ * Gemini Live thinking configuration.
767
+ *
768
+ * Supported by Live models with background reasoning (e.g.
769
+ * `gemini-3.8-live-extended-thinking`), which can process multi-step
770
+ * reasoning and function calls while streaming audio responses. Not
771
+ * supported by latency-optimized models (e.g. `gemini-3.8-live`).
772
+ */
773
+ thinkingConfig?: {
774
+ /**
775
+ * Thinking effort level. Background-reasoning Live models require exactly
776
+ * one of `thinkingLevel` or `thinkingBudget`; when neither is set, the
777
+ * provider sends `thinkingLevel: 'low'` on those models.
778
+ */
779
+ thinkingLevel?: 'low' | 'medium' | 'high';
780
+ /**
781
+ * Token budget for background thinking. Mutually exclusive with
782
+ * `thinkingLevel`; setting it suppresses the default level.
783
+ */
784
+ thinkingBudget?: number;
785
+ /**
786
+ * Whether thought summaries should be included in the response.
787
+ */
788
+ includeThoughts?: boolean;
789
+ };
790
+ /**
791
+ * Default `behavior` stamped onto every function declaration in the
792
+ * session setup.
793
+ *
794
+ * Gemini 3.8 Live models default to `NON_BLOCKING` (asynchronous) function
795
+ * calling. Set to `BLOCKING` for synchronous calls on models that support it
796
+ * (e.g. `gemini-3.8-live`); background-reasoning models accept only
797
+ * `NON_BLOCKING`.
798
+ */
799
+ defaultToolBehavior?: 'BLOCKING' | 'NON_BLOCKING';
765
800
  };
766
801
 
767
802
  interface GoogleTranscriptionModelConfig {
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.69" : "0.0.0-test";
10
+ var VERSION = true ? "4.0.72" : "0.0.0-test";
11
11
 
12
12
  // src/google-embedding-model.ts
13
13
  import {
@@ -255,7 +255,7 @@ var googleGenerativeAISingleEmbeddingResponseSchema = lazySchema3(
255
255
  import {
256
256
  InvalidArgumentError,
257
257
  InvalidResponseDataError,
258
- UnsupportedFunctionalityError as UnsupportedFunctionalityError4
258
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError3
259
259
  } from "@ai-sdk/provider";
260
260
  import {
261
261
  combineHeaders as combineHeaders3,
@@ -329,289 +329,9 @@ function convertGoogleUsage(usage) {
329
329
  };
330
330
  }
331
331
 
332
- // src/convert-json-schema-to-openapi-schema.ts
333
- import {
334
- UnsupportedFunctionalityError
335
- } from "@ai-sdk/provider";
336
- var recursiveReferenceFunctionalityPrefix = "recursive JSON Schema reference:";
337
- function isRecursiveJSONSchemaReferenceError(error) {
338
- return UnsupportedFunctionalityError.isInstance(error) && error.functionality.startsWith(recursiveReferenceFunctionalityPrefix);
339
- }
340
- function convertJSONSchemaToOpenAPISchema(jsonSchema, isRoot = true) {
341
- const rootSchema = typeof jsonSchema === "object" ? jsonSchema : void 0;
342
- return convertJSONSchemaDefinition(jsonSchema, isRoot, {
343
- definitions: rootSchema == null ? void 0 : rootSchema.definitions,
344
- dollarDefinitions: rootSchema == null ? void 0 : rootSchema.$defs,
345
- resolvingReferences: /* @__PURE__ */ new Set()
346
- });
347
- }
348
- function convertJSONSchemaDefinition(jsonSchema, isRoot, referenceContext) {
349
- if (jsonSchema == null) {
350
- return void 0;
351
- }
352
- if (typeof jsonSchema === "boolean") {
353
- return { type: "boolean", properties: {} };
354
- }
355
- if (jsonSchema.$ref != null) {
356
- return convertJSONSchemaReference({
357
- jsonSchema,
358
- reference: jsonSchema.$ref,
359
- isRoot,
360
- referenceContext
361
- });
362
- }
363
- if (isEmptyObjectSchema(jsonSchema)) {
364
- if (isRoot) {
365
- return void 0;
366
- }
367
- if (jsonSchema.description) {
368
- return { type: "object", description: jsonSchema.description };
369
- }
370
- return { type: "object" };
371
- }
372
- const {
373
- type,
374
- description,
375
- required,
376
- properties,
377
- items,
378
- allOf,
379
- anyOf,
380
- oneOf,
381
- format,
382
- const: constValue,
383
- minLength,
384
- minItems,
385
- maxItems,
386
- enum: enumValues
387
- } = jsonSchema;
388
- const result = {};
389
- if (description) result.description = description;
390
- if (required) result.required = required;
391
- if (format) result.format = format;
392
- if (type) {
393
- if (Array.isArray(type)) {
394
- const hasNull = type.includes("null");
395
- const nonNullTypes = type.filter((t) => t !== "null");
396
- if (nonNullTypes.length === 0) {
397
- result.type = "null";
398
- } else {
399
- result.anyOf = nonNullTypes.map((t) => ({ type: t }));
400
- if (hasNull) {
401
- result.nullable = true;
402
- }
403
- }
404
- } else {
405
- result.type = type;
406
- }
407
- }
408
- const values = enumValues != null ? enumValues : constValue !== void 0 ? [constValue] : void 0;
409
- if (values !== void 0) {
410
- addEnumToSchema({ values, type, result });
411
- }
412
- if (properties != null) {
413
- result.properties = Object.entries(properties).reduce(
414
- (acc, [key, value]) => {
415
- acc[key] = convertJSONSchemaDefinition(value, false, referenceContext);
416
- return acc;
417
- },
418
- {}
419
- );
420
- }
421
- if (items) {
422
- result.items = Array.isArray(items) ? items.map(
423
- (item) => convertJSONSchemaDefinition(item, false, referenceContext)
424
- ) : convertJSONSchemaDefinition(items, false, referenceContext);
425
- }
426
- if (allOf) {
427
- result.allOf = allOf.map(
428
- (item) => convertJSONSchemaDefinition(item, false, referenceContext)
429
- );
430
- }
431
- if (anyOf) {
432
- if (anyOf.some(
433
- (schema) => typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null"
434
- )) {
435
- const nonNullSchemas = anyOf.filter(
436
- (schema) => !(typeof schema === "object" && (schema == null ? void 0 : schema.type) === "null")
437
- );
438
- if (nonNullSchemas.length === 1) {
439
- const converted = convertJSONSchemaDefinition(
440
- nonNullSchemas[0],
441
- false,
442
- referenceContext
443
- );
444
- if (typeof converted === "object") {
445
- result.nullable = true;
446
- Object.assign(result, converted);
447
- }
448
- } else {
449
- result.anyOf = nonNullSchemas.map(
450
- (item) => convertJSONSchemaDefinition(item, false, referenceContext)
451
- );
452
- result.nullable = true;
453
- }
454
- } else {
455
- result.anyOf = anyOf.map(
456
- (item) => convertJSONSchemaDefinition(item, false, referenceContext)
457
- );
458
- }
459
- }
460
- if (oneOf) {
461
- result.oneOf = oneOf.map(
462
- (item) => convertJSONSchemaDefinition(item, false, referenceContext)
463
- );
464
- }
465
- if (minLength !== void 0) {
466
- result.minLength = minLength;
467
- }
468
- if (minItems !== void 0) {
469
- result.minItems = minItems;
470
- }
471
- if (maxItems !== void 0) {
472
- result.maxItems = maxItems;
473
- }
474
- return result;
475
- }
476
- function convertJSONSchemaReference({
477
- jsonSchema,
478
- reference,
479
- isRoot,
480
- referenceContext
481
- }) {
482
- const { definition, referenceKey } = getReferencedDefinition(
483
- reference,
484
- referenceContext
485
- );
486
- if (referenceContext.resolvingReferences.has(referenceKey)) {
487
- throw new UnsupportedFunctionalityError({
488
- functionality: `${recursiveReferenceFunctionalityPrefix} ${reference}`,
489
- message: "Google schema conversion does not support recursive JSON Schema references."
490
- });
491
- }
492
- const resolvingReferences = new Set(referenceContext.resolvingReferences);
493
- resolvingReferences.add(referenceKey);
494
- const { $ref: _reference, ...siblingSchema } = jsonSchema;
495
- const resolvedSchema = typeof definition === "boolean" ? definition ? siblingSchema : false : { ...definition, ...siblingSchema };
496
- return convertJSONSchemaDefinition(resolvedSchema, isRoot, {
497
- ...referenceContext,
498
- resolvingReferences
499
- });
500
- }
501
- function getReferencedDefinition(reference, referenceContext) {
502
- const definitionSources = [
503
- {
504
- prefix: "#/$defs/",
505
- definitions: referenceContext.dollarDefinitions
506
- },
507
- {
508
- prefix: "#/definitions/",
509
- definitions: referenceContext.definitions
510
- }
511
- ];
512
- const source = definitionSources.find(
513
- ({ prefix }) => reference.startsWith(prefix)
514
- );
515
- const encodedDefinitionName = source ? reference.slice(source.prefix.length) : void 0;
516
- if (source == null || encodedDefinitionName == null || encodedDefinitionName.length === 0 || encodedDefinitionName.includes("/")) {
517
- throwUnsupportedReference(reference);
518
- }
519
- let decodedDefinitionName;
520
- try {
521
- decodedDefinitionName = decodeURIComponent(encodedDefinitionName);
522
- } catch (e) {
523
- throwUnsupportedReference(reference);
524
- }
525
- if (decodedDefinitionName.includes("/") || /~(?![01])/u.test(decodedDefinitionName) || source.definitions == null) {
526
- throwUnsupportedReference(reference);
527
- }
528
- const definitionName = decodedDefinitionName.replace(
529
- /~[01]/g,
530
- (match) => match === "~1" ? "/" : "~"
531
- );
532
- if (!Object.prototype.hasOwnProperty.call(source.definitions, definitionName)) {
533
- throwUnsupportedReference(reference);
534
- }
535
- return {
536
- definition: source.definitions[definitionName],
537
- referenceKey: `${source.prefix}${definitionName}`
538
- };
539
- }
540
- function throwUnsupportedReference(reference) {
541
- throw new UnsupportedFunctionalityError({
542
- functionality: `JSON Schema reference: ${reference}`,
543
- message: "Google schema conversion only supports references to direct children of root-level $defs or definitions."
544
- });
545
- }
546
- function addEnumToSchema({
547
- values,
548
- type,
549
- result
550
- }) {
551
- const nullable = Array.isArray(type) && type.includes("null") || type === void 0 && values.includes(null);
552
- const enumValues = nullable ? values.filter((value) => value !== null) : values;
553
- if (values.length > 0 && values.every((value) => value === null)) {
554
- const typeAllowsNull = type === void 0 || type === "null" || Array.isArray(type) && type.includes("null");
555
- if (typeAllowsNull) {
556
- result.type = "null";
557
- if (Array.isArray(type)) {
558
- delete result.anyOf;
559
- }
560
- return;
561
- }
562
- }
563
- const enumType = getEnumType({ values: enumValues, type });
564
- if (enumType === void 0) {
565
- throw new UnsupportedFunctionalityError({
566
- functionality: "JSON Schema enum with mixed or unsupported values",
567
- message: "Google does not support this JSON Schema enum. Enum values must share one supported primitive type and match the schema type."
568
- });
569
- }
570
- result.type = enumType;
571
- if (Array.isArray(type)) {
572
- delete result.anyOf;
573
- }
574
- if (nullable) {
575
- result.nullable = true;
576
- }
577
- if (enumType === "string") {
578
- result.enum = enumValues;
579
- } else {
580
- result.format = "enum";
581
- result.enum = enumValues.map(String);
582
- }
583
- }
584
- function getEnumType({
585
- values,
586
- type
587
- }) {
588
- if (values.length === 0) {
589
- return void 0;
590
- }
591
- const typeAllows = (enumType) => type === void 0 || type === enumType || Array.isArray(type) && type.includes(enumType);
592
- if (typeAllows("string") && values.every((value) => typeof value === "string")) {
593
- return "string";
594
- }
595
- if ((typeAllows("number") || typeAllows("integer")) && values.every((value) => typeof value === "number" && Number.isFinite(value))) {
596
- if (typeAllows("number")) {
597
- return "number";
598
- }
599
- if (values.every((value) => Number.isInteger(value))) {
600
- return "integer";
601
- }
602
- }
603
- if (typeAllows("boolean") && values.every((value) => typeof value === "boolean")) {
604
- return "boolean";
605
- }
606
- return void 0;
607
- }
608
- function isEmptyObjectSchema(jsonSchema) {
609
- return jsonSchema != null && typeof jsonSchema === "object" && jsonSchema.type === "object" && (jsonSchema.properties == null || Object.keys(jsonSchema.properties).length === 0) && !jsonSchema.additionalProperties;
610
- }
611
-
612
332
  // src/convert-to-google-messages.ts
613
333
  import {
614
- UnsupportedFunctionalityError as UnsupportedFunctionalityError2
334
+ UnsupportedFunctionalityError
615
335
  } from "@ai-sdk/provider";
616
336
  import {
617
337
  convertToBase64,
@@ -768,7 +488,7 @@ function convertToGoogleMessages(prompt, options) {
768
488
  switch (role) {
769
489
  case "system": {
770
490
  if (!systemMessagesAllowed) {
771
- throw new UnsupportedFunctionalityError2({
491
+ throw new UnsupportedFunctionalityError({
772
492
  functionality: "system messages are only supported at the beginning of the conversation"
773
493
  });
774
494
  }
@@ -797,7 +517,7 @@ function convertToGoogleMessages(prompt, options) {
797
517
  }
798
518
  case "reference": {
799
519
  if (isVertexLike) {
800
- throw new UnsupportedFunctionalityError2({
520
+ throw new UnsupportedFunctionalityError({
801
521
  functionality: "file parts with provider references"
802
522
  });
803
523
  }
@@ -865,7 +585,7 @@ function convertToGoogleMessages(prompt, options) {
865
585
  case "reasoning-file": {
866
586
  switch (part.data.type) {
867
587
  case "url": {
868
- throw new UnsupportedFunctionalityError2({
588
+ throw new UnsupportedFunctionalityError({
869
589
  functionality: "File data URLs in assistant messages are not supported"
870
590
  });
871
591
  }
@@ -885,13 +605,13 @@ function convertToGoogleMessages(prompt, options) {
885
605
  case "file": {
886
606
  switch (part.data.type) {
887
607
  case "url": {
888
- throw new UnsupportedFunctionalityError2({
608
+ throw new UnsupportedFunctionalityError({
889
609
  functionality: "File data URLs in assistant messages are not supported"
890
610
  });
891
611
  }
892
612
  case "reference": {
893
613
  if (isVertexLike) {
894
- throw new UnsupportedFunctionalityError2({
614
+ throw new UnsupportedFunctionalityError({
895
615
  functionality: "file parts with provider references"
896
616
  });
897
617
  }
@@ -1154,6 +874,44 @@ async function downloadToolResultOutput(output, {
1154
874
  };
1155
875
  }
1156
876
 
877
+ // src/sanitize-response-json-schema.ts
878
+ function sanitizeResponseJsonSchema(schema) {
879
+ const {
880
+ const: constValue,
881
+ properties,
882
+ items,
883
+ additionalProperties,
884
+ anyOf,
885
+ oneOf,
886
+ ...result
887
+ } = schema;
888
+ return {
889
+ ...result,
890
+ ...constValue !== void 0 ? { enum: [constValue] } : {},
891
+ ...properties != null ? { properties: sanitizeDefinitions(properties) } : {},
892
+ ...items != null ? {
893
+ items: Array.isArray(items) ? items.map(sanitizeDefinition) : sanitizeDefinition(items)
894
+ } : {},
895
+ ...additionalProperties != null ? {
896
+ additionalProperties: typeof additionalProperties === "boolean" ? additionalProperties : sanitizeDefinition(additionalProperties)
897
+ } : {},
898
+ ...anyOf != null ? { anyOf: anyOf.map(sanitizeDefinition) } : {},
899
+ ...oneOf != null ? { oneOf: oneOf.map(sanitizeDefinition) } : {},
900
+ ...result.$defs != null ? { $defs: sanitizeDefinitions(result.$defs) } : {}
901
+ };
902
+ }
903
+ function sanitizeDefinitions(definitions) {
904
+ return Object.fromEntries(
905
+ Object.entries(definitions).map(([name, definition]) => [
906
+ name,
907
+ sanitizeDefinition(definition)
908
+ ])
909
+ );
910
+ }
911
+ function sanitizeDefinition(definition) {
912
+ return typeof definition === "boolean" ? definition : sanitizeResponseJsonSchema(definition);
913
+ }
914
+
1157
915
  // src/google-language-model-options.ts
1158
916
  import {
1159
917
  lazySchema as lazySchema4,
@@ -1368,7 +1126,7 @@ function getGoogleModelCapabilities(modelId) {
1368
1126
 
1369
1127
  // src/google-prepare-tools.ts
1370
1128
  import {
1371
- UnsupportedFunctionalityError as UnsupportedFunctionalityError3
1129
+ UnsupportedFunctionalityError as UnsupportedFunctionalityError2
1372
1130
  } from "@ai-sdk/provider";
1373
1131
  function prepareTools({
1374
1132
  tools,
@@ -1598,7 +1356,7 @@ function prepareTools({
1598
1356
  };
1599
1357
  default: {
1600
1358
  const _exhaustiveCheck = type;
1601
- throw new UnsupportedFunctionalityError3({
1359
+ throw new UnsupportedFunctionalityError2({
1602
1360
  functionality: `tool choice type: ${_exhaustiveCheck}`
1603
1361
  });
1604
1362
  }
@@ -1606,24 +1364,11 @@ function prepareTools({
1606
1364
  }
1607
1365
  function prepareFunctionDeclaration(tool) {
1608
1366
  var _a;
1609
- const declaration = {
1367
+ return {
1610
1368
  name: tool.name,
1611
- description: (_a = tool.description) != null ? _a : ""
1369
+ description: (_a = tool.description) != null ? _a : "",
1370
+ parametersJsonSchema: tool.inputSchema
1612
1371
  };
1613
- try {
1614
- return {
1615
- ...declaration,
1616
- parameters: convertJSONSchemaToOpenAPISchema(tool.inputSchema)
1617
- };
1618
- } catch (error) {
1619
- if (!isRecursiveJSONSchemaReferenceError(error)) {
1620
- throw error;
1621
- }
1622
- return {
1623
- ...declaration,
1624
- parametersJsonSchema: tool.inputSchema
1625
- };
1626
- }
1627
1372
  }
1628
1373
 
1629
1374
  // src/google-json-accumulator.ts
@@ -2109,10 +1854,10 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
2109
1854
  seed,
2110
1855
  // response format:
2111
1856
  responseMimeType: (responseFormat == null ? void 0 : responseFormat.type) === "json" ? "application/json" : void 0,
2112
- responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
2113
- // so this is needed as an escape hatch:
1857
+ responseJsonSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google does not support all JSON Schema features in
1858
+ // responseJsonSchema, so this is needed as an escape hatch:
2114
1859
  // TODO convert into provider option
2115
- ((_c = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _c : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
1860
+ ((_c = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _c : true) ? sanitizeResponseJsonSchema(responseFormat.schema) : void 0,
2116
1861
  ...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
2117
1862
  audioTimestamp: googleOptions.audioTimestamp
2118
1863
  },
@@ -3214,7 +2959,7 @@ function assertSupportedBatchRequests(requests) {
3214
2959
  for (const request of requests) {
3215
2960
  const requestType = request.type;
3216
2961
  if (requestType !== "text" && requestType !== "image") {
3217
- throw new UnsupportedFunctionalityError4({
2962
+ throw new UnsupportedFunctionalityError3({
3218
2963
  functionality: `batch request type: ${requestType}`,
3219
2964
  message: `The Google Batch API does not support batch requests with type "${requestType}".`
3220
2965
  });
@@ -3703,12 +3448,12 @@ var GoogleBatch = class {
3703
3448
  const { prompt, n, size, aspectRatio, seed, files, mask, providerOptions } = request.options;
3704
3449
  const warnings = [];
3705
3450
  if (mask != null) {
3706
- throw new UnsupportedFunctionalityError4({
3451
+ throw new UnsupportedFunctionalityError3({
3707
3452
  functionality: "mask-based image editing in Google batches"
3708
3453
  });
3709
3454
  }
3710
3455
  if (n > 1) {
3711
- throw new UnsupportedFunctionalityError4({
3456
+ throw new UnsupportedFunctionalityError3({
3712
3457
  functionality: "multiple images per Google batch request"
3713
3458
  });
3714
3459
  }
@@ -8312,6 +8057,20 @@ var GoogleRealtimeEventMapper = class {
8312
8057
  raw
8313
8058
  });
8314
8059
  }
8060
+ if (serverContent.interactionStatus != null) {
8061
+ events.push({
8062
+ type: "custom",
8063
+ rawType: "interactionStatus",
8064
+ raw
8065
+ });
8066
+ }
8067
+ if (serverContent.waitingForInput) {
8068
+ events.push({
8069
+ type: "custom",
8070
+ rawType: "waitingForInput",
8071
+ raw
8072
+ });
8073
+ }
8315
8074
  if (serverContent.turnComplete) {
8316
8075
  if (this.hasAudio) {
8317
8076
  events.push({
@@ -8400,9 +8159,16 @@ var GoogleRealtimeEventMapper = class {
8400
8159
  return null;
8401
8160
  }
8402
8161
  };
8162
+ function toFunctionResponseStruct(value) {
8163
+ const isStruct = typeof value === "object" && value !== null && !Array.isArray(value);
8164
+ return isStruct ? value : { output: value };
8165
+ }
8403
8166
  async function serializeFunctionCallOutput(item) {
8404
8167
  const parseResult = await safeParseJSON({ text: item.output });
8405
- const response = parseResult.success ? parseResult.value : {};
8168
+ const response = parseResult.success ? toFunctionResponseStruct(parseResult.value) : (
8169
+ // Preserve non-JSON output in the required object wrapper.
8170
+ { output: item.output }
8171
+ );
8406
8172
  return {
8407
8173
  toolResponse: {
8408
8174
  functionResponses: [
@@ -8415,10 +8181,18 @@ async function serializeFunctionCallOutput(item) {
8415
8181
  }
8416
8182
  };
8417
8183
  }
8184
+ function isThinkingLiveModel(modelId) {
8185
+ var _a, _b;
8186
+ const modelName = (_b = (_a = modelId.split("/").at(-1)) == null ? void 0 : _a.toLowerCase()) != null ? _b : "";
8187
+ return /^gemini-\d+\.\d+-live\b.*thinking/.test(modelName);
8188
+ }
8418
8189
  function buildGoogleSessionConfig(config, modelId) {
8190
+ var _a, _b;
8419
8191
  const setup = {
8420
8192
  model: getModelPath(modelId)
8421
8193
  };
8194
+ const { google: google2, ...restProviderOptions } = (_a = config == null ? void 0 : config.providerOptions) != null ? _a : {};
8195
+ const googleOptions = isRecord(google2) ? google2 : void 0;
8422
8196
  const generationConfig = {};
8423
8197
  if ((config == null ? void 0 : config.outputModalities) != null) {
8424
8198
  generationConfig.responseModalities = config.outputModalities.map(
@@ -8448,7 +8222,8 @@ function buildGoogleSessionConfig(config, modelId) {
8448
8222
  functionDeclarations: config.tools.map((tool) => ({
8449
8223
  name: tool.name,
8450
8224
  description: tool.description,
8451
- parameters: convertJSONSchemaToOpenAPISchema(tool.parameters)
8225
+ parametersJsonSchema: tool.parameters,
8226
+ ...(googleOptions == null ? void 0 : googleOptions.defaultToolBehavior) != null ? { behavior: googleOptions.defaultToolBehavior } : {}
8452
8227
  }))
8453
8228
  }
8454
8229
  ];
@@ -8459,12 +8234,17 @@ function buildGoogleSessionConfig(config, modelId) {
8459
8234
  if ((config == null ? void 0 : config.outputAudioTranscription) != null) {
8460
8235
  setup.outputAudioTranscription = {};
8461
8236
  }
8237
+ const thinkingConfig = (_b = googleOptions == null ? void 0 : googleOptions.thinkingConfig) != null ? _b : isThinkingLiveModel(modelId) ? { thinkingLevel: "low" } : void 0;
8238
+ const applyThinkingConfig = () => {
8239
+ if (thinkingConfig == null) return;
8240
+ const target = isRecord(setup.generationConfig) ? setup.generationConfig : generationConfig;
8241
+ setup.generationConfig = { ...target, thinkingConfig };
8242
+ };
8462
8243
  if ((config == null ? void 0 : config.providerOptions) == null) {
8244
+ applyThinkingConfig();
8463
8245
  return setup;
8464
8246
  }
8465
- const { google: google2, ...providerOptions } = config.providerOptions;
8466
- Object.assign(setup, providerOptions);
8467
- const googleOptions = isRecord(google2) ? google2 : void 0;
8247
+ Object.assign(setup, restProviderOptions);
8468
8248
  if ((googleOptions == null ? void 0 : googleOptions.translationConfig) != null) {
8469
8249
  const target = isRecord(setup.generationConfig) ? setup.generationConfig : generationConfig;
8470
8250
  setup.generationConfig = {
@@ -8472,6 +8252,7 @@ function buildGoogleSessionConfig(config, modelId) {
8472
8252
  translationConfig: googleOptions.translationConfig
8473
8253
  };
8474
8254
  }
8255
+ applyThinkingConfig();
8475
8256
  return setup;
8476
8257
  }
8477
8258