@mgamadeus/ddd-agents 0.0.0-stage → 0.1.0-alpha.21

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 (315) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +14 -2
  3. package/dist/chat.js +5263 -0
  4. package/dist/chat.js.map +1 -0
  5. package/dist/chunks/AgentsConversationClientContext-C4T7g_Qk.js +22 -0
  6. package/dist/chunks/AgentsConversationClientContext-C4T7g_Qk.js.map +1 -0
  7. package/dist/chunks/ConversationMarkdown-W7NHglmL.js +399 -0
  8. package/dist/chunks/ConversationMarkdown-W7NHglmL.js.map +1 -0
  9. package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js +5059 -0
  10. package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js.map +1 -0
  11. package/dist/chunks/canvas-behaviours-BRFR1ALE.js +45 -0
  12. package/dist/chunks/canvas-behaviours-BRFR1ALE.js.map +1 -0
  13. package/dist/chunks/canvas-feature-flags-BmmxC3bz.js +11 -0
  14. package/dist/chunks/canvas-feature-flags-BmmxC3bz.js.map +1 -0
  15. package/dist/chunks/canvasBodies-9SuF6NAB.js +289 -0
  16. package/dist/chunks/canvasBodies-9SuF6NAB.js.map +1 -0
  17. package/dist/chunks/d3-7.6.1.min.js-DTmPafrl.js +6 -0
  18. package/dist/chunks/d3-7.6.1.min.js-DTmPafrl.js.map +1 -0
  19. package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js +20 -0
  20. package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js.map +1 -0
  21. package/dist/chunks/widget-image-readiness-signal-DeOuL89j.js +25 -0
  22. package/dist/chunks/widget-image-readiness-signal-DeOuL89j.js.map +1 -0
  23. package/dist/chunks/widget-name-resolver-DyIY6Zu4.js +9736 -0
  24. package/dist/chunks/widget-name-resolver-DyIY6Zu4.js.map +1 -0
  25. package/dist/chunks/withPollingChangeSubscription-BLDAWF-o.js +251 -0
  26. package/dist/chunks/withPollingChangeSubscription-BLDAWF-o.js.map +1 -0
  27. package/dist/client-testing.js +346 -0
  28. package/dist/client-testing.js.map +1 -0
  29. package/dist/client.js +16 -0
  30. package/dist/client.js.map +1 -0
  31. package/dist/contract.js +31 -0
  32. package/dist/contract.js.map +1 -0
  33. package/dist/image-render.js +334 -0
  34. package/dist/image-render.js.map +1 -0
  35. package/dist/index.js +80 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/kit.js +13 -0
  38. package/dist/kit.js.map +1 -0
  39. package/dist/preview.js +733 -0
  40. package/dist/preview.js.map +1 -0
  41. package/dist/renderer.js +115 -0
  42. package/dist/renderer.js.map +1 -0
  43. package/dist/styles.css +6768 -0
  44. package/dist/types/chat/AgentChat/AgentChat.d.ts +37 -0
  45. package/dist/types/chat/AgentChatActivityHistory/AgentChatActivityHistory.d.ts +6 -0
  46. package/dist/types/chat/AgentChatActivityIndicator/AgentChatActivityIndicator.d.ts +8 -0
  47. package/dist/types/chat/CanvasPane/CanvasPane.d.ts +15 -0
  48. package/dist/types/chat/CanvasResizeHandle/CanvasResizeHandle.d.ts +10 -0
  49. package/dist/types/chat/CanvasResizeHandle/use-canvas-resize.d.ts +43 -0
  50. package/dist/types/chat/ConversationClosedBar/ConversationClosedBar.d.ts +10 -0
  51. package/dist/types/chat/ConversationErrorCard/ConversationErrorCard.d.ts +13 -0
  52. package/dist/types/chat/ConversationIntroCard/ConversationIntroCard.d.ts +10 -0
  53. package/dist/types/chat/ConversationLoadingStates.d.ts +2 -0
  54. package/dist/types/chat/ConversationMessage/ConversationCallMarkerChip/ConversationCallMarkerChip.d.ts +14 -0
  55. package/dist/types/chat/ConversationMessage/ConversationCallMarkerChip/VoiceBarsIcon/VoiceBarsIcon.d.ts +8 -0
  56. package/dist/types/chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystem.d.ts +8 -0
  57. package/dist/types/chat/ConversationMessage/ConversationMessageSystem/ConversationMessageSystemHeader/ConversationMessageSystemHeader.d.ts +9 -0
  58. package/dist/types/chat/ConversationMessage/ConversationMessageUser/ConversationMessageUser.d.ts +7 -0
  59. package/dist/types/chat/ConversationMessage/ConversationMessageUser/ConversationMessageUserWidgets.d.ts +14 -0
  60. package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageHeader/ConversationMessageHeader.d.ts +7 -0
  61. package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageThinking/ConversationMessageThinking.d.ts +7 -0
  62. package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/ConversationMessageWidgets.d.ts +29 -0
  63. package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/copyRichToClipboard.d.ts +1 -0
  64. package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useFreshMessageBlockReveal.d.ts +14 -0
  65. package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useStreamingText.d.ts +8 -0
  66. package/dist/types/chat/ConversationMessage/ConversationMessageWidgets/hooks/useTypewriter.d.ts +12 -0
  67. package/dist/types/chat/ConversationMessage/ConversationTaskInstructionDisclosure/ConversationTaskInstructionDisclosure.d.ts +12 -0
  68. package/dist/types/chat/ConversationMessageInput/ConversationMessageInput.d.ts +111 -0
  69. package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentPreviewCard.d.ts +34 -0
  70. package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsErrorBox.d.ts +22 -0
  71. package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/ConversationMessageInputAttachmentsPreviewStrip.d.ts +12 -0
  72. package/dist/types/chat/ConversationMessageInput/ConversationMessageInputAttachments/convert-bytes-to-size-string.d.ts +2 -0
  73. package/dist/types/chat/ConversationMessageInput/ConversationMessageInputComposerWidgets/ConversationMessageInputComposerWidgets.d.ts +12 -0
  74. package/dist/types/chat/ConversationMessageList/ConversationMessageList.d.ts +75 -0
  75. package/dist/types/chat/ConversationScrollToLatestMessageButton/ConversationScrollToLatestMessageButton.d.ts +6 -0
  76. package/dist/types/chat/ConversationSuggestionCard/ConversationSuggestionCard.d.ts +7 -0
  77. package/dist/types/chat/ConversationView.d.ts +216 -0
  78. package/dist/types/chat/ConversationViewBody/ConversationViewBody.d.ts +214 -0
  79. package/dist/types/chat/ConversationViewBody/hooks/useIsMessagesBottomOutOfView.d.ts +2 -0
  80. package/dist/types/chat/ConversationViewBody/hooks/usePinQuestionOnSend.d.ts +24 -0
  81. package/dist/types/chat/assistant-message-has-renderable-markdown.d.ts +13 -0
  82. package/dist/types/chat/chat-assistant-identity.d.ts +24 -0
  83. package/dist/types/chat/chat-message.d.ts +11 -0
  84. package/dist/types/chat/controller/AgentChatController.d.ts +97 -0
  85. package/dist/types/chat/controller/activity-ticker.d.ts +120 -0
  86. package/dist/types/chat/controller/changed-messages-request.d.ts +12 -0
  87. package/dist/types/chat/controller/chat-scroll-target.d.ts +10 -0
  88. package/dist/types/chat/controller/conversation-change-signal-rules.d.ts +64 -0
  89. package/dist/types/chat/controller/derive-agent-activity.d.ts +31 -0
  90. package/dist/types/chat/controller/merge-activity-elements.d.ts +25 -0
  91. package/dist/types/chat/controller/pending-start-request.d.ts +38 -0
  92. package/dist/types/chat/controller/use-activity-ticker.d.ts +60 -0
  93. package/dist/types/chat/controller/use-conversation-activity.d.ts +38 -0
  94. package/dist/types/chat/controller/use-conversation-live-updates.d.ts +30 -0
  95. package/dist/types/chat/controller/use-conversation-message-pages.d.ts +24 -0
  96. package/dist/types/chat/controller/use-conversation-scroll-jump.d.ts +47 -0
  97. package/dist/types/chat/controller/use-conversation-search.d.ts +31 -0
  98. package/dist/types/chat/controller/use-conversation-signals.d.ts +44 -0
  99. package/dist/types/chat/controller/use-debounced-semantic-search.d.ts +15 -0
  100. package/dist/types/chat/conversation-send-message.d.ts +43 -0
  101. package/dist/types/chat/last-wire-message-is-unanswered-user-message.d.ts +22 -0
  102. package/dist/types/chat/normalize-server-message-to-markdown.d.ts +23 -0
  103. package/dist/types/chat/store/agents-chat-state.d.ts +132 -0
  104. package/dist/types/chat/store/conversation-error-type.d.ts +32 -0
  105. package/dist/types/chat/store/create-agents-chat-store.d.ts +23 -0
  106. package/dist/types/chat/store/index.d.ts +5 -0
  107. package/dist/types/chat/store/merge-chat-messages.d.ts +20 -0
  108. package/dist/types/chat/store/reduce-agents-chat-state.d.ts +7 -0
  109. package/dist/types/chat/store/use-agents-chat-store.d.ts +22 -0
  110. package/dist/types/chat/strip-pre-call-message-marker.d.ts +12 -0
  111. package/dist/types/chat/use-canvas-shell-transitions.d.ts +25 -0
  112. package/dist/types/client/AgentsConversationClient.d.ts +93 -0
  113. package/dist/types/client/AgentsConversationClientContext.d.ts +17 -0
  114. package/dist/types/client/polling/createPollingConversationChangeSubscription.d.ts +62 -0
  115. package/dist/types/client/polling/withPollingChangeSubscription.d.ts +11 -0
  116. package/dist/types/client/testing/createInMemoryAgentsConversationClient.d.ts +139 -0
  117. package/dist/types/contract/conversation.d.ts +370 -0
  118. package/dist/types/entries/chat.d.ts +21 -0
  119. package/dist/types/entries/client-testing.d.ts +1 -0
  120. package/dist/types/entries/client.d.ts +4 -0
  121. package/dist/types/entries/contract.d.ts +1 -0
  122. package/dist/types/entries/image-render.d.ts +9 -0
  123. package/dist/types/entries/index.d.ts +9 -0
  124. package/dist/types/entries/kit.d.ts +4 -0
  125. package/dist/types/entries/preview.d.ts +8 -0
  126. package/dist/types/entries/renderer.d.ts +15 -0
  127. package/dist/types/entries/widgets.d.ts +16 -0
  128. package/dist/types/image-render/ComposedViewEmailDataTimes/ComposedViewEmailDataTimes.d.ts +15 -0
  129. package/dist/types/image-render/WidgetImageRender.d.ts +55 -0
  130. package/dist/types/image-render/WidgetImageRenderContext.d.ts +14 -0
  131. package/dist/types/image-render/composed-view-data-times.d.ts +20 -0
  132. package/dist/types/image-render/frozen-widget-requests.d.ts +2 -0
  133. package/dist/types/image-render/live-widget-requests.d.ts +4 -0
  134. package/dist/types/image-render/widget-image-google-map.d.ts +7 -0
  135. package/dist/types/image-render/widget-image-readiness-signal.d.ts +16 -0
  136. package/dist/types/image-render/widget-image-readiness.d.ts +9 -0
  137. package/dist/types/image-render/widget-image-render.types.d.ts +47 -0
  138. package/dist/types/kit/ComposedViewConversationWidget.d.ts +14 -0
  139. package/dist/types/kit/ComposedViewDataSourceLoader.d.ts +20 -0
  140. package/dist/types/kit/ComposedViewRenderer.d.ts +30 -0
  141. package/dist/types/kit/ComposedViewSlotErrorBoundary.d.ts +23 -0
  142. package/dist/types/kit/ModelText/ModelText.d.ts +12 -0
  143. package/dist/types/kit/components/embedding/EmbeddedConversationWidget.d.ts +26 -0
  144. package/dist/types/kit/components/map/map-full-screen-instance.d.ts +26 -0
  145. package/dist/types/kit/components/map/map-presentation-context.d.ts +8 -0
  146. package/dist/types/kit/components/text/shared/text-node-values.d.ts +39 -0
  147. package/dist/types/kit/composed-view-component-types.d.ts +61 -0
  148. package/dist/types/kit/composed-view-components.d.ts +7 -0
  149. package/dist/types/kit/composed-view-tones.d.ts +20 -0
  150. package/dist/types/kit/entity-detail/EntityDetailCanvasBody.d.ts +9 -0
  151. package/dist/types/kit/entity-detail/entity-detail-bodies.d.ts +32 -0
  152. package/dist/types/kit/entity-detail/entity-detail-name.d.ts +9 -0
  153. package/dist/types/kit/hooks/use-debounced-value.d.ts +2 -0
  154. package/dist/types/kit/map-full-screen/MapFullScreenCanvasBody.d.ts +11 -0
  155. package/dist/types/preview/WidgetPreviewHost.d.ts +20 -0
  156. package/dist/types/preview/preview-stub-components.d.ts +3 -0
  157. package/dist/types/preview/widget-preview-fixtures.d.ts +17 -0
  158. package/dist/types/preview/widget-preview-hydration.d.ts +10 -0
  159. package/dist/types/preview/widget-preview-readiness.d.ts +27 -0
  160. package/dist/types/preview/widget-preview-requests.d.ts +16 -0
  161. package/dist/types/preview/widget-preview-signal.d.ts +10 -0
  162. package/dist/types/preview/widget-preview.types.d.ts +134 -0
  163. package/dist/types/provider/AgentsProvider.d.ts +33 -0
  164. package/dist/types/provider/class-names.d.ts +7 -0
  165. package/dist/types/provider/components/default-components.d.ts +3 -0
  166. package/dist/types/provider/components/icon-names.d.ts +9 -0
  167. package/dist/types/provider/components/index.d.ts +39 -0
  168. package/dist/types/provider/components/types.d.ts +463 -0
  169. package/dist/types/provider/environment.d.ts +262 -0
  170. package/dist/types/provider/index.d.ts +4 -0
  171. package/dist/types/renderer/ConversationDeepLinkedWidget.d.ts +18 -0
  172. package/dist/types/renderer/ConversationMarkdown.d.ts +21 -0
  173. package/dist/types/renderer/ConversationWidgetActions/ConversationWidgetActions.d.ts +7 -0
  174. package/dist/types/renderer/ConversationWidgetCallbacksContext.d.ts +234 -0
  175. package/dist/types/renderer/ConversationWidgetContext.d.ts +32 -0
  176. package/dist/types/renderer/ConversationWidgetErrorBoundary.d.ts +25 -0
  177. package/dist/types/renderer/ConversationWidgetHost.d.ts +36 -0
  178. package/dist/types/renderer/ConversationWidgetRenderContext.d.ts +3 -0
  179. package/dist/types/renderer/MarkdownLink.d.ts +6 -0
  180. package/dist/types/renderer/WindowedWidget/WindowedWidget.d.ts +16 -0
  181. package/dist/types/renderer/_access/ConversationWidgetFeatureGate.d.ts +21 -0
  182. package/dist/types/renderer/_agent-space/ConversationWidgetAgentSpaceFrame.d.ts +12 -0
  183. package/dist/types/renderer/_agent-space/ConversationWidgetAgentSpaceHeader.d.ts +15 -0
  184. package/dist/types/renderer/_agent-space/agent-space-name.hydrator.d.ts +7 -0
  185. package/dist/types/renderer/_agent-space/declared-agent-space-key-field-name.d.ts +8 -0
  186. package/dist/types/renderer/_agent-space/use-resolved-conversation-widget-agent-space-key.d.ts +16 -0
  187. package/dist/types/renderer/_agent-space/widget-agent-space-key-attribute.d.ts +13 -0
  188. package/dist/types/renderer/balanced-json-object.d.ts +12 -0
  189. package/dist/types/renderer/canvas/CanvasRestoreOnMount.d.ts +19 -0
  190. package/dist/types/renderer/canvas/canvas-behaviours.d.ts +84 -0
  191. package/dist/types/renderer/canvas/canvas-body-props.d.ts +18 -0
  192. package/dist/types/renderer/canvas/canvas-feature-flags.d.ts +11 -0
  193. package/dist/types/renderer/canvas/canvas-reducers.d.ts +46 -0
  194. package/dist/types/renderer/canvas/canvas-state.d.ts +107 -0
  195. package/dist/types/renderer/canvas/canvasBodies.d.ts +19 -0
  196. package/dist/types/renderer/canvas/canvasStorage.d.ts +25 -0
  197. package/dist/types/renderer/canvas/decide-canvas-open.d.ts +32 -0
  198. package/dist/types/renderer/canvas/entity-detail-instance.d.ts +27 -0
  199. package/dist/types/renderer/canvas/find-widget-fences-in-markdown.d.ts +32 -0
  200. package/dist/types/renderer/canvas/use-anchor-widget-payload.d.ts +8 -0
  201. package/dist/types/renderer/composer-widget-fence.d.ts +30 -0
  202. package/dist/types/renderer/conversation-composer-widget.d.ts +13 -0
  203. package/dist/types/renderer/conversation-widget-props.d.ts +54 -0
  204. package/dist/types/renderer/conversation-widget-state-partition.d.ts +31 -0
  205. package/dist/types/renderer/conversationWidgetAstPlugin.d.ts +11 -0
  206. package/dist/types/renderer/conversationWidgetRegistry.d.ts +74 -0
  207. package/dist/types/renderer/detect-unrendered-widgets.d.ts +42 -0
  208. package/dist/types/renderer/markdown-contains-widget.d.ts +13 -0
  209. package/dist/types/renderer/reference-naked-widget-json.d.ts +1 -0
  210. package/dist/types/renderer/remarkWidgetFencePlugin.d.ts +22 -0
  211. package/dist/types/renderer/render-report/widget-render-report-collector.d.ts +57 -0
  212. package/dist/types/renderer/render-report/widget-render-report.d.ts +29 -0
  213. package/dist/types/renderer/repair-malformed-widget-fences.d.ts +11 -0
  214. package/dist/types/renderer/resolve-deep-linkable-widget.d.ts +25 -0
  215. package/dist/types/renderer/restoreTextDirectivesPlugin.d.ts +12 -0
  216. package/dist/types/renderer/widget-click-signal-sources.d.ts +15 -0
  217. package/dist/types/renderer/widget-fence-json.d.ts +16 -0
  218. package/dist/types/renderer/widget-fence-syntax.d.ts +25 -0
  219. package/dist/types/renderer/widget-hydration/index.d.ts +8 -0
  220. package/dist/types/renderer/widget-hydration/section-hydration.d.ts +41 -0
  221. package/dist/types/renderer/widget-hydration/use-widget-hydration.d.ts +27 -0
  222. package/dist/types/renderer/widget-hydration/widget-hydration-state-store.d.ts +27 -0
  223. package/dist/types/renderer/widget-hydration/widget-hydration.reducer.d.ts +39 -0
  224. package/dist/types/renderer/widget-hydration/widget-hydration.registry.d.ts +7 -0
  225. package/dist/types/renderer/widget-hydration/widget-hydration.slice.d.ts +8 -0
  226. package/dist/types/renderer/widget-hydration/widget-hydration.types.d.ts +27 -0
  227. package/dist/types/renderer/widget-name-resolver.d.ts +22 -0
  228. package/dist/types/renderer/widget-tree/bounded-json.d.ts +23 -0
  229. package/dist/types/renderer/widget-tree/composed-node-schema.d.ts +143 -0
  230. package/dist/types/renderer/widget-tree/composed-view-data-sources.d.ts +41 -0
  231. package/dist/types/renderer/widget-tree/composed-view-tree.d.ts +111 -0
  232. package/dist/types/renderer/widget-tree/expression/evaluate-expression.d.ts +65 -0
  233. package/dist/types/renderer/widget-tree/expression/parse-expression.d.ts +71 -0
  234. package/dist/types/renderer/widget-tree/resolve-composed-view-values.d.ts +49 -0
  235. package/dist/types/renderer/widget-tree/use-composed-view-state.d.ts +16 -0
  236. package/dist/types/renderer/widget-windowing.d.ts +25 -0
  237. package/dist/types/widgets/CanvasWidgetCard/CanvasWidgetCard.d.ts +79 -0
  238. package/dist/types/widgets/CanvasWidgetCard/CanvasWidgetSwitch.d.ts +61 -0
  239. package/dist/types/widgets/CanvasWidgetCard/canvas-for-message-widget.d.ts +8 -0
  240. package/dist/types/widgets/CanvasWidgetCard/use-canvas-viable.d.ts +15 -0
  241. package/dist/types/widgets/ClockConversationWidget/ClockConversationWidget.d.ts +11 -0
  242. package/dist/types/widgets/ClockConversationWidget/ClockWidget/AnalogClockFace.d.ts +12 -0
  243. package/dist/types/widgets/ClockConversationWidget/ClockWidget/ClockRow.d.ts +23 -0
  244. package/dist/types/widgets/ClockConversationWidget/ClockWidget/ClockWidget.d.ts +21 -0
  245. package/dist/types/widgets/ClockConversationWidget/ClockWidget/DayNightGlyph.d.ts +8 -0
  246. package/dist/types/widgets/ClockConversationWidget/shared/clock-time.d.ts +52 -0
  247. package/dist/types/widgets/ClockConversationWidget/shared/clock-widget-payload.d.ts +23 -0
  248. package/dist/types/widgets/ClockConversationWidget/shared/use-clock-settings.d.ts +18 -0
  249. package/dist/types/widgets/ConceptExplainerConversationWidget/ConceptExplainerConversationWidget.d.ts +14 -0
  250. package/dist/types/widgets/ConceptExplainerConversationWidget/ConceptExplainerWidget/ConceptExplainerWidget.d.ts +27 -0
  251. package/dist/types/widgets/ConceptExplainerConversationWidget/shared/ConceptExplainerTextView.d.ts +11 -0
  252. package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-type.d.ts +89 -0
  253. package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-types.d.ts +17 -0
  254. package/dist/types/widgets/ConceptExplainerConversationWidget/shared/concept-explainer-widget-payload.d.ts +25 -0
  255. package/dist/types/widgets/ConceptExplainerConversationWidget/shared/use-concept-explainer-language.d.ts +8 -0
  256. package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsCanvas.d.ts +9 -0
  257. package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsCanvasBody.d.ts +7 -0
  258. package/dist/types/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsConversationWidget.d.ts +15 -0
  259. package/dist/types/widgets/ConversationSearchResultsConversationWidget/shared/conversation-search-results-widget-payload.d.ts +42 -0
  260. package/dist/types/widgets/ConversationSearchResultsConversationWidget/shared/search-hit-excerpt.d.ts +1 -0
  261. package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterConversationWidget.d.ts +8 -0
  262. package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterWidget/CurrencyConverterWidget.d.ts +17 -0
  263. package/dist/types/widgets/CurrencyConverterConversationWidget/CurrencyConverterWidget/CurrencyLabel/CurrencyLabel.d.ts +9 -0
  264. package/dist/types/widgets/CurrencyConverterConversationWidget/shared/currency-converter-widget-payload.d.ts +22 -0
  265. package/dist/types/widgets/CurrencyConverterConversationWidget/shared/currency-display.d.ts +30 -0
  266. package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationConversationWidget.d.ts +11 -0
  267. package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationWidget/CustomVisualizationFrame.d.ts +14 -0
  268. package/dist/types/widgets/CustomVisualizationConversationWidget/CustomVisualizationWidget/CustomVisualizationWidget.d.ts +15 -0
  269. package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-frame-protocol.d.ts +77 -0
  270. package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-libraries.d.ts +25 -0
  271. package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-sandbox-config.d.ts +21 -0
  272. package/dist/types/widgets/CustomVisualizationConversationWidget/shared/custom-visualization-widget-payload.d.ts +55 -0
  273. package/dist/types/widgets/CustomVisualizationConversationWidget/shared/read-custom-visualization-theme.d.ts +5 -0
  274. package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionAskButton/EntityMentionAskButton.d.ts +13 -0
  275. package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionCard/EntityMentionCard.d.ts +11 -0
  276. package/dist/types/widgets/EntityMentionConversationWidget/EntityMentionConversationWidget.d.ts +9 -0
  277. package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention-presentation.d.ts +4 -0
  278. package/dist/types/widgets/EntityMentionConversationWidget/shared/entity-mention.d.ts +33 -0
  279. package/dist/types/widgets/EntityMentionConversationWidget/shared/use-entity-mention-composer.d.ts +17 -0
  280. package/dist/types/widgets/MultiChoiceConversationWidget/MultiChoiceConversationWidget.d.ts +2 -0
  281. package/dist/types/widgets/MultiChoiceConversationWidget/shared/multi-choice-widget-payload.d.ts +16 -0
  282. package/dist/types/widgets/QuickRepliesConversationWidget/QuickRepliesConversationWidget.d.ts +38 -0
  283. package/dist/types/widgets/QuickRepliesConversationWidget/shared/quick-replies-widget-payload.d.ts +20 -0
  284. package/dist/types/widgets/SuggestedActions/SuggestedActions.d.ts +10 -0
  285. package/dist/types/widgets/ToolTraceConversationWidget/ToolTraceConversationWidget.d.ts +8 -0
  286. package/dist/types/widgets/WebSearchResultsConversationWidget/SourceFavicon.d.ts +10 -0
  287. package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchAnswer.d.ts +6 -0
  288. package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchReferences.d.ts +12 -0
  289. package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsCanvas.d.ts +10 -0
  290. package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsCanvasBody.d.ts +7 -0
  291. package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchResultsConversationWidget.d.ts +14 -0
  292. package/dist/types/widgets/WebSearchResultsConversationWidget/WebSearchSourcesList.d.ts +10 -0
  293. package/dist/types/widgets/WebSearchResultsConversationWidget/shared/display-hostname.d.ts +9 -0
  294. package/dist/types/widgets/WebSearchResultsConversationWidget/shared/web-search-results-widget-payload.d.ts +30 -0
  295. package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftConversationWidget.d.ts +14 -0
  296. package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftWidget/WritingDraftBody.d.ts +9 -0
  297. package/dist/types/widgets/WritingDraftConversationWidget/WritingDraftWidget/WritingDraftWidget.d.ts +44 -0
  298. package/dist/types/widgets/WritingDraftConversationWidget/shared/draft-mail-link.d.ts +17 -0
  299. package/dist/types/widgets/WritingDraftConversationWidget/shared/draft-plain-text.d.ts +7 -0
  300. package/dist/types/widgets/WritingDraftConversationWidget/shared/remark-draft-line-breaks.d.ts +13 -0
  301. package/dist/types/widgets/WritingDraftConversationWidget/shared/writing-draft-widget-payload.d.ts +23 -0
  302. package/dist/types/widgets/_shared/ConversationWidgetButton.d.ts +4 -0
  303. package/dist/types/widgets/_shared/DonePill.d.ts +14 -0
  304. package/dist/types/widgets/_shared/modern/WidgetKpiValue.d.ts +24 -0
  305. package/dist/types/widgets/_shared/modern/WidgetListRow.d.ts +14 -0
  306. package/dist/types/widgets/_shared/modern/WidgetStatusChip.d.ts +8 -0
  307. package/dist/types/widgets/_shared/modern/WidgetSurface.d.ts +13 -0
  308. package/dist/types/widgets/_shared/modern/WidgetSurfaceSkeleton.d.ts +11 -0
  309. package/dist/types/widgets/_shared/modern/index.d.ts +16 -0
  310. package/dist/types/widgets/_shared/skeleton-primitives.d.ts +20 -0
  311. package/dist/types/widgets/_shared/use-stack-when-wrapped.d.ts +6 -0
  312. package/dist/types/widgets/_shared/widget-payload-validation.d.ts +22 -0
  313. package/dist/widgets.js +84 -0
  314. package/dist/widgets.js.map +1 -0
  315. package/package.json +147 -3
