@syntrologie/adapt-chatbot 2.8.0-canary.43 → 2.8.0-canary.430

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 (178) hide show
  1. package/dist/AdaptiveChatBar.d.ts +175 -0
  2. package/dist/AdaptiveChatBar.d.ts.map +1 -0
  3. package/dist/AdaptiveChatBar.js +11 -0
  4. package/dist/AdaptiveChatBar.js.map +7 -0
  5. package/dist/AdaptiveChatBarMountable.d.ts +80 -0
  6. package/dist/AdaptiveChatBarMountable.d.ts.map +1 -0
  7. package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts +2 -0
  8. package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts.map +1 -0
  9. package/dist/AdaptiveChatTrail.d.ts +415 -0
  10. package/dist/AdaptiveChatTrail.d.ts.map +1 -0
  11. package/dist/AdaptiveChatTrail.js +11 -0
  12. package/dist/AdaptiveChatTrail.js.map +7 -0
  13. package/dist/AdaptiveChatTrail.test.d.ts +2 -0
  14. package/dist/AdaptiveChatTrail.test.d.ts.map +1 -0
  15. package/dist/AdaptiveChipsStrip.d.ts +1150 -0
  16. package/dist/AdaptiveChipsStrip.d.ts.map +1 -0
  17. package/dist/AdaptiveChipsStrip.js +11 -0
  18. package/dist/AdaptiveChipsStrip.js.map +7 -0
  19. package/dist/AdaptiveChipsStripMountable.d.ts +24 -0
  20. package/dist/AdaptiveChipsStripMountable.d.ts.map +1 -0
  21. package/dist/ChatAssistantLit.d.ts +60 -0
  22. package/dist/ChatAssistantLit.d.ts.map +1 -0
  23. package/dist/ChatAssistantLit.js +13 -0
  24. package/dist/ChatAssistantLit.js.map +7 -0
  25. package/dist/ChatSession.d.ts +230 -0
  26. package/dist/ChatSession.d.ts.map +1 -0
  27. package/dist/ChatTransport.d.ts +360 -0
  28. package/dist/ChatTransport.d.ts.map +1 -0
  29. package/dist/InlineRegistryWidgetMount.test.d.ts +2 -0
  30. package/dist/InlineRegistryWidgetMount.test.d.ts.map +1 -0
  31. package/dist/InlineWidgetLiveMount.test.d.ts +2 -0
  32. package/dist/InlineWidgetLiveMount.test.d.ts.map +1 -0
  33. package/dist/NavLinkMountable.d.ts +25 -0
  34. package/dist/NavLinkMountable.d.ts.map +1 -0
  35. package/dist/NavLinkMountable.test.d.ts +2 -0
  36. package/dist/NavLinkMountable.test.d.ts.map +1 -0
  37. package/dist/TextAnswerMountable.d.ts +17 -0
  38. package/dist/TextAnswerMountable.d.ts.map +1 -0
  39. package/dist/TextAnswerMountable.test.d.ts +2 -0
  40. package/dist/TextAnswerMountable.test.d.ts.map +1 -0
  41. package/dist/Turnstile.d.ts +83 -0
  42. package/dist/Turnstile.d.ts.map +1 -0
  43. package/dist/cdn.d.ts +2 -6
  44. package/dist/cdn.d.ts.map +1 -1
  45. package/dist/chunk-5W75LR6M.js +460 -0
  46. package/dist/chunk-5W75LR6M.js.map +7 -0
  47. package/dist/chunk-7WSMNAKW.js +3824 -0
  48. package/dist/chunk-7WSMNAKW.js.map +7 -0
  49. package/dist/chunk-EWPPVPJ4.js +14 -0
  50. package/dist/chunk-EWPPVPJ4.js.map +7 -0
  51. package/dist/chunk-GP4OSTZT.js +641 -0
  52. package/dist/chunk-GP4OSTZT.js.map +7 -0
  53. package/dist/chunk-HELUC5JI.js +8971 -0
  54. package/dist/chunk-HELUC5JI.js.map +7 -0
  55. package/dist/chunk-HVGQJZMP.js +1520 -0
  56. package/dist/chunk-HVGQJZMP.js.map +7 -0
  57. package/dist/chunk-KPWW7N27.js +235 -0
  58. package/dist/chunk-KPWW7N27.js.map +7 -0
  59. package/dist/chunk-UVKRO5ER.js +13 -0
  60. package/dist/chunk-UVKRO5ER.js.map +7 -0
  61. package/dist/editor-lit.d.ts +37 -0
  62. package/dist/editor-lit.d.ts.map +1 -0
  63. package/dist/editor-lit.js +134 -0
  64. package/dist/editor-lit.js.map +7 -0
  65. package/dist/elements/ActionHandler.d.ts +34 -0
  66. package/dist/elements/ActionHandler.d.ts.map +1 -0
  67. package/dist/elements/ElementInstanceStore.d.ts +207 -0
  68. package/dist/elements/ElementInstanceStore.d.ts.map +1 -0
  69. package/dist/elements/ElementInstanceStore.test.d.ts +2 -0
  70. package/dist/elements/ElementInstanceStore.test.d.ts.map +1 -0
  71. package/dist/elements/ElementTypeHandler.d.ts +77 -0
  72. package/dist/elements/ElementTypeHandler.d.ts.map +1 -0
  73. package/dist/elements/ItemHandler.d.ts +60 -0
  74. package/dist/elements/ItemHandler.d.ts.map +1 -0
  75. package/dist/elements/ItemHandler.test.d.ts +2 -0
  76. package/dist/elements/ItemHandler.test.d.ts.map +1 -0
  77. package/dist/elements/TileHandler.d.ts +52 -0
  78. package/dist/elements/TileHandler.d.ts.map +1 -0
  79. package/dist/elements/TileHandler.test.d.ts +2 -0
  80. package/dist/elements/TileHandler.test.d.ts.map +1 -0
  81. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts +2 -0
  82. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts.map +1 -0
  83. package/dist/elements/blockRenderer.d.ts +46 -0
  84. package/dist/elements/blockRenderer.d.ts.map +1 -0
  85. package/dist/elements/blockRenderer.test.d.ts +13 -0
  86. package/dist/elements/blockRenderer.test.d.ts.map +1 -0
  87. package/dist/elements/blocks.d.ts +58 -0
  88. package/dist/elements/blocks.d.ts.map +1 -0
  89. package/dist/elements/envelope.d.ts +24 -0
  90. package/dist/elements/envelope.d.ts.map +1 -0
  91. package/dist/elements/fetcher.d.ts +40 -0
  92. package/dist/elements/fetcher.d.ts.map +1 -0
  93. package/dist/elements/index.d.ts +33 -0
  94. package/dist/elements/index.d.ts.map +1 -0
  95. package/dist/elements/store-singleton.d.ts +4 -0
  96. package/dist/elements/store-singleton.d.ts.map +1 -0
  97. package/dist/elements/types.d.ts +106 -0
  98. package/dist/elements/types.d.ts.map +1 -0
  99. package/dist/observer/__tests__/allowlist.test.d.ts +9 -0
  100. package/dist/observer/__tests__/allowlist.test.d.ts.map +1 -0
  101. package/dist/observer/__tests__/bus-translate.test.d.ts +16 -0
  102. package/dist/observer/__tests__/bus-translate.test.d.ts.map +1 -0
  103. package/dist/observer/__tests__/lifecycle.test.d.ts +2 -0
  104. package/dist/observer/__tests__/lifecycle.test.d.ts.map +1 -0
  105. package/dist/observer/__tests__/observer-enrich.test.d.ts +10 -0
  106. package/dist/observer/__tests__/observer-enrich.test.d.ts.map +1 -0
  107. package/dist/observer/__tests__/observer-isolation.test.d.ts +13 -0
  108. package/dist/observer/__tests__/observer-isolation.test.d.ts.map +1 -0
  109. package/dist/observer/__tests__/queue.test.d.ts +2 -0
  110. package/dist/observer/__tests__/queue.test.d.ts.map +1 -0
  111. package/dist/observer/__tests__/transport.test.d.ts +2 -0
  112. package/dist/observer/__tests__/transport.test.d.ts.map +1 -0
  113. package/dist/observer/allowlist.d.ts +30 -0
  114. package/dist/observer/allowlist.d.ts.map +1 -0
  115. package/dist/observer/bus-translate.d.ts +33 -0
  116. package/dist/observer/bus-translate.d.ts.map +1 -0
  117. package/dist/observer/index.d.ts +44 -0
  118. package/dist/observer/index.d.ts.map +1 -0
  119. package/dist/observer/queue.d.ts +63 -0
  120. package/dist/observer/queue.d.ts.map +1 -0
  121. package/dist/observer/transport.d.ts +27 -0
  122. package/dist/observer/transport.d.ts.map +1 -0
  123. package/dist/runtime-lit.d.ts +8 -0
  124. package/dist/runtime-lit.d.ts.map +1 -0
  125. package/dist/runtime.d.ts +10 -3
  126. package/dist/runtime.d.ts.map +1 -1
  127. package/dist/runtime.js +2232 -29
  128. package/dist/runtime.js.map +7 -0
  129. package/dist/schema.d.ts +3340 -11
  130. package/dist/schema.d.ts.map +1 -1
  131. package/dist/schema.js +220 -31
  132. package/dist/schema.js.map +7 -0
  133. package/dist/test/setup.d.ts +1 -0
  134. package/dist/test/setup.d.ts.map +1 -0
  135. package/dist/types.d.ts +61 -40
  136. package/dist/types.d.ts.map +1 -1
  137. package/package.json +44 -23
  138. package/dist/ChatAssistant.d.ts +0 -18
  139. package/dist/ChatAssistant.d.ts.map +0 -1
  140. package/dist/ChatAssistant.js +0 -178
  141. package/dist/SyntroChatbot.d.ts +0 -14
  142. package/dist/SyntroChatbot.d.ts.map +0 -1
  143. package/dist/SyntroChatbot.js +0 -56
  144. package/dist/actionParser.d.ts +0 -15
  145. package/dist/actionParser.d.ts.map +0 -1
  146. package/dist/actionParser.js +0 -52
  147. package/dist/apiClient.d.ts +0 -23
  148. package/dist/apiClient.d.ts.map +0 -1
  149. package/dist/apiClient.js +0 -51
  150. package/dist/cdn.js +0 -37
  151. package/dist/editor.d.ts +0 -17
  152. package/dist/editor.d.ts.map +0 -1
  153. package/dist/editor.js +0 -36
  154. package/dist/tools/bridge.d.ts +0 -26
  155. package/dist/tools/bridge.d.ts.map +0 -1
  156. package/dist/tools/bridge.js +0 -25
  157. package/dist/tools/expanders.d.ts +0 -17
  158. package/dist/tools/expanders.d.ts.map +0 -1
  159. package/dist/tools/expanders.js +0 -41
  160. package/dist/tools/index.d.ts +0 -14
  161. package/dist/tools/index.d.ts.map +0 -1
  162. package/dist/tools/index.js +0 -11
  163. package/dist/tools/registrations/GetContextTool.d.ts +0 -7
  164. package/dist/tools/registrations/GetContextTool.d.ts.map +0 -1
  165. package/dist/tools/registrations/GetContextTool.js +0 -18
  166. package/dist/tools/registrations/ScrollToTool.d.ts +0 -7
  167. package/dist/tools/registrations/ScrollToTool.d.ts.map +0 -1
  168. package/dist/tools/registrations/ScrollToTool.js +0 -38
  169. package/dist/tools/registrations/ShowOverlayTool.d.ts +0 -7
  170. package/dist/tools/registrations/ShowOverlayTool.d.ts.map +0 -1
  171. package/dist/tools/registrations/ShowOverlayTool.js +0 -47
  172. package/dist/tools/registrations/index.d.ts +0 -19
  173. package/dist/tools/registrations/index.d.ts.map +0 -1
  174. package/dist/tools/registrations/index.js +0 -7
  175. package/dist/types.js +0 -6
  176. package/dist/useChat.d.ts +0 -25
  177. package/dist/useChat.d.ts.map +0 -1
  178. package/dist/useChat.js +0 -106
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=queue.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queue.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/queue.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transport.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.test.d.ts","sourceRoot":"","sources":["../../../src/observer/__tests__/transport.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,30 @@
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
+ export declare function matchEvent(raw: RawEvent, opts?: MatchOptions): ObservationEvent | null;
30
+ //# 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;AAEnG,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;AA0ED,wBAAgB,UAAU,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAE,YAAiB,GAAG,gBAAgB,GAAG,IAAI,CA4I1F"}
@@ -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,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"}
package/dist/runtime.d.ts CHANGED
@@ -2,16 +2,23 @@
2
2
  * Adaptive Chatbot - Runtime Module
