@syntrologie/adapt-chatbot 2.8.0-canary.38 → 2.8.0-canary.381

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 (156) hide show
  1. package/dist/AdaptiveChatBar.d.ts +137 -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 +35 -0
  6. package/dist/AdaptiveChatBarMountable.d.ts.map +1 -0
  7. package/dist/AdaptiveChatTrail.d.ts +226 -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/AdaptiveChipsStrip.d.ts +1150 -0
  12. package/dist/AdaptiveChipsStrip.d.ts.map +1 -0
  13. package/dist/AdaptiveChipsStrip.js +11 -0
  14. package/dist/AdaptiveChipsStrip.js.map +7 -0
  15. package/dist/AdaptiveChipsStripMountable.d.ts +24 -0
  16. package/dist/AdaptiveChipsStripMountable.d.ts.map +1 -0
  17. package/dist/ChatAssistantLit.d.ts +60 -0
  18. package/dist/ChatAssistantLit.d.ts.map +1 -0
  19. package/dist/ChatAssistantLit.js +13 -0
  20. package/dist/ChatAssistantLit.js.map +7 -0
  21. package/dist/ChatSession.d.ts +217 -0
  22. package/dist/ChatSession.d.ts.map +1 -0
  23. package/dist/ChatTransport.d.ts +320 -0
  24. package/dist/ChatTransport.d.ts.map +1 -0
  25. package/dist/NavLinkMountable.d.ts +25 -0
  26. package/dist/NavLinkMountable.d.ts.map +1 -0
  27. package/dist/NavLinkMountable.test.d.ts +2 -0
  28. package/dist/NavLinkMountable.test.d.ts.map +1 -0
  29. package/dist/TextAnswerMountable.d.ts +17 -0
  30. package/dist/TextAnswerMountable.d.ts.map +1 -0
  31. package/dist/Turnstile.d.ts +83 -0
  32. package/dist/Turnstile.d.ts.map +1 -0
  33. package/dist/cdn.d.ts +2 -6
  34. package/dist/cdn.d.ts.map +1 -1
  35. package/dist/chunk-5PW6T3QF.js +3740 -0
  36. package/dist/chunk-5PW6T3QF.js.map +7 -0
  37. package/dist/chunk-6ATDJA4K.js +8911 -0
  38. package/dist/chunk-6ATDJA4K.js.map +7 -0
  39. package/dist/chunk-EWPPVPJ4.js +14 -0
  40. package/dist/chunk-EWPPVPJ4.js.map +7 -0
  41. package/dist/chunk-FVNSOP7B.js +634 -0
  42. package/dist/chunk-FVNSOP7B.js.map +7 -0
  43. package/dist/chunk-FW4XH5XF.js +1008 -0
  44. package/dist/chunk-FW4XH5XF.js.map +7 -0
  45. package/dist/chunk-UVKRO5ER.js +13 -0
  46. package/dist/chunk-UVKRO5ER.js.map +7 -0
  47. package/dist/chunk-VLJ3WOEX.js +231 -0
  48. package/dist/chunk-VLJ3WOEX.js.map +7 -0
  49. package/dist/chunk-WFEXIVLP.js +426 -0
  50. package/dist/chunk-WFEXIVLP.js.map +7 -0
  51. package/dist/editor-lit.d.ts +37 -0
  52. package/dist/editor-lit.d.ts.map +1 -0
  53. package/dist/editor-lit.js +134 -0
  54. package/dist/editor-lit.js.map +7 -0
  55. package/dist/elements/ActionHandler.d.ts +34 -0
  56. package/dist/elements/ActionHandler.d.ts.map +1 -0
  57. package/dist/elements/ElementInstanceStore.d.ts +168 -0
  58. package/dist/elements/ElementInstanceStore.d.ts.map +1 -0
  59. package/dist/elements/ElementInstanceStore.test.d.ts +2 -0
  60. package/dist/elements/ElementInstanceStore.test.d.ts.map +1 -0
  61. package/dist/elements/ElementTypeHandler.d.ts +77 -0
  62. package/dist/elements/ElementTypeHandler.d.ts.map +1 -0
  63. package/dist/elements/ItemHandler.d.ts +60 -0
  64. package/dist/elements/ItemHandler.d.ts.map +1 -0
  65. package/dist/elements/ItemHandler.test.d.ts +2 -0
  66. package/dist/elements/ItemHandler.test.d.ts.map +1 -0
  67. package/dist/elements/TileHandler.d.ts +52 -0
  68. package/dist/elements/TileHandler.d.ts.map +1 -0
  69. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts +2 -0
  70. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts.map +1 -0
  71. package/dist/elements/blockRenderer.d.ts +46 -0
  72. package/dist/elements/blockRenderer.d.ts.map +1 -0
  73. package/dist/elements/blockRenderer.test.d.ts +13 -0
  74. package/dist/elements/blockRenderer.test.d.ts.map +1 -0
  75. package/dist/elements/blocks.d.ts +58 -0
  76. package/dist/elements/blocks.d.ts.map +1 -0
  77. package/dist/elements/envelope.d.ts +24 -0
  78. package/dist/elements/envelope.d.ts.map +1 -0
  79. package/dist/elements/fetcher.d.ts +40 -0
  80. package/dist/elements/fetcher.d.ts.map +1 -0
  81. package/dist/elements/index.d.ts +33 -0
  82. package/dist/elements/index.d.ts.map +1 -0
  83. package/dist/elements/store-singleton.d.ts +4 -0
  84. package/dist/elements/store-singleton.d.ts.map +1 -0
  85. package/dist/elements/types.d.ts +106 -0
  86. package/dist/elements/types.d.ts.map +1 -0
  87. package/dist/observer/__tests__/allowlist.test.d.ts +9 -0
  88. package/dist/observer/__tests__/allowlist.test.d.ts.map +1 -0
  89. package/dist/observer/__tests__/observer-isolation.test.d.ts +13 -0
  90. package/dist/observer/__tests__/observer-isolation.test.d.ts.map +1 -0
  91. package/dist/observer/__tests__/queue.test.d.ts +2 -0
  92. package/dist/observer/__tests__/queue.test.d.ts.map +1 -0
  93. package/dist/observer/__tests__/transport.test.d.ts +2 -0
  94. package/dist/observer/__tests__/transport.test.d.ts.map +1 -0
  95. package/dist/observer/allowlist.d.ts +32 -0
  96. package/dist/observer/allowlist.d.ts.map +1 -0
  97. package/dist/observer/index.d.ts +36 -0
  98. package/dist/observer/index.d.ts.map +1 -0
  99. package/dist/observer/queue.d.ts +57 -0
  100. package/dist/observer/queue.d.ts.map +1 -0
  101. package/dist/observer/transport.d.ts +27 -0
  102. package/dist/observer/transport.d.ts.map +1 -0
  103. package/dist/runtime-lit.d.ts +8 -0
  104. package/dist/runtime-lit.d.ts.map +1 -0
  105. package/dist/runtime.d.ts +10 -3
  106. package/dist/runtime.d.ts.map +1 -1
  107. package/dist/runtime.js +1841 -29
  108. package/dist/runtime.js.map +7 -0
  109. package/dist/schema.d.ts +3334 -11
  110. package/dist/schema.d.ts.map +1 -1
  111. package/dist/schema.js +217 -31
  112. package/dist/schema.js.map +7 -0
  113. package/dist/types.d.ts +47 -40
  114. package/dist/types.d.ts.map +1 -1
  115. package/package.json +43 -23
  116. package/dist/ChatAssistant.d.ts +0 -18
  117. package/dist/ChatAssistant.d.ts.map +0 -1
  118. package/dist/ChatAssistant.js +0 -178
  119. package/dist/SyntroChatbot.d.ts +0 -14
  120. package/dist/SyntroChatbot.d.ts.map +0 -1
  121. package/dist/SyntroChatbot.js +0 -52
  122. package/dist/actionParser.d.ts +0 -15
  123. package/dist/actionParser.d.ts.map +0 -1
  124. package/dist/actionParser.js +0 -52
  125. package/dist/apiClient.d.ts +0 -23
  126. package/dist/apiClient.d.ts.map +0 -1
  127. package/dist/apiClient.js +0 -51
  128. package/dist/cdn.js +0 -37
  129. package/dist/editor.d.ts +0 -17
  130. package/dist/editor.d.ts.map +0 -1
  131. package/dist/editor.js +0 -36
  132. package/dist/tools/bridge.d.ts +0 -26
  133. package/dist/tools/bridge.d.ts.map +0 -1
  134. package/dist/tools/bridge.js +0 -25
  135. package/dist/tools/expanders.d.ts +0 -17
  136. package/dist/tools/expanders.d.ts.map +0 -1
  137. package/dist/tools/expanders.js +0 -41
  138. package/dist/tools/index.d.ts +0 -14
  139. package/dist/tools/index.d.ts.map +0 -1
  140. package/dist/tools/index.js +0 -11
  141. package/dist/tools/registrations/GetContextTool.d.ts +0 -7
  142. package/dist/tools/registrations/GetContextTool.d.ts.map +0 -1
  143. package/dist/tools/registrations/GetContextTool.js +0 -18
  144. package/dist/tools/registrations/ScrollToTool.d.ts +0 -7
  145. package/dist/tools/registrations/ScrollToTool.d.ts.map +0 -1
  146. package/dist/tools/registrations/ScrollToTool.js +0 -38
  147. package/dist/tools/registrations/ShowOverlayTool.d.ts +0 -7
  148. package/dist/tools/registrations/ShowOverlayTool.d.ts.map +0 -1
  149. package/dist/tools/registrations/ShowOverlayTool.js +0 -47
  150. package/dist/tools/registrations/index.d.ts +0 -19
  151. package/dist/tools/registrations/index.d.ts.map +0 -1
  152. package/dist/tools/registrations/index.js +0 -7
  153. package/dist/types.js +0 -6
  154. package/dist/useChat.d.ts +0 -25
  155. package/dist/useChat.d.ts.map +0 -1
  156. package/dist/useChat.js +0 -106
