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