@gengage/assistant-fe 0.6.34 → 0.6.35

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 (97) hide show
  1. package/dist/chat-runtime.js +1 -1
  2. package/dist/chat.iife.js +1 -1
  3. package/dist/chat.js +1 -1
  4. package/dist/common/index.d.ts +2 -1
  5. package/dist/{common-CB1Vjd-T.js → common-C-lXfS-s.js} +1 -1
  6. package/dist/common.js +68 -67
  7. package/dist/{connection-warning-DBE8pkFv.js → connection-warning-DrXU9qN9.js} +1 -1
  8. package/dist/{fastIntent-D9jYpC8V.js → fastIntent-Diz6Vo0W.js} +1 -1
  9. package/dist/index.js +21 -21
  10. package/dist/native.iife.js +1 -1
  11. package/dist/qna-runtime.js +1 -1
  12. package/dist/qna.iife.js +1 -1
  13. package/dist/qna.js +1 -1
  14. package/dist/request-response-cache-DmnzO4Hu.js +1426 -0
  15. package/dist/{runtime-By-msZ8j.js → runtime-CiO-HX8B.js} +198 -199
  16. package/dist/{runtime-DyG44pqo.js → runtime-D0v-KyzN.js} +36 -37
  17. package/dist/{runtime-CABcQc-L.js → runtime-hci1VRsa.js} +8 -9
  18. package/dist/{simbut-CsQSH5vN.js → simbut-D-IPkTT8.js} +1 -1
  19. package/dist/simbut.iife.js +1 -1
  20. package/dist/simbut.js +1 -1
  21. package/dist/{simrel-bxdmsMmZ.js → simrel-BjMCvCdo.js} +1 -1
  22. package/dist/simrel-runtime.js +1 -1
  23. package/dist/simrel.iife.js +1 -1
  24. package/dist/simrel.js +2 -2
  25. package/dist/{widget-base-C_RZ-VIr.js → widget-base-_HBDf5VH.js} +1 -1
  26. package/package.json +3 -19
  27. package/dist/agent-ui-steps-DIWmTMuV.js +0 -3199
  28. package/dist/agentic/adaptor/create-adaptor.d.ts +0 -22
  29. package/dist/agentic/adaptor/fetch-bridge.d.ts +0 -31
  30. package/dist/agentic/adaptor/mount.d.ts +0 -45
  31. package/dist/agentic/algos/similarity.d.ts +0 -86
  32. package/dist/agentic/algos/similarity.js +0 -261
  33. package/dist/agentic/context/chat-context.d.ts +0 -17
  34. package/dist/agentic/context/context-store.d.ts +0 -57
  35. package/dist/agentic/context/persistence.d.ts +0 -14
  36. package/dist/agentic/contracts/agentic-contracts.d.ts +0 -133
  37. package/dist/agentic/debug/activity-collector.d.ts +0 -15
  38. package/dist/agentic/debug/activity-instrumentation.d.ts +0 -22
  39. package/dist/agentic/debug/activity-overlay.d.ts +0 -3
  40. package/dist/agentic/debug/activity-state.d.ts +0 -37
  41. package/dist/agentic/debug/local-dev.d.ts +0 -18
  42. package/dist/agentic/events/builders.d.ts +0 -10
  43. package/dist/agentic/events/comparison.d.ts +0 -6
  44. package/dist/agentic/events/context-products.d.ts +0 -6
  45. package/dist/agentic/events/error-taxonomy.d.ts +0 -27
  46. package/dist/agentic/events/product-normalize.d.ts +0 -50
  47. package/dist/agentic/events/ui-specs.d.ts +0 -41
  48. package/dist/agentic/flow/create-flow.d.ts +0 -2
  49. package/dist/agentic/flow/dispatch.d.ts +0 -3
  50. package/dist/agentic/index.d.ts +0 -65
  51. package/dist/agentic/index.js +0 -3493
  52. package/dist/agentic/types.d.ts +0 -360
  53. package/dist/agentic/util/account-config.d.ts +0 -8
  54. package/dist/agentic/util/assistant-host.d.ts +0 -11
  55. package/dist/agentic/util/be-url.d.ts +0 -4
  56. package/dist/agentic/util/browser-memory.d.ts +0 -13
  57. package/dist/agentic/util/browser-tools.d.ts +0 -31
  58. package/dist/agentic/util/cache-key.d.ts +0 -15
  59. package/dist/agentic/util/common/declarative-cache.d.ts +0 -21
  60. package/dist/agentic/util/common/fallback-status.d.ts +0 -10
  61. package/dist/agentic/util/common/flow-steps.d.ts +0 -8
  62. package/dist/agentic/util/common/gss-tool-aliases.d.ts +0 -66
  63. package/dist/agentic/util/common/iframe-scraper.d.ts +0 -22
  64. package/dist/agentic/util/common/llm-routing.d.ts +0 -50
  65. package/dist/agentic/util/common/object.d.ts +0 -1
  66. package/dist/agentic/util/common/open-product-page.d.ts +0 -30
  67. package/dist/agentic/util/common/panel-context.d.ts +0 -3
  68. package/dist/agentic/util/common/privacy.d.ts +0 -14
  69. package/dist/agentic/util/common/product-resolver.d.ts +0 -20
  70. package/dist/agentic/util/common/product-surface.d.ts +0 -24
  71. package/dist/agentic/util/common/ref-store.d.ts +0 -15
  72. package/dist/agentic/util/common/retail-privacy.d.ts +0 -4
  73. package/dist/agentic/util/common/route-params.d.ts +0 -3
  74. package/dist/agentic/util/common/similarity-ranking.d.ts +0 -2
  75. package/dist/agentic/util/common/site-awareness.d.ts +0 -130
  76. package/dist/agentic/util/lazy-runtime-loader.d.ts +0 -10
  77. package/dist/agentic/util/privacy.d.ts +0 -12
  78. package/dist/agentic/util/request-text.d.ts +0 -3
  79. package/dist/agentic/util/time.d.ts +0 -2
  80. package/dist/agentic/widgets/endpoints.d.ts +0 -12
  81. package/dist/agentic/worker/agent-ui-steps.d.ts +0 -43
  82. package/dist/agentic/worker/agent-ui.d.ts +0 -44
  83. package/dist/agentic/worker/be-client.d.ts +0 -32
  84. package/dist/agentic/worker/coalesce.d.ts +0 -25
  85. package/dist/agentic/worker/compaction.d.ts +0 -12
  86. package/dist/agentic/worker/entry.d.ts +0 -2
  87. package/dist/agentic/worker/flow-runner.d.ts +0 -24
  88. package/dist/agentic/worker/jwt-mint.d.ts +0 -21
  89. package/dist/agentic/worker/pdp-hydrate.d.ts +0 -30
  90. package/dist/agentic/worker/rpc.d.ts +0 -47
  91. package/dist/agentic/worker/tool-bridge.d.ts +0 -2
  92. package/dist/agentic/worker/tool-schema.d.ts +0 -19
  93. package/dist/agentic/worker.d.ts +0 -52
  94. package/dist/agentic/worker.js +0 -432
  95. package/dist/agentic.iife.js +0 -445
  96. package/dist/api-paths-DZQ4Xx7u.js +0 -1274
  97. package/dist/request-response-cache-BxRsKGJ0.js +0 -154
