@gengage/assistant-fe 0.6.7 → 0.6.8
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/README.md +1 -1
- package/dist/agentic/index.js +117 -116
- package/dist/agentic/types.d.ts +2 -0
- package/dist/agentic/worker/be-client.d.ts +2 -1
- package/dist/agentic/worker.js +49 -48
- package/dist/agentic.iife.js +4 -4
- package/dist/{api-paths-Dkah8jhG.js → api-paths-DXlenbou.js} +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-Buxw5G_i.js → common-BqxygI8c.js} +1 -1
- package/dist/common.js +5 -5
- package/dist/{connection-warning-CEm2TZpj.js → connection-warning-BX0ZcdJM.js} +1 -1
- package/dist/{fastIntent-HK3SqGgn.js → fastIntent-Dl9zgfsn.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-DEOej3zn.js → runtime-CbSp96W2.js} +3 -3
- package/dist/{runtime-Dir14P0o.js → runtime-DKBxlh-F.js} +3 -3
- package/dist/{runtime-OdW89-j-.js → runtime-_HRuAyrh.js} +3 -3
- package/dist/{simbut-DWvSKXQ7.js → simbut-DotkjkIQ.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{similarity-CfOr8nPO.js → similarity-XEVfAN-6.js} +211 -200
- package/dist/{simrel-DWV_87jY.js → simrel-CBnnj4Mm.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-Cafa292X.js → widget-base-BEXFI7CM.js} +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ npm run docs:build # Build contributor docs with Vit
|
|
|
147
147
|
```
|
|
148
148
|
|
|
149
149
|
This repo builds the SDK package only. Hosted account demos and exact client PDP/PLP clones live in
|
|
150
|
-
`gengage-assistant-injector` and are deployed from that repository to
|
|
150
|
+
`gengage-assistant-injector` and are deployed from that repository to gengage CDN location.
|
|
151
151
|
|
|
152
152
|
---
|
|
153
153
|
|
package/dist/agentic/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
var
|
|
3
|
-
function
|
|
1
|
+
import { A as B, C as Ae, D as I, E as Pe, F as Re, I as Ue, M as k, O as ve, P as F, R as G, S as Te, T as xe, _ as _e, a as Le, b as je, c as Ce, d as Me, f as $e, g as De, h as Oe, i as qe, j as Be, k as Ie, l as ke, m as Fe, n as Ge, o as Ne, p as He, r as Je, s as ze, t as We, u as Ke, v as N, w as Qe, x as Ye, y as H, z as J } from "../similarity-XEVfAN-6.js";
|
|
2
|
+
var z = 512, W = 0.74;
|
|
3
|
+
function K({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: s, defaultLocale: i, tools: d = {}, beacon: w }) {
|
|
4
4
|
let m = 1;
|
|
5
5
|
const u = /* @__PURE__ */ new Map();
|
|
6
|
-
return
|
|
6
|
+
return G({
|
|
7
7
|
worker: t,
|
|
8
8
|
tools: d,
|
|
9
9
|
beacon: (l) => w?.({
|
|
@@ -65,13 +65,13 @@ function W({ accountId: e, worker: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl:
|
|
|
65
65
|
h(l);
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function Q({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBrokerUrl: o, tokenBrokerAudience: s, defaultLocale: i, tools: d = {}, beacon: w }) {
|
|
69
69
|
let m = null;
|
|
70
|
-
const u =
|
|
70
|
+
const u = Y({
|
|
71
71
|
accountId: e,
|
|
72
72
|
tools: d,
|
|
73
73
|
beacon: w
|
|
74
|
-
}), l =
|
|
74
|
+
}), l = N(u), a = k({
|
|
75
75
|
accountId: e,
|
|
76
76
|
...n ? { devJwtSecret: n } : {},
|
|
77
77
|
...o ? { tokenBrokerUrl: o } : {},
|
|
@@ -79,22 +79,22 @@ function K({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBro
|
|
|
79
79
|
});
|
|
80
80
|
return async (c, f, p, g) => {
|
|
81
81
|
const h = await j(c || {}, g);
|
|
82
|
-
m ||= new
|
|
82
|
+
m ||= new F({
|
|
83
83
|
accountId: e,
|
|
84
84
|
locale: h?.locale || i,
|
|
85
85
|
parentUrl: window.location.href,
|
|
86
86
|
rpc: u
|
|
87
87
|
});
|
|
88
88
|
try {
|
|
89
|
-
await
|
|
89
|
+
await H({
|
|
90
90
|
request: h,
|
|
91
91
|
accountModule: {
|
|
92
92
|
...t,
|
|
93
93
|
accountId: e
|
|
94
94
|
},
|
|
95
95
|
contextStore: m,
|
|
96
|
-
beClient: { invoke({ op: y, input: b, signal: U, cacheTtlS: O }) {
|
|
97
|
-
return
|
|
96
|
+
beClient: { invoke({ op: y, input: b, signal: U, cacheTtlS: O, cacheKey: q }) {
|
|
97
|
+
return I({
|
|
98
98
|
beUrl: r,
|
|
99
99
|
accountId: e,
|
|
100
100
|
jwtProvider: a,
|
|
@@ -102,6 +102,7 @@ function K({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBro
|
|
|
102
102
|
op: y,
|
|
103
103
|
input: b,
|
|
104
104
|
cacheTtlS: O,
|
|
105
|
+
cacheKey: q,
|
|
105
106
|
...U ? { signal: U } : {}
|
|
106
107
|
});
|
|
107
108
|
} },
|
|
@@ -111,16 +112,16 @@ function K({ accountId: e, accountModule: t, beUrl: r, devJwtSecret: n, tokenBro
|
|
|
111
112
|
signal: p
|
|
112
113
|
});
|
|
113
114
|
} catch (y) {
|
|
114
|
-
p?.aborted || (S(f,
|
|
115
|
+
p?.aborted || (S(f, B(y)), f.onDone());
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
+
function Y({ accountId: e, tools: t, beacon: r }) {
|
|
119
120
|
const n = (o) => r?.({
|
|
120
121
|
...o,
|
|
121
122
|
accountId: o.accountId || e
|
|
122
123
|
});
|
|
123
|
-
return ((o, s) =>
|
|
124
|
+
return ((o, s) => J(o, s, {
|
|
124
125
|
tools: t,
|
|
125
126
|
beacon: n,
|
|
126
127
|
memory: sessionStorage
|
|
@@ -128,8 +129,8 @@ function Q({ accountId: e, tools: t, beacon: r }) {
|
|
|
128
129
|
}
|
|
129
130
|
async function j(e, t) {
|
|
130
131
|
if (!t || !t.type?.startsWith("image/")) return e;
|
|
131
|
-
const r = await
|
|
132
|
-
...
|
|
132
|
+
const r = await Z(t), n = {
|
|
133
|
+
...V(e.payload ?? e.action?.payload),
|
|
133
134
|
image_data_url: r.dataUrl,
|
|
134
135
|
image_mime: r.mime
|
|
135
136
|
};
|
|
@@ -142,30 +143,30 @@ async function j(e, t) {
|
|
|
142
143
|
} } : {}
|
|
143
144
|
};
|
|
144
145
|
}
|
|
145
|
-
function Y(e) {
|
|
146
|
-
return V(e) ? { ...e } : typeof e == "string" ? { text: e } : {};
|
|
147
|
-
}
|
|
148
146
|
function V(e) {
|
|
147
|
+
return X(e) ? { ...e } : typeof e == "string" ? { text: e } : {};
|
|
148
|
+
}
|
|
149
|
+
function X(e) {
|
|
149
150
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
150
151
|
}
|
|
151
|
-
async function
|
|
152
|
-
const t = await
|
|
152
|
+
async function Z(e) {
|
|
153
|
+
const t = await ee(e);
|
|
153
154
|
return t || {
|
|
154
155
|
dataUrl: await C(e),
|
|
155
156
|
mime: e.type
|
|
156
157
|
};
|
|
157
158
|
}
|
|
158
|
-
async function
|
|
159
|
+
async function ee(e) {
|
|
159
160
|
if (typeof createImageBitmap != "function" || typeof document > "u") return null;
|
|
160
161
|
let t = null;
|
|
161
162
|
try {
|
|
162
163
|
t = await createImageBitmap(e);
|
|
163
|
-
const r = Math.min(1,
|
|
164
|
+
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)), s = document.createElement("canvas");
|
|
164
165
|
s.width = n, s.height = o;
|
|
165
166
|
const i = s.getContext("2d");
|
|
166
167
|
if (!i) return null;
|
|
167
168
|
i.drawImage(t, 0, 0, n, o);
|
|
168
|
-
const d = await new Promise((w) => s.toBlob(w, "image/jpeg",
|
|
169
|
+
const d = await new Promise((w) => s.toBlob(w, "image/jpeg", W));
|
|
169
170
|
return d ? {
|
|
170
171
|
dataUrl: await C(d),
|
|
171
172
|
mime: d.type || "image/jpeg"
|
|
@@ -202,7 +203,7 @@ function S(e, t) {
|
|
|
202
203
|
e.onMetadata(t);
|
|
203
204
|
break;
|
|
204
205
|
case "error":
|
|
205
|
-
e.onError(
|
|
206
|
+
e.onError(te(t));
|
|
206
207
|
break;
|
|
207
208
|
case "done":
|
|
208
209
|
e.onDone();
|
|
@@ -211,15 +212,15 @@ function S(e, t) {
|
|
|
211
212
|
break;
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
|
-
function
|
|
215
|
+
function te(e) {
|
|
215
216
|
const t = new Error(e.message || e.code || "Agent error");
|
|
216
217
|
return e.code && (t.code = e.code), t;
|
|
217
218
|
}
|
|
218
219
|
var v = "__gengageAgentFetchBridge";
|
|
219
|
-
function
|
|
220
|
+
function Ve({ accountId: e, streamTransport: t, endpoints: r = {} }) {
|
|
220
221
|
if (!e) throw new Error("accountId is required.");
|
|
221
222
|
if (typeof t != "function") throw new Error("streamTransport is required.");
|
|
222
|
-
const n =
|
|
223
|
+
const n = re(), o = `https://gengage-injector.invalid/${encodeURIComponent(e)}`, s = /* @__PURE__ */ new Set(), i = (d) => {
|
|
223
224
|
const w = `${o}/chat/${d}`;
|
|
224
225
|
s.add(w);
|
|
225
226
|
const m = r[d], u = {
|
|
@@ -237,7 +238,7 @@ function Ye({ accountId: e, streamTransport: t, endpoints: r = {} }) {
|
|
|
237
238
|
}
|
|
238
239
|
};
|
|
239
240
|
}
|
|
240
|
-
function
|
|
241
|
+
function re() {
|
|
241
242
|
const e = window, t = e[v];
|
|
242
243
|
if (t) return t;
|
|
243
244
|
const r = e.fetch.bind(e), n = {
|
|
@@ -246,7 +247,7 @@ function te() {
|
|
|
246
247
|
};
|
|
247
248
|
return e.fetch = (o, s) => {
|
|
248
249
|
const i = M(o), d = n.routes.get(i);
|
|
249
|
-
return d ?
|
|
250
|
+
return d ? oe(d, o, s) : r(o, s);
|
|
250
251
|
}, e[v] = n, n;
|
|
251
252
|
}
|
|
252
253
|
function M(e) {
|
|
@@ -259,7 +260,7 @@ function T(e, t) {
|
|
|
259
260
|
function $(e, t) {
|
|
260
261
|
return t?.body !== void 0 && t?.body !== null ? t.body : typeof Request < "u" && e instanceof Request ? e.clone().text() : null;
|
|
261
262
|
}
|
|
262
|
-
async function
|
|
263
|
+
async function ne(e, t) {
|
|
263
264
|
const r = $(e, t);
|
|
264
265
|
if (r instanceof FormData) {
|
|
265
266
|
const o = r.get("request"), s = r.get("attachment");
|
|
@@ -271,7 +272,7 @@ async function re(e, t) {
|
|
|
271
272
|
const n = await Promise.resolve(r);
|
|
272
273
|
return typeof n == "string" ? { request: JSON.parse(n || "{}") } : { request: {} };
|
|
273
274
|
}
|
|
274
|
-
async function
|
|
275
|
+
async function oe(e, t, r) {
|
|
275
276
|
if (e.endpoint && e.endpoint !== "process_action" && e.endpointHandler) {
|
|
276
277
|
const m = new AbortController(), u = T(t, r);
|
|
277
278
|
let l = null;
|
|
@@ -280,9 +281,9 @@ async function ne(e, t, r) {
|
|
|
280
281
|
u.aborted && a(), u.addEventListener("abort", a, { once: !0 }), l = () => u.removeEventListener("abort", a);
|
|
281
282
|
}
|
|
282
283
|
try {
|
|
283
|
-
const a = await
|
|
284
|
+
const a = await ae(t, r);
|
|
284
285
|
return await e.endpointHandler(a, {
|
|
285
|
-
accountId:
|
|
286
|
+
accountId: se(t),
|
|
286
287
|
endpoint: e.endpoint,
|
|
287
288
|
signal: m.signal
|
|
288
289
|
});
|
|
@@ -317,7 +318,7 @@ async function ne(e, t, r) {
|
|
|
317
318
|
s.addEventListener("abort", c, { once: !0 }), d = () => s.removeEventListener("abort", c);
|
|
318
319
|
}
|
|
319
320
|
try {
|
|
320
|
-
const { request: c, attachment: f } = await
|
|
321
|
+
const { request: c, attachment: f } = await ne(t, r), p = e.streamTransport(c, {
|
|
321
322
|
onTextChunk: (g, h, y = {}) => u({
|
|
322
323
|
type: "text_chunk",
|
|
323
324
|
content: g,
|
|
@@ -348,7 +349,7 @@ async function ne(e, t, r) {
|
|
|
348
349
|
u({ type: "done" }), l();
|
|
349
350
|
}
|
|
350
351
|
}, o.signal, f);
|
|
351
|
-
|
|
352
|
+
ie(p) && (await p, o.signal.aborted || (u({ type: "done" }), l()));
|
|
352
353
|
} catch (c) {
|
|
353
354
|
o.signal.aborted || a(c);
|
|
354
355
|
}
|
|
@@ -362,11 +363,11 @@ async function ne(e, t, r) {
|
|
|
362
363
|
headers: { "Content-Type": "application/x-ndjson" }
|
|
363
364
|
});
|
|
364
365
|
}
|
|
365
|
-
async function
|
|
366
|
+
async function ae(e, t) {
|
|
366
367
|
const r = await Promise.resolve($(e, t));
|
|
367
368
|
return typeof r != "string" || r.trim() === "" ? {} : JSON.parse(r);
|
|
368
369
|
}
|
|
369
|
-
function
|
|
370
|
+
function se(e) {
|
|
370
371
|
try {
|
|
371
372
|
const [t] = new URL(M(e)).pathname.split("/").filter(Boolean);
|
|
372
373
|
return decodeURIComponent(t || "");
|
|
@@ -374,17 +375,17 @@ function ae(e) {
|
|
|
374
375
|
return "";
|
|
375
376
|
}
|
|
376
377
|
}
|
|
377
|
-
function
|
|
378
|
+
function ie(e) {
|
|
378
379
|
return e !== null && (typeof e == "object" || typeof e == "function") && typeof e.then == "function";
|
|
379
380
|
}
|
|
380
|
-
function
|
|
381
|
+
function Xe({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenBrokerAudience: o, workerUrl: s, defaultLocale: i = "en-GB", accountModule: d, tools: w = {}, beacon: m, allowBlobWorker: u = !1 }) {
|
|
381
382
|
if (!e) throw new Error("accountId is required.");
|
|
382
383
|
if (!t) throw new Error("beUrl is required. The injector owns backend URLs; the SDK has no default.");
|
|
383
384
|
if (!s) throw new Error("workerUrl is required.");
|
|
384
385
|
const l = window, a = l.GengageAssistantInjector || (l.GengageAssistantInjector = {}), c = a[e] || (a[e] = {});
|
|
385
386
|
if (c.agentController) return c.agentController;
|
|
386
|
-
const f = D(s) || u ?
|
|
387
|
-
c.streamTransport = f ?
|
|
387
|
+
const f = D(s) || u ? ce(s, `gengage-${e}-agent`, { allowBlobWorker: u }) : null;
|
|
388
|
+
c.streamTransport = f ? K({
|
|
388
389
|
accountId: e,
|
|
389
390
|
worker: f.worker,
|
|
390
391
|
beUrl: t,
|
|
@@ -394,7 +395,7 @@ function Ve({ accountId: e, beUrl: t, devJwtSecret: r, tokenBrokerUrl: n, tokenB
|
|
|
394
395
|
defaultLocale: i,
|
|
395
396
|
tools: w,
|
|
396
397
|
...m ? { beacon: m } : {}
|
|
397
|
-
}) :
|
|
398
|
+
}) : Q({
|
|
398
399
|
accountId: e,
|
|
399
400
|
accountModule: d,
|
|
400
401
|
beUrl: t,
|
|
@@ -427,7 +428,7 @@ function D(e) {
|
|
|
427
428
|
const t = new URL(e, window.location.href);
|
|
428
429
|
return t.origin === window.location.origin || t.protocol === "blob:";
|
|
429
430
|
}
|
|
430
|
-
function
|
|
431
|
+
function ce(e, t, r = {}) {
|
|
431
432
|
const n = new URL(e, window.location.href);
|
|
432
433
|
if (D(e)) return {
|
|
433
434
|
worker: new Worker(n.href, {
|
|
@@ -454,23 +455,23 @@ function ie(e, t, r = {}) {
|
|
|
454
455
|
throw URL.revokeObjectURL(s), i;
|
|
455
456
|
}
|
|
456
457
|
}
|
|
457
|
-
function
|
|
458
|
+
function le(e) {
|
|
458
459
|
const t = (e?.chat || e?._chat)?.root || e?._chat?.root;
|
|
459
460
|
return t ? t.getRootNode?.()?.host || t : Array.from(document.querySelectorAll("*")).find((r) => r.shadowRoot?.querySelector?.(".gengage-chat-root, .gengage-chat-launcher-container"));
|
|
460
461
|
}
|
|
461
|
-
function
|
|
462
|
-
const r =
|
|
462
|
+
function Ze(e, t) {
|
|
463
|
+
const r = le(e);
|
|
463
464
|
r?.style && (t ? r.style.removeProperty("display") : r.style.setProperty("display", "none", "important")), t || (e?.chat || e?._chat)?.close?.();
|
|
464
465
|
}
|
|
465
|
-
var
|
|
466
|
-
function
|
|
467
|
-
const r =
|
|
466
|
+
var ue = "nd_be_url";
|
|
467
|
+
function et(e, t) {
|
|
468
|
+
const r = de() || e.beUrl || t;
|
|
468
469
|
if (!r) throw new Error("resolveBeUrl: backend URL is required. The injector must supply a fallback URL; the SDK has no default.");
|
|
469
470
|
return r;
|
|
470
471
|
}
|
|
471
|
-
function
|
|
472
|
+
function de() {
|
|
472
473
|
try {
|
|
473
|
-
const e = new URLSearchParams(window.location.search).get(
|
|
474
|
+
const e = new URLSearchParams(window.location.search).get(ue)?.trim();
|
|
474
475
|
if (!e) return null;
|
|
475
476
|
const t = new URL(e);
|
|
476
477
|
return t.protocol !== "https:" && t.protocol !== "http:" ? null : t.toString().replace(/\/+$/u, "");
|
|
@@ -478,7 +479,7 @@ function ue() {
|
|
|
478
479
|
return null;
|
|
479
480
|
}
|
|
480
481
|
}
|
|
481
|
-
var
|
|
482
|
+
var fe = "entries", ge = 1, me = {
|
|
482
483
|
volatile: "Hot per-page state and sensitive request context.",
|
|
483
484
|
session: "Current-visit tool context without raw tokens or PII-heavy payloads.",
|
|
484
485
|
local: "Small, non-sensitive capability facts or user preferences.",
|
|
@@ -497,7 +498,7 @@ function R(e, t) {
|
|
|
497
498
|
expiresAt: t ? E() + t : null
|
|
498
499
|
};
|
|
499
500
|
}
|
|
500
|
-
function
|
|
501
|
+
function pe(e, t, r) {
|
|
501
502
|
try {
|
|
502
503
|
const n = e.getItem(`${t}${r}`);
|
|
503
504
|
if (!n) return null;
|
|
@@ -507,14 +508,14 @@ function me(e, t, r) {
|
|
|
507
508
|
return null;
|
|
508
509
|
}
|
|
509
510
|
}
|
|
510
|
-
function
|
|
511
|
+
function we(e, t, r, n, o) {
|
|
511
512
|
try {
|
|
512
513
|
return e.setItem(`${t}${r}`, JSON.stringify(R(n, o))), !0;
|
|
513
514
|
} catch {
|
|
514
515
|
return !1;
|
|
515
516
|
}
|
|
516
517
|
}
|
|
517
|
-
function
|
|
518
|
+
function ye(e, t, r) {
|
|
518
519
|
try {
|
|
519
520
|
e.removeItem(`${t}${r}`);
|
|
520
521
|
} catch {
|
|
@@ -529,9 +530,9 @@ function _(e) {
|
|
|
529
530
|
}
|
|
530
531
|
function L(e, t) {
|
|
531
532
|
return e ? {
|
|
532
|
-
get: (r) =>
|
|
533
|
-
set: (r, n, o = {}) =>
|
|
534
|
-
remove: (r) =>
|
|
533
|
+
get: (r) => pe(e, t, r),
|
|
534
|
+
set: (r, n, o = {}) => we(e, t, r, n, o.ttlMs),
|
|
535
|
+
remove: (r) => ye(e, t, r)
|
|
535
536
|
} : {
|
|
536
537
|
get: () => null,
|
|
537
538
|
set: () => !1,
|
|
@@ -547,15 +548,15 @@ function A(e) {
|
|
|
547
548
|
}
|
|
548
549
|
return JSON.stringify(e);
|
|
549
550
|
}
|
|
550
|
-
function
|
|
551
|
+
function he(e) {
|
|
551
552
|
let t = 2166136261;
|
|
552
553
|
const r = A(e);
|
|
553
554
|
for (let n = 0; n < r.length; n += 1)
|
|
554
555
|
t ^= r.charCodeAt(n), t = Math.imul(t, 16777619);
|
|
555
556
|
return (t >>> 0).toString(36);
|
|
556
557
|
}
|
|
557
|
-
function
|
|
558
|
-
const r = t.dbName || `gengage-${e}`, n = t.dbStore ||
|
|
558
|
+
function be(e, t) {
|
|
559
|
+
const r = t.dbName || `gengage-${e}`, n = t.dbStore || fe, o = t.dbVersion || ge, s = /* @__PURE__ */ new Map();
|
|
559
560
|
let i = null;
|
|
560
561
|
const d = () => "indexedDB" in window ? i || (i = new Promise((l) => {
|
|
561
562
|
const a = indexedDB.open(r, o);
|
|
@@ -595,10 +596,10 @@ function he(e, t) {
|
|
|
595
596
|
}
|
|
596
597
|
};
|
|
597
598
|
}
|
|
598
|
-
function
|
|
599
|
+
function tt(e, t = {}) {
|
|
599
600
|
const r = window, n = r.gengage || (r.gengage = {}), o = n.memory || (n.memory = {}), s = o[e];
|
|
600
601
|
if (s) return s;
|
|
601
|
-
const i = x.get(e) ||
|
|
602
|
+
const i = x.get(e) || be(e, t);
|
|
602
603
|
x.set(e, i);
|
|
603
604
|
const d = t.sessionPrefix || `gengage:${e}:session:`, w = t.localPrefix || `gengage:${e}:local:`, u = {
|
|
604
605
|
get: (c) => {
|
|
@@ -620,9 +621,9 @@ function et(e, t = {}) {
|
|
|
620
621
|
session: L(_("sessionStorage"), d),
|
|
621
622
|
local: L(_("localStorage"), w),
|
|
622
623
|
indexedDb: l,
|
|
623
|
-
stableKey:
|
|
624
|
+
stableKey: he,
|
|
624
625
|
policy: {
|
|
625
|
-
...
|
|
626
|
+
...me,
|
|
626
627
|
...t.policy || {}
|
|
627
628
|
}
|
|
628
629
|
};
|
|
@@ -630,7 +631,7 @@ function et(e, t = {}) {
|
|
|
630
631
|
for (const c of t.aliases || []) o[c] = a;
|
|
631
632
|
return a;
|
|
632
633
|
}
|
|
633
|
-
var
|
|
634
|
+
var Se = [
|
|
634
635
|
"addToCart",
|
|
635
636
|
"search",
|
|
636
637
|
"searchKeyword",
|
|
@@ -638,17 +639,17 @@ var be = [
|
|
|
638
639
|
"searchGiftOptions",
|
|
639
640
|
"similaritySearch"
|
|
640
641
|
];
|
|
641
|
-
function
|
|
642
|
+
function rt(e, t, r = {}) {
|
|
642
643
|
const n = window, o = n.gengage || (n.gengage = {}), s = o.tools || (o.tools = {});
|
|
643
644
|
s[e] = t;
|
|
644
645
|
for (const i of r.accountAliases || []) s[i] = t;
|
|
645
|
-
if (r.exposeStandardAliases !== !1) for (const i of r.standardAliases ||
|
|
646
|
+
if (r.exposeStandardAliases !== !1) for (const i of r.standardAliases || Se) {
|
|
646
647
|
const d = t[i];
|
|
647
648
|
typeof d == "function" && (s[i] = s[i] || d);
|
|
648
649
|
}
|
|
649
650
|
return t;
|
|
650
651
|
}
|
|
651
|
-
function
|
|
652
|
+
function nt({ getPageType: e, getProduct: t }) {
|
|
652
653
|
return () => ({
|
|
653
654
|
url: window.location.href,
|
|
654
655
|
title: document.title,
|
|
@@ -656,7 +657,7 @@ function rt({ getPageType: e, getProduct: t }) {
|
|
|
656
657
|
product: t()
|
|
657
658
|
});
|
|
658
659
|
}
|
|
659
|
-
function
|
|
660
|
+
function ot({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getSearchCapabilities: o, getMemory: s }) {
|
|
660
661
|
return async () => ({
|
|
661
662
|
accountId: e,
|
|
662
663
|
url: window.location.href,
|
|
@@ -668,7 +669,7 @@ function nt({ accountId: e, getPageType: t, getProduct: r, getToolNames: n, getS
|
|
|
668
669
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
669
670
|
});
|
|
670
671
|
}
|
|
671
|
-
function
|
|
672
|
+
function at({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "start", globalBaseUrlKey: n, errorLabel: o } = {}) {
|
|
672
673
|
if (!e) throw new Error("accountId is required.");
|
|
673
674
|
const s = o || e, i = window, d = () => {
|
|
674
675
|
const l = i.GengageInjectorConfig || {}, a = l[e] || {};
|
|
@@ -695,49 +696,49 @@ function ot({ accountId: e, runtimeFile: t = "runtime.js", startExport: r = "sta
|
|
|
695
696
|
})), u.loaderPromise;
|
|
696
697
|
}
|
|
697
698
|
export {
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
699
|
+
ve as AgentError,
|
|
700
|
+
F as ContextStore,
|
|
701
|
+
Ye as action,
|
|
702
|
+
Me as actionButtonsUiSpec,
|
|
703
|
+
Ie as beErrorToAgentError,
|
|
704
|
+
Ce as beautyConsultingTurnFlow,
|
|
705
|
+
We as buildPhotoSimilarityProfile,
|
|
706
|
+
Ge as buildProductSimilarityProfile,
|
|
707
|
+
Je as buildSimilarityQueries,
|
|
707
708
|
D as canUseModuleWorker,
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
709
|
+
B as caughtToStreamError,
|
|
710
|
+
$e as comparisonUiSpec,
|
|
711
|
+
tt as createBrowserMemory,
|
|
712
|
+
ot as createDiagnosticsTool,
|
|
713
|
+
ke as createFlow,
|
|
714
|
+
K as createInjectorAdapter,
|
|
715
|
+
Q as createMainThreadInjectorAdapter,
|
|
716
|
+
ce as createModuleWorker,
|
|
717
|
+
nt as createReadPageTool,
|
|
718
|
+
Te as done,
|
|
719
|
+
Re as elapsedMs,
|
|
720
|
+
Ae as error,
|
|
721
|
+
Be as httpErrorToAgentError,
|
|
722
|
+
rt as installBrowserTools,
|
|
723
|
+
Ve as installFetchTransportBridge,
|
|
724
|
+
Qe as metadata,
|
|
725
|
+
Xe as mountAccount,
|
|
726
|
+
Oe as normalizeProduct,
|
|
727
|
+
qe as normalizeSimilarityText,
|
|
728
|
+
Ue as nowIso,
|
|
729
|
+
He as productDetailsUiSpec,
|
|
730
|
+
Fe as productsUiSpec,
|
|
731
|
+
Le as rankSimilarProducts,
|
|
732
|
+
Ke as requestText,
|
|
733
|
+
et as resolveBeUrl,
|
|
734
|
+
je as resolveFlow,
|
|
735
|
+
Ne as scoreSimilarityCandidate,
|
|
736
|
+
Ze as setAssistantHostVisible,
|
|
737
|
+
he as stableKey,
|
|
738
|
+
at as startLazyRuntimeLoader,
|
|
739
|
+
xe as textChunk,
|
|
740
|
+
ze as tokenizeSimilarityText,
|
|
741
|
+
De as trimProductFactsCore,
|
|
742
|
+
_e as trimProductFactsListCore,
|
|
743
|
+
Pe as uiSpec
|
|
743
744
|
};
|
package/dist/agentic/types.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export interface BeClient {
|
|
|
32
32
|
input?: unknown;
|
|
33
33
|
signal?: AbortSignal;
|
|
34
34
|
cacheTtlS?: number;
|
|
35
|
+
cacheKey?: string;
|
|
35
36
|
}): Promise<unknown>;
|
|
36
37
|
}
|
|
37
38
|
export interface FlowStepCtx {
|
|
@@ -47,6 +48,7 @@ export interface BeOpStep {
|
|
|
47
48
|
op: string;
|
|
48
49
|
input: FlowValue<unknown>;
|
|
49
50
|
cacheTtlS?: FlowValue<number | undefined>;
|
|
51
|
+
cacheKey?: FlowValue<string | undefined>;
|
|
50
52
|
out?: string;
|
|
51
53
|
patch?: FlowPatch;
|
|
52
54
|
}
|
|
@@ -10,7 +10,8 @@ interface InvokeBeOpArgs {
|
|
|
10
10
|
op: string;
|
|
11
11
|
input?: unknown;
|
|
12
12
|
cacheTtlS?: number | undefined;
|
|
13
|
+
cacheKey?: string | undefined;
|
|
13
14
|
signal?: AbortSignal | undefined;
|
|
14
15
|
}
|
|
15
|
-
export declare function invokeBeOp({ beUrl, accountId, devJwtSecret, tokenBrokerUrl, tokenBrokerAudience, jwtProvider, parentUrl, op, input, cacheTtlS, signal, }: InvokeBeOpArgs): Promise<Record<string, unknown>>;
|
|
16
|
+
export declare function invokeBeOp({ beUrl, accountId, devJwtSecret, tokenBrokerUrl, tokenBrokerAudience, jwtProvider, parentUrl, op, input, cacheTtlS, cacheKey, signal, }: InvokeBeOpArgs): Promise<Record<string, unknown>>;
|
|
16
17
|
export {};
|