@gengage/assistant-fe 0.5.7 → 0.6.1
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 +6 -22
- package/dist/agentic/adaptor/create-adaptor.d.ts +19 -0
- package/dist/agentic/adaptor/fetch-bridge.d.ts +11 -0
- package/dist/agentic/adaptor/mount.d.ts +38 -0
- package/dist/agentic/context/chat-context.d.ts +15 -0
- package/dist/agentic/context/context-store.d.ts +20 -0
- package/dist/agentic/context/persistence.d.ts +12 -0
- package/dist/agentic/events/builders.d.ts +10 -0
- package/dist/agentic/events/error-taxonomy.d.ts +27 -0
- package/dist/agentic/events/product-normalize.d.ts +47 -0
- package/dist/agentic/events/ui-specs.d.ts +37 -0
- package/dist/agentic/flow/beauty-consulting-turn.d.ts +1 -0
- package/dist/agentic/flow/create-flow.d.ts +2 -0
- package/dist/agentic/flow/dispatch.d.ts +3 -0
- package/dist/agentic/index.d.ts +18 -0
- package/dist/agentic/index.js +624 -0
- package/dist/agentic/types.d.ts +212 -0
- package/dist/agentic/util/assistant-host.d.ts +11 -0
- package/dist/agentic/util/be-url.d.ts +4 -0
- package/dist/agentic/util/browser-memory.d.ts +13 -0
- package/dist/agentic/util/browser-tools.d.ts +31 -0
- package/dist/agentic/util/lazy-runtime-loader.d.ts +9 -0
- package/dist/agentic/util/request-text.d.ts +3 -0
- package/dist/agentic/util/time.d.ts +2 -0
- package/dist/agentic/worker/be-client.d.ts +15 -0
- package/dist/agentic/worker/entry.d.ts +2 -0
- package/dist/agentic/worker/flow-runner.d.ts +24 -0
- package/dist/agentic/worker/jwt-mint.d.ts +21 -0
- package/dist/agentic/worker/rpc.d.ts +24 -0
- package/dist/agentic/worker/tool-bridge.d.ts +2 -0
- package/dist/agentic/worker.d.ts +16 -0
- package/dist/agentic/worker.js +119 -0
- package/dist/agentic.iife.js +5 -0
- package/dist/{api-paths-CwzwbgQZ.js → api-paths-C4WzXzyY.js} +1 -1
- package/dist/beauty-consulting-turn-BmPXbkQg.js +1019 -0
- package/dist/chat/api.d.ts +17 -0
- package/dist/chat/assistant-mode.d.ts +20 -0
- package/dist/chat/attachment-utils.d.ts +9 -0
- package/dist/chat/catalog.d.ts +455 -0
- package/dist/chat/chat-presentation-state.d.ts +53 -0
- package/dist/chat/components/AIGroupingCards.d.ts +15 -0
- package/dist/chat/components/AISuggestedSearchCards.d.ts +13 -0
- package/dist/chat/components/AITopPicks.d.ts +9 -0
- package/dist/chat/components/BeautyPhotoStep.d.ts +31 -0
- package/dist/chat/components/CategoriesContainer.d.ts +11 -0
- package/dist/chat/components/ChatDrawer.d.ts +362 -0
- package/dist/chat/components/ChoicePrompter.d.ts +21 -0
- package/dist/chat/components/ComparisonTable.d.ts +66 -0
- package/dist/chat/components/ConsultingStylePicker.d.ts +40 -0
- package/dist/chat/components/FloatingComparisonButton.d.ts +7 -0
- package/dist/chat/components/FloatingLauncher.d.ts +79 -0
- package/dist/chat/components/GroundingReviewCard.d.ts +11 -0
- package/dist/chat/components/HandoffNotice.d.ts +9 -0
- package/dist/chat/components/KvkkBanner.d.ts +6 -0
- package/dist/chat/components/Launcher.d.ts +28 -0
- package/dist/chat/components/PanelRestoreCard.d.ts +4 -0
- package/dist/chat/components/PanelTopBar.d.ts +32 -0
- package/dist/chat/components/PhotoAnalysisCard.d.ts +27 -0
- package/dist/chat/components/ProductSummaryCard.d.ts +12 -0
- package/dist/chat/components/ProsAndCons.d.ts +8 -0
- package/dist/chat/components/ReviewHighlights.d.ts +16 -0
- package/dist/chat/components/actionClassifier.d.ts +12 -0
- package/dist/chat/components/product-price-layout.d.ts +17 -0
- package/dist/chat/components/productMentionLinker.d.ts +26 -0
- package/dist/chat/components/renderUISpec.d.ts +15 -0
- package/dist/chat/components/typewriter.d.ts +24 -0
- package/dist/chat/extendedModeManager.d.ts +32 -0
- package/dist/chat/features/beauty-consulting/consulting-grid.d.ts +38 -0
- package/dist/chat/features/beauty-consulting/drawer-extensions.d.ts +22 -0
- package/dist/chat/features/beauty-consulting/mode-controller.d.ts +59 -0
- package/dist/chat/features/beauty-consulting/registry.d.ts +9 -0
- package/dist/chat/features/beauty-consulting/stream-handler.d.ts +45 -0
- package/dist/chat/history-storage.d.ts +85 -0
- package/dist/chat/index.d.ts +6 -0
- package/dist/chat/kvkk.d.ts +20 -0
- package/dist/chat/locales/en.d.ts +2 -0
- package/dist/chat/locales/index.d.ts +5 -0
- package/dist/chat/locales/tr.d.ts +2 -0
- package/dist/chat/panel-manager.d.ts +142 -0
- package/dist/chat/runtime.d.ts +417 -0
- package/dist/chat/session-persistence.d.ts +73 -0
- package/dist/chat/stream-error-display.d.ts +6 -0
- package/dist/chat/types.d.ts +547 -0
- package/dist/chat/utils/chat-presentation-debug.d.ts +18 -0
- package/dist/chat/utils/get-chat-scroll-element.d.ts +10 -0
- package/dist/chat/utils/ui.d.ts +10 -0
- package/dist/chat-runtime.js +1 -1
- package/dist/chat.iife.js +12 -12
- package/dist/chat.js +1 -1
- package/dist/common/action-router.d.ts +26 -0
- package/dist/common/api-paths.d.ts +23 -0
- package/dist/common/client.d.ts +27 -0
- package/dist/common/communication-bridge.d.ts +51 -0
- package/dist/common/config-constants.d.ts +1 -0
- package/dist/common/config-schema.d.ts +54 -0
- package/dist/common/connection-warning.d.ts +8 -0
- package/dist/common/consulting-sources.d.ts +8 -0
- package/dist/common/context.d.ts +64 -0
- package/dist/common/css-escape.d.ts +1 -0
- package/dist/common/customization-factories.d.ts +59 -0
- package/dist/common/debug.d.ts +13 -0
- package/dist/common/events.d.ts +55 -0
- package/dist/common/fastIntent.d.ts +1 -0
- package/dist/common/find-similar-payload.d.ts +3 -0
- package/dist/common/ga-datalayer.d.ts +80 -0
- package/dist/common/global-error-toast.d.ts +6 -0
- package/dist/common/index.d.ts +47 -0
- package/dist/common/indexed-db.d.ts +89 -0
- package/dist/common/locale.d.ts +1 -0
- package/dist/common/native-webview.d.ts +60 -0
- package/dist/common/navigation.d.ts +1 -0
- package/dist/common/overlay.d.ts +172 -0
- package/dist/common/page-detect.d.ts +36 -0
- package/dist/common/pill-launcher.d.ts +51 -0
- package/dist/common/preflight.d.ts +13 -0
- package/dist/common/price-formatter.d.ts +35 -0
- package/dist/common/product-utils.d.ts +35 -0
- package/dist/common/protocol-adapter.d.ts +108 -0
- package/dist/common/renderer/dom.d.ts +3 -0
- package/dist/common/renderer/index.d.ts +4 -0
- package/dist/common/renderer/overrides.d.ts +23 -0
- package/dist/common/renderer/registry.d.ts +2 -0
- package/dist/common/renderer/types.d.ts +19 -0
- package/dist/common/safe-html.d.ts +22 -0
- package/dist/common/sdk-version.d.ts +3 -0
- package/dist/common/streaming.d.ts +52 -0
- package/dist/common/suggested-search-keywords.d.ts +18 -0
- package/dist/common/theme-utils.d.ts +15 -0
- package/dist/common/transport.d.ts +75 -0
- package/dist/common/tts-player.d.ts +13 -0
- package/dist/common/types.d.ts +379 -0
- package/dist/common/ui-theme.d.ts +9 -0
- package/dist/common/uuidv7.d.ts +7 -0
- package/dist/common/voice-input.d.ts +74 -0
- package/dist/common/widget-base.d.ts +82 -0
- package/dist/{common-KpJP1YwP.js → common-DstAcheX.js} +90 -139
- package/dist/common.js +41 -41
- package/dist/{connection-warning-B5T_1oBn.js → connection-warning-Ddr91Y9x.js} +1 -1
- package/dist/{fastIntent--Ukm2nOh.js → fastIntent-XtUvISni.js} +199 -137
- package/dist/index.d.ts +25 -0
- package/dist/index.js +50 -50
- package/dist/native/index.d.ts +2 -0
- package/dist/{native-webview-qfjm4SHx.js → native-webview-JDC1vtde.js} +1 -1
- package/dist/native.iife.js +14 -14
- package/dist/native.js +1 -1
- package/dist/{overlay-CP5A0Hhf.js → overlay-BetAvpVZ.js} +19 -19
- package/dist/overlay.d.ts +4 -0
- package/dist/overlay.js +1 -1
- package/dist/qna/api.d.ts +23 -0
- package/dist/qna/catalog.d.ts +60 -0
- package/dist/qna/components/ButtonRow.d.ts +15 -0
- package/dist/qna/components/TextInput.d.ts +11 -0
- package/dist/qna/components/renderUISpec.d.ts +7 -0
- package/dist/qna/index.d.ts +3 -0
- package/dist/qna/locales/en.d.ts +2 -0
- package/dist/qna/locales/index.d.ts +4 -0
- package/dist/qna/locales/tr.d.ts +2 -0
- package/dist/qna/normalize-ui-specs.d.ts +15 -0
- package/dist/qna/runtime.d.ts +73 -0
- package/dist/qna/types.d.ts +98 -0
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +1 -1
- package/dist/{runtime-G3idwfkM.js → runtime-C66Wp6OR.js} +967 -923
- package/dist/{runtime-C3yOvNFK.js → runtime-CcA_r8pw.js} +3 -3
- package/dist/{runtime-BPyXOyyp.js → runtime-DJMUL882.js} +3 -3
- package/dist/simbut/index.d.ts +31 -0
- package/dist/simbut/locales.d.ts +3 -0
- package/dist/simbut/types.d.ts +43 -0
- package/dist/{simbut-CiknJI6-.js → simbut-B6L3fwI7.js} +1 -1
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/simrel/api.d.ts +25 -0
- package/dist/simrel/catalog.d.ts +77 -0
- package/dist/simrel/components/GroupTabs.d.ts +24 -0
- package/dist/simrel/components/ProductCard.d.ts +19 -0
- package/dist/simrel/components/ProductGrid.d.ts +17 -0
- package/dist/simrel/components/renderUISpec.d.ts +7 -0
- package/dist/simrel/index.d.ts +5 -0
- package/dist/simrel/locales/en.d.ts +2 -0
- package/dist/simrel/locales/index.d.ts +4 -0
- package/dist/simrel/locales/tr.d.ts +2 -0
- package/dist/simrel/renderers/default.d.ts +41 -0
- package/dist/simrel/runtime.d.ts +68 -0
- package/dist/simrel/types.d.ts +145 -0
- package/dist/{simrel-C1YN71aW.js → simrel-BB4Jrr32.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-UmvgIqDk.js → widget-base-B3Oq8pjs.js} +1 -1
- package/package.json +21 -39
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ The chat widget includes a built-in history entry point in the header. Past chat
|
|
|
97
97
|
|
|
98
98
|
## Customization
|
|
99
99
|
|
|
100
|
-
**Theme tokens** —
|
|
100
|
+
**Theme tokens** — configure visual defaults at the SDK boundary:
|
|
101
101
|
```ts
|
|
102
102
|
chat.init({
|
|
103
103
|
theme: { primaryColor: '#f27a1a', headerBg: '#1a1a2e' },
|
|
@@ -128,9 +128,9 @@ await initOverlayWidgets({
|
|
|
128
128
|
|
|
129
129
|
**SimBut customization** — use theme tokens, `i18n.findSimilarLabel`, and `onFindSimilar` for the PDP image-overlay pill.
|
|
130
130
|
|
|
131
|
-
**
|
|
131
|
+
**Reusable component changes** — update SDK components and keep `catalog.ts`, public exports, tests, and catalog previews in sync.
|
|
132
132
|
|
|
133
|
-
See [docs/customization.md](docs/customization.md) for the
|
|
133
|
+
See [docs/customization.md](docs/customization.md) for the supported SDK customization surface.
|
|
134
134
|
|
|
135
135
|
---
|
|
136
136
|
|
|
@@ -138,30 +138,16 @@ See [docs/customization.md](docs/customization.md) for the fork and merchant-cus
|
|
|
138
138
|
|
|
139
139
|
```bash
|
|
140
140
|
npm install
|
|
141
|
-
npm run dev -- koctascomtr --sku=1000465056 # Local dev server with HMR
|
|
142
|
-
npm run koctascomtr # Merchant shortcut with the seeded demo SKU
|
|
143
|
-
npm run trendyolcom # Another merchant shortcut using its default PDP SKU
|
|
144
141
|
npm run typecheck # TypeScript strict check
|
|
145
142
|
npm run test # Unit tests
|
|
146
143
|
npm run test:chat-history # Targeted history + restore regression suite
|
|
147
144
|
npm run build # Build to dist/
|
|
148
|
-
npm run catalog # Visual component catalog at :3002
|
|
145
|
+
npm run catalog # Visual component catalog at :3002, with fixed generic styling presets
|
|
149
146
|
npm run docs:build # Build contributor docs with VitePress
|
|
150
147
|
```
|
|
151
148
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
npm run dev -- koctascomtr --sku=1000465056 --backend-url=http://localhost:7860
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
The local demos use the shared `defaultDevBackend` value from `demos/shared/default-dev-backend.ts`. For account-specific testing, set `MIDDLEWARE_URL` to the backend service location provided for your Gengage account:
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
MIDDLEWARE_URL=http://localhost:7860 npm run dev -- koctascomtr --sku=1000465056
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
Merchant demo pages under `demos/` now seed a default PDP SKU for direct launch flows, and the affected PDP shells hydrate their breadcrumb, summary content, and gallery imagery from middleware `productDetails` when the backend is available.
|
|
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 `configs.gengage.ai`.
|
|
165
151
|
|
|
166
152
|
---
|
|
167
153
|
|
|
@@ -180,7 +166,6 @@ Merchant demo pages under `demos/` now seed a default PDP SKU for direct launch
|
|
|
180
166
|
| [Security](docs/security-production.md) | Production CSP, postMessage origins, sanitization |
|
|
181
167
|
| [Analytics](docs/analytics-contract.md) | GTM/GA dataLayer event mapping |
|
|
182
168
|
| [Mobile SDK](docs/native-mobile-sdk.md) | Android/iOS/React Native integration |
|
|
183
|
-
| [New Account](docs/new-account-guide.md) | Adding a new merchant demo |
|
|
184
169
|
| [AGENTS](AGENTS.md) | Coding-agent architecture and code-path index |
|
|
185
170
|
| [Contributing](CONTRIBUTING.md) | Shared SDK contribution workflow |
|
|
186
171
|
|
|
@@ -196,7 +181,6 @@ src/
|
|
|
196
181
|
simrel/ # Similar products widget (GengageSimRel class + components)
|
|
197
182
|
simbut/ # PDP image overlay pill widget (GengageSimBut class)
|
|
198
183
|
native/ # Native WebView bridge exports
|
|
199
|
-
demos/ # Merchant-branded demo pages and framework integration examples
|
|
200
184
|
catalog/ # Visual component catalog (mock data, no backend)
|
|
201
185
|
docs/ # Architecture, wire protocol, customization, analytics
|
|
202
186
|
tests/ # Vitest unit tests + Playwright E2E
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { InjectorAdapter } from '../../common/transport.js';
|
|
2
|
+
import type { AccountModule, BeaconCallback, ToolMap } from '../types.js';
|
|
3
|
+
interface CreateInjectorAdapterArgs {
|
|
4
|
+
accountId: string;
|
|
5
|
+
worker: Worker;
|
|
6
|
+
beUrl: string;
|
|
7
|
+
devJwtSecret?: string | undefined;
|
|
8
|
+
tokenBrokerUrl?: string | undefined;
|
|
9
|
+
tokenBrokerAudience?: string | undefined;
|
|
10
|
+
defaultLocale?: string | undefined;
|
|
11
|
+
tools?: ToolMap | undefined;
|
|
12
|
+
beacon?: BeaconCallback | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare function createInjectorAdapter({ accountId, worker, beUrl, devJwtSecret, tokenBrokerUrl, tokenBrokerAudience, defaultLocale, tools, beacon, }: CreateInjectorAdapterArgs): InjectorAdapter;
|
|
15
|
+
interface CreateMainThreadInjectorAdapterArgs extends Omit<CreateInjectorAdapterArgs, 'worker'> {
|
|
16
|
+
accountModule: AccountModule;
|
|
17
|
+
}
|
|
18
|
+
export declare function createMainThreadInjectorAdapter({ accountId, accountModule, beUrl, devJwtSecret, tokenBrokerUrl, tokenBrokerAudience, defaultLocale, tools, beacon, }: CreateMainThreadInjectorAdapterArgs): InjectorAdapter;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { InjectorAdapter } from '../../common/transport.js';
|
|
2
|
+
interface InstallFetchBridgeArgs {
|
|
3
|
+
accountId: string;
|
|
4
|
+
streamTransport: InjectorAdapter;
|
|
5
|
+
}
|
|
6
|
+
interface InstallFetchBridgeResult {
|
|
7
|
+
middlewareUrl: string;
|
|
8
|
+
stop: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function installFetchTransportBridge({ accountId, streamTransport, }: InstallFetchBridgeArgs): InstallFetchBridgeResult;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { AccountModule, BeaconCallback, ToolMap } from '../types.js';
|
|
2
|
+
interface MountAccountArgs {
|
|
3
|
+
accountId: string;
|
|
4
|
+
beUrl: string;
|
|
5
|
+
devJwtSecret?: string;
|
|
6
|
+
tokenBrokerUrl?: string;
|
|
7
|
+
tokenBrokerAudience?: string;
|
|
8
|
+
workerUrl: string;
|
|
9
|
+
defaultLocale?: string;
|
|
10
|
+
accountModule: AccountModule;
|
|
11
|
+
tools?: ToolMap;
|
|
12
|
+
beacon?: BeaconCallback;
|
|
13
|
+
allowBlobWorker?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface AgentDiagnostics {
|
|
16
|
+
accountId: string;
|
|
17
|
+
beUrl: string;
|
|
18
|
+
workerUrl: string;
|
|
19
|
+
mounted: boolean;
|
|
20
|
+
transport: 'worker' | 'main-thread';
|
|
21
|
+
flows: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface AgentController {
|
|
24
|
+
type: 'agent';
|
|
25
|
+
stop: () => void;
|
|
26
|
+
diagnostics: () => AgentDiagnostics;
|
|
27
|
+
}
|
|
28
|
+
interface ModuleWorkerHandle {
|
|
29
|
+
worker: Worker;
|
|
30
|
+
cleanup: () => void;
|
|
31
|
+
}
|
|
32
|
+
interface CreateModuleWorkerOptions {
|
|
33
|
+
allowBlobWorker?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function mountAccount({ accountId, beUrl, devJwtSecret, tokenBrokerUrl, tokenBrokerAudience, workerUrl, defaultLocale, accountModule, tools, beacon, allowBlobWorker, }: MountAccountArgs): AgentController;
|
|
36
|
+
export declare function canUseModuleWorker(workerUrl: string): boolean;
|
|
37
|
+
export declare function createModuleWorker(workerUrl: string, name: string, options?: CreateModuleWorkerOptions): ModuleWorkerHandle;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChatContext } from '../types.js';
|
|
2
|
+
interface CreateChatContextArgs {
|
|
3
|
+
accountId: string;
|
|
4
|
+
locale?: string | undefined;
|
|
5
|
+
parentUrl?: string | undefined;
|
|
6
|
+
threadId?: string | undefined;
|
|
7
|
+
incomingContext?: unknown;
|
|
8
|
+
}
|
|
9
|
+
interface IncomingMessageLike {
|
|
10
|
+
role?: unknown;
|
|
11
|
+
content?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export declare function createChatContext(args: CreateChatContextArgs): ChatContext;
|
|
14
|
+
export declare function appendMessage(context: ChatContext, message: IncomingMessageLike): ChatContext;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ProcessActionRequest } from '../../common/transport.js';
|
|
2
|
+
import type { ChatContext, RpcFn } from '../types.js';
|
|
3
|
+
interface ContextStoreOptions {
|
|
4
|
+
accountId: string;
|
|
5
|
+
locale?: string | undefined;
|
|
6
|
+
parentUrl?: string | undefined;
|
|
7
|
+
rpc: RpcFn;
|
|
8
|
+
}
|
|
9
|
+
type PatchInput = Partial<ChatContext> | null | undefined | ((current: ChatContext) => Partial<ChatContext> | null | undefined);
|
|
10
|
+
export declare class ContextStore {
|
|
11
|
+
#private;
|
|
12
|
+
constructor({ accountId, locale, parentUrl, rpc }: ContextStoreOptions);
|
|
13
|
+
load(request: (ProcessActionRequest & {
|
|
14
|
+
sessionId?: string;
|
|
15
|
+
}) | null | undefined): Promise<ChatContext>;
|
|
16
|
+
patch(threadId: string | null | undefined, patch: PatchInput): ChatContext | null;
|
|
17
|
+
appendUserMessage(threadId: string | null | undefined, text: string): ChatContext | null;
|
|
18
|
+
commit(threadId: string | null | undefined): Promise<ChatContext | null>;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RpcFn } from '../types.js';
|
|
2
|
+
interface LoadArgs {
|
|
3
|
+
accountId: string;
|
|
4
|
+
threadId: string;
|
|
5
|
+
rpc: RpcFn;
|
|
6
|
+
}
|
|
7
|
+
interface SaveArgs extends LoadArgs {
|
|
8
|
+
extensions: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
export declare function loadStickyContext({ accountId, threadId, rpc }: LoadArgs): Promise<Record<string, unknown>>;
|
|
11
|
+
export declare function saveStickyContext({ accountId, threadId, extensions, rpc }: SaveArgs): Promise<void>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StreamEventAction, StreamEventDone, StreamEventError, StreamEventMetadata, StreamEventTextChunk, StreamEventUISpec } from '../../common/types.js';
|
|
2
|
+
import type { UiSpecEnvelope } from '../types.js';
|
|
3
|
+
export declare function metadata(args?: Record<string, unknown>): StreamEventMetadata;
|
|
4
|
+
type TextChunkExtras = Omit<StreamEventTextChunk, 'type' | 'content' | 'final'>;
|
|
5
|
+
export declare function textChunk(content: string, final?: boolean, extras?: TextChunkExtras): StreamEventTextChunk;
|
|
6
|
+
export declare function uiSpec(args: UiSpecEnvelope): StreamEventUISpec;
|
|
7
|
+
export declare function action(payload: StreamEventAction['action']): StreamEventAction;
|
|
8
|
+
export declare function error(code: string, message: string): StreamEventError;
|
|
9
|
+
export declare function done(): StreamEventDone;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { StreamEventError } from '../../common/types.js';
|
|
2
|
+
interface AgentErrorOptions {
|
|
3
|
+
source?: string;
|
|
4
|
+
sourceCode?: string;
|
|
5
|
+
detail?: unknown;
|
|
6
|
+
}
|
|
7
|
+
export declare class AgentError extends Error {
|
|
8
|
+
readonly code: string;
|
|
9
|
+
readonly source: string;
|
|
10
|
+
readonly sourceCode?: string;
|
|
11
|
+
readonly detail?: unknown;
|
|
12
|
+
constructor(code: string, message: string, options?: AgentErrorOptions);
|
|
13
|
+
}
|
|
14
|
+
interface BeErrorLike {
|
|
15
|
+
code?: unknown;
|
|
16
|
+
detail?: unknown;
|
|
17
|
+
}
|
|
18
|
+
export declare function beErrorToAgentError(beError: BeErrorLike | null | undefined): AgentError;
|
|
19
|
+
interface HttpErrorBody {
|
|
20
|
+
error?: {
|
|
21
|
+
code?: unknown;
|
|
22
|
+
detail?: unknown;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare function httpErrorToAgentError(status: number, body: HttpErrorBody | null | undefined): AgentError;
|
|
26
|
+
export declare function caughtToStreamError(caught: unknown): StreamEventError;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account-agnostic product normalization. Maps a wide variety of catalog
|
|
3
|
+
* shapes (Algolia hits, scraped JSON-LD, direct product feeds) into the
|
|
4
|
+
* minimal field set that FE's ProductCard / ProductDetailsPanel renderers
|
|
5
|
+
* consume. Used by the UI-spec builders.
|
|
6
|
+
*/
|
|
7
|
+
export interface NormalizedProduct {
|
|
8
|
+
sku: string;
|
|
9
|
+
name: string;
|
|
10
|
+
url: string;
|
|
11
|
+
imageUrl?: string;
|
|
12
|
+
images?: string[];
|
|
13
|
+
price?: string;
|
|
14
|
+
originalPrice?: string;
|
|
15
|
+
brand?: string;
|
|
16
|
+
rating?: number;
|
|
17
|
+
reviewCount?: number;
|
|
18
|
+
cartCode?: string;
|
|
19
|
+
inStock?: boolean;
|
|
20
|
+
categoryNames?: string[];
|
|
21
|
+
}
|
|
22
|
+
export interface TrimmedProductFacts {
|
|
23
|
+
sku: unknown;
|
|
24
|
+
name?: unknown;
|
|
25
|
+
url?: unknown;
|
|
26
|
+
price?: unknown;
|
|
27
|
+
currency?: unknown;
|
|
28
|
+
category?: unknown;
|
|
29
|
+
category_names?: unknown;
|
|
30
|
+
image?: unknown;
|
|
31
|
+
in_stock?: unknown;
|
|
32
|
+
rating?: unknown;
|
|
33
|
+
review_count?: unknown;
|
|
34
|
+
}
|
|
35
|
+
export declare function normalizeProduct(product: unknown): NormalizedProduct | null;
|
|
36
|
+
/**
|
|
37
|
+
* Compact product facts for BE LLM-op evidence. Account-agnostic core —
|
|
38
|
+
* keeps fields aligned with BE's shared productSchema (sharedSchemas.ts)
|
|
39
|
+
* and drops merchant-internal noise (cart codes, group ids, full image
|
|
40
|
+
* arrays, internal flags). Account-specific trimmers can wrap this and
|
|
41
|
+
* add domain-specific facet fields (e.g. occasion, color) on top.
|
|
42
|
+
*/
|
|
43
|
+
export declare function trimProductFactsCore(product: unknown): unknown;
|
|
44
|
+
export declare function trimProductFactsListCore(products: unknown): unknown[];
|
|
45
|
+
export declare function firstString(...values: unknown[]): string;
|
|
46
|
+
export declare function numberValue(value: unknown): number;
|
|
47
|
+
export declare function stringList(value: unknown): string[];
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Account-agnostic UI-spec builders for FE-facing StreamEvents.
|
|
3
|
+
*
|
|
4
|
+
* Account flows compose these to emit `ui_spec` events. They produce the
|
|
5
|
+
* generic `chat` widget envelope used across all merchants. Account-specific
|
|
6
|
+
* decoration (occasion-aware copy, brand-themed cards, etc.) belongs in
|
|
7
|
+
* the account folder, but the structural specs live here.
|
|
8
|
+
*/
|
|
9
|
+
import type { UiSpecEnvelope } from '../types.js';
|
|
10
|
+
import { firstString, numberValue, stringList } from './product-normalize.js';
|
|
11
|
+
interface ActionRequest {
|
|
12
|
+
title?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
payload?: unknown;
|
|
15
|
+
}
|
|
16
|
+
interface ActionEntry {
|
|
17
|
+
label?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
shortName?: string;
|
|
20
|
+
action?: ActionRequest;
|
|
21
|
+
requestDetails?: ActionRequest;
|
|
22
|
+
request_details?: ActionRequest;
|
|
23
|
+
}
|
|
24
|
+
interface ComparisonInput {
|
|
25
|
+
multiple_product_details?: unknown[];
|
|
26
|
+
products?: unknown[];
|
|
27
|
+
recommended_choice_sku?: string;
|
|
28
|
+
recommended_choice?: string;
|
|
29
|
+
table?: Record<string, unknown>;
|
|
30
|
+
key_differences?: unknown;
|
|
31
|
+
special_considerations?: unknown;
|
|
32
|
+
}
|
|
33
|
+
export declare function productsUiSpec(products?: unknown[]): UiSpecEnvelope;
|
|
34
|
+
export declare function productDetailsUiSpec(product: unknown): UiSpecEnvelope;
|
|
35
|
+
export declare function comparisonUiSpec(comparison?: ComparisonInput): UiSpecEnvelope;
|
|
36
|
+
export declare function actionButtonsUiSpec(actions?: ActionEntry[]): UiSpecEnvelope;
|
|
37
|
+
export { firstString, numberValue, stringList };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const beautyConsultingTurnFlow: import("../types.js").Flow;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { createInjectorAdapter, createMainThreadInjectorAdapter } from './adaptor/create-adaptor.js';
|
|
2
|
+
export { installFetchTransportBridge } from './adaptor/fetch-bridge.js';
|
|
3
|
+
export { canUseModuleWorker, createModuleWorker, mountAccount } from './adaptor/mount.js';
|
|
4
|
+
export { ContextStore } from './context/context-store.js';
|
|
5
|
+
export { action, done, error, metadata, textChunk, uiSpec } from './events/builders.js';
|
|
6
|
+
export { AgentError, beErrorToAgentError, caughtToStreamError, httpErrorToAgentError, } from './events/error-taxonomy.js';
|
|
7
|
+
export { normalizeProduct, trimProductFactsCore, trimProductFactsListCore } from './events/product-normalize.js';
|
|
8
|
+
export { actionButtonsUiSpec, comparisonUiSpec, productDetailsUiSpec, productsUiSpec } from './events/ui-specs.js';
|
|
9
|
+
export { beautyConsultingTurnFlow } from './flow/beauty-consulting-turn.js';
|
|
10
|
+
export { createFlow } from './flow/create-flow.js';
|
|
11
|
+
export { resolveFlow } from './flow/dispatch.js';
|
|
12
|
+
export { setAssistantHostVisible } from './util/assistant-host.js';
|
|
13
|
+
export { resolveBeUrl } from './util/be-url.js';
|
|
14
|
+
export { createBrowserMemory, stableKey } from './util/browser-memory.js';
|
|
15
|
+
export { createDiagnosticsTool, createReadPageTool, installBrowserTools } from './util/browser-tools.js';
|
|
16
|
+
export { startLazyRuntimeLoader } from './util/lazy-runtime-loader.js';
|
|
17
|
+
export { requestText } from './util/request-text.js';
|
|
18
|
+
export { elapsedMs, nowIso } from './util/time.js';
|