@syntrologie/adapt-chatbot 2.27.0 → 2.29.0

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 (131) hide show
  1. package/dist/AdaptiveChatBar.composer.test.d.ts +2 -0
  2. package/dist/AdaptiveChatBar.composer.test.d.ts.map +1 -0
  3. package/dist/AdaptiveChatBar.d.ts +212 -0
  4. package/dist/AdaptiveChatBar.d.ts.map +1 -0
  5. package/dist/AdaptiveChatBar.js +11 -0
  6. package/dist/AdaptiveChatBar.js.map +7 -0
  7. package/dist/AdaptiveChatBarMountable.d.ts +82 -0
  8. package/dist/AdaptiveChatBarMountable.d.ts.map +1 -0
  9. package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts +2 -0
  10. package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts.map +1 -0
  11. package/dist/AdaptiveChatTrail.d.ts +469 -0
  12. package/dist/AdaptiveChatTrail.d.ts.map +1 -0
  13. package/dist/AdaptiveChatTrail.js +11 -0
  14. package/dist/AdaptiveChatTrail.js.map +7 -0
  15. package/dist/AdaptiveChatTrail.test.d.ts +2 -0
  16. package/dist/AdaptiveChatTrail.test.d.ts.map +1 -0
  17. package/dist/AdaptiveChipsStrip.d.ts +1156 -0
  18. package/dist/AdaptiveChipsStrip.d.ts.map +1 -0
  19. package/dist/AdaptiveChipsStrip.js +11 -0
  20. package/dist/AdaptiveChipsStrip.js.map +7 -0
  21. package/dist/AdaptiveChipsStripMountable.d.ts +24 -0
  22. package/dist/AdaptiveChipsStripMountable.d.ts.map +1 -0
  23. package/dist/ChatAssistantLit.d.ts +22 -50
  24. package/dist/ChatAssistantLit.d.ts.map +1 -1
  25. package/dist/ChatAssistantLit.js +6 -3
  26. package/dist/ChatSession.d.ts +239 -0
  27. package/dist/ChatSession.d.ts.map +1 -0
  28. package/dist/ChatTransport.d.ts +390 -0
  29. package/dist/ChatTransport.d.ts.map +1 -0
  30. package/dist/InlineRegistryWidgetMount.test.d.ts +2 -0
  31. package/dist/InlineRegistryWidgetMount.test.d.ts.map +1 -0
  32. package/dist/InlineWidgetLiveMount.test.d.ts +2 -0
  33. package/dist/InlineWidgetLiveMount.test.d.ts.map +1 -0
  34. package/dist/NavLinkMountable.d.ts +25 -0
  35. package/dist/NavLinkMountable.d.ts.map +1 -0
  36. package/dist/NavLinkMountable.test.d.ts +2 -0
  37. package/dist/NavLinkMountable.test.d.ts.map +1 -0
  38. package/dist/TextAnswerMountable.d.ts +17 -0
  39. package/dist/TextAnswerMountable.d.ts.map +1 -0
  40. package/dist/TextAnswerMountable.test.d.ts +2 -0
  41. package/dist/TextAnswerMountable.test.d.ts.map +1 -0
  42. package/dist/Turnstile.d.ts +83 -0
  43. package/dist/Turnstile.d.ts.map +1 -0
  44. package/dist/chunk-A7RBZLIX.js +1678 -0
  45. package/dist/chunk-A7RBZLIX.js.map +7 -0
  46. package/dist/chunk-EACGDSJI.js +237 -0
  47. package/dist/chunk-EACGDSJI.js.map +7 -0
  48. package/dist/chunk-EWPPVPJ4.js +14 -0
  49. package/dist/chunk-EWPPVPJ4.js.map +7 -0
  50. package/dist/chunk-FXHYE6FY.js +632 -0
  51. package/dist/chunk-FXHYE6FY.js.map +7 -0
  52. package/dist/chunk-OIGVZGSX.js +641 -0
  53. package/dist/chunk-OIGVZGSX.js.map +7 -0
  54. package/dist/chunk-VZIUXXAM.js +4015 -0
  55. package/dist/chunk-VZIUXXAM.js.map +7 -0
  56. package/dist/{chunk-W457NMGD.js → chunk-ZXV4GXMO.js} +2149 -4254
  57. package/dist/chunk-ZXV4GXMO.js.map +7 -0
  58. package/dist/elements/ActionHandler.d.ts +34 -0
  59. package/dist/elements/ActionHandler.d.ts.map +1 -0
  60. package/dist/elements/ElementInstanceStore.d.ts +217 -0
  61. package/dist/elements/ElementInstanceStore.d.ts.map +1 -0
  62. package/dist/elements/ElementInstanceStore.test.d.ts +2 -0
  63. package/dist/elements/ElementInstanceStore.test.d.ts.map +1 -0
  64. package/dist/elements/ElementTypeHandler.d.ts +77 -0
  65. package/dist/elements/ElementTypeHandler.d.ts.map +1 -0
  66. package/dist/elements/ItemHandler.d.ts +60 -0
  67. package/dist/elements/ItemHandler.d.ts.map +1 -0
  68. package/dist/elements/ItemHandler.test.d.ts +2 -0
  69. package/dist/elements/ItemHandler.test.d.ts.map +1 -0
  70. package/dist/elements/TileHandler.d.ts +52 -0
  71. package/dist/elements/TileHandler.d.ts.map +1 -0
  72. package/dist/elements/TileHandler.test.d.ts +2 -0
  73. package/dist/elements/TileHandler.test.d.ts.map +1 -0
  74. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts +2 -0
  75. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts.map +1 -0
  76. package/dist/elements/blockRenderer.d.ts +46 -0
  77. package/dist/elements/blockRenderer.d.ts.map +1 -0
  78. package/dist/elements/blockRenderer.test.d.ts +13 -0
  79. package/dist/elements/blockRenderer.test.d.ts.map +1 -0
  80. package/dist/elements/blocks.d.ts +58 -0
  81. package/dist/elements/blocks.d.ts.map +1 -0
  82. package/dist/elements/envelope.d.ts +24 -0
  83. package/dist/elements/envelope.d.ts.map +1 -0
  84. package/dist/elements/fetcher.d.ts +40 -0
  85. package/dist/elements/fetcher.d.ts.map +1 -0
  86. package/dist/elements/index.d.ts +33 -0
  87. package/dist/elements/index.d.ts.map +1 -0
  88. package/dist/elements/store-singleton.d.ts +4 -0
  89. package/dist/elements/store-singleton.d.ts.map +1 -0
  90. package/dist/elements/types.d.ts +110 -0
  91. package/dist/elements/types.d.ts.map +1 -0
  92. package/dist/observer/__tests__/allowlist.test.d.ts +9 -0
  93. package/dist/observer/__tests__/allowlist.test.d.ts.map +1 -0
  94. package/dist/observer/__tests__/bus-translate.test.d.ts +16 -0
  95. package/dist/observer/__tests__/bus-translate.test.d.ts.map +1 -0
  96. package/dist/observer/__tests__/lifecycle.test.d.ts +2 -0
  97. package/dist/observer/__tests__/lifecycle.test.d.ts.map +1 -0
  98. package/dist/observer/__tests__/observer-enrich.test.d.ts +10 -0
  99. package/dist/observer/__tests__/observer-enrich.test.d.ts.map +1 -0
  100. package/dist/observer/__tests__/observer-isolation.test.d.ts +13 -0
  101. package/dist/observer/__tests__/observer-isolation.test.d.ts.map +1 -0
  102. package/dist/observer/__tests__/queue.test.d.ts +2 -0
  103. package/dist/observer/__tests__/queue.test.d.ts.map +1 -0
  104. package/dist/observer/__tests__/transport.test.d.ts +2 -0
  105. package/dist/observer/__tests__/transport.test.d.ts.map +1 -0
  106. package/dist/observer/allowlist.d.ts +30 -0
  107. package/dist/observer/allowlist.d.ts.map +1 -0
  108. package/dist/observer/bus-translate.d.ts +33 -0
  109. package/dist/observer/bus-translate.d.ts.map +1 -0
  110. package/dist/observer/index.d.ts +44 -0
  111. package/dist/observer/index.d.ts.map +1 -0
  112. package/dist/observer/queue.d.ts +63 -0
  113. package/dist/observer/queue.d.ts.map +1 -0
  114. package/dist/observer/transport.d.ts +27 -0
  115. package/dist/observer/transport.d.ts.map +1 -0
  116. package/dist/personas.d.ts +30 -0
  117. package/dist/personas.d.ts.map +1 -0
  118. package/dist/runtime.d.ts +9 -0
  119. package/dist/runtime.d.ts.map +1 -1
  120. package/dist/runtime.js +2345 -3
  121. package/dist/runtime.js.map +4 -4
  122. package/dist/schema.d.ts +3426 -17
  123. package/dist/schema.d.ts.map +1 -1
  124. package/dist/schema.js +213 -0
  125. package/dist/schema.js.map +2 -2
  126. package/dist/test/setup.d.ts +1 -0
  127. package/dist/test/setup.d.ts.map +1 -0
  128. package/dist/types.d.ts +46 -2
  129. package/dist/types.d.ts.map +1 -1
  130. package/package.json +17 -1
  131. package/dist/chunk-W457NMGD.js.map +0 -7
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Helpers for decoding AG-UI custom event payloads — Phase 6b.
3
+ *
4
+ * `AgUiTransport.onA2UIEvent` historically forwarded the raw `event.value`
5
+ * payload as an `ActionStep` directly to `runtime.actions.applyBatch`.
6
+ * Phase 5's backend now also emits `syntro.element.mutation` envelopes
7
+ * (mounts/patches/unmounts authored by the LLM via `mount_element` &c.),
8
+ * which the SDK routes to `ElementInstanceStore.apply` instead.
9
+ *
10
+ * Discrimination is by the envelope's `type` field. Non-element payloads
11
+ * (raw ActionStep, A2UI `createSurface` / `updateDataModel` envelopes
12
+ * from any A2UI integration) fall through to the legacy path.
13
+ */
14
+ import type { ElementMutation } from './types';
15
+ /**
16
+ * Returns the mutations array if `payload` is a well-formed
17
+ * `syntro.element.mutation` envelope, otherwise `null`.
18
+ *
19
+ * Validates only the discriminator + the structural shape needed to
20
+ * route to the store. Per-mutation validation lives in the store / its
21
+ * type handlers (defense in depth), so this stays small.
22
+ */
23
+ export declare function decodeMutationEnvelope(payload: unknown): ElementMutation[] | null;
24
+ //# sourceMappingURL=envelope.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelope.d.ts","sourceRoot":"","sources":["../../src/elements/envelope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,SAAS,CAAC;AAEjE;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,eAAe,EAAE,GAAG,IAAI,CAOjF"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Boot-time fetcher for `GET /api/adaptive/mounted_elements`.
3
+ *
4
+ * Follows the SDK's vanilla-fetch convention (see
5
+ * `packages/runtime-sdk/src/overlays/fetcher.ts` for the sibling pattern
6
+ * — no shared HTTP client, no axios, no fetch wrapper).
7
+ *
8
+ * Auth: forwards the SDK token from `window.__SYNTRO_CONFIG__.token`
9
+ * as a Bearer header, plus the runtime's visitor ids (`X-Distinct-Id` /
10
+ * `X-Syntro-Session`) so the backend rehydrates mounts under the same
11
+ * session-keyed Redis state the chat persisted to.
12
+ *
13
+ * 404 contract: the backend returns 404 only when the workspace's SDK
14
+ * token doesn't resolve to a workspace. The SDK treats 404 as
15
+ * "feature unavailable" — no error UI, no retries — per the design doc.
16
+ * Network errors are logged + swallowed so the SDK boot path stays
17
+ * resilient to backend hiccups.
18
+ */
19
+ import type { MountedElementsResponse } from './types';
20
+ export interface FetchMountedElementsOptions {
21
+ /** Override the endpoint URL (defaults to same-origin
22
+ * `/api/adaptive/mounted_elements`). Tests + multi-environment
23
+ * deploys use this. */
24
+ endpoint?: string;
25
+ /** SDK token. Defaults to `window.__SYNTRO_CONFIG__.token`. */
26
+ token?: string;
27
+ /** Custom fetch implementation — used by tests to mock the network. */
28
+ fetchImpl?: typeof fetch;
29
+ /** Logger — used by tests to capture log output. */
30
+ logger?: Pick<Console, 'warn'>;
31
+ }
32
+ /**
33
+ * Fetch the visitor's currently-mounted elements + session expiry.
34
+ *
35
+ * Returns `null` on any failure (404, network error, malformed JSON,
36
+ * etc.). The caller treats `null` as "feature unavailable, no
37
+ * rehydrate" — boot continues normally with an empty element store.
38
+ */
39
+ export declare function fetchMountedElements(options?: FetchMountedElementsOptions): Promise<MountedElementsResponse | null>;
40
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../src/elements/fetcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAIvD,MAAM,WAAW,2BAA2B;IAC1C;;4BAEwB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+DAA+D;IAC/D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,oDAAoD;IACpD,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,GAAE,2BAAgC,GACxC,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CA2DzC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Element-instantiation machinery for the adaptive chatbot.
3
+ *
4
+ * Originally added in runtime-sdk; moved here in two passes:
5
+ * - Phase 6c: store / handlers / fetcher / envelope / wire types
6
+ * (every consumer was the chat surface).
7
+ * - Phase 6c.1: Portable Text vocab + safe renderer (`renderBlocks`,
8
+ * `BlockNode`, etc.). Generic by shape but zero non-chat consumers
9
+ * in practice, so leaving it in the universal CDN bundle made every
10
+ * non-chat customer pay the bundle cost for nothing — the
11
+ * runtime-as-OS principle says don't ship interfaces with no
12
+ * consumers in the universal bundle.
13
+ *
14
+ * If a second adaptive ever needs Portable Text rendering, promote
15
+ * `blocks.ts` + `blockRenderer.ts` to a leaf shared package
16
+ * (`@syntrologie/portable-text`) and have both consumers depend on it.
17
+ * Do NOT push it back into runtime-sdk.
18
+ */
19
+ export { ActionHandler } from './ActionHandler';
20
+ export type { RenderOptions } from './blockRenderer';
21
+ export { renderBlocks } from './blockRenderer';
22
+ export type { BlockNode, CodeBlock, HeadingBlock, HeadingLevel, LinkMark, ListBlock, ListItemBlock, ListStyle, MarkType, ParagraphBlock, TextSpan, } from './blocks';
23
+ export { ElementInstanceStore } from './ElementInstanceStore';
24
+ export type { ElementHandlerContext, ElementLifecycle, ElementMutationContext, ElementTypeHandler, ValidateResult, } from './ElementTypeHandler';
25
+ export { decodeMutationEnvelope } from './envelope';
26
+ export type { FetchMountedElementsOptions } from './fetcher';
27
+ export { fetchMountedElements } from './fetcher';
28
+ export type { CompositionalAppendEvent, CompositionalPatchEvent, CompositionalRemoveEvent, } from './ItemHandler';
29
+ export { COMPOSITIONAL_APPEND_EVENT, COMPOSITIONAL_PATCH_EVENT, COMPOSITIONAL_REMOVE_EVENT, ItemHandler, } from './ItemHandler';
30
+ export { getElementInstanceStore, setElementInstanceStore } from './store-singleton';
31
+ export { TileHandler } from './TileHandler';
32
+ export type { AgentProvenance, ElementMutation, ElementState, MountedElement, MountedElementsResponse, MountMutation, Mutation, MutationEnvelope, NoPlacement, ParentTilePlacement, PatchMutation, Placement, SelectorPlacement, SlotPlacement, UnmountMutation, } from './types';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elements/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,YAAY,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,aAAa,EACb,SAAS,EACT,QAAQ,EACR,cAAc,EACd,QAAQ,GACT,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,YAAY,EACV,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,kBAAkB,EAClB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AACpD,YAAY,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,EACzB,0BAA0B,EAC1B,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,eAAe,EACf,YAAY,EACZ,cAAc,EACd,uBAAuB,EACvB,aAAa,EACb,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,iBAAiB,EACjB,aAAa,EACb,eAAe,GAChB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ElementInstanceStore } from './ElementInstanceStore';
2
+ export declare function setElementInstanceStore(store: ElementInstanceStore | null): void;
3
+ export declare function getElementInstanceStore(): ElementInstanceStore | null;
4
+ //# sourceMappingURL=store-singleton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-singleton.d.ts","sourceRoot":"","sources":["../../src/elements/store-singleton.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAInE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,GAAG,IAAI,CAEhF;AAED,wBAAgB,uBAAuB,IAAI,oBAAoB,GAAG,IAAI,CAErE"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Wire types for LLM-authored UI element instantiation — Phase 6.
3
+ *
4
+ * These mirror the backend Pydantic models in
5
+ * `platform/backend/app/services/agents/elements_models.py`. Kept as
6
+ * plain TypeScript types (no Zod validators) for v1 — the SDK trusts
7
+ * what it fetches from the workspace's own backend per the design doc's
8
+ * "backend is the sole enforcer" stance. Add Zod here if defence-in-depth
9
+ * ever becomes a real concern.
10
+ *
11
+ * Wire format documented in
12
+ * `docs/plans/current/2026-05-24-adaptive-chatbot-action-triggers-design.md`.
13
+ */
14
+ export type ElementState = 'active' | 'applied' | 'reverted' | 'expired';
15
+ export interface AgentProvenance {
16
+ agent_id: string;
17
+ turn_id: string;
18
+ }
19
+ export interface Mutation {
20
+ op: 'mount' | 'patch' | 'unmount';
21
+ at: string;
22
+ by: AgentProvenance;
23
+ paths?: string[];
24
+ }
25
+ export interface SlotPlacement {
26
+ type: 'slot';
27
+ slot: string;
28
+ }
29
+ export interface SelectorPlacement {
30
+ type: 'selector';
31
+ selector: string;
32
+ position: 'beforebegin' | 'afterbegin' | 'beforeend' | 'afterend' | 'replace' | 'modify';
33
+ }
34
+ export interface NoPlacement {
35
+ type: 'none';
36
+ }
37
+ /**
38
+ * Compositional-item placement — for chips, FAQ items, nav tips that
39
+ * mount INSIDE an existing tile's compositional-actions list rather
40
+ * than occupying their own slot. `tile_id` references a tile by its
41
+ * config-time id (e.g. `hero-chips`); `position` controls insertion
42
+ * order in the parent's items array.
43
+ *
44
+ * Backend mirror: `ParentTilePlacement` in
45
+ * `platform/backend/app/services/agents/elements_models.py`.
46
+ */
47
+ export interface ParentTilePlacement {
48
+ type: 'parent_tile';
49
+ tile_id: string;
50
+ position: 'append' | 'prepend';
51
+ }
52
+ export type Placement = SlotPlacement | SelectorPlacement | NoPlacement | ParentTilePlacement;
53
+ export interface MountedElement {
54
+ instance_id: string;
55
+ element_type: 'tile' | 'action' | 'item';
56
+ template_id: string;
57
+ placement: Placement;
58
+ content: Record<string, unknown>;
59
+ state: ElementState;
60
+ mounted_by: AgentProvenance;
61
+ mounted_at: string;
62
+ /** Model-issued id of the tool call that mounted this element — the SDK
63
+ * anchors the restored element to the transcript message hosting this
64
+ * call (BUG-1784935730). Absent on pre-existing sessions. */
65
+ tool_call_id?: string | null;
66
+ version: number;
67
+ mutation_log?: Mutation[];
68
+ }
69
+ /**
70
+ * Live-mutation envelope carried on the `syntro.element.mutation`
71
+ * AG-UI custom event.
72
+ */
73
+ export interface MutationEnvelope {
74
+ type: 'syntro.element.mutation';
75
+ schema_version: 'v0';
76
+ mutations: ElementMutation[];
77
+ }
78
+ export type ElementMutation = MountMutation | PatchMutation | UnmountMutation;
79
+ export interface MountMutation {
80
+ op: 'mount';
81
+ instance: MountedElement;
82
+ }
83
+ export interface PatchMutation {
84
+ op: 'patch';
85
+ instance_id: string;
86
+ patches: {
87
+ path: string;
88
+ value: unknown;
89
+ }[];
90
+ expected_version: number;
91
+ /** New version after patch, sent by the backend. SDK uses this for dedup. */
92
+ resulting_version: number;
93
+ /** Full content snapshot after patch — saves the SDK from having to
94
+ * apply patches client-side. */
95
+ resulting_content: Record<string, unknown>;
96
+ }
97
+ export interface UnmountMutation {
98
+ op: 'unmount';
99
+ instance_id: string;
100
+ }
101
+ /**
102
+ * Response shape from `GET /api/adaptive/mounted_elements`. Matches the
103
+ * backend `MountedElementsResponse` (Phase 4).
104
+ */
105
+ export interface MountedElementsResponse {
106
+ mounted_elements: MountedElement[];
107
+ session_expires_at: string | null;
108
+ schema_version: 'v0';
109
+ }
110
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/elements/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,CAAC;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,eAAe,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,aAAa,GAAG,YAAY,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;CAC1F;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,QAAQ,GAAG,SAAS,CAAC;CAChC;AAED,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,iBAAiB,GAAG,WAAW,GAAG,mBAAmB,CAAC;AAE9F,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,EAAE,YAAY,CAAC;IACpB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB;;iEAE6D;IAC7D,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,QAAQ,EAAE,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,yBAAyB,CAAC;IAChC,cAAc,EAAE,IAAI,CAAC;IACrB,SAAS,EAAE,eAAe,EAAE,CAAC;CAC9B;AAED,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,aAAa,GAAG,eAAe,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,OAAO,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,EAAE,CAAC;IAC5C,gBAAgB,EAAE,MAAM,CAAC;IACzB,6EAA6E;IAC7E,iBAAiB,EAAE,MAAM,CAAC;IAC1B;qCACiC;IACjC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,SAAS,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,cAAc,EAAE,CAAC;IACnC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,cAAc,EAAE,IAAI,CAAC;CACtB"}
@@ -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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=lifecycle.test.d.ts.map
@@ -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,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,CAiJ1F"}
@@ -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,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"}
package/dist/runtime.d.ts CHANGED
@@ -3,7 +3,16 @@
3
3
  *
4
4
  * Runtime manifest for the AI chat assistant adaptive.
5
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;
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;CAmBnB,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"}