@syntrologie/adapt-chatbot 2.8.0-canary.62 → 2.8.0-canary.621
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/AdaptiveChatBar.composer.test.d.ts +2 -0
- package/dist/AdaptiveChatBar.composer.test.d.ts.map +1 -0
- package/dist/AdaptiveChatBar.d.ts +248 -0
- package/dist/AdaptiveChatBar.d.ts.map +1 -0
- package/dist/AdaptiveChatBar.interleave.test.d.ts +9 -0
- package/dist/AdaptiveChatBar.interleave.test.d.ts.map +1 -0
- package/dist/AdaptiveChatBar.js +12 -0
- package/dist/AdaptiveChatBar.js.map +7 -0
- package/dist/AdaptiveChatBarMountable.d.ts +93 -0
- package/dist/AdaptiveChatBarMountable.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.d.ts +539 -0
- package/dist/AdaptiveChatTrail.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.follow-bottom.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.follow-bottom.test.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.js +12 -0
- package/dist/AdaptiveChatTrail.js.map +7 -0
- package/dist/AdaptiveChatTrail.live-region.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.live-region.test.d.ts.map +1 -0
- package/dist/AdaptiveChatTrail.test.d.ts +2 -0
- package/dist/AdaptiveChatTrail.test.d.ts.map +1 -0
- package/dist/AdaptiveChipsStrip.d.ts +1156 -0
- package/dist/AdaptiveChipsStrip.d.ts.map +1 -0
- package/dist/AdaptiveChipsStrip.js +11 -0
- package/dist/AdaptiveChipsStrip.js.map +7 -0
- package/dist/AdaptiveChipsStripMountable.d.ts +24 -0
- package/dist/AdaptiveChipsStripMountable.d.ts.map +1 -0
- package/dist/ChatAssistantLit.d.ts +64 -0
- package/dist/ChatAssistantLit.d.ts.map +1 -0
- package/dist/ChatAssistantLit.js +14 -0
- package/dist/ChatAssistantLit.js.map +7 -0
- package/dist/ChatSession.d.ts +275 -0
- package/dist/ChatSession.d.ts.map +1 -0
- package/dist/ChatTransport.d.ts +448 -0
- package/dist/ChatTransport.d.ts.map +1 -0
- package/dist/InlineRegistryWidgetMount.test.d.ts +2 -0
- package/dist/InlineRegistryWidgetMount.test.d.ts.map +1 -0
- package/dist/InlineWidgetLiveMount.test.d.ts +2 -0
- package/dist/InlineWidgetLiveMount.test.d.ts.map +1 -0
- package/dist/LeaveAMessage.leadconnector.integration.test.d.ts +2 -0
- package/dist/LeaveAMessage.leadconnector.integration.test.d.ts.map +1 -0
- package/dist/LeaveAMessageLit.d.ts +329 -0
- package/dist/LeaveAMessageLit.d.ts.map +1 -0
- package/dist/LeaveAMessageLit.test.d.ts +2 -0
- package/dist/LeaveAMessageLit.test.d.ts.map +1 -0
- package/dist/LeaveAMessageMountable.test.d.ts +2 -0
- package/dist/LeaveAMessageMountable.test.d.ts.map +1 -0
- package/dist/NavLinkMountable.d.ts +25 -0
- package/dist/NavLinkMountable.d.ts.map +1 -0
- package/dist/NavLinkMountable.test.d.ts +2 -0
- package/dist/NavLinkMountable.test.d.ts.map +1 -0
- package/dist/TextAnswerMountable.d.ts +17 -0
- package/dist/TextAnswerMountable.d.ts.map +1 -0
- package/dist/TextAnswerMountable.test.d.ts +2 -0
- package/dist/TextAnswerMountable.test.d.ts.map +1 -0
- package/dist/Turnstile.d.ts +101 -0
- package/dist/Turnstile.d.ts.map +1 -0
- package/dist/cdn.d.ts +16 -8
- package/dist/cdn.d.ts.map +1 -1
- package/dist/chunk-4V5L7IRV.js +4711 -0
- package/dist/chunk-4V5L7IRV.js.map +7 -0
- package/dist/chunk-EWPPVPJ4.js +14 -0
- package/dist/chunk-EWPPVPJ4.js.map +7 -0
- package/dist/chunk-HD2NXGYO.js +8445 -0
- package/dist/chunk-HD2NXGYO.js.map +7 -0
- package/dist/chunk-HV52LYST.js +641 -0
- package/dist/chunk-HV52LYST.js.map +7 -0
- package/dist/chunk-LY5AGXVD.js +21 -0
- package/dist/chunk-LY5AGXVD.js.map +7 -0
- package/dist/chunk-T6VEDUXD.js +694 -0
- package/dist/chunk-T6VEDUXD.js.map +7 -0
- package/dist/chunk-UFTSEIQP.js +1877 -0
- package/dist/chunk-UFTSEIQP.js.map +7 -0
- package/dist/chunk-VIRIVP7H.js +898 -0
- package/dist/chunk-VIRIVP7H.js.map +7 -0
- package/dist/chunk-YFZCMLV6.js +4078 -0
- package/dist/chunk-YFZCMLV6.js.map +7 -0
- package/dist/editor-lit.d.ts +37 -0
- package/dist/editor-lit.d.ts.map +1 -0
- package/dist/editor-lit.js +134 -0
- package/dist/editor-lit.js.map +7 -0
- package/dist/editorToken.d.ts +23 -0
- package/dist/editorToken.d.ts.map +1 -0
- package/dist/element-session.d.ts +3 -0
- package/dist/element-session.d.ts.map +1 -0
- package/dist/element-session.js +9 -0
- package/dist/element-session.js.map +7 -0
- package/dist/elements/ActionHandler.d.ts +34 -0
- package/dist/elements/ActionHandler.d.ts.map +1 -0
- package/dist/elements/ElementInstanceStore.d.ts +232 -0
- package/dist/elements/ElementInstanceStore.d.ts.map +1 -0
- package/dist/elements/ElementInstanceStore.test.d.ts +2 -0
- package/dist/elements/ElementInstanceStore.test.d.ts.map +1 -0
- package/dist/elements/ElementSessionController.d.ts +37 -0
- package/dist/elements/ElementSessionController.d.ts.map +1 -0
- package/dist/elements/ElementSessionController.test.d.ts +2 -0
- package/dist/elements/ElementSessionController.test.d.ts.map +1 -0
- package/dist/elements/ElementTypeHandler.d.ts +77 -0
- package/dist/elements/ElementTypeHandler.d.ts.map +1 -0
- package/dist/elements/ItemHandler.d.ts +60 -0
- package/dist/elements/ItemHandler.d.ts.map +1 -0
- package/dist/elements/ItemHandler.test.d.ts +2 -0
- package/dist/elements/ItemHandler.test.d.ts.map +1 -0
- package/dist/elements/TileHandler.d.ts +52 -0
- package/dist/elements/TileHandler.d.ts.map +1 -0
- package/dist/elements/TileHandler.test.d.ts +2 -0
- package/dist/elements/TileHandler.test.d.ts.map +1 -0
- package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts +2 -0
- package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts.map +1 -0
- package/dist/elements/blockRenderer.d.ts +46 -0
- package/dist/elements/blockRenderer.d.ts.map +1 -0
- package/dist/elements/blockRenderer.test.d.ts +13 -0
- package/dist/elements/blockRenderer.test.d.ts.map +1 -0
- package/dist/elements/blocks.d.ts +58 -0
- package/dist/elements/blocks.d.ts.map +1 -0
- package/dist/elements/createElementStore.d.ts +11 -0
- package/dist/elements/createElementStore.d.ts.map +1 -0
- package/dist/elements/envelope.d.ts +24 -0
- package/dist/elements/envelope.d.ts.map +1 -0
- package/dist/elements/fetcher.d.ts +43 -0
- package/dist/elements/fetcher.d.ts.map +1 -0
- package/dist/elements/index.d.ts +33 -0
- package/dist/elements/index.d.ts.map +1 -0
- package/dist/elements/store-singleton.d.ts +4 -0
- package/dist/elements/store-singleton.d.ts.map +1 -0
- package/dist/elements/tileLifecycleProps.d.ts +13 -0
- package/dist/elements/tileLifecycleProps.d.ts.map +1 -0
- package/dist/elements/types.d.ts +117 -0
- package/dist/elements/types.d.ts.map +1 -0
- package/dist/findSmartCanvas.d.ts +19 -0
- package/dist/findSmartCanvas.d.ts.map +1 -0
- package/dist/hostAgentController.d.ts +65 -0
- package/dist/hostAgentController.d.ts.map +1 -0
- package/dist/hostAgentController.test.d.ts +2 -0
- package/dist/hostAgentController.test.d.ts.map +1 -0
- package/dist/observer/__tests__/allowlist.test.d.ts +9 -0
- package/dist/observer/__tests__/allowlist.test.d.ts.map +1 -0
- package/dist/observer/__tests__/bus-translate.test.d.ts +16 -0
- package/dist/observer/__tests__/bus-translate.test.d.ts.map +1 -0
- package/dist/observer/__tests__/detector-observation-contract.test.d.ts +25 -0
- package/dist/observer/__tests__/detector-observation-contract.test.d.ts.map +1 -0
- package/dist/observer/__tests__/lifecycle.test.d.ts +2 -0
- package/dist/observer/__tests__/lifecycle.test.d.ts.map +1 -0
- package/dist/observer/__tests__/observer-enrich.test.d.ts +10 -0
- package/dist/observer/__tests__/observer-enrich.test.d.ts.map +1 -0
- package/dist/observer/__tests__/observer-isolation.test.d.ts +13 -0
- package/dist/observer/__tests__/observer-isolation.test.d.ts.map +1 -0
- package/dist/observer/__tests__/queue.test.d.ts +2 -0
- package/dist/observer/__tests__/queue.test.d.ts.map +1 -0
- package/dist/observer/__tests__/transport.test.d.ts +2 -0
- package/dist/observer/__tests__/transport.test.d.ts.map +1 -0
- package/dist/observer/allowlist.d.ts +32 -0
- package/dist/observer/allowlist.d.ts.map +1 -0
- package/dist/observer/bus-translate.d.ts +33 -0
- package/dist/observer/bus-translate.d.ts.map +1 -0
- package/dist/observer/index.d.ts +44 -0
- package/dist/observer/index.d.ts.map +1 -0
- package/dist/observer/queue.d.ts +63 -0
- package/dist/observer/queue.d.ts.map +1 -0
- package/dist/observer/transport.d.ts +27 -0
- package/dist/observer/transport.d.ts.map +1 -0
- package/dist/observer/wire.d.ts +54 -0
- package/dist/observer/wire.d.ts.map +1 -0
- package/dist/observer/wire.test.d.ts +2 -0
- package/dist/observer/wire.test.d.ts.map +1 -0
- package/dist/personas.d.ts +30 -0
- package/dist/personas.d.ts.map +1 -0
- package/dist/runtime-lit.d.ts +8 -0
- package/dist/runtime-lit.d.ts.map +1 -0
- package/dist/runtime.d.ts +63 -5
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +4439 -28
- package/dist/runtime.js.map +7 -0
- package/dist/schema.d.ts +3688 -11
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +578 -30
- package/dist/schema.js.map +7 -0
- package/dist/support-chat/__tests__/lc-fetch-stub.d.ts +52 -0
- package/dist/support-chat/__tests__/lc-fetch-stub.d.ts.map +1 -0
- package/dist/support-chat/boot.d.ts +47 -0
- package/dist/support-chat/boot.d.ts.map +1 -0
- package/dist/support-chat/boot.test.d.ts +2 -0
- package/dist/support-chat/boot.test.d.ts.map +1 -0
- package/dist/support-chat/crisp.d.ts +4 -0
- package/dist/support-chat/crisp.d.ts.map +1 -0
- package/dist/support-chat/crisp.test.d.ts +2 -0
- package/dist/support-chat/crisp.test.d.ts.map +1 -0
- package/dist/support-chat/inbox.d.ts +57 -0
- package/dist/support-chat/inbox.d.ts.map +1 -0
- package/dist/support-chat/inbox.test.d.ts +2 -0
- package/dist/support-chat/inbox.test.d.ts.map +1 -0
- package/dist/support-chat/leadconnector.d.ts +13 -0
- package/dist/support-chat/leadconnector.d.ts.map +1 -0
- package/dist/support-chat/leadconnector.test.d.ts +2 -0
- package/dist/support-chat/leadconnector.test.d.ts.map +1 -0
- package/dist/support-chat/registry.d.ts +5 -0
- package/dist/support-chat/registry.d.ts.map +1 -0
- package/dist/support-chat/registry.test.d.ts +2 -0
- package/dist/support-chat/registry.test.d.ts.map +1 -0
- package/dist/support-chat/schema-widgetid.test.d.ts +2 -0
- package/dist/support-chat/schema-widgetid.test.d.ts.map +1 -0
- package/dist/support-chat/types.d.ts +19 -0
- package/dist/support-chat/types.d.ts.map +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/dist/types.d.ts +89 -40
- package/dist/types.d.ts.map +1 -1
- package/package.json +49 -24
- package/dist/ChatAssistant.d.ts +0 -18
- package/dist/ChatAssistant.d.ts.map +0 -1
- package/dist/ChatAssistant.js +0 -178
- package/dist/SyntroChatbot.d.ts +0 -14
- package/dist/SyntroChatbot.d.ts.map +0 -1
- package/dist/SyntroChatbot.js +0 -56
- package/dist/actionParser.d.ts +0 -15
- package/dist/actionParser.d.ts.map +0 -1
- package/dist/actionParser.js +0 -52
- package/dist/apiClient.d.ts +0 -23
- package/dist/apiClient.d.ts.map +0 -1
- package/dist/apiClient.js +0 -51
- package/dist/cdn.js +0 -37
- package/dist/editor.d.ts +0 -17
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js +0 -36
- package/dist/tools/bridge.d.ts +0 -26
- package/dist/tools/bridge.d.ts.map +0 -1
- package/dist/tools/bridge.js +0 -25
- package/dist/tools/expanders.d.ts +0 -17
- package/dist/tools/expanders.d.ts.map +0 -1
- package/dist/tools/expanders.js +0 -41
- package/dist/tools/index.d.ts +0 -14
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -11
- package/dist/tools/registrations/GetContextTool.d.ts +0 -7
- package/dist/tools/registrations/GetContextTool.d.ts.map +0 -1
- package/dist/tools/registrations/GetContextTool.js +0 -18
- package/dist/tools/registrations/ScrollToTool.d.ts +0 -7
- package/dist/tools/registrations/ScrollToTool.d.ts.map +0 -1
- package/dist/tools/registrations/ScrollToTool.js +0 -38
- package/dist/tools/registrations/ShowOverlayTool.d.ts +0 -7
- package/dist/tools/registrations/ShowOverlayTool.d.ts.map +0 -1
- package/dist/tools/registrations/ShowOverlayTool.js +0 -47
- package/dist/tools/registrations/index.d.ts +0 -19
- package/dist/tools/registrations/index.d.ts.map +0 -1
- package/dist/tools/registrations/index.js +0 -7
- package/dist/types.js +0 -6
- package/dist/useChat.d.ts +0 -25
- package/dist/useChat.d.ts.map +0 -1
- package/dist/useChat.js +0 -106
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/elements/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** The host canvas element's notification seam, as the adaptives use it. */
|
|
2
|
+
export interface SmartCanvasNotificationHost extends HTMLElement {
|
|
3
|
+
previewNotification?: (opts: {
|
|
4
|
+
title: string;
|
|
5
|
+
body?: string;
|
|
6
|
+
ttl?: number;
|
|
7
|
+
persistent?: boolean;
|
|
8
|
+
onTap?: () => void;
|
|
9
|
+
}) => {
|
|
10
|
+
dismiss: () => void;
|
|
11
|
+
} | undefined | void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Find the page's `<smart-canvas>`, piercing open shadow roots: the canvas
|
|
15
|
+
* usually lives inside one (live finding: a plain `document.querySelector`
|
|
16
|
+
* never found it and the toast silently no-op'd).
|
|
17
|
+
*/
|
|
18
|
+
export declare function findSmartCanvas(): SmartCanvasNotificationHost | null;
|
|
19
|
+
//# sourceMappingURL=findSmartCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"findSmartCanvas.d.ts","sourceRoot":"","sources":["../src/findSmartCanvas.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,WAAW,2BAA4B,SAAQ,WAAW;IAC9D,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;KACpB,KAAK;QAAE,OAAO,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,SAAS,GAAG,IAAI,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,2BAA2B,GAAG,IAAI,CAepE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { ChatbotWidgetRuntime } from './types';
|
|
2
|
+
/** Generic host transport. Agent metadata belongs to this adaptive, not the bridge. */
|
|
3
|
+
export interface HostToolResults {
|
|
4
|
+
subscribeToolResults(listener: (result: unknown) => void, options?: {
|
|
5
|
+
metadataKey?: string;
|
|
6
|
+
}): () => void;
|
|
7
|
+
/**
|
|
8
|
+
* The card's own way to ask the server a question, through the host.
|
|
9
|
+
*
|
|
10
|
+
* A reloaded card has nothing on screen and no live turn to wait for, so it
|
|
11
|
+
* calls the app-only read tool and applies what comes back. The host
|
|
12
|
+
* attaches the shopper's credential, which is why the card needs none.
|
|
13
|
+
*/
|
|
14
|
+
callServerTool?(params: {
|
|
15
|
+
name: string;
|
|
16
|
+
arguments?: Record<string, unknown>;
|
|
17
|
+
}): Promise<unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Called whenever the host says anything about a tool call (input, a
|
|
20
|
+
* result of any shape, a cancellation), and at once on subscribe if it
|
|
21
|
+
* already has. What the missing-result check stands down on.
|
|
22
|
+
*/
|
|
23
|
+
subscribeToolActivity?(listener: () => void): () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Where the tool call this card was drawn for stands, the latest replayed
|
|
26
|
+
* on subscribe. Its input names the session the conversation is in.
|
|
27
|
+
*/
|
|
28
|
+
subscribeToolCall?(listener: (call: {
|
|
29
|
+
phase: 'input';
|
|
30
|
+
arguments: Record<string, unknown>;
|
|
31
|
+
} | {
|
|
32
|
+
phase: 'result';
|
|
33
|
+
} | {
|
|
34
|
+
phase: 'cancelled';
|
|
35
|
+
}) => void): () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* How long a card says its answer is on its way when neither the answer nor a
|
|
39
|
+
* cancellation ever comes (a host that stops a turn without saying so).
|
|
40
|
+
*/
|
|
41
|
+
export declare const PENDING_MAX_MS = 120000;
|
|
42
|
+
export interface HostAgentControllerOptions {
|
|
43
|
+
/** How long a card that has heard nothing waits before reporting it. */
|
|
44
|
+
missingResultMs?: number;
|
|
45
|
+
}
|
|
46
|
+
interface HostUiInitialization {
|
|
47
|
+
setInteractive?(interactive: boolean): void;
|
|
48
|
+
}
|
|
49
|
+
/** One host conversation owns one store; host delivery may synchronously replay. */
|
|
50
|
+
export declare function activateHostAgentController(runtime: ChatbotWidgetRuntime, bridge: HostToolResults, hostUi?: HostUiInitialization, options?: HostAgentControllerOptions): {
|
|
51
|
+
acceptHostUi: (payload: unknown) => void;
|
|
52
|
+
consumeToolResult: (result: unknown, { earlyRead }?: {
|
|
53
|
+
earlyRead?: boolean;
|
|
54
|
+
}) => Promise<void>;
|
|
55
|
+
whenIdle: () => Promise<void>;
|
|
56
|
+
dispose(): void;
|
|
57
|
+
};
|
|
58
|
+
/** App activation runs without mounting a chat widget on MCP host surfaces. */
|
|
59
|
+
export declare function activateHostAgent(runtime: unknown): (() => void) | undefined;
|
|
60
|
+
/** Narrow manifest entry point; runtime owns queueing before adaptive activation. */
|
|
61
|
+
export declare function acceptHostUi(runtime: {
|
|
62
|
+
acceptHostUi?: (payload: unknown) => void;
|
|
63
|
+
}, payload: unknown): void;
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=hostAgentController.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostAgentController.d.ts","sourceRoot":"","sources":["../src/hostAgentController.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,oBAAoB,CAClB,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,EACnC,OAAO,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GACjC,MAAM,IAAI,CAAC;IACd;;;;;;OAMG;IACH,cAAc,CAAC,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACjG;;;;OAIG;IACH,qBAAqB,CAAC,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC;IACzD;;;OAGG;IACH,iBAAiB,CAAC,CAChB,QAAQ,EAAE,CACR,IAAI,EACA;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GACtD;QAAE,KAAK,EAAE,QAAQ,CAAA;KAAE,GACnB;QAAE,KAAK,EAAE,WAAW,CAAA;KAAE,KACvB,IAAI,GACR,MAAM,IAAI,CAAC;CACf;AAYD;;;GAGG;AACH,eAAO,MAAM,cAAc,SAAU,CAAC;AAKtC,MAAM,WAAW,0BAA0B;IACzC,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAwJD,UAAU,oBAAoB;IAC5B,cAAc,CAAC,CAAC,WAAW,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7C;AAsJD,oFAAoF;AACpF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,oBAAoB,EAC7B,MAAM,EAAE,eAAe,EACvB,MAAM,CAAC,EAAE,oBAAoB,EAC7B,OAAO,GAAE,0BAA+B;4BAwaT,OAAO,KAAG,IAAI;gCAiGnC,OAAO,kBACQ;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,KAC7C,OAAO,CAAC,IAAI,CAAC;;;EAkKjB;AA0BD,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CA4D5E;AAED,qFAAqF;AACrF,wBAAgB,YAAY,CAC1B,OAAO,EAAE;IAAE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAA;CAAE,EACtD,OAAO,EAAE,OAAO,GACf,IAAI,CAEN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hostAgentController.test.d.ts","sourceRoot":"","sources":["../src/hostAgentController.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the pure event-allowlist module.
|
|
3
|
+
*
|
|
4
|
+
* Each PostHog autocapture event shape maps to either:
|
|
5
|
+
* - a templated ObservationEvent ready for transport, or
|
|
6
|
+
* - null (drop — not significant).
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=allowlist.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowlist.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/allowlist.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Real-seam tests for the bus-fed observer path.
|
|
3
|
+
*
|
|
4
|
+
* On hosts without a `window.posthog` global, click / rage / dead / form
|
|
5
|
+
* observations reach the chat agent only via the runtime bus, which carries
|
|
6
|
+
* NORMALIZED events (event-processor's PostHog normalizer). This drives the
|
|
7
|
+
* ACTUAL translator (`busEventToRawEvent`) into the ACTUAL matcher
|
|
8
|
+
* (`matchEvent`) with authentic bus-shaped inputs — the exact shape
|
|
9
|
+
* `packages/event-processor/src/normalizers/posthog.ts` emits.
|
|
10
|
+
*
|
|
11
|
+
* Pre-fix, the translator only re-prefixed pathname/url, so matchEvent's
|
|
12
|
+
* `$autocapture` branch read `$event_type: undefined` → returned null. These
|
|
13
|
+
* tests fail against that behavior and pass once the mapping is fixed.
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=bus-translate.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bus-translate.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/bus-translate.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PRODUCER → CONSUMER contract test for the visitor-activity observation tail.
|
|
3
|
+
*
|
|
4
|
+
* Why this file exists (BUG-1786923485, prior instance BUG-1784146789):
|
|
5
|
+
* `allowlist.test.ts` proved the summarizer formats a HAND-AUTHORED props
|
|
6
|
+
* fixture. It could not fail when the detectors that actually feed it spelled
|
|
7
|
+
* their props differently — which is exactly what shipped: the idle detector
|
|
8
|
+
* emitted `idle_ms` while the summarizer read `durationMs`, and the hover
|
|
9
|
+
* tracker emitted a single `element` object while the summarizer read
|
|
10
|
+
* PostHog's `$elements[0].text`. Both rendered content-free observations
|
|
11
|
+
* (`idle`, `hovered on ''`) into the chat model's prompt for months behind a
|
|
12
|
+
* green test suite.
|
|
13
|
+
*
|
|
14
|
+
* So: NOTHING in this file hand-authors a detector payload. Every observation
|
|
15
|
+
* asserted here is produced by feeding real rrweb frames into the real
|
|
16
|
+
* `createEventProcessor`, forwarding whatever it emits through the real
|
|
17
|
+
* `busEventToRawEvent`, and rendering it with the real `matchEvent`. If any
|
|
18
|
+
* link in that chain renames a prop, these assertions go empty and fail.
|
|
19
|
+
*
|
|
20
|
+
* The ONLY thing faked is `document.elementFromPoint` — a layout API jsdom
|
|
21
|
+
* does not implement. The hit-test returns a real element from a real
|
|
22
|
+
* document; the production `createDomElementResolver` then extracts from it.
|
|
23
|
+
*/
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=detector-observation-contract.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detector-observation-contract.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/detector-observation-contract.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/lifecycle.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the observer's per-observation `enrich` hook.
|
|
3
|
+
*
|
|
4
|
+
* The chat-bar uses this hook to attach normalized product identity (from the
|
|
5
|
+
* ACTIVE platform adapter) to click observations before they're queued for the
|
|
6
|
+
* observation POST. The observer itself stays platform-neutral — it just
|
|
7
|
+
* applies whatever transform it's given, AFTER matchEvent, BEFORE queueing.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=observer-enrich.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer-enrich.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/observer-enrich.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Isolation tests for the observer.
|
|
3
|
+
*
|
|
4
|
+
* The observer must never include host-page PII in observation text.
|
|
5
|
+
* PostHog autocapture strips sensitive properties from $elements before
|
|
6
|
+
* delivery, but we add a belt-and-suspenders check here against text
|
|
7
|
+
* fields that look like emails, phones, or credit-card patterns.
|
|
8
|
+
*
|
|
9
|
+
* If this test ever fails, the templates in allowlist.ts have regressed
|
|
10
|
+
* — fix there, not by suppressing this test.
|
|
11
|
+
*/
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=observer-isolation.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observer-isolation.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/observer-isolation.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/queue.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/transport.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure mapping from raw PostHog events to ObservationEvents.
|
|
3
|
+
*
|
|
4
|
+
* One function: matchEvent(raw, opts) → ObservationEvent | null. Null means
|
|
5
|
+
* "drop, not significant." This module is the single source of truth for what
|
|
6
|
+
* the chat agent sees on the in-session timeline; the SDK observer never
|
|
7
|
+
* forwards anything matchEvent returns null for.
|
|
8
|
+
*
|
|
9
|
+
* Kept dependency-free (no DOM access, no PostHog SDK imports) so the
|
|
10
|
+
* Vitest unit tests run without any browser shim.
|
|
11
|
+
*/
|
|
12
|
+
import type { ObservationEvent as ObservationEventContract } from '@syntrologie/runtime-contracts';
|
|
13
|
+
/** The templated event kinds (nav/click/form/rage/…) — the backend enum. */
|
|
14
|
+
export type ObservationKind = ObservationEventContract['kind'];
|
|
15
|
+
/** One templated host-page event — the SDK↔backend wire contract. */
|
|
16
|
+
export type ObservationEvent = ObservationEventContract;
|
|
17
|
+
/** Shape of a raw event reaching matchEvent. Loose by design — PostHog's
|
|
18
|
+
* event shape evolves, and we want matchEvent to be resilient to extra
|
|
19
|
+
* properties. */
|
|
20
|
+
export interface RawEvent {
|
|
21
|
+
event: string;
|
|
22
|
+
timestamp: number;
|
|
23
|
+
properties: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export interface MatchOptions {
|
|
26
|
+
/** Workspace-configured custom event names to forward as kind="custom". */
|
|
27
|
+
observableEvents?: readonly string[];
|
|
28
|
+
}
|
|
29
|
+
/** Test-only: clear the drift-warn dedup so each test observes its own warn. */
|
|
30
|
+
export declare function resetCanonicalDriftWarnDedupForTest(): void;
|
|
31
|
+
export declare function matchEvent(raw: RawEvent, opts?: MatchOptions): ObservationEvent | null;
|
|
32
|
+
//# sourceMappingURL=allowlist.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"allowlist.d.ts","sourceRoot":"","sources":["../../src/observer/allowlist.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,OAAO,KAAK,EAAE,gBAAgB,IAAI,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAanG,4EAA4E;AAC5E,MAAM,MAAM,eAAe,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;AAE/D,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG,wBAAwB,CAAC;AAExD;;kBAEkB;AAClB,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AA4OD,gFAAgF;AAChF,wBAAgB,mCAAmC,IAAI,IAAI,CAE1D;AAkCD,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAE,YAAiB,GAAG,gBAAgB,GAAG,IAAI,CA4E1F"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-bus → observer translation.
|
|
3
|
+
*
|
|
4
|
+
* On hosts where `window.posthog` isn't exposed as a global, the observer's
|
|
5
|
+
* PostHog auto-attach is a no-op; instead the chat-bar subscribes to the
|
|
6
|
+
* SYNTRO runtime event bus and forwards events into the observer's allowlist.
|
|
7
|
+
*
|
|
8
|
+
* The catch: bus events have already been NORMALIZED by the event-processor
|
|
9
|
+
* (see `packages/event-processor/src/normalizers/posthog.ts`). The raw PostHog
|
|
10
|
+
* `$`-prefixed properties `matchEvent` reads (`$event_type`, `$elements`,
|
|
11
|
+
* `$element_tag_name`, `$pathname`, `$current_url`) were renamed to
|
|
12
|
+
* (`—dropped—`, `elements`, `tagName`, `pathname`, `url`) and the click/submit
|
|
13
|
+
* distinction moved from `$event_type` into the normalized event `name`
|
|
14
|
+
* (`ui.click` / `ui.submit`). This function re-derives the raw shape so
|
|
15
|
+
* `matchEvent` — the single source of truth, also fed directly by the
|
|
16
|
+
* `window.posthog`-global path — stays untouched.
|
|
17
|
+
*/
|
|
18
|
+
import type { RawEvent } from './allowlist';
|
|
19
|
+
/** A normalized event as it arrives on the SYNTRO runtime bus. */
|
|
20
|
+
export interface BusEvent {
|
|
21
|
+
ts?: number;
|
|
22
|
+
name?: string;
|
|
23
|
+
source?: string;
|
|
24
|
+
props?: Record<string, unknown> & {
|
|
25
|
+
originalEvent?: string;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Translate one bus event into the `RawEvent` the observer allowlist expects,
|
|
30
|
+
* or null to drop it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function busEventToRawEvent(e: BusEvent): RawEvent | null;
|
|
33
|
+
//# sourceMappingURL=bus-translate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bus-translate.d.ts","sourceRoot":"","sources":["../../src/observer/bus-translate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C,kEAAkE;AAClE,MAAM,WAAW,QAAQ;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC9D;AAoBD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAyB/D"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observer entry point.
|
|
3
|
+
*
|
|
4
|
+
* startObserver wires the four pieces — allowlist filter + queue +
|
|
5
|
+
* transport + PostHog subscription — into a single lifecycle controlled
|
|
6
|
+
* via the returned handle. The handle is reference-counted: multiple
|
|
7
|
+
* call sites (e.g. multiple chatbot widgets on the same page) share
|
|
8
|
+
* one observer.
|
|
9
|
+
*
|
|
10
|
+
* Idempotent: calling startObserver twice with equivalent options
|
|
11
|
+
* returns the same instance. Calling stop() decrements the ref count;
|
|
12
|
+
* the observer tears down only when the count reaches zero.
|
|
13
|
+
*/
|
|
14
|
+
import { type ObservationEvent, type RawEvent } from './allowlist';
|
|
15
|
+
import { type ObserverStats } from './queue';
|
|
16
|
+
import { type Transport } from './transport';
|
|
17
|
+
export interface StartObserverOptions {
|
|
18
|
+
url: string;
|
|
19
|
+
token: () => string;
|
|
20
|
+
getDistinctId: () => string | null;
|
|
21
|
+
getSessionId: () => string | null;
|
|
22
|
+
observableEvents?: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Optional per-observation enrichment applied AFTER matchEvent, BEFORE the
|
|
25
|
+
* observation is queued for POST. Given the matched observation plus the raw
|
|
26
|
+
* event (element chain intact), returns a possibly-augmented observation —
|
|
27
|
+
* e.g. attaching normalized product identity from the active platform
|
|
28
|
+
* adapter. Kept as a generic transform so the observer stays platform-neutral.
|
|
29
|
+
*/
|
|
30
|
+
enrich?: (ev: ObservationEvent, raw: RawEvent) => ObservationEvent;
|
|
31
|
+
/** Test seam: override fetch/timer behavior by injecting a custom transport. */
|
|
32
|
+
transport?: Transport;
|
|
33
|
+
}
|
|
34
|
+
export interface ObserverHandle {
|
|
35
|
+
stop(): void;
|
|
36
|
+
stats(): ObserverStats;
|
|
37
|
+
/** Test seam: ingest a raw event directly without depending on PostHog being loaded. */
|
|
38
|
+
ingest(raw: RawEvent): void;
|
|
39
|
+
flushNow(): Promise<void>;
|
|
40
|
+
}
|
|
41
|
+
export declare function startObserver(opts: StartObserverOptions): ObserverHandle;
|
|
42
|
+
/** Test-only: reset module singleton state. */
|
|
43
|
+
export declare function _resetObserverForTests(): void;
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/observer/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAc,KAAK,gBAAgB,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EAAiB,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAE9D,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,KAAK,gBAAgB,CAAC;IACnE,gFAAgF;IAChF,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,IAAI,aAAa,CAAC;IACvB,wFAAwF;IACxF,MAAM,CAAC,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC5B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3B;AA2DD,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,cAAc,CAqCxE;AAsCD,+CAA+C;AAC/C,wBAAgB,sBAAsB,IAAI,IAAI,CAK7C"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* In-memory batching queue for ObservationEvents.
|
|
3
|
+
*
|
|
4
|
+
* Holds events until either a size threshold or a time interval triggers
|
|
5
|
+
* a flush. The flush function is injected so transport choice (fetch vs.
|
|
6
|
+
* sendBeacon) and auth wiring stay out of this module.
|
|
7
|
+
*
|
|
8
|
+
* Backoff strategy: pure exponential, starting at 1s and capping at 30s
|
|
9
|
+
* (1s → 2s → 4s → 8s → 16s → 30s). Reset on first successful flush.
|
|
10
|
+
* Jitter is intentionally omitted — the observer queue is per-client, so
|
|
11
|
+
* thundering-herd at recovery is not a meaningful risk, and deterministic
|
|
12
|
+
* timing keeps unit tests fast and stable. A "permanent" failure (4xx
|
|
13
|
+
* marked by the caller) disables the queue entirely — no further flushes
|
|
14
|
+
* are attempted; lastError is exposed via stats().
|
|
15
|
+
*/
|
|
16
|
+
import type { ObservationEvent } from './allowlist';
|
|
17
|
+
export interface FlushError extends Error {
|
|
18
|
+
/** When true, the queue stops trying forever. Set by transport for 4xx. */
|
|
19
|
+
permanent?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ObserverQueueOptions {
|
|
22
|
+
batchSize: number;
|
|
23
|
+
flushIntervalMs: number;
|
|
24
|
+
queueCap: number;
|
|
25
|
+
flush: (batch: ObservationEvent[]) => Promise<void>;
|
|
26
|
+
backoffStartMs?: number;
|
|
27
|
+
backoffCapMs?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ObserverStats {
|
|
30
|
+
queued: number;
|
|
31
|
+
sent: number;
|
|
32
|
+
dropped: number;
|
|
33
|
+
lastError: string | null;
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare class ObserverQueue {
|
|
37
|
+
private readonly _opts;
|
|
38
|
+
private readonly _buffer;
|
|
39
|
+
private _sent;
|
|
40
|
+
private _dropped;
|
|
41
|
+
private _lastError;
|
|
42
|
+
private _disabled;
|
|
43
|
+
private _intervalTimer;
|
|
44
|
+
private _backoffTimer;
|
|
45
|
+
private _currentBackoffMs;
|
|
46
|
+
private _inFlight;
|
|
47
|
+
constructor(opts: ObserverQueueOptions);
|
|
48
|
+
push(event: ObservationEvent): void;
|
|
49
|
+
flushNow(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Synchronously hand the newest backend-sized batch to an unload-safe sender.
|
|
52
|
+
* Returns false when the sender rejected delivery and restores the batch so
|
|
53
|
+
* the caller can fall back to fetch({ keepalive: true }).
|
|
54
|
+
*/
|
|
55
|
+
flushOnPageHide(send: (batch: ObservationEvent[]) => boolean): boolean;
|
|
56
|
+
stats(): ObserverStats;
|
|
57
|
+
private _scheduleImmediate;
|
|
58
|
+
private _scheduleInterval;
|
|
59
|
+
private _clearInterval;
|
|
60
|
+
private _flush;
|
|
61
|
+
private _scheduleBackoff;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/observer/queue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,UAAW,SAAQ,KAAK;IACvC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiC;IACvD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAA8C;IACpE,OAAO,CAAC,aAAa,CAA8C;IACnE,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,SAAS,CAAS;gBAEd,IAAI,EAAE,oBAAoB;IAQtC,IAAI,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI;IAe7B,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAK/B;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,KAAK,OAAO,GAAG,OAAO;IAkBtE,KAAK,IAAI,aAAa;IAUtB,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,cAAc;YAOR,MAAM;IA0BpB,OAAO,CAAC,gBAAgB;CAazB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP transport for the observer queue.
|
|
3
|
+
*
|
|
4
|
+
* Two send paths:
|
|
5
|
+
* - send(batch) — async fetch. Used for normal flushes. Throws on
|
|
6
|
+
* non-2xx; sets the FlushError.permanent flag for 4xx so the queue
|
|
7
|
+
* stops trying.
|
|
8
|
+
* - sendBeacon(batch) — fire-and-forget via navigator.sendBeacon.
|
|
9
|
+
* Used on `pagehide` so the last batch survives navigation. No
|
|
10
|
+
* error path — beacon failure is invisible by design.
|
|
11
|
+
*
|
|
12
|
+
* Auth: same syn_ Bearer token mechanism as /stream. The token is read
|
|
13
|
+
* via a getter so SDK tokens that rotate live get refreshed naturally.
|
|
14
|
+
*/
|
|
15
|
+
import type { ObservationEvent } from './allowlist';
|
|
16
|
+
export interface TransportOptions {
|
|
17
|
+
url: string;
|
|
18
|
+
token: () => string;
|
|
19
|
+
getDistinctId: () => string | null;
|
|
20
|
+
getSessionId: () => string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface Transport {
|
|
23
|
+
send(batch: ObservationEvent[]): Promise<void>;
|
|
24
|
+
sendBeacon(batch: ObservationEvent[]): boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function createTransport(opts: TransportOptions): Transport;
|
|
27
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/observer/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IACnC,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,OAAO,CAAC;CAChD;AAsBD,wBAAgB,eAAe,CAAC,IAAI,EAAE,gBAAgB,GAAG,SAAS,CA4CjE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One place that connects a Syntro runtime to the observer.
|
|
3
|
+
*
|
|
4
|
+
* What the shopper does is the same signal wherever they are: on a storefront
|
|
5
|
+
* page the chat bar wires this, and inside a chat app's card the host agent
|
|
6
|
+
* controller wires the very same thing. Both post to
|
|
7
|
+
* `/api/adaptive/observation` with the runtime's own distinct id, so the
|
|
8
|
+
* backend drains one visitor's timeline whichever surface produced it.
|
|
9
|
+
*
|
|
10
|
+
* Extracted from `AdaptiveChatBarMountable` so there is exactly one copy of
|
|
11
|
+
* the transport options, the identity accessors and the bus translation.
|
|
12
|
+
* `startObserver` is reference-counted, so several owners share one queue and
|
|
13
|
+
* the observer tears down when the last one stops.
|
|
14
|
+
*/
|
|
15
|
+
import type { ProductIdentityExtractor } from '@syntrologie/sdk-contracts';
|
|
16
|
+
import type { ObservationEvent, RawEvent } from './allowlist';
|
|
17
|
+
/** What the observer needs from a runtime. Everything else is none of its business. */
|
|
18
|
+
export interface ObserverRuntime {
|
|
19
|
+
events?: {
|
|
20
|
+
subscribe?: (filter: unknown, cb: (e: unknown) => void) => () => void;
|
|
21
|
+
};
|
|
22
|
+
backendUrl?: string;
|
|
23
|
+
token?: string;
|
|
24
|
+
telemetry?: {
|
|
25
|
+
getDistinctId?: () => string | undefined | null;
|
|
26
|
+
getSessionId?: () => string | undefined | null;
|
|
27
|
+
};
|
|
28
|
+
/** Active platform adapter's product-identity extractor (undefined off-platform). */
|
|
29
|
+
getProductIdentity?: ProductIdentityExtractor;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Observation enrichment (exported for direct testing).
|
|
33
|
+
*
|
|
34
|
+
* Two passes through the SAME platform-adapter extractor:
|
|
35
|
+
* 1. clicks — resolve product identity from the clicked element chain
|
|
36
|
+
* (original behavior, unchanged);
|
|
37
|
+
* 2. page-level signals (view/scroll/idle/hesitation/hover/nav) with no
|
|
38
|
+
* product — resolve the CURRENT page's product by feeding the extractor
|
|
39
|
+
* a synthetic chain element carrying `location.pathname`. Live-verified
|
|
40
|
+
* gap (FEAT-1783640628): a visitor ON a PDP produces section views with
|
|
41
|
+
* no product identity, which starved every product-shaped downstream
|
|
42
|
+
* (nudge ping-pong detection, the agent's "viewed <product>" context).
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildObserverEnrich(runtimeRef: {
|
|
45
|
+
getProductIdentity?: ProductIdentityExtractor;
|
|
46
|
+
}): (ev: ObservationEvent, raw: RawEvent) => ObservationEvent;
|
|
47
|
+
/**
|
|
48
|
+
* Start observing this runtime's bus and return the owner's stop.
|
|
49
|
+
*
|
|
50
|
+
* The stop is idempotent and releases only this owner's reference; the shared
|
|
51
|
+
* observer keeps running while any other owner holds one.
|
|
52
|
+
*/
|
|
53
|
+
export declare function wireObserver(runtime: ObserverRuntime | undefined): () => void;
|
|
54
|
+
//# sourceMappingURL=wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.d.ts","sourceRoot":"","sources":["../../src/observer/wire.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAuB,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAChG,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI9D,uFAAuF;AACvF,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;KAAE,CAAC;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE;QACV,aAAa,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;QAChD,YAAY,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;KAChD,CAAC;IACF,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;CAC/C;AAOD;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE;IAC9C,kBAAkB,CAAC,EAAE,wBAAwB,CAAC;CAC/C,GAAG,CAAC,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,KAAK,gBAAgB,CAkC5D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,GAAG,MAAM,IAAI,CAqE7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wire.test.d.ts","sourceRoot":"","sources":["../../src/observer/wire.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chat personas — the "human face" of the concierge (FEAT-1784917430).
|
|
3
|
+
*
|
|
4
|
+
* A workspace ships a persona ROSTER in the chat-bar's props (plain config,
|
|
5
|
+
* like assistantName). Assignment is 50:50 sticky-random per visitor: first
|
|
6
|
+
* visit picks uniformly, the pick persists in localStorage, and every later
|
|
7
|
+
* session reuses it — consistency reads as a real team member, not a slot
|
|
8
|
+
* machine. An invalid/vanished persisted id re-picks (roster changes are
|
|
9
|
+
* config changes; visitors must never be stranded on a ghost).
|
|
10
|
+
*
|
|
11
|
+
* The persona never claims to be human: the header carries an explicit
|
|
12
|
+
* "AI concierge" microline (see renderHeader) and the server threads the
|
|
13
|
+
* no-human-claim rule into the prompt (Moffatt/R-001 lineage).
|
|
14
|
+
*/
|
|
15
|
+
export interface PersonaAvatar {
|
|
16
|
+
sm?: string;
|
|
17
|
+
md?: string;
|
|
18
|
+
lg?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ChatPersona {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
role_title?: string;
|
|
24
|
+
pronouns?: string;
|
|
25
|
+
avatar?: PersonaAvatar;
|
|
26
|
+
intro_line?: string;
|
|
27
|
+
}
|
|
28
|
+
/** Pick (or recall) the visitor's sticky persona from the roster. */
|
|
29
|
+
export declare function pickPersona(roster: ChatPersona[] | undefined | null): ChatPersona | null;
|
|
30
|
+
//# sourceMappingURL=personas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personas.d.ts","sourceRoot":"","sources":["../src/personas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,WAAW,aAAa;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAID,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAiBxF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adaptive Chatbot - Runtime Module (Lit)
|
|
3
|
+
*
|
|
4
|
+
* Now identical to the default runtime since there is no React path.
|
|
5
|
+
* Kept for backward compatibility with existing import paths.
|
|
6
|
+
*/
|
|
7
|
+
export { runtime, runtime as default } from './runtime';
|
|
8
|
+
//# sourceMappingURL=runtime-lit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-lit.d.ts","sourceRoot":"","sources":["../src/runtime-lit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAC"}
|