@@ -0,0 +1,137 @@
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 { 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
+ greeting: {
33
+ type: StringConstructor;
34
+ };
35
+ inFlight: {
36
+ type: BooleanConstructor;
37
+ reflect: boolean;
38
+ };
39
+ thinkingText: {
40
+ attribute: boolean;
41
+ };
42
+ introSuggestion: {
43
+ attribute: boolean;
44
+ };
45
+ forceExpanded: {
46
+ type: BooleanConstructor;
47
+ reflect: boolean;
48
+ };
49
+ maximized: {
50
+ type: BooleanConstructor;
51
+ };
52
+ tileReceipts: {
53
+ attribute: boolean;
54
+ };
55
+ _input: {
56
+ state: boolean;
57
+ };
58
+ };
59
+ messages: TrailMessage[];
60
+ maximized: boolean;
61
+ tileReceipts: TileReceipt[];
62
+ /**
63
+ * Live reasoning narration from the model — streamed in via
64
+ * AG-UI THINKING_TEXT_MESSAGE_CONTENT events and forwarded by
65
+ * the ChatSession subscription on the host (mountable).
66
+ * Forwarded verbatim to the trail, which renders it in place of
67
+ * the silent loading dots between turns. Empty string when no
68
+ * thinking turn is active.
69
+ */
70
+ thinkingText: string;
71
+ /**
72
+ * Pre-conversation suggestion button — forwarded to the trail's
73
+ * empty-state pane. When the visitor clicks it the trail emits
74
+ * `trail-intro-suggestion`; we catch that here and submit the
75
+ * configured prompt through the normal send path.
76
+ */
77
+ introSuggestion: {
78
+ label: string;
79
+ prompt: string;
80
+ } | undefined;
81
+ /** Pass-through to {@link AdaptiveChatTrail}'s ``forceExpanded`` prop.
82
+ * Hosts that mount the chat-bar in a full-screen surface (mobile
83
+ * panel, agent app, etc.) set this to skip the collapse affordance
84
+ * — there is no smaller state to fall back to. */
85
+ forceExpanded: boolean;
86
+ placeholder: string;
87
+ /**
88
+ * Initial assistant message shown before any real conversation
89
+ * starts. Renders inside the trail as a phantom assistant chip
90
+ * when messages.length === 0; auto-disappears as soon as the
91
+ * first user message lands. Mirrors ChatAssistantLit's greeting.
92
+ */
93
+ greeting: string | undefined;
94
+ /**
95
+ * Whether a chat round-trip is in flight (request sent, awaiting
96
+ * reply). The single send/stop button morphs accordingly: ↑ when
97
+ * ready, ⏹ when in-flight. Parent owns this state — set true after
98
+ * `chat-message-sent` fires, false when the reply lands or the
99
+ * request is aborted. Enter is inert while in-flight.
100
+ */
101
+ inFlight: boolean;
102
+ _input: string;
103
+ createRenderRoot(): HTMLElement;
104
+ connectedCallback(): void;
105
+ disconnectedCallback(): void;
106
+ private _onInput;
107
+ private _onKeyDown;
108
+ private _onSendOrInterrupt;
109
+ private _onTileReceiptActivate;
110
+ private _onMaximizeToggle;
111
+ private _send;
112
+ /**
113
+ * Visitor tapped the intro suggestion button in the empty-state
114
+ * trail. Submit the configured prompt through the same channel as
115
+ * a typed message so listeners (mountable → chatSession.send) see
116
+ * a uniform shape — no need for a parallel "suggestion-sent" path.
117
+ * The trail's intro pane auto-disappears the moment the first
118
+ * message lands, so this also closes the empty state in one go.
119
+ */
120
+ private _onIntroSuggestion;
121
+ /**
122
+ * Visitor tapped an inline `suggest_replies` chip in the trail. Submit
123
+ * the chip text through the SAME `chat-message-sent` channel a typed
124
+ * message uses, so the reply rides the existing send path (mountable →
125
+ * chatSession.send → transport) — no fabricated AG-UI events. The
126
+ * trail clears the chips on its own once the reply lands and a newer
127
+ * assistant turn becomes the latest.
128
+ */
129
+ private _onSuggestedReply;
130
+ render(): import("lit-html").TemplateResult<1>;
131
+ }
132
+ declare global {
133
+ interface HTMLElementTagNameMap {
134
+ 'adaptive-chat-bar': AdaptiveChatBar;
135
+ }
136
+ }
137
+ //# 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,WAAW,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAKxE,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,OAAgB,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWxB;IAEF,QAAQ,EAAE,YAAY,EAAE,CAAM;IAC9B,SAAS,UAAS;IAClB,YAAY,EAAE,WAAW,EAAE,CAAM;IAEjC;;;;;;;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,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAa;IACzC;;;;;;OAMG;IACH,QAAQ,UAAS;IACjB,MAAM,SAAM;IAEH,gBAAgB,IAAI,WAAW;IAI/B,iBAAiB,IAAI,IAAI;IAQzB,oBAAoB,IAAI,IAAI;IAWrC,OAAO,CAAC,QAAQ,CAEd;IAEF,OAAO,CAAC,UAAU,CAShB;IAKF,OAAO,CAAC,kBAAkB,CAMxB;IAEF,OAAO,CAAC,sBAAsB,CAM5B;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;CAgDhB;AA4PD,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-WFEXIVLP.js";
4
+ import "./chunk-EWPPVPJ4.js";
5
+ import "./chunk-FW4XH5XF.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,35 @@
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 const AdaptiveChatBarMountable: {
32
+ mount(container: HTMLElement, mountConfig?: Record<string, unknown>): () => void;
33
+ update(container: HTMLElement, mountConfig?: Record<string, unknown>): void;
34
+ };
35
+ //# 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;AA6a3B,eAAO,MAAM,wBAAwB;qBAClB,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,IAAI;sBAoE9D,WAAW,gBAAgB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;CAQ5E,CAAC"}
@@ -0,0 +1,226 @@
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 interface TileReceipt {
49
+ instanceId: string;
50
+ title: string;
51
+ dismissed: boolean;
52
+ }
53
+ export declare class AdaptiveChatTrail extends LitElement {
54
+ static styles: import("lit").CSSResult;
55
+ static properties: {
56
+ messages: {
57
+ attribute: boolean;
58
+ };
59
+ visibleCount: {
60
+ type: NumberConstructor;
61
+ };
62
+ expanded: {
63
+ type: BooleanConstructor;
64
+ };
65
+ greeting: {
66
+ type: StringConstructor;
67
+ };
68
+ /** When true: trail renders fully expanded AND the
69
+ * expand/collapse affordance is hidden. Used by hosts that mount
70
+ * the chat in a full-screen surface (the mobile panel) where
71
+ * collapse makes no sense — there's nothing to collapse INTO. */
72
+ forceExpanded: {
73
+ type: BooleanConstructor;
74
+ };
75
+ /**
76
+ * Mirrors `chatSession.inFlight` — true between `send()` and the
77
+ * assistant's first `receiveStart`/`receiveDelta`, OR while a
78
+ * stream is in progress. Drives the "thinking" indicator that
79
+ * fills the gap between the user's just-sent message and the
80
+ * first assistant token. Wired through AdaptiveChatBar (it owns
81
+ * the chatSession subscription and forwards inFlight as a prop).
82
+ */
83
+ inFlight: {
84
+ type: BooleanConstructor;
85
+ };
86
+ /**
87
+ * Live reasoning narration streamed from the model via AG-UI
88
+ * `THINKING_TEXT_MESSAGE_CONTENT`. When non-empty, the thinking
89
+ * chip renders this in place of the bouncing dots so the visitor
90
+ * sees what the model is actually doing instead of staring at
91
+ * silent loading state during a tool-call gap.
92
+ */
93
+ thinkingText: {
94
+ attribute: boolean;
95
+ };
96
+ /**
97
+ * Pre-conversation suggestion chip. When the visitor opens the
98
+ * chat and `messages` is empty, the trail renders this as a
99
+ * button beneath the greeting. Clicking it dispatches a
100
+ * `trail-intro-suggestion` event with the configured prompt —
101
+ * the parent (chat-bar) forwards that to chatSession.send().
102
+ * Disappears the moment the first message lands.
103
+ */
104
+ introSuggestion: {
105
+ attribute: boolean;
106
+ };
107
+ /**
108
+ * Tappable tile-receipt chips rendered once at the end of the
109
+ * trail. Produced from the store by Task 3 (AdaptiveChatBar).
110
+ * Each chip emits `tile-receipt-activate` with its instanceId.
111
+ */
112
+ tileReceipts: {
113
+ attribute: boolean;
114
+ };
115
+ };
116
+ messages: TrailMessage[];
117
+ tileReceipts: TileReceipt[];
118
+ visibleCount: number;
119
+ expanded: boolean;
120
+ forceExpanded: boolean;
121
+ inFlight: boolean;
122
+ thinkingText: string;
123
+ introSuggestion: {
124
+ label: string;
125
+ prompt: string;
126
+ } | undefined;
127
+ /**
128
+ * Pre-conversation phantom assistant message. Rendered only when
129
+ * `messages` is empty. NOT injected into chatSession state — the
130
+ * greeting is configuration, not conversation, so it disappears
131
+ * automatically when the first real message arrives.
132
+ */
133
+ greeting: string | undefined;
134
+ private _onExpand;
135
+ /**
136
+ * Approve a pending client tool call. The trail emits a generic
137
+ * event so the host can decide whether to forward to chatSession
138
+ * (the common path) or override. Keeps the trail itself free of
139
+ * direct chatSession coupling — it's a pure view component.
140
+ */
141
+ private _onToolCallClick;
142
+ private _onCollapse;
143
+ /**
144
+ * Whether to render the thinking-dots chip after the last message.
145
+ * True iff a request is in flight AND the assistant hasn't started
146
+ * streaming a reply yet — once the first delta lands, the streaming
147
+ * chip's caret takes over and the thinking indicator hides so the
148
+ * visitor isn't shown both at once. Also hidden when the last
149
+ * message is an error/system message, because the request that
150
+ * "errored" is already over from the user's perspective.
151
+ */
152
+ private _shouldShowThinking;
153
+ updated(changed: Map<string, unknown>): void;
154
+ private _onTileReceiptClick;
155
+ private _onIntroSuggestionClick;
156
+ /**
157
+ * Visitor tapped a `suggest_replies` inline chip. Emit
158
+ * `trail-suggested-reply` carrying the chip text — the parent
159
+ * (AdaptiveChatBar) re-dispatches it as `chat-message-sent`, the
160
+ * SAME channel the input row uses, so the reply rides the existing
161
+ * send path (mountable → chatSession.send → transport). No fabricated
162
+ * AG-UI events; this is exactly what typing the text and hitting
163
+ * Enter would do. The chips clear on their own once the reply lands
164
+ * and a newer assistant message becomes the latest.
165
+ */
166
+ private _onSuggestedReplyClick;
167
+ render(): typeof nothing | import("lit-html").TemplateResult<1>;
168
+ }
169
+ /**
170
+ * Discriminated visual state for a chip. Replaces the older
171
+ * `(role, { isStreaming, isError })` triple whose interaction order
172
+ * could produce nonsense combinations (e.g. an assistant chip
173
+ * accidentally reading as a user bubble because `isStreaming` was
174
+ * checked before role). Each kind below is a real conversational
175
+ * state with a single visual identity:
176
+ *
177
+ * - `settled` — a complete message; the user-vs-assistant
178
+ * identity comes from `role`
179
+ * - `streaming` — the assistant chip currently receiving tokens;
180
+ * keeps assistant identity (the blinking caret
181
+ * inside the chip carries "in progress")
182
+ * - `pending` — the thinking chip shown between the user's
183
+ * just-sent message and the assistant's first
184
+ * token; assistant identity (the bouncing dots
185
+ * inside carry "in progress")
186
+ * - `error` — a chip whose stream failed mid-flight, OR any
187
+ * system-role message (system messages render
188
+ * with the error identity by convention)
189
+ *
190
+ * Bug history: an earlier branch-ladder design checked `isStreaming`
191
+ * before `role`, so the `pending`/thinking chip inherited the user
192
+ * bubble border. On hosts whose chat panel sits over a light surface
193
+ * that read as a "white div" pasted into the assistant slot. The
194
+ * discriminated state prevents that combination from being expressible.
195
+ */
196
+ export type ChipVisualState = {
197
+ kind: 'settled';
198
+ role: 'user' | 'assistant' | 'system';
199
+ } | {
200
+ kind: 'streaming';
201
+ } | {
202
+ kind: 'pending';
203
+ } | {
204
+ kind: 'error';
205
+ role: 'user' | 'assistant' | 'system';
206
+ };
207
+ /**
208
+ * A misbehaving model can emit a raw SERIALIZED response payload as plain TEXT
209
+ * on a spurious trailing turn — e.g.
210
+ * `(Empty response: {'content': [{'type': 'thinking', …}], 'stop_reason': …})`.
211
+ * Backstop for model degeneration (Kimi); the prompt (S-14) also asks for one
212
+ * brief closing, but copy can't be trusted on the very turn that degenerates.
213
+ *
214
+ * Detection avoids false positives (which are WORSE than the dump — the visitor
215
+ * would see nothing): a turn is dropped only if it OPENS with the literal
216
+ * "(Empty response" marker, OR it carries ≥2 serialization tokens at once. A
217
+ * single token (a product about a "signature blend", the agent quoting one JSON
218
+ * key) never trips it; a real response dump carries all of them.
219
+ */
220
+ export declare function looksLikeSerializedModelResponse(text: string): boolean;
221
+ declare global {
222
+ interface HTMLElementTagNameMap {
223
+ 'adaptive-chat-trail': AdaptiveChatTrail;
224
+ }
225
+ }
226
+ //# sourceMappingURL=AdaptiveChatTrail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AdaptiveChatTrail.d.ts","sourceRoot":"","sources":["../src/AdaptiveChatTrail.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAa,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAIrD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,CAAC;IACpE;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,6GAA6G;IAC7G,MAAM,CAAC,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC;IAC5C,+EAA+E;IAC/E,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;CACpB;AAqBD,qBAAa,iBAAkB,SAAQ,UAAU;IAsB/C,OAAgB,MAAM,0BA8FpB;IAEF,OAAgB,UAAU;;;;;;;;;;;;;QAKxB;;;0EAGkE;;;;QAElE;;;;;;;WAOG;;;;QAEH;;;;;;WAMG;;;;QAEH;;;;;;;WAOG;;;;QAEH;;;;WAIG;;;;MAEH;IAEF,QAAQ,EAAE,YAAY,EAAE,CAAM;IAC9B,YAAY,EAAE,WAAW,EAAE,CAAM;IACjC,YAAY,SAAmB;IAC/B,QAAQ,UAAS;IACjB,aAAa,UAAS;IACtB,QAAQ,UAAS;IACjB,YAAY,SAAM;IAClB,eAAe,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAAa;IAC3E;;;;;OAKG;IACH,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAa;IAQzC,OAAO,CAAC,SAAS,CAMf;IAEF;;;;;OAKG;IACH,OAAO,CAAC,gBAAgB,CAStB;IAEF,OAAO,CAAC,WAAW,CAMjB;IAEF;;;;;;;;OAQG;IACH,OAAO,CAAC,mBAAmB;IAiBlB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI;IAyBrD,OAAO,CAAC,mBAAmB,CAQzB;IAEF,OAAO,CAAC,uBAAuB,CAU7B;IAEF;;;;;;;;;OASG;IACH,OAAO,CAAC,sBAAsB,CAU5B;IAEO,MAAM;CA6bhB;AA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,MAAM,eAAe,GACvB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GACrB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;CAAE,CAAC;AAuS7D;;;;;;;;;;;;GAYG;AACH,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAStE;AAuTD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,iBAAiB,CAAC;KAC1C;CACF"}
@@ -0,0 +1,11 @@
1
+ import {
2
+ AdaptiveChatTrail,
3
+ looksLikeSerializedModelResponse
4
+ } from "./chunk-FW4XH5XF.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
+ }