@gengage/assistant-fe 0.6.18 → 0.6.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/account-config-D_EMuR0g.js +1479 -0
- package/dist/agentic/context/context-store.d.ts +2 -1
- package/dist/agentic/index.d.ts +0 -1
- package/dist/agentic/index.js +155 -181
- package/dist/agentic/types.d.ts +6 -1
- package/dist/agentic/worker.d.ts +0 -2
- package/dist/agentic/worker.js +117 -415
- package/dist/agentic.iife.js +6 -6
- package/dist/{api-paths-CEDR4rld.js → api-paths-lIioK7-S.js} +1 -1
- package/dist/chat/components/InlineLauncher.d.ts +1 -1
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +1 -1
- package/dist/chat.js +1 -1
- package/dist/{common-BBgWfT-W.js → common-8WOyaL9-.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-B-doodzu.js → connection-warning-CBR0CWsY.js} +1 -1
- package/dist/{fastIntent-CloHPZQh.js → fastIntent-Dw79pmRK.js} +1 -1
- package/dist/index.js +10 -10
- package/dist/native.iife.js +1 -1
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{runtime-Ctqq0V6G.js → runtime-BsnZ6gt2.js} +3 -3
- package/dist/{runtime-BGCNkU1H.js → runtime-D5Sj-_tA.js} +3 -3
- package/dist/{runtime-CbWCU424.js → runtime-w0f2VkzL.js} +3 -3
- package/dist/{simbut-Dh4cJysK.js → simbut-BvdJtzCu.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-B-sjHbL5.js → simrel-DU6a27g9.js} +1 -1
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +1 -1
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-CIJT5AiP.js → widget-base-BeWuIxD6.js} +1 -1
- package/package.json +4 -2
- package/dist/account-config-gj7_mF6Q.js +0 -1731
- package/dist/agentic/recipes/catalog-assistant-flow.d.ts +0 -50
- package/dist/agentic/recipes/input-text/actions.d.ts +0 -15
- package/dist/agentic/recipes/input-text/index.d.ts +0 -4
- package/dist/agentic/recipes/input-text/products.d.ts +0 -4
- package/dist/agentic/recipes/input-text/ranking.d.ts +0 -14
- package/dist/agentic/recipes/input-text/steps.d.ts +0 -31
package/dist/agentic/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as J, A as Ge, B as Ke, C as He, D as A, E as Je, F as ze, G as We, H as Qe, I as Ye, J as z, K as C, L as Ve, M as W, N as Q, O as Xe, P as Ze, Q as Y, R as et, S as tt, T as rt, U as nt, V, W as X, X as ot, Y as at, _ as st, a as it, b as ct, c as lt, d as ut, f as dt, g as ft, h as pt, i as gt, j as yt, k as mt, l as wt, m as ht, n as bt, o as St, p as Et, r as Pt, s as At, t as Rt, u as vt, v as Ut, w as xt, x as Tt, y as _t, z as kt } from "../account-config-D_EMuR0g.js";
|
|
2
2
|
var Z = 512, ee = 0.74;
|
|
3
3
|
function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: m }) {
|
|
4
4
|
let f = 1;
|
|
5
5
|
const u = /* @__PURE__ */ new Map();
|
|
6
|
-
return
|
|
6
|
+
return Y({
|
|
7
7
|
worker: t,
|
|
8
8
|
tools: p,
|
|
9
9
|
beacon: (l) => m?.({
|
|
@@ -27,20 +27,20 @@ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
|
|
|
27
27
|
s.type === "end" && u.delete(i);
|
|
28
28
|
}
|
|
29
29
|
}), (l, s, i, d) => {
|
|
30
|
-
const
|
|
31
|
-
u.set(
|
|
30
|
+
const y = f++;
|
|
31
|
+
u.set(y, s);
|
|
32
32
|
const g = () => {
|
|
33
|
-
u.delete(
|
|
34
|
-
id:
|
|
33
|
+
u.delete(y), t.postMessage({
|
|
34
|
+
id: y,
|
|
35
35
|
type: "abort"
|
|
36
36
|
});
|
|
37
|
-
},
|
|
37
|
+
}, h = (w) => {
|
|
38
38
|
if (i.aborted) {
|
|
39
39
|
g();
|
|
40
40
|
return;
|
|
41
41
|
}
|
|
42
42
|
t.postMessage({
|
|
43
|
-
id:
|
|
43
|
+
id: y,
|
|
44
44
|
type: "invoke",
|
|
45
45
|
accountId: e,
|
|
46
46
|
beUrl: r,
|
|
@@ -48,7 +48,7 @@ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
|
|
|
48
48
|
tokenBrokerUrl: o,
|
|
49
49
|
tokenBrokerAudience: a,
|
|
50
50
|
defaultLocale: c,
|
|
51
|
-
request:
|
|
51
|
+
request: w,
|
|
52
52
|
parentUrl: window.location.href
|
|
53
53
|
});
|
|
54
54
|
};
|
|
@@ -57,12 +57,12 @@ function te({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl
|
|
|
57
57
|
return;
|
|
58
58
|
}
|
|
59
59
|
if (i.addEventListener("abort", g, { once: !0 }), d) {
|
|
60
|
-
L(l, d).then(
|
|
61
|
-
u.delete(
|
|
60
|
+
L(l, d).then(h).catch((w) => {
|
|
61
|
+
u.delete(y), s.onError(w instanceof Error ? w : /* @__PURE__ */ new Error("Failed to read image attachment"));
|
|
62
62
|
});
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
h(l);
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
function re({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: a, defaultLocale: c, tools: p = {}, beacon: m }) {
|
|
@@ -77,44 +77,45 @@ function re({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBr
|
|
|
77
77
|
...o ? { tokenBrokerUrl: o } : {},
|
|
78
78
|
...a ? { tokenBrokerAudience: a } : {}
|
|
79
79
|
});
|
|
80
|
-
return async (i, d,
|
|
81
|
-
const
|
|
82
|
-
f ||= new
|
|
80
|
+
return async (i, d, y, g) => {
|
|
81
|
+
const h = await L(i || {}, g);
|
|
82
|
+
f ||= new z({
|
|
83
83
|
accountId: e,
|
|
84
|
-
locale:
|
|
84
|
+
locale: h?.locale || c,
|
|
85
85
|
parentUrl: window.location.href,
|
|
86
86
|
rpc: u,
|
|
87
|
-
persistentPanelKeys: t.contextPersistence?.panelKeys
|
|
87
|
+
persistentPanelKeys: t.contextPersistence?.panelKeys,
|
|
88
|
+
panelKeyLimits: t.contextPersistence?.panelKeyLimits
|
|
88
89
|
});
|
|
89
90
|
try {
|
|
90
|
-
await
|
|
91
|
-
request:
|
|
91
|
+
await Q({
|
|
92
|
+
request: h,
|
|
92
93
|
accountModule: {
|
|
93
94
|
...t,
|
|
94
95
|
accountId: e
|
|
95
96
|
},
|
|
96
97
|
contextStore: f,
|
|
97
|
-
beClient: { invoke({ op:
|
|
98
|
+
beClient: { invoke({ op: w, input: S, signal: U, cacheTtlS: G, cacheKey: K, browserCache: H }) {
|
|
98
99
|
return V({
|
|
99
100
|
beUrl: r,
|
|
100
101
|
accountId: e,
|
|
101
102
|
jwtProvider: s,
|
|
102
103
|
parentUrl: window.location.href,
|
|
103
|
-
op:
|
|
104
|
+
op: w,
|
|
104
105
|
input: S,
|
|
105
106
|
cacheTtlS: G,
|
|
106
|
-
cacheKey:
|
|
107
|
-
browserCache:
|
|
108
|
-
...
|
|
107
|
+
cacheKey: K,
|
|
108
|
+
browserCache: H,
|
|
109
|
+
...U ? { signal: U } : {}
|
|
109
110
|
});
|
|
110
111
|
} },
|
|
111
112
|
toolBridge: l,
|
|
112
|
-
emit: (
|
|
113
|
+
emit: (w) => E(d, w),
|
|
113
114
|
rpc: u,
|
|
114
|
-
signal:
|
|
115
|
+
signal: y
|
|
115
116
|
});
|
|
116
|
-
} catch (
|
|
117
|
-
|
|
117
|
+
} catch (w) {
|
|
118
|
+
y?.aborted || (E(d, X(w)), d.onDone());
|
|
118
119
|
}
|
|
119
120
|
};
|
|
120
121
|
}
|
|
@@ -123,7 +124,7 @@ function ne({ accountId: e, tools: t, beacon: r }) {
|
|
|
123
124
|
...o,
|
|
124
125
|
accountId: o.accountId || e
|
|
125
126
|
});
|
|
126
|
-
return ((o, a) =>
|
|
127
|
+
return ((o, a) => J(o, a, {
|
|
127
128
|
tools: t,
|
|
128
129
|
beacon: n,
|
|
129
130
|
memory: sessionStorage
|
|
@@ -154,7 +155,7 @@ function ae(e) {
|
|
|
154
155
|
async function se(e) {
|
|
155
156
|
const t = await ie(e);
|
|
156
157
|
return t || {
|
|
157
|
-
dataUrl: await
|
|
158
|
+
dataUrl: await j(e),
|
|
158
159
|
mime: e.type
|
|
159
160
|
};
|
|
160
161
|
}
|
|
@@ -170,7 +171,7 @@ async function ie(e) {
|
|
|
170
171
|
c.drawImage(t, 0, 0, n, o);
|
|
171
172
|
const p = await new Promise((m) => a.toBlob(m, "image/jpeg", ee));
|
|
172
173
|
return p ? {
|
|
173
|
-
dataUrl: await
|
|
174
|
+
dataUrl: await j(p),
|
|
174
175
|
mime: p.type || "image/jpeg"
|
|
175
176
|
} : null;
|
|
176
177
|
} catch {
|
|
@@ -179,7 +180,7 @@ async function ie(e) {
|
|
|
179
180
|
t?.close();
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
|
-
async function
|
|
183
|
+
async function j(e) {
|
|
183
184
|
const t = new Uint8Array(await e.arrayBuffer());
|
|
184
185
|
let r = "";
|
|
185
186
|
const n = 32768;
|
|
@@ -223,7 +224,7 @@ var le = "entries", ue = 1, de = {
|
|
|
223
224
|
session: "Current-visit tool context without raw tokens or PII-heavy payloads.",
|
|
224
225
|
local: "Small, non-sensitive capability facts or user preferences.",
|
|
225
226
|
indexedDb: "Larger product/search payload caches with short TTLs."
|
|
226
|
-
},
|
|
227
|
+
}, x = /* @__PURE__ */ new Map();
|
|
227
228
|
function P() {
|
|
228
229
|
return Date.now();
|
|
229
230
|
}
|
|
@@ -260,7 +261,7 @@ function ge(e, t, r) {
|
|
|
260
261
|
} catch {
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
|
-
function
|
|
264
|
+
function T(e) {
|
|
264
265
|
try {
|
|
265
266
|
return window[e];
|
|
266
267
|
} catch {
|
|
@@ -279,7 +280,7 @@ function _(e, t) {
|
|
|
279
280
|
}
|
|
280
281
|
};
|
|
281
282
|
}
|
|
282
|
-
function
|
|
283
|
+
function ye(e, t) {
|
|
283
284
|
const r = t.dbName || `gengage-${e}`, n = t.dbStore || le, o = t.dbVersion || ue, a = /* @__PURE__ */ new Map();
|
|
284
285
|
let c = null;
|
|
285
286
|
const p = () => "indexedDB" in window ? c || (c = new Promise((l) => {
|
|
@@ -293,22 +294,22 @@ function he(e, t) {
|
|
|
293
294
|
idbGet: async (l) => {
|
|
294
295
|
const s = await p();
|
|
295
296
|
return s ? new Promise((i) => {
|
|
296
|
-
const d = s.transaction(n, "readwrite").objectStore(n),
|
|
297
|
-
|
|
298
|
-
const g =
|
|
297
|
+
const d = s.transaction(n, "readwrite").objectStore(n), y = d.get(l);
|
|
298
|
+
y.onsuccess = () => {
|
|
299
|
+
const g = y.result;
|
|
299
300
|
if (!g || R(g)) {
|
|
300
301
|
g && d.delete(l), i(null);
|
|
301
302
|
return;
|
|
302
303
|
}
|
|
303
304
|
i(g.value);
|
|
304
|
-
},
|
|
305
|
+
}, y.onerror = () => i(null);
|
|
305
306
|
}) : null;
|
|
306
307
|
},
|
|
307
308
|
idbSet: async (l, s, i = {}) => {
|
|
308
309
|
const d = await p();
|
|
309
|
-
return d ? new Promise((
|
|
310
|
+
return d ? new Promise((y) => {
|
|
310
311
|
const g = d.transaction(n, "readwrite");
|
|
311
|
-
g.oncomplete = () =>
|
|
312
|
+
g.oncomplete = () => y(!0), g.onerror = () => y(!1), g.objectStore(n).put({
|
|
312
313
|
key: l,
|
|
313
314
|
...v(s, i.ttlMs)
|
|
314
315
|
});
|
|
@@ -320,17 +321,17 @@ function he(e, t) {
|
|
|
320
321
|
}
|
|
321
322
|
};
|
|
322
323
|
}
|
|
323
|
-
function
|
|
324
|
+
function M(e, t = {}) {
|
|
324
325
|
const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}), a = o[e];
|
|
325
326
|
if (a) return a;
|
|
326
|
-
const c =
|
|
327
|
-
|
|
327
|
+
const c = x.get(e) || ye(e, t);
|
|
328
|
+
x.set(e, c);
|
|
328
329
|
const p = t.sessionPrefix || `gengage:${e}:session:`, m = t.localPrefix || `gengage:${e}:local:`, u = {
|
|
329
330
|
get: (i) => {
|
|
330
331
|
const d = c.volatileEntries.get(i);
|
|
331
332
|
return d ? R(d) ? (c.volatileEntries.delete(i), null) : d.value : null;
|
|
332
333
|
},
|
|
333
|
-
set: (i, d,
|
|
334
|
+
set: (i, d, y = {}) => (c.volatileEntries.set(i, v(d, y.ttlMs)), !0),
|
|
334
335
|
remove: (i) => {
|
|
335
336
|
c.volatileEntries.delete(i);
|
|
336
337
|
},
|
|
@@ -342,8 +343,8 @@ function j(e, t = {}) {
|
|
|
342
343
|
}, s = {
|
|
343
344
|
accountId: e,
|
|
344
345
|
volatile: u,
|
|
345
|
-
session: _(
|
|
346
|
-
local: _(
|
|
346
|
+
session: _(T("sessionStorage"), p),
|
|
347
|
+
local: _(T("localStorage"), m),
|
|
347
348
|
indexedDb: l,
|
|
348
349
|
stableKey: A,
|
|
349
350
|
policy: {
|
|
@@ -356,10 +357,10 @@ function j(e, t = {}) {
|
|
|
356
357
|
return s;
|
|
357
358
|
}
|
|
358
359
|
var b = "__gengageAgentFetchBridge", me = 1e3 * 60 * 60 * 24 * 14;
|
|
359
|
-
function
|
|
360
|
+
function Ct({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache: n }) {
|
|
360
361
|
if (!e) throw new Error("accountId is required.");
|
|
361
362
|
if (typeof t != "function") throw new Error("streamTransport is required.");
|
|
362
|
-
const o =
|
|
363
|
+
const o = we(), a = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, c = /* @__PURE__ */ new Set(), p = n ? Ae({
|
|
363
364
|
accountId: e,
|
|
364
365
|
endpointCache: n,
|
|
365
366
|
fetchImpl: o.originalFetch
|
|
@@ -378,11 +379,11 @@ function or({ accountId: e, streamTransport: t, endpoints: r = {}, endpointCache
|
|
|
378
379
|
middlewareUrl: a,
|
|
379
380
|
stop() {
|
|
380
381
|
for (const f of c) o.routes.delete(f);
|
|
381
|
-
|
|
382
|
+
he(o);
|
|
382
383
|
}
|
|
383
384
|
};
|
|
384
385
|
}
|
|
385
|
-
function
|
|
386
|
+
function we() {
|
|
386
387
|
const e = window, t = e[b];
|
|
387
388
|
if (t) return t;
|
|
388
389
|
const r = e.fetch.bind(e), n = {
|
|
@@ -395,7 +396,7 @@ function ye() {
|
|
|
395
396
|
return p ? Se(p, o, a) : r(o, a);
|
|
396
397
|
}, e.fetch = n.installedFetch, e[b] = n, n;
|
|
397
398
|
}
|
|
398
|
-
function
|
|
399
|
+
function he(e) {
|
|
399
400
|
if (e.routes.size > 0) return;
|
|
400
401
|
const t = window;
|
|
401
402
|
t.fetch === e.installedFetch && (t.fetch = e.originalFetch), t[b] === e && delete t[b];
|
|
@@ -407,11 +408,11 @@ function k(e, t) {
|
|
|
407
408
|
if (t?.signal) return t.signal;
|
|
408
409
|
if (typeof Request < "u" && e instanceof Request) return e.signal;
|
|
409
410
|
}
|
|
410
|
-
function
|
|
411
|
+
function $(e, t) {
|
|
411
412
|
return t?.body !== void 0 && t?.body !== null ? t.body : typeof Request < "u" && e instanceof Request ? e.clone().text() : null;
|
|
412
413
|
}
|
|
413
414
|
async function be(e, t) {
|
|
414
|
-
const r =
|
|
415
|
+
const r = $(e, t);
|
|
415
416
|
if (r instanceof FormData) {
|
|
416
417
|
const o = r.get("request"), a = r.get("attachment");
|
|
417
418
|
return {
|
|
@@ -440,8 +441,8 @@ async function Se(e, t, r) {
|
|
|
440
441
|
const g = await ve(e.endpointCache, d, f.signal);
|
|
441
442
|
if (g) return Ce(g);
|
|
442
443
|
}
|
|
443
|
-
const
|
|
444
|
-
return d &&
|
|
444
|
+
const y = await e.endpointHandler(s, i);
|
|
445
|
+
return d && y.ok && await Ue(e.endpointCache, d, y.clone(), f.signal), y;
|
|
445
446
|
} finally {
|
|
446
447
|
l?.();
|
|
447
448
|
}
|
|
@@ -473,18 +474,18 @@ async function Se(e, t, r) {
|
|
|
473
474
|
a.addEventListener("abort", i, { once: !0 }), p = () => a.removeEventListener("abort", i);
|
|
474
475
|
}
|
|
475
476
|
try {
|
|
476
|
-
const { request: i, attachment: d } = await be(t, r),
|
|
477
|
-
onTextChunk: (g,
|
|
477
|
+
const { request: i, attachment: d } = await be(t, r), y = e.streamTransport(i, {
|
|
478
|
+
onTextChunk: (g, h, w = {}) => u({
|
|
478
479
|
type: "text_chunk",
|
|
479
480
|
content: g,
|
|
480
|
-
final:
|
|
481
|
-
...
|
|
481
|
+
final: h === !0,
|
|
482
|
+
...w
|
|
482
483
|
}),
|
|
483
|
-
onUISpec: (g,
|
|
484
|
+
onUISpec: (g, h, w, S) => u({
|
|
484
485
|
type: "ui_spec",
|
|
485
486
|
spec: g,
|
|
486
|
-
widget:
|
|
487
|
-
...
|
|
487
|
+
widget: h,
|
|
488
|
+
...w ? { panelHint: w } : {},
|
|
488
489
|
...S ? { clearPanel: !0 } : {}
|
|
489
490
|
}),
|
|
490
491
|
onAction: (g) => {
|
|
@@ -504,7 +505,7 @@ async function Se(e, t, r) {
|
|
|
504
505
|
u({ type: "done" }), l();
|
|
505
506
|
}
|
|
506
507
|
}, o.signal, d);
|
|
507
|
-
Be(
|
|
508
|
+
Be(y) && (await y, o.signal.aborted || (u({ type: "done" }), l()));
|
|
508
509
|
} catch (i) {
|
|
509
510
|
o.signal.aborted || s(i);
|
|
510
511
|
}
|
|
@@ -519,7 +520,7 @@ async function Se(e, t, r) {
|
|
|
519
520
|
});
|
|
520
521
|
}
|
|
521
522
|
async function Ee(e, t) {
|
|
522
|
-
const r = await Promise.resolve(
|
|
523
|
+
const r = await Promise.resolve($(e, t));
|
|
523
524
|
return typeof r != "string" || r.trim() === "" ? {} : JSON.parse(r);
|
|
524
525
|
}
|
|
525
526
|
function Pe(e) {
|
|
@@ -564,23 +565,23 @@ function Re(e, t, r, n) {
|
|
|
564
565
|
async function ve(e, t, r) {
|
|
565
566
|
const n = F(e.accountId, t), o = await Le(e.accountId, n);
|
|
566
567
|
if (O(o)) return o;
|
|
567
|
-
const a = await
|
|
568
|
+
const a = await xe(e, t, r);
|
|
568
569
|
return a ? (await q(e.accountId, n, a, t.ttlMs), a) : null;
|
|
569
570
|
}
|
|
570
|
-
async function
|
|
571
|
+
async function Ue(e, t, r, n) {
|
|
571
572
|
try {
|
|
572
573
|
const o = await ke(r);
|
|
573
|
-
if (
|
|
574
|
+
if (Me(o.body)) return;
|
|
574
575
|
const a = F(e.accountId, t);
|
|
575
|
-
await q(e.accountId, a, o, t.ttlMs),
|
|
576
|
+
await q(e.accountId, a, o, t.ttlMs), Te(e, t, o, n);
|
|
576
577
|
} catch {
|
|
577
578
|
}
|
|
578
579
|
}
|
|
579
|
-
async function
|
|
580
|
+
async function xe(e, t, r) {
|
|
580
581
|
try {
|
|
581
582
|
const n = await e.fetchImpl(D(e.beUrl), {
|
|
582
583
|
method: "POST",
|
|
583
|
-
headers: await
|
|
584
|
+
headers: await I(e, r),
|
|
584
585
|
body: JSON.stringify({
|
|
585
586
|
partition: t.partition,
|
|
586
587
|
key: t.key
|
|
@@ -594,11 +595,11 @@ async function Ue(e, t, r) {
|
|
|
594
595
|
return null;
|
|
595
596
|
}
|
|
596
597
|
}
|
|
597
|
-
async function
|
|
598
|
+
async function Te(e, t, r, n) {
|
|
598
599
|
try {
|
|
599
600
|
await e.fetchImpl(D(e.beUrl), {
|
|
600
601
|
method: "POST",
|
|
601
|
-
headers: await
|
|
602
|
+
headers: await I(e, n),
|
|
602
603
|
body: JSON.stringify({
|
|
603
604
|
partition: t.partition,
|
|
604
605
|
key: t.key,
|
|
@@ -610,7 +611,7 @@ async function xe(e, t, r, n) {
|
|
|
610
611
|
} catch {
|
|
611
612
|
}
|
|
612
613
|
}
|
|
613
|
-
async function
|
|
614
|
+
async function I(e, t) {
|
|
614
615
|
return {
|
|
615
616
|
authorization: `Bearer ${await e.jwtProvider({
|
|
616
617
|
signal: t,
|
|
@@ -634,7 +635,7 @@ async function ke(e) {
|
|
|
634
635
|
return {
|
|
635
636
|
status: e.status,
|
|
636
637
|
statusText: e.statusText,
|
|
637
|
-
headers: [...e.headers.entries()].filter(([t]) =>
|
|
638
|
+
headers: [...e.headers.entries()].filter(([t]) => je(t)),
|
|
638
639
|
body: await e.text()
|
|
639
640
|
};
|
|
640
641
|
}
|
|
@@ -658,29 +659,29 @@ function F(e, t) {
|
|
|
658
659
|
})}`;
|
|
659
660
|
}
|
|
660
661
|
async function Le(e, t) {
|
|
661
|
-
const r =
|
|
662
|
+
const r = M(e);
|
|
662
663
|
return r.volatile.get(t) || await r.indexedDb.get(t) || r.local.get(t);
|
|
663
664
|
}
|
|
664
665
|
async function q(e, t, r, n) {
|
|
665
|
-
const o =
|
|
666
|
+
const o = M(e);
|
|
666
667
|
o.volatile.set(t, r, { ttlMs: n }), await o.indexedDb.set(t, r, { ttlMs: n }) || o.local.set(t, r, { ttlMs: n });
|
|
667
668
|
}
|
|
668
|
-
function
|
|
669
|
+
function je(e) {
|
|
669
670
|
return ["content-type", "cache-control"].includes(e.toLowerCase());
|
|
670
671
|
}
|
|
671
|
-
function
|
|
672
|
+
function Me(e) {
|
|
672
673
|
return /"_error"\s*:/u.test(e) || /"type"\s*:\s*"error"/u.test(e);
|
|
673
674
|
}
|
|
674
675
|
function Be(e) {
|
|
675
676
|
return e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
|
|
676
677
|
}
|
|
677
|
-
function
|
|
678
|
+
function Lt({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: a, defaultLocale: c = "en-GB", accountModule: p, tools: m = {}, beacon: f, allowBlobWorker: u = !1 }) {
|
|
678
679
|
if (!e) throw new Error("accountId is required.");
|
|
679
680
|
if (!t) throw new Error("beUrl is required. The injector owns backend URLs; the SDK has no default.");
|
|
680
681
|
if (!a) throw new Error("workerUrl is required.");
|
|
681
682
|
const l = window, s = l.GengageAssistantInjector || (l.GengageAssistantInjector = {}), i = s[e] || (s[e] = {});
|
|
682
683
|
if (i.agentController) return i.agentController;
|
|
683
|
-
const d = N(a) || u ?
|
|
684
|
+
const d = N(a) || u ? $e(a, `gengage-${e}-agent`, { allowBlobWorker: u }) : null;
|
|
684
685
|
d || f?.({
|
|
685
686
|
type: "agentRuntime",
|
|
686
687
|
accountId: e,
|
|
@@ -708,7 +709,7 @@ function ar({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
|
|
|
708
709
|
tools: m,
|
|
709
710
|
...f ? { beacon: f } : {}
|
|
710
711
|
});
|
|
711
|
-
const
|
|
712
|
+
const y = {
|
|
712
713
|
type: "agent",
|
|
713
714
|
stop() {
|
|
714
715
|
delete i.streamTransport, d?.worker.terminate(), d?.cleanup(), delete i.agentController;
|
|
@@ -725,13 +726,13 @@ function ar({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
|
|
|
725
726
|
};
|
|
726
727
|
}
|
|
727
728
|
};
|
|
728
|
-
return i.agentController =
|
|
729
|
+
return i.agentController = y, y;
|
|
729
730
|
}
|
|
730
731
|
function N(e) {
|
|
731
732
|
const t = new URL(e, window.location.href);
|
|
732
733
|
return t.origin === window.location.origin || t.protocol === "blob:";
|
|
733
734
|
}
|
|
734
|
-
function
|
|
735
|
+
function $e(e, t, r = {}) {
|
|
735
736
|
const n = new URL(e, window.location.href);
|
|
736
737
|
if (N(e)) return {
|
|
737
738
|
worker: new Worker(n.href, {
|
|
@@ -758,16 +759,16 @@ function Ie(e, t, r = {}) {
|
|
|
758
759
|
throw URL.revokeObjectURL(a), c;
|
|
759
760
|
}
|
|
760
761
|
}
|
|
761
|
-
function
|
|
762
|
+
function Ie(e, t, r = "v1") {
|
|
762
763
|
return `endpoint:${r}:${A({
|
|
763
764
|
endpoint: e,
|
|
764
765
|
request: t
|
|
765
766
|
})}`;
|
|
766
767
|
}
|
|
767
|
-
function
|
|
768
|
+
function jt(e) {
|
|
768
769
|
const t = e.version || "v1", r = (n) => (o) => ({
|
|
769
770
|
partition: `${e.partitionPrefix}/${n}`,
|
|
770
|
-
key:
|
|
771
|
+
key: Ie(n, o, t),
|
|
771
772
|
...e.ttlMs ? { ttlMs: e.ttlMs } : {}
|
|
772
773
|
});
|
|
773
774
|
return {
|
|
@@ -776,10 +777,10 @@ function sr(e) {
|
|
|
776
777
|
product_groupings: r("product_groupings")
|
|
777
778
|
};
|
|
778
779
|
}
|
|
779
|
-
function
|
|
780
|
+
function Mt(e) {
|
|
780
781
|
return { ...e };
|
|
781
782
|
}
|
|
782
|
-
function
|
|
783
|
+
function Bt(e, t = {}) {
|
|
783
784
|
return new Response(e.map((r) => JSON.stringify(r)).join(`
|
|
784
785
|
`) + `
|
|
785
786
|
`, {
|
|
@@ -790,7 +791,7 @@ function cr(e, t = {}) {
|
|
|
790
791
|
}
|
|
791
792
|
});
|
|
792
793
|
}
|
|
793
|
-
function
|
|
794
|
+
function $t(e, t = {}) {
|
|
794
795
|
return new Response(JSON.stringify(e), {
|
|
795
796
|
...t,
|
|
796
797
|
headers: {
|
|
@@ -803,12 +804,12 @@ function De(e) {
|
|
|
803
804
|
const t = (e?.chat || e?._chat)?.root || e?._chat?.root;
|
|
804
805
|
return t ? t.getRootNode?.()?.host || t : Array.from(document.querySelectorAll("*")).find((r) => r.shadowRoot?.querySelector?.(".gengage-chat-root, .gengage-chat-launcher-container"));
|
|
805
806
|
}
|
|
806
|
-
function
|
|
807
|
+
function It(e, t) {
|
|
807
808
|
const r = De(e);
|
|
808
809
|
r?.style && (t ? r.style.removeProperty("display") : r.style.setProperty("display", "none", "important")), t || (e?.chat || e?._chat)?.close?.();
|
|
809
810
|
}
|
|
810
811
|
var Oe = "nd_be_url";
|
|
811
|
-
function
|
|
812
|
+
function Dt(e, t) {
|
|
812
813
|
const r = Fe() || e.beUrl || t;
|
|
813
814
|
if (!r) throw new Error("resolveBeUrl: backend URL is required. The injector must supply a fallback URL; the SDK has no default.");
|
|
814
815
|
return r;
|
|
@@ -831,7 +832,7 @@ var qe = [
|
|
|
831
832
|
"searchGiftOptions",
|
|
832
833
|
"similaritySearch"
|
|
833
834
|
];
|
|
834
|
-
function
|
|
835
|
+
function Ot(e, t, r = {}) {
|
|
835
836
|
const n = window, o = n.gengage || (n.gengage = {}), a = o.tools || (o.tools = {});
|
|
836
837
|
a[e] = t;
|
|
837
838
|
for (const c of r.accountAliases || []) a[c] = t;
|
|
@@ -841,7 +842,7 @@ function fr(e, t, r = {}) {
|
|
|
841
842
|
}
|
|
842
843
|
return t;
|
|
843
844
|
}
|
|
844
|
-
function
|
|
845
|
+
function Ft({ getPageType: e, getProduct: t }) {
|
|
845
846
|
return () => ({
|
|
846
847
|
url: window.location.href,
|
|
847
848
|
title: document.title,
|
|
@@ -849,7 +850,7 @@ function pr({ getPageType: e, getProduct: t }) {
|
|
|
849
850
|
product: t()
|
|
850
851
|
});
|
|
851
852
|
}
|
|
852
|
-
function
|
|
853
|
+
function qt({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: a }) {
|
|
853
854
|
return async () => ({
|
|
854
855
|
accountId: e,
|
|
855
856
|
url: window.location.href,
|
|
@@ -861,7 +862,7 @@ function gr({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getS
|
|
|
861
862
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
862
863
|
});
|
|
863
864
|
}
|
|
864
|
-
function
|
|
865
|
+
function Nt({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o } = {}) {
|
|
865
866
|
if (!e) throw new Error("accountId is required.");
|
|
866
867
|
const a = o || e, c = window, p = () => {
|
|
867
868
|
const l = c.GengageInjectorConfig || {}, s = l[e] || {};
|
|
@@ -888,94 +889,67 @@ function hr({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
|
|
|
888
889
|
})), u.loaderPromise;
|
|
889
890
|
}
|
|
890
891
|
export {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
892
|
+
Qe as AgentError,
|
|
893
|
+
z as ContextStore,
|
|
894
|
+
ze as action,
|
|
894
895
|
ft as actionButtonsUiSpec,
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
rt as buildSimilarityQueries,
|
|
896
|
+
ct as alignProductsToTable,
|
|
897
|
+
Pt as anonymousRequestText,
|
|
898
|
+
nt as beErrorToAgentError,
|
|
899
|
+
lt as buildPhotoSimilarityProfile,
|
|
900
|
+
wt as buildProductSimilarityProfile,
|
|
901
|
+
vt as buildSimilarityQueries,
|
|
902
902
|
N as canUseModuleWorker,
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
gr as createDiagnosticsTool,
|
|
914
|
-
sr as createEndpointCachePolicies,
|
|
915
|
-
ir as createEndpointHandlers,
|
|
916
|
-
Xe as createFlow,
|
|
903
|
+
X as caughtToStreamError,
|
|
904
|
+
Rt as compactAccountConfig,
|
|
905
|
+
He as compactContextProducts,
|
|
906
|
+
Tt as comparisonResultForUi,
|
|
907
|
+
st as comparisonUiSpec,
|
|
908
|
+
M as createBrowserMemory,
|
|
909
|
+
qt as createDiagnosticsTool,
|
|
910
|
+
jt as createEndpointCachePolicies,
|
|
911
|
+
Mt as createEndpointHandlers,
|
|
912
|
+
pt as createFlow,
|
|
917
913
|
te as createInjectorAdapter,
|
|
918
914
|
re as createMainThreadInjectorAdapter,
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
St as
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
Ye as productDetailsUiSpec,
|
|
951
|
-
it as productFactsKey,
|
|
952
|
-
lt as productPanelActions,
|
|
953
|
-
$t as productQuestionSteps,
|
|
954
|
-
Mt as productRankScore,
|
|
955
|
-
nt as productSearchText,
|
|
956
|
-
Ge as productSkuKey,
|
|
957
|
-
dt as productsMatchingParams,
|
|
958
|
-
tt as productsUiSpec,
|
|
959
|
-
nr as rankSimilarProducts,
|
|
960
|
-
ot as rankedSearchProducts,
|
|
961
|
-
st as rankingTokens,
|
|
962
|
-
Ft as redactPii,
|
|
963
|
-
zt as requestText,
|
|
964
|
-
dr as resolveBeUrl,
|
|
965
|
-
Jt as resolveFlow,
|
|
966
|
-
Ke as scoreSimilarityCandidate,
|
|
967
|
-
_t as searchResultSteps,
|
|
968
|
-
Ut as searchSteps,
|
|
969
|
-
ur as setAssistantHostVisible,
|
|
915
|
+
$e as createModuleWorker,
|
|
916
|
+
Ft as createReadPageTool,
|
|
917
|
+
gt as defaultPiiPatternPack,
|
|
918
|
+
it as defaultPiiPatterns,
|
|
919
|
+
Ye as done,
|
|
920
|
+
at as elapsedMs,
|
|
921
|
+
Ie as endpointStableKey,
|
|
922
|
+
Ve as error,
|
|
923
|
+
We as httpErrorToAgentError,
|
|
924
|
+
Ot as installBrowserTools,
|
|
925
|
+
Ct as installFetchTransportBridge,
|
|
926
|
+
$t as jsonResponse,
|
|
927
|
+
xt as llmCacheKey,
|
|
928
|
+
et as metadata,
|
|
929
|
+
Lt as mountAccount,
|
|
930
|
+
Bt as ndjsonResponse,
|
|
931
|
+
tt as normalizeComparisonTable,
|
|
932
|
+
mt as normalizeProduct,
|
|
933
|
+
ut as normalizeSimilarityText,
|
|
934
|
+
ot as nowIso,
|
|
935
|
+
Ut as productDetailsUiSpec,
|
|
936
|
+
rt as productFactsKey,
|
|
937
|
+
Je as productSkuKey,
|
|
938
|
+
_t as productsUiSpec,
|
|
939
|
+
dt as rankSimilarProducts,
|
|
940
|
+
St as redactPii,
|
|
941
|
+
At as requestText,
|
|
942
|
+
Dt as resolveBeUrl,
|
|
943
|
+
Ze as resolveFlow,
|
|
944
|
+
Et as scoreSimilarityCandidate,
|
|
945
|
+
It as setAssistantHostVisible,
|
|
970
946
|
A as stableKey,
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
We as uniqueProducts,
|
|
980
|
-
Dt as withAccountConfig
|
|
947
|
+
Nt as startLazyRuntimeLoader,
|
|
948
|
+
kt as textChunk,
|
|
949
|
+
Xe as textKey,
|
|
950
|
+
ht as tokenizeSimilarityText,
|
|
951
|
+
Ge as trimProductFactsCore,
|
|
952
|
+
yt as trimProductFactsListCore,
|
|
953
|
+
Ke as uiSpec,
|
|
954
|
+
bt as withAccountConfig
|
|
981
955
|
};
|