@@ -0,0 +1,43 @@
1
+ import type { ConversationAttachmentReference } from "../contract/conversation";
2
+ import { ConversationComposerWidget } from "../renderer/conversation-composer-widget";
3
+ /**
4
+ * Everything a chat send carries alongside the plain message text. The object is always passed
5
+ * (a bare `{}` when there is nothing extra) so callers stop juggling a growing tail of positional
6
+ * optional arguments — every extra becomes a named, individually-optional field here instead.
7
+ */
8
+ export type SendMessageOptions = {
9
+ /**
10
+ * Invisible START context: a model-visible, user-invisible SIGNAL prepended before the
11
+ * (possibly empty) user message when a dashboard-widget CTA starts the conversation, so the agent's
12
+ * first turn already has it. Empty/omitted for a normal typed message.
13
+ */
14
+ startSignalText?: string;
15
+ /**
16
+ * Uploaded media-library images that ride along with this message. ConversationMessageInput never builds these —
17
+ * it forwards the host-provided `outgoingAttachmentImages`.
18
+ */
19
+ attachments?: ConversationAttachmentReference[];
20
+ /**
21
+ * Composer widgets sent alongside this message — informational for hosts (the message TEXT is already the
22
+ * record: `onSendMessage` receives it with each widget's ```widget fence appended, see
23
+ * `buildMessageTextWithComposerWidgets`). ConversationMessageInput never builds these — it forwards the
24
+ * host-provided `outgoingComposerWidgets`.
25
+ */
26
+ composerWidgets?: ConversationComposerWidget[];
27
+ /**
28
+ * The stable key of the product entry point a NEW conversation is started from (e.g. `hub.starter.R2`): the start
29
+ * reopens the recent conversation of that entry point instead of starting an identical one. Ignored when the
30
+ * message goes into an existing conversation.
31
+ */
32
+ entryPointKey?: string;
33
+ };
34
+ /**
35
+ * Signature shared by every chat "send" callback across the Conversation components (ConversationMessageInput →
36
+ * ConversationViewBody → ConversationView) and their hosts (AgentChat, Conversation, …). The message text stays a
37
+ * required positional argument; everything else lives in the mandatory `options` object.
38
+ *
39
+ * May return `true`/`false` when the host can tell whether the send was actually accepted (dispatched/posted) or
40
+ * dropped by a caller-side guard (a closed conversation, an in-flight start) — see AgentChat's `handleSendMessage`,
41
+ * whose result feeds `ConversationWidgetCallbacks.sendMessageToChat`. `void` (most callers) reports nothing.
42
+ */
43
+ export type SendMessageHandler = (message: string, options: SendMessageOptions) => void | boolean;
@@ -0,0 +1,22 @@
1
+ import type { ChatMessage } from "./chat-message";
2
+ /** The phone call's started / ended markers — the call marker chip, structural context, never owed work. */
3
+ export declare const PHONE_CALL_LIFECYCLE_SIGNAL_SOURCES: readonly string[];
4
+ /**
5
+ * The SIGNAL rows that owe no work — the backend's `owesWork() === false` on a SIGNAL row, pinned by
6
+ * `signal-source-parity.json` (`_signal-source-parity.spec.ts`).
7
+ */
8
+ export declare const SIGNAL_SOURCES_THAT_OWE_NO_WORK: readonly string[];
9
+ /**
10
+ * Whether the newest WIRE message is the customer's own, still unanswered — the backend's `hasUnansweredInboundMessage`
11
+ * seen from the frontend, walked the same way: ERROR / CHECKPOINT rows are bookkeeping (never rendered, never an
12
+ * answer); a TOOL_MESSAGE (a tool's own widget to the customer, stored role ASSISTANT) is NOT the agent's answer — a
13
+ * customer question followed only by a tool's status widget stays owed; the phone-call lifecycle chips are structural
14
+ * context, never owed work, and so is the platform's notice that it wrote a widget on its own; any other trailing SIGNAL (a widget click, a memory-conflict clarify) IS owed work, exactly
15
+ * like a user message. Only then does a failed run have something to RETRY — the persisted
16
+ * message is re-driven server-side instead of asking the customer to send it again. A walk that diverges from the
17
+ * backend's shows the error card without the button while the backend would accept the retry — keep the two in step.
18
+ *
19
+ * The slice keeps `messages` ordered by `indexInConversation`; the sort here is belt-and-suspenders for a caller that
20
+ * hands in an unordered page, not a fix for an upstream ordering defect.
21
+ */
22
+ export declare const lastWireMessageIsUnansweredUserMessage: (messages: ChatMessage[] | null) => boolean;
@@ -0,0 +1,23 @@
1
+ type ServerTextPart = {
2
+ type: "text";
3
+ text?: string;
4
+ };
5
+ type ServerComponentPart = {
6
+ type: "component";
7
+ name?: string;
8
+ props?: Record<string, unknown>;
9
+ };
10
+ type ServerToolUsePart = {
11
+ type: "tool_use";
12
+ name?: string;
13
+ input?: unknown;
14
+ };
15
+ type ServerMessagePart = ServerTextPart | ServerComponentPart | ServerToolUsePart;
16
+ export type AssistantServerMessagePayload = {
17
+ role?: string;
18
+ content?: ServerMessagePart[];
19
+ parts?: ServerMessagePart[];
20
+ messageId?: string;
21
+ };
22
+ export declare const normalizeServerMessageToMarkdown: (message: unknown) => string;
23
+ export {};
@@ -0,0 +1,132 @@
1
+ import type { AgentsClientError, AgentsConversation, AgentsConversationMessage, PostedMessage, StartedConversation } from "../../contract/conversation";
2
+ import type { ChatMessage } from "../chat-message";
3
+ import type { CanvasCreatedEntity, CanvasSliceState } from "../../renderer/canvas/canvas-reducers";
4
+ import type { CanvasOpenRequest } from "../../renderer/canvas/canvas-state";
5
+ import type { ConversationErrorType } from "./conversation-error-type";
6
+ /**
7
+ * How an entry point outside the chat hands a job over to the chat that opens next (one generic opening
8
+ * request): the first visible message, or an invisible start signal so the agent speaks first, the entry point the
9
+ * start comes from, and a widget to mount without a message (a page handing over a tool). Set before the chat mounts,
10
+ * so a reset keeps it; the chat clears each part once it consumed it.
11
+ */
12
+ export interface AgentsChatOpeningRequest {
13
+ /** The first visible owner message of the next started conversation. */
14
+ userMessage: string | null;
15
+ /** The invisible start signal of the next started conversation (an empty visible message carries it). */
16
+ startSignalText: string | null;
17
+ /** The entry point the start comes from; the server reopens that entry point's recent conversation instead. */
18
+ entryPointKey: string | null;
19
+ /** The canonical wire name of a deep-linkable widget the chat mounts once, without a message. */
20
+ deepLinkedWidgetName: string | null;
21
+ }
22
+ /** The state of one chat instance. */
23
+ export interface AgentsChatState extends CanvasSliceState {
24
+ /** The conversation shown; null for a cold chat until a start or the metadata read brings it. */
25
+ conversation: AgentsConversation | null;
26
+ /** Null until the first page or a send; ordered by `indexInConversation`, the optimistic message last. */
27
+ messages: ChatMessage[] | null;
28
+ /** A send is on its way. */
29
+ conversationLoading: boolean;
30
+ /** The last read or send for this conversation came back. */
31
+ conversationLoaded: boolean;
32
+ /** An older page exists: the scroll-up load stays armed. */
33
+ hasMoreOlder: boolean;
34
+ /** The agent works on a turn (the controller mirrors the derived activity here; read by the launcher). */
35
+ aiThinking: boolean;
36
+ error: ConversationErrorType | null;
37
+ /** Seconds until the quota frees up again; set only while `error` is RATE_LIMIT. */
38
+ rateLimitRetryAfterSeconds: number | null;
39
+ /**
40
+ * The conversation the newest metadata or page read asked for; null after a reset. A late answer for another
41
+ * conversation — or one that lands after a reset — is dropped.
42
+ */
43
+ requestedConversationId: number | null;
44
+ /** A start is on its way; no second start is sent meanwhile. */
45
+ startingNewConversation: boolean;
46
+ /** The token of the start on its way; its answer applies only while it is still the pending one. */
47
+ pendingStartToken: number | null;
48
+ /**
49
+ * How many starts this chat instance sent — the source of `pendingStartToken`. Survives a reset (like
50
+ * `canvasMountCount`): the store outlives a remount of the chat, so a token is never reused for another start.
51
+ */
52
+ startTokenCount: number;
53
+ openingRequest: AgentsChatOpeningRequest;
54
+ }
55
+ export declare const EMPTY_AGENTS_CHAT_OPENING_REQUEST: AgentsChatOpeningRequest;
56
+ export declare const INITIAL_AGENTS_CHAT_STATE: AgentsChatState;
57
+ /**
58
+ * What happens to a chat instance. The read and send events carry the port's answers (`AgentsConversationClient`);
59
+ * the controller dispatches the `…Requested` event before it calls the port and the `…Received` / `…Failed` event
60
+ * with the answer.
61
+ */
62
+ export type AgentsChatEvent =
63
+ /** A conversation switch, an empty chat, the chat's unmount: everything goes except the opening request and the two counters. */
64
+ {
65
+ type: "reset";
66
+ } | {
67
+ type: "conversationMetadataRequested";
68
+ conversationId: number;
69
+ } | {
70
+ type: "conversationMetadataReceived";
71
+ conversationId: number;
72
+ conversation: AgentsConversation;
73
+ } | {
74
+ type: "conversationMetadataFailed";
75
+ conversationId: number;
76
+ } | {
77
+ type: "messagesPageRequested";
78
+ conversationId: number;
79
+ }
80
+ /** `hasMoreOlder` null: a changed-messages read, which says nothing about older pages. */
81
+ | {
82
+ type: "messagesPageReceived";
83
+ conversationId: number;
84
+ messages: AgentsConversationMessage[];
85
+ hasMoreOlder: boolean | null;
86
+ } | {
87
+ type: "messagePostRequested";
88
+ message: ChatMessage;
89
+ } | {
90
+ type: "messagePostReceived";
91
+ conversationId: number;
92
+ posted: PostedMessage;
93
+ } | {
94
+ type: "messagePostFailed";
95
+ error: AgentsClientError;
96
+ }
97
+ /** Takes the next start token (`pendingStartToken`); the controller reads it after the dispatch. */
98
+ | {
99
+ type: "startRequested";
100
+ message: ChatMessage;
101
+ } | {
102
+ type: "startReceived";
103
+ startToken: number;
104
+ started: StartedConversation;
105
+ } | {
106
+ type: "startFailed";
107
+ error: AgentsClientError;
108
+ } | {
109
+ type: "errorSet";
110
+ error: ConversationErrorType | null;
111
+ } | {
112
+ type: "aiThinkingSet";
113
+ aiThinking: boolean;
114
+ }
115
+ /** Sets the named parts of the opening request; the others stay. */
116
+ | {
117
+ type: "openingRequestSet";
118
+ openingRequest: Partial<AgentsChatOpeningRequest>;
119
+ } | {
120
+ type: "canvasOpened";
121
+ request: CanvasOpenRequest;
122
+ } | {
123
+ type: "canvasClosed";
124
+ byCustomer: boolean;
125
+ } | {
126
+ type: "canvasResetForNewTurn";
127
+ } | {
128
+ type: "canvasCleared";
129
+ } | {
130
+ type: "canvasCreatedEntityIdSet";
131
+ created: CanvasCreatedEntity;
132
+ };
@@ -0,0 +1,32 @@
1
+ import type { AgentsClientError } from "../../contract/conversation";
2
+ /**
3
+ * The error card the chat shows. A plain object with string values (not a TypeScript `enum`), so the chat store, the
4
+ * view and an app's older chat state share one vocabulary without a nominal type in between.
5
+ */
6
+ export declare const ConversationErrorType: {
7
+ readonly AI_BUDGET: "AI_BUDGET";
8
+ /**
9
+ * HTTP 429 from an AI endpoint — a per-minute/hour/day usage quota was hit. Distinct from AI_BUDGET (monthly budget):
10
+ * this one clears on its own after the Retry-After window.
11
+ */
12
+ readonly RATE_LIMIT: "RATE_LIMIT";
13
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
14
+ readonly CONVERSATION_NOT_FOUND: "CONVERSATION_NOT_FOUND";
15
+ /**
16
+ * The backend run FAILED (e.g. the model provider returned an error). The raw provider error is admin-only (never
17
+ * shown here); the owner gets a generic "something went wrong" card.
18
+ */
19
+ readonly AGENT_ERROR: "AGENT_ERROR";
20
+ /**
21
+ * The conversation is COMPLETED/CANCELLED and refuses further owner input. Set from the server's stable error code
22
+ * `CONVERSATION_CLOSED` or by the chat's own pre-send guard; the error card owns the copy.
23
+ */
24
+ readonly CONVERSATION_CLOSED: "CONVERSATION_CLOSED";
25
+ };
26
+ export type ConversationErrorType = (typeof ConversationErrorType)[keyof typeof ConversationErrorType];
27
+ /**
28
+ * The error card of a refused send (post or start), read from the port's error. Only the stable outcomes select a
29
+ * dedicated card; every other refusal is a generic network error — the same classification the older chat applies to
30
+ * the server's error codes (`AI_BUDGET_REACHED`, `RATE_LIMIT_EXCEEDED`, `CONVERSATION_CLOSED`).
31
+ */
32
+ export declare const readConversationErrorTypeOfRefusedSend: (error: AgentsClientError) => ConversationErrorType;
@@ -0,0 +1,23 @@
1
+ import { type AgentsChatEvent, type AgentsChatState } from "./agents-chat-state";
2
+ /**
3
+ * The state handle of one chat instance. The app creates one per chat (host application: one per agent
4
+ * window, created before the window's chat mounts) and releases it with the chat; the chat and the app's code outside
5
+ * the chat read and dispatch through the same handle. React reads it through `useAgentsChatSelector`.
6
+ */
7
+ export interface AgentsChatStore {
8
+ getState: () => AgentsChatState;
9
+ /** Calls the listener after every state change; returns the unsubscribe. */
10
+ subscribe: (listener: () => void) => () => void;
11
+ dispatch: (event: AgentsChatEvent) => void;
12
+ }
13
+ /** The plain implementation of `AgentsChatStore`: one state object, replaced by the reducer on every event. */
14
+ export declare class AgentsChatStateContainer implements AgentsChatStore {
15
+ protected state: AgentsChatState;
16
+ protected readonly listeners: Set<() => void>;
17
+ constructor(initialState?: AgentsChatState);
18
+ getState: () => AgentsChatState;
19
+ subscribe: (listener: () => void) => (() => void);
20
+ dispatch: (event: AgentsChatEvent) => void;
21
+ }
22
+ /** Creates the state handle of one chat instance. */
23
+ export declare const createAgentsChatStore: (initialState?: AgentsChatState) => AgentsChatStore;
@@ -0,0 +1,5 @@
1
+ export { type AgentsChatEvent, type AgentsChatOpeningRequest, type AgentsChatState, EMPTY_AGENTS_CHAT_OPENING_REQUEST, INITIAL_AGENTS_CHAT_STATE, } from "./agents-chat-state";
2
+ export { type AgentsChatStore, AgentsChatStateContainer, createAgentsChatStore } from "./create-agents-chat-store";
3
+ export { reduceAgentsChatState } from "./reduce-agents-chat-state";
4
+ export { ConversationErrorType, readConversationErrorTypeOfRefusedSend } from "./conversation-error-type";
5
+ export { AgentsChatStoreProvider, useAgentsChatSelector, useAgentsChatState, useAgentsChatStore, useOptionalAgentsChatStore, } from "./use-agents-chat-store";
@@ -0,0 +1,20 @@
1
+ import type { ChatMessage } from "../chat-message";
2
+ /**
3
+ * Merges two message lists by `indexInConversation`, preferring `incoming` on a collision, sorted ascending by index.
4
+ * Messages without an index (the optimistic owner message) cannot be matched, so they follow the indexed ones in order.
5
+ * A start or post answer carries the whole list and a live read brings it again: concatenating would show every
6
+ * message twice.
7
+ */
8
+ export declare const mergeChatMessagesByIndex: (existing: ChatMessage[], incoming: ChatMessage[]) => ChatMessage[];
9
+ /**
10
+ * Tags the messages of a send's answer: `fresh` when the id was not in the list before — the server just delivered it,
11
+ * so its one-shot widgets may fire; a replayed message never fires them again.
12
+ */
13
+ export declare const tagFreshChatMessages: (incoming: ChatMessage[], previousMessages: ChatMessage[]) => ChatMessage[];
14
+ /**
15
+ * Merges a page of a keyset read (the newest page, an older page, the changed tail) into the loaded messages by index.
16
+ * A message is `fresh` only when it is a live arrival: never shown before and newer than everything loaded — so the
17
+ * streamed reply opens its canvas while a scroll-up page and the first page on open stay history. A message already
18
+ * shown keeps its tag. A page of another conversation than the one shown replaces the list.
19
+ */
20
+ export declare const mergeMessagesPage: (loadedMessages: ChatMessage[] | null, page: ChatMessage[], requestedConversationId: number) => ChatMessage[];
@@ -0,0 +1,7 @@
1
+ import { type AgentsChatEvent, type AgentsChatState } from "./agents-chat-state";
2
+ /**
3
+ * The chat store's reducer: plain functions over the contract types. Each case is the one of the older
4
+ * chat state (a Redux slice and its cases) it replaces, reading the port's answers instead of the
5
+ * generated client's actions; the replay spec feeds both the same recorded sequence.
6
+ */
7
+ export declare const reduceAgentsChatState: (state: AgentsChatState, event: AgentsChatEvent) => AgentsChatState;
@@ -0,0 +1,22 @@
1
+ import { type ReactNode } from "react";
2
+ import type { AgentsChatState } from "./agents-chat-state";
3
+ import type { AgentsChatStore } from "./create-agents-chat-store";
4
+ export interface AgentsChatStoreProviderProps {
5
+ /** The state handle of the chat below (the app creates and releases it). */
6
+ chatStore: AgentsChatStore;
7
+ children?: ReactNode;
8
+ }
9
+ /** Puts one chat instance's state handle in reach of the chat and of the app's components inside it. */
10
+ export declare const AgentsChatStoreProvider: (props: AgentsChatStoreProviderProps) => import("react/jsx-runtime").JSX.Element;
11
+ /** The state handle of the chat this component renders in; throws outside `AgentsChatStoreProvider`. */
12
+ export declare const useAgentsChatStore: () => AgentsChatStore;
13
+ /** The state handle of the chat this component renders in, or null outside a chat. */
14
+ export declare const useOptionalAgentsChatStore: () => AgentsChatStore | null;
15
+ /**
16
+ * Reads one value of a chat instance's state and re-renders when it changes. The selector must return a value that
17
+ * keeps its identity while the state does not change (a state field, not a new object). Without a store it returns
18
+ * `valueWithoutStore`.
19
+ */
20
+ export declare const useAgentsChatSelector: <Selected>(chatStore: AgentsChatStore | null | undefined, selector: (state: AgentsChatState) => Selected, valueWithoutStore?: Selected) => Selected;
21
+ /** Reads one value of the state of the chat this component renders in. */
22
+ export declare const useAgentsChatState: <Selected>(selector: (state: AgentsChatState) => Selected) => Selected;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Mirrors `AIConversationMessage::PRE_CALL_MESSAGE_MARKER` (PHP). The model prefixes a short "I'm about to do X"
3
+ * status line with this sentinel; the BACKEND only detects/signals on it and stores it RAW (it never strips). Every
4
+ * render layer — this is the customer chat one — strips it before showing the text to the user.
5
+ */
6
+ export declare const PRE_CALL_MESSAGE_MARKER = "{preCallMessage}";
7
+ /**
8
+ * Remove the {preCallMessage} sentinel from assistant text before display, and normalize the mangled JSON form to
9
+ * its inner status line. Also holds back a leading PARTIAL of either shape while it is still streaming in (so the
10
+ * user never sees a "{preCa…" or `{ "preCallMessage": "Einen Mo` flash before the full form arrives).
11
+ */
12
+ export declare const stripPreCallMessageMarker: (text: string) => string;
@@ -0,0 +1,25 @@
1
+ export interface CanvasShellTransitionsInput {
2
+ /** The conversation the view shows; undefined for a cold chat that has none yet. */
3
+ conversationId?: number;
4
+ /** The viewport is wide enough for the side split (`useCanvasViable`). */
5
+ canvasViable: boolean;
6
+ }
7
+ /**
8
+ * The two SHELL-driven transitions of the canvas model that `ConversationView` owns (the widget-driven ones go through
9
+ * `openCanvas`; the send boundary is the hosts'):
10
+ *
11
+ * - **A conversation switch** (history select / new chat) makes the previous conversation's canvas stale — it is
12
+ * cleared so the new conversation starts with a closed canvas. History replay never auto-opens a canvas (the
13
+ * opening rule rejects replay), and the LEFT conversation keeps its stored pointer for when the customer comes
14
+ * back. Only a REAL switch between two conversations counts. Not the first mount: a canvas the host opened on open
15
+ * (the `?agentWidget=` deep-link, a restored canvas) mounts its widget BEFORE this parent effect runs, and an
16
+ * unconditional reset would tear it down before the customer ever sees it. And not the id ARRIVING on a chat that
17
+ * had none: that is the same conversation, just persisted now (the first send creates it) — closing the customer's
18
+ * pinned work surface at that moment would be wrong.
19
+ * - **The wide → narrow crossing** closes the side-split canvas as a shell close (re-openable, no customer veto).
20
+ * Keyed on `canvasViable` ONLY (the canvas read through a ref) so it fires on the crossing, NOT when the mobile CTA
21
+ * opens a canvas on an already narrow viewport. Skipped for a canvas whose behaviour says `narrowViewport:
22
+ * "overlay"`: its widget renders nothing inline, so closing it on the crossing would leave the chat with no content
23
+ * at all — it stays open as the full-screen overlay.
24
+ */
25
+ export declare const useCanvasShellTransitions: ({ conversationId, canvasViable }: CanvasShellTransitionsInput) => void;
@@ -0,0 +1,93 @@
1
+ import type { AgentsConversation, ChangedConversationMessages, ChangedMessagesRequest, ConversationActivity, ConversationAttachmentReference, ConversationChangeSignal, ConversationListQueryOptions, ConversationMessageSearchHit, ConversationMessageSentPayload, ConversationMessagesPage, ConversationSearchGroup, ConversationSearchOptions, ConversationSignal, ConversationSubscriptionEndReason, PostedMessage, SelectableModel, StartedConversation } from "../contract/conversation";
2
+ /**
3
+ * The conversation client port (one function per row of the table, derived from the chat
4
+ * controller's requests). The package calls only this; an app binds it over its own request layer; the package
5
+ * ships an in-memory binding for specs, stories and the reference app (`client/testing/`).
6
+ *
7
+ * Rules every binding keeps:
8
+ * - ids are numbers; the agent space key is passed where the endpoint needs it;
9
+ * - every function rejects with `AgentsClientError` (`contract/conversation.ts`), never with a transport error;
10
+ * - a send returns once the server stored it — the agent's reply arrives through `subscribeToConversationChanges`;
11
+ * - the package adds the optimistic owner message before it calls a send and pairs request and answer itself;
12
+ * - a purposed start is not part of the port (it stays an app call).
13
+ */
14
+ export interface AgentsConversationClient {
15
+ /** The conversation without messages: title, run state, the owed-turn mark, purpose, initiator. */
16
+ getConversationMetadata: (conversationId: number) => Promise<AgentsConversation>;
17
+ /** The newest page, each message with its delegated children's `{ id, runState }`. */
18
+ getNewestMessagesPage: (conversationId: number, pageSize: number) => Promise<ConversationMessagesPage>;
19
+ /** The page before `beforeIndex` (scroll-up). */
20
+ getOlderMessagesPage: (conversationId: number, beforeIndex: number, pageSize: number) => Promise<ConversationMessagesPage>;
21
+ /** New rows and rows that can still change (a live update); the package computes the request and keeps `hasMoreOlder`. */
22
+ getChangedMessages: (conversationId: number, request: ChangedMessagesRequest) => Promise<ChangedConversationMessages>;
23
+ /**
24
+ * Start a conversation with its first message. `text` may be empty only together with `startSignalText` (the agent
25
+ * speaks first); `entryPointKey` reopens the recent conversation of that entry point instead of starting an
26
+ * identical one; `model` is a name from `getSelectableModels`.
27
+ */
28
+ startConversation: (request: {
29
+ agentSpaceKey: number;
30
+ text: string;
31
+ startSignalText?: string;
32
+ entryPointKey?: string;
33
+ model?: string;
34
+ attachments?: ConversationAttachmentReference[];
35
+ }) => Promise<StartedConversation>;
36
+ /** Post the owner's message. Allowed while a turn runs: the server answers it in the next turn. */
37
+ postMessage: (conversationId: number, message: {
38
+ text: string;
39
+ model?: string;
40
+ attachments?: ConversationAttachmentReference[];
41
+ }) => Promise<PostedMessage>;
42
+ /** Inject a model-visible, owner-invisible signal (a widget click) and let the agent take a turn on it. */
43
+ injectSignal: (conversationId: number, signal: ConversationSignal) => Promise<void>;
44
+ /** Re-drive the failed run on the stored, still unanswered owner message. */
45
+ retryConversation: (conversationId: number) => Promise<void>;
46
+ /** Set the title by hand; returns the conversation with the stored title. */
47
+ renameConversation: (conversationId: number, title: string) => Promise<AgentsConversation>;
48
+ deleteConversation: (conversationId: number) => Promise<void>;
49
+ /** The root conversations of an agent space, newest first. */
50
+ listConversations: (agentSpaceKey: number, options?: ConversationListQueryOptions) => Promise<AgentsConversation[]>;
51
+ /** Search across the account's conversations, grouped by conversation. */
52
+ searchConversations: (text: string, options?: ConversationSearchOptions) => Promise<ConversationSearchGroup[]>;
53
+ /** Search inside one conversation. */
54
+ searchConversationMessages: (conversationId: number, text: string, options?: ConversationSearchOptions) => Promise<ConversationMessageSearchHit[]>;
55
+ /** What the agent does in the current turn; `turnMessageId` pins the narrated turn once known. */
56
+ getConversationActivity: (conversationId: number, turnMessageId?: number | null) => Promise<ConversationActivity>;
57
+ /** The models the owner may pick. Optional: without it the chat shows no model picker. */
58
+ getSelectableModels?: () => Promise<SelectableModel[]>;
59
+ /**
60
+ * The text the server stores for a message with attachments — the package shows the optimistic owner message with
61
+ * it, so the bubble does not change when the stored message arrives. Optional: without it the text stays as typed
62
+ * (a binding that sends attachments in a field of their own).
63
+ */
64
+ composeSentMessageText?: (text: string, attachments: ConversationAttachmentReference[] | undefined) => string;
65
+ /** The reconstructed request of a model call (the admin details panel). Optional. */
66
+ getMessageSentPayload?: (conversationId: number, messageId: number) => Promise<ConversationMessageSentPayload>;
67
+ /**
68
+ * Live updates: `onSignal` receives the conversation's signal as data, the first one right after the
69
+ * subscription is up; `onEnded` reports that the conversation is gone or no longer accessible (`gone`, `forbidden`) —
70
+ * the binding stops its own reads for it then (run-state checks), the package clears the status; a push transport may
71
+ * keep delivering until the unsubscribe. Returns the unsubscribe. The rules on top (throttle, terminal re-read,
72
+ * convergence on `lastMessageId`) are the package's; transport health (connection watchdog, token cache) is the
73
+ * binding's.
74
+ *
75
+ * Optional: a binding without a push transport leaves it out, and `withPollingChangeSubscription`
76
+ * (`client/polling/`) fills it with the polling default over `getConversationMetadata`; the default `AgentChat` does
77
+ * that by itself. `AgentChatController` and `useAgentsConversationRunStatus` follow nothing for a client without it.
78
+ */
79
+ subscribeToConversationChanges?: (conversationId: number, onSignal: (signal: ConversationChangeSignal) => void, onEnded: (reason: ConversationSubscriptionEndReason) => void) => () => void;
80
+ }
81
+ /** The port functions by name — the `operation` that `extraRequestParameters` receives. */
82
+ export type AgentsConversationOperation = Exclude<keyof AgentsConversationClient, "subscribeToConversationChanges">;
83
+ /** Extra query parameters a binding stamps onto a request: an app's own routing tags, admin overrides. */
84
+ export type AgentsExtraRequestParameters = Record<string, string | number | boolean | undefined>;
85
+ /** Options every binding that issues HTTP requests takes. */
86
+ export interface AgentsConversationClientBindingOptions {
87
+ /**
88
+ * App-only request parameters per operation, merged over the binding's own (the host application's own
89
+ * overrides and its chat partition tag). Read on every request, so it may read
90
+ * state that changes at runtime. The package never names these parameters.
91
+ */
92
+ extraRequestParameters?: (operation: AgentsConversationOperation) => AgentsExtraRequestParameters;
93
+ }
@@ -0,0 +1,17 @@
1
+ import { type ReactNode } from "react";
2
+ import type { AgentsConversationClient } from "./AgentsConversationClient";
3
+ export interface AgentsConversationClientProviderProps {
4
+ /** The app's binding of the conversation client port. */
5
+ client: AgentsConversationClient;
6
+ children?: ReactNode;
7
+ }
8
+ /**
9
+ * Puts the app's conversation client in reach of the package's chat hooks (search, activity, conversation list). The
10
+ * app mounts it around the chat; until the provider carries the `client` member, this is where the
11
+ * hooks read it from.
12
+ */
13
+ export declare const AgentsConversationClientProvider: (props: AgentsConversationClientProviderProps) => import("react/jsx-runtime").JSX.Element;
14
+ /** The conversation client the app mounted; throws when a chat hook renders outside `AgentsConversationClientProvider`. */
15
+ export declare const useAgentsConversationClient: () => AgentsConversationClient;
16
+ /** The conversation client the app mounted, or null outside `AgentsConversationClientProvider`. */
17
+ export declare const useOptionalAgentsConversationClient: () => AgentsConversationClient | null;
@@ -0,0 +1,62 @@
1
+ import { type AgentsConversation, type ConversationChangeSignal, type ConversationRunStatus, type ConversationSubscriptionEndReason } from "../../contract/conversation";
2
+ /** Read interval while a turn runs (or right after a local send). */
3
+ export declare const POLLING_RUNNING_INTERVAL_MS = 2000;
4
+ /** Read interval while the conversation is idle or failed. */
5
+ export declare const POLLING_IDLE_INTERVAL_MS = 20000;
6
+ /** Ceiling of the exponential backoff after failed reads. */
7
+ export declare const POLLING_MAX_BACKOFF_MS = 60000;
8
+ /**
9
+ * How long after a local send the poller keeps the running interval although the conversation still reads idle: the
10
+ * server may store the owner's message before it marks the turn as running.
11
+ */
12
+ export declare const POLLING_LOCAL_ACTIVITY_WINDOW_MS = 10000;
13
+ /** Reads a conversation's metadata — the port's `getConversationMetadata`. */
14
+ export type ConversationMetadataReader = (conversationId: number) => Promise<AgentsConversation>;
15
+ /** The timer functions the poller uses; a spec hands in fake ones. */
16
+ export interface PollingTimers {
17
+ setTimeout: (callback: () => void, delayMs: number) => unknown;
18
+ clearTimeout: (timerHandle: unknown) => void;
19
+ now: () => number;
20
+ }
21
+ /** Whether the page is hidden, and a way to hear when that changes; a spec hands in its own. */
22
+ export interface PollingDocumentVisibility {
23
+ isHidden: () => boolean;
24
+ /** Calls `listener` on every visibility change; returns the function that stops it. */
25
+ listen: (listener: () => void) => () => void;
26
+ }
27
+ export interface PollingConversationChangeSubscriptionOptions {
28
+ /** Default `POLLING_RUNNING_INTERVAL_MS` (2 s). */
29
+ runningIntervalMs?: number;
30
+ /** Default `POLLING_IDLE_INTERVAL_MS` (20 s). */
31
+ idleIntervalMs?: number;
32
+ /** Default `POLLING_MAX_BACKOFF_MS` (60 s). */
33
+ maxBackoffMs?: number;
34
+ /** Default `POLLING_LOCAL_ACTIVITY_WINDOW_MS` (10 s). */
35
+ localActivityWindowMs?: number;
36
+ /** Default: the global `setTimeout` / `clearTimeout` and `Date.now`. */
37
+ timers?: PollingTimers;
38
+ /** Default: the browser `document`; `null` = the page counts as always visible (no `document`, a worker). */
39
+ documentVisibility?: PollingDocumentVisibility | null;
40
+ }
41
+ /**
42
+ * The polling default of the live updates: the port's `subscribeToConversationChanges` plus
43
+ * `notifyLocalActivity`, which `withPollingChangeSubscription` calls after every send the server accepted.
44
+ */
45
+ export interface PollingConversationChangeSubscription {
46
+ subscribeToConversationChanges: (conversationId: number, onSignal: (signal: ConversationChangeSignal) => void, onEnded: (reason: ConversationSubscriptionEndReason) => void) => () => void;
47
+ /** Reads the conversation's metadata now and keeps the running interval for the local-activity window. */
48
+ notifyLocalActivity: (conversationId: number) => void;
49
+ }
50
+ /**
51
+ * The three-value run status a polled read reports: the stored run state, and "running" for an idle conversation the
52
+ * server owes a turn (`agentTurnOwedAt`), as the chat's own derivation does.
53
+ */
54
+ export declare const readPolledRunStatus: (conversation: AgentsConversation) => ConversationRunStatus | null;
55
+ /**
56
+ * The polling default of `subscribeToConversationChanges` over a metadata read: every 2 s while a turn
57
+ * runs, every 20 s while idle, at once after `notifyLocalActivity`; paused while the page is hidden and read once when
58
+ * it shows again; exponential backoff on failed reads up to 60 s; a `notFound` / `forbidden` read ends the subscription
59
+ * with `gone` / `forbidden`. One poller per subscription; see `ConversationMetadataPoller` for how a read becomes a
60
+ * signal.
61
+ */
62
+ export declare const createPollingConversationChangeSubscription: (readMetadata: ConversationMetadataReader, options?: PollingConversationChangeSubscriptionOptions) => PollingConversationChangeSubscription;
@@ -0,0 +1,11 @@
1
+ import type { AgentsConversationClient } from "../AgentsConversationClient";
2
+ import { type PollingConversationChangeSubscriptionOptions } from "./createPollingConversationChangeSubscription";
3
+ /** A conversation client whose `subscribeToConversationChanges` is present. */
4
+ export type AgentsConversationClientWithChangeSubscription = AgentsConversationClient & Required<Pick<AgentsConversationClient, "subscribeToConversationChanges">>;
5
+ /**
6
+ * The client with live updates: a client that brings its own `subscribeToConversationChanges` (a push
7
+ * transport — the host application's Firebase binding) is returned as it is; any other gets the polling default over its
8
+ * `getConversationMetadata` (`createPollingConversationChangeSubscription`, `options` tune the intervals). The default
9
+ * `AgentChat` calls this by itself.
10
+ */
11
+ export declare const withPollingChangeSubscription: (client: AgentsConversationClient, options?: PollingConversationChangeSubscriptionOptions) => AgentsConversationClientWithChangeSubscription;