3
3
  *
4
4
  * Runtime manifest for the AI chat assistant adaptive.
5
- * This is a widget-based adaptive with no action executors.
5
+ * Uses @syntrologie/chat for the UI no React dependency.
6
+ *
7
+ * Chat surfaces are config-driven: customers reference the chat-bar
8
+ * widget id (`adaptive-chatbot:chat-bar`) from `slots.drawer.lid` (to
9
+ * replace the launcher FAB) or any other slot's `lid` / tile slot. The
10
+ * adaptive no longer auto-registers a canvas lid renderer.
6
11
  */
12
+ import './AdaptiveChatBar';
13
+ import './AdaptiveChatTrail';
14
+ export { ElementInstanceStore, TileHandler } from './elements';
15
+ export { getElementInstanceStore, setElementInstanceStore } from './elements/store-singleton';
7
16
  export declare const runtime: {
8
17
  id: string;
9
18
  version: string;
10
19
  name: string;
11
20
  description: string;
12
- /** No action executors — chatbot uses existing action kinds via applyBatch */
13
21
  executors: never[];
14
- /** Widget definitions for the runtime's WidgetRegistry */
15
22
  widgets: {
16
23
  id: string;
17
24
  component: {
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,eAAO,MAAM,OAAO;;;;;IAMlB,8EAA8E;;IAG9E,0DAA0D;;;;;;;;;;;;CAY3D,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,mBAAmB,CAAC;AAC3B,OAAO,qBAAqB,CAAC;AAW7B,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAE9F,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;CA4EnB,CAAC;AAEF,eAAe,OAAO,CAAC"}