@gengage/assistant-fe 0.6.14 → 0.6.17

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 (40) hide show
  1. package/dist/agentic/adaptor/fetch-bridge.d.ts +20 -1
  2. package/dist/agentic/index.js +517 -367
  3. package/dist/agentic/worker.js +18 -18
  4. package/dist/agentic.iife.js +5 -5
  5. package/dist/{api-paths-kwROurUu.js → api-paths-xsHH9jtm.js} +1 -1
  6. package/dist/chat/components/InlineLauncher.d.ts +152 -0
  7. package/dist/chat/index.d.ts +2 -0
  8. package/dist/chat/runtime.d.ts +3 -0
  9. package/dist/chat/types.d.ts +6 -0
  10. package/dist/chat-runtime.js +9 -9
  11. package/dist/chat.iife.js +160 -35
  12. package/dist/chat.js +13 -12
  13. package/dist/common/overlay.d.ts +2 -0
  14. package/dist/{common-DZuPNgWh.js → common-O0BUdXOn.js} +2 -2
  15. package/dist/common.js +7 -7
  16. package/dist/{connection-warning-Bg4gn-cq.js → connection-warning-DWMfjv0Y.js} +1 -1
  17. package/dist/{fastIntent-BSgLJDlW.js → fastIntent-RTSVRJhw.js} +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +16 -16
  20. package/dist/{native-webview-DbKq9lN8.js → native-webview-U9HtGabb.js} +1 -1
  21. package/dist/native.iife.js +140 -15
  22. package/dist/native.js +1 -1
  23. package/dist/{overlay-CyoB1K0w.js → overlay-ClYgI2Kl.js} +5 -5
  24. package/dist/overlay.js +1 -1
  25. package/dist/qna-runtime.js +1 -1
  26. package/dist/qna.iife.js +1 -1
  27. package/dist/qna.js +1 -1
  28. package/dist/{request-text-su3Vlhrs.js → request-text-DThlE-Xd.js} +106 -106
  29. package/dist/{runtime-CAJp9Ehc.js → runtime-BKU-NQXf.js} +2101 -1745
  30. package/dist/{runtime-KV5wCTc-.js → runtime-COh3CwNU.js} +3 -3
  31. package/dist/{runtime-DwQSV54I.js → runtime-n7fEJGDt.js} +3 -3
  32. package/dist/{simbut-Bm96zEAo.js → simbut-DaFCfvp7.js} +1 -1
  33. package/dist/simbut.iife.js +1 -1
  34. package/dist/simbut.js +1 -1
  35. package/dist/{simrel-C9sM9CCV.js → simrel-CX1JBDa5.js} +1 -1
  36. package/dist/simrel-runtime.js +1 -1
  37. package/dist/simrel.iife.js +1 -1
  38. package/dist/simrel.js +2 -2
  39. package/dist/{widget-base-TZjXRr3u.js → widget-base-DoZrhVze.js} +1 -1
  40. package/package.json +1 -1
