@flamingo-stack/openframe-frontend-core 0.0.457 → 0.0.458-snapshot.20260720215024

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 (290) hide show
  1. package/dist/chat-protocol/decode.d.ts +58 -0
  2. package/dist/chat-protocol/decode.d.ts.map +1 -0
  3. package/dist/chat-protocol/encode.d.ts +44 -0
  4. package/dist/chat-protocol/encode.d.ts.map +1 -0
  5. package/dist/chat-protocol/env-flag.d.ts +35 -0
  6. package/dist/chat-protocol/env-flag.d.ts.map +1 -0
  7. package/dist/chat-protocol/events.d.ts +192 -0
  8. package/dist/chat-protocol/events.d.ts.map +1 -0
  9. package/dist/chat-protocol/frames.d.ts +206 -0
  10. package/dist/chat-protocol/frames.d.ts.map +1 -0
  11. package/dist/chat-protocol/index.cjs +493 -0
  12. package/dist/chat-protocol/index.cjs.map +1 -0
  13. package/dist/chat-protocol/index.d.ts +18 -0
  14. package/dist/chat-protocol/index.d.ts.map +1 -0
  15. package/dist/chat-protocol/index.js +477 -0
  16. package/dist/chat-protocol/index.js.map +1 -0
  17. package/dist/chat-protocol/ip-normalize.d.ts +44 -0
  18. package/dist/chat-protocol/ip-normalize.d.ts.map +1 -0
  19. package/dist/chat-protocol/nats-decoder.d.ts +26 -0
  20. package/dist/chat-protocol/nats-decoder.d.ts.map +1 -0
  21. package/dist/{chunk-SQ3CP2IV.cjs → chunk-3N3TMZ62.cjs} +7 -7
  22. package/dist/{chunk-SQ3CP2IV.cjs.map → chunk-3N3TMZ62.cjs.map} +1 -1
  23. package/dist/{chunk-I7M6KCCS.js → chunk-4R6H2U77.js} +4 -4
  24. package/dist/{chunk-CCT5VCRP.cjs → chunk-4XDWNAZW.cjs} +9 -9
  25. package/dist/{chunk-CCT5VCRP.cjs.map → chunk-4XDWNAZW.cjs.map} +1 -1
  26. package/dist/{chunk-KQ36EHE4.cjs → chunk-7KSEINAE.cjs} +15 -15
  27. package/dist/{chunk-KQ36EHE4.cjs.map → chunk-7KSEINAE.cjs.map} +1 -1
  28. package/dist/{chunk-FM5DTJPA.cjs → chunk-ADD3FPDG.cjs} +6851 -4713
  29. package/dist/chunk-ADD3FPDG.cjs.map +1 -0
  30. package/dist/{chunk-RSW42GTZ.js → chunk-APF5QBAU.js} +2 -2
  31. package/dist/{chunk-YCIVMKRS.cjs → chunk-BLZZXZNM.cjs} +26 -26
  32. package/dist/{chunk-YCIVMKRS.cjs.map → chunk-BLZZXZNM.cjs.map} +1 -1
  33. package/dist/{chunk-YHB4MNUX.cjs → chunk-BQ7PMWLM.cjs} +28 -27
  34. package/dist/chunk-BQ7PMWLM.cjs.map +1 -0
  35. package/dist/{chunk-GJ7BN4MI.js → chunk-CGNDAJ7V.js} +4 -4
  36. package/dist/{chunk-R5IQJXA3.js → chunk-F2NMWV44.js} +2 -2
  37. package/dist/{chunk-EOVQVVDJ.cjs → chunk-F7F43U7Q.cjs} +11 -11
  38. package/dist/{chunk-EOVQVVDJ.cjs.map → chunk-F7F43U7Q.cjs.map} +1 -1
  39. package/dist/{chunk-2ZW2ZPDW.js → chunk-LAOO7XHO.js} +2 -2
  40. package/dist/{chunk-O7F7RZFN.js → chunk-LJKZIIK4.js} +6 -5
  41. package/dist/chunk-LJKZIIK4.js.map +1 -0
  42. package/dist/{chunk-AJGZ3YSR.js → chunk-OR5AMXYN.js} +2 -2
  43. package/dist/{chunk-5XFJG3TC.cjs → chunk-P5JQDFRM.cjs} +60 -60
  44. package/dist/chunk-P5JQDFRM.cjs.map +1 -0
  45. package/dist/{chunk-U4APSAAR.cjs → chunk-PXZ7YQ5V.cjs} +5 -5
  46. package/dist/{chunk-U4APSAAR.cjs.map → chunk-PXZ7YQ5V.cjs.map} +1 -1
  47. package/dist/{chunk-WXDEMTLD.js → chunk-QO2XD3FR.js} +2 -2
  48. package/dist/{chunk-C2TDHJBO.cjs → chunk-QSGZE6AZ.cjs} +37 -37
  49. package/dist/{chunk-C2TDHJBO.cjs.map → chunk-QSGZE6AZ.cjs.map} +1 -1
  50. package/dist/{chunk-NSL5MNS4.js → chunk-REWRUV3K.js} +11644 -9506
  51. package/dist/chunk-REWRUV3K.js.map +1 -0
  52. package/dist/{chunk-BDTQIIJR.cjs → chunk-TA7MFVUS.cjs} +31 -31
  53. package/dist/{chunk-BDTQIIJR.cjs.map → chunk-TA7MFVUS.cjs.map} +1 -1
  54. package/dist/{chunk-4423DHRX.js → chunk-UI7CIUAR.js} +2 -2
  55. package/dist/{chunk-5BKBG653.js → chunk-VXJH5TDN.js} +10 -10
  56. package/dist/chunk-VXJH5TDN.js.map +1 -0
  57. package/dist/{chunk-AB65PWU2.cjs → chunk-WCE66C2Z.cjs} +62 -62
  58. package/dist/{chunk-AB65PWU2.cjs.map → chunk-WCE66C2Z.cjs.map} +1 -1
  59. package/dist/{chunk-KXIIUE75.js → chunk-XF5ROTMQ.js} +2 -2
  60. package/dist/components/case-studies/index.cjs +8 -8
  61. package/dist/components/case-studies/index.js +2 -2
  62. package/dist/components/chart.d.ts +1 -1
  63. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  64. package/dist/components/chat/chat-message-list.d.ts.map +1 -1
  65. package/dist/components/chat/hooks/index.d.ts +0 -1
  66. package/dist/components/chat/hooks/index.d.ts.map +1 -1
  67. package/dist/components/chat/hooks/use-chat.d.ts.map +1 -1
  68. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +15 -48
  69. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  70. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +3 -47
  71. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  72. package/dist/components/chat/index.cjs +10 -2
  73. package/dist/components/chat/index.cjs.map +1 -1
  74. package/dist/components/chat/index.d.ts +1 -0
  75. package/dist/components/chat/index.d.ts.map +1 -1
  76. package/dist/components/chat/index.js +21 -13
  77. package/dist/components/chat/stream/chat-dialog-store.d.ts +184 -0
  78. package/dist/components/chat/stream/chat-dialog-store.d.ts.map +1 -0
  79. package/dist/components/chat/stream/chat-stream-reducer.d.ts +367 -0
  80. package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -0
  81. package/dist/components/chat/stream/delta-batcher.d.ts +51 -0
  82. package/dist/components/chat/stream/delta-batcher.d.ts.map +1 -0
  83. package/dist/components/chat/stream/index.d.ts +17 -0
  84. package/dist/components/chat/stream/index.d.ts.map +1 -0
  85. package/dist/components/chat/stream/message-mutations.d.ts +77 -0
  86. package/dist/components/chat/stream/message-mutations.d.ts.map +1 -0
  87. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts +22 -0
  88. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts.map +1 -0
  89. package/dist/components/chat/types/api.types.d.ts +1 -81
  90. package/dist/components/chat/types/api.types.d.ts.map +1 -1
  91. package/dist/components/chat/types/processing.types.d.ts +2 -90
  92. package/dist/components/chat/types/processing.types.d.ts.map +1 -1
  93. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts +34 -6
  94. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts.map +1 -1
  95. package/dist/components/chat/utils/index.d.ts +2 -3
  96. package/dist/components/chat/utils/index.d.ts.map +1 -1
  97. package/dist/components/chat/utils/process-historical-messages.d.ts +59 -11
  98. package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
  99. package/dist/components/contact/index.cjs +3 -3
  100. package/dist/components/contact/index.js +2 -2
  101. package/dist/components/docs/index.cjs +5 -5
  102. package/dist/components/docs/index.js +4 -4
  103. package/dist/components/embeds/index.cjs +3 -3
  104. package/dist/components/embeds/index.js +2 -2
  105. package/dist/components/faq/index.cjs +3 -3
  106. package/dist/components/faq/index.js +2 -2
  107. package/dist/components/features/index.cjs +2 -2
  108. package/dist/components/features/index.js +1 -1
  109. package/dist/components/features/time-tracker/time-tracker-panel.d.ts.map +1 -1
  110. package/dist/components/help-center-pages/index.cjs +20 -20
  111. package/dist/components/help-center-pages/index.js +11 -11
  112. package/dist/components/index.cjs +171 -129
  113. package/dist/components/index.cjs.map +1 -1
  114. package/dist/components/index.js +63 -21
  115. package/dist/components/index.js.map +1 -1
  116. package/dist/components/layout/page-container.d.ts.map +1 -1
  117. package/dist/components/navigation/index.cjs +2 -2
  118. package/dist/components/navigation/index.js +1 -1
  119. package/dist/components/onboarding-guides/index.cjs +5 -5
  120. package/dist/components/onboarding-guides/index.js +4 -4
  121. package/dist/components/onboarding-guides/onboarding-guide-detail-view.d.ts.map +1 -1
  122. package/dist/components/related-content/index.cjs +3 -3
  123. package/dist/components/related-content/index.js +2 -2
  124. package/dist/components/shared/product-release/release-detail-page.d.ts.map +1 -1
  125. package/dist/components/tickets/index.cjs +5 -5
  126. package/dist/components/tickets/index.js +4 -4
  127. package/dist/components/ui/index.cjs +44 -2
  128. package/dist/components/ui/index.cjs.map +1 -1
  129. package/dist/components/ui/index.d.ts +1 -2
  130. package/dist/components/ui/index.d.ts.map +1 -1
  131. package/dist/components/ui/index.js +55 -13
  132. package/dist/components/ui/markdown/base-components.d.ts +56 -0
  133. package/dist/components/ui/markdown/base-components.d.ts.map +1 -0
  134. package/dist/components/ui/markdown/engine.d.ts +99 -0
  135. package/dist/components/ui/markdown/engine.d.ts.map +1 -0
  136. package/dist/components/ui/markdown/heading-ids.d.ts +65 -0
  137. package/dist/components/ui/markdown/heading-ids.d.ts.map +1 -0
  138. package/dist/components/ui/markdown/index.d.ts +18 -0
  139. package/dist/components/ui/markdown/index.d.ts.map +1 -0
  140. package/dist/components/ui/markdown/mermaid-diagram.d.ts +79 -0
  141. package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +1 -0
  142. package/dist/components/ui/markdown/rich/embed-overrides.d.ts +14 -0
  143. package/dist/components/ui/markdown/rich/embed-overrides.d.ts.map +1 -0
  144. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +40 -0
  145. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -0
  146. package/dist/components/ui/markdown/rich/shortcodes.d.ts +8 -0
  147. package/dist/components/ui/markdown/rich/shortcodes.d.ts.map +1 -0
  148. package/dist/components/ui/markdown/sanitize.d.ts +153 -0
  149. package/dist/components/ui/markdown/sanitize.d.ts.map +1 -0
  150. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +23 -0
  151. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +1 -0
  152. package/dist/components/ui/markdown/streaming.d.ts +78 -0
  153. package/dist/components/ui/markdown/streaming.d.ts.map +1 -0
  154. package/dist/components/ui/markdown/text-size.d.ts +34 -0
  155. package/dist/components/ui/markdown/text-size.d.ts.map +1 -0
  156. package/dist/components/ui/modal-v2.d.ts.map +1 -1
  157. package/dist/components/ui/modal.d.ts.map +1 -1
  158. package/dist/index.cjs +60 -2
  159. package/dist/index.cjs.map +1 -1
  160. package/dist/index.js +71 -13
  161. package/dist/utils/index.cjs +169 -40
  162. package/dist/utils/index.cjs.map +1 -1
  163. package/dist/utils/index.d.ts +1 -0
  164. package/dist/utils/index.d.ts.map +1 -1
  165. package/dist/utils/index.js +162 -41
  166. package/dist/utils/index.js.map +1 -1
  167. package/dist/utils/markdown-fences.d.ts +42 -0
  168. package/dist/utils/markdown-fences.d.ts.map +1 -0
  169. package/dist/utils/markdown-heading-id.d.ts +85 -0
  170. package/dist/utils/markdown-heading-id.d.ts.map +1 -0
  171. package/dist/utils/markdown-section-extractor.d.ts.map +1 -1
  172. package/package.json +7 -1
  173. package/src/chat-protocol/__tests__/__snapshots__/nats-decoder-golden.test.ts.snap +307 -0
  174. package/src/chat-protocol/__tests__/chat-protocol.test.ts +515 -0
  175. package/src/chat-protocol/__tests__/env-flag.test.ts +52 -0
  176. package/src/chat-protocol/__tests__/ip-normalize.test.ts +136 -0
  177. package/src/chat-protocol/__tests__/nats-decoder-golden.test.ts +228 -0
  178. package/src/chat-protocol/decode.ts +277 -0
  179. package/src/chat-protocol/encode.ts +71 -0
  180. package/src/chat-protocol/env-flag.ts +39 -0
  181. package/src/chat-protocol/events.ts +228 -0
  182. package/src/chat-protocol/frames.ts +238 -0
  183. package/src/chat-protocol/index.ts +21 -0
  184. package/src/chat-protocol/ip-normalize.ts +146 -0
  185. package/src/chat-protocol/nats-decoder.ts +252 -0
  186. package/src/components/chat/__tests__/chat-message-list.test.tsx +293 -5
  187. package/src/components/chat/__tests__/chat-message-streaming-memo.test.tsx +207 -0
  188. package/src/components/chat/__tests__/chat-pending-turn.test.tsx +209 -0
  189. package/src/components/chat/chat-message-enhanced.tsx +111 -17
  190. package/src/components/chat/chat-message-list.tsx +367 -113
  191. package/src/components/chat/embeddable-chat.tsx +6 -0
  192. package/src/components/chat/hooks/.index.md +1 -1
  193. package/src/components/chat/hooks/.use-nats-chat-adapter.md +1 -1
  194. package/src/components/chat/hooks/__tests__/__snapshots__/persisted-state-v1-golden.test.ts.snap +297 -0
  195. package/src/components/chat/hooks/__tests__/__snapshots__/sse-stream-golden.test.ts.snap +0 -0
  196. package/src/components/chat/hooks/__tests__/persisted-state-v1-golden.test.ts +272 -0
  197. package/src/components/chat/hooks/__tests__/sse-stream-golden.test.ts +318 -0
  198. package/src/components/chat/hooks/index.ts +0 -1
  199. package/src/components/chat/hooks/use-chat.ts +8 -0
  200. package/src/components/chat/hooks/use-nats-chat-adapter.ts +243 -822
  201. package/src/components/chat/hooks/use-sse-chat-adapter.ts +318 -666
  202. package/src/components/chat/index.ts +5 -0
  203. package/src/components/chat/stream/__tests__/__snapshots__/chat-stream-reducer-golden.test.ts.snap +937 -0
  204. package/src/components/chat/stream/__tests__/chat-dialog-store.test.ts +756 -0
  205. package/src/components/chat/stream/__tests__/chat-stream-reducer-golden.test.ts +460 -0
  206. package/src/components/chat/stream/__tests__/chat-stream-reducer.test.ts +894 -0
  207. package/src/components/chat/stream/__tests__/delta-batcher.test.ts +255 -0
  208. package/src/components/chat/stream/__tests__/use-chat-stream-reducer.test.ts +98 -0
  209. package/src/components/chat/stream/chat-dialog-store.ts +536 -0
  210. package/src/components/chat/stream/chat-stream-reducer.ts +1796 -0
  211. package/src/components/chat/stream/delta-batcher.ts +159 -0
  212. package/src/components/chat/stream/index.ts +55 -0
  213. package/src/components/chat/stream/message-mutations.ts +338 -0
  214. package/src/components/chat/stream/use-chat-stream-reducer.ts +126 -0
  215. package/src/components/chat/thinking-display.tsx +1 -1
  216. package/src/components/chat/types/.api.types.md +1 -3
  217. package/src/components/chat/types/.processing.types.md +6 -23
  218. package/src/components/chat/types/api.types.ts +6 -73
  219. package/src/components/chat/types/processing.types.ts +11 -52
  220. package/src/components/chat/utils/.index.md +0 -5
  221. package/src/components/chat/utils/__tests__/__snapshots__/process-historical-messages-golden.test.ts.snap +418 -0
  222. package/src/components/chat/utils/__tests__/__snapshots__/segment-accumulator-golden.test.ts.snap +599 -0
  223. package/src/components/chat/utils/__tests__/process-historical-messages-golden.test.ts +317 -0
  224. package/src/components/chat/utils/__tests__/segment-accumulator-golden.test.ts +270 -0
  225. package/src/components/chat/utils/extract-incomplete-message-state.ts +63 -5
  226. package/src/components/chat/utils/index.ts +5 -8
  227. package/src/components/chat/utils/process-historical-messages.ts +352 -383
  228. package/src/components/features/notifications/notification-drawer.tsx +4 -2
  229. package/src/components/features/time-tracker/time-tracker-panel.tsx +8 -2
  230. package/src/components/layout/page-container.tsx +5 -1
  231. package/src/components/onboarding-guides/onboarding-guide-detail-view.tsx +22 -4
  232. package/src/components/shared/legal-document/legal-document-page.tsx +1 -1
  233. package/src/components/shared/product-release/release-detail-page.tsx +19 -4
  234. package/src/components/ui/__tests__/__snapshots__/markdown-parity.test.tsx.snap +2420 -0
  235. package/src/components/ui/__tests__/markdown-parity.test.tsx +2528 -0
  236. package/src/components/ui/index.ts +1 -2
  237. package/src/components/ui/markdown/__tests__/mermaid-security.test.ts +115 -0
  238. package/src/components/ui/markdown/__tests__/mermaid-stale-render.test.tsx +95 -0
  239. package/src/components/ui/markdown/__tests__/sanitize-invariant.test.ts +309 -0
  240. package/src/components/ui/markdown/__tests__/streaming.test.tsx +388 -0
  241. package/src/components/ui/markdown/base-components.tsx +341 -0
  242. package/src/components/ui/markdown/engine.tsx +315 -0
  243. package/src/components/ui/markdown/heading-ids.ts +239 -0
  244. package/src/components/ui/markdown/index.ts +49 -0
  245. package/src/components/ui/markdown/mermaid-diagram.tsx +291 -0
  246. package/src/components/ui/markdown/rich/embed-overrides.tsx +199 -0
  247. package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +184 -0
  248. package/src/components/ui/markdown/rich/shortcodes.ts +170 -0
  249. package/src/components/ui/markdown/sanitize.ts +3499 -0
  250. package/src/components/ui/markdown/simple-markdown-renderer.tsx +28 -0
  251. package/src/components/ui/markdown/streaming.ts +362 -0
  252. package/src/components/ui/markdown/text-size.ts +106 -0
  253. package/src/components/ui/modal-v2.tsx +6 -0
  254. package/src/components/ui/modal.tsx +3 -0
  255. package/src/components/ui/release-changelog-section.tsx +1 -1
  256. package/src/components/ui/ticket-info-section.tsx +1 -1
  257. package/src/utils/index.ts +1 -0
  258. package/src/utils/markdown-fences.ts +127 -0
  259. package/src/utils/markdown-heading-id.ts +348 -0
  260. package/src/utils/markdown-section-extractor.ts +41 -56
  261. package/dist/chunk-5BKBG653.js.map +0 -1
  262. package/dist/chunk-5XFJG3TC.cjs.map +0 -1
  263. package/dist/chunk-FM5DTJPA.cjs.map +0 -1
  264. package/dist/chunk-NSL5MNS4.js.map +0 -1
  265. package/dist/chunk-O7F7RZFN.js.map +0 -1
  266. package/dist/chunk-YHB4MNUX.cjs.map +0 -1
  267. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts +0 -6
  268. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +0 -1
  269. package/dist/components/chat/utils/chunk-parser.d.ts +0 -25
  270. package/dist/components/chat/utils/chunk-parser.d.ts.map +0 -1
  271. package/dist/components/ui/rich-markdown-renderer.d.ts +0 -34
  272. package/dist/components/ui/rich-markdown-renderer.d.ts.map +0 -1
  273. package/dist/components/ui/simple-markdown-renderer.d.ts +0 -73
  274. package/dist/components/ui/simple-markdown-renderer.d.ts.map +0 -1
  275. package/src/components/chat/hooks/.use-realtime-chunk-processor.md +0 -50
  276. package/src/components/chat/hooks/use-realtime-chunk-processor.ts +0 -479
  277. package/src/components/chat/utils/.chunk-parser.md +0 -51
  278. package/src/components/chat/utils/chunk-parser.ts +0 -255
  279. package/src/components/ui/.simple-markdown-renderer.md +0 -40
  280. package/src/components/ui/rich-markdown-renderer.tsx +0 -1223
  281. package/src/components/ui/simple-markdown-renderer.tsx +0 -965
  282. /package/dist/{chunk-I7M6KCCS.js.map → chunk-4R6H2U77.js.map} +0 -0
  283. /package/dist/{chunk-RSW42GTZ.js.map → chunk-APF5QBAU.js.map} +0 -0
  284. /package/dist/{chunk-GJ7BN4MI.js.map → chunk-CGNDAJ7V.js.map} +0 -0
  285. /package/dist/{chunk-R5IQJXA3.js.map → chunk-F2NMWV44.js.map} +0 -0
  286. /package/dist/{chunk-2ZW2ZPDW.js.map → chunk-LAOO7XHO.js.map} +0 -0
  287. /package/dist/{chunk-AJGZ3YSR.js.map → chunk-OR5AMXYN.js.map} +0 -0
  288. /package/dist/{chunk-WXDEMTLD.js.map → chunk-QO2XD3FR.js.map} +0 -0
  289. /package/dist/{chunk-4423DHRX.js.map → chunk-UI7CIUAR.js.map} +0 -0
  290. /package/dist/{chunk-KXIIUE75.js.map → chunk-XF5ROTMQ.js.map} +0 -0
