@roomle/embedding-lib 0.0.0-dev-d29f634 → 0.0.0-dev-d66646c

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.
Files changed (74) hide show
  1. package/THIRD-PARTY-NOTICES.txt +2 -2
  2. package/ai.js +8 -8
  3. package/ai.min.js +7 -6
  4. package/{browser-D6M-d6y5.mjs → browser-Cys-y5Hy.mjs} +1 -2
  5. package/chat-model-DooKwd8I.mjs +117 -0
  6. package/chat-model-KHuz1Ej9.mjs +118 -0
  7. package/coerce-CuLRCRlo.mjs +6 -0
  8. package/coerce-Dup0o-HR.mjs +7 -0
  9. package/{comlink-CG3f9q6z.mjs → comlink-7u13Z2ZH.mjs} +2 -3
  10. package/{comlink-hSUzCx9j.mjs → comlink-DKhvPU0o.mjs} +1 -1
  11. package/configurator.js +3 -4
  12. package/configurator.min.js +2 -2
  13. package/construction.js +387 -31
  14. package/construction.min.js +395 -36
  15. package/continuation-COcMrXyj.mjs +14 -0
  16. package/continuation-D2hsmYf1.mjs +13 -0
  17. package/{dist-Cm3aF4sf.mjs → dist-7-X7Xqsl.mjs} +851 -919
  18. package/{dist-BQaw78-_.mjs → dist-BMxyw-Zs.mjs} +411 -405
  19. package/{dist-0WZWTj8T.mjs → dist-BU022PnG.mjs} +4 -9
  20. package/{dist-DkR6G9Kj.mjs → dist-BY8OLJ2p.mjs} +1 -1
  21. package/{dist-6TznX-Ae.mjs → dist-BZSd56sr.mjs} +3850 -3942
  22. package/{dist-70R0b5Mq.mjs → dist-Ba3J8AjB.mjs} +400 -390
  23. package/{dist-CTS0DDwt.mjs → dist-CbQKC1xX.mjs} +1590 -1616
  24. package/{dist-BmOBP9h9.mjs → dist-CiybWJvs.mjs} +44 -41
  25. package/{dist-CPG4atmb.mjs → dist-CkZuNdCU.mjs} +6 -4
  26. package/{dist-Bt1FopV4.mjs → dist-D2ZAAHGn.mjs} +1058 -1042
  27. package/{dist-BWNv7qW9.mjs → dist-DjsS42rR.mjs} +916 -962
  28. package/{dist-9UI7dzwc.mjs → dist-Jcq_kKKT.mjs} +403 -393
  29. package/{dist-D0XFfKEL.mjs → dist-S9sLSjZ4.mjs} +3112 -3104
  30. package/{dist-BV-32IEX.mjs → dist-XECXrV5Q.mjs} +1497 -1558
  31. package/{dist-Bc2s-kJZ.mjs → dist-a5_BIeaS.mjs} +45 -51
  32. package/{dist-Crrp-Bno.mjs → dist-bQAJDeYc.mjs} +698 -748
  33. package/{drag-ghost-BpIDzSdK.mjs → drag-ghost-QZelgA-_.mjs} +2 -3
  34. package/{drag-ghost-Bhb0_67G.mjs → drag-ghost-VmgSWLva.mjs} +5 -7
  35. package/{drag-in-mE_ozj_Q.mjs → drag-in-Cd_67tzS.mjs} +4 -5
  36. package/{drag-in-CGBG4wEk.mjs → drag-in-DlDsgY4T.mjs} +3 -3
  37. package/embedding-plugins.js +1 -2
  38. package/embedding-plugins.min.js +1 -2
  39. package/{experimental-evaluation-FzKFGoye.mjs → experimental-evaluation-B4hKMgFH.mjs} +19 -38
  40. package/{experimental-evaluation-DczxmJme.mjs → experimental-evaluation-DmqghFSx.mjs} +1 -1
  41. package/{from-custom-view-B3fIWMox.mjs → from-custom-view-6HMD_sPe.mjs} +5 -4
  42. package/{from-custom-view-B3HCOhdT.mjs → from-custom-view-BRFynafo.mjs} +16 -16
  43. package/{from-website-DaTahmvJ.mjs → from-website-Dl1VN4h7.mjs} +5 -6
  44. package/{from-website-DUQ9USj1.mjs → from-website-iZzauH4C.mjs} +3 -3
  45. package/hi.js +228 -233
  46. package/hi.min.js +207 -204
  47. package/mcp-tools-C6O2gQZW.mjs +41 -0
  48. package/mcp-tools-m_3IX0vB.mjs +40 -0
  49. package/package.json +1 -1
  50. package/packages/embedding-lib/src/homag-intelligence/hi-planning-assistant.d.ts +3 -0
  51. package/packages/embedding-lib/src/homag-intelligence/hi-planning-usage.d.ts +0 -6
  52. package/packages/web-sdk/packages/assistant.d.ts +3 -1
  53. package/packages/web-sdk/packages/common-core/src/planning-assistant/chat-recovery.d.ts +5 -1
  54. package/packages/web-sdk/packages/common-core/src/planning-assistant/continuation.d.ts +5 -3
  55. package/packages/web-sdk/packages/common-core/src/planning-assistant/runtime.d.ts +4 -1
  56. package/packages/web-sdk/packages/common-core/src/planning-assistant/types.d.ts +2 -0
  57. package/packages/web-sdk/packages/common-core/src/planning-assistant/usage.d.ts +16 -0
  58. package/packages/web-sdk/packages/common-core/src/planning-assistant.d.ts +19 -1
  59. package/rolldown-runtime--db92txo.mjs +10 -0
  60. package/rolldown-runtime-CyjYJMBa.mjs +11 -0
  61. package/roomle-embedding-lib.js +25 -34
  62. package/roomle-embedding-lib.min.js +3 -3
  63. package/sbom.cdx.json +5 -5
  64. package/usage-CgXarvBY.mjs +16 -0
  65. package/usage-c8evaONq.mjs +17 -0
  66. package/{utils-BwWn6Fw4.mjs → utils-CJnKZceY.mjs} +3 -4
  67. package/{utils-BoELtcEK.mjs → utils-DdNhTbJr.mjs} +6 -6
  68. package/chat-model-C1ov616e.mjs +0 -377
  69. package/chat-model-CifTV-8H.mjs +0 -373
  70. package/coerce-CqJod_GZ.mjs +0 -8
  71. package/coerce-CsI42_k0.mjs +0 -6
  72. package/mcp-tools-CC8DTfZA.mjs +0 -2
  73. package/mcp-tools-CfJ_ue_2.mjs +0 -2
  74. /package/{browser-BjtSrqbu.mjs → browser-CzLpXYFF.mjs} +0 -0
@@ -1,16 +1,16 @@
1
1
 
