@syntrologie/adapt-chatbot 2.8.0-canary.41 → 2.8.0-canary.410

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 (168) hide show
  1. package/dist/AdaptiveChatBar.d.ts +154 -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 +37 -0
  6. package/dist/AdaptiveChatBarMountable.d.ts.map +1 -0
  7. package/dist/AdaptiveChatTrail.d.ts +314 -0
  8. package/dist/AdaptiveChatTrail.d.ts.map +1 -0
  9. package/dist/AdaptiveChatTrail.js +11 -0
  10. package/dist/AdaptiveChatTrail.js.map +7 -0
  11. package/dist/AdaptiveChatTrail.test.d.ts +2 -0
  12. package/dist/AdaptiveChatTrail.test.d.ts.map +1 -0
  13. package/dist/AdaptiveChipsStrip.d.ts +1150 -0
  14. package/dist/AdaptiveChipsStrip.d.ts.map +1 -0
  15. package/dist/AdaptiveChipsStrip.js +11 -0
  16. package/dist/AdaptiveChipsStrip.js.map +7 -0
  17. package/dist/AdaptiveChipsStripMountable.d.ts +24 -0
  18. package/dist/AdaptiveChipsStripMountable.d.ts.map +1 -0
  19. package/dist/ChatAssistantLit.d.ts +60 -0
  20. package/dist/ChatAssistantLit.d.ts.map +1 -0
  21. package/dist/ChatAssistantLit.js +13 -0
  22. package/dist/ChatAssistantLit.js.map +7 -0
  23. package/dist/ChatSession.d.ts +217 -0
  24. package/dist/ChatSession.d.ts.map +1 -0
  25. package/dist/ChatTransport.d.ts +320 -0
  26. package/dist/ChatTransport.d.ts.map +1 -0
  27. package/dist/InlineWidgetLiveMount.test.d.ts +2 -0
  28. package/dist/InlineWidgetLiveMount.test.d.ts.map +1 -0
  29. package/dist/NavLinkMountable.d.ts +25 -0
  30. package/dist/NavLinkMountable.d.ts.map +1 -0
  31. package/dist/NavLinkMountable.test.d.ts +2 -0
  32. package/dist/NavLinkMountable.test.d.ts.map +1 -0
  33. package/dist/TextAnswerMountable.d.ts +17 -0
  34. package/dist/TextAnswerMountable.d.ts.map +1 -0
  35. package/dist/Turnstile.d.ts +83 -0
  36. package/dist/Turnstile.d.ts.map +1 -0
  37. package/dist/cdn.d.ts +2 -6
  38. package/dist/cdn.d.ts.map +1 -1
  39. package/dist/chunk-5PW6T3QF.js +3740 -0
  40. package/dist/chunk-5PW6T3QF.js.map +7 -0
  41. package/dist/chunk-6ONIYMVA.js +8955 -0
  42. package/dist/chunk-6ONIYMVA.js.map +7 -0
  43. package/dist/chunk-EWPPVPJ4.js +14 -0
  44. package/dist/chunk-EWPPVPJ4.js.map +7 -0
  45. package/dist/chunk-FVNSOP7B.js +634 -0
  46. package/dist/chunk-FVNSOP7B.js.map +7 -0
  47. package/dist/chunk-I73UT22O.js +1296 -0
  48. package/dist/chunk-I73UT22O.js.map +7 -0
  49. package/dist/chunk-L3LR2J3L.js +421 -0
  50. package/dist/chunk-L3LR2J3L.js.map +7 -0
  51. package/dist/chunk-UVKRO5ER.js +13 -0
  52. package/dist/chunk-UVKRO5ER.js.map +7 -0
  53. package/dist/chunk-VLJ3WOEX.js +231 -0
  54. package/dist/chunk-VLJ3WOEX.js.map +7 -0
  55. package/dist/editor-lit.d.ts +37 -0
  56. package/dist/editor-lit.d.ts.map +1 -0
  57. package/dist/editor-lit.js +134 -0
  58. package/dist/editor-lit.js.map +7 -0
  59. package/dist/elements/ActionHandler.d.ts +34 -0
  60. package/dist/elements/ActionHandler.d.ts.map +1 -0
  61. package/dist/elements/ElementInstanceStore.d.ts +205 -0
  62. package/dist/elements/ElementInstanceStore.d.ts.map +1 -0
  63. package/dist/elements/ElementInstanceStore.test.d.ts +2 -0
  64. package/dist/elements/ElementInstanceStore.test.d.ts.map +1 -0
  65. package/dist/elements/ElementTypeHandler.d.ts +77 -0
  66. package/dist/elements/ElementTypeHandler.d.ts.map +1 -0
  67. package/dist/elements/ItemHandler.d.ts +60 -0
  68. package/dist/elements/ItemHandler.d.ts.map +1 -0
  69. package/dist/elements/ItemHandler.test.d.ts +2 -0
  70. package/dist/elements/ItemHandler.test.d.ts.map +1 -0
  71. package/dist/elements/TileHandler.d.ts +52 -0
  72. package/dist/elements/TileHandler.d.ts.map +1 -0
  73. package/dist/elements/TileHandler.test.d.ts +2 -0
  74. package/dist/elements/TileHandler.test.d.ts.map +1 -0
  75. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts +2 -0
  76. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts.map +1 -0
  77. package/dist/elements/blockRenderer.d.ts +46 -0
  78. package/dist/elements/blockRenderer.d.ts.map +1 -0
  79. package/dist/elements/blockRenderer.test.d.ts +13 -0
  80. package/dist/elements/blockRenderer.test.d.ts.map +1 -0
  81. package/dist/elements/blocks.d.ts +58 -0
  82. package/dist/elements/blocks.d.ts.map +1 -0
  83. package/dist/elements/envelope.d.ts +24 -0
  84. package/dist/elements/envelope.d.ts.map +1 -0
  85. package/dist/elements/fetcher.d.ts +40 -0
  86. package/dist/elements/fetcher.d.ts.map +1 -0
  87. package/dist/elements/index.d.ts +33 -0
  88. package/dist/elements/index.d.ts.map +1 -0
  89. package/dist/elements/store-singleton.d.ts +4 -0
  90. package/dist/elements/store-singleton.d.ts.map +1 -0
  91. package/dist/elements/types.d.ts +106 -0
  92. package/dist/elements/types.d.ts.map +1 -0
  93. package/dist/observer/__tests__/allowlist.test.d.ts +9 -0
  94. package/dist/observer/__tests__/allowlist.test.d.ts.map +1 -0
  95. package/dist/observer/__tests__/bus-translate.test.d.ts +16 -0
  96. package/dist/observer/__tests__/bus-translate.test.d.ts.map +1 -0
  97. package/dist/observer/__tests__/observer-enrich.test.d.ts +10 -0
  98. package/dist/observer/__tests__/observer-enrich.test.d.ts.map +1 -0
  99. package/dist/observer/__tests__/observer-isolation.test.d.ts +13 -0
  100. package/dist/observer/__tests__/observer-isolation.test.d.ts.map +1 -0
  101. package/dist/observer/__tests__/queue.test.d.ts +2 -0
  102. package/dist/observer/__tests__/queue.test.d.ts.map +1 -0
  103. package/dist/observer/__tests__/transport.test.d.ts +2 -0
  104. package/dist/observer/__tests__/transport.test.d.ts.map +1 -0
  105. package/dist/observer/allowlist.d.ts +30 -0
  106. package/dist/observer/allowlist.d.ts.map +1 -0
  107. package/dist/observer/bus-translate.d.ts +33 -0
  108. package/dist/observer/bus-translate.d.ts.map +1 -0
  109. package/dist/observer/index.d.ts +44 -0
  110. package/dist/observer/index.d.ts.map +1 -0
  111. package/dist/observer/queue.d.ts +57 -0
  112. package/dist/observer/queue.d.ts.map +1 -0
  113. package/dist/observer/transport.d.ts +27 -0
  114. package/dist/observer/transport.d.ts.map +1 -0
  115. package/dist/runtime-lit.d.ts +8 -0
  116. package/dist/runtime-lit.d.ts.map +1 -0
  117. package/dist/runtime.d.ts +10 -3
  118. package/dist/runtime.d.ts.map +1 -1
  119. package/dist/runtime.js +1883 -29
  120. package/dist/runtime.js.map +7 -0
  121. package/dist/schema.d.ts +3340 -11
  122. package/dist/schema.d.ts.map +1 -1
  123. package/dist/schema.js +220 -31
  124. package/dist/schema.js.map +7 -0
  125. package/dist/types.d.ts +47 -40
  126. package/dist/types.d.ts.map +1 -1
  127. package/package.json +44 -23
  128. package/dist/ChatAssistant.d.ts +0 -18
  129. package/dist/ChatAssistant.d.ts.map +0 -1
  130. package/dist/ChatAssistant.js +0 -178
  131. package/dist/SyntroChatbot.d.ts +0 -14
  132. package/dist/SyntroChatbot.d.ts.map +0 -1
  133. package/dist/SyntroChatbot.js +0 -52
  134. package/dist/actionParser.d.ts +0 -15
  135. package/dist/actionParser.d.ts.map +0 -1
  136. package/dist/actionParser.js +0 -52
  137. package/dist/apiClient.d.ts +0 -23
  138. package/dist/apiClient.d.ts.map +0 -1
  139. package/dist/apiClient.js +0 -51
  140. package/dist/cdn.js +0 -37
  141. package/dist/editor.d.ts +0 -17
  142. package/dist/editor.d.ts.map +0 -1
  143. package/dist/editor.js +0 -36
  144. package/dist/tools/bridge.d.ts +0 -26
  145. package/dist/tools/bridge.d.ts.map +0 -1
  146. package/dist/tools/bridge.js +0 -25
  147. package/dist/tools/expanders.d.ts +0 -17
  148. package/dist/tools/expanders.d.ts.map +0 -1
  149. package/dist/tools/expanders.js +0 -41
  150. package/dist/tools/index.d.ts +0 -14
  151. package/dist/tools/index.d.ts.map +0 -1
  152. package/dist/tools/index.js +0 -11
  153. package/dist/tools/registrations/GetContextTool.d.ts +0 -7
  154. package/dist/tools/registrations/GetContextTool.d.ts.map +0 -1
  155. package/dist/tools/registrations/GetContextTool.js +0 -18
  156. package/dist/tools/registrations/ScrollToTool.d.ts +0 -7
  157. package/dist/tools/registrations/ScrollToTool.d.ts.map +0 -1
  158. package/dist/tools/registrations/ScrollToTool.js +0 -38
  159. package/dist/tools/registrations/ShowOverlayTool.d.ts +0 -7
  160. package/dist/tools/registrations/ShowOverlayTool.d.ts.map +0 -1
  161. package/dist/tools/registrations/ShowOverlayTool.js +0 -47
  162. package/dist/tools/registrations/index.d.ts +0 -19
  163. package/dist/tools/registrations/index.d.ts.map +0 -1
  164. package/dist/tools/registrations/index.js +0 -7
  165. package/dist/types.js +0 -6
  166. package/dist/useChat.d.ts +0 -25
  167. package/dist/useChat.d.ts.map +0 -1
  168. package/dist/useChat.js +0 -106