@@ -87,7 +87,9 @@ import {
87
87
  ContextMenuRow,
88
88
  CustomerInterviewCard,
89
89
  CustomerInterviewCardSkeleton,
90
+ DEFAULT_DIALOG_SIDE,
90
91
  DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID,
92
+ DEFAULT_MAX_REDUCERS,
91
93
  DataRoomDocCard,
92
94
  DataRoomDocCardSkeleton,
93
95
  DialogListItem,
@@ -112,6 +114,7 @@ import {
112
114
  ICON_REGISTRY,
113
115
  InvestorUpdateCard,
114
116
  InvestorUpdateCardSkeleton,
117
+ MAX_PENDING_RETAIN_KEYS,
115
118
  MESSAGE_ROLE,
116
119
  MESSAGE_TYPE,
117
120
  MemoizedChatMessageEnhanced,
@@ -178,8 +181,13 @@ import {
178
181
  clickupTaskUrl,
179
182
  computeHistoryPrepend,
180
183
  computeIsNewTab,
184
+ createChatDialogStore,
185
+ createChatStreamReducer,
186
+ createDeltaBatcher,
187
+ createEmptyTurnMeta,
181
188
  createMessageSegmentAccumulator,
182
189
  decideNewTab,
190
+ decodeHistoricalMessageData,
183
191
  defaultBuildProductReleaseCardProps,
184
192
  defaultTableIdForDocumentType,
185
193
  escapeMarkdownInline,
@@ -188,7 +196,7 @@ import {
188
196
  extractEntityIdFilter,
189
197
  extractErrorMessages,
190
198
  extractIncompleteMessageState,
191
- extractTextFromChunk,
199
+ extractIncompleteTailState,
192
200
  fetchEmptyStateConfig,
193
201
  fetchSlashCommands,
194
202
  flattenAssistantContent,
@@ -208,11 +216,8 @@ import {
208
216
  hideOnError,
209
217
  historicalToUnified,
210
218
  interleave,
211
- isControlChunk,
212
219
  isCrossOriginUrl,
213
- isErrorChunk,
214
220
  isHistoricalUserTurn,
215
- isMetadataChunk,
216
221
  isModifierClick,
217
222
  isQuickActionIconSpec,
218
223
  isStructuredContent,
@@ -223,7 +228,6 @@ import {
223
228
  normalizeContent,
224
229
  normalizeHistoricalMessageData,
225
230
  normalizeIconKey,
226
- parseChunkToAction,
227
231
  parseScrollAnchor,
228
232
  parseWireCommandOverride,
229
233
  processHistoricalMessages,
@@ -250,6 +254,7 @@ import {
250
254
  useChatAttachments,
251
255
  useChatCardItem,
252
256
  useChatIdentity,
257
+ useChatStreamReducer,
253
258
  useChunkCatchup,
254
259
  useCloseOnNavigation,
255
260
  useCollapsible,
@@ -259,14 +264,13 @@ import {
259
264
  useNatsChatAdapter,
260
265
  useNatsDialogSubscription,
261
266
  useProxiedImageUrl,
262
- useRealtimeChunkProcessor,
263
267
  useSSE,
264
268
  useScriptedStream,
265
269
  useSlashCommandRegistry,
266
270
  useSlashCommands,
267
271
  useSseChatAdapter,
268
272
  useUnifiedChat
269
- } from "../../chunk-NSL5MNS4.js";
273
+ } from "../../chunk-REWRUV3K.js";
270
274
  import {
271
275
  applyProxyAuth,
272
276
  clearEmbedProxyAuth,
@@ -377,7 +381,9 @@ export {
377
381
  ContextMenuRow,
378
382
  CustomerInterviewCard,
379
383
  CustomerInterviewCardSkeleton,
384
+ DEFAULT_DIALOG_SIDE,
380
385
  DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID,
386
+ DEFAULT_MAX_REDUCERS,
381
387
  DataRoomDocCard,
382
388
  DataRoomDocCardSkeleton,
383
389
  DialogListItem,
@@ -402,6 +408,7 @@ export {
402
408
  ICON_REGISTRY,
403
409
  InvestorUpdateCard,
404
410
  InvestorUpdateCardSkeleton,
411
+ MAX_PENDING_RETAIN_KEYS,
405
412
  MESSAGE_ROLE,
406
413
  MESSAGE_TYPE,
407
414
  MessageSegmentAccumulator,
@@ -470,8 +477,13 @@ export {
470
477
  clickupTaskUrl,
471
478
  computeHistoryPrepend,
472
479
  computeIsNewTab,
480
+ createChatDialogStore,
481
+ createChatStreamReducer,
482
+ createDeltaBatcher,
483
+ createEmptyTurnMeta,
473
484
  createMessageSegmentAccumulator,
474
485
  decideNewTab,
486
+ decodeHistoricalMessageData,
475
487
  defaultBuildProductReleaseCardProps,
476
488
  defaultTableIdForDocumentType,
477
489
  escapeMarkdownInline,
@@ -480,7 +492,7 @@ export {
480
492
  extractEntityIdFilter,
481
493
  extractErrorMessages,
482
494
  extractIncompleteMessageState,
483
- extractTextFromChunk,
495
+ extractIncompleteTailState,
484
496
  fetchEmptyStateConfig,
485
497
  fetchSlashCommands,
486
498
  flattenAssistantContent,
@@ -502,11 +514,8 @@ export {
502
514
  hideOnError,
503
515
  historicalToUnified,
504
516
  interleave,
505
- isControlChunk,
506
517
  isCrossOriginUrl,
507
- isErrorChunk,
508
518
  isHistoricalUserTurn,
509
- isMetadataChunk,
510
519
  isModifierClick,
511
520
  isQuickActionIconSpec,
512
521
  isStructuredContent,
@@ -517,7 +526,6 @@ export {
517
526
  normalizeContent,
518
527
  normalizeHistoricalMessageData,
519
528
  normalizeIconKey,
520
- parseChunkToAction,
521
529
  parseScrollAnchor,
522
530
  parseWireCommandOverride,
523
531
  processHistoricalMessages,
@@ -545,6 +553,7 @@ export {
545
553
  useChatAttachments,
546
554
  useChatCardItem,
547
555
  useChatIdentity,
556
+ useChatStreamReducer,
548
557
  useChunkCatchup,
549
558
  useCloseOnNavigation,
550
559
  useCollapsible,
@@ -555,7 +564,6 @@ export {
555
564
  useNatsChatAdapter,
556
565
  useNatsDialogSubscription,
557
566
  useProxiedImageUrl,
558
- useRealtimeChunkProcessor,
559
567
  useSSE,
560
568
  useScriptedStream,
561
569
  useSlashCommandRegistry,
@@ -0,0 +1,184 @@
1
+ /**
2
+ * createChatDialogStore — framework-free registry of `ChatStreamReducer`
3
+ * instances keyed by `(dialogId, side)`. Reducer state PERSISTS across
4
+ * component unmounts (the store outlives React), and the store is the
5
+ * `useSyncExternalStore` source for the `useChatStreamReducer` wrapper.
6
+ *
7
+ * CROSS-SIDE PROJECTION: exactly two operations fan out across sides of the
8
+ * same dialogId —
9
+ * 1. approval RESOLUTION by requestId (`approval-resolved` events), and
10
+ * 2. tool-execution MERGE by execId (`tool-execution` events)
11
+ * — implemented as idempotent pure projections over the other side's state
12
+ * (recomputed from state, never re-injected into the other side's seq
13
+ * stream; per-side seq gates stay untouched). Everything else — text,
14
+ * thinking, participant rows — is strictly per-side.
15
+ *
16
+ * LIFECYCLE / MEMORY: the reducer map is LRU-capped (`maxReducers`, default
17
+ * `DEFAULT_MAX_REDUCERS`) and evicted through the same path as `remove()`.
18
+ * Without a cap an agent cycling hundreds of dialogs would retain a reducer
19
+ * (thread + accumulator) per dialog for the process's lifetime; under SSR,
20
+ * where the store is module-scoped, that growth is shared across every
21
+ * request. `getSnapshot` is PURE — it never creates an entry — and
22
+ * `getServerSnapshot` always returns the shared frozen `EMPTY_STATE`.
23
+ *
24
+ * EVICTION SAFETY (LRU recency alone is NOT liveness):
25
+ * 1. RETAINED keys are never evicted. `retain(dialogId, side)` returns a
26
+ * release fn; the `useChatStreamReducer` hook calls it for as long as it
27
+ * is mounted, so a quiet-but-visible panel can't be dropped just because
28
+ * ten other keys were touched. NON-React hosts must call it too.
29
+ * Because the hook retains in an EFFECT but takes its reducer during
30
+ * RENDER, a key created by a public `getReducer` is protected from
31
+ * creation until its FIRST `retain()` (bounded by
32
+ * `MAX_PENDING_RETAIN_KEYS`) — see `pendingRetain`.
33
+ * 2. A reducer whose `streamingPhase !== 'idle'` is never evicted — dropping
34
+ * mid-turn would recreate an EMPTY reducer on the next `getReducer`
35
+ * while the host's seq cursor still says "caught up", i.e. the thread
36
+ * visually vanishes with no path back.
37
+ * 3. Eviction hands the host the dropped instance's PARKED state
38
+ * (`onEvict(..., { messages, approvalStatuses, lastAppliedSeq,
39
+ * pendingEchoes })`). A recreated reducer is pristine, so re-seeding
40
+ * messages alone would
41
+ * resurrect resolved approvals as actionable and reset the seq gate to
42
+ * `-Infinity`; the parked payload is what makes the round-trip lossless.
43
+ * 4. Eviction NEVER notifies synchronously. `getReducer` is called during
44
+ * render (by the hook), and notifying there means updating other
45
+ * components mid-render. The notify is deferred to a microtask.
46
+ */
47
+ import { type ChatReducerState, type ChatStreamReducer, type ChatStreamReducerOptions, type PendingEcho } from './chat-stream-reducer';
48
+ import type { ChatStreamEvent } from '../../../chat-protocol/events';
49
+ export type ChatDialogSide = string;
50
+ /** Factory for a key's reducer options, consulted ONCE at creation. A plain
51
+ * `() => options` thunk remains assignable. */
52
+ export type CreateReducerOptionsFn = (dialogId: string, side: ChatDialogSide) => ChatStreamReducerOptions;
53
+ export interface ChatDialogStore {
54
+ /** Create-or-get the reducer for `(dialogId, side)`. `createOptions` is
55
+ * consulted ONLY when the instance is first created. */
56
+ getReducer(dialogId: string, side?: ChatDialogSide, createOptions?: CreateReducerOptionsFn): ChatStreamReducer;
57
+ /** Apply one event to a side, then fan out the cross-side projections to
58
+ * the other sides of the same dialog. */
59
+ apply(dialogId: string, side: ChatDialogSide, event: ChatStreamEvent): void;
60
+ /** Run adapter commands against a reducer; subscribers are notified. */
61
+ mutate<T>(dialogId: string, side: ChatDialogSide, fn: (reducer: ChatStreamReducer) => T): T;
62
+ subscribe(listener: () => void): () => void;
63
+ /**
64
+ * Referentially-stable snapshot for `useSyncExternalStore`. PURE — an
65
+ * unknown key returns the shared frozen `EMPTY_STATE` rather than
66
+ * creating a reducer (a create-on-read would let SSR renders accumulate
67
+ * reducers in a process-global map, and would make React's snapshot read
68
+ * a mutation).
69
+ */
70
+ getSnapshot(dialogId: string, side?: ChatDialogSide): ChatReducerState;
71
+ /** `useSyncExternalStore`'s server getter — always `EMPTY_STATE`. There is
72
+ * no per-request store on the server, so a live thread cannot be rendered
73
+ * server-side; the client hydrates from the real reducer. */
74
+ getServerSnapshot(): ChatReducerState;
75
+ /** Drop a side's reducer (or every side of the dialog when omitted). */
76
+ remove(dialogId: string, side?: ChatDialogSide): void;
77
+ /**
78
+ * PIN `(dialogId, side)` against LRU eviction while a consumer is live.
79
+ * Returns the release fn (idempotent; refcounted, so nested retains are
80
+ * safe). Creation is NOT implied — retaining an absent key simply means the
81
+ * key is protected once it exists.
82
+ */
83
+ retain(dialogId: string, side?: ChatDialogSide): () => void;
84
+ /**
85
+ * POLICY retain: keep exactly `keys` pinned by this store-level set and
86
+ * release every key the set previously pinned. Independent of the refcounted
87
+ * `retain()` handles a host's components hold — the two compose.
88
+ *
89
+ * Exists because "retain this set, release the rest" is generic store
90
+ * policy that every multi-panel host otherwise re-derives (diffing its own
91
+ * key list against a map of release fns). Retains BEFORE releasing, so a key
92
+ * present in both the old and the new set never momentarily drops to zero
93
+ * retains and becomes evictable mid-swap.
94
+ */
95
+ setRetained(keys: Array<{
96
+ dialogId: string;
97
+ side?: ChatDialogSide;
98
+ }>): void;
99
+ }
100
+ export declare const DEFAULT_DIALOG_SIDE: ChatDialogSide;
101
+ /** Most-recently-used reducer keys retained before eviction. Ten covers
102
+ * every realistic multi-panel / dialog-switching session while bounding an
103
+ * agent that cycles hundreds of dialogs. */
104
+ export declare const DEFAULT_MAX_REDUCERS = 10;
105
+ /**
106
+ * Hard cap on keys held in the "created by `getReducer`, `retain()` still
107
+ * pending" protection set — the ONLY thing bounding the map while retains are
108
+ * outstanding, since that protection ends at the retain rather than on a timer.
109
+ *
110
+ * Deliberately far above `maxReducers`: a host may legitimately mount MORE
111
+ * panels than the LRU cap (once their effects run, retained keys already let
112
+ * the map exceed it), so capping the pending set at `maxReducers` would blank
113
+ * exactly the panels round 10 fixed. It is a backstop against a caller that
114
+ * reads a reducer once and drops it — or a concurrent render React discards
115
+ * before any effect runs — not a per-commit budget. Past it, the oldest pending
116
+ * key falls through to ordinary LRU.
117
+ */
118
+ export declare const MAX_PENDING_RETAIN_KEYS = 256;
119
+ export interface CreateChatDialogStoreOptions {
120
+ /** LRU cap on retained reducers (keys are `(dialogId, side)` pairs).
121
+ * Values < 1 are clamped to 1. Default `DEFAULT_MAX_REDUCERS`. */
122
+ maxReducers?: number;
123
+ /**
124
+ * Options applied to any reducer this store creates WITHOUT an explicit
125
+ * per-call `createOptions` — i.e. every reducer first materialized by
126
+ * `apply()` or `mutate()`. Hosts with non-default reducer semantics
127
+ * (`ownEchoIncludesAdmin`, `selfUserId`, approve/reject `callbacks`, …)
128
+ * MUST set this: creation options are consulted once, so a bare
129
+ * apply-created instance would keep those semantics missing for its whole
130
+ * lifetime, including for a later `getReducer(..., options)` caller.
131
+ */
132
+ defaultCreateOptions?: CreateReducerOptionsFn;
133
+ /**
134
+ * Called when LRU eviction actually DROPS a key. The store knows this
135
+ * exactly; without publishing it, hosts are left inferring eviction by
136
+ * comparing reducer OBJECT IDENTITY across `getReducer` calls and then
137
+ * suppressing the "pristine empty" snapshot that a silently-recreated
138
+ * reducer returns — archaeology about a fact this callback states outright.
139
+ *
140
+ * Fires only for LRU eviction. Host-initiated `remove()` needs no
141
+ * notification: the caller already knows which key it dropped.
142
+ *
143
+ * Called AFTER the key is gone, from `getReducer` (i.e. potentially during a
144
+ * React render) — treat it as a "schedule a refetch/rehydrate" signal, not a
145
+ * place to set state synchronously.
146
+ *
147
+ * `parked` carries the dropped reducer's non-refetchable state so the host
148
+ * can restore it on the recreated instance (`initializeWithState(messages,
149
+ * { approvalStatuses, lastAppliedSeq, pendingEchoes })`). Refetching
150
+ * messages alone is NOT
151
+ * equivalent: a recreated reducer starts with `approvalStatuses = {}` and
152
+ * `lastAppliedSeq = -Infinity`, so a resolved approval whose APPROVAL_RESULT
153
+ * row is not in the refetched history page re-renders as ACTIONABLE (the
154
+ * exact hazard `resetForDialogSwitch` preserves that map to avoid), and a
155
+ * replay from the host's own cursor re-applies events the dropped instance
156
+ * had already consumed.
157
+ */
158
+ onEvict?: (dialogId: string, side: ChatDialogSide, parked: EvictedReducerState) => void;
159
+ }
160
+ /**
161
+ * Snapshot of an LRU-evicted reducer's state, captured just before the
162
+ * instance is dropped. Everything here either cannot be refetched
163
+ * (`lastAppliedSeq`) or is not reliably present in a refetched history page
164
+ * (`approvalStatuses`); `messages` rides along so a host that keeps its own
165
+ * copy does not have to.
166
+ */
167
+ export interface EvictedReducerState {
168
+ messages: ChatReducerState['messages'];
169
+ approvalStatuses: ChatReducerState['approvalStatuses'];
170
+ /** `-Infinity` when the instance never applied a seq-carrying event. */
171
+ lastAppliedSeq: number;
172
+ /**
173
+ * Optimistic-echo entries still armed at eviction time. A key dropped
174
+ * between `pushOptimisticSend` and its `MESSAGE_REQUEST` echo would
175
+ * otherwise leave the recreated reducer with nothing armed, and the echo
176
+ * renders a DUPLICATE user bubble. Replay via
177
+ * `initializeWithState(messages, { pendingEchoes })`; the reducer drops
178
+ * entries already past `OWN_ECHO_AUTHOR_TTL_MS`. Empty for a key with no
179
+ * send in flight (the common case).
180
+ */
181
+ pendingEchoes: readonly PendingEcho[];
182
+ }
183
+ export declare function createChatDialogStore(options?: CreateChatDialogStoreOptions): ChatDialogStore;
184
+ //# sourceMappingURL=chat-dialog-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-dialog-store.d.ts","sourceRoot":"","sources":["../../../../src/components/chat/stream/chat-dialog-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAEpE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAA;AAEnC;gDACgD;AAChD,MAAM,MAAM,sBAAsB,GAAG,CACnC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,cAAc,KACjB,wBAAwB,CAAA;AAE7B,MAAM,WAAW,eAAe;IAC9B;6DACyD;IACzD,UAAU,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,cAAc,EACrB,aAAa,CAAC,EAAE,sBAAsB,GACrC,iBAAiB,CAAA;IACpB;8CAC0C;IAC1C,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,eAAe,GAAG,IAAI,CAAA;IAC3E,wEAAwE;IACxE,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,CAAC,GAAG,CAAC,CAAA;IAC3F,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IAC3C;;;;;;OAMG;IACH,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAA;IACtE;;kEAE8D;IAC9D,iBAAiB,IAAI,gBAAgB,CAAA;IACrC,wEAAwE;IACxE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;IACrD;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,cAAc,GAAG,MAAM,IAAI,CAAA;IAC3D;;;;;;;;;;OAUG;IACH,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,cAAc,CAAA;KAAE,CAAC,GAAG,IAAI,CAAA;CAC5E;AAED,eAAO,MAAM,mBAAmB,EAAE,cAAuB,CAAA;AAEzD;;6CAE6C;AAC7C,eAAO,MAAM,oBAAoB,KAAK,CAAA;AAEtC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAA;AAE1C,MAAM,WAAW,4BAA4B;IAC3C;uEACmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,sBAAsB,CAAA;IAC7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,OAAO,CAAC,EAAE,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,mBAAmB,KACxB,IAAI,CAAA;CACV;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAA;IACtC,gBAAgB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAA;IACtD,wEAAwE;IACxE,cAAc,EAAE,MAAM,CAAA;IACtB;;;;;;;;OAQG;IACH,aAAa,EAAE,SAAS,WAAW,EAAE,CAAA;CACtC;AAyBD,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,4BAAiC,GACzC,eAAe,CAgTjB"}