@@ -1,432 +0,0 @@
1
- import { buildPhotoSimilarityProfile as Y, buildProductSimilarityProfile as Z, buildSimilarityQueries as tt, normalizeSimilarityText as et, rankSimilarProducts as rt, rankSimilarProductsAsync as at, scoreSimilarityCandidate as ot, tokenizeSimilarityText as nt } from "./algos/similarity.js";
2
- import { $ as A, A as it, At as ct, B as T, C as lt, Ct as C, D as ut, Dt as I, E as dt, Et as pt, F as yt, G as mt, H as U, I as ft, J as _t, K as gt, L as R, M as Pt, N as ht, O as kt, P as B, Q as F, R as L, St as wt, T as vt, Tt as St, U as xt, V as M, W as bt, X as At, Y as Tt, Z as Ct, _ as It, _t as Ut, a as Rt, at as K, b as Bt, bt as Ft, c as Lt, ct as Mt, d as Kt, dt as x, et as jt, f as Et, ft as j, g as zt, gt as E, h as Ot, ht as qt, i as Jt, it as Nt, j as $t, k as Dt, kt as Ht, l as Wt, lt as Gt, m as Qt, mt as Vt, n as Xt, nt as Yt, o as Zt, ot as te, p as ee, pt as re, q as ae, r as oe, rt as ne, s as se, st as ie, t as ce, tt as z, u as le, ut as ue, v as de, vt as pe, w as ye, wt as me, xt as O, y as fe, yt as q, z as _e } from "../agent-ui-steps-DIWmTMuV.js";
3
- function ge(t) {
4
- const e = self, a = /* @__PURE__ */ new Map(), o = I(e), c = F(o);
5
- let s = null, y = null, d = null, m = "", _ = "idle", p = null;
6
- e.addEventListener("message", (r) => {
7
- const n = r.data;
8
- if (n) {
9
- if (n.type === "abort") {
10
- typeof n.id == "number" && (a.get(n.id)?.abort(), a.delete(n.id), p === n.id && (_ = "idle", p = null));
11
- return;
12
- }
13
- n.type === "invoke" && g(n);
14
- }
15
- });
16
- async function g(r) {
17
- if (_ !== "idle") {
18
- const u = (w) => {
19
- e.postMessage({
20
- id: r.id,
21
- type: "event",
22
- event: w
23
- });
24
- };
25
- u(j("agent_busy", J(r.defaultLocale || t.defaultLocale || "en-GB"))), u(x()), e.postMessage({
26
- id: r.id,
27
- type: "end"
28
- });
29
- return;
30
- }
31
- _ = "in_turn", p = r.id, s = {
32
- accountId: String(r.accountId || t.accountId || ""),
33
- beUrl: r.beUrl || "",
34
- ...r.devJwtSecret ? { devJwtSecret: r.devJwtSecret } : {},
35
- ...r.tokenBrokerUrl ? { tokenBrokerUrl: r.tokenBrokerUrl } : {},
36
- ...r.tokenBrokerAudience ? { tokenBrokerAudience: r.tokenBrokerAudience } : {},
37
- locale: r.defaultLocale || t.defaultLocale || "en-GB",
38
- parentUrl: r.parentUrl || ""
39
- };
40
- const n = [
41
- s.accountId,
42
- s.devJwtSecret || "",
43
- s.tokenBrokerUrl || "",
44
- s.tokenBrokerAudience || ""
45
- ].join(`
46
- `);
47
- (!d || m !== n) && (d = O(s), m = n), y ||= new C({
48
- accountId: s.accountId,
49
- locale: s.locale,
50
- parentUrl: s.parentUrl,
51
- rpc: o,
52
- persistentPanelKeys: t.contextPersistence?.panelKeys,
53
- panelKeyLimits: t.contextPersistence?.panelKeyLimits,
54
- messageLimit: t.contextPersistence?.messageLimit,
55
- maxThreads: t.contextPersistence?.maxThreads,
56
- threadTtlMs: t.contextPersistence?.threadTtlMs
57
- });
58
- const i = new AbortController();
59
- a.set(r.id, i);
60
- const l = (u) => {
61
- e.postMessage({
62
- id: r.id,
63
- type: "event",
64
- event: u
65
- });
66
- }, h = (u) => {
67
- r.debugActivity === !0 && e.postMessage({
68
- id: r.id,
69
- type: "activity",
70
- entry: u
71
- });
72
- };
73
- try {
74
- const u = s, w = d;
75
- await A({
76
- request: r.request || {},
77
- accountModule: {
78
- ...t,
79
- accountId: u.accountId,
80
- trace: async (S) => {
81
- h({
82
- kind: "flow/trace",
83
- event: S
84
- }), await t.trace?.(S);
85
- }
86
- },
87
- contextStore: y,
88
- beClient: N({
89
- config: u,
90
- jwtProvider: w,
91
- postActivity: h
92
- }),
93
- toolBridge: c,
94
- emit: l,
95
- rpc: o,
96
- signal: i.signal
97
- }), e.postMessage({
98
- id: r.id,
99
- type: "end"
100
- });
101
- } catch (u) {
102
- i.signal.aborted || (l(q(u)), l(x()), e.postMessage({
103
- id: r.id,
104
- type: "end"
105
- }));
106
- } finally {
107
- a.delete(r.id), p === r.id && (_ = "idle", p = null);
108
- }
109
- }
110
- }
111
- function J(t) {
112
- return String(t).toLowerCase().startsWith("en") ? "I’m still finishing up — just a moment!" : "Hâlâ tamamlıyorum — bir saniye bekleyin.";
113
- }
114
- function N({ config: t, jwtProvider: e, postActivity: a }) {
115
- return { async invoke({ op: o, input: c, signal: s, cacheTtlS: y, cacheKey: d, cacheFreshness: m, browserCache: _ }) {
116
- const p = performance.now(), g = t.accountId.replace(/-agentic$/u, ""), r = `${String(t.beUrl).replace(/\/+$/u, "")}/v1/execute`;
117
- a({
118
- kind: "be/request",
119
- source: "worker-fetch",
120
- url: r,
121
- op: o,
122
- opDomain: g,
123
- params: c || {},
124
- rawBody: {
125
- op_domain: g,
126
- op_name: o,
127
- op_payload: c,
128
- ...y !== void 0 ? { cache_ttl_s: y } : {},
129
- ...d !== void 0 ? { cache_key: d } : {},
130
- ...m !== void 0 ? { cache_freshness: m } : {}
131
- }
132
- });
133
- try {
134
- const n = await E({
135
- beUrl: t.beUrl,
136
- accountId: t.accountId,
137
- jwtProvider: e,
138
- parentUrl: t.parentUrl,
139
- op: o,
140
- input: c,
141
- cacheTtlS: y,
142
- cacheKey: d,
143
- cacheFreshness: m,
144
- browserCache: _,
145
- ...s ? { signal: s } : {}
146
- });
147
- return a({
148
- kind: "be/response",
149
- source: "worker-fetch",
150
- url: r,
151
- status: 200,
152
- op: o,
153
- opDomain: g,
154
- latencyMs: Math.max(0, Math.round(performance.now() - p)),
155
- result: n
156
- }), n;
157
- } catch (n) {
158
- throw a({
159
- kind: "be/response",
160
- source: "worker-fetch",
161
- url: r,
162
- op: o,
163
- opDomain: g,
164
- latencyMs: Math.max(0, Math.round(performance.now() - p)),
165
- error: n instanceof Error ? n.message : String(n)
166
- }), n;
167
- }
168
- } };
169
- }
170
- var v = { patterns: [
171
- ...T,
172
- {
173
- pattern: /(?:adresim|adres|address)\s*[:=]?\s*[^.;\n]{0,160}/giu,
174
- replacement: "[address]"
175
- },
176
- {
177
- pattern: /[^\s,.;]{2,}\s+(?:mahallesi|mah\.|sokak|sk\.|cadde|cad\.)\s+[^.;\n]{0,120}/giu,
178
- replacement: "[address]"
179
- }
180
- ] }, $ = "llm-flow-routing-v1";
181
- function D(t) {
182
- return String(t?.payload?.text || t?.payload?.query || t?.action?.payload?.text || "");
183
- }
184
- function Pe(t, e = {}) {
185
- return e[t?.type || t?.action?.type] || "";
186
- }
187
- function he({ accountId: t, cacheTtlS: e = 3600, browserCacheTtlMs: a, promptVersion: o = $, cacheable: c = !0, piiPatternPack: s = v, utterance: y, compactPageContext: d = W, compactStructuredContext: m = G, extraInput: _, cacheKeyParts: p, onError: g = [] } = {}) {
188
- return {
189
- kind: "be_op",
190
- op: "intent",
191
- input: (r) => {
192
- const { request: n, context: i, bag: l, accountConfig: h } = r;
193
- return R(P({
194
- utterance: b(n, {
195
- request: n,
196
- context: i,
197
- bag: l,
198
- accountConfig: h
199
- }, y, s),
200
- page_context: f(d, l.page, r),
201
- structured_context: f(m, i, r),
202
- locale: i.meta.locale,
203
- ...P(f(_, r))
204
- }), h, "intent");
205
- },
206
- out: "route",
207
- cache: (r) => f(c, r) ? B({
208
- ttlS: e,
209
- promptVersion: o
210
- }) : void 0,
211
- ...a ? { browserCache: { ttlMs: a } } : {},
212
- cacheKey: ({ request: r, context: n, bag: i, accountConfig: l }) => {
213
- if (f(c, {
214
- request: r,
215
- context: n,
216
- bag: i,
217
- accountConfig: l
218
- }))
219
- return z("intent", {
220
- account: t,
221
- prompt: o,
222
- locale: n.meta.locale,
223
- utterance: K(b(r, {
224
- request: r,
225
- context: n,
226
- bag: i,
227
- accountConfig: l
228
- }, y, s), n.meta.locale),
229
- page: f(d, i.page, {
230
- request: r,
231
- context: n,
232
- bag: i,
233
- accountConfig: l
234
- }),
235
- panel: f(m, n, {
236
- request: r,
237
- context: n,
238
- bag: i,
239
- accountConfig: l
240
- }),
241
- ...P(f(p, {
242
- request: r,
243
- context: n,
244
- bag: i,
245
- accountConfig: l
246
- }))
247
- });
248
- },
249
- onError: g
250
- };
251
- }
252
- function ke(t, e = "product") {
253
- const a = String(t?.intent?.kind || t?.kind || "").trim();
254
- return {
255
- product_search: "search",
256
- add_to_cart: "cart",
257
- question: "product",
258
- open_product: "open_product",
259
- beauty_consulting: "consulting",
260
- fashion_consulting: "consulting",
261
- style_consulting: "consulting",
262
- account_expert: "consulting",
263
- consulting: "consulting",
264
- consulting_redirect: "consulting",
265
- handoff_shopping: "consulting",
266
- handOffShopping: "consulting"
267
- }[a] || a || e;
268
- }
269
- function we(t, e) {
270
- return H(t, e).query || "";
271
- }
272
- function H(t, e) {
273
- const a = e.route?.search_params || e.route?.searchParams || {}, o = t?.payload || {}, c = a.query || o.query;
274
- return P({
275
- ...a,
276
- query: c,
277
- text: a.text || o.text,
278
- facetParams: a.facetParams || a.facet_params || o.facetParams || o.facet_params,
279
- facets: a.facets || o.facets,
280
- categoryName: a.categoryName || a.category_name || o.categoryName || o.category_name,
281
- categoryId: a.categoryId || a.category_id || o.categoryId || o.category_id,
282
- size: a.size || o.size || o.beden || o.shoeSize || o.clothingSize,
283
- budgetMax: a.budgetMax || a.budget_max || a.maxPrice || o.budgetMax || o.budget_max || o.maxPrice,
284
- maxPrice: a.maxPrice || o.maxPrice
285
- });
286
- }
287
- function ve(t) {
288
- return (t.route?.flow_params && typeof t.route.flow_params == "object" ? t.route.flow_params : null) || (t.route?.flowParams && typeof t.route.flowParams == "object" ? t.route.flowParams : null) || {};
289
- }
290
- function W(t = {}) {
291
- const e = t?.product && typeof t.product == "object" ? t.product : null;
292
- return P({
293
- pageType: t?.pageType || t?.type || "other",
294
- sku: t?.sku || e?.sku,
295
- product_name: e?.name || e?.title,
296
- category_names: Array.isArray(e?.category_names) ? e.category_names.slice(0, 5) : void 0
297
- });
298
- }
299
- function G(t = {}) {
300
- const e = t.panel || {};
301
- return P({
302
- screen_type: e.screen_type,
303
- screen_sku_list: Array.isArray(e.screen_sku_list) ? e.screen_sku_list.slice(0, 24) : void 0,
304
- chat_mentioned_skus: Array.isArray(e.chat_mentioned_skus) ? e.chat_mentioned_skus.slice(0, 12) : void 0,
305
- last_search: Q(e.last_search),
306
- current_panel_product_count: Array.isArray(e.last_search_products) ? e.last_search_products.length : 0
307
- });
308
- }
309
- function Q(t) {
310
- return !t || typeof t != "object" ? null : P({
311
- query: k(t.query),
312
- source: t.source,
313
- count: t.count,
314
- category: k(t.category),
315
- goal: k(t.goal)
316
- });
317
- }
318
- function V(t, e = v) {
319
- return L(t, e) || k(U(t) || D(t), e);
320
- }
321
- function b(t, e, a, o) {
322
- const c = f(a, t, e);
323
- return c ? String(c) : V(t, o);
324
- }
325
- function k(t, e = v) {
326
- return M(String(t || ""), e);
327
- }
328
- function f(t, e, a) {
329
- return typeof t == "function" ? t(e, a) : t;
330
- }
331
- function P(t) {
332
- return Object.fromEntries(Object.entries(t || {}).filter(([, e]) => e != null && e !== "" && (!Array.isArray(e) || e.length)));
333
- }
334
- export {
335
- Ut as AgentError,
336
- C as ContextStore,
337
- it as FALLBACK_STATUS,
338
- Kt as __resetAllCartCoalescersForTesting,
339
- Wt as __resetAllPdpHydratorsForTesting,
340
- ue as action,
341
- bt as actionButtonsUiSpec,
342
- _t as alignProductsToTable,
343
- L as anonymousRequestText,
344
- oe as applyCompactionResult,
345
- pe as beErrorToAgentError,
346
- Jt as buildCompactionRequest,
347
- ce as buildPdpFollowupSteps,
348
- Y as buildPhotoSimilarityProfile,
349
- Z as buildProductSimilarityProfile,
350
- tt as buildSimilarityQueries,
351
- Xt as buildToolUiSteps,
352
- q as caughtToStreamError,
353
- Et as coalesceAddToCart,
354
- ft as compactAccountConfig,
355
- Ct as compactContextProducts,
356
- kt as compactObject,
357
- Bt as compactProductSurfaceForLlm,
358
- Tt as comparisonResultForUi,
359
- mt as comparisonUiSpec,
360
- xt as createFlow,
361
- O as createJwtProvider,
362
- vt as createPrivacyHelpers,
363
- Dt as createReadPageStep,
364
- F as createToolBridge,
365
- I as createWorkerRpc,
366
- ht as declarativeBeOpCache,
367
- _e as defaultPiiPatternPack,
368
- T as defaultPiiPatterns,
369
- x as done,
370
- St as elapsedMs,
371
- j as error,
372
- Pe as explicitRoute,
373
- $t as fallbackStatus,
374
- Qt as firstArrayValue,
375
- ve as flowParamsFromRoute,
376
- Ht as handleMainRpc,
377
- ut as homePanelReset,
378
- Ft as httpErrorToAgentError,
379
- B as inputHashCachePolicy,
380
- E as invokeBeOp,
381
- Pt as isFallbackStatus,
382
- z as llmCacheKey,
383
- he as llmIntentStep,
384
- lt as mergeProductSurfaceEvidence,
385
- Zt as mergeRoundProducts,
386
- re as metadata,
387
- wt as mintDevJwt,
388
- At as normalizeComparisonTable,
389
- te as normalizeProduct,
390
- et as normalizeSimilarityText,
391
- pt as nowIso,
392
- dt as plainMessageContent,
393
- gt as productDetailsUiSpec,
394
- Yt as productFactsKey,
395
- ne as productSkuKey,
396
- ye as productSurfaceReviewText,
397
- ae as productsUiSpec,
398
- rt as rankSimilarProducts,
399
- at as rankSimilarProductsAsync,
400
- M as redactPii,
401
- U as requestText,
402
- Gt as resolveFlow,
403
- It as retailAnonymizeMessages,
404
- de as retailAnonymousRequestText,
405
- fe as retailRedactPii,
406
- Ot as routeFlowParams,
407
- ke as routeKind,
408
- zt as routeSkuList,
409
- D as routeText,
410
- ct as runMainRpc,
411
- A as runTurn,
412
- ot as scoreSimilarityCandidate,
413
- se as searchFollowUpPills,
414
- H as searchInputFromRoute,
415
- we as searchQueryFromRoute,
416
- Rt as shouldCompact,
417
- ee as singleFlight,
418
- Nt as stableKey,
419
- ge as startWorker,
420
- me as stickyContextKey,
421
- Vt as textChunk,
422
- K as textKey,
423
- nt as tokenizeSimilarityText,
424
- ie as trimProductFactsCore,
425
- Mt as trimProductFactsListCore,
426
- qt as uiSpec,
427
- jt as validateToolArgs,
428
- R as withAccountConfig,
429
- yt as withDeclarativeBeOpCache,
430
- Lt as withSimilarsAppend,
431
- le as wrapResolveProductsWithPdpHydration
432
- };