@roomle/embedding-lib 0.0.0-dev-20f436f → 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,6 +1,6 @@
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-Bt1FopV4.mjs";
3
- import { t as ve } from "./experimental-evaluation-DczxmJme.mjs";
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-D2ZAAHGn.mjs";
3
+ import { t as ve } from "./experimental-evaluation-DmqghFSx.mjs";
4
4
  var ye, Y = he({
5
5
  errorSchema: G(() => t(N({ error: N({
6
6
  code: B().nullable(),
@@ -249,11 +249,7 @@ async function Ie(e, { abortSignal: t, maxBytes: n, supportedUrls: r }) {
249
249
  if (e.type !== "content") return e;
250
250
  let i = [];
251
251
  for (let a of e.value) {
252
- if (a.type !== "file" || a.data.type !== "url") {
253
- i.push(a);
254
- continue;
255
- }
256
- if (re({
252
+ if (a.type !== "file" || a.data.type !== "url" || re({
257
253
  url: a.data.url.toString(),
258
254
  mediaType: a.mediaType,
259
255
  supportedUrls: r
@@ -852,41 +848,35 @@ var tt = [
852
848
  };
853
849
  }(n.downloadToolResultFiles ? await async function(e, { abortSignal: t, maxBytes: n, supportedUrls: r = {} }) {
854
850
  let i = [];
855
- for (let a of e) {
856
- if (a.role === "assistant") {
857
- let e = [];
858
- for (let i of a.content) e.push(i.type === "tool-result" ? {
859
- ...i,
860
- output: await Ie(i.output, {
861
- abortSignal: t,
862
- maxBytes: n,
863
- supportedUrls: r
864
- })
865
- } : i);
866
- i.push({
867
- ...a,
868
- content: e
869
- });
870
- continue;
871
- }
872
- if (a.role === "tool") {
873
- let e = [];
874
- for (let i of a.content) i.type === "tool-result" ? e.push({
875
- ...i,
876
- output: await Ie(i.output, {
877
- abortSignal: t,
878
- maxBytes: n,
879
- supportedUrls: r
880
- })
881
- }) : e.push(i);
882
- i.push({
883
- ...a,
884
- content: e
885
- });
886
- continue;
887
- }
888
- i.push(a);
889
- }
851
+ for (let a of e) if (a.role === "assistant") {
852
+ let e = [];
853
+ for (let i of a.content) e.push(i.type === "tool-result" ? {
854
+ ...i,
855
+ output: await Ie(i.output, {
856
+ abortSignal: t,
857
+ maxBytes: n,
858
+ supportedUrls: r
859
+ })
860
+ } : i);
861
+ i.push({
862
+ ...a,
863
+ content: e
864
+ });
865
+ } else if (a.role === "tool") {
866
+ let e = [];
867
+ for (let i of a.content) i.type === "tool-result" ? e.push({
868
+ ...i,
869
+ output: await Ie(i.output, {
870
+ abortSignal: t,
871
+ maxBytes: n,
872
+ supportedUrls: r
873
+ })
874
+ }) : e.push(i);
875
+ i.push({
876
+ ...a,
877
+ content: e
878
+ });
879
+ } else i.push(a);
890
880
  return i;
891
881
  }(i, {
892
882
  abortSignal: b,
@@ -1800,7 +1790,7 @@ var _t = se({
1800
1790
  id: "google.google_search",
1801
1791
  inputSchema: G(() => t(N({}))),
1802
1792
  outputSchema: G(() => t(N({})))
1803
- }), yt = G(() => t(N({ googleSearch: _t.optional() }))), bt = new Set([
1793
+ }), yt = G(() => t(N({ googleSearch: _t.optional() }))), bt = /* @__PURE__ */ new Set([
1804
1794
  "text",
1805
1795
  "reasoning",
1806
1796
  "source",
@@ -1886,7 +1876,7 @@ var _t = se({
1886
1876
  metadata: { key: t.id }
1887
1877
  };
1888
1878
  if (c == null) {
1889
- let r = l + s.encode(JSON.stringify(n)).byteLength + (a.length > 0 ? 1 : 0);
1879
+ let r = l + s.encode(JSON.stringify(n)).byteLength + +(a.length > 0);
1890
1880
  if (r < 2e7) a.push(n), l = r;
1891
1881
  else {
1892
1882
  c = [];
@@ -2234,10 +2224,10 @@ var _t = se({
2234
2224
  };
2235
2225
  function Mt(e) {
2236
2226
  let t = e.metadata?.state ?? void 0, n = function(e) {
2237
- let t = Pt(e?.requestCount), n = Pt(e?.successfulRequestCount ?? 0), r = Pt(e?.failedRequestCount ?? 0);
2227
+ let t = Pt(e?.requestCount), n = Pt(e?.successfulRequestCount ?? 0), r = Pt(e?.failedRequestCount ?? 0), i = Pt(e?.pendingRequestCount ?? 0);
2238
2228
  return ue({
2239
2229
  total: t,
2240
- pending: Pt(e?.pendingRequestCount ?? 0),
2230
+ pending: i,
2241
2231
  completed: n,
2242
2232
  failed: r
2243
2233
  });
@@ -2341,7 +2331,7 @@ var zt = V({
2341
2331
  inputSchema: G(() => t(N({}))),
2342
2332
  outputSchema: G(() => t(N({})))
2343
2333
  })
2344
- }, Vt = new Set([
2334
+ }, Vt = /* @__PURE__ */ new Set([
2345
2335
  "gemini-2.5-flash-image",
2346
2336
  "gemini-3-pro-image-preview",
2347
2337
  "gemini-3.1-flash-image-preview"
@@ -2780,23 +2770,23 @@ var Yt = class {
2780
2770
  }), Zt = G(() => t(N({ candidates: c(N({ content: N({ parts: c(N({ inlineData: N({
2781
2771
  mimeType: W().nullish(),
2782
2772
  data: W().nullish()
2783
- }).nullish() })).nullish() }).nullish() })).nullish() }))), Qt = N({
2784
- prebuiltVoiceConfig: N({ voiceName: W() }),
2773
+ }).nullish() })).nullish() }).nullish() })).nullish() }))), Qt = N({ voiceName: W() }), $t = N({
2774
+ prebuiltVoiceConfig: Qt,
2785
2775
  voice: de().optional()
2786
- }), $t = N({
2776
+ }), en = N({
2787
2777
  speaker: W().min(1).optional(),
2788
2778
  style: W().optional()
2789
- }), en = G(() => t(N({
2790
- speechMetadata: $t.optional(),
2779
+ }), tn = G(() => t(N({
2780
+ speechMetadata: en.optional(),
2791
2781
  turns: c(N({
2792
2782
  text: W(),
2793
- speechMetadata: $t.optional()
2783
+ speechMetadata: en.optional()
2794
2784
  })).min(1).optional(),
2795
2785
  multiSpeakerVoiceConfig: N({ speakerVoiceConfigs: c(N({
2796
2786
  speaker: W(),
2797
- voiceConfig: Qt
2787
+ voiceConfig: $t
2798
2788
  })) }).optional()
2799
- }))), tn = class e {
2789
+ }))), nn = class e {
2800
2790
  constructor(e, t) {
2801
2791
  this.modelId = e, this.config = t, this.specificationVersion = "v4";
2802
2792
  }
@@ -2817,12 +2807,12 @@ var Yt = class {
2817
2807
  for (let e of c) if (l = await j({
2818
2808
  provider: e,
2819
2809
  providerOptions: o,
2820
- schema: en
2810
+ schema: tn
2821
2811
  }), l != null) break;
2822
2812
  l != null || c.includes("google") || (l = await j({
2823
2813
  provider: "google",
2824
2814
  providerOptions: o,
2825
- schema: en
2815
+ schema: tn
2826
2816
  }));
2827
2817
  let u = !this.modelId.startsWith("gemini-2.5-") && !this.modelId.startsWith("gemini-3.1-"), d = function({ text: e, voice: t, providerOptions: n }) {
2828
2818
  let r = n?.google, i = typeof r == "object" && r ? r : void 0, a = i && "turns" in i ? i.turns : void 0, o = [];
@@ -2952,9 +2942,9 @@ var Yt = class {
2952
2942
  if (e == null) return;
2953
2943
  let t = /rate=(\d+)/.exec(e);
2954
2944
  return t ? Number.parseInt(t[1], 10) : void 0;
2955
- }(d) ?? 24e3, 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 ? function(e, t) {
2945
+ }(d) ?? 24e3, 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 ? function(e, t) {
2956
2946
  let n = 2 * t, r = e.length, i = new ArrayBuffer(44 + r), a = new DataView(i);
2957
- nn(a, 0, "RIFF"), a.setUint32(4, 36 + r, !0), nn(a, 8, "WAVE"), nn(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), nn(a, 36, "data"), a.setUint32(40, r, !0);
2947
+ rn(a, 0, "RIFF"), a.setUint32(4, 36 + r, !0), rn(a, 8, "WAVE"), rn(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), rn(a, 36, "data"), a.setUint32(40, r, !0);
2958
2948
  let o = new Uint8Array(i);
2959
2949
  return o.set(e, 44), o;
2960
2950
  }(p, f) : p;
@@ -2979,10 +2969,10 @@ var Yt = class {
2979
2969
  };
2980
2970
  }
2981
2971
  };
2982
- function nn(e, t, n) {
2972
+ function rn(e, t, n) {
2983
2973
  for (let r = 0; r < n.length; r++) e.setUint8(t + r, n.charCodeAt(r));
2984
2974
  }
2985
- function rn(e) {
2975
+ function an(e) {
2986
2976
  if (e == null) return m();
2987
2977
  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;
2988
2978
  return {
@@ -3000,14 +2990,14 @@ function rn(e) {
3000
2990
  raw: e
3001
2991
  };
3002
2992
  }
3003
- function an(e) {
2993
+ function on(e) {
3004
2994
  let t = e?.output_tokens_by_modality;
3005
2995
  if (t == null) return;
3006
2996
  let n = {};
3007
2997
  for (let e of t) e?.modality != null && e.tokens != null && (n[e.modality] = e.tokens);
3008
2998
  return Object.keys(n).length > 0 ? n : void 0;
3009
2999
  }
3010
- var on = {
3000
+ var sn = {
3011
3001
  pdf: "application/pdf",
3012
3002
  txt: "text/plain",
3013
3003
  md: "text/markdown",
@@ -3015,16 +3005,16 @@ var on = {
3015
3005
  doc: "application/msword",
3016
3006
  docx: "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
3017
3007
  };
3018
- function sn(e) {
3008
+ function cn(e) {
3019
3009
  let t = e.toLowerCase();
3020
- for (let [e, n] of Object.entries(on)) if (t.endsWith(`.${e}`)) return n;
3010
+ for (let [e, n] of Object.entries(sn)) if (t.endsWith(`.${e}`)) return n;
3021
3011
  return "application/octet-stream";
3022
3012
  }
3023
- function cn(e) {
3013
+ function ln(e) {
3024
3014
  let t = e.split("/"), n = t[t.length - 1];
3025
3015
  return n && n.length > 0 ? n : void 0;
3026
3016
  }
3027
- function ln({ annotation: e, generateId: t }) {
3017
+ function un({ annotation: e, generateId: t }) {
3028
3018
  switch (e.type) {
3029
3019
  case "url_citation": {
3030
3020
  let n = e;
@@ -3046,7 +3036,7 @@ function ln({ annotation: e, generateId: t }) {
3046
3036
  url: r,
3047
3037
  ...n.file_name == null ? {} : { title: n.file_name }
3048
3038
  };
3049
- let i = n.file_name ?? cn(r), a = sn(r);
3039
+ let i = n.file_name ?? ln(r), a = cn(r);
3050
3040
  return {
3051
3041
  type: "source",
3052
3042
  sourceType: "document",
@@ -3069,7 +3059,7 @@ function ln({ annotation: e, generateId: t }) {
3069
3059
  default: return;
3070
3060
  }
3071
3061
  }
3072
- function un({ block: e, generateId: t }) {
3062
+ function dn({ block: e, generateId: t }) {
3073
3063
  let n = [];
3074
3064
  switch (e.type) {
3075
3065
  case "url_context_result": {
@@ -3123,7 +3113,7 @@ function un({ block: e, generateId: t }) {
3123
3113
  });
3124
3114
  continue;
3125
3115
  }
3126
- let a = r.file_name ?? cn(i), o = sn(i);
3116
+ let a = r.file_name ?? ln(i), o = cn(i);
3127
3117
  n.push({
3128
3118
  type: "source",
3129
3119
  sourceType: "document",
@@ -3138,11 +3128,11 @@ function un({ block: e, generateId: t }) {
3138
3128
  }
3139
3129
  return n;
3140
3130
  }
3141
- function dn({ annotations: e, generateId: t }) {
3131
+ function fn({ annotations: e, generateId: t }) {
3142
3132
  if (e == null) return [];
3143
3133
  let n = /* @__PURE__ */ new Set(), r = [];
3144
3134
  for (let i of e) {
3145
- let e = ln({
3135
+ let e = un({
3146
3136
  annotation: i,
3147
3137
  generateId: t
3148
3138
  });
@@ -3152,7 +3142,7 @@ function dn({ annotations: e, generateId: t }) {
3152
3142
  }
3153
3143
  return r;
3154
3144
  }
3155
- function fn({ status: e, hasFunctionCall: t }) {
3145
+ function pn({ status: e, hasFunctionCall: t }) {
3156
3146
  switch (e) {
3157
3147
  case "completed": return t ? "tool-calls" : "stop";
3158
3148
  case "requires_action": return "tool-calls";
@@ -3161,14 +3151,14 @@ function fn({ status: e, hasFunctionCall: t }) {
3161
3151
  default: return "other";
3162
3152
  }
3163
3153
  }
3164
- var pn = new Set([
3154
+ var mn = /* @__PURE__ */ new Set([
3165
3155
  "google_search_call",
3166
3156
  "code_execution_call",
3167
3157
  "url_context_call",
3168
3158
  "file_search_call",
3169
3159
  "google_maps_call",
3170
3160
  "mcp_server_tool_call"
3171
- ]), mn = new Set([
3161
+ ]), hn = /* @__PURE__ */ new Set([
3172
3162
  "google_search_result",
3173
3163
  "code_execution_result",
3174
3164
  "url_context_result",
@@ -3176,7 +3166,7 @@ var pn = new Set([
3176
3166
  "google_maps_result",
3177
3167
  "mcp_server_tool_result"
3178
3168
  ]);
3179
- function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r }) {
3169
+ function gn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r }) {
3180
3170
  let i, a, o, s = r, c = !1, l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Set();
3181
3171
  function d(e) {
3182
3172
  return e.sourceType === "url" ? `url:${e.url}` : `doc:${e.filename ?? e.title}`;
@@ -3227,7 +3217,7 @@ function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3227
3217
  type: "text-start",
3228
3218
  id: o
3229
3219
  });
3230
- let n = dn({
3220
+ let n = fn({
3231
3221
  annotations: e.annotations,
3232
3222
  generateId: t
3233
3223
  });
@@ -3283,7 +3273,7 @@ function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3283
3273
  id: e,
3284
3274
  toolName: t
3285
3275
  });
3286
- } else if (s != null && pn.has(s)) {
3276
+ } else if (s != null && mn.has(s)) {
3287
3277
  let e = s === "mcp_server_tool_call" ? n?.name ?? "mcp_server_tool" : s.replace(/_call$/, ""), t = {
3288
3278
  kind: "builtin_tool_call",
3289
3279
  id: o,
@@ -3294,7 +3284,7 @@ function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3294
3284
  callEmitted: !1
3295
3285
  };
3296
3286
  l.set(a, t);
3297
- } else if (s != null && mn.has(s)) {
3287
+ } else if (s != null && hn.has(s)) {
3298
3288
  let e = s === "mcp_server_tool_result" ? n?.name ?? "mcp_server_tool" : s.replace(/_result$/, ""), t = {
3299
3289
  kind: "builtin_tool_result",
3300
3290
  id: o,
@@ -3374,45 +3364,47 @@ function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3374
3364
  break;
3375
3365
  }
3376
3366
  let o = e.delta;
3377
- if (n.kind !== "custom" || o?.type !== "processing_call" && o?.type !== "processing_result") if (n.kind === "text" && o?.type === "text") {
3378
- let e = o.text ?? "";
3379
- e.length > 0 && r.enqueue({
3380
- type: "text-delta",
3381
- id: n.id,
3382
- delta: e
3383
- });
3384
- } else if (n.kind !== "text" || o?.type !== "text_annotation" && o?.type !== "text_annotation_delta") if (n.kind === "image" && o?.type === "image") o.data != null && (n.data = o.data), o.mime_type != null && (n.mimeType = o.mime_type), o.uri != null && (n.uri = o.uri);
3385
- else if (n.kind === "reasoning") {
3386
- if (o?.type === "thought_summary") {
3387
- let e = o.content;
3388
- e?.type === "text" && typeof e.text == "string" && r.enqueue({
3389
- type: "reasoning-delta",
3367
+ if (n.kind !== "custom" || o?.type !== "processing_call" && o?.type !== "processing_result") {
3368
+ if (n.kind === "text" && o?.type === "text") {
3369
+ let e = o.text ?? "";
3370
+ e.length > 0 && r.enqueue({
3371
+ type: "text-delta",
3390
3372
  id: n.id,
3391
- delta: e.text
3373
+ delta: e
3392
3374
  });
3393
- } else if (o?.type === "thought_signature") {
3394
- let e = o.signature;
3395
- e != null && (n.signature = e);
3396
- }
3397
- } else if (n.kind === "function_call" && o?.type === "arguments_delta") {
3398
- let e = typeof o.arguments == "string" ? o.arguments : "";
3399
- e.length > 0 && (n.argumentsAccum += e, r.enqueue({
3400
- type: "tool-input-delta",
3401
- id: n.toolCallId,
3402
- delta: e
3403
- })), o.id != null && o.id.length > 0 && (n.toolCallId = o.id), o.signature != null && (n.signature = o.signature), c = !0;
3404
- } else n.kind === "builtin_tool_call" && o?.type === n.blockType ? (o.id != null && o.id.length > 0 && (n.toolCallId = o.id), o.arguments != null && typeof o.arguments == "object" && (n.arguments = o.arguments), o.name != null && n.blockType === "mcp_server_tool_call" && (n.toolName = o.name)) : n.kind === "builtin_tool_result" && o?.type === n.blockType && (o.call_id != null && o.call_id.length > 0 && (n.callId = o.call_id), o.result !== void 0 && (n.result = o.result), o.is_error != null && (n.isError = o.is_error), o.name != null && n.blockType === "mcp_server_tool_result" && (n.toolName = o.name));
3405
- else {
3406
- let e = dn({
3407
- annotations: o.annotations,
3408
- generateId: t
3409
- });
3410
- for (let t of e) {
3411
- let e = d(t);
3412
- u.has(e) || (u.add(e), n.emittedSourceKeys.add(e), r.enqueue(t));
3375
+ } else if (n.kind !== "text" || o?.type !== "text_annotation" && o?.type !== "text_annotation_delta") {
3376
+ if (n.kind === "image" && o?.type === "image") o.data != null && (n.data = o.data), o.mime_type != null && (n.mimeType = o.mime_type), o.uri != null && (n.uri = o.uri);
3377
+ else if (n.kind === "reasoning") {
3378
+ if (o?.type === "thought_summary") {
3379
+ let e = o.content;
3380
+ e?.type === "text" && typeof e.text == "string" && r.enqueue({
3381
+ type: "reasoning-delta",
3382
+ id: n.id,
3383
+ delta: e.text
3384
+ });
3385
+ } else if (o?.type === "thought_signature") {
3386
+ let e = o.signature;
3387
+ e != null && (n.signature = e);
3388
+ }
3389
+ } else if (n.kind === "function_call" && o?.type === "arguments_delta") {
3390
+ let e = typeof o.arguments == "string" ? o.arguments : "";
3391
+ e.length > 0 && (n.argumentsAccum += e, r.enqueue({
3392
+ type: "tool-input-delta",
3393
+ id: n.toolCallId,
3394
+ delta: e
3395
+ })), o.id != null && o.id.length > 0 && (n.toolCallId = o.id), o.signature != null && (n.signature = o.signature), c = !0;
3396
+ } else n.kind === "builtin_tool_call" && o?.type === n.blockType ? (o.id != null && o.id.length > 0 && (n.toolCallId = o.id), o.arguments != null && typeof o.arguments == "object" && (n.arguments = o.arguments), o.name != null && n.blockType === "mcp_server_tool_call" && (n.toolName = o.name)) : n.kind === "builtin_tool_result" && o?.type === n.blockType && (o.call_id != null && o.call_id.length > 0 && (n.callId = o.call_id), o.result !== void 0 && (n.result = o.result), o.is_error != null && (n.isError = o.is_error), o.name != null && n.blockType === "mcp_server_tool_result" && (n.toolName = o.name));
3397
+ } else {
3398
+ let e = fn({
3399
+ annotations: o.annotations,
3400
+ generateId: t
3401
+ });
3402
+ for (let t of e) {
3403
+ let e = d(t);
3404
+ u.has(e) || (u.add(e), n.emittedSourceKeys.add(e), r.enqueue(t));
3405
+ }
3413
3406
  }
3414
- }
3415
- else o.signature != null && (n.google.signature = o.signature), o.type === "processing_call" && o.id != null && o.id.length > 0 && (n.google.processingId = o.id), o.type === "processing_result" && o.call_id != null && o.call_id.length > 0 && (n.google.processingCallId = o.call_id);
3407
+ } else o.signature != null && (n.google.signature = o.signature), o.type === "processing_call" && o.id != null && o.id.length > 0 && (n.google.processingId = o.id), o.type === "processing_result" && o.call_id != null && o.call_id.length > 0 && (n.google.processingCallId = o.call_id);
3416
3408
  break;
3417
3409
  }
3418
3410
  case "step.stop": {
@@ -3484,7 +3476,7 @@ function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3484
3476
  toolName: n.toolName,
3485
3477
  result: n.result ?? null
3486
3478
  }), n.resultEmitted = !0;
3487
- let e = un({
3479
+ let e = dn({
3488
3480
  block: {
3489
3481
  type: n.blockType,
3490
3482
  call_id: n.callId,
@@ -3536,12 +3528,12 @@ function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3536
3528
  },
3537
3529
  flush(e) {
3538
3530
  let t = {
3539
- unified: fn({
3531
+ unified: pn({
3540
3532
  status: o,
3541
3533
  hasFunctionCall: c
3542
3534
  }),
3543
3535
  raw: o
3544
- }, n = an(a), r = { google: {
3536
+ }, n = on(a), r = { google: {
3545
3537
  ...i == null ? {} : { interactionId: i },
3546
3538
  ...s == null ? {} : { serviceTier: s },
3547
3539
  ...n == null ? {} : { outputTokensByModality: n }
@@ -3549,13 +3541,13 @@ function hn({ warnings: e, generateId: t, includeRawChunks: n, serviceTier: r })
3549
3541
  e.enqueue({
3550
3542
  type: "finish",
3551
3543
  finishReason: t,
3552
- usage: rn(a),
3544
+ usage: an(a),
3553
3545
  providerMetadata: r
3554
3546
  });
3555
3547
  }
3556
3548
  });
3557
3549
  }
3558
- function gn({ part: e, warnings: t, mediaResolution: n }) {
3550
+ function _n({ part: e, warnings: t, mediaResolution: n }) {
3559
3551
  if (e.data.type === "text") return {
3560
3552
  type: "text",
3561
3553
  text: e.data.text
@@ -3632,7 +3624,7 @@ function gn({ part: e, warnings: t, mediaResolution: n }) {
3632
3624
  };
3633
3625
  }
3634
3626
  }
3635
- function _n(t) {
3627
+ function vn(t) {
3636
3628
  try {
3637
3629
  let n = e(t);
3638
3630
  return typeof n != "object" || !n || Array.isArray(n) ? { value: n } : n;
@@ -3640,7 +3632,7 @@ function _n(t) {
3640
3632
  return { value: t };
3641
3633
  }
3642
3634
  }
3643
- function vn({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }) {
3635
+ function yn({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }) {
3644
3636
  let a = {
3645
3637
  type: "function_result",
3646
3638
  call_id: e,
@@ -3685,7 +3677,7 @@ function vn({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }
3685
3677
  });
3686
3678
  continue;
3687
3679
  }
3688
- let n = yn({
3680
+ let n = bn({
3689
3681
  part: t,
3690
3682
  warnings: i
3691
3683
  });
@@ -3701,7 +3693,7 @@ function vn({ toolCallId: e, toolName: t, output: n, signature: r, warnings: i }
3701
3693
  }
3702
3694
  }
3703
3695
  }
3704
- function yn({ part: e, warnings: t }) {
3696
+ function bn({ part: e, warnings: t }) {
3705
3697
  switch (e.data.type) {
3706
3698
  case "data": {
3707
3699
  let t = _(e.mediaType) ? e.mediaType : C({ part: {
@@ -3736,7 +3728,7 @@ function yn({ part: e, warnings: t }) {
3736
3728
  return;
3737
3729
  }
3738
3730
  }
3739
- function bn(e) {
3731
+ function xn(e) {
3740
3732
  if (e.length < 2) return e;
3741
3733
  let t = [];
3742
3734
  for (let n of e) {
@@ -3747,46 +3739,43 @@ function bn(e) {
3747
3739
  text: `${e.text}\n\n${n.text}`
3748
3740
  };
3749
3741
  t[t.length - 1] = r;
3750
- continue;
3751
- }
3752
- t.push(n);
3742
+ } else t.push(n);
3753
3743
  }
3754
3744
  return t;
3755
3745
  }
3756
- var xn = () => N({
3746
+ var Sn = () => N({
3757
3747
  modality: W().nullish(),
3758
3748
  tokens: B().nullish()
3759
- }).loose(), Sn = () => N({
3749
+ }).loose(), Cn = () => N({
3760
3750
  total_input_tokens: B().nullish(),
3761
3751
  total_output_tokens: B().nullish(),
3762
3752
  total_thought_tokens: B().nullish(),
3763
3753
  total_cached_tokens: B().nullish(),
3764
3754
  total_tool_use_tokens: B().nullish(),
3765
3755
  total_tokens: B().nullish(),
3766
- input_tokens_by_modality: c(xn()).nullish(),
3767
- output_tokens_by_modality: c(xn()).nullish(),
3768
- cached_tokens_by_modality: c(xn()).nullish(),
3769
- tool_use_tokens_by_modality: c(xn()).nullish(),
3756
+ input_tokens_by_modality: c(Sn()).nullish(),
3757
+ output_tokens_by_modality: c(Sn()).nullish(),
3758
+ cached_tokens_by_modality: c(Sn()).nullish(),
3759
+ tool_use_tokens_by_modality: c(Sn()).nullish(),
3770
3760
  grounding_tool_count: c(N({
3771
3761
  type: W().nullish(),
3772
3762
  count: B().nullish()
3773
3763
  }).loose()).nullish()
3774
- }).loose(), Cn = () => D([
3764
+ }).loose(), wn = () => D([
3775
3765
  "in_progress",
3776
3766
  "requires_action",
3777
3767
  "completed",
3778
3768
  "failed",
3779
3769
  "cancelled",
3780
3770
  "incomplete"
3781
- ]), wn = () => I([
3782
- N({
3771
+ ]), Tn = () => {
3772
+ let e = N({
3783
3773
  type: q("url_citation"),
3784
3774
  url: W().nullish(),
3785
3775
  title: W().nullish(),
3786
3776
  start_index: B().nullish(),
3787
3777
  end_index: B().nullish()
3788
- }).loose(),
3789
- N({
3778
+ }).loose(), t = N({
3790
3779
  type: q("file_citation"),
3791
3780
  file_name: W().nullish(),
3792
3781
  document_uri: W().nullish(),
@@ -3796,28 +3785,31 @@ var xn = () => N({
3796
3785
  start_index: B().nullish(),
3797
3786
  end_index: B().nullish(),
3798
3787
  custom_metadata: K(W(), R()).nullish()
3799
- }).loose(),
3800
- N({
3788
+ }).loose(), n = N({
3801
3789
  type: q("place_citation"),
3802
3790
  name: W().nullish(),
3803
3791
  url: W().nullish(),
3804
3792
  place_id: W().nullish(),
3805
3793
  start_index: B().nullish(),
3806
3794
  end_index: B().nullish()
3807
- }).loose(),
3808
- N({ type: W() }).loose()
3809
- ]), Tn = () => N({
3795
+ }).loose();
3796
+ return I([
3797
+ e,
3798
+ t,
3799
+ n,
3800
+ N({ type: W() }).loose()
3801
+ ]);
3802
+ }, En = () => N({
3810
3803
  type: W(),
3811
3804
  text: W().nullish(),
3812
3805
  data: W().nullish(),
3813
3806
  mime_type: W().nullish()
3814
- }).loose(), En = () => I([
3815
- N({
3807
+ }).loose(), Dn = () => {
3808
+ let e = N({
3816
3809
  type: q("text"),
3817
3810
  text: W(),
3818
- annotations: c(wn()).nullish()
3819
- }).loose(),
3820
- N({
3811
+ annotations: c(Tn()).nullish()
3812
+ }).loose(), t = N({
3821
3813
  type: q("image"),
3822
3814
  data: W().nullish(),
3823
3815
  mime_type: W().nullish(),
@@ -3828,92 +3820,99 @@ var xn = () => N({
3828
3820
  "ultra_high"
3829
3821
  ]).nullish(),
3830
3822
  uri: W().nullish()
3831
- }).loose(),
3832
- N({
3823
+ }).loose(), n = N({
3833
3824
  type: q("video"),
3834
3825
  data: W().nullish(),
3835
3826
  mime_type: W().nullish(),
3836
3827
  uri: W().nullish()
3837
- }).loose(),
3838
- N({ type: W() }).loose()
3839
- ]), Dn = [
3828
+ }).loose();
3829
+ return I([
3830
+ e,
3831
+ t,
3832
+ n,
3833
+ N({ type: W() }).loose()
3834
+ ]);
3835
+ }, On = [
3840
3836
  "google_search_call",
3841
3837
  "code_execution_call",
3842
3838
  "url_context_call",
3843
3839
  "file_search_call",
3844
3840
  "google_maps_call",
3845
3841
  "mcp_server_tool_call"
3846
- ], On = [
3842
+ ], kn = [
3847
3843
  "google_search_result",
3848
3844
  "code_execution_result",
3849
3845
  "url_context_result",
3850
3846
  "file_search_result",
3851
3847
  "google_maps_result",
3852
3848
  "mcp_server_tool_result"
3853
- ], kn = () => I([
3854
- N({
3849
+ ], An = () => {
3850
+ let e = N({
3855
3851
  type: q("user_input"),
3856
- content: c(En()).nullish()
3857
- }).loose(),
3858
- N({
3852
+ content: c(Dn()).nullish()
3853
+ }).loose(), t = N({
3859
3854
  type: q("model_output"),
3860
- content: c(En()).nullish()
3861
- }).loose(),
3862
- N({
3855
+ content: c(Dn()).nullish()
3856
+ }).loose(), n = N({
3863
3857
  type: q("function_call"),
3864
3858
  id: W(),
3865
3859
  name: W(),
3866
3860
  arguments: K(W(), R()).nullish(),
3867
3861
  signature: W().nullish()
3868
- }).loose(),
3869
- N({
3862
+ }).loose(), r = N({
3870
3863
  type: q("thought"),
3871
3864
  signature: W().nullish(),
3872
- summary: c(Tn()).nullish()
3873
- }).loose(),
3874
- N({
3865
+ summary: c(En()).nullish()
3866
+ }).loose(), i = N({
3875
3867
  type: q("processing_call"),
3876
3868
  id: W(),
3877
3869
  signature: W().nullish()
3878
- }).loose(),
3879
- N({
3870
+ }).loose(), a = N({
3880
3871
  type: q("processing_result"),
3881
3872
  call_id: W(),
3882
3873
  signature: W().nullish()
3883
- }).loose(),
3884
- N({
3885
- type: D(Dn),
3874
+ }).loose(), o = N({
3875
+ type: D(On),
3886
3876
  id: W(),
3887
3877
  arguments: K(W(), R()).nullish(),
3888
3878
  name: W().nullish(),
3889
3879
  server_name: W().nullish(),
3890
3880
  search_type: W().nullish(),
3891
3881
  signature: W().nullish()
3892
- }).loose(),
3893
- N({
3894
- type: D(On),
3882
+ }).loose(), s = N({
3883
+ type: D(kn),
3895
3884
  call_id: W(),
3896
3885
  result: R().nullish(),
3897
3886
  is_error: k().nullish(),
3898
3887
  name: W().nullish(),
3899
3888
  server_name: W().nullish(),
3900
3889
  signature: W().nullish()
3901
- }).loose(),
3902
- N({ type: W() }).loose()
3903
- ]), An = G(() => t(N({
3890
+ }).loose();
3891
+ return I([
3892
+ e,
3893
+ t,
3894
+ n,
3895
+ r,
3896
+ i,
3897
+ a,
3898
+ o,
3899
+ s,
3900
+ N({ type: W() }).loose()
3901
+ ]);
3902
+ }, jn = G(() => t(N({
3904
3903
  id: W().nullish(),
3905
3904
  created: W().nullish(),
3906
3905
  updated: W().nullish(),
3907
- status: Cn(),
3906
+ status: wn(),
3908
3907
  model: W().nullish(),
3909
3908
  agent: W().nullish(),
3910
- steps: c(kn()).nullish(),
3911
- usage: Sn().nullish(),
3909
+ steps: c(An()).nullish(),
3910
+ usage: Cn().nullish(),
3912
3911
  service_tier: W().nullish(),
3913
3912
  previous_interaction_id: W().nullish(),
3914
3913
  response_modalities: c(W()).nullish()
3915
- }).loose())), jn = G(() => t((() => {
3916
- let e = Cn(), t = wn(), n = Tn(), r = N({
3914
+ }).loose())), Mn = G(() => t((() => {
3915
+ let e = wn(), t = Tn(), n = En(), r = N({
3917
3916
  event_type: q("interaction.created"),
3918
3917
  event_id: W().nullish(),
3919
3918
  interaction: N({
@@ -3927,7 +3926,7 @@ var xn = () => N({
3927
3926
  event_type: q("step.start"),
3928
3927
  event_id: W().nullish(),
3929
3928
  index: B(),
3930
- step: kn()
3929
+ step: An()
3931
3930
  }).loose(), a = N({
3932
3931
  type: q("text"),
3933
3932
  text: W()
@@ -3945,103 +3944,103 @@ var xn = () => N({
3945
3944
  }).loose(), u = N({
3946
3945
  type: D(["text_annotation_delta", "text_annotation"]),
3947
3946
  annotations: c(t).nullish()
3948
- }).loose(), d = I([
3947
+ }).loose(), d = N({
3948
+ type: q("image"),
3949
+ data: W().nullish(),
3950
+ mime_type: W().nullish(),
3951
+ resolution: D([
3952
+ "low",
3953
+ "medium",
3954
+ "high",
3955
+ "ultra_high"
3956
+ ]).nullish(),
3957
+ uri: W().nullish()
3958
+ }).loose(), f = N({
3959
+ type: q("video"),
3960
+ data: W().nullish(),
3961
+ mime_type: W().nullish(),
3962
+ uri: W().nullish()
3963
+ }).loose(), p = N({
3964
+ type: D(On),
3965
+ id: W().nullish(),
3966
+ arguments: K(W(), R()).nullish(),
3967
+ name: W().nullish(),
3968
+ server_name: W().nullish(),
3969
+ search_type: W().nullish(),
3970
+ signature: W().nullish()
3971
+ }).loose(), m = N({
3972
+ type: D(kn),
3973
+ call_id: W().nullish(),
3974
+ result: R().nullish(),
3975
+ is_error: k().nullish(),
3976
+ name: W().nullish(),
3977
+ server_name: W().nullish(),
3978
+ signature: W().nullish()
3979
+ }).loose(), h = N({ type: W() }).loose(), g = I([
3949
3980
  a,
3950
- N({
3951
- type: q("image"),
3952
- data: W().nullish(),
3953
- mime_type: W().nullish(),
3954
- resolution: D([
3955
- "low",
3956
- "medium",
3957
- "high",
3958
- "ultra_high"
3959
- ]).nullish(),
3960
- uri: W().nullish()
3961
- }).loose(),
3962
- N({
3963
- type: q("video"),
3964
- data: W().nullish(),
3965
- mime_type: W().nullish(),
3966
- uri: W().nullish()
3967
- }).loose(),
3981
+ d,
3982
+ f,
3968
3983
  o,
3969
3984
  s,
3970
3985
  l,
3971
3986
  u,
3972
- N({
3973
- type: D(Dn),
3987
+ p,
3988
+ m,
3989
+ h
3990
+ ]), _ = N({
3991
+ event_type: q("step.delta"),
3992
+ event_id: W().nullish(),
3993
+ index: B(),
3994
+ delta: g
3995
+ }).loose(), v = N({
3996
+ event_type: q("step.stop"),
3997
+ event_id: W().nullish(),
3998
+ index: B()
3999
+ }).loose(), y = N({
4000
+ event_type: q("interaction.status_update"),
4001
+ event_id: W().nullish(),
4002
+ interaction_id: W().nullish(),
4003
+ status: e.nullish()
4004
+ }).loose(), b = N({
4005
+ event_type: q("interaction.in_progress"),
4006
+ event_id: W().nullish(),
4007
+ interaction_id: W().nullish(),
4008
+ status: e.nullish()
4009
+ }).loose(), x = N({
4010
+ event_type: q("interaction.requires_action"),
4011
+ event_id: W().nullish(),
4012
+ interaction_id: W().nullish(),
4013
+ status: e.nullish()
4014
+ }).loose(), S = N({
4015
+ event_type: q("interaction.completed"),
4016
+ event_id: W().nullish(),
4017
+ interaction: N({
3974
4018
  id: W().nullish(),
3975
- arguments: K(W(), R()).nullish(),
3976
- name: W().nullish(),
3977
- server_name: W().nullish(),
3978
- search_type: W().nullish(),
3979
- signature: W().nullish()
3980
- }).loose(),
3981
- N({
3982
- type: D(On),
3983
- call_id: W().nullish(),
3984
- result: R().nullish(),
3985
- is_error: k().nullish(),
3986
- name: W().nullish(),
3987
- server_name: W().nullish(),
3988
- signature: W().nullish()
3989
- }).loose(),
3990
- N({ type: W() }).loose()
3991
- ]);
4019
+ status: e.nullish(),
4020
+ usage: Cn().nullish(),
4021
+ service_tier: W().nullish()
4022
+ }).loose()
4023
+ }).loose(), C = N({
4024
+ event_type: q("error"),
4025
+ event_id: W().nullish(),
4026
+ error: N({
4027
+ code: W().nullish(),
4028
+ message: W().nullish()
4029
+ }).loose().nullish()
4030
+ }).loose(), w = N({ event_type: W() }).loose();
3992
4031
  return I([
3993
4032
  r,
3994
4033
  i,
3995
- N({
3996
- event_type: q("step.delta"),
3997
- event_id: W().nullish(),
3998
- index: B(),
3999
- delta: d
4000
- }).loose(),
4001
- N({
4002
- event_type: q("step.stop"),
4003
- event_id: W().nullish(),
4004
- index: B()
4005
- }).loose(),
4006
- N({
4007
- event_type: q("interaction.status_update"),
4008
- event_id: W().nullish(),
4009
- interaction_id: W().nullish(),
4010
- status: e.nullish()
4011
- }).loose(),
4012
- N({
4013
- event_type: q("interaction.in_progress"),
4014
- event_id: W().nullish(),
4015
- interaction_id: W().nullish(),
4016
- status: e.nullish()
4017
- }).loose(),
4018
- N({
4019
- event_type: q("interaction.requires_action"),
4020
- event_id: W().nullish(),
4021
- interaction_id: W().nullish(),
4022
- status: e.nullish()
4023
- }).loose(),
4024
- N({
4025
- event_type: q("interaction.completed"),
4026
- event_id: W().nullish(),
4027
- interaction: N({
4028
- id: W().nullish(),
4029
- status: e.nullish(),
4030
- usage: Sn().nullish(),
4031
- service_tier: W().nullish()
4032
- }).loose()
4033
- }).loose(),
4034
- N({
4035
- event_type: q("error"),
4036
- event_id: W().nullish(),
4037
- error: N({
4038
- code: W().nullish(),
4039
- message: W().nullish()
4040
- }).loose().nullish()
4041
- }).loose(),
4042
- N({ event_type: W() }).loose()
4034
+ _,
4035
+ v,
4036
+ y,
4037
+ b,
4038
+ x,
4039
+ S,
4040
+ C,
4041
+ w
4043
4042
  ]);
4044
- })())), Mn = G(() => t(N({
4043
+ })())), Nn = G(() => t(N({
4045
4044
  previousInteractionId: W().nullish(),
4046
4045
  store: k().nullish(),
4047
4046
  agent: W().nullish(),
@@ -4184,14 +4183,14 @@ function Q({ signature: e, interactionId: t, processingId: n, processingCallId:
4184
4183
  let i = {};
4185
4184
  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 } } : {};
4186
4185
  }
4187
- var Nn = new Set([
4186
+ var Pn = /* @__PURE__ */ new Set([
4188
4187
  "google_search_call",
4189
4188
  "code_execution_call",
4190
4189
  "url_context_call",
4191
4190
  "file_search_call",
4192
4191
  "google_maps_call",
4193
4192
  "mcp_server_tool_call"
4194
- ]), Pn = new Set([
4193
+ ]), Fn = /* @__PURE__ */ new Set([
4195
4194
  "google_search_result",
4196
4195
  "code_execution_result",
4197
4196
  "url_context_result",
@@ -4199,13 +4198,13 @@ var Nn = new Set([
4199
4198
  "google_maps_result",
4200
4199
  "mcp_server_tool_result"
4201
4200
  ]);
4202
- function Fn(e) {
4201
+ function In(e) {
4203
4202
  return e.replace(/_call$/, "");
4204
4203
  }
4205
- function In(e) {
4204
+ function Ln(e) {
4206
4205
  return e.replace(/_result$/, "");
4207
4206
  }
4208
- function Ln({ steps: e, generateId: t, interactionId: n }) {
4207
+ function Rn({ steps: e, generateId: t, interactionId: n }) {
4209
4208
  let r = [], i = !1;
4210
4209
  if (e == null) return {
4211
4210
  content: r,
@@ -4228,7 +4227,7 @@ function Ln({ steps: e, generateId: t, interactionId: n }) {
4228
4227
  text: e,
4229
4228
  ...Q({ interactionId: n })
4230
4229
  });
4231
- let o = dn({
4230
+ let o = fn({
4232
4231
  annotations: a,
4233
4232
  generateId: t
4234
4233
  });
@@ -4328,8 +4327,8 @@ function Ln({ steps: e, generateId: t, interactionId: n }) {
4328
4327
  });
4329
4328
  break;
4330
4329
  }
4331
- default: if (Nn.has(e)) {
4332
- let n = a, i = e === "mcp_server_tool_call" ? n.name ?? "mcp_server_tool" : Fn(e), o = JSON.stringify(n.arguments ?? {});
4330
+ default: if (Pn.has(e)) {
4331
+ let n = a, i = e === "mcp_server_tool_call" ? n.name ?? "mcp_server_tool" : In(e), o = JSON.stringify(n.arguments ?? {});
4333
4332
  r.push({
4334
4333
  type: "tool-call",
4335
4334
  toolCallId: n.id || t(),
@@ -4337,15 +4336,15 @@ function Ln({ steps: e, generateId: t, interactionId: n }) {
4337
4336
  input: o,
4338
4337
  providerExecuted: !0
4339
4338
  });
4340
- } else if (Pn.has(e)) {
4341
- let n = a, i = e === "mcp_server_tool_result" ? n.name ?? "mcp_server_tool" : In(e);
4339
+ } else if (Fn.has(e)) {
4340
+ let n = a, i = e === "mcp_server_tool_result" ? n.name ?? "mcp_server_tool" : Ln(e);
4342
4341
  r.push({
4343
4342
  type: "tool-result",
4344
4343
  toolCallId: n.call_id || t(),
4345
4344
  toolName: i,
4346
4345
  result: n.result ?? null
4347
4346
  });
4348
- let o = un({
4347
+ let o = dn({
4349
4348
  block: a,
4350
4349
  generateId: t
4351
4350
  });
@@ -4358,8 +4357,8 @@ function Ln({ steps: e, generateId: t, interactionId: n }) {
4358
4357
  hasFunctionCall: i
4359
4358
  };
4360
4359
  }
4361
- var Rn = () => globalThis.fetch;
4362
- async function zn({ baseURL: e, interactionId: t, headers: n, fetch: r = Rn() }) {
4360
+ var zn = () => globalThis.fetch;
4361
+ async function Bn({ baseURL: e, interactionId: t, headers: n, fetch: r = zn() }) {
4363
4362
  if (t == null || t.length === 0) return;
4364
4363
  let i = `${e}/interactions/${encodeURIComponent(t)}/cancel`;
4365
4364
  try {
@@ -4373,16 +4372,16 @@ async function zn({ baseURL: e, interactionId: t, headers: n, fetch: r = Rn() })
4373
4372
  } catch {}
4374
4373
  } catch {}
4375
4374
  }
4376
- var Bn = new Set([
4375
+ var Vn = /* @__PURE__ */ new Set([
4377
4376
  "completed",
4378
4377
  "failed",
4379
4378
  "cancelled",
4380
4379
  "incomplete"
4381
4380
  ]);
4382
- function Vn(e) {
4383
- return e != null && Bn.has(e);
4381
+ function Hn(e) {
4382
+ return e != null && Vn.has(e);
4384
4383
  }
4385
- function Hn({ response: e, warnings: t, generateId: n, includeRawChunks: r, headerServiceTier: i }) {
4384
+ function Un({ response: e, warnings: t, generateId: n, includeRawChunks: r, headerServiceTier: i }) {
4386
4385
  return new ReadableStream({ start(a) {
4387
4386
  a.enqueue({
4388
4387
  type: "stream-start",
@@ -4402,7 +4401,7 @@ function Hn({ response: e, warnings: t, generateId: n, includeRawChunks: r, head
4402
4401
  type: "raw",
4403
4402
  rawValue: e
4404
4403
  });
4405
- let { content: l, hasFunctionCall: u } = Ln({
4404
+ let { content: l, hasFunctionCall: u } = Rn({
4406
4405
  steps: e.steps ?? null,
4407
4406
  generateId: n,
4408
4407
  interactionId: o
@@ -4476,7 +4475,7 @@ function Hn({ response: e, warnings: t, generateId: n, includeRawChunks: r, head
4476
4475
  case "file": a.enqueue(e);
4477
4476
  }
4478
4477
  let p = e.service_tier ?? i, m = {
4479
- unified: fn({
4478
+ unified: pn({
4480
4479
  status: e.status,
4481
4480
  hasFunctionCall: u
4482
4481
  }),
@@ -4488,12 +4487,12 @@ function Hn({ response: e, warnings: t, generateId: n, includeRawChunks: r, head
4488
4487
  a.enqueue({
4489
4488
  type: "finish",
4490
4489
  finishReason: m,
4491
- usage: rn(e.usage),
4490
+ usage: an(e.usage),
4492
4491
  providerMetadata: h
4493
4492
  }), a.close();
4494
4493
  } });
4495
4494
  }
4496
- var Un = class e {
4495
+ var Wn = class e {
4497
4496
  constructor(e, t) {
4498
4497
  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;
4499
4498
  }
@@ -4528,7 +4527,7 @@ var Un = class e {
4528
4527
  let t = [], n = await j({
4529
4528
  provider: "google",
4530
4529
  providerOptions: e.providerOptions,
4531
- schema: Mn
4530
+ schema: Nn
4532
4531
  }), r = this.agent != null, i, a;
4533
4532
  if (r || (e.frequencyPenalty != null && t.push({
4534
4533
  type: "unsupported",
@@ -4655,17 +4654,19 @@ var Un = class e {
4655
4654
  i = n.tools, a = n.toolChoice, t.push(...n.toolWarnings);
4656
4655
  }
4657
4656
  let o = [];
4658
- if (e.responseFormat?.type === "json") if (r) t.push({
4659
- type: "other",
4660
- message: "google.interactions: structured output (responseFormat) is not supported when an agent is set; responseFormat will be ignored."
4661
- });
4662
- else {
4663
- let t = {
4664
- type: "text",
4665
- mime_type: "application/json",
4666
- ...e.responseFormat.schema == null ? {} : { schema: e.responseFormat.schema }
4667
- };
4668
- o.push(t);
4657
+ if (e.responseFormat?.type === "json") {
4658
+ if (r) t.push({
4659
+ type: "other",
4660
+ message: "google.interactions: structured output (responseFormat) is not supported when an agent is set; responseFormat will be ignored."
4661
+ });
4662
+ else {
4663
+ let t = {
4664
+ type: "text",
4665
+ mime_type: "application/json",
4666
+ ...e.responseFormat.schema == null ? {} : { schema: e.responseFormat.schema }
4667
+ };
4668
+ o.push(t);
4669
+ }
4669
4670
  }
4670
4671
  if (n?.responseFormat != null) for (let e of n.responseFormat) e.type === "text" ? o.push($({
4671
4672
  type: "text",
@@ -4729,14 +4730,14 @@ var Un = class e {
4729
4730
  text: n.text
4730
4731
  });
4731
4732
  else if (n.type === "file") {
4732
- let e = gn({
4733
+ let e = _n({
4733
4734
  part: n,
4734
4735
  warnings: i,
4735
4736
  mediaResolution: r
4736
4737
  });
4737
4738
  e != null && t.push(e);
4738
4739
  }
4739
- let n = bn(t);
4740
+ let n = xn(t);
4740
4741
  n.length > 0 && c.push({
4741
4742
  type: "user_input",
4742
4743
  content: n
@@ -4766,7 +4767,7 @@ var Un = class e {
4766
4767
  }] : void 0
4767
4768
  });
4768
4769
  } else if (a.type === "file") {
4769
- let e = gn({
4770
+ let e = _n({
4770
4771
  part: a,
4771
4772
  warnings: i,
4772
4773
  mediaResolution: r
@@ -4789,7 +4790,7 @@ var Un = class e {
4789
4790
  });
4790
4791
  } else if (a.type === "tool-call") {
4791
4792
  n();
4792
- let e = a.providerOptions?.google?.signature, t = typeof a.input == "string" ? _n(a.input) : a.input ?? {};
4793
+ let e = a.providerOptions?.google?.signature, t = typeof a.input == "string" ? vn(a.input) : a.input ?? {};
4793
4794
  c.push({
4794
4795
  type: "function_call",
4795
4796
  id: a.toolCallId,
@@ -4814,7 +4815,7 @@ var Un = class e {
4814
4815
  });
4815
4816
  continue;
4816
4817
  }
4817
- let e = vn({
4818
+ let e = yn({
4818
4819
  toolCallId: n.toolCallId,
4819
4820
  toolName: n.toolName,
4820
4821
  output: n.output,
@@ -4883,30 +4884,33 @@ var Un = class e {
4883
4884
  collaborative_planning: e.collaborativePlanning ?? void 0
4884
4885
  }) : e.type === "dynamic" && (p = { type: "dynamic" });
4885
4886
  }
4886
- if (n?.environment != null) if (r) if (typeof n.environment == "string") m = n.environment;
4887
- else {
4888
- let e = n.environment, t = e.sources?.map((e) => e.type === "inline" ? {
4889
- type: "inline",
4890
- content: e.content,
4891
- target: e.target
4892
- } : $({
4893
- type: e.type,
4894
- source: e.source,
4895
- target: e.target ?? void 0
4896
- })), r;
4897
- e.network === "disabled" ? r = "disabled" : e.network != null && (r = { allowlist: e.network.allowlist.map((e) => $({
4898
- domain: e.domain,
4899
- transform: e.transform ?? void 0
4900
- })) }), m = $({
4901
- type: "remote",
4902
- sources: t != null && t.length > 0 ? t : void 0,
4903
- network: r
4887
+ if (n?.environment != null) {
4888
+ if (r) {
4889
+ if (typeof n.environment == "string") m = n.environment;
4890
+ else {
4891
+ let e = n.environment, t = e.sources?.map((e) => e.type === "inline" ? {
4892
+ type: "inline",
4893
+ content: e.content,
4894
+ target: e.target
4895
+ } : $({
4896
+ type: e.type,
4897
+ source: e.source,
4898
+ target: e.target ?? void 0
4899
+ })), r;
4900
+ e.network === "disabled" ? r = "disabled" : e.network != null && (r = { allowlist: e.network.allowlist.map((e) => $({
4901
+ domain: e.domain,
4902
+ transform: e.transform ?? void 0
4903
+ })) }), m = $({
4904
+ type: "remote",
4905
+ sources: t != null && t.length > 0 ? t : void 0,
4906
+ network: r
4907
+ });
4908
+ }
4909
+ } else t.push({
4910
+ type: "other",
4911
+ message: "google.interactions: environment is only supported when an agent is set; environment will be omitted from the request body."
4904
4912
  });
4905
4913
  }
4906
- else t.push({
4907
- type: "other",
4908
- message: "google.interactions: environment is only supported when an agent is set; environment will be omitted from the request body."
4909
- });
4910
4914
  return {
4911
4915
  args: $({
4912
4916
  ...r ? { agent: this.agent } : { model: this.modelId },
@@ -4935,14 +4939,14 @@ var Un = class e {
4935
4939
  headers: l,
4936
4940
  body: t,
4937
4941
  failedResponseHandler: Y,
4938
- successfulResponseHandler: n(An),
4942
+ successfulResponseHandler: n(jn),
4939
4943
  abortSignal: e.abortSignal,
4940
4944
  fetch: this.config.fetch
4941
4945
  });
4942
- if (a && !Vn(d.status)) {
4946
+ if (a && !Hn(d.status)) {
4943
4947
  let t = await async function({ baseURL: e, interactionId: t, headers: r, fetch: i, abortSignal: a, initialDelayMs: o = 1e3, maxDelayMs: c = 1e4, timeoutMs: l = 18e5 }) {
4944
4948
  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.");
4945
- let u = Date.now(), d = o, f = `${e}/interactions/${encodeURIComponent(t)}`, p = () => zn({
4949
+ let u = Date.now(), d = o, f = `${e}/interactions/${encodeURIComponent(t)}`, p = () => Bn({
4946
4950
  baseURL: e,
4947
4951
  interactionId: t,
4948
4952
  headers: r,
@@ -4958,11 +4962,11 @@ var Un = class e {
4958
4962
  validateUrl: !1,
4959
4963
  headers: r,
4960
4964
  failedResponseHandler: Y,
4961
- successfulResponseHandler: n(An),
4965
+ successfulResponseHandler: n(jn),
4962
4966
  abortSignal: a,
4963
4967
  fetch: i
4964
4968
  });
4965
- if (Vn(e.status)) return {
4969
+ if (Hn(e.status)) return {
4966
4970
  response: e,
4967
4971
  rawResponse: o,
4968
4972
  responseHeaders: s
@@ -4982,17 +4986,17 @@ var Un = class e {
4982
4986
  });
4983
4987
  d = t.response, f = t.rawResponse, u = t.responseHeaders ?? u;
4984
4988
  }
4985
- let p = typeof d.id == "string" && d.id.length > 0 ? d.id : void 0, { content: m, hasFunctionCall: h } = Ln({
4989
+ let p = typeof d.id == "string" && d.id.length > 0 ? d.id : void 0, { content: m, hasFunctionCall: h } = Rn({
4986
4990
  steps: d.steps ?? null,
4987
4991
  generateId: this.config.generateId ?? i,
4988
4992
  interactionId: p
4989
4993
  }), _ = {
4990
- unified: fn({
4994
+ unified: pn({
4991
4995
  status: d.status,
4992
4996
  hasFunctionCall: h
4993
4997
  }),
4994
4998
  raw: d.status
4995
- }, v = d.service_tier ?? u?.["x-gemini-service-tier"] ?? void 0, y = an(d.usage), b = { google: {
4999
+ }, v = d.service_tier ?? u?.["x-gemini-service-tier"] ?? void 0, y = on(d.usage), b = { google: {
4996
5000
  ...p == null ? {} : { interactionId: p },
4997
5001
  ...v == null ? {} : { serviceTier: v },
4998
5002
  ...y == null ? {} : { outputTokensByModality: y }
@@ -5004,7 +5008,7 @@ var Un = class e {
5004
5008
  return {
5005
5009
  content: m,
5006
5010
  finishReason: _,
5007
- usage: rn(d.usage),
5011
+ usage: an(d.usage),
5008
5012
  warnings: r,
5009
5013
  providerMetadata: b,
5010
5014
  request: { body: t },
@@ -5035,10 +5039,10 @@ var Un = class e {
5035
5039
  headers: s,
5036
5040
  body: c,
5037
5041
  failedResponseHandler: Y,
5038
- successfulResponseHandler: y(jn),
5042
+ successfulResponseHandler: y(Mn),
5039
5043
  abortSignal: e.abortSignal,
5040
5044
  fetch: this.config.fetch
5041
- }), d = l?.["x-gemini-service-tier"], f = hn({
5045
+ }), d = l?.["x-gemini-service-tier"], f = gn({
5042
5046
  warnings: n,
5043
5047
  generateId: this.config.generateId ?? i,
5044
5048
  includeRawChunks: e.includeRawChunks,
@@ -5056,14 +5060,14 @@ var Un = class e {
5056
5060
  headers: a,
5057
5061
  body: e,
5058
5062
  failedResponseHandler: Y,
5059
- successfulResponseHandler: n(An),
5063
+ successfulResponseHandler: n(jn),
5060
5064
  abortSignal: o.abortSignal,
5061
5065
  fetch: this.config.fetch
5062
5066
  }), d = u.id;
5063
5067
  if (d == null || d.length === 0) throw Error("google.interactions: background POST response did not include an interaction id; cannot stream the result.");
5064
5068
  let f = l?.["x-gemini-service-tier"];
5065
- if (Vn(u.status)) return {
5066
- stream: Hn({
5069
+ if (Hn(u.status)) return {
5070
+ stream: Un({
5067
5071
  response: u,
5068
5072
  warnings: t,
5069
5073
  generateId: this.config.generateId ?? i,
@@ -5091,7 +5095,7 @@ var Un = class e {
5091
5095
  validateUrl: !1,
5092
5096
  headers: c,
5093
5097
  failedResponseHandler: Y,
5094
- successfulResponseHandler: y(jn),
5098
+ successfulResponseHandler: y(Mn),
5095
5099
  abortSignal: _,
5096
5100
  fetch: r
5097
5101
  });
@@ -5133,7 +5137,7 @@ var Un = class e {
5133
5137
  } catch (e) {
5134
5138
  c.error(e);
5135
5139
  } finally {
5136
- i?.removeEventListener("abort", h), u?.cancel().catch(() => {}), u = void 0, _.aborted && !d && await zn({
5140
+ i?.removeEventListener("abort", h), u?.cancel().catch(() => {}), u = void 0, _.aborted && !d && await Bn({
5137
5141
  baseURL: e,
5138
5142
  interactionId: t,
5139
5143
  headers: n,
@@ -5151,7 +5155,7 @@ var Un = class e {
5151
5155
  headers: a,
5152
5156
  fetch: this.config.fetch,
5153
5157
  abortSignal: o.abortSignal
5154
- }), m = hn({
5158
+ }), m = gn({
5155
5159
  warnings: t,
5156
5160
  generateId: this.config.generateId ?? i,
5157
5161
  includeRawChunks: o.includeRawChunks,
@@ -5169,15 +5173,15 @@ function $(e) {
5169
5173
  for (let [n, r] of Object.entries(e)) r !== void 0 && (t[n] = r);
5170
5174
  return t;
5171
5175
  }
5172
- function Wn(e) {
5176
+ function Gn(e) {
5173
5177
  let t = new URL(e), n = t.pathname.split("/"), r = n.at(-1);
5174
5178
  return r !== "v1beta" && r !== "v1alpha" || (n.pop(), t.pathname = n.join("/") || "/"), t;
5175
5179
  }
5176
- function Gn(e, t) {
5177
- let n = Wn(e);
5180
+ function Kn(e, t) {
5181
+ let n = Gn(e);
5178
5182
  return n.protocol = n.protocol === "https:" ? "wss:" : "ws:", n.pathname = `${n.pathname.replace(/\/$/, "")}/ws/${t}`, n;
5179
5183
  }
5180
- var Kn = class {
5184
+ var qn = class {
5181
5185
  constructor() {
5182
5186
  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;
5183
5187
  }
@@ -5333,7 +5337,7 @@ var Kn = class {
5333
5337
  }
5334
5338
  serializeClientEvent(e, t) {
5335
5339
  switch (e.type) {
5336
- case "session-update": return e.config.inputAudioFormat?.rate != null && (this.inputAudioRate = e.config.inputAudioFormat.rate), { setup: qn(e.config, t) };
5340
+ case "session-update": return e.config.inputAudioFormat?.rate != null && (this.inputAudioRate = e.config.inputAudioFormat.rate), { setup: Jn(e.config, t) };
5337
5341
  case "input-audio-append": return { realtimeInput: { audio: {
5338
5342
  data: e.audio,
5339
5343
  mimeType: `audio/pcm;rate=${this.inputAudioRate}`
@@ -5364,7 +5368,7 @@ var Kn = class {
5364
5368
  return null;
5365
5369
  }
5366
5370
  };
5367
- function qn(e, t) {
5371
+ function Jn(e, t) {
5368
5372
  let n = { model: X(t) }, { google: r, ...i } = e?.providerOptions ?? {}, a = ce(r) ? r : void 0, o = {};
5369
5373
  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) => ({
5370
5374
  name: e.name,
@@ -5379,25 +5383,27 @@ function qn(e, t) {
5379
5383
  ...c,
5380
5384
  thinkingLevel: "low"
5381
5385
  } : a?.thinkingConfig, u = () => {
5382
- l != null && (n.generationConfig = {
5383
- ...ce(n.generationConfig) ? n.generationConfig : o,
5386
+ if (l == null) return;
5387
+ let e = ce(n.generationConfig) ? n.generationConfig : o;
5388
+ n.generationConfig = {
5389
+ ...e,
5384
5390
  thinkingConfig: l
5385
- });
5391
+ };
5386
5392
  };
5387
5393
  return e?.providerOptions == null ? (u(), n) : (Object.assign(n, i), a?.translationConfig != null && (n.generationConfig = {
5388
5394
  ...ce(n.generationConfig) ? n.generationConfig : o,
5389
5395
  translationConfig: a.translationConfig
5390
5396
  }), u(), n);
5391
5397
  }
5392
- var Jn = class {
5398
+ var Yn = class {
5393
5399
  constructor(e, t) {
5394
- this.specificationVersion = "v4", this.mapper = new Kn(), this.modelId = e, this.provider = t.provider, this.config = t;
5400
+ this.specificationVersion = "v4", this.mapper = new qn(), this.modelId = e, this.provider = t.provider, this.config = t;
5395
5401
  }
5396
5402
  async doCreateClientSecret(e) {
5397
5403
  let t = this.config.fetch ?? fetch, n = this.config.headers()["x-goog-api-key"];
5398
5404
  if (!n) throw Error("Google Generative AI API key is required for realtime token creation.");
5399
- let r = Date.now(), i = 1e3 * (e.expiresAfterSeconds ?? 60), a = new Date(r + i).toISOString(), o = new Date(r + i + 18e5).toISOString(), s = qn(e.sessionConfig, this.modelId), c = await t(`${function(e) {
5400
- let t = Wn(e);
5405
+ let r = Date.now(), i = 1e3 * (e.expiresAfterSeconds ?? 60), a = new Date(r + i).toISOString(), o = new Date(r + i + 18e5).toISOString(), s = Jn(e.sessionConfig, this.modelId), c = await t(`${function(e) {
5406
+ let t = Gn(e);
5401
5407
  return t.pathname = `${t.pathname.replace(/\/$/, "")}/v1alpha/auth_tokens`, t.toString();
5402
5408
  }(this.config.baseURL)}?key=${encodeURIComponent(n)}`, {
5403
5409
  method: "POST",
@@ -5416,7 +5422,7 @@ var Jn = class {
5416
5422
  let l = await c.json();
5417
5423
  return {
5418
5424
  token: l.name,
5419
- url: (u = this.config.baseURL, Gn(u, "google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained").toString()),
5425
+ url: (u = this.config.baseURL, Kn(u, "google.ai.generativelanguage.v1alpha.GenerativeService.BidiGenerateContentConstrained").toString()),
5420
5426
  expiresAt: l.expireTime ? Math.floor(new Date(l.expireTime).getTime() / 1e3) : void 0
5421
5427
  };
5422
5428
  var u;
@@ -5431,23 +5437,23 @@ var Jn = class {
5431
5437
  return this.mapper.serializeClientEvent(e, this.modelId);
5432
5438
  }
5433
5439
  buildSessionConfig(e) {
5434
- return qn(e, this.modelId);
5440
+ return Jn(e, this.modelId);
5435
5441
  }
5436
- }, Yn = N({
5442
+ }, Xn = N({
5437
5443
  languageCodes: c(W()).optional(),
5438
5444
  customVocabulary: c(W()).optional(),
5439
5445
  wordTimestamp: k().optional(),
5440
5446
  diarization: k().optional(),
5441
5447
  mode: D(["SMART", "VERBATIM"]).optional()
5442
5448
  });
5443
- function Xn(e, t) {
5444
- let n = Gn(e, "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent");
5449
+ function Zn(e, t) {
5450
+ let n = Kn(e, "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent");
5445
5451
  return n.searchParams.set("key", t), n;
5446
5452
  }
5447
- function Zn(e) {
5453
+ function Qn(e) {
5448
5454
  return e.includes("-live");
5449
5455
  }
5450
- var Qn = class e {
5456
+ var $n = class e {
5451
5457
  constructor(e, t) {
5452
5458
  this.modelId = e, this.config = t, this.specificationVersion = "v4";
5453
5459
  }
@@ -5467,11 +5473,11 @@ var Qn = class e {
5467
5473
  return j({
5468
5474
  provider: "google",
5469
5475
  providerOptions: e,
5470
- schema: Yn
5476
+ schema: Xn
5471
5477
  });
5472
5478
  }
5473
5479
  async doGenerate(e) {
5474
- if (Zn(this.modelId)) throw new P({
5480
+ if (Qn(this.modelId)) throw new P({
5475
5481
  argument: "modelId",
5476
5482
  message: `Model '${this.modelId}' only supports streaming transcription. Use experimental_streamTranscribe, or a unary model such as 'gemini-3.5-transcribe'.`
5477
5483
  });
@@ -5496,7 +5502,7 @@ var Qn = class e {
5496
5502
  headers: L(this.config.headers ? await J(this.config.headers) : void 0, e.headers),
5497
5503
  body: i,
5498
5504
  failedResponseHandler: Y,
5499
- successfulResponseHandler: n(rr),
5505
+ successfulResponseHandler: n(ir),
5500
5506
  abortSignal: e.abortSignal,
5501
5507
  fetch: this.config.fetch
5502
5508
  }), c = "", l = [];
@@ -5504,7 +5510,7 @@ var Qn = class e {
5504
5510
  c += t.text;
5505
5511
  for (let e of t.annotations ?? []) {
5506
5512
  if (e.type !== "word_info") continue;
5507
- let t = tr(e.start_offset), n = tr(e.end_offset);
5513
+ let t = nr(e.start_offset), n = nr(e.end_offset);
5508
5514
  e.text != null && t != null && n != null && l.push({
5509
5515
  text: e.text,
5510
5516
  startSecond: t,
@@ -5528,7 +5534,7 @@ var Qn = class e {
5528
5534
  };
5529
5535
  }
5530
5536
  async doStream(e) {
5531
- if (!Zn(this.modelId)) throw new P({
5537
+ if (!Qn(this.modelId)) throw new P({
5532
5538
  argument: "modelId",
5533
5539
  message: `Model '${this.modelId}' does not support streaming transcription. Use a live model such as 'gemini-3.5-transcribe-live'.`
5534
5540
  });
@@ -5544,7 +5550,7 @@ var Qn = class e {
5544
5550
  if (i == null) throw Error("Google Generative AI API key is required for streaming transcription.");
5545
5551
  let a = Object.fromEntries(Object.entries(r).filter(([e]) => e.toLowerCase() !== "x-goog-api-key")), o = {
5546
5552
  model: X(this.modelId),
5547
- inputAudioTranscription: er(n) ?? {}
5553
+ inputAudioTranscription: tr(n) ?? {}
5548
5554
  };
5549
5555
  return {
5550
5556
  request: { body: o },
@@ -5552,9 +5558,9 @@ var Qn = class e {
5552
5558
  timestamp: t,
5553
5559
  modelId: this.modelId
5554
5560
  },
5555
- stream: $n({
5561
+ stream: er({
5556
5562
  webSocket: this.config.webSocket,
5557
- url: Xn(this.config.baseURL, i),
5563
+ url: Zn(this.config.baseURL, i),
5558
5564
  headers: a,
5559
5565
  setup: o,
5560
5566
  inputAudioRate: e.inputAudioFormat.rate ?? 16e3,
@@ -5567,7 +5573,7 @@ var Qn = class e {
5567
5573
  };
5568
5574
  }
5569
5575
  };
5570
- function $n({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5576
+ function er({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5571
5577
  let u = !1, f = () => {};
5572
5578
  return new ReadableStream({
5573
5579
  start: (p) => {
@@ -5670,39 +5676,39 @@ function $n({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
5670
5676
  }
5671
5677
  });
5672
5678
  }
5673
- function er(e) {
5679
+ function tr(e) {
5674
5680
  if (e == null) return;
5675
5681
  let t = {};
5676
5682
  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;
5677
5683
  }
5678
- function tr(e) {
5684
+ function nr(e) {
5679
5685
  if (e == null) return;
5680
5686
  let t = Number.parseFloat(e);
5681
5687
  return Number.isFinite(t) ? t : void 0;
5682
5688
  }
5683
- var nr = N({
5689
+ var rr = N({
5684
5690
  type: W().nullish(),
5685
5691
  text: W().nullish(),
5686
5692
  speaker: W().nullish(),
5687
5693
  start_offset: W().nullish(),
5688
5694
  end_offset: W().nullish()
5689
- }), rr = N({
5695
+ }), ir = N({
5690
5696
  status: W().nullish(),
5691
5697
  steps: c(N({
5692
5698
  type: W().nullish(),
5693
5699
  content: c(N({
5694
5700
  type: W().nullish(),
5695
5701
  text: W().nullish(),
5696
- annotations: c(nr).nullish()
5702
+ annotations: c(rr).nullish()
5697
5703
  })).nullish()
5698
5704
  })).nullish(),
5699
5705
  usage: K(W(), R()).nullish()
5700
- }), ir = G(() => t(N({ echoTargetLanguage: k().optional() })));
5701
- function ar(e, t) {
5702
- let n = Gn(e, "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent");
5706
+ }), ar = G(() => t(N({ echoTargetLanguage: k().optional() })));
5707
+ function or(e, t) {
5708
+ let n = Kn(e, "google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent");
5703
5709
  return n.searchParams.set("key", t), n;
5704
5710
  }
5705
- var or = class e {
5711
+ var sr = class e {
5706
5712
  constructor(e, t) {
5707
5713
  this.specificationVersion = "v4", this.modelId = e, this.config = t;
5708
5714
  }
@@ -5726,7 +5732,7 @@ var or = class e {
5726
5732
  let t = this.config._internal?.currentDate?.() ?? /* @__PURE__ */ new Date(), n = await j({
5727
5733
  provider: "google",
5728
5734
  providerOptions: e.providerOptions,
5729
- schema: ir
5735
+ schema: ar
5730
5736
  }), r = [];
5731
5737
  (function(e) {
5732
5738
  if (e.type !== "audio/pcm" || e.rate != null && e.rate !== 16e3) throw new P({
@@ -5769,9 +5775,9 @@ var or = class e {
5769
5775
  timestamp: t,
5770
5776
  modelId: this.modelId
5771
5777
  },
5772
- stream: sr({
5778
+ stream: cr({
5773
5779
  webSocket: this.config.webSocket,
5774
- url: ar(this.config.baseURL, a),
5780
+ url: or(this.config.baseURL, a),
5775
5781
  headers: o,
5776
5782
  setup: s,
5777
5783
  inputAudioRate: e.inputAudioFormat.rate ?? 16e3,
@@ -5784,7 +5790,7 @@ var or = class e {
5784
5790
  };
5785
5791
  }
5786
5792
  };
5787
- function sr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5793
+ function cr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, finishGraceMs: a, warnings: o, audio: s, abortSignal: c, includeRawChunks: l }) {
5788
5794
  let u = !1, f = () => {};
5789
5795
  return new ReadableStream({
5790
5796
  start: (p) => {
@@ -5882,7 +5888,7 @@ function sr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
5882
5888
  id: j(),
5883
5889
  audio: e.inlineData.data
5884
5890
  });
5885
- let t = cr(e.inlineData.data);
5891
+ let t = lr(e.inlineData.data);
5886
5892
  if (E && t != null) {
5887
5893
  if (k += t, k >= a) return void I();
5888
5894
  } else P();
@@ -5907,7 +5913,7 @@ function sr({ webSocket: e, url: t, headers: n, setup: r, inputAudioRate: i, fin
5907
5913
  }
5908
5914
  });
5909
5915
  }
5910
- function cr(e) {
5916
+ function lr(e) {
5911
5917
  let t;
5912
5918
  try {
5913
5919
  t = ne(e);
@@ -5919,7 +5925,7 @@ function cr(e) {
5919
5925
  for (let e = 0; e < r; e++) if (Math.abs(n.getInt16(2 * e, !0)) > 128) return;
5920
5926
  return r / 24e3 * 1e3;
5921
5927
  }
5922
- var lr = /^https:\/\/generativelanguage\.googleapis\.com\/v1beta\/files\/.*$/, ur = [
5928
+ var ur = /^https:\/\/generativelanguage\.googleapis\.com\/v1beta\/files\/.*$/, dr = [
5923
5929
  "text/html",
5924
5930
  "text/css",
5925
5931
  "text/plain",
@@ -5942,8 +5948,8 @@ var lr = /^https:\/\/generativelanguage\.googleapis\.com\/v1beta\/files\/.*$/, u
5942
5948
  "video/webm",
5943
5949
  "video/wmv",
5944
5950
  "video/3gpp"
5945
- ], dr = /^https:\/\/.*$/;
5946
- function fr(e = {}) {
5951
+ ], fr = /^https:\/\/.*$/;
5952
+ function pr(e = {}) {
5947
5953
  let t = _e(e.baseURL) ?? "https://generativelanguage.googleapis.com/v1beta", n = e.name ?? "google.generative-ai", r = () => v({
5948
5954
  "x-goog-api-key": pe({
5949
5955
  apiKey: e.apiKey,
@@ -5955,12 +5961,12 @@ function fr(e = {}) {
5955
5961
  return /(^|\/)gemini-/.test(e) && !/(^|\/)gemini-2\.0/.test(e);
5956
5962
  }(e)) => ({
5957
5963
  "*": [
5958
- lr,
5964
+ ur,
5959
5965
  RegExp(`^${t}/files/.*$`),
5960
5966
  /* @__PURE__ */ RegExp("^https://(?:www\\.)?youtube\\.com/watch\\?v=[\\w-]+(?:&[\\w=&.-]*)?$"),
5961
5967
  /* @__PURE__ */ RegExp("^https://youtu\\.be/[\\w-]+(?:\\?[\\w=&.-]*)?$")
5962
5968
  ],
5963
- ...n ? Object.fromEntries(ur.map((e) => [e, [dr]])) : {}
5969
+ ...n ? Object.fromEntries(dr.map((e) => [e, [fr]])) : {}
5964
5970
  }), o = {
5965
5971
  provider: n,
5966
5972
  baseURL: t,
@@ -5986,22 +5992,22 @@ function fr(e = {}) {
5986
5992
  headers: r,
5987
5993
  fetch: e.fetch,
5988
5994
  generateId: e.generateId ?? i
5989
- }), d = (i) => new Jn(i, {
5995
+ }), d = (i) => new Yn(i, {
5990
5996
  provider: `${n}.realtime`,
5991
5997
  baseURL: t,
5992
5998
  headers: r,
5993
5999
  fetch: e.fetch
5994
- }), f = (i) => new or(i, {
6000
+ }), f = (i) => new sr(i, {
5995
6001
  provider: `${n}.speech-translation`,
5996
6002
  baseURL: t,
5997
6003
  headers: r,
5998
6004
  webSocket: e.webSocket
5999
- }), p = (i) => new tn(i, {
6005
+ }), p = (i) => new nn(i, {
6000
6006
  provider: `${n}.speech`,
6001
6007
  baseURL: t,
6002
6008
  headers: r,
6003
6009
  fetch: e.fetch
6004
- }), m = (i) => new Qn(i, {
6010
+ }), m = (i) => new $n(i, {
6005
6011
  provider: `${n}.transcription`,
6006
6012
  baseURL: t,
6007
6013
  headers: r,
@@ -6033,7 +6039,7 @@ function fr(e = {}) {
6033
6039
  baseURL: t,
6034
6040
  headers: r,
6035
6041
  fetch: e.fetch
6036
- }), g.speech = p, g.speechModel = p, g.transcription = m, g.transcriptionModel = m, g.translation = f, g.speechTranslationModel = f, g.interactions = (a) => new Un(a, {
6042
+ }), g.speech = p, g.speechModel = p, g.transcription = m, g.transcriptionModel = m, g.translation = f, g.speechTranslationModel = f, g.interactions = (a) => new Wn(a, {
6037
6043
  provider: `${n}.interactions`,
6038
6044
  baseURL: t,
6039
6045
  headers: r,
@@ -6041,5 +6047,5 @@ function fr(e = {}) {
6041
6047
  fetch: e.fetch
6042
6048
  }), g.tools = Bt, g;
6043
6049
  }
6044
- fr();
6045
- export { fr as createGoogle, fr as createGoogleGenerativeAI };
6050
+ pr();
6051
+ export { pr as createGoogle, pr as createGoogleGenerativeAI };