@gengage/assistant-fe 0.6.17 → 0.6.18
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/{request-text-DThlE-Xd.js → account-config-gj7_mF6Q.js} +725 -312
- package/dist/agentic/events/comparison.d.ts +6 -0
- package/dist/agentic/events/context-products.d.ts +6 -0
- package/dist/agentic/index.d.ts +8 -0
- package/dist/agentic/index.js +251 -168
- package/dist/agentic/recipes/catalog-assistant-flow.d.ts +50 -0
- package/dist/agentic/recipes/input-text/actions.d.ts +15 -0
- package/dist/agentic/recipes/input-text/index.d.ts +4 -0
- package/dist/agentic/recipes/input-text/products.d.ts +4 -0
- package/dist/agentic/recipes/input-text/ranking.d.ts +14 -0
- package/dist/agentic/recipes/input-text/steps.d.ts +31 -0
- package/dist/agentic/util/account-config.d.ts +8 -0
- package/dist/agentic/util/privacy.d.ts +12 -0
- package/dist/agentic/widgets/endpoints.d.ts +12 -0
- package/dist/agentic/worker.d.ts +8 -0
- package/dist/agentic/worker.js +415 -106
- package/dist/agentic.iife.js +7 -5
- package/dist/{api-paths-xsHH9jtm.js → api-paths-CEDR4rld.js} +1 -1
- package/dist/chat-runtime.js +1 -1
- package/dist/{chat-BP-yXukW.js → chat-rvSffJXw.js} +1 -1
- package/dist/chat.iife.js +11 -11
- package/dist/chat.js +2 -2
- package/dist/{common-O0BUdXOn.js → common-BBgWfT-W.js} +3 -3
- package/dist/common.js +8 -8
- package/dist/{connection-warning-DWMfjv0Y.js → connection-warning-B-doodzu.js} +1 -1
- package/dist/{fastIntent-RTSVRJhw.js → fastIntent-CloHPZQh.js} +2 -2
- package/dist/index.js +13 -13
- package/dist/{native-webview-U9HtGabb.js → native-webview-NWc9LrJh.js} +1 -1
- package/dist/native.iife.js +2 -2
- package/dist/native.js +1 -1
- package/dist/{overlay-ClYgI2Kl.js → overlay-COzFFq0-.js} +1 -1
- package/dist/overlay.js +2 -2
- package/dist/{qna-B3lMzHvS.js → qna-DUs97irI.js} +1 -1
- package/dist/qna-runtime.js +1 -1
- package/dist/qna.iife.js +1 -1
- package/dist/qna.js +2 -2
- package/dist/{runtime-n7fEJGDt.js → runtime-BGCNkU1H.js} +6 -6
- package/dist/{runtime-BKU-NQXf.js → runtime-CbWCU424.js} +116 -116
- package/dist/{runtime-COh3CwNU.js → runtime-Ctqq0V6G.js} +8 -8
- package/dist/{simbut-DaFCfvp7.js → simbut-Dh4cJysK.js} +3 -3
- package/dist/simbut.iife.js +1 -1
- package/dist/simbut.js +1 -1
- package/dist/{simrel-CX1JBDa5.js → simrel-B-sjHbL5.js} +4 -4
- package/dist/simrel-runtime.js +1 -1
- package/dist/simrel.iife.js +2 -2
- package/dist/simrel.js +2 -2
- package/dist/{widget-base-DoZrhVze.js → widget-base-CIJT5AiP.js} +2 -2
- package/package.json +1 -1
- /package/dist/{context-BBuSsXZ9.js → context-heG8hv5l.js} +0 -0
- /package/dist/{locale-CfqNifrU.js → locale-uQ5XZ2yS.js} +0 -0
- /package/dist/{price-formatter-CFsWT0lP.js → price-formatter-CHUmYq8I.js} +0 -0
- /package/dist/{request-response-cache-zsgz3Awp.js → request-response-cache-BxRsKGJ0.js} +0 -0
- /package/dist/{schemas-Cq2blsO_.js → schemas-BnYUhYSy.js} +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Flow, FlowStepCtx } from '../types.js';
|
|
2
|
+
export type CatalogAssistantRoute = 'addToCart' | 'compare' | 'similar' | 'search' | 'review' | 'like' | 'home' | 'product';
|
|
3
|
+
export interface CatalogAssistantCopy {
|
|
4
|
+
productQuestion: string;
|
|
5
|
+
compareQuestion: string;
|
|
6
|
+
searchGoal: string;
|
|
7
|
+
similarGoal: string;
|
|
8
|
+
cartActionLabel: string;
|
|
9
|
+
cartSuccess: string | ((ctx: FlowStepCtx) => string);
|
|
10
|
+
cartFailure: string | ((ctx: FlowStepCtx) => string);
|
|
11
|
+
comparisonReady: string | ((ctx: FlowStepCtx) => string);
|
|
12
|
+
comparisonFallback: (products: unknown[]) => string;
|
|
13
|
+
productFallback: (product: unknown | undefined) => string;
|
|
14
|
+
searchResult: (products: unknown[], goal: string) => string;
|
|
15
|
+
reviewUnavailable: string | ((ctx: FlowStepCtx) => string);
|
|
16
|
+
likeAcknowledged: string | ((ctx: FlowStepCtx) => string);
|
|
17
|
+
homeIntro: string | ((ctx: FlowStepCtx) => string);
|
|
18
|
+
}
|
|
19
|
+
export interface CatalogAssistantRoutePatterns {
|
|
20
|
+
addToCart?: RegExp;
|
|
21
|
+
compare?: RegExp;
|
|
22
|
+
similar?: RegExp;
|
|
23
|
+
search?: RegExp;
|
|
24
|
+
}
|
|
25
|
+
export interface CatalogAssistantFlowOptions {
|
|
26
|
+
accountId: string;
|
|
27
|
+
homeUrl: string;
|
|
28
|
+
copy: CatalogAssistantCopy;
|
|
29
|
+
cacheTtlS?: number;
|
|
30
|
+
limit?: number;
|
|
31
|
+
routePatterns?: CatalogAssistantRoutePatterns;
|
|
32
|
+
readPageToolName?: string;
|
|
33
|
+
searchToolName?: string;
|
|
34
|
+
similarityToolName?: string;
|
|
35
|
+
resolveProductsToolName?: string;
|
|
36
|
+
addToCartToolName?: string;
|
|
37
|
+
productAnswerOpName?: string;
|
|
38
|
+
topPicksOpName?: string;
|
|
39
|
+
compareOpName?: string;
|
|
40
|
+
anonymousRequestText?: (request: FlowStepCtx['request']) => string;
|
|
41
|
+
trimProductFacts?: (product: unknown) => unknown;
|
|
42
|
+
trimProductFactsList?: (products: unknown[]) => unknown[];
|
|
43
|
+
productFromPage?: (page: unknown) => unknown | undefined;
|
|
44
|
+
}
|
|
45
|
+
export interface CatalogAssistantFlowResult {
|
|
46
|
+
flow: Flow;
|
|
47
|
+
flows: Record<string, Flow>;
|
|
48
|
+
}
|
|
49
|
+
export declare function createCatalogAssistantFlow(options: CatalogAssistantFlowOptions): CatalogAssistantFlowResult;
|
|
50
|
+
export declare function routeCatalogAssistantRequest(request: FlowStepCtx['request'] | undefined, patterns?: CatalogAssistantRoutePatterns): CatalogAssistantRoute;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ProductActionOptions {
|
|
2
|
+
includeCompare?: boolean;
|
|
3
|
+
includeSpecs?: boolean;
|
|
4
|
+
includeSimilar?: boolean;
|
|
5
|
+
labels?: {
|
|
6
|
+
compare?: string;
|
|
7
|
+
specs?: string;
|
|
8
|
+
similar?: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function productActions(product: Record<string, unknown>, options?: ProductActionOptions): Record<string, unknown>[];
|
|
12
|
+
export declare function productPanelActions(products: unknown, options?: ProductActionOptions): Record<string, unknown>[];
|
|
13
|
+
export declare function actionCandidatePayload(label: unknown, requestDetails: unknown): Record<string, unknown>;
|
|
14
|
+
export declare function normalizeSuggestedActions(actions: unknown, limit?: number): Record<string, unknown>[];
|
|
15
|
+
export declare function normalizeActionLabel(label: unknown, maxLength?: number): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { hasProductImage, hasUsablePrice, hasVisibleShoppingFacts, normalizeQueryText, productRankScore, productSearchText, rankedSearchProducts, rankingTokens, type RankedSearchOptions, } from './ranking.js';
|
|
2
|
+
export { panelProductScore, prioritizePanelProducts, productsMatchingParams, uniqueProducts } from './products.js';
|
|
3
|
+
export { actionCandidatePayload, normalizeActionLabel, normalizeSuggestedActions, productActions, productPanelActions, type ProductActionOptions, } from './actions.js';
|
|
4
|
+
export { compareCachedResultSteps, compareResultSteps, compareSearchSteps, compareSteps, intentQuestionSteps, panelQuestionSteps, productQuestionSteps, searchResultSteps, searchSteps, suggestedActionSteps, type CanonicalStepOptions, } from './steps.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function uniqueProducts(products: unknown): Record<string, unknown>[];
|
|
2
|
+
export declare function productsMatchingParams(products: unknown, params: unknown): Record<string, unknown>[];
|
|
3
|
+
export declare function prioritizePanelProducts(products: unknown, panelProducts: unknown, limit?: number): Record<string, unknown>[];
|
|
4
|
+
export declare function panelProductScore(product: Record<string, unknown>, panelKeys: ReadonlySet<string>): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface RankedSearchOptions {
|
|
2
|
+
limit?: number;
|
|
3
|
+
query?: unknown;
|
|
4
|
+
searchInput?: Record<string, unknown> | null;
|
|
5
|
+
intent?: Record<string, unknown> | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function rankedSearchProducts(products: unknown, options?: RankedSearchOptions): Record<string, unknown>[];
|
|
8
|
+
export declare function productRankScore(product: Record<string, unknown>, options?: RankedSearchOptions): number;
|
|
9
|
+
export declare function rankingTokens(options?: RankedSearchOptions): string[];
|
|
10
|
+
export declare function hasUsablePrice(product: Record<string, unknown>): boolean;
|
|
11
|
+
export declare function hasProductImage(product: Record<string, unknown>): boolean;
|
|
12
|
+
export declare function hasVisibleShoppingFacts(product: Record<string, unknown>): boolean;
|
|
13
|
+
export declare function productSearchText(product: Record<string, unknown>): string;
|
|
14
|
+
export declare function normalizeQueryText(value: unknown): string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { FlowPatch, FlowStep, FlowValue } from '../../types.js';
|
|
2
|
+
export interface CanonicalStepOptions {
|
|
3
|
+
steps?: FlowStep[];
|
|
4
|
+
toolName?: string;
|
|
5
|
+
beOpName?: string;
|
|
6
|
+
input?: FlowValue<unknown>;
|
|
7
|
+
cacheTtlS?: FlowValue<number | undefined>;
|
|
8
|
+
cacheKey?: FlowValue<string | undefined>;
|
|
9
|
+
browserCache?: FlowValue<boolean | {
|
|
10
|
+
ttlMs?: number;
|
|
11
|
+
} | undefined>;
|
|
12
|
+
out?: string;
|
|
13
|
+
errorOut?: string;
|
|
14
|
+
patch?: FlowPatch;
|
|
15
|
+
onError?: readonly FlowStep[];
|
|
16
|
+
emitProducts?: boolean;
|
|
17
|
+
emitProductDetails?: boolean;
|
|
18
|
+
emitComparison?: boolean;
|
|
19
|
+
emitActions?: boolean;
|
|
20
|
+
emitText?: FlowValue<string>;
|
|
21
|
+
}
|
|
22
|
+
export declare function intentQuestionSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
23
|
+
export declare function searchSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
24
|
+
export declare function productQuestionSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
25
|
+
export declare function panelQuestionSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
26
|
+
export declare function compareSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
27
|
+
export declare function compareSearchSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
28
|
+
export declare function compareCachedResultSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
29
|
+
export declare function compareResultSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
30
|
+
export declare function searchResultSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
31
|
+
export declare function suggestedActionSteps(options?: CanonicalStepOptions): FlowStep[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface AccountConfigPayloadOptions {
|
|
2
|
+
baseKeys?: readonly string[];
|
|
3
|
+
opAllowlist?: Readonly<Record<string, readonly string[]>>;
|
|
4
|
+
}
|
|
5
|
+
export declare function withAccountConfig<T extends Record<string, unknown>>(payload: T, accountConfig: Record<string, unknown> | null | undefined, opName: string, options?: AccountConfigPayloadOptions): T & {
|
|
6
|
+
account_config?: Record<string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
export declare function compactAccountConfig(accountConfig: Record<string, unknown> | null | undefined, opName: string, options?: AccountConfigPayloadOptions): Record<string, unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ProcessActionRequest } from '../../common/transport.js';
|
|
2
|
+
export interface RedactionPattern {
|
|
3
|
+
pattern: RegExp;
|
|
4
|
+
replacement: string | ((value: string) => string);
|
|
5
|
+
}
|
|
6
|
+
export interface RedactionPatternPack {
|
|
7
|
+
patterns?: readonly RedactionPattern[];
|
|
8
|
+
}
|
|
9
|
+
export declare const defaultPiiPatterns: readonly RedactionPattern[];
|
|
10
|
+
export declare const defaultPiiPatternPack: RedactionPatternPack;
|
|
11
|
+
export declare function redactPii(value: unknown, patternPack?: RedactionPatternPack): string;
|
|
12
|
+
export declare function anonymousRequestText(request: ProcessActionRequest | null | undefined, patternPack?: RedactionPatternPack): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InjectorBridgeEndpoint, InjectorEndpointHandler } from '../../common/transport.js';
|
|
2
|
+
import type { EndpointCachePolicyResolver } from '../adaptor/fetch-bridge.js';
|
|
3
|
+
export interface EndpointCachePolicyOptions {
|
|
4
|
+
partitionPrefix: string;
|
|
5
|
+
version?: string;
|
|
6
|
+
ttlMs?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function endpointStableKey(endpoint: InjectorBridgeEndpoint, request: unknown, version?: string): string;
|
|
9
|
+
export declare function createEndpointCachePolicies(options: EndpointCachePolicyOptions): Partial<Record<InjectorBridgeEndpoint, EndpointCachePolicyResolver>>;
|
|
10
|
+
export declare function createEndpointHandlers(handlers: Partial<Record<InjectorBridgeEndpoint, InjectorEndpointHandler>>): Partial<Record<InjectorBridgeEndpoint, InjectorEndpointHandler>>;
|
|
11
|
+
export declare function ndjsonResponse(lines: unknown[], init?: ResponseInit): Response;
|
|
12
|
+
export declare function jsonResponse(value: unknown, init?: ResponseInit): Response;
|
package/dist/agentic/worker.d.ts
CHANGED
|
@@ -2,13 +2,21 @@ export { ContextStore } from './context/context-store.js';
|
|
|
2
2
|
export { action, done, error, metadata, textChunk, uiSpec } from './events/builders.js';
|
|
3
3
|
export { AgentError, beErrorToAgentError, caughtToStreamError, httpErrorToAgentError, } from './events/error-taxonomy.js';
|
|
4
4
|
export { normalizeProduct, trimProductFactsCore, trimProductFactsListCore } from './events/product-normalize.js';
|
|
5
|
+
export { compactContextProducts } from './events/context-products.js';
|
|
6
|
+
export { alignProductsToTable, comparisonResultForUi, normalizeComparisonTable } from './events/comparison.js';
|
|
5
7
|
export { actionButtonsUiSpec, comparisonUiSpec, productDetailsUiSpec, productsUiSpec } from './events/ui-specs.js';
|
|
6
8
|
export { createFlow } from './flow/create-flow.js';
|
|
7
9
|
export { resolveFlow } from './flow/dispatch.js';
|
|
10
|
+
export { createCatalogAssistantFlow, routeCatalogAssistantRequest, type CatalogAssistantCopy, type CatalogAssistantFlowOptions, type CatalogAssistantFlowResult, type CatalogAssistantRoute, type CatalogAssistantRoutePatterns, } from './recipes/catalog-assistant-flow.js';
|
|
11
|
+
export { actionCandidatePayload, compareCachedResultSteps, compareResultSteps, compareSearchSteps, compareSteps, hasProductImage, hasUsablePrice, hasVisibleShoppingFacts, intentQuestionSteps, normalizeActionLabel, normalizeQueryText, normalizeSuggestedActions, panelProductScore, panelQuestionSteps, prioritizePanelProducts, productActions, productPanelActions, productQuestionSteps, productRankScore, productSearchText, productsMatchingParams, rankedSearchProducts, rankingTokens, searchResultSteps, searchSteps, suggestedActionSteps, uniqueProducts, } from './recipes/input-text/index.js';
|
|
8
12
|
export { buildPhotoSimilarityProfile, buildProductSimilarityProfile, buildSimilarityQueries, normalizeSimilarityText, rankSimilarProducts, scoreSimilarityCandidate, tokenizeSimilarityText, type PhotoSimilaritySignals, type ProductSimilarityProfile, type SimilarityProductLike, type SimilarityRankedProduct, type SimilarityRankingOptions, type SimilarityScore, type SimilarityWeights, } from './similarity.js';
|
|
9
13
|
export { requestText } from './util/request-text.js';
|
|
14
|
+
export { anonymousRequestText, defaultPiiPatternPack, defaultPiiPatterns, redactPii } from './util/privacy.js';
|
|
15
|
+
export { compactAccountConfig, withAccountConfig } from './util/account-config.js';
|
|
10
16
|
export { llmCacheKey, productFactsKey, productSkuKey, stableKey, textKey } from './util/cache-key.js';
|
|
11
17
|
export type { LlmCacheKeyOptions, ProductFactsKeyOptions, ProductKeyOptions } from './util/cache-key.js';
|
|
18
|
+
export type { RedactionPattern, RedactionPatternPack } from './util/privacy.js';
|
|
19
|
+
export type { AccountConfigPayloadOptions } from './util/account-config.js';
|
|
12
20
|
export { elapsedMs, nowIso } from './util/time.js';
|
|
13
21
|
export { invokeBeOp } from './worker/be-client.js';
|
|
14
22
|
export { startWorker } from './worker/entry.js';
|