@@ -0,0 +1,154 @@
1
+ /**
2
+ * AdaptiveChatBar — the canvas lid composition for the chat-canvas
3
+ * experience. Renders the bubble-up trail on top and an always-visible
4
+ * input row below.
5
+ *
6
+ * Wiring contract (events out):
7
+ * - `chat-message-sent` ({ text }): the user submitted text via Enter
8
+ * or the send button. The owning code is responsible for pushing
9
+ * this into the conversation history and producing a reply.
10
+ *
11
+ * Wiring contract (props in):
12
+ * - `messages`: the conversation trail, passed straight through to
13
+ * `<adaptive-chat-trail>`.
14
+ * - `placeholder`: input placeholder copy. Defaults to a generic
15
+ * "Ask, find, or navigate…" — the host (typically the slot's lid
16
+ * widget mount) can override to a context-specific string.
17
+ *
18
+ * Light DOM. Glassmorphism is applied at the input-row level so the
19
+ * trail above floats over the host page without chrome. See PRD §4.4.
20
+ */
21
+ import { LitElement } from 'lit';
22
+ import './AdaptiveChatTrail.js';
23
+ import type { InlineTrailWidget, TileReceipt, TrailMessage } from './AdaptiveChatTrail.js';
24
+ export declare class AdaptiveChatBar extends LitElement {
25
+ static properties: {
26
+ messages: {
27
+ attribute: boolean;
28
+ };
29
+ placeholder: {
30
+ type: StringConstructor;
31
+ };
32
+ assistantName: {
33
+ type: StringConstructor;
34
+ };
35
+ greeting: {
36
+ type: StringConstructor;
37
+ };
38
+ inFlight: {
39
+ type: BooleanConstructor;
40
+ reflect: boolean;
41
+ };
42
+ thinkingText: {
43
+ attribute: boolean;
44
+ };
45
+ introSuggestion: {
46
+ attribute: boolean;
47
+ };
48
+ forceExpanded: {
49
+ type: BooleanConstructor;
50
+ reflect: boolean;
51
+ };
52
+ maximized: {
53
+ type: BooleanConstructor;
54
+ };
55
+ tileReceipts: {
56
+ attribute: boolean;
57
+ };
58
+ inlineWidgets: {
59
+ attribute: boolean;
60
+ };
61
+ _input: {
62
+ state: boolean;
63
+ };
64
+ };
65
+ messages: TrailMessage[];
66
+ maximized: boolean;
67
+ tileReceipts: TileReceipt[];
68
+ /** Widgets rendered inline in the trail (reco carousel), sourced from
69
+ * the store's `chat-inline` slot mounts. Forwarded to the trail. */
70
+ inlineWidgets: InlineTrailWidget[];
71
+ /**
72
+ * Live reasoning narration from the model — streamed in via
73
+ * AG-UI THINKING_TEXT_MESSAGE_CONTENT events and forwarded by
74
+ * the ChatSession subscription on the host (mountable).
75
+ * Forwarded verbatim to the trail, which renders it in place of
76
+ * the silent loading dots between turns. Empty string when no
77
+ * thinking turn is active.
78
+ */
79
+ thinkingText: string;
80
+ /**
81
+ * Pre-conversation suggestion button — forwarded to the trail's
82
+ * empty-state pane. When the visitor clicks it the trail emits
83
+ * `trail-intro-suggestion`; we catch that here and submit the
84
+ * configured prompt through the normal send path.
85
+ */
86
+ introSuggestion: {
87
+ label: string;
88
+ prompt: string;
89
+ } | undefined;
90
+ /** Pass-through to {@link AdaptiveChatTrail}'s ``forceExpanded`` prop.
91
+ * Hosts that mount the chat-bar in a full-screen surface (mobile
92
+ * panel, agent app, etc.) set this to skip the collapse affordance
93
+ * — there is no smaller state to fall back to. */
94
+ forceExpanded: boolean;
95
+ placeholder: string;
96
+ /**
97
+ * Name shown in the (forceExpanded) header. Defaults to a generic
98
+ * "Assistant". Hosts can override per-workspace (e.g. Vela sets
99
+ * "Vela Concierge") without inventing new SDK surface — it threads
100
+ * through the same mount config the placeholder does.
101
+ */
102
+ assistantName: string;
103
+ /**
104
+ * Initial assistant message shown before any real conversation
105
+ * starts. Renders inside the trail as a phantom assistant chip
106
+ * when messages.length === 0; auto-disappears as soon as the
107
+ * first user message lands. Mirrors ChatAssistantLit's greeting.
108
+ */
109
+ greeting: string | undefined;
110
+ /**
111
+ * Whether a chat round-trip is in flight (request sent, awaiting
112
+ * reply). The single send/stop button morphs accordingly: ↑ when
113
+ * ready, ⏹ when in-flight. Parent owns this state — set true after
114
+ * `chat-message-sent` fires, false when the reply lands or the
115
+ * request is aborted. Enter is inert while in-flight.
116
+ */
117
+ inFlight: boolean;
118
+ _input: string;
119
+ createRenderRoot(): HTMLElement;
120
+ connectedCallback(): void;
121
+ disconnectedCallback(): void;
122
+ private _onInput;
123
+ private _onKeyDown;
124
+ private _onSendOrInterrupt;
125
+ private _onTileReceiptActivate;
126
+ private _onAlertReceiptActivate;
127
+ private _onMaximizeToggle;
128
+ private _send;
129
+ /**
130
+ * Visitor tapped the intro suggestion button in the empty-state
131
+ * trail. Submit the configured prompt through the same channel as
132
+ * a typed message so listeners (mountable → chatSession.send) see
133
+ * a uniform shape — no need for a parallel "suggestion-sent" path.
134
+ * The trail's intro pane auto-disappears the moment the first
135
+ * message lands, so this also closes the empty state in one go.
136
+ */
137
+ private _onIntroSuggestion;
138
+ /**
139
+ * Visitor tapped an inline `suggest_replies` chip in the trail. Submit
140
+ * the chip text through the SAME `chat-message-sent` channel a typed
141
+ * message uses, so the reply rides the existing send path (mountable →
142
+ * chatSession.send → transport) — no fabricated AG-UI events. The
143
+ * trail clears the chips on its own once the reply lands and a newer
144
+ * assistant turn becomes the latest.
145
+ */
146
+ private _onSuggestedReply;
147
+ render(): import("lit-html").TemplateResult<1>;
148
+ }
149
+ declare global {
150
+ interface HTMLElementTagNameMap {
151
+ 'adaptive-chat-bar': AdaptiveChatBar;
152
+ }
153
+ }
154
+ //# sourceMappingURL=AdaptiveChatBar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdaptiveChatBar.d.ts","sourceRoot":"","sources":["../src/AdaptiveChatBar.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAGhD,OAAO,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAM3F,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAaxB;IAEF,QAAQ,EAAE,YAAY,EAAE,CAAM;IAC9B,SAAS,UAAS;IAClB,YAAY,EAAE,WAAW,EAAE,CAAM;IACjC;yEACqE;IACrE,aAAa,EAAE,iBAAiB,EAAE,CAAM;IAExC;;;;;;;OAOG;IACH,YAAY,SAAM;IAClB;;;;;OAKG;IACH,eAAe,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAa;IAE3E;;;uDAGmD;IACnD,aAAa,UAAS;IACtB,WAAW,SAAuB;IAClC;;;;;OAKG;IACH,aAAa,SAA0B;IACvC;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAa;IACzC;;;;;;OAMG;IACH,QAAQ,UAAS;IACjB,MAAM,SAAM;IAEH,gBAAgB,IAAI,WAAW;IAI/B,iBAAiB,IAAI,IAAI;IASzB,oBAAoB,IAAI,IAAI;IAYrC,OAAO,CAAC,QAAQ,CAEd;IAEF,OAAO,CAAC,UAAU,CAShB;IAKF,OAAO,CAAC,kBAAkB,CAMxB;IAEF,OAAO,CAAC,sBAAsB,CAM5B;IAEF,OAAO,CAAC,uBAAuB,CAK7B;IAEF,OAAO,CAAC,iBAAiB,CAEvB;IAEF,OAAO,CAAC,KAAK;IAoBb;;;;;;;OAOG;IACH,OAAO,CAAC,kBAAkB,CAmBxB;IAEF;;;;;;;OAOG;IACH,OAAO,CAAC,iBAAiB,CAiBvB;IAEO,MAAM;CAiDhB;AA8OD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,mBAAmB,EAAE,eAAe,CAAC;KACtC;CACF"}
@@ -0,0 +1,11 @@
1
+ import {
2
+ AdaptiveChatBar
3
+ } from "./chunk-L3LR2J3L.js";
4
+ import "./chunk-EWPPVPJ4.js";
5
+ import "./chunk-I73UT22O.js";
6
+ import "./chunk-5PW6T3QF.js";
7
+ import "./chunk-UVKRO5ER.js";
8
+ export {
9
+ AdaptiveChatBar
10
+ };
11
+ //# sourceMappingURL=AdaptiveChatBar.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * AdaptiveChatBarMountable — `MountableWidget` adapter that turns the
3
+ * standalone `<adaptive-chat-bar>` Lit element into something the
4
+ * runtime widget registry can mount.
5
+ *
6
+ * Registered as widget id `adaptive-chatbot:chat-bar`. Customers
7
+ * reference it from canvas config — either as a slot's `lid` widget
8
+ * (replaces the launcher when referenced from `slots.drawer.lid`) or
9
+ * as a regular tile widget.
10
+ *
11
+ * The bar is a VIEW. State lives in the singleton `chatSession` —
12
+ * whether the bar mounts in the mini-canvas lid, the drawer lid, or
13
+ * both, they're all views of the same conversation. The mountable:
14
+ * - subscribes to chatSession.subscribe() and pushes state into
15
+ * the bar's `messages` + `inFlight` props on every change
16
+ * - routes the bar's `chat-message-sent` event → chatSession.send()
17
+ * - routes the bar's `chat-interrupt` event → chatSession.interrupt()
18
+ * - bubbles the bar's `canvas-close` event → optional onClose
19
+ * callback (canvas-level concern, not session-level)
20
+ *
21
+ * Props (passed via mountConfig):
22
+ * - `placeholder?: string` — input placeholder copy
23
+ * - `onClose?: () => void` — fires on ✕ click (canvas-level)
24
+ *
25
+ * Note: messages and inFlight are NOT props. They flow from chatSession.
26
+ * A canvas-config author who wants to pre-seed messages should do so
27
+ * via the session directly (e.g. via a startup action) — but typical
28
+ * use is to let the conversation start empty.
29
+ */
30
+ import './AdaptiveChatBar';
31
+ export declare function resolveTileWidget(templateId: string): string | undefined;
32
+ export declare function refreshTemplateWidgetMap(uiTemplates: Record<string, unknown> | undefined): void;
33
+ export declare const AdaptiveChatBarMountable: {
34
+ mount(container: HTMLElement, mountConfig?: Record<string, unknown>): () => void;
35
+ update(container: HTMLElement, mountConfig?: Record<string, unknown>): void;
36
+ };
37
+ //# sourceMappingURL=AdaptiveChatBarMountable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdaptiveChatBarMountable.d.ts","sourceRoot":"","sources":["../src/AdaptiveChatBarMountable.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,mBAAmB,CAAC;AA6K3B,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAExE;AAED,wBAAgB,wBAAwB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAgB/F;AA4QD,eAAO,MAAM,wBAAwB;qBAClB,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,IAAI;sBAuE9D,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAQ5E,CAAC"}
@@ -0,0 +1,314 @@
1
+ /**
2
+ * AdaptiveChatTrail — the "bubble-up" message column that sits above the
3
+ * chat bar in the canvas lid.
4
+ *
5
+ * Messages appear immediately above the chat bar and drift upward as
6
+ * newer ones arrive. Each stack position carries an opacity + blur
7
+ * falloff so older messages read as fading from the page. Beyond a
8
+ * `visibleCount` cap (default 3) the trail collapses into an "N more ·
9
+ * expand" affordance — clicking emits `trail-expand`.
10
+ *
11
+ * Shadow DOM (default Lit open root) so chip styles, markdown reset
12
+ * rules, and animation @keyframes are scoped to this element's tree.
13
+ * Theme CSS variables (--sc-tile-text-color, --sc-content-bubble-*,
14
+ * etc.) inherit through the shadow boundary, so canvas-level theming
15
+ * still reaches the chips. The earlier light-DOM render-root override
16
+ * silently broke @keyframes lookup once the trail was hosted inside
17
+ * any shadow root (sc-mount, velvet-mobile, etc.) — keyframes injected
18
+ * into `document.head` aren't visible from another tree scope.
19
+ *
20
+ * See PRD §4.3 (chat trail) for the canonical motion + falloff spec.
21
+ */
22
+ import { LitElement, nothing } from 'lit';
23
+ export interface TrailToolCall {
24
+ id: string;
25
+ name: string;
26
+ status: 'args-streaming' | 'pending' | 'running' | 'done' | 'error';
27
+ /**
28
+ * Parsed tool-call arguments, when available. Threaded through from
29
+ * the AG-UI `ToolCall.args` so the trail can render argument-derived
30
+ * affordances WITHOUT a new transport: an activity receipt for a
31
+ * `primary_response_action` mount (derives type + label from
32
+ * `template_id` / `content.title`) and inline reply chips for a
33
+ * `suggest_replies` call (reads the `replies` array). Undefined while
34
+ * args are still streaming or for tools whose args we don't surface.
35
+ */
36
+ args?: Record<string, unknown>;
37
+ }
38
+ export interface TrailMessage {
39
+ /** Stable identity for keyed rendering (must be unique within the trail). */
40
+ id: number | string;
41
+ role: 'user' | 'assistant' | 'system';
42
+ text: string;
43
+ /** Streaming → assistant text still arriving from backend. Complete → final. Error → fatal during stream. */
44
+ status?: 'streaming' | 'complete' | 'error';
45
+ /** Tool calls attached to an assistant message (rendered as compact chips). */
46
+ toolCalls?: TrailToolCall[];
47
+ }
48
+ export type TileReceipt = {
49
+ kind: 'tile';
50
+ instanceId: string;
51
+ title: string;
52
+ dismissed: boolean;
53
+ } | {
54
+ kind: 'alert';
55
+ instanceId: string;
56
+ title: string;
57
+ };
58
+ /**
59
+ * A widget the backend wants rendered INLINE IN THE CHAT TRAIL (in the
60
+ * conversation flow, like a rich message) — currently the reco carousel.
61
+ * Sourced from `ElementInstanceStore.listInlineWidgets()` (backend
62
+ * `chat-inline` slot mounts) and forwarded by AdaptiveChatBar.
63
+ *
64
+ * The trail mounts `tag` by name via `document.createElement` and assigns
65
+ * `props` onto the element — it never imports the widget package (the
66
+ * element self-defines when its own bundle loads; on demos both bundles
67
+ * are present). If `tag` is not a defined custom element, the trail
68
+ * renders NOTHING for it (no broken box).
69
+ */
70
+ export interface InlineTrailWidget {
71
+ instanceId: string;
72
+ /** Custom-element tag (e.g. `syntro-product-reco-carousel`). */
73
+ tag: string;
74
+ props: Record<string, unknown>;
75
+ }
76
+ export declare class AdaptiveChatTrail extends LitElement {
77
+ static styles: import("lit").CSSResult;
78
+ static properties: {
79
+ messages: {
80
+ attribute: boolean;
81
+ };
82
+ visibleCount: {
83
+ type: NumberConstructor;
84
+ };
85
+ expanded: {
86
+ type: BooleanConstructor;
87
+ };
88
+ greeting: {
89
+ type: StringConstructor;
90
+ };
91
+ /** When true: trail renders fully expanded AND the
92
+ * expand/collapse affordance is hidden. Used by hosts that mount
93
+ * the chat in a full-screen surface (the mobile panel) where
94
+ * collapse makes no sense — there's nothing to collapse INTO. */
95
+ forceExpanded: {
96
+ type: BooleanConstructor;
97
+ };
98
+ /**
99
+ * Mirrors `chatSession.inFlight` — true between `send()` and the
100
+ * assistant's first `receiveStart`/`receiveDelta`, OR while a
101
+ * stream is in progress. Drives the "thinking" indicator that
102
+ * fills the gap between the user's just-sent message and the
103
+ * first assistant token. Wired through AdaptiveChatBar (it owns
104
+ * the chatSession subscription and forwards inFlight as a prop).
105
+ */
106
+ inFlight: {
107
+ type: BooleanConstructor;
108
+ };
109
+ /**
110
+ * Live reasoning narration streamed from the model via AG-UI
111
+ * `THINKING_TEXT_MESSAGE_CONTENT`. When non-empty, the thinking
112
+ * chip renders this in place of the bouncing dots so the visitor
113
+ * sees what the model is actually doing instead of staring at
114
+ * silent loading state during a tool-call gap.
115
+ */
116
+ thinkingText: {
117
+ attribute: boolean;
118
+ };
119
+ /**
120
+ * Pre-conversation suggestion chip. When the visitor opens the
121
+ * chat and `messages` is empty, the trail renders this as a
122
+ * button beneath the greeting. Clicking it dispatches a
123
+ * `trail-intro-suggestion` event with the configured prompt —
124
+ * the parent (chat-bar) forwards that to chatSession.send().
125
+ * Disappears the moment the first message lands.
126
+ */
127
+ introSuggestion: {
128
+ attribute: boolean;
129
+ };
130
+ /**
131
+ * Tappable tile-receipt chips rendered once at the end of the
132
+ * trail. Produced from the store by Task 3 (AdaptiveChatBar).
133
+ * Each chip emits `tile-receipt-activate` with its instanceId.
134
+ */
135
+ tileReceipts: {
136
+ attribute: boolean;
137
+ };
138
+ /**
139
+ * Widgets rendered INLINE in the trail (reco carousel etc.),
140
+ * anchored to a message position like receipts. Sourced from the
141
+ * store's `chat-inline` slot mounts via AdaptiveChatBar.
142
+ */
143
+ inlineWidgets: {
144
+ attribute: boolean;
145
+ };
146
+ };
147
+ messages: TrailMessage[];
148
+ tileReceipts: TileReceipt[];
149
+ inlineWidgets: InlineTrailWidget[];
150
+ visibleCount: number;
151
+ expanded: boolean;
152
+ forceExpanded: boolean;
153
+ inFlight: boolean;
154
+ thinkingText: string;
155
+ introSuggestion: {
156
+ label: string;
157
+ prompt: string;
158
+ } | undefined;
159
+ /**
160
+ * Pre-conversation phantom assistant message. Rendered only when
161
+ * `messages` is empty. NOT injected into chatSession state — the
162
+ * greeting is configuration, not conversation, so it disappears
163
+ * automatically when the first real message arrives.
164
+ */
165
+ greeting: string | undefined;
166
+ private _onExpand;
167
+ /**
168
+ * Approve a pending client tool call. The trail emits a generic
169
+ * event so the host can decide whether to forward to chatSession
170
+ * (the common path) or override. Keeps the trail itself free of
171
+ * direct chatSession coupling — it's a pure view component.
172
+ */
173
+ private _onToolCallClick;
174
+ private _onCollapse;
175
+ /**
176
+ * Whether to render the thinking-dots chip after the last message.
177
+ * True iff a request is in flight AND the assistant hasn't started
178
+ * streaming a reply yet — once the first delta lands, the streaming
179
+ * chip's caret takes over and the thinking indicator hides so the
180
+ * visitor isn't shown both at once. Also hidden when the last
181
+ * message is an error/system message, because the request that
182
+ * "errored" is already over from the user's perspective.
183
+ */
184
+ private _shouldShowThinking;
185
+ /**
186
+ * instanceId → id of the message that was newest when the receipt first
187
+ * appeared. This is what makes a receipt read like a chat bubble: it renders
188
+ * inline right after its anchor message, so newer messages push it up into
189
+ * history instead of it staying pinned below everything. Assigned once per
190
+ * instanceId (in willUpdate, the only place that sees both `messages` and
191
+ * `tileReceipts` at the moment a tile mounts) and never re-homed — a
192
+ * dismiss/bring-back keeps the chip where it was created. `null` = the tile
193
+ * mounted before the first chat message (canvas replay); those fall to the
194
+ * tail strip (see render).
195
+ */
196
+ private readonly _receiptAnchors;
197
+ /**
198
+ * instanceId → anchor message id for inline widgets — same mechanism as
199
+ * `_receiptAnchors`. The inline carousel renders right after the message
200
+ * that was newest when it mounted, so it reads like a rich reply and
201
+ * drifts up into history as later messages append.
202
+ */
203
+ private readonly _inlineAnchors;
204
+ /**
205
+ * instanceId → the live custom element mounted for an inline widget.
206
+ * Cached so a prop patch (same instanceId, new props) updates the
207
+ * EXISTING element instead of tearing it down and re-creating it —
208
+ * which would reset the carousel's scroll position + internal state.
209
+ * The element is created lazily via `document.createElement(tag)` the
210
+ * first time we see a defined tag; an undefined tag caches `null` so
211
+ * the fail-safe renders nothing without re-checking the registry.
212
+ */
213
+ private readonly _inlineElements;
214
+ willUpdate(changed: Map<string, unknown>): void;
215
+ /**
216
+ * Create (once) or refresh the cached custom element for an inline
217
+ * widget. Mounts by tag name so the chat bundle never imports the
218
+ * widget package. Fail-safe: if the tag is not a defined custom
219
+ * element, cache `null` and render nothing (no broken box).
220
+ */
221
+ private _ensureInlineElement;
222
+ updated(changed: Map<string, unknown>): void;
223
+ private _onTileReceiptClick;
224
+ private _onAlertReceiptClick;
225
+ /** Render a set of inline widgets (reco carousel etc.) as
226
+ * `[data-trail-widget]` blocks, anchored to a message position like
227
+ * receipts. Each block hosts the cached custom element for that
228
+ * instanceId — a defined tag mounts inline; an undefined tag renders
229
+ * nothing (fail-safe). Rendered at every trail site (inline per anchor,
230
+ * tail, empty-state) so placement can't diverge. */
231
+ private _renderInlineWidgetStrip;
232
+ /** A row of receipt chips, used at every trail render site (inline per
233
+ * anchor message, the tail fallback, and the empty-state branches) so the
234
+ * markup + styling can never diverge. Returns `nothing` for an empty list. */
235
+ private _renderReceiptStrip;
236
+ /** One receipt chip — a single, unified, single-line design for both kinds
237
+ * (nav "alert" + mounted "tile"). Same container/title/action style so they
238
+ * read as one chip family; the icon + action label carry the kind. No
239
+ * subtitle: the old "Brought up earlier" line was hardcoded (wrong for
240
+ * same-turn mounts) and made the chip taller — dropping it is the "shorter"
241
+ * chip. Rendered at every trail site so the kinds can't diverge. */
242
+ private _renderReceiptChip;
243
+ private _onIntroSuggestionClick;
244
+ /**
245
+ * Visitor tapped a `suggest_replies` inline chip. Emit
246
+ * `trail-suggested-reply` carrying the chip text — the parent
247
+ * (AdaptiveChatBar) re-dispatches it as `chat-message-sent`, the
248
+ * SAME channel the input row uses, so the reply rides the existing
249
+ * send path (mountable → chatSession.send → transport). No fabricated
250
+ * AG-UI events; this is exactly what typing the text and hitting
251
+ * Enter would do. The chips clear on their own once the reply lands
252
+ * and a newer assistant message becomes the latest.
253
+ */
254
+ private _onSuggestedReplyClick;
255
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
256
+ }
257
+ /**
258
+ * Discriminated visual state for a chip. Replaces the older
259
+ * `(role, { isStreaming, isError })` triple whose interaction order
260
+ * could produce nonsense combinations (e.g. an assistant chip
261
+ * accidentally reading as a user bubble because `isStreaming` was
262
+ * checked before role). Each kind below is a real conversational
263
+ * state with a single visual identity:
264
+ *
265
+ * - `settled` — a complete message; the user-vs-assistant
266
+ * identity comes from `role`
267
+ * - `streaming` — the assistant chip currently receiving tokens;
268
+ * keeps assistant identity (the blinking caret
269
+ * inside the chip carries "in progress")
270
+ * - `pending` — the thinking chip shown between the user's
271
+ * just-sent message and the assistant's first
272
+ * token; assistant identity (the bouncing dots
273
+ * inside carry "in progress")
274
+ * - `error` — a chip whose stream failed mid-flight, OR any
275
+ * system-role message (system messages render
276
+ * with the error identity by convention)
277
+ *
278
+ * Bug history: an earlier branch-ladder design checked `isStreaming`
279
+ * before `role`, so the `pending`/thinking chip inherited the user
280
+ * bubble border. On hosts whose chat panel sits over a light surface
281
+ * that read as a "white div" pasted into the assistant slot. The
282
+ * discriminated state prevents that combination from being expressible.
283
+ */
284
+ export type ChipVisualState = {
285
+ kind: 'settled';
286
+ role: 'user' | 'assistant' | 'system';
287
+ } | {
288
+ kind: 'streaming';
289
+ } | {
290
+ kind: 'pending';
291
+ } | {
292
+ kind: 'error';
293
+ role: 'user' | 'assistant' | 'system';
294
+ };
295
+ /**
296
+ * A misbehaving model can emit a raw SERIALIZED response payload as plain TEXT
297
+ * on a spurious trailing turn — e.g.
298
+ * `(Empty response: {'content': [{'type': 'thinking', …}], 'stop_reason': …})`.
299
+ * Backstop for model degeneration (Kimi); the prompt (S-14) also asks for one
300
+ * brief closing, but copy can't be trusted on the very turn that degenerates.
301
+ *
302
+ * Detection avoids false positives (which are WORSE than the dump — the visitor
303
+ * would see nothing): a turn is dropped only if it OPENS with the literal
304
+ * "(Empty response" marker, OR it carries ≥2 serialization tokens at once. A
305
+ * single token (a product about a "signature blend", the agent quoting one JSON
306
+ * key) never trips it; a real response dump carries all of them.
307
+ */
308
+ export declare function looksLikeSerializedModelResponse(text: string): boolean;
309
+ declare global {
310
+ interface HTMLElementTagNameMap {
311
+ 'adaptive-chat-trail': AdaptiveChatTrail;
312
+ }
313
+ }
314
+ //# sourceMappingURL=AdaptiveChatTrail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdaptiveChatTrail.d.ts","sourceRoot":"","sources":["../src/AdaptiveChatTrail.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,11 @@
1
+ import {
2
+ AdaptiveChatTrail,
3
+ looksLikeSerializedModelResponse
4
+ } from "./chunk-I73UT22O.js";
5
+ import "./chunk-5PW6T3QF.js";
6
+ import "./chunk-UVKRO5ER.js";
7
+ export {
8
+ AdaptiveChatTrail,
9
+ looksLikeSerializedModelResponse
10
+ };
11
+ //# sourceMappingURL=AdaptiveChatTrail.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ import './AdaptiveChatTrail';
2
+ //# sourceMappingURL=AdaptiveChatTrail.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdaptiveChatTrail.test.d.ts","sourceRoot":"","sources":["../src/AdaptiveChatTrail.test.ts"],"names":[],"mappings":"AAgBA,OAAO,qBAAqB,CAAC"}