2
- import { At as e, Bt as t, E as n, Et as r, H as i, Ht as a, I as o, J as s, Jt as c, K as l, L as u, Lt as d, M as f, N as p, O as m, Ot as h, P as g, Q as _, Rt as v, S as y, Sn as b, St as x, T as S, Tt as C, U as w, Vt as T, W as E, Wt as D, X as O, Yt as k, _ as A, _t as j, a as M, an as N, bn as P, bt as F, dn as I, dt as ee, f as L, fn as R, g as te, gn as z, h as ne, in as B, it as re, j as V, jn as H, jt as U, kn as ie, kt as ae, ln as W, m as oe, nn as se, nt as ce, ot as G, p as le, pt as ue, rn as de, rt as fe, sn as K, st as pe, tn as q, ut as me, w as he, wt as J, y as ge, zt as _e } from "./dist-BV-32IEX.mjs";
3
- import { t as ve } from "./experimental-evaluation-FzKFGoye.mjs";
4
- //#region node_modules/@ai-sdk/google/dist/index.js
5
- var ye = "4.0.85", Y = he({
6
- errorSchema: G(() => t(N({ error: N({
7
- code: B().nullable(),
8
- message: W(),
9
- status: W(),
10
- details: c(R()).nullish()
11
- }) }))),
2
+ import { At as e, Bt as t, E as n, Et as r, H as i, Ht as a, I as o, J as s, Jt as c, K as l, L as u, Lt as d, M as f, N as p, O as m, Ot as h, P as g, Q as _, Rt as v, S as y, Sn as b, St as x, T as S, Tt as C, U as w, Vt as T, W as E, Wt as D, X as O, Yt as k, _ as A, _t as j, a as M, an as N, bn as P, bt as F, dn as I, dt as ee, f as L, fn as R, g as te, gn as z, h as ne, in as B, it as re, j as V, jn as H, jt as U, kn as ie, kt as ae, ln as W, m as oe, nn as se, nt as ce, ot as G, p as le, pt as ue, rn as de, rt as fe, sn as K, st as pe, tn as q, ut as me, w as he, wt as J, y as ge, zt as _e } from "./dist-XECXrV5Q.mjs";
3
+ import { t as ve } from "./experimental-evaluation-B4hKMgFH.mjs";
4
+ // node_modules/@ai-sdk/google/dist/index.js
5
+ var ye = "4.0.85", be = G(() => t(N({ error: N({
6
+ code: B().nullable(),
7
+ message: W(),
8
+ status: W(),
9
+ details: c(R()).nullish()
10
+ }) }))), Y = he({
11
+ errorSchema: be,
12
12
  errorToMessage: (e) => e.error.message
13
- }), be = I([
13
+ }), xe = I([
14
14
  N({ text: W() }),
15
15
  N({ inlineData: N({
16
16
  mimeType: W(),
@@ -20,7 +20,7 @@ var ye = "4.0.85", Y = he({
20
20
  fileUri: W(),
21
21
  mimeType: W()
22
22
  }) })
23
- ]), xe = G(() => t(N({
23
+ ]), Se = G(() => t(N({
24
24
  outputDimensionality: B().optional(),
25
25
  taskType: D([
26
26
  "SEMANTIC_SIMILARITY",
@@ -32,12 +32,12 @@ var ye = "4.0.85", Y = he({
32
32
  "FACT_VERIFICATION",
33
33
  "CODE_RETRIEVAL_QUERY"
34
34
  ]).optional(),
35
- content: c(c(be).min(1).nullable()).optional()
36
- }))), Se, Ce = class e {
35
+ content: c(c(xe).min(1).nullable()).optional()
36
+ }))), Ce, we = class e {
37
37
  constructor(e, t) {
38
- this.specificationVersion = "v4", this.maxEmbeddingsPerCall = 100, this.supportsParallelCalls = !0, this[Se] = ({ providerOptions: e, values: t, startIndex: n, endIndex: r }) => {
38
+ this.specificationVersion = "v4", this.maxEmbeddingsPerCall = 100, this.supportsParallelCalls = !0, this[Ce] = ({ providerOptions: e, values: t, startIndex: n, endIndex: r }) => {
39
39
  let i = e?.google?.content;
40
- return Array.isArray(i) ? (Ee({
40
+ return Array.isArray(i) ? (De({
41
41
  multimodalContent: i,
42
42
  values: t
43
43
  }), {
@@ -49,7 +49,7 @@ var ye = "4.0.85", Y = he({
49
49
  }) : e;
50
50
  }, this.modelId = e, this.config = t;
51
51
  }
52
- static [(Se = M, a)](e) {
52
+ static [(Ce = M, a)](e) {
53
53
  return U({
54
54
  modelId: e.modelId,
55
55
  config: e.config
@@ -65,7 +65,7 @@ var ye = "4.0.85", Y = he({
65
65
  let a = await j({
66
66
  provider: "google",
67
67
  providerOptions: i,
68
- schema: xe
68
+ schema: Se
69
69
  });
70
70
  if (e.length > this.maxEmbeddingsPerCall) throw new ie({
71
71
  provider: this.provider,
@@ -74,7 +74,7 @@ var ye = "4.0.85", Y = he({
74
74
  values: e
75
75
  });
76
76
  let o = L(this.config.headers ? await J(this.config.headers) : void 0, t), s = a?.content;
77
- if (Ee({
77
+ if (De({
78
78
  multimodalContent: s,
79
79
  values: e
80
80
  }), e.length === 1) {
@@ -88,7 +88,7 @@ var ye = "4.0.85", Y = he({
88
88
  taskType: a?.taskType
89
89
  },
90
90
  failedResponseHandler: Y,
91
- successfulResponseHandler: n(Te),
91
+ successfulResponseHandler: n(Ee),
92
92
  abortSignal: r,
93
93
  fetch: this.config.fetch
94
94
  });
@@ -118,7 +118,7 @@ var ye = "4.0.85", Y = he({
118
118
  };
119
119
  }) },
120
120
  failedResponseHandler: Y,
121
- successfulResponseHandler: n(we),
121
+ successfulResponseHandler: n(Te),
122
122
  abortSignal: r,
123
123
  fetch: this.config.fetch
124
124
  });
@@ -132,14 +132,14 @@ var ye = "4.0.85", Y = he({
132
132
  }
133
133
  };
134
134
  }
135
- }, we = G(() => t(N({ embeddings: c(N({ values: c(B()) })) }))), Te = G(() => t(N({ embedding: N({ values: c(B()) }) })));
136
- function Ee({ multimodalContent: e, values: t }) {
135
+ }, Te = G(() => t(N({ embeddings: c(N({ values: c(B()) })) }))), Ee = G(() => t(N({ embedding: N({ values: c(B()) }) })));
136
+ function De({ multimodalContent: e, values: t }) {
137
137
  if (e != null && e.length !== t.length) throw Error(`The number of multimodal content entries (${e.length}) must match the number of values (${t.length}).`);
138
138
  }
139
139
  function X(e) {
140
140
  return e.includes("/") ? e : `models/${e}`;
141
141
  }
142
- function De(e) {
142
+ function Oe(e) {
143
143
  if (e == null) return m();
144
144
  let t = e.promptTokenCount ?? 0, n = e.candidatesTokenCount ?? 0, r = e.toolUsePromptTokenCount ?? 0, i = e.cachedContentTokenCount ?? 0, a = e.thoughtsTokenCount ?? 0, o = t + r;
145
145
  return {
@@ -157,38 +157,38 @@ function De(e) {
157
157
  raw: e
158
158
  };
159
159
  }
160
- var Oe = N({
160
+ var ke = N({
161
161
  language: W().describe("The programming language of the code."),
162
162
  code: W().describe("The code to be executed.")
163
- }), ke = N({
163
+ }), Ae = N({
164
164
  outcome: W().describe("The outcome of the execution (e.g., \"OUTCOME_OK\")."),
165
165
  output: W().describe("The output from the code execution.")
166
- }), Ae = V({
166
+ }), je = V({
167
167
  id: "google.code_execution",
168
- inputSchema: Oe,
169
- outputSchema: ke
170
- }), je = "skip_thought_signature_validator", Me = /^data:([^;,]+);base64,(.+)$/s;
171
- function Ne(e) {
172
- let t = Me.exec(e);
168
+ inputSchema: ke,
169
+ outputSchema: Ae
170
+ }), Me = "skip_thought_signature_validator", Ne = /^data:([^;,]+);base64,(.+)$/s;
171
+ function Pe(e) {
172
+ let t = Ne.exec(e);
173
173
  if (t != null) return {
174
174
  mediaType: t[1],
175
175
  data: t[2]
176
176
  };
177
177
  }
178
- function Pe(e) {
179
- let t = Ne(e);
178
+ function Fe(e) {
179
+ let t = Pe(e);
180
180
  if (t != null) return { inlineData: {
181
181
  mimeType: t.mediaType,
182
182
  data: t.data
183
183
  } };
184
184
  }
185
- function Fe(e) {
186
- return Array.isArray(e) ? e.some(Fe) : typeof e != "object" || !e ? !1 : Object.entries(e).some(([e, t]) => e === "$ref" || Fe(t));
187
- }
188
185
  function Ie(e) {
189
- return Fe(e) ? JSON.stringify(e) : e;
186
+ return Array.isArray(e) ? e.some(Ie) : typeof e != "object" || !e ? !1 : Object.entries(e).some(([e, t]) => e === "$ref" || Ie(t));
190
187
  }
191
- function Le(e, t, n, r, i = !0, a = {}) {
188
+ function Le(e) {
189
+ return Ie(e) ? JSON.stringify(e) : e;
190
+ }
191
+ function Re(e, t, n, r, i = !0, a = {}) {
192
192
  let o = [], s = [];
193
193
  for (let e of n) switch (e.type) {
194
194
  case "text":
@@ -200,7 +200,7 @@ function Le(e, t, n, r, i = !0, a = {}) {
200
200
  data: A(e.data.data)
201
201
  } });
202
202
  else if (e.data.type === "url") {
203
- let t = e.data.url.toString(), n = Pe(t), r = e.data.url.protocol === "gs:" && e.data.originalUrl != null ? e.data.originalUrl : t;
203
+ let t = e.data.url.toString(), n = Fe(t), r = e.data.url.protocol === "gs:" && e.data.originalUrl != null ? e.data.originalUrl : t;
204
204
  n == null ? _(e.mediaType) && re({
205
205
  url: r,
206
206
  mediaType: e.mediaType,
@@ -211,9 +211,7 @@ function Le(e, t, n, r, i = !0, a = {}) {
211
211
  } }) : s.push(JSON.stringify(e)) : o.push(n);
212
212
  } else s.push(JSON.stringify(e));
213
213
  break;
214
- default:
215
- s.push(JSON.stringify(e));
216
- break;
214
+ default: s.push(JSON.stringify(e));
217
215
  }
218
216
  e.push({ functionResponse: {
219
217
  ...i && r != null ? { id: r } : {},
@@ -225,7 +223,7 @@ function Le(e, t, n, r, i = !0, a = {}) {
225
223
  ...o.length > 0 ? { parts: o } : {}
226
224
  } });
227
225
  }
228
- function Re(e, t, n, r, i = !0) {
226
+ function ze(e, t, n, r, i = !0) {
229
227
  for (let a of n) switch (a.type) {
230
228
  case "text":
231
229
  e.push({ functionResponse: {
@@ -246,13 +244,11 @@ function Re(e, t, n, r, i = !0) {
246
244
  } }, { text: `Tool executed successfully and returned this ${t === "image" ? "image" : "file"} as a response` });
247
245
  } else e.push({ text: JSON.stringify(a) });
248
246
  break;
249
- default:
250
- e.push({ text: JSON.stringify(a) });
251
- break;
247
+ default: e.push({ text: JSON.stringify(a) });
252
248
  }
253
249
  }
254
- function ze(t, n) {
255
- let i = [], a = [], o = !0, s = n?.isGemmaModel ?? !1, c = n?.isGemini3Model ?? !1, l = n?.onWarning, u = n?.providerOptionsNames ?? ["google"], d = !u.includes("google"), f = n?.supportsFunctionResponseParts ?? !0, p = n?.includeFunctionCallIds ?? !0, m = n?.supportedFunctionResponseUrls ?? {}, h = !1, g = [], v = (e) => (g.push(e), h = !0, je), y = (e) => {
250
+ function Be(t, n) {
251
+ let i = [], a = [], o = !0, s = n?.isGemmaModel ?? !1, c = n?.isGemini3Model ?? !1, l = n?.onWarning, u = n?.providerOptionsNames ?? ["google"], d = !u.includes("google"), f = n?.supportsFunctionResponseParts ?? !0, p = n?.includeFunctionCallIds ?? !0, m = n?.supportedFunctionResponseUrls ?? {}, h = !1, g = [], v = (e) => (g.push(e), h = !0, Me), y = (e) => {
256
252
  for (let t of u) {
257
253
  let n = e.providerOptions?.[t];
258
254
  if (n != null) return n;
@@ -271,38 +267,34 @@ function ze(t, n) {
271
267
  case "text":
272
268
  e.push({ text: t.text });
273
269
  break;
274
- case "file":
275
- switch (t.data.type) {
276
- case "url":
277
- e.push({ fileData: {
278
- mimeType: C({ part: t }),
279
- fileUri: t.data.url.protocol === "gs:" && t.data.originalUrl != null ? t.data.originalUrl : t.data.url.toString()
280
- } });
281
- break;
282
- case "reference":
283
- if (d) throw new H({ functionality: "file parts with provider references" });
284
- e.push({ fileData: {
285
- mimeType: C({ part: t }),
286
- fileUri: r({
287
- reference: t.data.reference,
288
- provider: "google"
289
- })
290
- } });
291
- break;
292
- case "text":
293
- e.push({ inlineData: {
294
- mimeType: _(t.mediaType) ? t.mediaType : "text/plain",
295
- data: A(new TextEncoder().encode(t.data.text))
296
- } });
297
- break;
298
- case "data":
299
- e.push({ inlineData: {
300
- mimeType: C({ part: t }),
301
- data: A(t.data.data)
302
- } });
303
- break;
304
- }
305
- break;
270
+ case "file": switch (t.data.type) {
271
+ case "url":
272
+ e.push({ fileData: {
273
+ mimeType: C({ part: t }),
274
+ fileUri: t.data.url.protocol === "gs:" && t.data.originalUrl != null ? t.data.originalUrl : t.data.url.toString()
275
+ } });
276
+ break;
277
+ case "reference":
278
+ if (d) throw new H({ functionality: "file parts with provider references" });
279
+ e.push({ fileData: {
280
+ mimeType: C({ part: t }),
281
+ fileUri: r({
282
+ reference: t.data.reference,
283
+ provider: "google"
284
+ })
285
+ } });
286
+ break;
287
+ case "text":
288
+ e.push({ inlineData: {
289
+ mimeType: _(t.mediaType) ? t.mediaType : "text/plain",
290
+ data: A(new TextEncoder().encode(t.data.text))
291
+ } });
292
+ break;
293
+ case "data": e.push({ inlineData: {
294
+ mimeType: C({ part: t }),
295
+ data: A(t.data.data)
296
+ } });
297
+ }
306
298
  }
307
299
  a.push({
308
300
  role: "user",
@@ -375,8 +367,8 @@ function ze(t, n) {
375
367
  }
376
368
  break;
377
369
  case "tool-call": {
378
- if (n.providerExecuted === !0 && n.toolName === "code_execution") return { executableCode: Oe.parse(typeof n.input == "string" ? e(n.input) : n.input) };
379
- let r = i?.serverToolCallId == null ? void 0 : String(i.serverToolCallId), o = i?.serverToolType == null ? void 0 : String(i.serverToolType), s = r != null && o != null, l = a ?? (c && !(!s && a == null && t) ? v(n.toolName) : void 0);
370
+ if (n.providerExecuted === !0 && n.toolName === "code_execution") return { executableCode: ke.parse(typeof n.input == "string" ? e(n.input) : n.input) };
371
+ let r = i?.serverToolCallId == null ? void 0 : String(i.serverToolCallId), o = i?.serverToolType == null ? void 0 : String(i.serverToolType), s = r != null && o != null, l = a ?? (c && (s || a != null || !t) ? v(n.toolName) : void 0);
380
372
  return !s && a != null && (t = !0), s ? {
381
373
  toolCall: {
382
374
  toolType: o,
@@ -394,7 +386,7 @@ function ze(t, n) {
394
386
  };
395
387
  }
396
388
  case "tool-result": {
397
- if (n.toolName === "code_execution" && n.output.type === "json") return { codeExecutionResult: ke.parse(n.output.value) };
389
+ if (n.toolName === "code_execution" && n.output.type === "json") return { codeExecutionResult: Ae.parse(n.output.value) };
398
390
  let e = i?.serverToolCallId == null ? void 0 : String(i.serverToolCallId), t = i?.serverToolType == null ? void 0 : String(i.serverToolType);
399
391
  return e && t ? {
400
392
  toolResponse: {
@@ -434,12 +426,12 @@ function ze(t, n) {
434
426
  }
435
427
  }
436
428
  let o = t.output;
437
- o.type === "content" ? f ? Le(e, t.toolName, o.value, t.toolCallId, p, m) : Re(e, t.toolName, o.value, t.toolCallId, p) : e.push({ functionResponse: {
429
+ o.type === "content" ? f ? Re(e, t.toolName, o.value, t.toolCallId, p, m) : ze(e, t.toolName, o.value, t.toolCallId, p) : e.push({ functionResponse: {
438
430
  ...p && t.toolCallId != null ? { id: t.toolCallId } : {},
439
431
  name: t.toolName,
440
432
  response: {
441
433
  name: t.toolName,
442
- content: o.type === "execution-denied" ? o.reason ?? "Tool call execution denied." : Ie(o.value)
434
+ content: o.type === "execution-denied" ? o.reason ?? "Tool call execution denied." : Le(o.value)
443
435
  }
444
436
  } });
445
437
  }
@@ -466,60 +458,44 @@ function ze(t, n) {
466
458
  contents: a
467
459
  };
468
460
  }
469
- async function Be(e, { abortSignal: t, maxBytes: n, supportedUrls: r = {} }) {
461
+ async function Ve(e, { abortSignal: t, maxBytes: n, supportedUrls: r = {} }) {
470
462
  let i = [];
471
- for (let a of e) {
472
- if (a.role === "assistant") {
473
- let e = [];
474
- for (let i of a.content) e.push(i.type === "tool-result" ? {
475
- ...i,
476
- output: await Ve(i.output, {
477
- abortSignal: t,
478
- maxBytes: n,
479
- supportedUrls: r
480
- })
481
- } : i);
482
- i.push({
483
- ...a,
484
- content: e
485
- });
486
- continue;
487
- }
488
- if (a.role === "tool") {
489
- let e = [];
490
- for (let i of a.content) {
491
- if (i.type !== "tool-result") {
492
- e.push(i);
493
- continue;
494
- }
495
- e.push({
496
- ...i,
497
- output: await Ve(i.output, {
498
- abortSignal: t,
499
- maxBytes: n,
500
- supportedUrls: r
501
- })
502
- });
503
- }
504
- i.push({
505
- ...a,
506
- content: e
507
- });
508
- continue;
509
- }
510
- i.push(a);
511
- }
463
+ for (let a of e) if (a.role === "assistant") {
464
+ let e = [];
465
+ for (let i of a.content) e.push(i.type === "tool-result" ? {
466
+ ...i,
467
+ output: await He(i.output, {
468
+ abortSignal: t,
469
+ maxBytes: n,
470
+ supportedUrls: r
471
+ })
472
+ } : i);
473
+ i.push({
474
+ ...a,
475
+ content: e
476
+ });
477
+ } else if (a.role === "tool") {
478
+ let e = [];
479
+ for (let i of a.content) i.type === "tool-result" ? e.push({
480
+ ...i,
481
+ output: await He(i.output, {
482
+ abortSignal: t,
483
+ maxBytes: n,
484
+ supportedUrls: r
485
+ })
486
+ }) : e.push(i);
487
+ i.push({
488
+ ...a,
489
+ content: e
490
+ });
491
+ } else i.push(a);
512
492
  return i;
513
493
  }
514
- async function Ve(e, { abortSignal: t, maxBytes: n, supportedUrls: r }) {
494
+ async function He(e, { abortSignal: t, maxBytes: n, supportedUrls: r }) {
515
495
  if (e.type !== "content") return e;
516
496
  let i = [];
517
497
  for (let a of e.value) {
518
- if (a.type !== "file" || a.data.type !== "url") {
519
- i.push(a);
520
- continue;
521
- }
522
- if (re({
498
+ if (a.type !== "file" || a.data.type !== "url" || re({
523
499
  url: a.data.url.toString(),
524
500
  mediaType: a.mediaType,
525
501
  supportedUrls: r
@@ -548,26 +524,26 @@ async function Ve(e, { abortSignal: t, maxBytes: n, supportedUrls: r }) {
548
524
  value: i
549
525
  };
550
526
  }
551
- function He(e) {
527
+ function Ue(e) {
552
528
  let { const: t, properties: n, items: r, additionalProperties: i, anyOf: a, oneOf: o, ...s } = e;
553
529
  return {
554
530
  ...s,
555
531
  ...t === void 0 ? {} : { enum: [t] },
556
- ...n == null ? {} : { properties: Ue(n) },
532
+ ...n == null ? {} : { properties: We(n) },
557
533
  ...r == null ? {} : { items: Array.isArray(r) ? r.map(Z) : Z(r) },
558
534
  ...i == null ? {} : { additionalProperties: typeof i == "boolean" ? i : Z(i) },
559
535
  ...a == null ? {} : { anyOf: a.map(Z) },
560
536
  ...o == null ? {} : { oneOf: o.map(Z) },
561
- ...s.$defs == null ? {} : { $defs: Ue(s.$defs) }
537
+ ...s.$defs == null ? {} : { $defs: We(s.$defs) }
562
538
  };
563
539
  }
564
- function Ue(e) {
540
+ function We(e) {
565
541
  return Object.fromEntries(Object.entries(e).map(([e, t]) => [e, Z(t)]));
566
542
  }
567
543
  function Z(e) {
568
- return typeof e == "boolean" ? e : He(e);
544
+ return typeof e == "boolean" ? e : Ue(e);
569
545
  }
570
- var We = G(() => t(N({
546
+ var Ge = G(() => t(N({
571
547
  responseModalities: c(D(["TEXT", "IMAGE"])).optional(),
572
548
  thinkingConfig: N({
573
549
  thinkingBudget: B().optional(),
@@ -670,21 +646,21 @@ var We = G(() => t(N({
670
646
  "standard"
671
647
  ]).optional(),
672
648
  requestType: D(["shared"]).optional()
673
- }))), Ge = /(^|\/)gemini-1(?:[.-]|$)/i, Ke = /(^|\/)gemini-2(?:[.-]|$)/i, qe = /(^|\/)gemini-2\.5(?:[.-]|$)/i, Je = /(^|\/)gemini-/i;
674
- function Ye(e) {
675
- return Ge.test(e) || /(^|\/)gemini-pro(?:-vision)?$/i.test(e) || /(^|\/)gemini-robotics-er-1\.5(?:[.-]|$)/i.test(e);
676
- }
649
+ }))), Ke = /(^|\/)gemini-1(?:[.-]|$)/i, qe = /(^|\/)gemini-2(?:[.-]|$)/i, Je = /(^|\/)gemini-2\.5(?:[.-]|$)/i, Ye = /(^|\/)gemini-/i;
677
650
  function Xe(e) {
678
- let t = Je.test(e), n = Ke.test(e), r = Ye(e), i = t && !(r || n);
651
+ return Ke.test(e) || /(^|\/)gemini-pro(?:-vision)?$/i.test(e) || /(^|\/)gemini-robotics-er-1\.5(?:[.-]|$)/i.test(e);
652
+ }
653
+ function Ze(e) {
654
+ let t = Ye.test(e), n = qe.test(e), r = Xe(e), i = t && !(r || n);
679
655
  return {
680
656
  supportsGemini2Tools: t && !r || e.toLowerCase().includes("nano-banana"),
681
- supportsFileSearch: qe.test(e) || i,
657
+ supportsFileSearch: Je.test(e) || i,
682
658
  usesGemini3Features: i
683
659
  };
684
660
  }
685
- function Ze({ tools: e, toolChoice: t, modelId: n, isVertexProvider: r = !1 }) {
661
+ function Qe({ tools: e, toolChoice: t, modelId: n, isVertexProvider: r = !1 }) {
686
662
  e = e?.length ? e : void 0;
687
- let i = [], { supportsGemini2Tools: a, supportsFileSearch: o, usesGemini3Features: s } = Xe(n);
663
+ let i = [], { supportsGemini2Tools: a, supportsFileSearch: o, usesGemini3Features: s } = Ze(n);
688
664
  if (e == null) return {
689
665
  tools: void 0,
690
666
  toolConfig: void 0,
@@ -750,16 +726,14 @@ function Ze({ tools: e, toolChoice: t, modelId: n, isVertexProvider: r = !1 }) {
750
726
  details: "The Google Maps grounding tool is not supported with Gemini models other than Gemini 2 or newer."
751
727
  });
752
728
  break;
753
- default:
754
- i.push({
755
- type: "unsupported",
756
- feature: `provider-defined tool ${e.id}`
757
- });
758
- break;
729
+ default: i.push({
730
+ type: "unsupported",
731
+ feature: `provider-defined tool ${e.id}`
732
+ });
759
733
  }
760
734
  }), c && s && n.length > 0) {
761
735
  let a = [];
762
- for (let t of e) t.type === "function" && a.push(Qe(t));
736
+ for (let t of e) t.type === "function" && a.push($e(t));
763
737
  let o = {
764
738
  functionCallingConfig: { mode: "VALIDATED" },
765
739
  ...!r && { includeServerSideToolInvocations: !0 }
@@ -772,12 +746,10 @@ function Ze({ tools: e, toolChoice: t, modelId: n, isVertexProvider: r = !1 }) {
772
746
  case "required":
773
747
  o.functionCallingConfig = { mode: "ANY" };
774
748
  break;
775
- case "tool":
776
- o.functionCallingConfig = {
777
- mode: "ANY",
778
- allowedFunctionNames: [t.toolName]
779
- };
780
- break;
749
+ case "tool": o.functionCallingConfig = {
750
+ mode: "ANY",
751
+ allowedFunctionNames: [t.toolName]
752
+ };
781
753
  }
782
754
  return {
783
755
  tools: [...n, { functionDeclarations: a }],
@@ -794,14 +766,12 @@ function Ze({ tools: e, toolChoice: t, modelId: n, isVertexProvider: r = !1 }) {
794
766
  let u = [], d = !1;
795
767
  for (let t of e) switch (t.type) {
796
768
  case "function":
797
- u.push(Qe(t)), t.strict === !0 && (d = !0);
798
- break;
799
- default:
800
- i.push({
801
- type: "unsupported",
802
- feature: `function tool ${t.name}`
803
- });
769
+ u.push($e(t)), t.strict === !0 && (d = !0);
804
770
  break;
771
+ default: i.push({
772
+ type: "unsupported",
773
+ feature: `function tool ${t.name}`
774
+ });
805
775
  }
806
776
  if (t == null) return {
807
777
  tools: [{ functionDeclarations: u }],
@@ -836,14 +806,14 @@ function Ze({ tools: e, toolChoice: t, modelId: n, isVertexProvider: r = !1 }) {
836
806
  default: throw new H({ functionality: `tool choice type: ${f}` });
837
807
  }
838
808
  }
839
- function Qe(e) {
809
+ function $e(e) {
840
810
  return {
841
811
  name: e.name,
842
812
  description: e.description ?? "",
843
813
  parametersJsonSchema: e.inputSchema
844
814
  };
845
815
  }
846
- var $e = class {
816
+ var et = class {
847
817
  constructor() {
848
818
  this.accumulatedArgs = {}, this.jsonText = "", this.pathStack = [], this.stringOpen = !1;
849
819
  }
@@ -852,14 +822,14 @@ var $e = class {
852
822
  for (let n of e) {
853
823
  let e = n.jsonPath.replace(/^\$\./, "");
854
824
  if (!e) continue;
855
- let r = et(e), i = it(this.accumulatedArgs, r);
825
+ let r = tt(e), i = at(this.accumulatedArgs, r);
856
826
  if (n.stringValue != null && i !== void 0) {
857
827
  let e = JSON.stringify(n.stringValue).slice(1, -1);
858
- at(this.accumulatedArgs, r, i + n.stringValue), t += e;
828
+ ot(this.accumulatedArgs, r, i + n.stringValue), t += e;
859
829
  continue;
860
830
  }
861
- let a = ot(n);
862
- a != null && (at(this.accumulatedArgs, r, a.value), t += this.emitNavigationTo(r, n, a.json));
831
+ let a = st(n);
832
+ a != null && (ot(this.accumulatedArgs, r, a.value), t += this.emitNavigationTo(r, n, a.json));
863
833
  }
864
834
  return this.jsonText += t, {
865
835
  currentJSON: this.accumulatedArgs,
@@ -918,7 +888,7 @@ var $e = class {
918
888
  return i.childCount > 0 && (r += ","), i.childCount++, typeof e == "string" && (r += `${JSON.stringify(e)}:`), t.stringValue != null && t.willContinue ? (r += n.slice(0, -1), this.stringOpen = !0) : r += n, r;
919
889
  }
920
890
  };
921
- function et(e) {
891
+ function tt(e) {
922
892
  let t = [];
923
893
  for (let n of e.split(".")) {
924
894
  let e = n.indexOf("[");
@@ -930,11 +900,11 @@ function et(e) {
930
900
  }
931
901
  return t;
932
902
  }
933
- var tt = Object.prototype.hasOwnProperty;
934
- function nt(e, t) {
935
- return tt.call(e, t);
903
+ var nt = Object.prototype.hasOwnProperty;
904
+ function rt(e, t) {
905
+ return nt.call(e, t);
936
906
  }
937
- function rt(e, t, n) {
907
+ function it(e, t, n) {
938
908
  Object.defineProperty(e, t, {
939
909
  value: n,
940
910
  enumerable: !0,
@@ -942,25 +912,25 @@ function rt(e, t, n) {
942
912
  writable: !0
943
913
  });
944
914
  }
945
- function it(e, t) {
915
+ function at(e, t) {
946
916
  let n = e;
947
917
  for (let e of t) {
948
918
  if (typeof n != "object" || !n) return;
949
919
  let t = n;
950
- if (!nt(t, e)) return;
920
+ if (!rt(t, e)) return;
951
921
  n = t[e];
952
922
  }
953
923
  return n;
954
924
  }
955
- function at(e, t, n) {
925
+ function ot(e, t, n) {
956
926
  let r = e;
957
927
  for (let e = 0; e < t.length - 1; e++) {
958
928
  let n = t[e], i = t[e + 1];
959
- (!nt(r, n) || r[n] == null) && rt(r, n, typeof i == "number" ? [] : {}), r = r[n];
929
+ rt(r, n) && r[n] != null || it(r, n, typeof i == "number" ? [] : {}), r = r[n];
960
930
  }
961
- rt(r, t[t.length - 1], n);
931
+ it(r, t[t.length - 1], n);
962
932
  }
963
- function ot(e) {
933
+ function st(e) {
964
934
  let t = e.stringValue ?? e.numberValue ?? e.boolValue;
965
935
  if (t != null) return {
966
936
  value: t,
@@ -971,7 +941,7 @@ function ot(e) {
971
941
  json: "null"
972
942
  };
973
943
  }
974
- function st({ finishReason: e, hasToolCalls: t }) {
944
+ function ct({ finishReason: e, hasToolCalls: t }) {
975
945
  switch (e) {
976
946
  case "STOP": return t ? "tool-calls" : "stop";
977
947
  case "MAX_TOKENS": return "length";
@@ -985,18 +955,18 @@ function st({ finishReason: e, hasToolCalls: t }) {
985
955
  default: return "other";
986
956
  }
987
957
  }
988
- var ct = [
958
+ var lt = [
989
959
  "HARM_CATEGORY_HATE_SPEECH",
990
960
  "HARM_CATEGORY_DANGEROUS_CONTENT",
991
961
  "HARM_CATEGORY_HARASSMENT",
992
962
  "HARM_CATEGORY_SEXUALLY_EXPLICIT"
993
- ], lt = /(^|\/)gemini-2\.5(?:[.-]|$)/i, ut = {
963
+ ], ut = /(^|\/)gemini-2\.5(?:[.-]|$)/i, dt = {
994
964
  "image/png": [/^gs:\/\/.*$/],
995
965
  "image/jpeg": [/^gs:\/\/.*$/],
996
966
  "image/webp": [/^gs:\/\/.*$/],
997
967
  "application/pdf": [/^gs:\/\/.*$/],
998
968
  "text/plain": [/^gs:\/\/.*$/]
999
- }, dt = class e {
969
+ }, ft = class e {
1000
970
  constructor(e, t) {
1001
971
  this.specificationVersion = "v4", this.modelId = e, this.config = t, this.generateId = t.generateId ?? i;
1002
972
  }
@@ -1020,12 +990,12 @@ var ct = [
1020
990
  for (let e of b) if (x = await j({
1021
991
  provider: e,
1022
992
  providerOptions: g,
1023
- schema: We
993
+ schema: Ge
1024
994
  }), x != null) break;
1025
995
  x == null && !b.includes("google") && (x = await j({
1026
996
  provider: "google",
1027
997
  providerOptions: g,
1028
- schema: We
998
+ schema: Ge
1029
999
  }));
1030
1000
  let S = t.provider.startsWith("google.vertex.");
1031
1001
  f?.some((e) => e.type === "provider" && e.id === "google.vertex_rag_store") && !S && y.push({
@@ -1056,7 +1026,7 @@ var ct = [
1056
1026
  message: `${a.join(", ")} ${a.length === 1 ? "is a Vertex AI option and is" : "are Vertex AI options and are"} ignored with the current Google provider (${t.provider}).`
1057
1027
  }), T = i);
1058
1028
  }
1059
- let E = e.toLowerCase().startsWith("gemma-"), D = !S && lt.test(e);
1029
+ let E = e.toLowerCase().startsWith("gemma-"), D = !S && ut.test(e);
1060
1030
  D && s != null && y.push({
1061
1031
  type: "unsupported",
1062
1032
  feature: "frequencyPenalty"
@@ -1064,7 +1034,7 @@ var ct = [
1064
1034
  type: "unsupported",
1065
1035
  feature: "presencePenalty"
1066
1036
  });
1067
- let { usesGemini3Features: O } = Xe(e), k = O && t.downloadToolResultFiles?.supportsGoogleCloudStorageUrls ? ut : void 0, { contents: A, systemInstruction: M } = ze(t.downloadToolResultFiles ? await Be(n, {
1037
+ let { usesGemini3Features: O } = Ze(e), k = O && t.downloadToolResultFiles?.supportsGoogleCloudStorageUrls ? dt : void 0, { contents: A, systemInstruction: M } = Be(t.downloadToolResultFiles ? await Ve(n, {
1068
1038
  abortSignal: _,
1069
1039
  maxBytes: t.downloadToolResultFiles.maxBytes,
1070
1040
  supportedUrls: k
@@ -1076,7 +1046,7 @@ var ct = [
1076
1046
  supportsFunctionResponseParts: O,
1077
1047
  includeFunctionCallIds: !S,
1078
1048
  supportedFunctionResponseUrls: k
1079
- }), { tools: N, toolConfig: P, toolWarnings: F } = Ze({
1049
+ }), { tools: N, toolConfig: P, toolWarnings: F } = Qe({
1080
1050
  tools: f,
1081
1051
  toolChoice: m,
1082
1052
  modelId: e,
@@ -1084,14 +1054,14 @@ var ct = [
1084
1054
  }), I = p({
1085
1055
  tools: f,
1086
1056
  providerToolNames: { "google.code_execution": "code_execution" }
1087
- }), ee = mt({
1057
+ }), ee = ht({
1088
1058
  reasoning: h,
1089
1059
  modelId: e,
1090
1060
  warnings: y
1091
1061
  }), L = x?.thinkingConfig || ee ? {
1092
1062
  ...ee,
1093
1063
  ...x?.thinkingConfig
1094
- } : void 0, R = v && S ? x?.streamFunctionCallArguments ?? !1 : void 0, te = x?.threshold, z = x?.safetySettings ?? (te == null ? void 0 : ct.map((e) => ({
1064
+ } : void 0, R = v && S ? x?.streamFunctionCallArguments ?? !1 : void 0, te = x?.threshold, z = x?.safetySettings ?? (te == null ? void 0 : lt.map((e) => ({
1095
1065
  category: e,
1096
1066
  threshold: te
1097
1067
  }))), ne = P || R || x?.retrievalConfig ? {
@@ -1114,7 +1084,7 @@ var ct = [
1114
1084
  stopSequences: l,
1115
1085
  seed: d,
1116
1086
  responseMimeType: u?.type === "json" ? "application/json" : void 0,
1117
- responseJsonSchema: u?.type === "json" && u.schema != null && (x?.structuredOutputs ?? !0) ? He(u.schema) : void 0,
1087
+ responseJsonSchema: u?.type === "json" && u.schema != null && (x?.structuredOutputs ?? !0) ? Ue(u.schema) : void 0,
1118
1088
  ...x?.audioTimestamp && { audioTimestamp: x.audioTimestamp },
1119
1089
  responseModalities: x?.responseModalities,
1120
1090
  thinkingConfig: L,
@@ -1145,7 +1115,7 @@ var ct = [
1145
1115
  });
1146
1116
  }
1147
1117
  static convertGenerateContentResponse({ config: e, response: t, warnings: n, providerOptionsNames: r, toolNameMapping: i }) {
1148
- let a = (e) => Object.fromEntries(r.map((t) => [t, e])), o = t.candidates?.[0], s = t.promptFeedback?.blockReason, c = Ot(s) ? s : void 0, l = o?.finishReason == null && c != null, u = o?.finishReason ?? c, d = [], f = o?.content?.parts ?? [], p = t.usageMetadata, m, h;
1118
+ let a = (e) => Object.fromEntries(r.map((t) => [t, e])), o = t.candidates?.[0], s = t.promptFeedback?.blockReason, c = kt(s) ? s : void 0, l = o?.finishReason == null && c != null, u = o?.finishReason ?? c, d = [], f = o?.content?.parts ?? [], p = t.usageMetadata, m, h;
1149
1119
  for (let t of f) if ("executableCode" in t && t.executableCode?.code) {
1150
1120
  let n = e.generateId();
1151
1121
  m = n, d.push({
@@ -1229,7 +1199,7 @@ var ct = [
1229
1199
  })
1230
1200
  }), h = void 0;
1231
1201
  }
1232
- let g = vt({
1202
+ let g = yt({
1233
1203
  groundingMetadata: o?.groundingMetadata,
1234
1204
  generateId: e.generateId
1235
1205
  }) ?? [];
@@ -1237,13 +1207,13 @@ var ct = [
1237
1207
  return {
1238
1208
  content: d,
1239
1209
  finishReason: {
1240
- unified: l ? "content-filter" : st({
1210
+ unified: l ? "content-filter" : ct({
1241
1211
  finishReason: u,
1242
1212
  hasToolCalls: d.some((e) => e.type === "tool-call" && !e.providerExecuted)
1243
1213
  }),
1244
1214
  raw: u
1245
1215
  },
1246
- usage: De(p),
1216
+ usage: Oe(p),
1247
1217
  warnings: n,
1248
1218
  providerMetadata: a({
1249
1219
  promptFeedback: t.promptFeedback ?? null,
@@ -1263,7 +1233,7 @@ var ct = [
1263
1233
  headers: c,
1264
1234
  body: r,
1265
1235
  failedResponseHandler: Y,
1266
- successfulResponseHandler: n(Et),
1236
+ successfulResponseHandler: n(Dt),
1267
1237
  abortSignal: t.abortSignal,
1268
1238
  fetch: this.config.fetch
1269
1239
  }), f = e.convertGenerateContentResponse({
@@ -1289,7 +1259,7 @@ var ct = [
1289
1259
  headers: s,
1290
1260
  body: t,
1291
1261
  failedResponseHandler: Y,
1292
- successfulResponseHandler: y(Dt),
1262
+ successfulResponseHandler: y(Ot),
1293
1263
  abortSignal: e.abortSignal,
1294
1264
  fetch: this.config.fetch
1295
1265
  }), u = {
@@ -1341,13 +1311,13 @@ var ct = [
1341
1311
  id: r.responseId
1342
1312
  }));
1343
1313
  let i = r.usageMetadata;
1344
- i != null && (d = i), r.promptFeedback != null && _ == null && (f = r.promptFeedback, Ot(r.promptFeedback.blockReason) && (_ = r.promptFeedback.blockReason, u = {
1314
+ i != null && (d = i), r.promptFeedback != null && _ == null && (f = r.promptFeedback, kt(r.promptFeedback.blockReason) && (_ = r.promptFeedback.blockReason, u = {
1345
1315
  unified: "content-filter",
1346
1316
  raw: _
1347
1317
  }));
1348
1318
  let s = r.candidates?.[0];
1349
1319
  if (s != null && (s.groundingMetadata != null && (p = s.groundingMetadata), s.urlContextMetadata != null && (m = s.urlContextMetadata), s.safetyRatings != null && (h = s.safetyRatings), s.finishMessage != null && (g = s.finishMessage)), _ != null || s == null) return;
1350
- let c = s.content, l = vt({
1320
+ let c = s.content, l = yt({
1351
1321
  groundingMetadata: s.groundingMetadata,
1352
1322
  generateId: v
1353
1323
  });
@@ -1460,7 +1430,7 @@ var ct = [
1460
1430
  let e = t.thoughtSignature ? o({ thoughtSignature: t.thoughtSignature }) : void 0, r = t.functionCall.partialArgs != null || t.functionCall.name != null && t.functionCall.willContinue === !0, i = t.functionCall.name == null && t.functionCall.args == null && t.functionCall.partialArgs == null && t.functionCall.willContinue == null, a = t.functionCall.name != null && t.functionCall.args != null && t.functionCall.partialArgs == null, s = t.functionCall.name != null && t.functionCall.args == null && t.functionCall.partialArgs == null && t.functionCall.willContinue !== !0;
1461
1431
  if (r) {
1462
1432
  if (t.functionCall.name != null) {
1463
- let r = t.functionCall.id || v(), i = new $e();
1433
+ let r = t.functionCall.id || v(), i = new et();
1464
1434
  if (O.push({
1465
1435
  toolCallId: r,
1466
1436
  toolName: t.functionCall.name,
@@ -1535,7 +1505,7 @@ var ct = [
1535
1505
  }
1536
1506
  }
1537
1507
  s.finishReason != null && (u = {
1538
- unified: st({
1508
+ unified: ct({
1539
1509
  finishReason: s.finishReason,
1540
1510
  hasToolCalls: b
1541
1511
  }),
@@ -1552,7 +1522,7 @@ var ct = [
1552
1522
  }), e.enqueue({
1553
1523
  type: "finish",
1554
1524
  finishReason: u,
1555
- usage: De(d),
1525
+ usage: Oe(d),
1556
1526
  providerMetadata: o({
1557
1527
  promptFeedback: f,
1558
1528
  groundingMetadata: p,
@@ -1570,26 +1540,26 @@ var ct = [
1570
1540
  };
1571
1541
  }
1572
1542
  };
1573
- function ft() {
1543
+ function pt() {
1574
1544
  return 65536;
1575
1545
  }
1576
- function pt(e) {
1546
+ function mt(e) {
1577
1547
  let t = e.toLowerCase();
1578
1548
  return t.includes("2.5-pro") || t.includes("gemini-3-pro-image") ? 32768 : 24576;
1579
1549
  }
1580
- function mt({ reasoning: e, modelId: t, warnings: n }) {
1581
- if (O(e)) return Xe(t).usesGemini3Features && !t.includes("gemini-3-pro-image") ? ht({
1550
+ function ht({ reasoning: e, modelId: t, warnings: n }) {
1551
+ if (O(e)) return Ze(t).usesGemini3Features && !t.includes("gemini-3-pro-image") ? gt({
1582
1552
  reasoning: e,
1583
1553
  modelId: t,
1584
1554
  warnings: n
1585
- }) : _t({
1555
+ }) : vt({
1586
1556
  reasoning: e,
1587
1557
  modelId: t,
1588
1558
  warnings: n
1589
1559
  });
1590
1560
  }
1591
- function ht({ reasoning: e, modelId: t, warnings: n }) {
1592
- let r = gt(t);
1561
+ function gt({ reasoning: e, modelId: t, warnings: n }) {
1562
+ let r = _t(t);
1593
1563
  if (e === "none") return { thinkingLevel: r };
1594
1564
  let i = ee({
1595
1565
  reasoning: e,
@@ -1604,7 +1574,7 @@ function ht({ reasoning: e, modelId: t, warnings: n }) {
1604
1574
  });
1605
1575
  if (i != null) return { thinkingLevel: i };
1606
1576
  }
1607
- function gt(e) {
1577
+ function _t(e) {
1608
1578
  let t = e.split("/").at(-1)?.toLowerCase();
1609
1579
  if (t === "gemini-flash-latest") return "low";
1610
1580
  let n = /^gemini-(\d+)\.(\d+)-flash(?:$|-(?!lite(?:-|$)))/.exec(t ?? "");
@@ -1612,18 +1582,18 @@ function gt(e) {
1612
1582
  let r = Number(n[1]), i = Number(n[2]);
1613
1583
  return r > 3 || r === 3 && i >= 7 ? "low" : "minimal";
1614
1584
  }
1615
- function _t({ reasoning: e, modelId: t, warnings: n }) {
1585
+ function vt({ reasoning: e, modelId: t, warnings: n }) {
1616
1586
  if (e === "none") return { thinkingBudget: 0 };
1617
1587
  let r = me({
1618
1588
  reasoning: e,
1619
- maxOutputTokens: ft(),
1620
- maxReasoningBudget: pt(t),
1589
+ maxOutputTokens: pt(),
1590
+ maxReasoningBudget: mt(t),
1621
1591
  minReasoningBudget: 0,
1622
1592
  warnings: n
1623
1593
  });
1624
1594
  if (r != null) return { thinkingBudget: r };
1625
1595
  }
1626
- function vt({ groundingMetadata: e, generateId: t }) {
1596
+ function yt({ groundingMetadata: e, generateId: t }) {
1627
1597
  if (!e?.groundingChunks) return;
1628
1598
  let n = [];
1629
1599
  for (let r of e.groundingChunks) if (r.web != null) n.push({
@@ -1679,7 +1649,7 @@ function vt({ groundingMetadata: e, generateId: t }) {
1679
1649
  });
1680
1650
  return n.length > 0 ? n : void 0;
1681
1651
  }
1682
- var yt = () => N({
1652
+ var bt = () => N({
1683
1653
  webSearchQueries: c(W()).nullish(),
1684
1654
  imageSearchQueries: c(W()).nullish(),
1685
1655
  retrievalQueries: c(W()).nullish(),
@@ -1721,20 +1691,20 @@ var yt = () => N({
1721
1691
  confidenceScore: c(B()).nullish()
1722
1692
  })).nullish(),
1723
1693
  retrievalMetadata: I([N({ webDynamicRetrievalScore: B() }), N({})]).nullish()
1724
- }), bt = N({
1694
+ }), xt = N({
1725
1695
  jsonPath: W(),
1726
1696
  stringValue: W().nullish(),
1727
1697
  numberValue: B().nullish(),
1728
1698
  boolValue: k().nullish(),
1729
1699
  nullValue: R().nullish(),
1730
1700
  willContinue: k().nullish()
1731
- }), xt = () => N({ parts: c(I([
1701
+ }), St = () => N({ parts: c(I([
1732
1702
  N({
1733
1703
  functionCall: N({
1734
1704
  id: W().nullish(),
1735
1705
  name: W().nullish(),
1736
1706
  args: R().nullish(),
1737
- partialArgs: c(bt).nullish(),
1707
+ partialArgs: c(xt).nullish(),
1738
1708
  willContinue: k().nullish()
1739
1709
  }),
1740
1710
  thoughtSignature: W().nullish()
@@ -1776,17 +1746,17 @@ var yt = () => N({
1776
1746
  thought: k().nullish(),
1777
1747
  thoughtSignature: W().nullish()
1778
1748
  })
1779
- ])).nullish() }), St = () => N({
1749
+ ])).nullish() }), Ct = () => N({
1780
1750
  category: W().nullish(),
1781
1751
  probability: W().nullish(),
1782
1752
  probabilityScore: B().nullish(),
1783
1753
  severity: W().nullish(),
1784
1754
  severityScore: B().nullish(),
1785
1755
  blocked: k().nullish()
1786
- }), Ct = c(N({
1756
+ }), wt = c(N({
1787
1757
  modality: W(),
1788
1758
  tokenCount: B()
1789
- }).loose()).nullish(), wt = N({
1759
+ }).loose()).nullish(), Tt = N({
1790
1760
  cachedContentTokenCount: B().nullish(),
1791
1761
  thoughtsTokenCount: B().nullish(),
1792
1762
  promptTokenCount: B().nullish(),
@@ -1795,48 +1765,48 @@ var yt = () => N({
1795
1765
  totalTokenCount: B().nullish(),
1796
1766
  trafficType: W().nullish(),
1797
1767
  serviceTier: W().nullish(),
1798
- promptTokensDetails: Ct,
1799
- cacheTokensDetails: Ct,
1800
- candidatesTokensDetails: Ct,
1801
- toolUsePromptTokensDetails: Ct
1802
- }).loose(), Tt = () => N({ urlMetadata: c(N({
1768
+ promptTokensDetails: wt,
1769
+ cacheTokensDetails: wt,
1770
+ candidatesTokensDetails: wt,
1771
+ toolUsePromptTokensDetails: wt
1772
+ }).loose(), Et = () => N({ urlMetadata: c(N({
1803
1773
  retrievedUrl: W(),
1804
1774
  urlRetrievalStatus: W()
1805
- })).nullish() }), Et = G(() => t(N({
1775
+ })).nullish() }), Dt = G(() => t(N({
1806
1776
  responseId: W().nullish(),
1807
1777
  candidates: c(N({
1808
- content: xt().nullish().or(N({}).strict()),
1778
+ content: St().nullish().or(N({}).strict()),
1809
1779
  finishReason: W().nullish(),
1810
1780
  finishMessage: W().nullish(),
1811
- safetyRatings: c(St()).nullish(),
1812
- groundingMetadata: yt().nullish(),
1813
- urlContextMetadata: Tt().nullish()
1781
+ safetyRatings: c(Ct()).nullish(),
1782
+ groundingMetadata: bt().nullish(),
1783
+ urlContextMetadata: Et().nullish()
1814
1784
  })).nullish(),
1815
- usageMetadata: wt.nullish(),
1785
+ usageMetadata: Tt.nullish(),
1816
1786
  promptFeedback: N({
1817
1787
  blockReason: W().nullish(),
1818
- safetyRatings: c(St()).nullish()
1788
+ safetyRatings: c(Ct()).nullish()
1819
1789
  }).nullish()
1820
- }))), Dt = G(() => t(N({
1790
+ }))), Ot = G(() => t(N({
1821
1791
  responseId: W().nullish(),
1822
1792
  candidates: c(N({
1823
- content: xt().nullish(),
1793
+ content: St().nullish(),
1824
1794
  finishReason: W().nullish(),
1825
1795
  finishMessage: W().nullish(),
1826
- safetyRatings: c(St()).nullish(),
1827
- groundingMetadata: yt().nullish(),
1828
- urlContextMetadata: Tt().nullish()
1796
+ safetyRatings: c(Ct()).nullish(),
1797
+ groundingMetadata: bt().nullish(),
1798
+ urlContextMetadata: Et().nullish()
1829
1799
  })).nullish(),
1830
- usageMetadata: wt.nullish(),
1800
+ usageMetadata: Tt.nullish(),
1831
1801
  promptFeedback: N({
1832
1802
  blockReason: W().nullish(),
1833
- safetyRatings: c(St()).nullish()
1803
+ safetyRatings: c(Ct()).nullish()
1834
1804
  }).nullish()
1835
1805
  })));
1836
- function Ot(e) {
1806
+ function kt(e) {
1837
1807
  return e != null && e !== "" && e !== "BLOCK_REASON_UNSPECIFIED" && e !== "BLOCKED_REASON_UNSPECIFIED";
1838
1808
  }
1839
- var kt = se({
1809
+ var At = se({
1840
1810
  searchTypes: N({
1841
1811
  webSearch: N({}).optional(),
1842
1812
  imageSearch: N({}).optional()
@@ -1845,18 +1815,18 @@ var kt = se({
1845
1815
  startTime: W(),
1846
1816
  endTime: W()
1847
1817
  }).optional()
1848
- }), At = V({
1818
+ }), jt = V({
1849
1819
  id: "google.google_search",
1850
1820
  inputSchema: G(() => t(N({}))),
1851
1821
  outputSchema: G(() => t(N({})))
1852
- }), jt = G(() => t(N({ googleSearch: kt.optional() }))), Mt = 2 * 1024 * 1024 * 1024, Nt = 2e7, Pt = /* @__PURE__ */ new Set([
1822
+ }), Mt = G(() => t(N({ googleSearch: At.optional() }))), Nt = 2147483648, Pt = 2e7, Ft = /* @__PURE__ */ new Set([
1853
1823
  "text",
1854
1824
  "reasoning",
1855
1825
  "source",
1856
1826
  "tool-call",
1857
1827
  "tool-result"
1858
1828
  ]);
1859
- function Ft(e) {
1829
+ function It(e) {
1860
1830
  for (let t of e) {
1861
1831
  let e = t.type;
1862
1832
  if (e !== "text" && e !== "image") throw new H({
@@ -1865,59 +1835,59 @@ function Ft(e) {
1865
1835
  });
1866
1836
  }
1867
1837
  }
1868
- var It = N({
1838
+ var Lt = N({
1869
1839
  code: I([B(), W()]).nullish(),
1870
1840
  message: W().nullish(),
1871
1841
  status: W().nullish()
1872
- }), Lt = N({
1842
+ }), Rt = N({
1873
1843
  requestCount: I([W(), B()]).nullish(),
1874
1844
  successfulRequestCount: I([W(), B()]).nullish(),
1875
1845
  failedRequestCount: I([W(), B()]).nullish(),
1876
1846
  pendingRequestCount: I([W(), B()]).nullish()
1877
- }), Rt = N({
1847
+ }), zt = N({
1878
1848
  responsesFile: W().nullish(),
1879
1849
  inlinedResponses: N({ inlinedResponses: c(N({
1880
1850
  metadata: N({ key: W() }),
1881
1851
  response: R().nullish(),
1882
- error: It.nullish()
1852
+ error: Lt.nullish()
1883
1853
  })) }).nullish()
1884
- }), zt = () => N({
1854
+ }), Bt = () => N({
1885
1855
  name: W(),
1886
1856
  metadata: N({
1887
1857
  state: W().nullish(),
1888
1858
  createTime: W().nullish(),
1889
- batchStats: Lt.nullish(),
1890
- output: Rt.nullish()
1859
+ batchStats: Rt.nullish(),
1860
+ output: zt.nullish()
1891
1861
  }).nullish(),
1892
1862
  done: k().nullish(),
1893
- error: It.nullish(),
1894
- response: Rt.nullish()
1895
- }), Bt = G(() => t(zt())), Vt = G(() => t(N({
1896
- operations: c(zt()).nullish(),
1863
+ error: Lt.nullish(),
1864
+ response: zt.nullish()
1865
+ }), Vt = G(() => t(Bt())), Ht = G(() => t(N({
1866
+ operations: c(Bt()).nullish(),
1897
1867
  nextPageToken: W().nullish()
1898
- }))), Ht = G(() => t(N({}))), Ut = G(() => t(N({ file: N({
1868
+ }))), Ut = G(() => t(N({}))), Wt = G(() => t(N({ file: N({
1899
1869
  name: W(),
1900
1870
  expirationTime: W().nullish()
1901
- }) }))), Wt = G(() => t(N({
1871
+ }) }))), Gt = G(() => t(N({
1902
1872
  key: W(),
1903
1873
  response: R().nullish(),
1904
- error: It.nullish()
1905
- }))), Gt = G(() => t(N({
1874
+ error: Lt.nullish()
1875
+ }))), Kt = G(() => t(N({
1906
1876
  candidates: c(R()).nullish(),
1907
1877
  promptFeedback: N({ blockReason: W().nullish() }).nullish()
1908
- }))), Kt = class {
1878
+ }))), qt = class {
1909
1879
  constructor(e) {
1910
1880
  this.specificationVersion = "v4", this.provider = e.provider, this.batchConfig = e.config, this.supportedUrls = e.supportedUrls, this.batchGenerateId = e.config.generateId ?? i;
1911
1881
  }
1912
1882
  async doStartBatch(e) {
1913
- Ft(e.requests);
1914
- let t = $t(e.requests), r = [], i = `ai-sdk-batch-${this.batchGenerateId()}`, a = [], o = { batch: {
1883
+ It(e.requests);
1884
+ let t = en(e.requests), r = [], i = `ai-sdk-batch-${this.batchGenerateId()}`, a = [], o = { batch: {
1915
1885
  displayName: i,
1916
1886
  ...e.webhookUrl != null && { webhookConfig: { uris: [e.webhookUrl] } },
1917
1887
  inputConfig: { requests: { requests: a } }
1918
1888
  } }, s = new TextEncoder(), c = s.encode(JSON.stringify(o)).byteLength, l;
1919
1889
  for (let t of e.requests) {
1920
- let e = t.type === "text" ? await dt.prepareRequest({
1890
+ let e = t.type === "text" ? await ft.prepareRequest({
1921
1891
  modelId: t.modelId,
1922
1892
  config: this.batchConfig,
1923
1893
  options: t.options
@@ -1926,8 +1896,8 @@ var It = N({
1926
1896
  metadata: { key: t.id }
1927
1897
  };
1928
1898
  if (l == null) {
1929
- let r = s.encode(JSON.stringify(n)).byteLength, i = c + r + (a.length > 0 ? 1 : 0);
1930
- if (i < Nt) a.push(n), c = i;
1899
+ let r = s.encode(JSON.stringify(n)).byteLength, i = c + r + +(a.length > 0);
1900
+ if (i < Pt) a.push(n), c = i;
1931
1901
  else {
1932
1902
  l = [];
1933
1903
  for (let e of a) l.push(JSON.stringify({
@@ -1955,18 +1925,18 @@ var It = N({
1955
1925
  headers: u,
1956
1926
  body: o,
1957
1927
  failedResponseHandler: Y,
1958
- successfulResponseHandler: n(Bt),
1928
+ successfulResponseHandler: n(Vt),
1959
1929
  abortSignal: e.abortSignal,
1960
1930
  fetch: this.batchConfig.fetch
1961
1931
  });
1962
1932
  return {
1963
1933
  batchId: t.name,
1964
- ...qt(t),
1934
+ ...Jt(t),
1965
1935
  warnings: r
1966
1936
  };
1967
1937
  }
1968
1938
  let f = new Blob(l, { type: "application/jsonl" });
1969
- if (l.length = 0, f.size > Mt) throw new P({
1939
+ if (l.length = 0, f.size > Nt) throw new P({
1970
1940
  argument: "requests",
1971
1941
  message: "Google batch input files must not exceed 2 GB."
1972
1942
  });
@@ -1980,7 +1950,7 @@ var It = N({
1980
1950
  }),
1981
1951
  body: { file: { display_name: `${i}-input` } },
1982
1952
  failedResponseHandler: Y,
1983
- successfulResponseHandler: Qt,
1953
+ successfulResponseHandler: $t,
1984
1954
  abortSignal: e.abortSignal,
1985
1955
  fetch: this.batchConfig.fetch
1986
1956
  }), { value: m } = await x({
@@ -1998,7 +1968,7 @@ var It = N({
1998
1968
  }
1999
1969
  },
2000
1970
  failedResponseHandler: Y,
2001
- successfulResponseHandler: n(Ut),
1971
+ successfulResponseHandler: n(Wt),
2002
1972
  abortSignal: e.abortSignal,
2003
1973
  fetch: this.batchConfig.fetch
2004
1974
  }), { value: h } = await F({
@@ -2010,13 +1980,13 @@ var It = N({
2010
1980
  inputConfig: { fileName: m.file.name }
2011
1981
  } },
2012
1982
  failedResponseHandler: Y,
2013
- successfulResponseHandler: n(Bt),
1983
+ successfulResponseHandler: n(Vt),
2014
1984
  abortSignal: e.abortSignal,
2015
1985
  fetch: this.batchConfig.fetch
2016
1986
  });
2017
1987
  return {
2018
1988
  batchId: h.name,
2019
- ...qt(h),
1989
+ ...Jt(h),
2020
1990
  providerMetadata: { google: {
2021
1991
  inputFileId: m.file.name,
2022
1992
  ...m.file.expirationTime == null ? {} : { inputFileExpiresAt: m.file.expirationTime }
@@ -2025,7 +1995,7 @@ var It = N({
2025
1995
  };
2026
1996
  }
2027
1997
  async doGetBatchStatus(e) {
2028
- return qt(await this.retrieveBatch(e));
1998
+ return Jt(await this.retrieveBatch(e));
2029
1999
  }
2030
2000
  async doCancelBatch(e) {
2031
2001
  return await F({
@@ -2033,7 +2003,7 @@ var It = N({
2033
2003
  headers: await this.getHeaders(e.headers),
2034
2004
  body: {},
2035
2005
  failedResponseHandler: Y,
2036
- successfulResponseHandler: n(Ht),
2006
+ successfulResponseHandler: n(Ut),
2037
2007
  abortSignal: e.abortSignal,
2038
2008
  fetch: this.batchConfig.fetch
2039
2009
  }), {};
@@ -2045,7 +2015,7 @@ var It = N({
2045
2015
  url: t.toString(),
2046
2016
  headers: await this.getHeaders(e.headers),
2047
2017
  failedResponseHandler: Y,
2048
- successfulResponseHandler: n(Vt),
2018
+ successfulResponseHandler: n(Ht),
2049
2019
  abortSignal: e.abortSignal,
2050
2020
  fetch: this.batchConfig.fetch,
2051
2021
  validateUrl: !1
@@ -2053,13 +2023,13 @@ var It = N({
2053
2023
  return {
2054
2024
  batches: (r.operations ?? []).map((e) => ({
2055
2025
  batchId: e.name,
2056
- ...qt(e)
2026
+ ...Jt(e)
2057
2027
  })),
2058
2028
  ...r.nextPageToken == null ? {} : { nextCursor: r.nextPageToken }
2059
2029
  };
2060
2030
  }
2061
2031
  async doGetBatchResults(e) {
2062
- let t = await this.retrieveBatch(e), n = qt(t);
2032
+ let t = await this.retrieveBatch(e), n = Jt(t);
2063
2033
  if (n.status === "pending") throw new P({
2064
2034
  argument: "batchId",
2065
2035
  message: `Google batch "${e.batchId}" is not complete.`
@@ -2084,7 +2054,7 @@ var It = N({
2084
2054
  url: `${this.getBaseOrigin()}/download/v1beta/${a}:download?alt=media`,
2085
2055
  headers: await this.getHeaders(e.headers),
2086
2056
  failedResponseHandler: Y,
2087
- successfulResponseHandler: S(Wt),
2057
+ successfulResponseHandler: S(Gt),
2088
2058
  abortSignal: e.abortSignal,
2089
2059
  fetch: this.batchConfig.fetch,
2090
2060
  validateUrl: !1
@@ -2096,7 +2066,7 @@ var It = N({
2096
2066
  url: `${this.batchConfig.baseURL}/${e.batchId}`,
2097
2067
  headers: await this.getHeaders(e.headers),
2098
2068
  failedResponseHandler: Y,
2099
- successfulResponseHandler: n(Bt),
2069
+ successfulResponseHandler: n(Vt),
2100
2070
  abortSignal: e.abortSignal,
2101
2071
  fetch: this.batchConfig.fetch,
2102
2072
  validateUrl: !1
@@ -2106,7 +2076,7 @@ var It = N({
2106
2076
  async *iterateBatchResults(e) {
2107
2077
  for await (let t of e) {
2108
2078
  if (t.error != null) {
2109
- let e = Zt(t.error, "Google batch request failed."), n = t.error.status === "CANCELLED" || String(t.error.code) === "1" ? "cancelled" : "failed";
2079
+ let e = Qt(t.error, "Google batch request failed."), n = t.error.status === "CANCELLED" || String(t.error.code) === "1" ? "cancelled" : "failed";
2110
2080
  yield {
2111
2081
  type: "text",
2112
2082
  id: t.key,
@@ -2129,7 +2099,7 @@ var It = N({
2129
2099
  }
2130
2100
  let e = await ae({
2131
2101
  value: t.response,
2132
- schema: Gt
2102
+ schema: Kt
2133
2103
  });
2134
2104
  if (e.success && (e.value.candidates == null || e.value.candidates.length === 0)) {
2135
2105
  let n = e.value.promptFeedback ?? void 0, r = n?.blockReason ?? void 0;
@@ -2148,7 +2118,7 @@ var It = N({
2148
2118
  }
2149
2119
  let n = await ae({
2150
2120
  value: t.response,
2151
- schema: Et
2121
+ schema: Dt
2152
2122
  });
2153
2123
  if (!n.success) {
2154
2124
  yield {
@@ -2162,12 +2132,12 @@ var It = N({
2162
2132
  };
2163
2133
  continue;
2164
2134
  }
2165
- let r = dt.convertGenerateContentResponse({
2135
+ let r = ft.convertGenerateContentResponse({
2166
2136
  config: this.batchConfig,
2167
2137
  response: n.value,
2168
2138
  warnings: [],
2169
2139
  providerOptionsNames: ["google"]
2170
- }), i = en(r);
2140
+ }), i = tn(r);
2171
2141
  if (i != null) {
2172
2142
  yield {
2173
2143
  type: "image",
@@ -2177,24 +2147,20 @@ var It = N({
2177
2147
  };
2178
2148
  continue;
2179
2149
  }
2180
- let a = r.content.find((e) => !Pt.has(e.type));
2181
- if (a != null) {
2182
- yield {
2183
- type: "text",
2184
- id: t.key,
2185
- status: "failed",
2186
- error: {
2187
- message: `Google returned a "${a.type}" content block, but that content is not supported in AI SDK text batches.`,
2188
- code: "unsupported_content"
2189
- }
2190
- };
2191
- continue;
2192
- }
2193
- yield {
2150
+ let a = r.content.find((e) => !Ft.has(e.type));
2151
+ a == null ? yield {
2194
2152
  type: "text",
2195
2153
  id: t.key,
2196
2154
  status: "succeeded",
2197
2155
  result: r
2156
+ } : yield {
2157
+ type: "text",
2158
+ id: t.key,
2159
+ status: "failed",
2160
+ error: {
2161
+ message: `Google returned a "${a.type}" content block, but that content is not supported in AI SDK text batches.`,
2162
+ code: "unsupported_content"
2163
+ }
2198
2164
  };
2199
2165
  }
2200
2166
  }
@@ -2230,11 +2196,11 @@ var It = N({
2230
2196
  let d = await j({
2231
2197
  provider: "google",
2232
2198
  providerOptions: c,
2233
- schema: jt
2199
+ schema: Mt
2234
2200
  }), { responseModalities: f, imageConfig: p, ...m } = await j({
2235
2201
  provider: "google",
2236
2202
  providerOptions: c,
2237
- schema: We
2203
+ schema: Ge
2238
2204
  }) ?? {}, h = await j({
2239
2205
  provider: "google",
2240
2206
  providerOptions: { google: {
@@ -2245,8 +2211,8 @@ var It = N({
2245
2211
  ...i == null ? {} : { aspectRatio: i }
2246
2212
  } : void 0
2247
2213
  } },
2248
- schema: We
2249
- }), g = await dt.prepareRequest({
2214
+ schema: Ge
2215
+ }), g = await ft.prepareRequest({
2250
2216
  modelId: e.modelId,
2251
2217
  config: this.batchConfig,
2252
2218
  options: {
@@ -2276,10 +2242,10 @@ var It = N({
2276
2242
  return this.batchConfig.baseURL.replace(/\/v1beta$/, "");
2277
2243
  }
2278
2244
  };
2279
- function qt(e) {
2280
- let t = e.metadata?.state ?? void 0, n = Yt(e.metadata?.batchStats), r = e.metadata?.createTime ?? void 0, i = e.error == null ? void 0 : Zt(e.error, "Google batch failed.");
2245
+ function Jt(e) {
2246
+ let t = e.metadata?.state ?? void 0, n = Xt(e.metadata?.batchStats), r = e.metadata?.createTime ?? void 0, i = e.error == null ? void 0 : Qt(e.error, "Google batch failed.");
2281
2247
  return {
2282
- status: Jt({
2248
+ status: Yt({
2283
2249
  rawStatus: t,
2284
2250
  done: e.done ?? void 0,
2285
2251
  hasError: i != null
@@ -2290,7 +2256,7 @@ function qt(e) {
2290
2256
  ...r == null ? {} : { createdAt: r }
2291
2257
  };
2292
2258
  }
2293
- function Jt({ rawStatus: e, done: t, hasError: n }) {
2259
+ function Yt({ rawStatus: e, done: t, hasError: n }) {
2294
2260
  if (n) return "failed";
2295
2261
  if (e == null) return t ? "completed" : "pending";
2296
2262
  switch (e.replace(/^(?:BATCH|JOB)_STATE_/, "")) {
@@ -2301,27 +2267,27 @@ function Jt({ rawStatus: e, done: t, hasError: n }) {
2301
2267
  default: return "pending";
2302
2268
  }
2303
2269
  }
2304
- function Yt(e) {
2305
- let t = Xt(e?.requestCount), n = Xt(e?.successfulRequestCount ?? 0), r = Xt(e?.failedRequestCount ?? 0);
2270
+ function Xt(e) {
2271
+ let t = Zt(e?.requestCount), n = Zt(e?.successfulRequestCount ?? 0), r = Zt(e?.failedRequestCount ?? 0), i = Zt(e?.pendingRequestCount ?? 0);
2306
2272
  return ue({
2307
2273
  total: t,
2308
- pending: Xt(e?.pendingRequestCount ?? 0),
2274
+ pending: i,
2309
2275
  completed: n,
2310
2276
  failed: r
2311
2277
  });
2312
2278
  }
2313
- function Xt(e) {
2279
+ function Zt(e) {
2314
2280
  let t = typeof e == "string" && /^\d+$/.test(e) ? Number(e) : e;
2315
2281
  return typeof t == "number" && Number.isSafeInteger(t) && t >= 0 ? t : void 0;
2316
2282
  }
2317
- function Zt(e, t) {
2283
+ function Qt(e, t) {
2318
2284
  return {
2319
2285
  message: e.message ?? t,
2320
2286
  ...e.status == null ? {} : { type: e.status },
2321
2287
  ...e.code == null ? {} : { code: String(e.code) }
2322
2288
  };
2323
2289
  }
2324
- var Qt = async ({ response: e }) => {
2290
+ var $t = async ({ response: e }) => {
2325
2291
  let t = e.headers.get("x-goog-upload-url");
2326
2292
  if (t == null) throw new b({
2327
2293
  data: e.headers,
@@ -2329,7 +2295,7 @@ var Qt = async ({ response: e }) => {
2329
2295
  });
2330
2296
  return { value: t };
2331
2297
  };
2332
- function $t(e) {
2298
+ function en(e) {
2333
2299
  let t = e[0]?.modelId;
2334
2300
  if (t == null) throw new P({
2335
2301
  argument: "requests",
@@ -2341,7 +2307,7 @@ function $t(e) {
2341
2307
  });
2342
2308
  return t;
2343
2309
  }
2344
- function en(e) {
2310
+ function tn(e) {
2345
2311
  let t = e.content.flatMap((e) => e.type === "file" && e.mediaType.startsWith("image/") && e.data.type === "data" ? [A(e.data.data)] : []);
2346
2312
  if (t.length === 0) return;
2347
2313
  let n = e.providerMetadata?.google ?? {};
@@ -2364,7 +2330,7 @@ function en(e) {
2364
2330
  }
2365
2331
  };
2366
2332
  }
2367
- var tn = V({
2333
+ var nn = V({
2368
2334
  id: "google.enterprise_web_search",
2369
2335
  inputSchema: G(() => t(N({}))),
2370
2336
  outputSchema: G(() => t(N({})))
@@ -2374,13 +2340,13 @@ se({
2374
2340
  topK: B().int().positive().describe("The number of file search retrieval chunks to retrieve.").optional(),
2375
2341
  metadataFilter: W().describe("Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression.").optional()
2376
2342
  });
2377
- var nn = V({
2343
+ var rn = V({
2378
2344
  id: "google.file_search",
2379
2345
  inputSchema: G(() => t(N({}))),
2380
2346
  outputSchema: G(() => t(N({})))
2381
- }), rn = {
2382
- googleSearch: At,
2383
- enterpriseWebSearch: tn,
2347
+ }), an = {
2348
+ googleSearch: jt,
2349
+ enterpriseWebSearch: nn,
2384
2350
  googleMaps: V({
2385
2351
  id: "google.google_maps",
2386
2352
  inputSchema: G(() => t(N({}))),
@@ -2391,18 +2357,18 @@ var nn = V({
2391
2357
  inputSchema: G(() => t(N({}))),
2392
2358
  outputSchema: G(() => t(N({})))
2393
2359
  }),
2394
- fileSearch: nn,
2395
- codeExecution: Ae,
2360
+ fileSearch: rn,
2361
+ codeExecution: je,
2396
2362
  vertexRagStore: V({
2397
2363
  id: "google.vertex_rag_store",
2398
2364
  inputSchema: G(() => t(N({}))),
2399
2365
  outputSchema: G(() => t(N({})))
2400
2366
  })
2401
- }, an = /* @__PURE__ */ new Set([
2367
+ }, on = /* @__PURE__ */ new Set([
2402
2368
  "gemini-2.5-flash-image",
2403
2369
  "gemini-3-pro-image-preview",
2404
2370
  "gemini-3.1-flash-image-preview"
2405
- ]), on = class e {
2371
+ ]), sn = class e {
2406
2372
  constructor(e, t, n) {
2407
2373
  this.modelId = e, this.settings = t, this.config = n, this.specificationVersion = "v4";
2408
2374
  }
@@ -2419,10 +2385,10 @@ var nn = V({
2419
2385
  return this.settings.maxImagesPerCall == null ? 1 : this.settings.maxImagesPerCall;
2420
2386
  }
2421
2387
  get supportsFileInputs() {
2422
- return an.has(this.modelId) ? !0 : void 0;
2388
+ return on.has(this.modelId) ? !0 : void 0;
2423
2389
  }
2424
2390
  get supportsMaskInputs() {
2425
- return this.supportsFileInputs === !0 ? !1 : void 0;
2391
+ return this.supportsFileInputs !== !0 && void 0;
2426
2392
  }
2427
2393
  get provider() {
2428
2394
  return this.config.provider;
@@ -2461,8 +2427,8 @@ var nn = V({
2461
2427
  }], m = await j({
2462
2428
  provider: "google",
2463
2429
  providerOptions: o,
2464
- schema: jt
2465
- }), { googleSearch: h, responseModalities: g, imageConfig: _, ...v } = o?.google ?? {}, y = await new dt(this.modelId, {
2430
+ schema: Mt
2431
+ }), { googleSearch: h, responseModalities: g, imageConfig: _, ...v } = o?.google ?? {}, y = await new ft(this.modelId, {
2466
2432
  provider: this.config.provider,
2467
2433
  baseURL: this.config.baseURL,
2468
2434
  headers: this.config.headers ?? {},
@@ -2512,11 +2478,11 @@ var nn = V({
2512
2478
  };
2513
2479
  }
2514
2480
  };
2515
- function sn(e) {
2481
+ function cn(e) {
2516
2482
  let t = encodeURIComponent(e);
2517
2483
  return t === "." ? "%252E" : t === ".." ? "%252E%252E" : t;
2518
2484
  }
2519
- var cn = class {
2485
+ var ln = class {
2520
2486
  constructor(e) {
2521
2487
  this.config = e, this.specificationVersion = "v4";
2522
2488
  }
@@ -2527,7 +2493,7 @@ var cn = class {
2527
2493
  let t = await j({
2528
2494
  provider: "google",
2529
2495
  providerOptions: e.providerOptions,
2530
- schema: dn
2496
+ schema: fn
2531
2497
  }), r = L(this.config.headers(), e.headers), i = this.config.fetch ?? globalThis.fetch, a = [];
2532
2498
  e.filename != null && a.push({
2533
2499
  type: "unsupported",
@@ -2564,7 +2530,7 @@ var cn = class {
2564
2530
  "X-Goog-Upload-Offset": "0",
2565
2531
  "X-Goog-Upload-Command": "upload, finalize"
2566
2532
  },
2567
- body: ln(o),
2533
+ body: un(o),
2568
2534
  signal: e.abortSignal
2569
2535
  });
2570
2536
  if (!d.ok) {
@@ -2581,11 +2547,11 @@ var cn = class {
2581
2547
  message: `File processing timed out after ${m}ms`
2582
2548
  });
2583
2549
  await g(p, { abortSignal: e.abortSignal });
2584
- let t = /^files\/([^/]+)$/.exec(f.name), i = t == null ? sn(f.name) : `files/${sn(t[1])}`, { value: a } = await w({
2550
+ let t = /^files\/([^/]+)$/.exec(f.name), i = t == null ? cn(f.name) : `files/${cn(t[1])}`, { value: a } = await w({
2585
2551
  url: `${this.config.baseURL}/${i}`,
2586
2552
  validateUrl: !1,
2587
2553
  headers: L(r),
2588
- successfulResponseHandler: n(un),
2554
+ successfulResponseHandler: n(dn),
2589
2555
  failedResponseHandler: Y,
2590
2556
  abortSignal: e.abortSignal,
2591
2557
  fetch: this.config.fetch
@@ -2615,10 +2581,10 @@ var cn = class {
2615
2581
  };
2616
2582
  }
2617
2583
  };
2618
- function ln(e) {
2584
+ function un(e) {
2619
2585
  return e.buffer instanceof ArrayBuffer ? e : new Uint8Array(e);
2620
2586
  }
2621
- var un = G(() => t(N({
2587
+ var dn = G(() => t(N({
2622
2588
  name: W(),
2623
2589
  displayName: W().nullish(),
2624
2590
  mimeType: W(),
@@ -2629,11 +2595,11 @@ var un = G(() => t(N({
2629
2595
  sha256Hash: W().nullish(),
2630
2596
  uri: W(),
2631
2597
  state: W()
2632
- }))), dn = G(() => t(se({
2598
+ }))), fn = G(() => t(se({
2633
2599
  displayName: W().nullish(),
2634
2600
  pollIntervalMs: B().positive().nullish(),
2635
2601
  pollTimeoutMs: B().positive().nullish()
2636
- }))), fn = G(() => t(se({
2602
+ }))), pn = G(() => t(se({
2637
2603
  pollIntervalMs: B().positive().nullish(),
2638
2604
  pollTimeoutMs: B().positive().nullish(),
2639
2605
  personGeneration: D([
@@ -2647,19 +2613,19 @@ var un = G(() => t(N({
2647
2613
  gcsUri: W().nullish()
2648
2614
  })).nullish()
2649
2615
  })));
2650
- function pn(e) {
2651
- return e.frameImages?.find((e) => e.frameType === "first_frame")?.image;
2652
- }
2653
2616
  function mn(e) {
2654
- return pn(e) ?? e.image;
2617
+ return e.frameImages?.find((e) => e.frameType === "first_frame")?.image;
2655
2618
  }
2656
2619
  function hn(e) {
2657
- return e.frameImages?.find((e) => e.frameType === "last_frame")?.image;
2620
+ return mn(e) ?? e.image;
2658
2621
  }
2659
2622
  function gn(e) {
2623
+ return e.frameImages?.find((e) => e.frameType === "last_frame")?.image;
2624
+ }
2625
+ function _n(e) {
2660
2626
  if (!(e.frameImages != null && e.frameImages.length > 0)) return e.inputReferences != null && e.inputReferences.length > 0 ? e.inputReferences : void 0;
2661
2627
  }
2662
- function _n(e, t) {
2628
+ function vn(e, t) {
2663
2629
  if (e.type === "url") {
2664
2630
  if (e.url.startsWith("gs://")) return {
2665
2631
  gcsUri: e.url,
@@ -2670,14 +2636,12 @@ function _n(e, t) {
2670
2636
  feature: "URL-based image input",
2671
2637
  details: "Google Generative AI video models require base64-encoded images or GCS URIs. URL will be ignored."
2672
2638
  });
2673
- return;
2674
- }
2675
- return {
2639
+ } else return {
2676
2640
  bytesBase64Encoded: typeof e.data == "string" ? e.data : ge(e.data),
2677
2641
  mimeType: e.mediaType || "image/png"
2678
2642
  };
2679
2643
  }
2680
- function vn(e) {
2644
+ function yn(e) {
2681
2645
  return e.bytesBase64Encoded ? {
2682
2646
  image: {
2683
2647
  bytesBase64Encoded: e.bytesBase64Encoded,
@@ -2692,14 +2656,14 @@ function vn(e) {
2692
2656
  referenceType: "asset"
2693
2657
  } : e;
2694
2658
  }
2695
- function yn(e, t) {
2696
- let n = _n(e, t);
2659
+ function bn(e, t) {
2660
+ let n = vn(e, t);
2697
2661
  return n == null ? void 0 : {
2698
2662
  image: n,
2699
2663
  referenceType: "asset"
2700
2664
  };
2701
2665
  }
2702
- var bn = class {
2666
+ var xn = class {
2703
2667
  constructor(e, t) {
2704
2668
  this.modelId = e, this.config = t, this.specificationVersion = "v4";
2705
2669
  }
@@ -2713,22 +2677,22 @@ var bn = class {
2713
2677
  let t = [], n = await j({
2714
2678
  provider: "google",
2715
2679
  providerOptions: e.providerOptions,
2716
- schema: fn
2680
+ schema: pn
2717
2681
  }), r = [{}], i = r[0];
2718
2682
  e.prompt != null && (i.prompt = e.prompt);
2719
- let a = mn(e);
2683
+ let a = hn(e);
2720
2684
  if (a != null) {
2721
- let e = _n(a, t);
2685
+ let e = vn(a, t);
2722
2686
  e != null && (i.image = e);
2723
2687
  }
2724
- let o = hn(e);
2688
+ let o = gn(e);
2725
2689
  if (o != null) {
2726
- let e = _n(o, t);
2690
+ let e = vn(o, t);
2727
2691
  e != null && (i.lastFrame = e);
2728
2692
  }
2729
- let s = gn(e);
2730
- s == null ? n?.referenceImages != null && (i.referenceImages = n.referenceImages.map((e) => vn(e))) : i.referenceImages = s.flatMap((e) => {
2731
- let n = yn(e, t);
2693
+ let s = _n(e);
2694
+ s == null ? n?.referenceImages != null && (i.referenceImages = n.referenceImages.map((e) => yn(e))) : i.referenceImages = s.flatMap((e) => {
2695
+ let n = bn(e, t);
2732
2696
  return n == null ? [] : [n];
2733
2697
  });
2734
2698
  let c = { sampleCount: e.n };
@@ -2793,7 +2757,7 @@ var bn = class {
2793
2757
  instances: r,
2794
2758
  parameters: i
2795
2759
  },
2796
- successfulResponseHandler: n(xn),
2760
+ successfulResponseHandler: n(Sn),
2797
2761
  failedResponseHandler: Y,
2798
2762
  abortSignal: e.abortSignal,
2799
2763
  fetch: this.config.fetch
@@ -2817,7 +2781,7 @@ var bn = class {
2817
2781
  url: `${this.config.baseURL}/${r}`,
2818
2782
  validateUrl: !1,
2819
2783
  headers: L(await J(this.config.headers), e.headers),
2820
- successfulResponseHandler: n(xn),
2784
+ successfulResponseHandler: n(Sn),
2821
2785
  failedResponseHandler: Y,
2822
2786
  abortSignal: e.abortSignal,
2823
2787
  fetch: this.config.fetch
@@ -2839,7 +2803,7 @@ var bn = class {
2839
2803
  }
2840
2804
  };
2841
2805
  }
2842
- }, xn = N({
2806
+ }, Sn = N({
2843
2807
  name: W().nullish(),
2844
2808
  done: k().nullish(),
2845
2809
  error: N({
@@ -2848,11 +2812,11 @@ var bn = class {
2848
2812
  status: W().nullish()
2849
2813
  }).nullish(),
2850
2814
  response: N({ generateVideoResponse: N({ generatedSamples: c(N({ video: N({ uri: W().nullish() }).nullish() })).nullish() }).nullish() }).nullish()
2851
- }), Sn = G(() => t(N({ candidates: c(N({ content: N({ parts: c(N({ inlineData: N({
2815
+ }), Cn = G(() => t(N({ candidates: c(N({ content: N({ parts: c(N({ inlineData: N({
2852
2816
  mimeType: W().nullish(),
2853
2817
  data: W().nullish()
2854
2818
  }).nullish() })).nullish() }).nullish() })).nullish() })));
2855
- function Cn({ text: e, voice: t, providerOptions: n }) {
2819
+ function wn({ text: e, voice: t, providerOptions: n }) {
2856
2820
  let r = n?.google, i = typeof r == "object" && r ? r : void 0, a = i && "turns" in i ? i.turns : void 0, o = [];
2857
2821
  if (Array.isArray(a) && a.length > 0) {
2858
2822
  for (let e of a) {
@@ -2867,23 +2831,23 @@ function Cn({ text: e, voice: t, providerOptions: n }) {
2867
2831
  usesCustomVoice: t?.startsWith("voice_") === !0 || t?.startsWith("voicekey_") === !0 || c.some((e) => typeof e == "object" && !!e && "voiceConfig" in e && e.voiceConfig != null && typeof e.voiceConfig == "object" && "voice" in e.voiceConfig)
2868
2832
  };
2869
2833
  }
2870
- var wn = N({
2871
- prebuiltVoiceConfig: N({ voiceName: W() }),
2834
+ var Tn = N({ voiceName: W() }), En = N({
2835
+ prebuiltVoiceConfig: Tn,
2872
2836
  voice: de().optional()
2873
- }), Tn = N({
2837
+ }), Dn = N({
2874
2838
  speaker: W().min(1).optional(),
2875
2839
  style: W().optional()
2876
- }), En = G(() => t(N({
2877
- speechMetadata: Tn.optional(),
2840
+ }), On = G(() => t(N({
2841
+ speechMetadata: Dn.optional(),
2878
2842
  turns: c(N({
2879
2843
  text: W(),
2880
- speechMetadata: Tn.optional()
2844
+ speechMetadata: Dn.optional()
2881
2845
  })).min(1).optional(),
2882
2846
  multiSpeakerVoiceConfig: N({ speakerVoiceConfigs: c(N({
2883
2847
  speaker: W(),
2884
- voiceConfig: wn
2848
+ voiceConfig: En
2885
2849
  })) }).optional()
2886
- }))), Dn = "Kore", On = 24e3, kn = class e {
2850
+ }))), kn = "Kore", An = 24e3, jn = class e {
2887
2851
  constructor(e, t) {
2888
2852
  this.modelId = e, this.config = t, this.specificationVersion = "v4";
2889
2853
  }
@@ -2899,19 +2863,19 @@ var wn = N({
2899
2863
  get provider() {
2900
2864
  return this.config.provider;
2901
2865
  }
2902
- async getArgs({ text: e, voice: t = Dn, outputFormat: n, instructions: r, speed: i, language: a, providerOptions: o }) {
2866
+ async getArgs({ text: e, voice: t = kn, outputFormat: n, instructions: r, speed: i, language: a, providerOptions: o }) {
2903
2867
  let s = [], c = this.config.provider.includes("vertex") ? ["googleVertex", "vertex"] : ["google"], l;
2904
2868
  for (let e of c) if (l = await j({
2905
2869
  provider: e,
2906
2870
  providerOptions: o,
2907
- schema: En
2871
+ schema: On
2908
2872
  }), l != null) break;
2909
2873
  l == null && !c.includes("google") && (l = await j({
2910
2874
  provider: "google",
2911
2875
  providerOptions: o,
2912
- schema: En
2876
+ schema: On
2913
2877
  }));
2914
- let u = !this.modelId.startsWith("gemini-2.5-") && !this.modelId.startsWith("gemini-3.1-"), d = Cn({
2878
+ let u = !this.modelId.startsWith("gemini-2.5-") && !this.modelId.startsWith("gemini-3.1-"), d = wn({
2915
2879
  text: e,
2916
2880
  voice: t,
2917
2881
  providerOptions: { google: l }
@@ -3010,7 +2974,7 @@ var wn = N({
3010
2974
  headers: L(this.config.headers ? await J(this.config.headers) : void 0, e.headers),
3011
2975
  body: r,
3012
2976
  failedResponseHandler: Y,
3013
- successfulResponseHandler: n(Sn),
2977
+ successfulResponseHandler: n(Cn),
3014
2978
  abortSignal: e.abortSignal,
3015
2979
  fetch: this.config.fetch
3016
2980
  }), u, d;
@@ -3021,7 +2985,7 @@ var wn = N({
3021
2985
  }
3022
2986
  if (u != null) break;
3023
2987
  }
3024
- let f = An(d) ?? On, p = u == null ? new Uint8Array() : ne(u), m = /^audio\/(?:l16|pcm)(?:;|$)/i.test(d ?? "") || d == null && !o, h = a === "AUDIO_WAV" && m && p.length > 0 ? jn(p, f) : p;
2988
+ let f = Mn(d) ?? An, p = u == null ? /* @__PURE__ */ new Uint8Array() : ne(u), m = /^audio\/(?:l16|pcm)(?:;|$)/i.test(d ?? "") || d == null && !o, h = a === "AUDIO_WAV" && m && p.length > 0 ? Nn(p, f) : p;
3025
2989
  return a === "AUDIO_L16" && p.length > 0 && !o && i.push({
3026
2990
  type: "unsupported",
3027
2991
  feature: "outputFormat",
@@ -3043,21 +3007,21 @@ var wn = N({
3043
3007
  };
3044
3008
  }
3045
3009
  };
3046
- function An(e) {
3010
+ function Mn(e) {
3047
3011
  if (e == null) return;
3048
3012
  let t = /rate=(\d+)/.exec(e);
3049
3013
  return t ? Number.parseInt(t[1], 10) : void 0;
3050
3014
  }
3051
- function jn(e, t) {
3015
+ function Nn(e, t) {
3052
3016
  let n = t * 2, r = e.length, i = new ArrayBuffer(44 + r), a = new DataView(i);
3053
- Mn(a, 0, "RIFF"), a.setUint32(4, 36 + r, !0), Mn(a, 8, "WAVE"), Mn(a, 12, "fmt "), a.setUint32(16, 16, !0), a.setUint16(20, 1, !0), a.setUint16(22, 1, !0), a.setUint32(24, t, !0), a.setUint32(28, n, !0), a.setUint16(32, 2, !0), a.setUint16(34, 16, !0), Mn(a, 36, "data"), a.setUint32(40, r, !0);
3017
+ Pn(a, 0, "RIFF"), a.setUint32(4, 36 + r, !0), Pn(a, 8, "WAVE"), Pn(a, 12, "fmt "), a.setUint32(16, 16, !0), a.setUint16(20, 1, !0), a.setUint16(22, 1, !0), a.setUint32(24, t, !0), a.setUint32(28, n, !0), a.setUint16(32, 2, !0), a.setUint16(34, 16, !0), Pn(a, 36, "data"), a.setUint32(40, r, !0);
3054
3018
  let o = new Uint8Array(i);
3055
3019
  return o.set(e, 44), o;
3056
3020
  }
3057
- function Mn(e, t, n) {
3021
+ function Pn(e, t, n) {
3058
3022
  for (let r = 0; r < n.length; r++) e.setUint8(t + r, n.charCodeAt(r));
3059
3023
  }
3060
- function Nn(e) {
3024
+ function Fn(e) {
3061
3025
  if (e == null) return m();
3062
3026
  let t = e.total_input_tokens ?? 0, n = e.total_output_tokens ?? 0, r = e.total_thought_tokens ?? 0, i = e.total_cached_tokens ?? 0;
3063
3027
  return {
@@ -3075,14 +3039,14 @@ function Nn(e) {
3075
3039
  raw: e
3076
3040
  };
3077
3041
  }
3078
- function Pn(e) {
3042
+ function In(e) {
3079
3043
  let t = e?.output_tokens_by_modality;
3080
3044
  if (t == null) return;
3081
3045
  let n = {};
3082
3046
  for (let e of t) e?.modality != null && e.tokens != null && (n[e.modality] = e.tokens);
3083
3047
  return Object.keys(n).length > 0 ? n : void 0;
3084
3048
  }
3085
- var Fn = {
3049
+ var Ln = {
3086
3050
  pdf: "application/pdf",
3087
3051
  txt: "text/plain",
3088
3052
  md: "text/markdown",
@@ -3090,16 +3054,16 @@ var Fn = {
3090
3054
  doc: "application/msword",
3091
3055
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
3092
3056
  };
3093
- function In(e) {
3057
+ function Rn(e) {
3094
3058
  let t = e.toLowerCase();
3095
- for (let [e, n] of Object.entries(Fn)) if (t.endsWith(`.${e}`)) return n;
3059
+ for (let [e, n] of Object.entries(Ln)) if (t.endsWith(`.${e}`)) return n;
3096
3060
  return "application/octet-stream";
3097
3061
  }
3098
- function Ln(e) {
3062
+ function zn(e) {
3099
3063
  let t = e.split("/"), n = t[t.length - 1];
3100
3064
  return n && n.length > 0 ? n : void 0;
3101
3065
  }
3102
- function Rn({ annotation: e, generateId: t }) {
3066
+ function Bn({ annotation: e, generateId: t }) {
3103
3067
  switch (e.type) {
3104
3068
  case "url_citation": {
3105
3069
  let n = e;
@@ -3121,7 +3085,7 @@ function Rn({ annotation: e, generateId: t }) {
3121
3085
  url: r,
3122
3086
  ...n.file_name == null ? {} : { title: n.file_name }
3123
3087
  };
3124
- let i = n.file_name ?? Ln(r), a = In(r);
3088
+ let i = n.file_name ?? zn(r), a = Rn(r);
3125
3089
  return {
3126
3090
  type: "source",
3127
3091
  sourceType: "document",
@@ -3144,12 +3108,12 @@ function Rn({ annotation: e, generateId: t }) {
3144
3108
  default: return;
3145
3109
  }
3146
3110
  }
3147
- function zn({ block: e, generateId: t }) {
3111
+ function Vn({ block: e, generateId: t }) {
3148
3112
  let n = [];
3149
3113
  switch (e.type) {
3150
3114
  case "url_context_result": {
3151
3115
  let r = e.result ?? [];
3152
- for (let e of r) e?.url == null || e.url.length === 0 || e.status != null && e.status !== "success" || n.push({
3116
+ for (let e of r) e?.url != null && e.url.length !== 0 && (e.status == null || e.status === "success") && n.push({
3153
3117
  type: "source",
3154
3118
  sourceType: "url",
3155
3119
  id: t(),
@@ -3161,7 +3125,7 @@ function zn({ block: e, generateId: t }) {
3161
3125
  let r = e.result ?? [];
3162
3126
  for (let e of r) {
3163
3127
  let r = e?.url;
3164
- r == null || r.length === 0 || n.push({
3128
+ r != null && r.length !== 0 && n.push({
3165
3129
  type: "source",
3166
3130
  sourceType: "url",
3167
3131
  id: t(),
@@ -3173,7 +3137,7 @@ function zn({ block: e, generateId: t }) {
3173
3137
  }
3174
3138
  case "google_maps_result": {
3175
3139
  let r = e.result ?? [];
3176
- for (let e of r) for (let r of e.places ?? []) r.url == null || r.url.length === 0 || n.push({
3140
+ for (let e of r) for (let r of e.places ?? []) r.url != null && r.url.length !== 0 && n.push({
3177
3141
  type: "source",
3178
3142
  sourceType: "url",
3179
3143
  id: t(),
@@ -3198,7 +3162,7 @@ function zn({ block: e, generateId: t }) {
3198
3162
  });
3199
3163
  continue;
3200
3164
  }
3201
- let a = r.file_name ?? Ln(i), o = In(i);
3165
+ let a = r.file_name ?? zn(i), o = Rn(i);
3202
3166
  n.push({
3203
3167
  type: "source",
3204
3168
  sourceType: "document",
@@ -3210,15 +3174,14 @@ function zn({ block: e, generateId: t }) {
3210
3174
  }
3211
3175
  break;
3212
3176
  }
3213
- default: break;
3214
3177
  }
3215
3178
  return n;
3216
3179
  }
3217
- function Bn({ annotations: e, generateId: t }) {
3180
+ function Hn({ annotations: e, generateId: t }) {
3218
3181
  if (e == null) return [];
3219
3182
  let n = /* @__PURE__ */ new Set(), r = [];
3220
3183
  for (let i of e) {
3221
- let e = Rn({
3184
+ let e = Bn({
3222
3185
  annotation: i,
3223
3186
  generateId: t
3224
3187
  });
@@ -3228,7 +3191,7 @@ function Bn({ annotations: e, generateId: t }) {
3228
3191
  }
3229
3192
  return r;
3230
3193
  }
3231
- function Vn({ status: e, hasFunctionCall: t }) {
3194
+ function Un({ status: e, hasFunctionCall: t }) {
3232
3195
  switch (e) {
3233
3196
  case "completed": return t ? "tool-calls" : "stop";
3234
3197
  case "requires_action": return "tool-calls";
@@ -3238,14 +3201,14 @@ function Vn({ status: e, hasFunctionCall: t }) {
3238
3201
  default: return "other";
3239
3202
  }
3240
3203
  }
3241
- var Hn = /* @__PURE__ */ new Set([
3204
+ var Wn = /* @__PURE__ */ new Set([
3242
3205
  "google_search_call",
3243
3206
  "code_execution_call",
3244
3207
  "url_context_call",
3245
3208
  "file_search_call",
3246
3209
  "google_maps_call",
3247
3210
  "mcp_server_tool_call"
3248
- ]), Un = /* @__PURE__ */ new Set([
3211
+ ]), Gn = /* @__PURE__ */ new Set([
3249
3212
  "google_search_result",
3250
3213
  "code_execution_result",
3251
3214
  "url_context_result",
@@ -3253,13 +3216,13 @@ var Hn = /* @__PURE__ */ new Set([
3253
3216
  "google_maps_result",
3254
3217
  "mcp_server_tool_result"
3255
3218
  ]);
3256
- function Wn(e) {
3219
+ function Kn(e) {
3257
3220
  return e.replace(/_call$/, "");
3258
3221
  }
3259
- function Gn(e) {
3222
+ function qn(e) {
3260
3223
  return e.replace(/_result$/, "");
3261
3224
  }
3262
- function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r }) {
3225
+ function Jn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r }) {
3263
3226
  let i, a, o = r, s, c = !1, l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set();
3264
3227
  function d(e) {
3265
3228
  return e.sourceType === "url" ? `url:${e.url}` : `doc:${e.filename ?? e.title}`;
@@ -3313,7 +3276,7 @@ function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3313
3276
  type: "text-start",
3314
3277
  id: o
3315
3278
  });
3316
- let n = Bn({
3279
+ let n = Hn({
3317
3280
  annotations: e.annotations,
3318
3281
  generateId: t
3319
3282
  });
@@ -3369,8 +3332,8 @@ function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3369
3332
  id: e,
3370
3333
  toolName: t
3371
3334
  });
3372
- } else if (s != null && Hn.has(s)) {
3373
- let e = s === "mcp_server_tool_call" ? n?.name ?? "mcp_server_tool" : Wn(s), t = {
3335
+ } else if (s != null && Wn.has(s)) {
3336
+ let e = s === "mcp_server_tool_call" ? n?.name ?? "mcp_server_tool" : Kn(s), t = {
3374
3337
  kind: "builtin_tool_call",
3375
3338
  id: o,
3376
3339
  blockType: s,
@@ -3380,8 +3343,8 @@ function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3380
3343
  callEmitted: !1
3381
3344
  };
3382
3345
  l.set(a, t);
3383
- } else if (s != null && Un.has(s)) {
3384
- let e = s === "mcp_server_tool_result" ? n?.name ?? "mcp_server_tool" : Gn(s), t = {
3346
+ } else if (s != null && Gn.has(s)) {
3347
+ let e = s === "mcp_server_tool_result" ? n?.name ?? "mcp_server_tool" : qn(s), t = {
3385
3348
  kind: "builtin_tool_result",
3386
3349
  id: o,
3387
3350
  blockType: s,
@@ -3469,7 +3432,7 @@ function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3469
3432
  delta: e
3470
3433
  });
3471
3434
  } else if (n.kind === "text" && (o?.type === "text_annotation" || o?.type === "text_annotation_delta")) {
3472
- let e = Bn({
3435
+ let e = Hn({
3473
3436
  annotations: o.annotations,
3474
3437
  generateId: t
3475
3438
  });
@@ -3575,7 +3538,7 @@ function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3575
3538
  toolName: n.toolName,
3576
3539
  result: n.result ?? null
3577
3540
  }), n.resultEmitted = !0;
3578
- let e = zn({
3541
+ let e = Vn({
3579
3542
  block: {
3580
3543
  type: n.blockType,
3581
3544
  call_id: n.callId,
@@ -3616,17 +3579,16 @@ function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3616
3579
  });
3617
3580
  break;
3618
3581
  }
3619
- default: break;
3620
3582
  }
3621
3583
  },
3622
3584
  flush(e) {
3623
3585
  let t = {
3624
- unified: Vn({
3586
+ unified: Un({
3625
3587
  status: s,
3626
3588
  hasFunctionCall: c
3627
3589
  }),
3628
3590
  raw: s
3629
- }, n = Pn(a), r = { google: {
3591
+ }, n = In(a), r = { google: {
3630
3592
  ...i == null ? {} : { interactionId: i },
3631
3593
  ...o == null ? {} : { serviceTier: o },
3632
3594
  ...n == null ? {} : { outputTokensByModality: n }
@@ -3634,19 +3596,19 @@ function Kn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3634
3596
  e.enqueue({
3635
3597
  type: "finish",
3636
3598
  finishReason: t,
3637
- usage: Nn(a),
3599
+ usage: Fn(a),
3638
3600
  providerMetadata: r
3639
3601
  });
3640
3602
  }
3641
3603
  });
3642
3604
  }
3643
- function qn({ prompt: e, previousInteractionId: t, store: n, mediaResolution: r }) {
3605
+ function Yn({ prompt: e, previousInteractionId: t, store: n, mediaResolution: r }) {
3644
3606
  let i = [], a = t != null && n === !1, o = t != null && n !== !1;
3645
3607
  a && i.push({
3646
3608
  type: "other",
3647
3609
  message: "google.interactions: providerOptions.google.previousInteractionId was set together with store: false. These are incoherent (the prior interaction cannot be referenced when nothing was stored on the server); the full history will be sent and previous_interaction_id will still be emitted."
3648
3610
  });
3649
- let s = o ? Xn({
3611
+ let s = o ? Qn({
3650
3612
  prompt: e,
3651
3613
  previousInteractionId: t
3652
3614
  }) : e, c = [], l = [];
@@ -3661,14 +3623,14 @@ function qn({ prompt: e, previousInteractionId: t, store: n, mediaResolution: r
3661
3623
  text: n.text
3662
3624
  });
3663
3625
  else if (n.type === "file") {
3664
- let e = Jn({
3626
+ let e = Xn({
3665
3627
  part: n,
3666
3628
  warnings: i,
3667
3629
  mediaResolution: r
3668
3630
  });
3669
3631
  e != null && t.push(e);
3670
3632
  }
3671
- let n = er(t);
3633
+ let n = nr(t);
3672
3634
  n.length > 0 && l.push({
3673
3635
  type: "user_input",
3674
3636
  content: n
@@ -3698,7 +3660,7 @@ function qn({ prompt: e, previousInteractionId: t, store: n, mediaResolution: r
3698
3660
  }] : void 0
3699
3661
  });
3700
3662
  } else if (a.type === "file") {
3701
- let e = Jn({
3663
+ let e = Xn({
3702
3664
  part: a,
3703
3665
  warnings: i,
3704
3666
  mediaResolution: r
@@ -3721,7 +3683,7 @@ function qn({ prompt: e, previousInteractionId: t, store: n, mediaResolution: r
3721
3683
  });
3722
3684
  } else if (a.type === "tool-call") {
3723
3685
  n();
3724
- let e = a.providerOptions?.google?.signature, t = typeof a.input == "string" ? Zn(a.input) : a.input ?? {};
3686
+ let e = a.providerOptions?.google?.signature, t = typeof a.input == "string" ? $n(a.input) : a.input ?? {};
3725
3687
  l.push({
3726
3688
  type: "function_call",
3727
3689
  id: a.toolCallId,
@@ -3746,7 +3708,7 @@ function qn({ prompt: e, previousInteractionId: t, store: n, mediaResolution: r
3746
3708
  });
3747
3709
  continue;
3748
3710
  }
3749
- let e = Qn({
3711
+ let e = er({
3750
3712
  toolCallId: n.toolCallId,
3751
3713
  toolName: n.toolName,
3752
3714
  output: n.output,
@@ -3768,7 +3730,7 @@ function qn({ prompt: e, previousInteractionId: t, store: n, mediaResolution: r
3768
3730
  warnings: i
3769
3731
  };
3770
3732
  }
3771
- function Jn({ part: e, warnings: t, mediaResolution: n }) {
3733
+ function Xn({ part: e, warnings: t, mediaResolution: n }) {
3772
3734
  if (e.data.type === "text") return {
3773
3735
  type: "text",
3774
3736
  text: e.data.text
@@ -3797,7 +3759,7 @@ function Jn({ part: e, warnings: t, mediaResolution: n }) {
3797
3759
  });
3798
3760
  return;
3799
3761
  }
3800
- let o = n != null && (a === "image" || a === "video") ? { resolution: n } : {}, s = a === "video" ? Yn({
3762
+ let o = n != null && (a === "image" || a === "video") ? { resolution: n } : {}, s = a === "video" ? Zn({
3801
3763
  part: e,
3802
3764
  warnings: t
3803
3765
  }) : {};
@@ -3834,7 +3796,7 @@ function Jn({ part: e, warnings: t, mediaResolution: n }) {
3834
3796
  }
3835
3797
  }
3836
3798
  }
3837
- function Yn({ part: e, warnings: t }) {
3799
+ function Zn({ part: e, warnings: t }) {
3838
3800
  let n = e.providerOptions?.google?.processing;
3839
3801
  if (n == null) return {};
3840
3802
  if (n === "agentic" || n === "static") return { processing: n };
@@ -3852,31 +3814,25 @@ function Yn({ part: e, warnings: t }) {
3852
3814
  message: "google.interactions: invalid providerOptions.google.processing on video file part; expected \"agentic\", \"static\", or a static processing configuration. Option dropped."
3853
3815
  }), {};
3854
3816
  }
3855
- function Xn({ prompt: e, previousInteractionId: t }) {
3817
+ function Qn({ prompt: e, previousInteractionId: t }) {
3856
3818
  let n = [], r = /* @__PURE__ */ new Set();
3857
- for (let i of e) {
3858
- if (i.role === "assistant") {
3859
- if (i.content.some((e) => e.providerOptions?.google?.interactionId === t)) {
3860
- for (let e of i.content) e.type === "tool-call" && r.add(e.toolCallId);
3861
- continue;
3862
- }
3863
- n.push(i);
3864
- continue;
3865
- }
3866
- if (i.role === "tool") {
3867
- let e = i.content.filter((e) => e.type === "tool-result" ? !r.has(e.toolCallId) : !0);
3868
- if (e.length === 0) continue;
3869
- n.push({
3870
- ...i,
3871
- content: e
3872
- });
3819
+ for (let i of e) if (i.role === "assistant") {
3820
+ if (i.content.some((e) => e.providerOptions?.google?.interactionId === t)) {
3821
+ for (let e of i.content) e.type === "tool-call" && r.add(e.toolCallId);
3873
3822
  continue;
3874
3823
  }
3875
3824
  n.push(i);
3876
- }
3825
+ } else if (i.role === "tool") {
3826
+ let e = i.content.filter((e) => e.type !== "tool-result" || !r.has(e.toolCallId));
3827
+ if (e.length === 0) continue;
3828
+ n.push({
3829
+ ...i,
3830
+ content: e
3831
+ });
3832
+ } else n.push(i);
3877
3833
  return n;
3878
3834
  }
3879
- function Zn(t) {
3835
+ function $n(t) {
3880
3836
  try {
3881
3837
  let n = e(t);
3882
3838
  return typeof n == "object" && n && !Array.isArray(n) ? n : { value: n };
@@ -3884,7 +3840,7 @@ function Zn(t) {
3884
3840
  return { value: t };
3885
3841
  }
3886
3842
  }
3887
- function Qn({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }) {
3843
+ function er({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }) {
3888
3844
  let a = {
3889
3845
  type: "function_result",
3890
3846
  call_id: e,
@@ -3929,7 +3885,7 @@ function Qn({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }
3929
3885
  });
3930
3886
  continue;
3931
3887
  }
3932
- let n = $n({
3888
+ let n = tr({
3933
3889
  part: t,
3934
3890
  warnings: i
3935
3891
  });
@@ -3945,7 +3901,7 @@ function Qn({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }
3945
3901
  }
3946
3902
  }
3947
3903
  }
3948
- function $n({ part: e, warnings: t }) {
3904
+ function tr({ part: e, warnings: t }) {
3949
3905
  switch (e.data.type) {
3950
3906
  case "data": {
3951
3907
  let t = _(e.mediaType) ? e.mediaType : C({ part: {
@@ -3980,7 +3936,7 @@ function $n({ part: e, warnings: t }) {
3980
3936
  return;
3981
3937
  }
3982
3938
  }
3983
- function er(e) {
3939
+ function nr(e) {
3984
3940
  if (e.length < 2) return e;
3985
3941
  let t = [];
3986
3942
  for (let n of e) {
@@ -3993,46 +3949,43 @@ function er(e) {
3993
3949
  ${n.text}`
3994
3950
  };
3995
3951
  t[t.length - 1] = r;
3996
- continue;
3997
- }
3998
- t.push(n);
3952
+ } else t.push(n);
3999
3953
  }
4000
3954
  return t;
4001
3955
  }
4002
- var tr = () => N({
3956
+ var rr = () => N({
4003
3957
  modality: W().nullish(),
4004
3958
  tokens: B().nullish()
4005
- }).loose(), nr = () => N({
3959
+ }).loose(), ir = () => N({
4006
3960
  total_input_tokens: B().nullish(),
4007
3961
  total_output_tokens: B().nullish(),
4008
3962
  total_thought_tokens: B().nullish(),
4009
3963
  total_cached_tokens: B().nullish(),
4010
3964
  total_tool_use_tokens: B().nullish(),
4011
3965
  total_tokens: B().nullish(),
4012
- input_tokens_by_modality: c(tr()).nullish(),
4013
- output_tokens_by_modality: c(tr()).nullish(),
4014
- cached_tokens_by_modality: c(tr()).nullish(),
4015
- tool_use_tokens_by_modality: c(tr()).nullish(),
3966
+ input_tokens_by_modality: c(rr()).nullish(),
3967
+ output_tokens_by_modality: c(rr()).nullish(),
3968
+ cached_tokens_by_modality: c(rr()).nullish(),
3969
+ tool_use_tokens_by_modality: c(rr()).nullish(),
4016
3970
  grounding_tool_count: c(N({
4017
3971
  type: W().nullish(),
4018
3972
  count: B().nullish()
4019
3973
  }).loose()).nullish()
4020
- }).loose(), rr = () => D([
3974
+ }).loose(), ar = () => D([
4021
3975
  "in_progress",
4022
3976
  "requires_action",
4023
3977
  "completed",
4024
3978
  "failed",
4025
3979
  "cancelled",
4026
3980
  "incomplete"
4027
- ]), ir = () => I([
4028
- N({
3981
+ ]), or = () => {
3982
+ let e = N({
4029
3983
  type: q("url_citation"),
4030
3984
  url: W().nullish(),
4031
3985
  title: W().nullish(),
4032
3986
  start_index: B().nullish(),
4033
3987
  end_index: B().nullish()
4034
- }).loose(),
4035
- N({
3988
+ }).loose(), t = N({
4036
3989
  type: q("file_citation"),
4037
3990
  file_name: W().nullish(),
4038
3991
  document_uri: W().nullish(),
@@ -4042,28 +3995,31 @@ var tr = () => N({
4042
3995
  start_index: B().nullish(),
4043
3996
  end_index: B().nullish(),
4044
3997
  custom_metadata: K(W(), R()).nullish()
4045
- }).loose(),
4046
- N({
3998
+ }).loose(), n = N({
4047
3999
  type: q("place_citation"),
4048
4000
  name: W().nullish(),
4049
4001
  url: W().nullish(),
4050
4002
  place_id: W().nullish(),
4051
4003
  start_index: B().nullish(),
4052
4004
  end_index: B().nullish()
4053
- }).loose(),
4054
- N({ type: W() }).loose()
4055
- ]), ar = () => N({
4005
+ }).loose();
4006
+ return I([
4007
+ e,
4008
+ t,
4009
+ n,
4010
+ N({ type: W() }).loose()
4011
+ ]);
4012
+ }, sr = () => N({
4056
4013
  type: W(),
4057
4014
  text: W().nullish(),
4058
4015
  data: W().nullish(),
4059
4016
  mime_type: W().nullish()
4060
- }).loose(), or = () => I([
4061
- N({
4017
+ }).loose(), cr = () => {
4018
+ let e = N({
4062
4019
  type: q("text"),
4063
4020
  text: W(),
4064
- annotations: c(ir()).nullish()
4065
- }).loose(),
4066
- N({
4021
+ annotations: c(or()).nullish()
4022
+ }).loose(), t = N({
4067
4023
  type: q("image"),
4068
4024
  data: W().nullish(),
4069
4025
  mime_type: W().nullish(),
@@ -4074,92 +4030,99 @@ var tr = () => N({
4074
4030
  "ultra_high"
4075
4031
  ]).nullish(),
4076
4032
  uri: W().nullish()
4077
- }).loose(),
4078
- N({
4033
+ }).loose(), n = N({
4079
4034
  type: q("video"),
4080
4035
  data: W().nullish(),
4081
4036
  mime_type: W().nullish(),
4082
4037
  uri: W().nullish()
4083
- }).loose(),
4084
- N({ type: W() }).loose()
4085
- ]), sr = [
4038
+ }).loose();
4039
+ return I([
4040
+ e,
4041
+ t,
4042
+ n,
4043
+ N({ type: W() }).loose()
4044
+ ]);
4045
+ }, lr = [
4086
4046
  "google_search_call",
4087
4047
  "code_execution_call",
4088
4048
  "url_context_call",
4089
4049
  "file_search_call",
4090
4050
  "google_maps_call",
4091
4051
  "mcp_server_tool_call"
4092
- ], cr = [
4052
+ ], ur = [
4093
4053
  "google_search_result",
4094
4054
  "code_execution_result",
4095
4055
  "url_context_result",
4096
4056
  "file_search_result",
4097
4057
  "google_maps_result",
4098
4058
  "mcp_server_tool_result"
4099
- ], lr = () => I([
4100
- N({
4059
+ ], dr = () => {
4060
+ let e = N({
4101
4061
  type: q("user_input"),
4102
- content: c(or()).nullish()
4103
- }).loose(),
4104
- N({
4062
+ content: c(cr()).nullish()
4063
+ }).loose(), t = N({
4105
4064
  type: q("model_output"),
4106
- content: c(or()).nullish()
4107
- }).loose(),
4108
- N({
4065
+ content: c(cr()).nullish()
4066
+ }).loose(), n = N({
4109
4067
  type: q("function_call"),
4110
4068
  id: W(),
4111
4069
  name: W(),
4112
4070
  arguments: K(W(), R()).nullish(),
4113
4071
  signature: W().nullish()
4114
- }).loose(),
4115
- N({
4072
+ }).loose(), r = N({
4116
4073
  type: q("thought"),
4117
4074
  signature: W().nullish(),
4118
- summary: c(ar()).nullish()
4119
- }).loose(),
4120
- N({
4075
+ summary: c(sr()).nullish()
4076
+ }).loose(), i = N({
4121
4077
  type: q("processing_call"),
4122
4078
  id: W(),
4123
4079
  signature: W().nullish()
4124
- }).loose(),
4125
- N({
4080
+ }).loose(), a = N({
4126
4081
  type: q("processing_result"),
4127
4082
  call_id: W(),
4128
4083
  signature: W().nullish()
4129
- }).loose(),
4130
- N({
4131
- type: D(sr),
4084
+ }).loose(), o = N({
4085
+ type: D(lr),
4132
4086
  id: W(),
4133
4087
  arguments: K(W(), R()).nullish(),
4134
4088
  name: W().nullish(),
4135
4089
  server_name: W().nullish(),
4136
4090
  search_type: W().nullish(),
4137
4091
  signature: W().nullish()
4138
- }).loose(),
4139
- N({
4140
- type: D(cr),
4092
+ }).loose(), s = N({
4093
+ type: D(ur),
4141
4094
  call_id: W(),
4142
4095
  result: R().nullish(),
4143
4096
  is_error: k().nullish(),
4144
4097
  name: W().nullish(),
4145
4098
  server_name: W().nullish(),
4146
4099
  signature: W().nullish()
4147
- }).loose(),
4148
- N({ type: W() }).loose()
4149
- ]), ur = G(() => t(N({
4100
+ }).loose();
4101
+ return I([
4102
+ e,
4103
+ t,
4104
+ n,
4105
+ r,
4106
+ i,
4107
+ a,
4108
+ o,
4109
+ s,
4110
+ N({ type: W() }).loose()
4111
+ ]);
4112
+ }, fr = G(() => t(N({
4150
4113
  id: W().nullish(),
4151
4114
  created: W().nullish(),
4152
4115
  updated: W().nullish(),
4153
- status: rr(),
4116
+ status: ar(),
4154
4117
  model: W().nullish(),
4155
4118
  agent: W().nullish(),
4156
- steps: c(lr()).nullish(),
4157
- usage: nr().nullish(),
4119
+ steps: c(dr()).nullish(),
4120
+ usage: ir().nullish(),
4158
4121
  service_tier: W().nullish(),
4159
4122
  previous_interaction_id: W().nullish(),
4160
4123
  response_modalities: c(W()).nullish()
4161
- }).loose())), dr = G(() => t((() => {
4162
- let e = rr(), t = ir(), n = ar(), r = N({
4124
+ }).loose())), pr = G(() => t((() => {
4125
+ let e = ar(), t = or(), n = sr(), r = N({
4163
4126
  event_type: q("interaction.created"),
4164
4127
  event_id: W().nullish(),
4165
4128
  interaction: N({
@@ -4173,7 +4136,7 @@ var tr = () => N({
4173
4136
  event_type: q("step.start"),
4174
4137
  event_id: W().nullish(),
4175
4138
  index: B(),
4176
- step: lr()
4139
+ step: dr()
4177
4140
  }).loose(), a = N({
4178
4141
  type: q("text"),
4179
4142
  text: W()
@@ -4191,103 +4154,103 @@ var tr = () => N({
4191
4154
  }).loose(), u = N({
4192
4155
  type: D(["text_annotation_delta", "text_annotation"]),
4193
4156
  annotations: c(t).nullish()
4194
- }).loose(), d = I([
4157
+ }).loose(), d = N({
4158
+ type: q("image"),
4159
+ data: W().nullish(),
4160
+ mime_type: W().nullish(),
4161
+ resolution: D([
4162
+ "low",
4163
+ "medium",
4164
+ "high",
4165
+ "ultra_high"
4166
+ ]).nullish(),
4167
+ uri: W().nullish()
4168
+ }).loose(), f = N({
4169
+ type: q("video"),
4170
+ data: W().nullish(),
4171
+ mime_type: W().nullish(),
4172
+ uri: W().nullish()
4173
+ }).loose(), p = N({
4174
+ type: D(lr),
4175
+ id: W().nullish(),
4176
+ arguments: K(W(), R()).nullish(),
4177
+ name: W().nullish(),
4178
+ server_name: W().nullish(),
4179
+ search_type: W().nullish(),
4180
+ signature: W().nullish()
4181
+ }).loose(), m = N({
4182
+ type: D(ur),
4183
+ call_id: W().nullish(),
4184
+ result: R().nullish(),
4185
+ is_error: k().nullish(),
4186
+ name: W().nullish(),
4187
+ server_name: W().nullish(),
4188
+ signature: W().nullish()
4189
+ }).loose(), h = N({ type: W() }).loose(), g = I([
4195
4190
  a,
4196
- N({
4197
- type: q("image"),
4198
- data: W().nullish(),
4199
- mime_type: W().nullish(),
4200
- resolution: D([
4201
- "low",
4202
- "medium",
4203
- "high",
4204
- "ultra_high"
4205
- ]).nullish(),
4206
- uri: W().nullish()
4207
- }).loose(),
4208
- N({
4209
- type: q("video"),
4210
- data: W().nullish(),
4211
- mime_type: W().nullish(),
4212
- uri: W().nullish()
4213
- }).loose(),
4191
+ d,
4192
+ f,
4214
4193
  o,
4215
4194
  s,
4216
4195
  l,
4217
4196
  u,
4218
- N({
4219
- type: D(sr),
4197
+ p,
4198
+ m,
4199
+ h
4200
+ ]), _ = N({
4201
+ event_type: q("step.delta"),
4202
+ event_id: W().nullish(),
4203
+ index: B(),
4204
+ delta: g
4205
+ }).loose(), v = N({
4206
+ event_type: q("step.stop"),
4207
+ event_id: W().nullish(),
4208
+ index: B()
4209
+ }).loose(), y = N({
4210
+ event_type: q("interaction.status_update"),
4211
+ event_id: W().nullish(),
4212
+ interaction_id: W().nullish(),
4213
+ status: e.nullish()
4214
+ }).loose(), b = N({
4215
+ event_type: q("interaction.in_progress"),
4216
+ event_id: W().nullish(),
4217
+ interaction_id: W().nullish(),
4218
+ status: e.nullish()
4219
+ }).loose(), x = N({
4220
+ event_type: q("interaction.requires_action"),
4221
+ event_id: W().nullish(),
4222
+ interaction_id: W().nullish(),
4223
+ status: e.nullish()
4224
+ }).loose(), S = N({
4225
+ event_type: q("interaction.completed"),
4226
+ event_id: W().nullish(),
4227
+ interaction: N({
4220
4228
  id: W().nullish(),
4221
- arguments: K(W(), R()).nullish(),
4222
- name: W().nullish(),
4223
- server_name: W().nullish(),
4224
- search_type: W().nullish(),
4225
- signature: W().nullish()
4226
- }).loose(),
4227
- N({
4228
- type: D(cr),
4229
- call_id: W().nullish(),
4230
- result: R().nullish(),
4231
- is_error: k().nullish(),
4232
- name: W().nullish(),
4233
- server_name: W().nullish(),
4234
- signature: W().nullish()
4235
- }).loose(),
4236
- N({ type: W() }).loose()
4237
- ]);
4229
+ status: e.nullish(),
4230
+ usage: ir().nullish(),
4231
+ service_tier: W().nullish()
4232
+ }).loose()
4233
+ }).loose(), C = N({
4234
+ event_type: q("error"),
4235
+ event_id: W().nullish(),
4236
+ error: N({
4237
+ code: W().nullish(),
4238
+ message: W().nullish()
4239
+ }).loose().nullish()
4240
+ }).loose(), w = N({ event_type: W() }).loose();
4238
4241
  return I([
4239
4242
  r,
4240
4243
  i,
4241
- N({
4242
- event_type: q("step.delta"),
4243
- event_id: W().nullish(),
4244
- index: B(),
4245
- delta: d
4246
- }).loose(),
4247
- N({
4248
- event_type: q("step.stop"),
4249
- event_id: W().nullish(),
4250
- index: B()
4251
- }).loose(),
4252
- N({
4253
- event_type: q("interaction.status_update"),
4254
- event_id: W().nullish(),
4255
- interaction_id: W().nullish(),
4256
- status: e.nullish()
4257
- }).loose(),
4258
- N({
4259
- event_type: q("interaction.in_progress"),
4260
- event_id: W().nullish(),
4261
- interaction_id: W().nullish(),
4262
- status: e.nullish()
4263
- }).loose(),
4264
- N({
4265
- event_type: q("interaction.requires_action"),
4266
- event_id: W().nullish(),
4267
- interaction_id: W().nullish(),
4268
- status: e.nullish()
4269
- }).loose(),
4270
- N({
4271
- event_type: q("interaction.completed"),
4272
- event_id: W().nullish(),
4273
- interaction: N({
4274
- id: W().nullish(),
4275
- status: e.nullish(),
4276
- usage: nr().nullish(),
4277
- service_tier: W().nullish()
4278
- }).loose()
4279
- }).loose(),
4280
- N({
4281
- event_type: q("error"),
4282
- event_id: W().nullish(),
4283
- error: N({
4284
- code: W().nullish(),
4285
- message: W().nullish()
4286
- }).loose().nullish()
4287
- }).loose(),
4288
- N({ event_type: W() }).loose()
4244
+ _,
4245
+ v,
4246
+ y,
4247
+ b,
4248
+ x,
4249
+ S,
4250
+ C,
4251
+ w
4289
4252
  ]);
4290
- })())), fr = G(() => t(N({
4253
+ })())), mr = G(() => t(N({
4291
4254
  previousInteractionId: W().nullish(),
4292
4255
  store: k().nullish(),
4293
4256
  agent: W().nullish(),
@@ -4430,14 +4393,14 @@ function Q({ signature: e, interactionId: t, processingId: n, processingCallId:
4430
4393
  let i = {};
4431
4394
  return e != null && (i.signature = e), t != null && (i.interactionId = t), n != null && (i.processingId = n), r != null && (i.processingCallId = r), Object.keys(i).length > 0 ? { providerMetadata: { google: i } } : {};
4432
4395
  }
4433
- var pr = /* @__PURE__ */ new Set([
4396
+ var hr = /* @__PURE__ */ new Set([
4434
4397
  "google_search_call",
4435
4398
  "code_execution_call",
4436
4399
  "url_context_call",
4437
4400
  "file_search_call",
4438
4401
  "google_maps_call",
4439
4402
  "mcp_server_tool_call"
4440
- ]), mr = /* @__PURE__ */ new Set([
4403
+ ]), gr = /* @__PURE__ */ new Set([
4441
4404
  "google_search_result",
4442
4405
  "code_execution_result",
4443
4406
  "url_context_result",
@@ -4445,13 +4408,13 @@ var pr = /* @__PURE__ */ new Set([
4445
4408
  "google_maps_result",
4446
4409
  "mcp_server_tool_result"
4447
4410
  ]);
4448
- function hr(e) {
4411
+ function _r(e) {
4449
4412
  return e.replace(/_call$/, "");
4450
4413
  }
4451
- function gr(e) {
4414
+ function vr(e) {
4452
4415
  return e.replace(/_result$/, "");
4453
4416
  }
4454
- function _r({ steps: e, generateId: t, interactionId: n }) {
4417
+ function yr({ steps: e, generateId: t, interactionId: n }) {
4455
4418
  let r = [], i = !1;
4456
4419
  if (e == null) return {
4457
4420
  content: r,
@@ -4474,7 +4437,7 @@ function _r({ steps: e, generateId: t, interactionId: n }) {
4474
4437
  text: e,
4475
4438
  ...Q({ interactionId: n })
4476
4439
  });
4477
- let o = Bn({
4440
+ let o = Hn({
4478
4441
  annotations: a,
4479
4442
  generateId: t
4480
4443
  });
@@ -4574,31 +4537,29 @@ function _r({ steps: e, generateId: t, interactionId: n }) {
4574
4537
  });
4575
4538
  break;
4576
4539
  }
4577
- default:
4578
- if (pr.has(e)) {
4579
- let n = a, i = e === "mcp_server_tool_call" ? n.name ?? "mcp_server_tool" : hr(e), o = JSON.stringify(n.arguments ?? {});
4580
- r.push({
4581
- type: "tool-call",
4582
- toolCallId: n.id || t(),
4583
- toolName: i,
4584
- input: o,
4585
- providerExecuted: !0
4586
- });
4587
- } else if (mr.has(e)) {
4588
- let n = a, i = e === "mcp_server_tool_result" ? n.name ?? "mcp_server_tool" : gr(e);
4589
- r.push({
4590
- type: "tool-result",
4591
- toolCallId: n.call_id || t(),
4592
- toolName: i,
4593
- result: n.result ?? null
4594
- });
4595
- let o = zn({
4596
- block: a,
4597
- generateId: t
4598
- });
4599
- for (let e of o) r.push(e);
4600
- }
4601
- break;
4540
+ default: if (hr.has(e)) {
4541
+ let n = a, i = e === "mcp_server_tool_call" ? n.name ?? "mcp_server_tool" : _r(e), o = JSON.stringify(n.arguments ?? {});
4542
+ r.push({
4543
+ type: "tool-call",
4544
+ toolCallId: n.id || t(),
4545
+ toolName: i,
4546
+ input: o,
4547
+ providerExecuted: !0
4548
+ });
4549
+ } else if (gr.has(e)) {
4550
+ let n = a, i = e === "mcp_server_tool_result" ? n.name ?? "mcp_server_tool" : vr(e);
4551
+ r.push({
4552
+ type: "tool-result",
4553
+ toolCallId: n.call_id || t(),
4554
+ toolName: i,
4555
+ result: n.result ?? null
4556
+ });
4557
+ let o = Vn({
4558
+ block: a,
4559
+ generateId: t
4560
+ });
4561
+ for (let e of o) r.push(e);
4562
+ }
4602
4563
  }
4603
4564
  }
4604
4565
  return {
@@ -4606,8 +4567,8 @@ function _r({ steps: e, generateId: t, interactionId: n }) {
4606
4567
  hasFunctionCall: i
4607
4568
  };
4608
4569
  }
4609
- var vr = () => globalThis.fetch;
4610
- async function yr({ baseURL: e, interactionId: t, headers: n, fetch: r = vr() }) {
4570
+ var br = () => globalThis.fetch;
4571
+ async function xr({ baseURL: e, interactionId: t, headers: n, fetch: r = br() }) {
4611
4572
  if (t == null || t.length === 0) return;
4612
4573
  let i = `${e}/interactions/${encodeURIComponent(t)}/cancel`;
4613
4574
  try {
@@ -4621,19 +4582,19 @@ async function yr({ baseURL: e, interactionId: t, headers: n, fetch: r = vr() })
4621
4582
  } catch {}
4622
4583
  } catch {}
4623
4584
  }
4624
- var br = /* @__PURE__ */ new Set([
4585
+ var Sr = /* @__PURE__ */ new Set([
4625
4586
  "completed",
4626
4587
  "failed",
4627
4588
  "cancelled",
4628
4589
  "incomplete"
4629
4590
  ]);
4630
- function xr(e) {
4631
- return e != null && br.has(e);
4591
+ function Cr(e) {
4592
+ return e != null && Sr.has(e);
4632
4593
  }
4633
- var Sr = 1e3, Cr = 1e4, wr = 1800 * 1e3;
4634
- async function Tr({ baseURL: e, interactionId: t, headers: r, fetch: i, abortSignal: a, initialDelayMs: o = Sr, maxDelayMs: c = Cr, timeoutMs: l = wr }) {
4594
+ var wr = 1e3, Tr = 1e4, Er = 18e5;
4595
+ async function Dr({ baseURL: e, interactionId: t, headers: r, fetch: i, abortSignal: a, initialDelayMs: o = wr, maxDelayMs: c = Tr, timeoutMs: l = Er }) {
4635
4596
  if (t == null || t.length === 0) throw Error("google.interactions: cannot poll a background interaction without an id. The POST response did not include an interaction id.");
4636
- let u = Date.now(), d = o, f = `${e}/interactions/${encodeURIComponent(t)}`, p = () => yr({
4597
+ let u = Date.now(), d = o, f = `${e}/interactions/${encodeURIComponent(t)}`, p = () => xr({
4637
4598
  baseURL: e,
4638
4599
  interactionId: t,
4639
4600
  headers: r,
@@ -4649,11 +4610,11 @@ async function Tr({ baseURL: e, interactionId: t, headers: r, fetch: i, abortSig
4649
4610
  validateUrl: !1,
4650
4611
  headers: r,
4651
4612
  failedResponseHandler: Y,
4652
- successfulResponseHandler: n(ur),
4613
+ successfulResponseHandler: n(fr),
4653
4614
  abortSignal: a,
4654
4615
  fetch: i
4655
4616
  });
4656
- if (xr(e.status)) return {
4617
+ if (Cr(e.status)) return {
4657
4618
  response: e,
4658
4619
  rawResponse: o,
4659
4620
  responseHeaders: s
@@ -4664,7 +4625,7 @@ async function Tr({ baseURL: e, interactionId: t, headers: r, fetch: i, abortSig
4664
4625
  throw s(e) && await p(), e;
4665
4626
  }
4666
4627
  }
4667
- function Er({ tools: e, toolChoice: t }) {
4628
+ function Or({ tools: e, toolChoice: t }) {
4668
4629
  let n = [], r = e?.length ? e : void 0;
4669
4630
  if (r == null) return {
4670
4631
  tools: void 0,
@@ -4672,94 +4633,85 @@ function Er({ tools: e, toolChoice: t }) {
4672
4633
  toolWarnings: n
4673
4634
  };
4674
4635
  let i = [];
4675
- for (let e of r) {
4676
- if (e.type === "function") {
4677
- i.push({
4678
- type: "function",
4679
- name: e.name,
4680
- description: e.description ?? "",
4681
- parameters: e.inputSchema
4682
- });
4683
- continue;
4684
- }
4685
- if (e.type === "provider") {
4686
- let t = e.args ?? {};
4687
- switch (e.id) {
4688
- case "google.google_search": {
4689
- let e = t.searchTypes, n;
4690
- if (typeof e == "object" && e) {
4691
- let t = [];
4692
- e.webSearch != null && t.push("web_search"), e.imageSearch != null && t.push("image_search"), t.length > 0 && (n = t);
4693
- }
4694
- i.push({
4695
- type: "google_search",
4696
- ...n == null ? {} : { search_types: n }
4697
- });
4698
- break;
4699
- }
4700
- case "google.code_execution":
4701
- i.push({ type: "code_execution" });
4702
- break;
4703
- case "google.url_context":
4704
- i.push({ type: "url_context" });
4705
- break;
4706
- case "google.file_search":
4707
- i.push({
4708
- type: "file_search",
4709
- ...t.fileSearchStoreNames == null ? {} : { file_search_store_names: t.fileSearchStoreNames },
4710
- ...t.topK == null ? {} : { top_k: t.topK },
4711
- ...t.metadataFilter == null ? {} : { metadata_filter: t.metadataFilter }
4712
- });
4713
- break;
4714
- case "google.google_maps":
4715
- i.push({
4716
- type: "google_maps",
4717
- ...t.latitude == null ? {} : { latitude: t.latitude },
4718
- ...t.longitude == null ? {} : { longitude: t.longitude },
4719
- ...t.enableWidget == null ? {} : { enable_widget: t.enableWidget }
4720
- });
4721
- break;
4722
- case "google.computer_use":
4723
- i.push({
4724
- type: "computer_use",
4725
- environment: t.environment ?? "browser",
4726
- ...t.excludedPredefinedFunctions == null ? {} : { excludedPredefinedFunctions: t.excludedPredefinedFunctions }
4727
- });
4728
- break;
4729
- case "google.mcp_server":
4730
- i.push({
4731
- type: "mcp_server",
4732
- ...t.name == null ? {} : { name: t.name },
4733
- ...t.url == null ? {} : { url: t.url },
4734
- ...t.headers == null ? {} : { headers: t.headers },
4735
- ...t.allowedTools == null ? {} : { allowed_tools: t.allowedTools }
4736
- });
4737
- break;
4738
- case "google.retrieval": {
4739
- let e = t.vertexAiSearchConfig ?? void 0;
4740
- i.push({
4741
- type: "retrieval",
4742
- ...t.retrievalTypes == null ? { retrieval_types: ["vertex_ai_search"] } : { retrieval_types: t.retrievalTypes },
4743
- ...e == null ? {} : { vertex_ai_search_config: e }
4744
- });
4745
- break;
4636
+ for (let e of r) if (e.type === "function") i.push({
4637
+ type: "function",
4638
+ name: e.name,
4639
+ description: e.description ?? "",
4640
+ parameters: e.inputSchema
4641
+ });
4642
+ else if (e.type === "provider") {
4643
+ let t = e.args ?? {};
4644
+ switch (e.id) {
4645
+ case "google.google_search": {
4646
+ let e = t.searchTypes, n;
4647
+ if (typeof e == "object" && e) {
4648
+ let t = [];
4649
+ e.webSearch != null && t.push("web_search"), e.imageSearch != null && t.push("image_search"), t.length > 0 && (n = t);
4746
4650
  }
4747
- default:
4748
- n.push({
4749
- type: "unsupported",
4750
- feature: `provider-defined tool ${e.id}`,
4751
- details: `provider-defined tool ${e.id} is not supported by google.interactions; tool dropped.`
4752
- });
4753
- break;
4651
+ i.push({
4652
+ type: "google_search",
4653
+ ...n == null ? {} : { search_types: n }
4654
+ });
4655
+ break;
4754
4656
  }
4755
- continue;
4657
+ case "google.code_execution":
4658
+ i.push({ type: "code_execution" });
4659
+ break;
4660
+ case "google.url_context":
4661
+ i.push({ type: "url_context" });
4662
+ break;
4663
+ case "google.file_search":
4664
+ i.push({
4665
+ type: "file_search",
4666
+ ...t.fileSearchStoreNames == null ? {} : { file_search_store_names: t.fileSearchStoreNames },
4667
+ ...t.topK == null ? {} : { top_k: t.topK },
4668
+ ...t.metadataFilter == null ? {} : { metadata_filter: t.metadataFilter }
4669
+ });
4670
+ break;
4671
+ case "google.google_maps":
4672
+ i.push({
4673
+ type: "google_maps",
4674
+ ...t.latitude == null ? {} : { latitude: t.latitude },
4675
+ ...t.longitude == null ? {} : { longitude: t.longitude },
4676
+ ...t.enableWidget == null ? {} : { enable_widget: t.enableWidget }
4677
+ });
4678
+ break;
4679
+ case "google.computer_use":
4680
+ i.push({
4681
+ type: "computer_use",
4682
+ environment: t.environment ?? "browser",
4683
+ ...t.excludedPredefinedFunctions == null ? {} : { excludedPredefinedFunctions: t.excludedPredefinedFunctions }
4684
+ });
4685
+ break;
4686
+ case "google.mcp_server":
4687
+ i.push({
4688
+ type: "mcp_server",
4689
+ ...t.name == null ? {} : { name: t.name },
4690
+ ...t.url == null ? {} : { url: t.url },
4691
+ ...t.headers == null ? {} : { headers: t.headers },
4692
+ ...t.allowedTools == null ? {} : { allowed_tools: t.allowedTools }
4693
+ });
4694
+ break;
4695
+ case "google.retrieval": {
4696
+ let e = t.vertexAiSearchConfig ?? void 0;
4697
+ i.push({
4698
+ type: "retrieval",
4699
+ ...t.retrievalTypes == null ? { retrieval_types: ["vertex_ai_search"] } : { retrieval_types: t.retrievalTypes },
4700
+ ...e == null ? {} : { vertex_ai_search_config: e }
4701
+ });
4702
+ break;
4703
+ }
4704
+ default: n.push({
4705
+ type: "unsupported",
4706
+ feature: `provider-defined tool ${e.id}`,
4707
+ details: `provider-defined tool ${e.id} is not supported by google.interactions; tool dropped.`
4708
+ });
4756
4709
  }
4757
- n.push({
4758
- type: "unsupported",
4759
- feature: `tool of type ${e.type}`,
4760
- details: "Only function tools and google.* provider-defined tools are supported by google.interactions; tool dropped."
4761
- });
4762
- }
4710
+ } else n.push({
4711
+ type: "unsupported",
4712
+ feature: `tool of type ${e.type}`,
4713
+ details: "Only function tools and google.* provider-defined tools are supported by google.interactions; tool dropped."
4714
+ });
4763
4715
  let a = i.some((e) => e.type === "function"), o;
4764
4716
  if (t != null && a) switch (t.type) {
4765
4717
  case "auto":
@@ -4771,12 +4723,10 @@ function Er({ tools: e, toolChoice: t }) {
4771
4723
  case "none":
4772
4724
  o = "none";
4773
4725
  break;
4774
- case "tool":
4775
- o = { allowed_tools: {
4776
- mode: "validated",
4777
- tools: [t.toolName]
4778
- } };
4779
- break;
4726
+ case "tool": o = { allowed_tools: {
4727
+ mode: "validated",
4728
+ tools: [t.toolName]
4729
+ } };
4780
4730
  }
4781
4731
  return {
4782
4732
  tools: i.length > 0 ? i : void 0,
@@ -4784,8 +4734,8 @@ function Er({ tools: e, toolChoice: t }) {
4784
4734
  toolWarnings: n
4785
4735
  };
4786
4736
  }
4787
- var Dr = 3, Or = 500;
4788
- function kr({ baseURL: e, interactionId: t, headers: n, fetch: r, abortSignal: i, maxRetries: a = Dr, retryDelayMs: o = Or }) {
4737
+ var kr = 3, Ar = 500;
4738
+ function jr({ baseURL: e, interactionId: t, headers: n, fetch: r, abortSignal: i, maxRetries: a = kr, retryDelayMs: o = Ar }) {
4789
4739
  if (t.length === 0) throw Error("google.interactions: cannot stream a background interaction without an id.");
4790
4740
  let c = {
4791
4741
  ...n,
@@ -4803,7 +4753,7 @@ function kr({ baseURL: e, interactionId: t, headers: n, fetch: r, abortSignal: i
4803
4753
  validateUrl: !1,
4804
4754
  headers: c,
4805
4755
  failedResponseHandler: Y,
4806
- successfulResponseHandler: y(dr),
4756
+ successfulResponseHandler: y(pr),
4807
4757
  abortSignal: _,
4808
4758
  fetch: r
4809
4759
  });
@@ -4816,11 +4766,7 @@ function kr({ baseURL: e, interactionId: t, headers: n, fetch: r, abortSignal: i
4816
4766
  if (p == null) try {
4817
4767
  p = await b(), f = !1;
4818
4768
  } catch (e) {
4819
- if (s(e) || _.aborted) {
4820
- c.error(e);
4821
- return;
4822
- }
4823
- if (d++, d >= a) {
4769
+ if (s(e) || _.aborted || (d++, d >= a)) {
4824
4770
  c.error(e);
4825
4771
  return;
4826
4772
  }
@@ -4847,11 +4793,7 @@ function kr({ baseURL: e, interactionId: t, headers: n, fetch: r, abortSignal: i
4847
4793
  }
4848
4794
  c.enqueue(t);
4849
4795
  } catch (e) {
4850
- if (s(e) || _.aborted) {
4851
- c.error(e);
4852
- return;
4853
- }
4854
- if (p = void 0, d++, d >= a) {
4796
+ if (s(e) || _.aborted || (p = void 0, d++, d >= a)) {
4855
4797
  c.error(e);
4856
4798
  return;
4857
4799
  }
@@ -4862,7 +4804,7 @@ function kr({ baseURL: e, interactionId: t, headers: n, fetch: r, abortSignal: i
4862
4804
  } catch (e) {
4863
4805
  c.error(e);
4864
4806
  } finally {
4865
- i?.removeEventListener("abort", h), p?.cancel().catch(() => {}), p = void 0, _.aborted && !u && await yr({
4807
+ i?.removeEventListener("abort", h), p?.cancel().catch(() => {}), p = void 0, _.aborted && !u && await xr({
4866
4808
  baseURL: e,
4867
4809
  interactionId: t,
4868
4810
  headers: n,
@@ -4875,7 +4817,7 @@ function kr({ baseURL: e, interactionId: t, headers: n, fetch: r, abortSignal: i
4875
4817
  }
4876
4818
  });
4877
4819
  }
4878
- function Ar({ response: e, warnings: t, generateId: n, includeRawChunks: r, headerServiceTier: i }) {
4820
+ function Mr({ response: e, warnings: t, generateId: n, includeRawChunks: r, headerServiceTier: i }) {
4879
4821
  return new ReadableStream({ start(a) {
4880
4822
  a.enqueue({
4881
4823
  type: "stream-start",
@@ -4895,7 +4837,7 @@ function Ar({ response: e, warnings: t, generateId: n, includeRawChunks: r, head
4895
4837
  type: "raw",
4896
4838
  rawValue: e
4897
4839
  });
4898
- let { content: l, hasFunctionCall: u } = _r({
4840
+ let { content: l, hasFunctionCall: u } = yr({
4899
4841
  steps: e.steps ?? null,
4900
4842
  generateId: n,
4901
4843
  interactionId: o
@@ -4966,13 +4908,10 @@ function Ar({ response: e, warnings: t, generateId: n, includeRawChunks: r, head
4966
4908
  });
4967
4909
  break;
4968
4910
  case "source":
4969
- case "file":
4970
- a.enqueue(e);
4971
- break;
4972
- default: break;
4911
+ case "file": a.enqueue(e);
4973
4912
  }
4974
4913
  let p = e.service_tier ?? i, m = {
4975
- unified: Vn({
4914
+ unified: Un({
4976
4915
  status: e.status,
4977
4916
  hasFunctionCall: u
4978
4917
  }),
@@ -4984,12 +4923,12 @@ function Ar({ response: e, warnings: t, generateId: n, includeRawChunks: r, head
4984
4923
  a.enqueue({
4985
4924
  type: "finish",
4986
4925
  finishReason: m,
4987
- usage: Nn(e.usage),
4926
+ usage: Fn(e.usage),
4988
4927
  providerMetadata: h
4989
4928
  }), a.close();
4990
4929
  } });
4991
4930
  }
4992
- var jr = class e {
4931
+ var Nr = class e {
4993
4932
  constructor(e, t) {
4994
4933
  this.specificationVersion = "v4", typeof e == "string" ? (this.modelId = e, this.agent = void 0) : "managedAgent" in e ? (this.modelId = e.managedAgent, this.agent = e.managedAgent) : (this.modelId = e.agent, this.agent = e.agent), this.config = t;
4995
4934
  }
@@ -5024,7 +4963,7 @@ var jr = class e {
5024
4963
  let t = [], n = await j({
5025
4964
  provider: "google",
5026
4965
  providerOptions: e.providerOptions,
5027
- schema: fr
4966
+ schema: mr
5028
4967
  }), r = this.agent != null;
5029
4968
  r || (e.frequencyPenalty != null && t.push({
5030
4969
  type: "unsupported",
@@ -5035,24 +4974,26 @@ var jr = class e {
5035
4974
  }));
5036
4975
  let i = e.tools != null && e.tools.length > 0, a, o;
5037
4976
  if (i) {
5038
- let n = Er({
4977
+ let n = Or({
5039
4978
  tools: e.tools,
5040
4979
  toolChoice: e.toolChoice
5041
4980
  });
5042
4981
  a = n.tools, o = n.toolChoice, t.push(...n.toolWarnings);
5043
4982
  }
5044
4983
  let s = [];
5045
- if (e.responseFormat?.type === "json") if (r) t.push({
5046
- type: "other",
5047
- message: "google.interactions: structured output (responseFormat) is not supported when an agent is set; responseFormat will be ignored."
5048
- });
5049
- else {
5050
- let t = {
5051
- type: "text",
5052
- mime_type: "application/json",
5053
- ...e.responseFormat.schema == null ? {} : { schema: e.responseFormat.schema }
5054
- };
5055
- s.push(t);
4984
+ if (e.responseFormat?.type === "json") {
4985
+ if (r) t.push({
4986
+ type: "other",
4987
+ message: "google.interactions: structured output (responseFormat) is not supported when an agent is set; responseFormat will be ignored."
4988
+ });
4989
+ else {
4990
+ let t = {
4991
+ type: "text",
4992
+ mime_type: "application/json",
4993
+ ...e.responseFormat.schema == null ? {} : { schema: e.responseFormat.schema }
4994
+ };
4995
+ s.push(t);
4996
+ }
5056
4997
  }
5057
4998
  if (n?.responseFormat != null) for (let e of n.responseFormat) e.type === "text" ? s.push($({
5058
4999
  type: "text",
@@ -5074,7 +5015,7 @@ var jr = class e {
5074
5015
  delivery: e.delivery ?? void 0,
5075
5016
  gcs_uri: e.gcsUri ?? void 0
5076
5017
  }));
5077
- let { input: c, systemInstruction: l, warnings: u } = qn({
5018
+ let { input: c, systemInstruction: l, warnings: u } = Yn({
5078
5019
  prompt: e.prompt,
5079
5020
  previousInteractionId: n?.previousInteractionId ?? void 0,
5080
5021
  store: n?.store ?? void 0,
@@ -5126,29 +5067,31 @@ var jr = class e {
5126
5067
  }) : e.type === "dynamic" && (m = { type: "dynamic" });
5127
5068
  }
5128
5069
  let h;
5129
- if (n?.environment != null) if (!r) t.push({
5130
- type: "other",
5131
- message: "google.interactions: environment is only supported when an agent is set; environment will be omitted from the request body."
5132
- });
5133
- else if (typeof n.environment == "string") h = n.environment;
5134
- else {
5135
- let e = n.environment, t = e.sources?.map((e) => e.type === "inline" ? {
5136
- type: "inline",
5137
- content: e.content,
5138
- target: e.target
5139
- } : $({
5140
- type: e.type,
5141
- source: e.source,
5142
- target: e.target ?? void 0
5143
- })), r;
5144
- e.network === "disabled" ? r = "disabled" : e.network != null && (r = { allowlist: e.network.allowlist.map((e) => $({
5145
- domain: e.domain,
5146
- transform: e.transform ?? void 0
5147
- })) }), h = $({
5148
- type: "remote",
5149
- sources: t != null && t.length > 0 ? t : void 0,
5150
- network: r
5070
+ if (n?.environment != null) {
5071
+ if (!r) t.push({
5072
+ type: "other",
5073
+ message: "google.interactions: environment is only supported when an agent is set; environment will be omitted from the request body."
5151
5074
  });
5075
+ else if (typeof n.environment == "string") h = n.environment;
5076
+ else {
5077
+ let e = n.environment, t = e.sources?.map((e) => e.type === "inline" ? {
5078
+ type: "inline",
5079
+ content: e.content,
5080
+ target: e.target
5081
+ } : $({
5082
+ type: e.type,
5083
+ source: e.source,
5084
+ target: e.target ?? void 0
5085
+ })), r;
5086
+ e.network === "disabled" ? r = "disabled" : e.network != null && (r = { allowlist: e.network.allowlist.map((e) => $({
5087
+ domain: e.domain,
5088
+ transform: e.transform ?? void 0
5089
+ })) }), h = $({
5090
+ type: "remote",
5091
+ sources: t != null && t.length > 0 ? t : void 0,
5092
+ network: r
5093
+ });
5094
+ }
5152
5095
  }
5153
5096
  return {
5154
5097
  args: $({
@@ -5178,12 +5121,12 @@ var jr = class e {
5178
5121
  headers: c,
5179
5122
  body: t,
5180
5123
  failedResponseHandler: Y,
5181
- successfulResponseHandler: n(ur),
5124
+ successfulResponseHandler: n(fr),
5182
5125
  abortSignal: e.abortSignal,
5183
5126
  fetch: this.config.fetch
5184
5127
  });
5185
- if (a && !xr(u.status)) {
5186
- let t = await Tr({
5128
+ if (a && !Cr(u.status)) {
5129
+ let t = await Dr({
5187
5130
  baseURL: this.config.baseURL,
5188
5131
  interactionId: u.id,
5189
5132
  headers: c,
@@ -5193,17 +5136,17 @@ var jr = class e {
5193
5136
  });
5194
5137
  u = t.response, d = t.rawResponse, l = t.responseHeaders ?? l;
5195
5138
  }
5196
- let f = typeof u.id == "string" && u.id.length > 0 ? u.id : void 0, { content: p, hasFunctionCall: m } = _r({
5139
+ let f = typeof u.id == "string" && u.id.length > 0 ? u.id : void 0, { content: p, hasFunctionCall: m } = yr({
5197
5140
  steps: u.steps ?? null,
5198
5141
  generateId: this.config.generateId ?? i,
5199
5142
  interactionId: f
5200
5143
  }), h = {
5201
- unified: Vn({
5144
+ unified: Un({
5202
5145
  status: u.status,
5203
5146
  hasFunctionCall: m
5204
5147
  }),
5205
5148
  raw: u.status
5206
- }, g = u.service_tier ?? l?.["x-gemini-service-tier"] ?? void 0, _ = Pn(u.usage), v = { google: {
5149
+ }, g = u.service_tier ?? l?.["x-gemini-service-tier"] ?? void 0, _ = In(u.usage), v = { google: {
5207
5150
  ...f == null ? {} : { interactionId: f },
5208
5151
  ...g == null ? {} : { serviceTier: g },
5209
5152
  ..._ == null ? {} : { outputTokensByModality: _ }
@@ -5215,7 +5158,7 @@ var jr = class e {
5215
5158
  return {
5216
5159
  content: p,
5217
5160
  finishReason: h,
5218
- usage: Nn(u.usage),
5161
+ usage: Fn(u.usage),
5219
5162
  warnings: r,
5220
5163
  providerMetadata: v,
5221
5164
  request: { body: t },
@@ -5246,10 +5189,10 @@ var jr = class e {
5246
5189
  headers: s,
5247
5190
  body: c,
5248
5191
  failedResponseHandler: Y,
5249
- successfulResponseHandler: y(dr),
5192
+ successfulResponseHandler: y(pr),
5250
5193
  abortSignal: e.abortSignal,
5251
5194
  fetch: this.config.fetch
5252
- }), d = l?.["x-gemini-service-tier"], f = Kn({
5195
+ }), d = l?.["x-gemini-service-tier"], f = Jn({
5253
5196
  warnings: n,
5254
5197
  generateId: this.config.generateId ?? i,
5255
5198
  includeRawChunks: e.includeRawChunks,
@@ -5267,14 +5210,14 @@ var jr = class e {
5267
5210
  headers: a,
5268
5211
  body: e,
5269
5212
  failedResponseHandler: Y,
5270
- successfulResponseHandler: n(ur),
5213
+ successfulResponseHandler: n(fr),
5271
5214
  abortSignal: o.abortSignal,
5272
5215
  fetch: this.config.fetch
5273
5216
  }), u = l.id;
5274
5217
  if (u == null || u.length === 0) throw Error("google.interactions: background POST response did not include an interaction id; cannot stream the result.");
5275
5218
  let d = c?.["x-gemini-service-tier"];
5276
- if (xr(l.status)) return {
5277
- stream: Ar({
5219
+ if (Cr(l.status)) return {
5220
+ stream: Mr({
5278
5221
  response: l,
5279
5222
  warnings: t,
5280
5223
  generateId: this.config.generateId ?? i,
@@ -5284,13 +5227,13 @@ var jr = class e {
5284
5227
  request: { body: e },
5285
5228
  response: { headers: c }
5286
5229
  };
5287
- let f = kr({
5230
+ let f = jr({
5288
5231
  baseURL: this.config.baseURL,
5289
5232
  interactionId: u,
5290
5233
  headers: a,
5291
5234
  fetch: this.config.fetch,
5292
5235
  abortSignal: o.abortSignal
5293
- }), p = Kn({
5236
+ }), p = Jn({
5294
5237
  warnings: t,
5295
5238
  generateId: this.config.generateId ?? i,
5296
5239
  includeRawChunks: o.includeRawChunks,
@@ -5308,15 +5251,15 @@ function $(e) {
5308
5251
  for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
5309
5252
  return t;
5310
5253
  }
5311
- function Mr(e) {
5254
+ function Pr(e) {
5312
5255
  let t = new URL(e), n = t.pathname.split("/"), r = n.at(-1);
5313
5256
  return (r === "v1beta" || r === "v1alpha") && (n.pop(), t.pathname = n.join("/") || "/"), t;
5314
5257
  }
5315
- function Nr(e, t) {
5316
- let n = Mr(e);
5258
+ function Fr(e, t) {
5259
+ let n = Pr(e);
5317
5260
  return n.protocol = n.protocol === "https:" ? "wss:" : "ws:", n.pathname = `${n.pathname.replace(/\/$/, "")}/ws/${t}`, n;
5318
5261
  }
5319
- var Pr = class {
5262
+ var Ir = class {
5320
5263
  constructor() {
5321
5264
  this.turnCounter = 0, this.inputTranscriptionCounter = 0, this.inputTranscriptionBuffer = "", this.inputTranscriptionBoundary = "none", this.preserveInputTranscriptionAcrossTurnComplete = !1, this.hasAudio = !1, this.hasText = !1, this.hasTranscript = !1, this.turnClosed = !1, this.inputAudioRate = 16e3;
5322
5265
  }
@@ -5475,7 +5418,7 @@ var Pr = class {
5475
5418
  }
5476
5419
  serializeClientEvent(e, t) {
5477
5420
  switch (e.type) {
5478
- case "session-update": return e.config.inputAudioFormat?.rate != null && (this.inputAudioRate = e.config.inputAudioFormat.rate), { setup: Rr(e.config, t) };
5421
+ case "session-update": return e.config.inputAudioFormat?.rate != null && (this.inputAudioRate = e.config.inputAudioFormat.rate), { setup: Br(e.config, t) };
5479
5422
  case "input-audio-append": return { realtimeInput: { audio: {
5480
5423
  data: e.audio,
5481
5424
  mimeType: `audio/pcm;rate=${this.inputAudioRate}`
@@ -5489,7 +5432,7 @@ var Pr = class {
5489
5432
  let t = e.item;
5490
5433
  switch (t.type) {
5491
5434
  case "text-message": return { realtimeInput: { text: t.text } };
5492
- case "function-call-output": return Ir(t);
5435
+ case "function-call-output": return Rr(t);
5493
5436
  case "audio-message": return null;
5494
5437
  }
5495
5438
  break;
@@ -5498,59 +5441,61 @@ var Pr = class {
5498
5441
  return null;
5499
5442
  }
5500
5443
  };
5501
- function Fr(e) {
5444
+ function Lr(e) {
5502
5445
  return typeof e == "object" && e && !Array.isArray(e) ? e : { output: e };
5503
5446
  }
5504
- async function Ir(e) {
5505
- let t = await h({ text: e.output }), n = t.success ? Fr(t.value) : { output: e.output };
5447
+ async function Rr(e) {
5448
+ let t = await h({ text: e.output }), n = t.success ? Lr(t.value) : { output: e.output };
5506
5449
  return { toolResponse: { functionResponses: [{
5507
5450
  id: e.callId,
5508
5451
  name: e.name,
5509
5452
  response: n
5510
5453
  }] } };
5511
5454
  }
5512
- function Lr(e) {
5455
+ function zr(e) {
5513
5456
  let t = e.split("/").at(-1)?.toLowerCase() ?? "";
5514
5457
  return /^gemini-\d+\.\d+-live\b.*thinking/.test(t);
5515
5458
  }
5516
- function Rr(e, t) {
5459
+ function Br(e, t) {
5517
5460
  let n = { model: X(t) }, { google: r, ...i } = e?.providerOptions ?? {}, a = ce(r) ? r : void 0, o = {};
5518
- e?.outputModalities == null ? o.responseModalities = ["AUDIO"] : o.responseModalities = e.outputModalities.map((e) => e.toUpperCase()), e?.voice != null && (o.speechConfig = { voiceConfig: { prebuiltVoiceConfig: { voiceName: e.voice } } }), n.generationConfig = o, e?.instructions != null && (n.systemInstruction = { parts: [{ text: e.instructions }] }), e?.tools != null && e.tools.length > 0 && (n.tools = [{ functionDeclarations: e.tools.map((e) => ({
5461
+ o.responseModalities = e?.outputModalities == null ? ["AUDIO"] : e.outputModalities.map((e) => e.toUpperCase()), e?.voice != null && (o.speechConfig = { voiceConfig: { prebuiltVoiceConfig: { voiceName: e.voice } } }), n.generationConfig = o, e?.instructions != null && (n.systemInstruction = { parts: [{ text: e.instructions }] }), e?.tools != null && e.tools.length > 0 && (n.tools = [{ functionDeclarations: e.tools.map((e) => ({
5519
5462
  name: e.name,
5520
5463
  description: e.description,
5521
5464
  parametersJsonSchema: e.parameters,
5522
5465
  ...a?.defaultToolBehavior == null ? {} : { behavior: a.defaultToolBehavior }
5523
5466
  })) }]), e?.inputAudioTranscription != null && (n.inputAudioTranscription = {}), e?.outputAudioTranscription != null && (n.outputAudioTranscription = {});
5524
- let s = i.generationConfig, c = a?.thinkingConfig ?? (ce(s) && ce(s.thinkingConfig) ? s.thinkingConfig : void 0), l = Lr(t) && c?.thinkingLevel == null && c?.thinkingBudget == null ? {
5467
+ let s = i.generationConfig, c = a?.thinkingConfig ?? (ce(s) && ce(s.thinkingConfig) ? s.thinkingConfig : void 0), l = zr(t) && c?.thinkingLevel == null && c?.thinkingBudget == null ? {
5525
5468
  ...c,
5526
5469
  thinkingLevel: "low"
5527
5470
  } : a?.thinkingConfig, u = () => {
5528
- l != null && (n.generationConfig = {
5529
- ...ce(n.generationConfig) ? n.generationConfig : o,
5471
+ if (l == null) return;
5472
+ let e = ce(n.generationConfig) ? n.generationConfig : o;
5473
+ n.generationConfig = {
5474
+ ...e,
5530
5475
  thinkingConfig: l
5531
- });
5476
+ };
5532
5477
  };
5533
5478
  return e?.providerOptions == null ? (u(), n) : (Object.assign(n, i), a?.translationConfig != null && (n.generationConfig = {
5534
5479
  ...ce(n.generationConfig) ? n.generationConfig : o,
5535
5480
  translationConfig: a.translationConfig
5536
5481
  }), u(), n);
5537
5482
  }
5538
- var zr = "google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained";
5539
- function Br(e) {
5540
- let t = Mr(e);
5483
+ var Vr = "google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained";
5484
+ function Hr(e) {
5485
+ let t = Pr(e);
5541
5486
  return t.pathname = `${t.pathname.replace(/\/$/, "")}/v1alpha/auth_tokens`, t.toString();
5542
5487
  }
5543
- function Vr(e) {
5544
- return Nr(e, zr).toString();
5488
+ function Ur(e) {
5489
+ return Fr(e, Vr).toString();
5545
5490
  }
5546
- var Hr = class {
5491
+ var Wr = class {
5547
5492
  constructor(e, t) {
5548
- this.specificationVersion = "v4", this.mapper = new Pr(), this.modelId = e, this.provider = t.provider, this.config = t;
5493
+ this.specificationVersion = "v4", this.mapper = new Ir(), this.modelId = e, this.provider = t.provider, this.config = t;
5549
5494
  }
5550
5495
  async doCreateClientSecret(e) {
5551
5496
  let t = this.config.fetch ?? fetch, n = this.config.headers()["x-goog-api-key"];
5552
5497
  if (!n) throw Error("Google Generative AI API key is required for realtime token creation.");
5553
- let r = Date.now(), i = (e.expiresAfterSeconds ?? 60) * 1e3, a = new Date(r + i).toISOString(), o = new Date(r + i + 1800 * 1e3).toISOString(), s = Rr(e.sessionConfig, this.modelId), c = await t(`${Br(this.config.baseURL)}?key=${encodeURIComponent(n)}`, {
5498
+ let r = Date.now(), i = (e.expiresAfterSeconds ?? 60) * 1e3, a = new Date(r + i).toISOString(), o = new Date(r + i + 18e5).toISOString(), s = Br(e.sessionConfig, this.modelId), c = await t(`${Hr(this.config.baseURL)}?key=${encodeURIComponent(n)}`, {
5554
5499
  method: "POST",
5555
5500
  headers: { "Content-Type": "application/json" },
5556
5501
  body: JSON.stringify({
@@ -5567,7 +5512,7 @@ var Hr = class {
5567
5512
  let l = await c.json();
5568
5513
  return {
5569
5514
  token: l.name,
5570
- url: Vr(this.config.baseURL),
5515
+ url: Ur(this.config.baseURL),
5571
5516
  expiresAt: l.expireTime ? Math.floor(new Date(l.expireTime).getTime() / 1e3) : void 0
5572
5517
  };
5573
5518
  }
@@ -5581,23 +5526,23 @@ var Hr = class {
5581
5526
  return this.mapper.serializeClientEvent(e, this.modelId);
5582
5527
  }
5583
5528
  buildSessionConfig(e) {
5584
- return Rr(e, this.modelId);
5529
+ return Br(e, this.modelId);
5585
5530
  }
5586
- }, Ur = N({
5531
+ }, Gr = N({
5587
5532
  languageCodes: c(W()).optional(),
5588
5533
  customVocabulary: c(W()).optional(),
5589
5534
  wordTimestamp: k().optional(),
5590
5535
  diarization: k().optional(),
5591
5536
  mode: D(["SMART", "VERBATIM"]).optional()
5592
- }), Wr = "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent", Gr = 3e3;
5593
- function Kr(e, t) {
5594
- let n = Nr(e, Wr);
5537
+ }), Kr = "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent", qr = 3e3;
5538
+ function Jr(e, t) {
5539
+ let n = Fr(e, Kr);
5595
5540
  return n.searchParams.set("key", t), n;
5596
5541
  }
5597
- function qr(e) {
5542
+ function Yr(e) {
5598
5543
  return e.includes("-live");
5599
5544
  }
5600
- var Jr = class e {
5545
+ var Xr = class e {
5601
5546
  constructor(e, t) {
5602
5547
  this.modelId = e, this.config = t, this.specificationVersion = "v4";
5603
5548
  }
@@ -5617,15 +5562,15 @@ var Jr = class e {
5617
5562
  return j({
5618
5563
  provider: "google",
5619
5564
  providerOptions: e,
5620
- schema: Ur
5565
+ schema: Gr
5621
5566
  });
5622
5567
  }
5623
5568
  async doGenerate(e) {
5624
- if (qr(this.modelId)) throw new P({
5569
+ if (Yr(this.modelId)) throw new P({
5625
5570
  argument: "modelId",
5626
5571
  message: `Model '${this.modelId}' only supports streaming transcription. Use experimental_streamTranscribe, or a unary model such as 'gemini-3.5-transcribe'.`
5627
5572
  });
5628
- let t = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date(), r = [], i = Zr(await this.parseOptions(e.providerOptions)), a = {
5573
+ let t = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date(), r = [], i = $r(await this.parseOptions(e.providerOptions)), a = {
5629
5574
  model: this.modelId,
5630
5575
  input: [{
5631
5576
  type: "audio",
@@ -5638,16 +5583,16 @@ var Jr = class e {
5638
5583
  headers: L(this.config.headers ? await J(this.config.headers) : void 0, e.headers),
5639
5584
  body: a,
5640
5585
  failedResponseHandler: Y,
5641
- successfulResponseHandler: n(ti),
5586
+ successfulResponseHandler: n(ri),
5642
5587
  abortSignal: e.abortSignal,
5643
5588
  fetch: this.config.fetch
5644
5589
  }), l = "", u = [];
5645
- for (let e of o.steps ?? []) for (let t of e.content ?? []) if (!(t.type !== "text" || t.text == null)) {
5590
+ for (let e of o.steps ?? []) for (let t of e.content ?? []) if (t.type === "text" && t.text != null) {
5646
5591
  l += t.text;
5647
5592
  for (let e of t.annotations ?? []) {
5648
5593
  if (e.type !== "word_info") continue;
5649
- let t = Qr(e.start_offset), n = Qr(e.end_offset);
5650
- e.text == null || t == null || n == null || u.push({
5594
+ let t = ei(e.start_offset), n = ei(e.end_offset);
5595
+ e.text != null && t != null && n != null && u.push({
5651
5596
  text: e.text,
5652
5597
  startSecond: t,
5653
5598
  endSecond: n
@@ -5670,18 +5615,18 @@ var Jr = class e {
5670
5615
  };
5671
5616
  }
5672
5617
  async doStream(e) {
5673
- if (!qr(this.modelId)) throw new P({
5618
+ if (!Yr(this.modelId)) throw new P({
5674
5619
  argument: "modelId",
5675
5620
  message: `Model '${this.modelId}' does not support streaming transcription. Use a live model such as 'gemini-3.5-transcribe-live'.`
5676
5621
  });
5677
5622
  let t = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date(), n = [], r = await this.parseOptions(e.providerOptions);
5678
- $r(e.inputAudioFormat);
5623
+ ti(e.inputAudioFormat);
5679
5624
  let i = L(this.config.headers ? await J(this.config.headers) : void 0, e.headers), a;
5680
5625
  for (let [e, t] of Object.entries(i)) e.toLowerCase() === "x-goog-api-key" && t != null && (a = t);
5681
5626
  if (a == null) throw Error("Google Generative AI API key is required for streaming transcription.");
5682
5627
  let o = Object.fromEntries(Object.entries(i).filter(([e]) => e.toLowerCase() !== "x-goog-api-key")), s = {
5683
5628
  model: X(this.modelId),
5684
- inputAudioTranscription: Xr(r) ?? {}
5629
+ inputAudioTranscription: Qr(r) ?? {}
5685
5630
  };
5686
5631
  return {
5687
5632
  request: { body: s },
@@ -5689,13 +5634,13 @@ var Jr = class e {
5689
5634
  timestamp: t,
5690
5635
  modelId: this.modelId
5691
5636
  },
5692
- stream: Yr({
5637
+ stream: Zr({
5693
5638
  webSocket: this.config.webSocket,
5694
- url: Kr(this.config.baseURL, a),
5639
+ url: Jr(this.config.baseURL, a),
5695
5640
  headers: o,
5696
5641
  setup: s,
5697
5642
  inputAudioRate: e.inputAudioFormat.rate ?? 16e3,
5698
- finishGraceMs: this.config._internal?.finishGraceMs ?? Gr,
5643
+ finishGraceMs: this.config._internal?.finishGraceMs ?? qr,
5699
5644
  warnings: n,
5700
5645
  audio: e.audio,
5701
5646
  abortSignal: e.abortSignal,
@@ -5704,7 +5649,7 @@ var Jr = class e {
5704
5649
  };
5705
5650
  }
5706
5651
  };
5707
- function Yr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5652
+ function Zr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5708
5653
  let u = !1, f = () => {};
5709
5654
  return new ReadableStream({
5710
5655
  start: (p) => {
@@ -5713,7 +5658,7 @@ function Yr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
5713
5658
  }), y = 0, b = "", x = "", S = "", C, w = !1, T, E, D = () => `google-segment-${y}`, O = () => {
5714
5659
  E != null && (clearTimeout(E), E = void 0);
5715
5660
  }, k = () => {
5716
- u || !w || (O(), E = setTimeout(() => {
5661
+ !u && w && (O(), E = setTimeout(() => {
5717
5662
  E = void 0, N();
5718
5663
  }, a));
5719
5664
  };
@@ -5801,13 +5746,7 @@ function Yr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
5801
5746
  j(/* @__PURE__ */ Error("Google Live transcription error"));
5802
5747
  },
5803
5748
  onClose: ({ code: e, reason: t }) => {
5804
- if (!u) {
5805
- if (w) {
5806
- N();
5807
- return;
5808
- }
5809
- j(/* @__PURE__ */ Error(`Google Live transcription WebSocket closed unexpectedly before finishing (code ${e ?? "unknown"}${t ? `, reason: ${t}` : ""}).`));
5810
- }
5749
+ u || (w ? N() : j(/* @__PURE__ */ Error(`Google Live transcription WebSocket closed unexpectedly before finishing (code ${e ?? "unknown"}${t ? `, reason: ${t}` : ""}).`)));
5811
5750
  }
5812
5751
  });
5813
5752
  },
@@ -5816,12 +5755,12 @@ function Yr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
5816
5755
  }
5817
5756
  });
5818
5757
  }
5819
- function Xr(e) {
5758
+ function Qr(e) {
5820
5759
  if (e == null) return;
5821
5760
  let t = {};
5822
5761
  return e.languageCodes != null && (t.languageCodes = e.languageCodes), e.customVocabulary != null && (t.customVocabulary = e.customVocabulary), e.wordTimestamp != null && (t.wordTimestamp = e.wordTimestamp), e.diarization != null && (t.diarization = e.diarization), e.mode != null && (t.mode = e.mode), Object.keys(t).length > 0 ? t : void 0;
5823
5762
  }
5824
- function Zr(e) {
5763
+ function $r(e) {
5825
5764
  if (e == null) return;
5826
5765
  let t = {};
5827
5766
  return e.languageCodes != null && (t.language_codes = e.languageCodes), e.customVocabulary != null && (t.custom_vocabulary = e.customVocabulary), (e.mode != null || e.diarization === !0 || e.wordTimestamp === !0) && (t.mode = {
@@ -5830,40 +5769,40 @@ function Zr(e) {
5830
5769
  ...e.wordTimestamp === !0 ? { timestamp_granularities: ["word"] } : {}
5831
5770
  }), Object.keys(t).length > 0 ? t : void 0;
5832
5771
  }
5833
- function Qr(e) {
5772
+ function ei(e) {
5834
5773
  if (e == null) return;
5835
5774
  let t = Number.parseFloat(e);
5836
5775
  return Number.isFinite(t) ? t : void 0;
5837
5776
  }
5838
- function $r(e) {
5777
+ function ti(e) {
5839
5778
  if (e.type !== "audio/pcm" || e.rate != null && e.rate !== 16e3) throw new P({
5840
5779
  argument: "inputAudioFormat",
5841
5780
  message: "The Gemini Live transcription API only supports 16kHz 16-bit PCM input audio."
5842
5781
  });
5843
5782
  }
5844
- var ei = N({
5783
+ var ni = N({
5845
5784
  type: W().nullish(),
5846
5785
  text: W().nullish(),
5847
5786
  speaker: W().nullish(),
5848
5787
  start_offset: W().nullish(),
5849
5788
  end_offset: W().nullish()
5850
- }), ti = N({
5789
+ }), ri = N({
5851
5790
  status: W().nullish(),
5852
5791
  steps: c(N({
5853
5792
  type: W().nullish(),
5854
5793
  content: c(N({
5855
5794
  type: W().nullish(),
5856
5795
  text: W().nullish(),
5857
- annotations: c(ei).nullish()
5796
+ annotations: c(ni).nullish()
5858
5797
  })).nullish()
5859
5798
  })).nullish(),
5860
5799
  usage: K(W(), R()).nullish()
5861
- }), ni = G(() => t(N({ echoTargetLanguage: k().optional() }))), ri = "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent", ii = 1e3, ai = 24e3, oi = 128;
5862
- function si(e, t) {
5863
- let n = Nr(e, ri);
5800
+ }), ii = G(() => t(N({ echoTargetLanguage: k().optional() }))), ai = "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent", oi = 1e3, si = 24e3, ci = 128;
5801
+ function li(e, t) {
5802
+ let n = Fr(e, ai);
5864
5803
  return n.searchParams.set("key", t), n;
5865
5804
  }
5866
- var ci = class e {
5805
+ var ui = class e {
5867
5806
  constructor(e, t) {
5868
5807
  this.specificationVersion = "v4", this.modelId = e, this.config = t;
5869
5808
  }
@@ -5887,9 +5826,9 @@ var ci = class e {
5887
5826
  let t = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date(), n = await j({
5888
5827
  provider: "google",
5889
5828
  providerOptions: e.providerOptions,
5890
- schema: ni
5829
+ schema: ii
5891
5830
  }), r = [];
5892
- pi(e.inputAudioFormat), e.sourceLanguage != null && r.push({
5831
+ hi(e.inputAudioFormat), e.sourceLanguage != null && r.push({
5893
5832
  type: "unsupported",
5894
5833
  feature: "sourceLanguage",
5895
5834
  details: "The Gemini Live translation API auto-detects the source language and does not accept a source language."
@@ -5901,7 +5840,7 @@ var ci = class e {
5901
5840
  let i = L(this.config.headers(), e.headers), a;
5902
5841
  for (let [e, t] of Object.entries(i)) e.toLowerCase() === "x-goog-api-key" && t != null && (a = t);
5903
5842
  if (a == null) throw Error("Google Generative AI API key is required for streaming translation.");
5904
- let o = Object.fromEntries(Object.entries(i).filter(([e]) => e.toLowerCase() !== "x-goog-api-key")), s = fi({
5843
+ let o = Object.fromEntries(Object.entries(i).filter(([e]) => e.toLowerCase() !== "x-goog-api-key")), s = mi({
5905
5844
  modelId: this.modelId,
5906
5845
  targetLanguage: e.targetLanguage,
5907
5846
  providerOptions: n
@@ -5912,13 +5851,13 @@ var ci = class e {
5912
5851
  timestamp: t,
5913
5852
  modelId: this.modelId
5914
5853
  },
5915
- stream: li({
5854
+ stream: di({
5916
5855
  webSocket: this.config.webSocket,
5917
- url: si(this.config.baseURL, a),
5856
+ url: li(this.config.baseURL, a),
5918
5857
  headers: o,
5919
5858
  setup: s,
5920
5859
  inputAudioRate: e.inputAudioFormat.rate ?? 16e3,
5921
- finishGraceMs: this.config._internal?.finishGraceMs ?? ii,
5860
+ finishGraceMs: this.config._internal?.finishGraceMs ?? oi,
5922
5861
  warnings: r,
5923
5862
  audio: e.audio,
5924
5863
  abortSignal: e.abortSignal,
@@ -5927,7 +5866,7 @@ var ci = class e {
5927
5866
  };
5928
5867
  }
5929
5868
  };
5930
- function li({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5869
+ function di({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5931
5870
  let u = !1, f = () => {};
5932
5871
  return new ReadableStream({
5933
5872
  start: (p) => {
@@ -6001,7 +5940,7 @@ function li({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
6001
5940
  if (l && p.enqueue({
6002
5941
  type: "raw",
6003
5942
  rawValue: n
6004
- }), n.setupComplete != null && _(), n.usageMetadata != null && (T = ui(T, n.usageMetadata)), n.error != null) {
5943
+ }), n.setupComplete != null && _(), n.usageMetadata != null && (T = fi(T, n.usageMetadata)), n.error != null) {
6005
5944
  F(Error(n.error.message ?? "Google Live API error"));
6006
5945
  return;
6007
5946
  }
@@ -6019,7 +5958,7 @@ function li({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
6019
5958
  id: j(),
6020
5959
  audio: e.inlineData.data
6021
5960
  });
6022
- let t = di(e.inlineData.data);
5961
+ let t = pi(e.inlineData.data);
6023
5962
  if (w && t != null) {
6024
5963
  if (O += t, O >= a) {
6025
5964
  I();
@@ -6038,13 +5977,7 @@ function li({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
6038
5977
  F(/* @__PURE__ */ Error("Google Live translation error"));
6039
5978
  },
6040
5979
  onClose: ({ code: e, reason: t }) => {
6041
- if (!u) {
6042
- if (k != null) {
6043
- I();
6044
- return;
6045
- }
6046
- F(/* @__PURE__ */ Error(`Google Live translation WebSocket closed unexpectedly before finishing (code ${e ?? "unknown"}${t ? `, reason: ${t}` : ""}).`));
6047
- }
5980
+ u || (k == null ? F(/* @__PURE__ */ Error(`Google Live translation WebSocket closed unexpectedly before finishing (code ${e ?? "unknown"}${t ? `, reason: ${t}` : ""}).`)) : I());
6048
5981
  }
6049
5982
  });
6050
5983
  },
@@ -6053,7 +5986,7 @@ function li({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
6053
5986
  }
6054
5987
  });
6055
5988
  }
6056
- function ui(e, t) {
5989
+ function fi(e, t) {
6057
5990
  let n = e?.inputAudioTokens, r = e?.outputAudioTokens;
6058
5991
  for (let e of t.promptTokensDetails ?? []) e.modality === "AUDIO" && e.tokenCount != null && (n = (n ?? 0) + e.tokenCount);
6059
5992
  for (let e of t.responseTokensDetails ?? []) e.modality === "AUDIO" && e.tokenCount != null && (r = (r ?? 0) + e.tokenCount);
@@ -6063,7 +5996,7 @@ function ui(e, t) {
6063
5996
  ...r == null ? {} : { outputAudioTokens: r }
6064
5997
  };
6065
5998
  }
6066
- function di(e) {
5999
+ function pi(e) {
6067
6000
  let t;
6068
6001
  try {
6069
6002
  t = ne(e);
@@ -6072,10 +6005,10 @@ function di(e) {
6072
6005
  }
6073
6006
  if (t.byteLength < 2) return;
6074
6007
  let n = new DataView(t.buffer, t.byteOffset, t.byteLength), r = Math.floor(t.byteLength / 2);
6075
- for (let e = 0; e < r; e++) if (Math.abs(n.getInt16(e * 2, !0)) > oi) return;
6076
- return r / ai * 1e3;
6008
+ for (let e = 0; e < r; e++) if (Math.abs(n.getInt16(e * 2, !0)) > ci) return;
6009
+ return r / si * 1e3;
6077
6010
  }
6078
- function fi({ modelId: e, targetLanguage: t, providerOptions: n }) {
6011
+ function mi({ modelId: e, targetLanguage: t, providerOptions: n }) {
6079
6012
  return {
6080
6013
  model: X(e),
6081
6014
  generationConfig: {
@@ -6089,13 +6022,13 @@ function fi({ modelId: e, targetLanguage: t, providerOptions: n }) {
6089
6022
  outputAudioTranscription: {}
6090
6023
  };
6091
6024
  }
6092
- function pi(e) {
6025
+ function hi(e) {
6093
6026
  if (e.type !== "audio/pcm" || e.rate != null && e.rate !== 16e3) throw new P({
6094
6027
  argument: "inputAudioFormat",
6095
6028
  message: "The Gemini Live translation API only supports 16kHz 16-bit PCM input audio."
6096
6029
  });
6097
6030
  }
6098
- var mi = "https://generativelanguage.googleapis.com/v1beta", hi = /^https:\/\/generativelanguage\.googleapis\.com\/v1beta\/files\/.*$/, gi = [
6031
+ var gi = "https://generativelanguage.googleapis.com/v1beta", _i = /^https:\/\/generativelanguage\.googleapis\.com\/v1beta\/files\/.*$/, vi = [
6099
6032
  "text/html",
6100
6033
  "text/css",
6101
6034
  "text/plain",
@@ -6118,76 +6051,76 @@ var mi = "https://generativelanguage.googleapis.com/v1beta", hi = /^https:\/\/ge
6118
6051
  "video/webm",
6119
6052
  "video/wmv",
6120
6053
  "video/3gpp"
6121
- ], _i = /^https:\/\/.*$/;
6122
- function vi(e) {
6054
+ ], yi = /^https:\/\/.*$/;
6055
+ function bi(e) {
6123
6056
  return /(^|\/)gemini-/.test(e) && !/(^|\/)gemini-2\.0/.test(e);
6124
6057
  }
6125
- function yi(e = {}) {
6126
- let t = _e(e.baseURL) ?? mi, n = e.name ?? "google.generative-ai", r = () => v({
6058
+ function xi(e = {}) {
6059
+ let t = _e(e.baseURL) ?? gi, n = e.name ?? "google.generative-ai", r = () => v({
6127
6060
  "x-goog-api-key": pe({
6128
6061
  apiKey: e.apiKey,
6129
6062
  environmentVariableName: "GOOGLE_GENERATIVE_AI_API_KEY",
6130
6063
  description: "Google Generative AI"
6131
6064
  }),
6132
6065
  ...e.headers
6133
- }, `ai-sdk-google/${ye}`), a = (e, n = e == null || vi(e)) => ({
6066
+ }, `ai-sdk-google/${ye}`), a = (e, n = e == null || bi(e)) => ({
6134
6067
  "*": [
6135
- hi,
6068
+ _i,
6136
6069
  RegExp(`^${t}/files/.*$`),
6137
- RegExp("^https://(?:www\\.)?youtube\\.com/watch\\?v=[\\w-]+(?:&[\\w=&.-]*)?$"),
6138
- RegExp("^https://youtu\\.be/[\\w-]+(?:\\?[\\w=&.-]*)?$")
6070
+ /* @__PURE__ */ RegExp("^https://(?:www\\.)?youtube\\.com/watch\\?v=[\\w-]+(?:&[\\w=&.-]*)?$"),
6071
+ /* @__PURE__ */ RegExp("^https://youtu\\.be/[\\w-]+(?:\\?[\\w=&.-]*)?$")
6139
6072
  ],
6140
- ...n ? Object.fromEntries(gi.map((e) => [e, [_i]])) : {}
6073
+ ...n ? Object.fromEntries(vi.map((e) => [e, [yi]])) : {}
6141
6074
  }), o = {
6142
6075
  provider: n,
6143
6076
  baseURL: t,
6144
6077
  headers: r,
6145
6078
  generateId: e.generateId ?? i,
6146
6079
  fetch: e.fetch
6147
- }, s = (e) => new dt(e, {
6080
+ }, s = (e) => new ft(e, {
6148
6081
  ...o,
6149
6082
  supportedUrls: () => a(e)
6150
- }), c = () => new Kt({
6083
+ }), c = () => new qt({
6151
6084
  provider: `${n.replace(/\.generative-ai$/, "")}.batch`,
6152
6085
  config: o,
6153
6086
  supportedUrls: a(void 0, !1)
6154
- }), l = (i) => new Ce(i, {
6087
+ }), l = (i) => new we(i, {
6155
6088
  provider: n,
6156
6089
  baseURL: t,
6157
6090
  headers: r,
6158
6091
  fetch: e.fetch
6159
- }), u = (i, a = {}) => new on(i, a, {
6092
+ }), u = (i, a = {}) => new sn(i, a, {
6160
6093
  provider: n,
6161
6094
  baseURL: t,
6162
6095
  headers: r,
6163
6096
  fetch: e.fetch
6164
- }), d = () => new cn({
6097
+ }), d = () => new ln({
6165
6098
  provider: n,
6166
6099
  baseURL: t,
6167
6100
  headers: r,
6168
6101
  fetch: e.fetch
6169
- }), f = (a) => new bn(a, {
6102
+ }), f = (a) => new xn(a, {
6170
6103
  provider: n,
6171
6104
  baseURL: t,
6172
6105
  headers: r,
6173
6106
  fetch: e.fetch,
6174
6107
  generateId: e.generateId ?? i
6175
- }), p = (i) => new Hr(i, {
6108
+ }), p = (i) => new Wr(i, {
6176
6109
  provider: `${n}.realtime`,
6177
6110
  baseURL: t,
6178
6111
  headers: r,
6179
6112
  fetch: e.fetch
6180
- }), m = (i) => new ci(i, {
6113
+ }), m = (i) => new ui(i, {
6181
6114
  provider: `${n}.speech-translation`,
6182
6115
  baseURL: t,
6183
6116
  headers: r,
6184
6117
  webSocket: e.webSocket
6185
- }), h = (i) => new kn(i, {
6118
+ }), h = (i) => new jn(i, {
6186
6119
  provider: `${n}.speech`,
6187
6120
  baseURL: t,
6188
6121
  headers: r,
6189
6122
  fetch: e.fetch
6190
- }), g = (i) => new Jr(i, {
6123
+ }), g = (i) => new Xr(i, {
6191
6124
  provider: `${n}.transcription`,
6192
6125
  baseURL: t,
6193
6126
  headers: r,
@@ -6203,7 +6136,7 @@ function yi(e = {}) {
6203
6136
  url: t.url,
6204
6137
  expiresAt: t.expiresAt
6205
6138
  };
6206
- } }), y = (a) => new jr(a, {
6139
+ } }), y = (a) => new Nr(a, {
6207
6140
  provider: `${n}.interactions`,
6208
6141
  baseURL: t,
6209
6142
  headers: r,
@@ -6216,8 +6149,7 @@ function yi(e = {}) {
6216
6149
  return b.specificationVersion = "v4", b.languageModel = s, b.chat = s, b.generativeAI = s, b.evaluationModel = (e) => new ve({
6217
6150
  model: s(e),
6218
6151
  provider: `${n.replace(/\.generative-ai$/, "")}.evaluation`
6219
- }), b.experimental_batch = c, b.embedding = l, b.embeddingModel = l, b.textEmbedding = l, b.textEmbeddingModel = l, b.image = u, b.imageModel = u, b.video = f, b.videoModel = f, b.experimental_realtime = _, b.files = d, b.speech = h, b.speechModel = h, b.transcription = g, b.transcriptionModel = g, b.translation = m, b.speechTranslationModel = m, b.interactions = y, b.tools = rn, b;
6152
+ }), b.experimental_batch = c, b.embedding = l, b.embeddingModel = l, b.textEmbedding = l, b.textEmbeddingModel = l, b.image = u, b.imageModel = u, b.video = f, b.videoModel = f, b.experimental_realtime = _, b.files = d, b.speech = h, b.speechModel = h, b.transcription = g, b.transcriptionModel = g, b.translation = m, b.speechTranslationModel = m, b.interactions = y, b.tools = an, b;
6220
6153
  }
6221
- yi();
6222
- //#endregion
6223
- export { yi as createGoogle, yi as createGoogleGenerativeAI };
6154
+ xi();
6155
+ export { xi as createGoogle, xi as createGoogleGenerativeAI };