@@ -1,138 +1,138 @@
1
- import { A as Pe, B as Re, C as F, D as ve, E as Ue, F as xe, H as I, I as O, M as Te, N as _e, O as Le, P as $, R as G, S as N, T as Ce, U as K, _ as je, a as H, b as Me, c as De, d as Be, f as ke, g as qe, h as Fe, i as Ie, j as z, k as Oe, l as $e, m as Ge, n as Ne, o as Ke, p as He, r as ze, s as We, t as Je, u as Qe, v as Ye, w as Ve, x as Xe, y as Ze, z as et } from "../request-text-su3Vlhrs.js";
2
- var W = 512, J = 0.74;
3
- function Q({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: i, tools: d = {}, beacon: w }) {
4
- let m = 1;
1
+ import { A as Ne, B as Ge, C as J, D as He, E as Ke, F as Je, H as z, I as k, M as ze, N as We, O as Qe, P as W, R as Q, S as Y, T as Ye, U as V, _ as L, a as Ve, b as Xe, c as Ze, d as et, f as tt, g as rt, h as nt, i as ot, j as X, k as at, l as st, m as it, n as ct, o as lt, p as ut, r as dt, s as ft, t as pt, u as gt, v as wt, w as yt, x as ht, y as mt, z as bt } from "../request-text-DThlE-Xd.js";
2
+ var Z = 512, ee = 0.74;
3
+ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: y }) {
4
+ let f = 1;
5
5
  const u = /* @__PURE__ */ new Map();
6
- return I({
6
+ return z({
7
7
  worker: t,
8
- tools: d,
9
- beacon: (l) => w?.({
8
+ tools: p,
9
+ beacon: (l) => y?.({
10
10
  ...l,
11
11
  accountId: l.accountId || e
12
12
  }),
13
13
  memory: sessionStorage
14
14
  }), t.addEventListener("message", (l) => {
15
- const s = l.data || {}, c = typeof s.id == "number" ? s.id : null;
16
- if (c == null) return;
17
- const f = u.get(c);
18
- if (f) {
15
+ const s = l.data || {}, i = typeof s.id == "number" ? s.id : null;
16
+ if (i == null) return;
17
+ const d = u.get(i);
18
+ if (d) {
19
19
  if (s.type === "event" && s.event) {
20
- E(f, s.event);
20
+ E(d, s.event);
21
21
  return;
22
22
  }
23
23
  if (s.type === "error") {
24
- f.onError(new Error(s.message || "Agent worker failed")), u.delete(c);
24
+ d.onError(new Error(s.message || "Agent worker failed")), u.delete(i);
25
25
  return;
26
26
  }
27
- s.type === "end" && u.delete(c);
27
+ s.type === "end" && u.delete(i);
28
28
  }
29
- }), (l, s, c, f) => {
30
- const p = m++;
31
- u.set(p, s);
29
+ }), (l, s, i, d) => {
30
+ const w = f++;
31
+ u.set(w, s);
32
32
  const g = () => {
33
- u.delete(p), t.postMessage({
34
- id: p,
33
+ u.delete(w), t.postMessage({
34
+ id: w,
35
35
  type: "abort"
36
36
  });
37
- }, y = (h) => {
38
- if (c.aborted) {
37
+ }, m = (h) => {
38
+ if (i.aborted) {
39
39
  g();
40
40
  return;
41
41
  }
42
42
  t.postMessage({
43
- id: p,
43
+ id: w,
44
44
  type: "invoke",
45
45
  accountId: e,
46
46
  beUrl: r,
47
47
  devJwtSecret: n,
48
48
  tokenBrokerUrl: o,
49
49
  tokenBrokerAudience: a,
50
- defaultLocale: i,
50
+ defaultLocale: c,
51
51
  request: h,
52
52
  parentUrl: window.location.href
53
53
  });
54
54
  };
55
- if (c.aborted) {
55
+ if (i.aborted) {
56
56
  g();
57
57
  return;
58
58
  }
59
- if (c.addEventListener("abort", g, { once: !0 }), f) {
60
- L(l, f).then(y).catch((h) => {
61
- u.delete(p), s.onError(h instanceof Error ? h : /* @__PURE__ */ new Error("Failed to read image attachment"));
59
+ if (i.addEventListener("abort", g, { once: !0 }), d) {
60
+ C(l, d).then(m).catch((h) => {
61
+ u.delete(w), s.onError(h instanceof Error ? h : /* @__PURE__ */ new Error("Failed to read image attachment"));
62
62
  });
63
63
  return;
64
64
  }
65
- y(l);
65
+ m(l);
66
66
  };
67
67
  }
68
- function Y({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: i, tools: d = {}, beacon: w }) {
69
- let m = null;
70
- const u = V({
68
+ function re({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: y }) {
69
+ let f = null;
70
+ const u = ne({
71
71
  accountId: e,
72
- tools: d,
73
- beacon: w
74
- }), l = N(u), s = O({
72
+ tools: p,
73
+ beacon: y
74
+ }), l = Y(u), s = k({
75
75
  accountId: e,
76
76
  ...n ? { devJwtSecret: n } : {},
77
77
  ...o ? { tokenBrokerUrl: o } : {},
78
78
  ...a ? { tokenBrokerAudience: a } : {}
79
79
  });
80
- return async (c, f, p, g) => {
81
- const y = await L(c || {}, g);
82
- m ||= new G({
80
+ return async (i, d, w, g) => {
81
+ const m = await C(i || {}, g);
82
+ f ||= new Q({
83
83
  accountId: e,
84
- locale: y?.locale || i,
84
+ locale: m?.locale || c,
85
85
  parentUrl: window.location.href,
86
86
  rpc: u,
87
87
  persistentPanelKeys: t.contextPersistence?.panelKeys
88
88
  });
89
89
  try {
90
- await F({
91
- request: y,
90
+ await J({
91
+ request: m,
92
92
  accountModule: {
93
93
  ...t,
94
94
  accountId: e
95
95
  },
96
- contextStore: m,
97
- beClient: { invoke({ op: h, input: S, signal: v, cacheTtlS: B, cacheKey: k, browserCache: q }) {
98
- return z({
96
+ contextStore: f,
97
+ beClient: { invoke({ op: h, input: S, signal: v, cacheTtlS: G, cacheKey: H, browserCache: K }) {
98
+ return X({
99
99
  beUrl: r,
100
100
  accountId: e,
101
101
  jwtProvider: s,
102
102
  parentUrl: window.location.href,
103
103
  op: h,
104
104
  input: S,
105
- cacheTtlS: B,
106
- cacheKey: k,
107
- browserCache: q,
105
+ cacheTtlS: G,
106
+ cacheKey: H,
107
+ browserCache: K,
108
108
  ...v ? { signal: v } : {}
109
109
  });
110
110
  } },
111
111
  toolBridge: l,
112
- emit: (h) => E(f, h),
112
+ emit: (h) => E(d, h),
113
113
  rpc: u,
114
- signal: p
114
+ signal: w
115
115
  });
116
116
  } catch (h) {
117
- p?.aborted || (E(f, $(h)), f.onDone());
117
+ w?.aborted || (E(d, W(h)), d.onDone());
118
118
  }
119
119
  };
120
120
  }
121
- function V({ accountId: e, tools: t, beacon: r }) {
121
+ function ne({ accountId: e, tools: t, beacon: r }) {
122
122
  const n = (o) => r?.({
123
123
  ...o,
124
124
  accountId: o.accountId || e
125
125
  });
126
- return ((o, a) => K(o, a, {
126
+ return ((o, a) => V(o, a, {
127
127
  tools: t,
128
128
  beacon: n,
129
129
  memory: sessionStorage
130
130
  }));
131
131
  }
132
- async function L(e, t) {
132
+ async function C(e, t) {
133
133
  if (!t || !t.type?.startsWith("image/")) return e;
134
- const r = await ee(t), n = {
135
- ...X(e.payload ?? e.action?.payload),
134
+ const r = await se(t), n = {
135
+ ...oe(e.payload ?? e.action?.payload),
136
136
  image_data_url: r.dataUrl,
137
137
  image_mime: r.mime
138
138
  };
@@ -145,33 +145,33 @@ async function L(e, t) {
145
145
  } } : {}
146
146
  };
147
147
  }
148
- function X(e) {
149
- return Z(e) ? { ...e } : typeof e == "string" ? { text: e } : {};
148
+ function oe(e) {
149
+ return ae(e) ? { ...e } : typeof e == "string" ? { text: e } : {};
150
150
  }
151
- function Z(e) {
151
+ function ae(e) {
152
152
  return typeof e == "object" && e !== null && !Array.isArray(e);
153
153
  }
154
- async function ee(e) {
155
- const t = await te(e);
154
+ async function se(e) {
155
+ const t = await ie(e);
156
156
  return t || {
157
- dataUrl: await C(e),
157
+ dataUrl: await M(e),
158
158
  mime: e.type
159
159
  };
160
160
  }
161
- async function te(e) {
161
+ async function ie(e) {
162
162
  if (typeof createImageBitmap != "function" || typeof document > "u") return null;
163
163
  let t = null;
164
164
  try {
165
165
  t = await createImageBitmap(e);
166
- const r = Math.min(1, W / Math.max(t.width, t.height)), n = Math.max(1, Math.round(t.width * r)), o = Math.max(1, Math.round(t.height * r)), a = document.createElement("canvas");
166
+ const r = Math.min(1, Z / Math.max(t.width, t.height)), n = Math.max(1, Math.round(t.width * r)), o = Math.max(1, Math.round(t.height * r)), a = document.createElement("canvas");
167
167
  a.width = n, a.height = o;
168
- const i = a.getContext("2d");
169
- if (!i) return null;
170
- i.drawImage(t, 0, 0, n, o);
171
- const d = await new Promise((w) => a.toBlob(w, "image/jpeg", J));
172
- return d ? {
173
- dataUrl: await C(d),
174
- mime: d.type || "image/jpeg"
168
+ const c = a.getContext("2d");
169
+ if (!c) return null;
170
+ c.drawImage(t, 0, 0, n, o);
171
+ const p = await new Promise((y) => a.toBlob(y, "image/jpeg", ee));
172
+ return p ? {
173
+ dataUrl: await M(p),
174
+ mime: p.type || "image/jpeg"
175
175
  } : null;
176
176
  } catch {
177
177
  return null;
@@ -179,7 +179,7 @@ async function te(e) {
179
179
  t?.close();
180
180
  }
181
181
  }
182
- async function C(e) {
182
+ async function M(e) {
183
183
  const t = new Uint8Array(await e.arrayBuffer());
184
184
  let r = "";
185
185
  const n = 32768;
@@ -205,7 +205,7 @@ function E(e, t) {
205
205
  e.onMetadata(t);
206
206
  break;
207
207
  case "error":
208
- e.onError(re(t));
208
+ e.onError(ce(t));
209
209
  break;
210
210
  case "done":
211
211
  e.onDone();
@@ -214,34 +214,175 @@ function E(e, t) {
214
214
  break;
215
215
  }
216
216
  }
217
- function re(e) {
217
+ function ce(e) {
218
218
  const t = new Error(e.message || e.code || "Agent error");
219
219
  return e.code && (t.code = e.code), t;
220
220
  }
221
- var b = "__gengageAgentFetchBridge";
222
- function tt({ accountId: e, streamTransport: t, endpoints: r = {} }) {
221
+ var le = "entries", ue = 1, de = {
222
+ volatile: "Hot per-page state and sensitive request context.",
223
+ session: "Current-visit tool context without raw tokens or PII-heavy payloads.",
224
+ local: "Small, non-sensitive capability facts or user preferences.",
225
+ indexedDb: "Larger product/search payload caches with short TTLs."
226
+ }, P = /* @__PURE__ */ new Map();
227
+ function A() {
228
+ return Date.now();
229
+ }
230
+ function U(e) {
231
+ return e?.expiresAt != null && e.expiresAt <= A();
232
+ }
233
+ function R(e, t) {
234
+ return {
235
+ value: e,
236
+ createdAt: A(),
237
+ expiresAt: t ? A() + t : null
238
+ };
239
+ }
240
+ function fe(e, t, r) {
241
+ try {
242
+ const n = e.getItem(`${t}${r}`);
243
+ if (!n) return null;
244
+ const o = JSON.parse(n);
245
+ return U(o) ? (e.removeItem(`${t}${r}`), null) : o.value;
246
+ } catch {
247
+ return null;
248
+ }
249
+ }
250
+ function pe(e, t, r, n, o) {
251
+ try {
252
+ return e.setItem(`${t}${r}`, JSON.stringify(R(n, o))), !0;
253
+ } catch {
254
+ return !1;
255
+ }
256
+ }
257
+ function ge(e, t, r) {
258
+ try {
259
+ e.removeItem(`${t}${r}`);
260
+ } catch {
261
+ }
262
+ }
263
+ function T(e) {
264
+ try {
265
+ return window[e];
266
+ } catch {
267
+ return null;
268
+ }
269
+ }
270
+ function x(e, t) {
271
+ return e ? {
272
+ get: (r) => fe(e, t, r),
273
+ set: (r, n, o = {}) => pe(e, t, r, n, o.ttlMs),
274
+ remove: (r) => ge(e, t, r)
275
+ } : {
276
+ get: () => null,
277
+ set: () => !1,
278
+ remove: () => {
279
+ }
280
+ };
281
+ }
282
+ function we(e, t) {
283
+ const r = t.dbName || `gengage-${e}`, n = t.dbStore || le, o = t.dbVersion || ue, a = /* @__PURE__ */ new Map();
284
+ let c = null;
285
+ const p = () => "indexedDB" in window ? c || (c = new Promise((l) => {
286
+ const s = indexedDB.open(r, o);
287
+ s.onupgradeneeded = () => {
288
+ s.result.createObjectStore(n, { keyPath: "key" });
289
+ }, s.onsuccess = () => l(s.result), s.onerror = () => l(null), s.onblocked = () => l(null);
290
+ }), c) : Promise.resolve(null);
291
+ return {
292
+ volatileEntries: a,
293
+ idbGet: async (l) => {
294
+ const s = await p();
295
+ return s ? new Promise((i) => {
296
+ const d = s.transaction(n, "readwrite").objectStore(n), w = d.get(l);
297
+ w.onsuccess = () => {
298
+ const g = w.result;
299
+ if (!g || U(g)) {
300
+ g && d.delete(l), i(null);
301
+ return;
302
+ }
303
+ i(g.value);
304
+ }, w.onerror = () => i(null);
305
+ }) : null;
306
+ },
307
+ idbSet: async (l, s, i = {}) => {
308
+ const d = await p();
309
+ return d ? new Promise((w) => {
310
+ const g = d.transaction(n, "readwrite");
311
+ g.oncomplete = () => w(!0), g.onerror = () => w(!1), g.objectStore(n).put({
312
+ key: l,
313
+ ...R(s, i.ttlMs)
314
+ });
315
+ }) : !1;
316
+ },
317
+ idbRemove: async (l) => {
318
+ const s = await p();
319
+ s && s.transaction(n, "readwrite").objectStore(n).delete(l);
320
+ }
321
+ };
322
+ }
323
+ function j(e, t = {}) {
324
+ const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}), a = o[e];
325
+ if (a) return a;
326
+ const c = P.get(e) || we(e, t);
327
+ P.set(e, c);
328
+ const p = t.sessionPrefix || `gengage:${e}:session:`, y = t.localPrefix || `gengage:${e}:local:`, u = {
329
+ get: (i) => {
330
+ const d = c.volatileEntries.get(i);
331
+ return d ? U(d) ? (c.volatileEntries.delete(i), null) : d.value : null;
332
+ },
333
+ set: (i, d, w = {}) => (c.volatileEntries.set(i, R(d, w.ttlMs)), !0),
334
+ remove: (i) => {
335
+ c.volatileEntries.delete(i);
336
+ },
337
+ clear: () => c.volatileEntries.clear()
338
+ }, l = {
339
+ get: c.idbGet,
340
+ set: c.idbSet,
341
+ remove: c.idbRemove
342
+ }, s = {
343
+ accountId: e,
344
+ volatile: u,
345
+ session: x(T("sessionStorage"), p),
346
+ local: x(T("localStorage"), y),
347
+ indexedDb: l,
348
+ stableKey: L,
349
+ policy: {
350
+ ...de,
351
+ ...t.policy || {}
352
+ }
353
+ };
354
+ o[e] = s;
355
+ for (const i of t.aliases || []) o[i] = s;
356
+ return s;
357
+ }
358
+ var b = "__gengageAgentFetchBridge", ye = 1e3 * 60 * 60 * 24 * 14;
359
+ function St({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache: n }) {
223
360
  if (!e) throw new Error("accountId is required.");
224
361
  if (typeof t != "function") throw new Error("streamTransport is required.");
225
- const n = ne(), o = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, a = /* @__PURE__ */ new Set(), i = (d) => {
226
- const w = `${o}/chat/${d}`;
227
- a.add(w);
228
- const m = r[d], u = {
362
+ const o = he(), a = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, c = /* @__PURE__ */ new Set(), p = n ? Ue({
363
+ accountId: e,
364
+ endpointCache: n,
365
+ fetchImpl: o.originalFetch
366
+ }) : void 0, y = (f) => {
367
+ const u = `${a}/chat/${f}`;
368
+ c.add(u);
369
+ const l = r[f], s = {
229
370
  streamTransport: t,
230
- endpoint: d
371
+ endpoint: f
231
372
  };
232
- m && (u.endpointHandler = m), n.routes.set(w, u);
373
+ l && (s.endpointHandler = l), p && (s.endpointCache = p), o.routes.set(u, s);
233
374
  };
234
- i("process_action");
235
- for (const d of Object.keys(r)) d !== "process_action" && i(d);
375
+ y("process_action");
376
+ for (const f of Object.keys(r)) f !== "process_action" && y(f);
236
377
  return {
237
- middlewareUrl: o,
378
+ middlewareUrl: a,
238
379
  stop() {
239
- for (const d of a) n.routes.delete(d);
240
- oe(n);
380
+ for (const f of c) o.routes.delete(f);
381
+ me(o);
241
382
  }
242
383
  };
243
384
  }
244
- function ne() {
385
+ function he() {
245
386
  const e = window, t = e[b];
246
387
  if (t) return t;
247
388
  const r = e.fetch.bind(e), n = {
@@ -250,27 +391,27 @@ function ne() {
250
391
  installedFetch: r
251
392
  };
252
393
  return n.installedFetch = (o, a) => {
253
- const i = j(o), d = n.routes.get(i);
254
- return d ? se(d, o, a) : r(o, a);
394
+ const c = B(o), p = n.routes.get(c);
395
+ return p ? Se(p, o, a) : r(o, a);
255
396
  }, e.fetch = n.installedFetch, e[b] = n, n;
256
397
  }
257
- function oe(e) {
398
+ function me(e) {
258
399
  if (e.routes.size > 0) return;
259
400
  const t = window;
260
401
  t.fetch === e.installedFetch && (t.fetch = e.originalFetch), t[b] === e && delete t[b];
261
402
  }
262
- function j(e) {
403
+ function B(e) {
263
404
  return typeof e == "string" ? e : e instanceof URL ? e.href : e?.url || "";
264
405
  }
265
- function U(e, t) {
406
+ function _(e, t) {
266
407
  if (t?.signal) return t.signal;
267
408
  if (typeof Request < "u" && e instanceof Request) return e.signal;
268
409
  }
269
- function M(e, t) {
410
+ function I(e, t) {
270
411
  return t?.body !== void 0 && t?.body !== null ? t.body : typeof Request < "u" && e instanceof Request ? e.clone().text() : null;
271
412
  }
272
- async function ae(e, t) {
273
- const r = M(e, t);
413
+ async function be(e, t) {
414
+ const r = I(e, t);
274
415
  if (r instanceof FormData) {
275
416
  const o = r.get("request"), a = r.get("attachment");
276
417
  return {
@@ -281,63 +422,68 @@ async function ae(e, t) {
281
422
  const n = await Promise.resolve(r);
282
423
  return typeof n == "string" ? { request: JSON.parse(n || "{}") } : { request: {} };
283
424
  }
284
- async function se(e, t, r) {
425
+ async function Se(e, t, r) {
285
426
  if (e.endpoint && e.endpoint !== "process_action" && e.endpointHandler) {
286
- const m = new AbortController(), u = U(t, r);
427
+ const f = new AbortController(), u = _(t, r);
287
428
  let l = null;
288
429
  if (u) {
289
- const s = () => m.abort();
430
+ const s = () => f.abort();
290
431
  u.aborted && s(), u.addEventListener("abort", s, { once: !0 }), l = () => u.removeEventListener("abort", s);
291
432
  }
292
433
  try {
293
- const s = await ie(t, r);
294
- return await e.endpointHandler(s, {
295
- accountId: ce(t),
434
+ const s = await Ee(t, r), i = {
435
+ accountId: Ae(t),
296
436
  endpoint: e.endpoint,
297
- signal: m.signal
298
- });
437
+ signal: f.signal
438
+ }, d = Re(e.endpointCache, e.endpoint, s, i.accountId);
439
+ if (d) {
440
+ const g = await ve(e.endpointCache, d, f.signal);
441
+ if (g) return Le(g);
442
+ }
443
+ const w = await e.endpointHandler(s, i);
444
+ return d && w.ok && await Pe(e.endpointCache, d, w.clone(), f.signal), w;
299
445
  } finally {
300
446
  l?.();
301
447
  }
302
448
  }
303
- const n = new TextEncoder(), o = new AbortController(), a = U(t, r);
304
- let i = !1, d = null;
305
- const w = new ReadableStream({
306
- async start(m) {
307
- const u = (c) => {
308
- i || m.enqueue(n.encode(`${JSON.stringify(c)}
449
+ const n = new TextEncoder(), o = new AbortController(), a = _(t, r);
450
+ let c = !1, p = null;
451
+ const y = new ReadableStream({
452
+ async start(f) {
453
+ const u = (i) => {
454
+ c || f.enqueue(n.encode(`${JSON.stringify(i)}
309
455
  `));
310
456
  }, l = () => {
311
- i || (i = !0, d?.(), m.close());
312
- }, s = (c) => {
457
+ c || (c = !0, p?.(), f.close());
458
+ }, s = (i) => {
313
459
  u({
314
460
  type: "error",
315
- code: c?.code || "agent_bridge_error",
316
- message: c instanceof Error ? c.message : String(c)
461
+ code: i?.code || "agent_bridge_error",
462
+ message: i instanceof Error ? i.message : String(i)
317
463
  }), u({ type: "done" }), l();
318
464
  };
319
465
  if (a) {
320
- const c = () => {
321
- o.abort(), i || (i = !0, d?.(), m.error(new DOMException("Aborted", "AbortError")));
466
+ const i = () => {
467
+ o.abort(), c || (c = !0, p?.(), f.error(new DOMException("Aborted", "AbortError")));
322
468
  };
323
469
  if (a.aborted) {
324
- c();
470
+ i();
325
471
  return;
326
472
  }
327
- a.addEventListener("abort", c, { once: !0 }), d = () => a.removeEventListener("abort", c);
473
+ a.addEventListener("abort", i, { once: !0 }), p = () => a.removeEventListener("abort", i);
328
474
  }
329
475
  try {
330
- const { request: c, attachment: f } = await ae(t, r), p = e.streamTransport(c, {
331
- onTextChunk: (g, y, h = {}) => u({
476
+ const { request: i, attachment: d } = await be(t, r), w = e.streamTransport(i, {
477
+ onTextChunk: (g, m, h = {}) => u({
332
478
  type: "text_chunk",
333
479
  content: g,
334
- final: y === !0,
480
+ final: m === !0,
335
481
  ...h
336
482
  }),
337
- onUISpec: (g, y, h, S) => u({
483
+ onUISpec: (g, m, h, S) => u({
338
484
  type: "ui_spec",
339
485
  spec: g,
340
- widget: y,
486
+ widget: m,
341
487
  ...h ? { panelHint: h } : {},
342
488
  ...S ? { clearPanel: !0 } : {}
343
489
  }),
@@ -357,74 +503,215 @@ async function se(e, t, r) {
357
503
  onDone: () => {
358
504
  u({ type: "done" }), l();
359
505
  }
360
- }, o.signal, f);
361
- le(p) && (await p, o.signal.aborted || (u({ type: "done" }), l()));
362
- } catch (c) {
363
- o.signal.aborted || s(c);
506
+ }, o.signal, d);
507
+ Be(w) && (await w, o.signal.aborted || (u({ type: "done" }), l()));
508
+ } catch (i) {
509
+ o.signal.aborted || s(i);
364
510
  }
365
511
  },
366
512
  cancel() {
367
- o.abort(), d?.(), i = !0;
513
+ o.abort(), p?.(), c = !0;
368
514
  }
369
515
  });
370
- return new Response(w, {
516
+ return new Response(y, {
371
517
  status: 200,
372
518
  headers: { "Content-Type": "application/x-ndjson" }
373
519
  });
374
520
  }
375
- async function ie(e, t) {
376
- const r = await Promise.resolve(M(e, t));
521
+ async function Ee(e, t) {
522
+ const r = await Promise.resolve(I(e, t));
377
523
  return typeof r != "string" || r.trim() === "" ? {} : JSON.parse(r);
378
524
  }
379
- function ce(e) {
525
+ function Ae(e) {
380
526
  try {
381
- const [t] = new URL(j(e)).pathname.split("/").filter(Boolean);
527
+ const [t] = new URL(B(e)).pathname.split("/").filter(Boolean);
382
528
  return decodeURIComponent(t || "");
383
529
  } catch {
384
530
  return "";
385
531
  }
386
532
  }
387
- function le(e) {
533
+ function Ue({ accountId: e, endpointCache: t, fetchImpl: r }) {
534
+ return {
535
+ accountId: e,
536
+ beUrl: t.beUrl,
537
+ ...t.parentUrl ? { parentUrl: t.parentUrl } : {},
538
+ ttlMs: t.ttlMs ?? ye,
539
+ policies: t.policies,
540
+ fetchImpl: r,
541
+ jwtProvider: k({
542
+ accountId: e,
543
+ ...t.devJwtSecret ? { devJwtSecret: t.devJwtSecret } : {},
544
+ ...t.tokenBrokerUrl ? { tokenBrokerUrl: t.tokenBrokerUrl } : {},
545
+ ...t.tokenBrokerAudience ? { tokenBrokerAudience: t.tokenBrokerAudience } : {},
546
+ fetchImpl: r
547
+ })
548
+ };
549
+ }
550
+ function Re(e, t, r, n) {
551
+ if (!e) return null;
552
+ const o = e.policies[t];
553
+ if (!o) return null;
554
+ const a = o(r, {
555
+ accountId: n,
556
+ endpoint: t
557
+ });
558
+ return !a?.partition || !a?.key ? null : {
559
+ partition: a.partition,
560
+ key: a.key,
561
+ ttlMs: a.ttlMs ?? e.ttlMs
562
+ };
563
+ }
564
+ async function ve(e, t, r) {
565
+ const n = F(e.accountId, t), o = await Ce(e.accountId, n);
566
+ if ($(o)) return o;
567
+ const a = await Te(e, t, r);
568
+ return a ? (await q(e.accountId, n, a, t.ttlMs), a) : null;
569
+ }
570
+ async function Pe(e, t, r, n) {
571
+ try {
572
+ const o = await ke(r);
573
+ if (je(o.body)) return;
574
+ const a = F(e.accountId, t);
575
+ await q(e.accountId, a, o, t.ttlMs), xe(e, t, o, n);
576
+ } catch {
577
+ }
578
+ }
579
+ async function Te(e, t, r) {
580
+ try {
581
+ const n = await e.fetchImpl(O(e.beUrl), {
582
+ method: "POST",
583
+ headers: await D(e, r),
584
+ body: JSON.stringify({
585
+ partition: t.partition,
586
+ key: t.key
587
+ }),
588
+ signal: r
589
+ });
590
+ if (!n.ok) return null;
591
+ const o = await n.json();
592
+ return o.hit === !0 && $(o.payload) ? o.payload : null;
593
+ } catch {
594
+ return null;
595
+ }
596
+ }
597
+ async function xe(e, t, r, n) {
598
+ try {
599
+ await e.fetchImpl(O(e.beUrl), {
600
+ method: "POST",
601
+ headers: await D(e, n),
602
+ body: JSON.stringify({
603
+ partition: t.partition,
604
+ key: t.key,
605
+ ttl_s: Math.max(1, Math.ceil(t.ttlMs / 1e3)),
606
+ payload: r
607
+ }),
608
+ signal: n
609
+ });
610
+ } catch {
611
+ }
612
+ }
613
+ async function D(e, t) {
614
+ return {
615
+ authorization: `Bearer ${await e.jwtProvider({
616
+ signal: t,
617
+ parentUrl: e.parentUrl || _e()
618
+ })}`,
619
+ "content-type": "application/json",
620
+ accept: "application/json"
621
+ };
622
+ }
623
+ function _e() {
624
+ try {
625
+ return window.location?.href || "";
626
+ } catch {
627
+ return "";
628
+ }
629
+ }
630
+ function O(e) {
631
+ return `${String(e).replace(/\/+$/u, "")}/v1/cache`;
632
+ }
633
+ async function ke(e) {
634
+ return {
635
+ status: e.status,
636
+ statusText: e.statusText,
637
+ headers: [...e.headers.entries()].filter(([t]) => Me(t)),
638
+ body: await e.text()
639
+ };
640
+ }
641
+ function Le(e) {
642
+ return new Response(e.body, {
643
+ status: e.status,
644
+ statusText: e.statusText,
645
+ headers: new Headers(e.headers)
646
+ });
647
+ }
648
+ function $(e) {
649
+ if (!e || typeof e != "object" || Array.isArray(e)) return !1;
650
+ const t = e;
651
+ return typeof t.status == "number" && typeof t.statusText == "string" && typeof t.body == "string" && Array.isArray(t.headers);
652
+ }
653
+ function F(e, t) {
654
+ return `endpoint-response:${L({
655
+ accountId: e,
656
+ partition: t.partition,
657
+ key: t.key
658
+ })}`;
659
+ }
660
+ async function Ce(e, t) {
661
+ const r = j(e);
662
+ return r.volatile.get(t) || await r.indexedDb.get(t) || r.local.get(t);
663
+ }
664
+ async function q(e, t, r, n) {
665
+ const o = j(e);
666
+ o.volatile.set(t, r, { ttlMs: n }), await o.indexedDb.set(t, r, { ttlMs: n }) || o.local.set(t, r, { ttlMs: n });
667
+ }
668
+ function Me(e) {
669
+ return ["content-type", "cache-control"].includes(e.toLowerCase());
670
+ }
671
+ function je(e) {
672
+ return /"_error"\s*:/u.test(e) || /"type"\s*:\s*"error"/u.test(e);
673
+ }
674
+ function Be(e) {
388
675
  return e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
389
676
  }
390
- function rt({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: a, defaultLocale: i = "en-GB", accountModule: d, tools: w = {}, beacon: m, allowBlobWorker: u = !1 }) {
677
+ function Et({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: a, defaultLocale: c = "en-GB", accountModule: p, tools: y = {}, beacon: f, allowBlobWorker: u = !1 }) {
391
678
  if (!e) throw new Error("accountId is required.");
392
679
  if (!t) throw new Error("beUrl is required. The injector owns backend URLs; the SDK has no default.");
393
680
  if (!a) throw new Error("workerUrl is required.");
394
- const l = window, s = l.GengageAssistantInjector || (l.GengageAssistantInjector = {}), c = s[e] || (s[e] = {});
395
- if (c.agentController) return c.agentController;
396
- const f = D(a) || u ? ue(a, `gengage-${e}-agent`, { allowBlobWorker: u }) : null;
397
- f || m?.({
681
+ const l = window, s = l.GengageAssistantInjector || (l.GengageAssistantInjector = {}), i = s[e] || (s[e] = {});
682
+ if (i.agentController) return i.agentController;
683
+ const d = N(a) || u ? Ie(a, `gengage-${e}-agent`, { allowBlobWorker: u }) : null;
684
+ d || f?.({
398
685
  type: "agentRuntime",
399
686
  accountId: e,
400
687
  transport: "main-thread",
401
688
  reason: "cross-origin-worker-url",
402
689
  workerUrl: a
403
- }), c.streamTransport = f ? Q({
690
+ }), i.streamTransport = d ? te({
404
691
  accountId: e,
405
- worker: f.worker,
692
+ worker: d.worker,
406
693
  beUrl: t,
407
694
  ...r ? { devJwtSecret: r } : {},
408
695
  ...n ? { tokenBrokerUrl: n } : {},
409
696
  ...o ? { tokenBrokerAudience: o } : {},
410
- defaultLocale: i,
411
- tools: w,
412
- ...m ? { beacon: m } : {}
413
- }) : Y({
697
+ defaultLocale: c,
698
+ tools: y,
699
+ ...f ? { beacon: f } : {}
700
+ }) : re({
414
701
  accountId: e,
415
- accountModule: d,
702
+ accountModule: p,
416
703
  beUrl: t,
417
704
  ...r ? { devJwtSecret: r } : {},
418
705
  ...n ? { tokenBrokerUrl: n } : {},
419
706
  ...o ? { tokenBrokerAudience: o } : {},
420
- defaultLocale: i,
421
- tools: w,
422
- ...m ? { beacon: m } : {}
707
+ defaultLocale: c,
708
+ tools: y,
709
+ ...f ? { beacon: f } : {}
423
710
  });
424
- const p = {
711
+ const w = {
425
712
  type: "agent",
426
713
  stop() {
427
- delete c.streamTransport, f?.worker.terminate(), f?.cleanup(), delete c.agentController;
714
+ delete i.streamTransport, d?.worker.terminate(), d?.cleanup(), delete i.agentController;
428
715
  },
429
716
  diagnostics() {
430
717
  return {
@@ -432,21 +719,21 @@ function rt({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
432
719
  beUrl: t,
433
720
  workerUrl: a,
434
721
  mounted: !0,
435
- transport: f ? "worker" : "main-thread",
436
- transportReason: f ? "module-worker" : "cross-origin-worker-url",
437
- flows: Object.keys(d?.flows || {})
722
+ transport: d ? "worker" : "main-thread",
723
+ transportReason: d ? "module-worker" : "cross-origin-worker-url",
724
+ flows: Object.keys(p?.flows || {})
438
725
  };
439
726
  }
440
727
  };
441
- return c.agentController = p, p;
728
+ return i.agentController = w, w;
442
729
  }
443
- function D(e) {
730
+ function N(e) {
444
731
  const t = new URL(e, window.location.href);
445
732
  return t.origin === window.location.origin || t.protocol === "blob:";
446
733
  }
447
- function ue(e, t, r = {}) {
734
+ function Ie(e, t, r = {}) {
448
735
  const n = new URL(e, window.location.href);
449
- if (D(e)) return {
736
+ if (N(e)) return {
450
737
  worker: new Worker(n.href, {
451
738
  type: "module",
452
739
  name: t
@@ -467,27 +754,27 @@ function ue(e, t, r = {}) {
467
754
  URL.revokeObjectURL(a);
468
755
  }
469
756
  };
470
- } catch (i) {
471
- throw URL.revokeObjectURL(a), i;
757
+ } catch (c) {
758
+ throw URL.revokeObjectURL(a), c;
472
759
  }
473
760
  }
474
- function de(e) {
761
+ function De(e) {
475
762
  const t = (e?.chat || e?._chat)?.root || e?._chat?.root;
476
763
  return t ? t.getRootNode?.()?.host || t : Array.from(document.querySelectorAll("*")).find((r) => r.shadowRoot?.querySelector?.(".gengage-chat-root, .gengage-chat-launcher-container"));
477
764
  }
478
- function nt(e, t) {
479
- const r = de(e);
765
+ function At(e, t) {
766
+ const r = De(e);
480
767
  r?.style && (t ? r.style.removeProperty("display") : r.style.setProperty("display", "none", "important")), t || (e?.chat || e?._chat)?.close?.();
481
768
  }
482
- var fe = "nd_be_url";
483
- function ot(e, t) {
484
- const r = ge() || e.beUrl || t;
769
+ var Oe = "nd_be_url";
770
+ function Ut(e, t) {
771
+ const r = $e() || e.beUrl || t;
485
772
  if (!r) throw new Error("resolveBeUrl: backend URL is required. The injector must supply a fallback URL; the SDK has no default.");
486
773
  return r;
487
774
  }
488
- function ge() {
775
+ function $e() {
489
776
  try {
490
- const e = new URLSearchParams(window.location.search).get(fe)?.trim();
777
+ const e = new URLSearchParams(window.location.search).get(Oe)?.trim();
491
778
  if (!e) return null;
492
779
  const t = new URL(e);
493
780
  return t.protocol !== "https:" && t.protocol !== "http:" ? null : t.toString().replace(/\/+$/u, "");
@@ -495,144 +782,7 @@ function ge() {
495
782
  return null;
496
783
  }
497
784
  }
498
- var me = "entries", pe = 1, we = {
499
- volatile: "Hot per-page state and sensitive request context.",
500
- session: "Current-visit tool context without raw tokens or PII-heavy payloads.",
501
- local: "Small, non-sensitive capability facts or user preferences.",
502
- indexedDb: "Larger product/search payload caches with short TTLs."
503
- }, x = /* @__PURE__ */ new Map();
504
- function A() {
505
- return Date.now();
506
- }
507
- function P(e) {
508
- return e?.expiresAt != null && e.expiresAt <= A();
509
- }
510
- function R(e, t) {
511
- return {
512
- value: e,
513
- createdAt: A(),
514
- expiresAt: t ? A() + t : null
515
- };
516
- }
517
- function he(e, t, r) {
518
- try {
519
- const n = e.getItem(`${t}${r}`);
520
- if (!n) return null;
521
- const o = JSON.parse(n);
522
- return P(o) ? (e.removeItem(`${t}${r}`), null) : o.value;
523
- } catch {
524
- return null;
525
- }
526
- }
527
- function ye(e, t, r, n, o) {
528
- try {
529
- return e.setItem(`${t}${r}`, JSON.stringify(R(n, o))), !0;
530
- } catch {
531
- return !1;
532
- }
533
- }
534
- function be(e, t, r) {
535
- try {
536
- e.removeItem(`${t}${r}`);
537
- } catch {
538
- }
539
- }
540
- function T(e) {
541
- try {
542
- return window[e];
543
- } catch {
544
- return null;
545
- }
546
- }
547
- function _(e, t) {
548
- return e ? {
549
- get: (r) => he(e, t, r),
550
- set: (r, n, o = {}) => ye(e, t, r, n, o.ttlMs),
551
- remove: (r) => be(e, t, r)
552
- } : {
553
- get: () => null,
554
- set: () => !1,
555
- remove: () => {
556
- }
557
- };
558
- }
559
- function Se(e, t) {
560
- const r = t.dbName || `gengage-${e}`, n = t.dbStore || me, o = t.dbVersion || pe, a = /* @__PURE__ */ new Map();
561
- let i = null;
562
- const d = () => "indexedDB" in window ? i || (i = new Promise((l) => {
563
- const s = indexedDB.open(r, o);
564
- s.onupgradeneeded = () => {
565
- s.result.createObjectStore(n, { keyPath: "key" });
566
- }, s.onsuccess = () => l(s.result), s.onerror = () => l(null), s.onblocked = () => l(null);
567
- }), i) : Promise.resolve(null);
568
- return {
569
- volatileEntries: a,
570
- idbGet: async (l) => {
571
- const s = await d();
572
- return s ? new Promise((c) => {
573
- const f = s.transaction(n, "readwrite").objectStore(n), p = f.get(l);
574
- p.onsuccess = () => {
575
- const g = p.result;
576
- if (!g || P(g)) {
577
- g && f.delete(l), c(null);
578
- return;
579
- }
580
- c(g.value);
581
- }, p.onerror = () => c(null);
582
- }) : null;
583
- },
584
- idbSet: async (l, s, c = {}) => {
585
- const f = await d();
586
- return f ? new Promise((p) => {
587
- const g = f.transaction(n, "readwrite");
588
- g.oncomplete = () => p(!0), g.onerror = () => p(!1), g.objectStore(n).put({
589
- key: l,
590
- ...R(s, c.ttlMs)
591
- });
592
- }) : !1;
593
- },
594
- idbRemove: async (l) => {
595
- const s = await d();
596
- s && s.transaction(n, "readwrite").objectStore(n).delete(l);
597
- }
598
- };
599
- }
600
- function at(e, t = {}) {
601
- const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}), a = o[e];
602
- if (a) return a;
603
- const i = x.get(e) || Se(e, t);
604
- x.set(e, i);
605
- const d = t.sessionPrefix || `gengage:${e}:session:`, w = t.localPrefix || `gengage:${e}:local:`, u = {
606
- get: (c) => {
607
- const f = i.volatileEntries.get(c);
608
- return f ? P(f) ? (i.volatileEntries.delete(c), null) : f.value : null;
609
- },
610
- set: (c, f, p = {}) => (i.volatileEntries.set(c, R(f, p.ttlMs)), !0),
611
- remove: (c) => {
612
- i.volatileEntries.delete(c);
613
- },
614
- clear: () => i.volatileEntries.clear()
615
- }, l = {
616
- get: i.idbGet,
617
- set: i.idbSet,
618
- remove: i.idbRemove
619
- }, s = {
620
- accountId: e,
621
- volatile: u,
622
- session: _(T("sessionStorage"), d),
623
- local: _(T("localStorage"), w),
624
- indexedDb: l,
625
- stableKey: H,
626
- policy: {
627
- ...we,
628
- ...t.policy || {}
629
- }
630
- };
631
- o[e] = s;
632
- for (const c of t.aliases || []) o[c] = s;
633
- return s;
634
- }
635
- var Ee = [
785
+ var Fe = [
636
786
  "addToCart",
637
787
  "search",
638
788
  "searchKeyword",
@@ -640,17 +790,17 @@ var Ee = [
640
790
  "searchGiftOptions",
641
791
  "similaritySearch"
642
792
  ];
643
- function st(e, t, r = {}) {
793
+ function Rt(e, t, r = {}) {
644
794
  const n = window, o = n.gengage || (n.gengage = {}), a = o.tools || (o.tools = {});
645
795
  a[e] = t;
646
- for (const i of r.accountAliases || []) a[i] = t;
647
- if (r.exposeStandardAliases !== !1) for (const i of r.standardAliases || Ee) {
648
- const d = t[i];
649
- typeof d == "function" && (a[i] = a[i] || d);
796
+ for (const c of r.accountAliases || []) a[c] = t;
797
+ if (r.exposeStandardAliases !== !1) for (const c of r.standardAliases || Fe) {
798
+ const p = t[c];
799
+ typeof p == "function" && (a[c] = a[c] || p);
650
800
  }
651
801
  return t;
652
802
  }
653
- function it({ getPageType: e, getProduct: t }) {
803
+ function vt({ getPageType: e, getProduct: t }) {
654
804
  return () => ({
655
805
  url: window.location.href,
656
806
  title: document.title,
@@ -658,7 +808,7 @@ function it({ getPageType: e, getProduct: t }) {
658
808
  product: t()
659
809
  });
660
810
  }
661
- function ct({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: a }) {
811
+ function Pt({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: a }) {
662
812
  return async () => ({
663
813
  accountId: e,
664
814
  url: window.location.href,
@@ -670,24 +820,24 @@ function ct({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getS
670
820
  timestamp: (/* @__PURE__ */ new Date()).toISOString()
671
821
  });
672
822
  }
673
- function lt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o } = {}) {
823
+ function Tt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o } = {}) {
674
824
  if (!e) throw new Error("accountId is required.");
675
- const a = o || e, i = window, d = () => {
676
- const l = i.GengageInjectorConfig || {}, s = l[e] || {};
825
+ const a = o || e, c = window, p = () => {
826
+ const l = c.GengageInjectorConfig || {}, s = l[e] || {};
677
827
  return {
678
828
  ...l,
679
829
  ...s
680
830
  };
681
- }, w = () => {
682
- const l = d();
831
+ }, y = () => {
832
+ const l = p();
683
833
  if (l.runtimeUrl) return l.runtimeUrl;
684
- const s = l.assetBaseUrl || l.baseUrl || document.currentScript?.getAttribute("src") || (n ? i[n] : null);
834
+ const s = l.assetBaseUrl || l.baseUrl || document.currentScript?.getAttribute("src") || (n ? c[n] : null);
685
835
  if (!s) throw new Error(`${a} runtime URL cannot be resolved.`);
686
836
  return new URL(t, s).href;
687
- }, m = i.GengageAssistantInjector || (i.GengageAssistantInjector = {}), u = m[e] || (m[e] = {});
837
+ }, f = c.GengageAssistantInjector || (c.GengageAssistantInjector = {}), u = f[e] || (f[e] = {});
688
838
  return u.loaderPromise || (u.loaderPromise = import(
689
839
  /* @vite-ignore */
690
- w()
840
+ y()
691
841
  ).then((l) => {
692
842
  const s = l[r];
693
843
  if (typeof s != "function") throw new Error(`${a} runtime export ${r} is unavailable.`);
@@ -697,52 +847,52 @@ function lt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
697
847
  })), u.loaderPromise;
698
848
  }
699
849
  export {
700
- Te as AgentError,
701
- G as ContextStore,
702
- Ce as action,
703
- Fe as actionButtonsUiSpec,
704
- _e as beErrorToAgentError,
705
- We as buildPhotoSimilarityProfile,
706
- De as buildProductSimilarityProfile,
707
- $e as buildSimilarityQueries,
708
- D as canUseModuleWorker,
709
- $ as caughtToStreamError,
710
- qe as comparisonUiSpec,
711
- at as createBrowserMemory,
712
- ct as createDiagnosticsTool,
713
- Ge as createFlow,
714
- Q as createInjectorAdapter,
715
- Y as createMainThreadInjectorAdapter,
716
- ue as createModuleWorker,
717
- it as createReadPageTool,
718
- Ue as done,
719
- et as elapsedMs,
720
- ve as error,
721
- xe as httpErrorToAgentError,
722
- st as installBrowserTools,
723
- tt as installFetchTransportBridge,
724
- Ne as llmCacheKey,
725
- Le as metadata,
726
- rt as mountAccount,
727
- Ze as normalizeProduct,
728
- Qe as normalizeSimilarityText,
729
- Re as nowIso,
730
- je as productDetailsUiSpec,
731
- ze as productFactsKey,
732
- Ie as productSkuKey,
733
- Ye as productsUiSpec,
734
- Be as rankSimilarProducts,
735
- Je as requestText,
736
- ot as resolveBeUrl,
737
- Ve as resolveFlow,
738
- ke as scoreSimilarityCandidate,
739
- nt as setAssistantHostVisible,
740
- H as stableKey,
741
- lt as startLazyRuntimeLoader,
742
- Oe as textChunk,
743
- Ke as textKey,
744
- He as tokenizeSimilarityText,
745
- Me as trimProductFactsCore,
746
- Xe as trimProductFactsListCore,
747
- Pe as uiSpec
850
+ ze as AgentError,
851
+ Q as ContextStore,
852
+ Ye as action,
853
+ gt as actionButtonsUiSpec,
854
+ We as beErrorToAgentError,
855
+ ct as buildPhotoSimilarityProfile,
856
+ dt as buildProductSimilarityProfile,
857
+ ot as buildSimilarityQueries,
858
+ N as canUseModuleWorker,
859
+ W as caughtToStreamError,
860
+ et as comparisonUiSpec,
861
+ j as createBrowserMemory,
862
+ Pt as createDiagnosticsTool,
863
+ st as createFlow,
864
+ te as createInjectorAdapter,
865
+ re as createMainThreadInjectorAdapter,
866
+ Ie as createModuleWorker,
867
+ vt as createReadPageTool,
868
+ Ke as done,
869
+ bt as elapsedMs,
870
+ He as error,
871
+ Je as httpErrorToAgentError,
872
+ Rt as installBrowserTools,
873
+ St as installFetchTransportBridge,
874
+ it as llmCacheKey,
875
+ Qe as metadata,
876
+ Et as mountAccount,
877
+ mt as normalizeProduct,
878
+ Ve as normalizeSimilarityText,
879
+ Ge as nowIso,
880
+ tt as productDetailsUiSpec,
881
+ nt as productFactsKey,
882
+ rt as productSkuKey,
883
+ ut as productsUiSpec,
884
+ lt as rankSimilarProducts,
885
+ pt as requestText,
886
+ Ut as resolveBeUrl,
887
+ yt as resolveFlow,
888
+ ft as scoreSimilarityCandidate,
889
+ At as setAssistantHostVisible,
890
+ L as stableKey,
891
+ Tt as startLazyRuntimeLoader,
892
+ at as textChunk,
893
+ wt as textKey,
894
+ Ze as tokenizeSimilarityText,
895
+ Xe as trimProductFactsCore,
896
+ ht as trimProductFactsListCore,
897
+ Ne as uiSpec
748
898
  };