@flamingo-stack/openframe-frontend-core 0.0.467 → 0.0.468-snapshot.20260723140929

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 (289) 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-BIDOIPIT.js → chunk-2BJSRTKU.js} +2 -2
  22. package/dist/{chunk-4DFPQKKJ.js → chunk-33FDAZDB.js} +2 -2
  23. package/dist/{chunk-LOWJWKM5.js → chunk-4QDFNDVW.js} +4 -4
  24. package/dist/{chunk-72NEN4G4.cjs → chunk-4UFRQT7Z.cjs} +15 -15
  25. package/dist/{chunk-72NEN4G4.cjs.map → chunk-4UFRQT7Z.cjs.map} +1 -1
  26. package/dist/{chunk-WWC75D3J.cjs → chunk-4W54HUP7.cjs} +6853 -4609
  27. package/dist/chunk-4W54HUP7.cjs.map +1 -0
  28. package/dist/{chunk-6DZ5QOUM.cjs → chunk-5HUTT3FD.cjs} +11 -11
  29. package/dist/{chunk-6DZ5QOUM.cjs.map → chunk-5HUTT3FD.cjs.map} +1 -1
  30. package/dist/{chunk-GXXLJHQX.js → chunk-7I2QMUEZ.js} +2 -2
  31. package/dist/{chunk-QJ7NIL6A.js → chunk-AJSNF5YF.js} +6 -5
  32. package/dist/chunk-AJSNF5YF.js.map +1 -0
  33. package/dist/{chunk-NYOQNYSI.js → chunk-AW3LVWVV.js} +2 -2
  34. package/dist/{chunk-25YYEVSE.js → chunk-DG7TX763.js} +2 -2
  35. package/dist/{chunk-CZFPPNYV.js → chunk-E6O6XATC.js} +11899 -9655
  36. package/dist/chunk-E6O6XATC.js.map +1 -0
  37. package/dist/{chunk-ZYPHZ3R3.cjs → chunk-GLKULDQN.cjs} +9 -9
  38. package/dist/{chunk-ZYPHZ3R3.cjs.map → chunk-GLKULDQN.cjs.map} +1 -1
  39. package/dist/{chunk-TZSPLSDU.js → chunk-GYEZV4GK.js} +2 -2
  40. package/dist/{chunk-G5D7NRH5.cjs → chunk-LRESZO4L.cjs} +26 -26
  41. package/dist/{chunk-G5D7NRH5.cjs.map → chunk-LRESZO4L.cjs.map} +1 -1
  42. package/dist/{chunk-ABU37QSG.js → chunk-MMF6HJB7.js} +4 -4
  43. package/dist/{chunk-O7LQYYUA.cjs → chunk-MTLBBSLP.cjs} +5 -5
  44. package/dist/{chunk-O7LQYYUA.cjs.map → chunk-MTLBBSLP.cjs.map} +1 -1
  45. package/dist/{chunk-UWW4PQQS.cjs → chunk-OVIUQJ2H.cjs} +28 -27
  46. package/dist/chunk-OVIUQJ2H.cjs.map +1 -0
  47. package/dist/{chunk-3L44PPMF.js → chunk-RPAOSHBN.js} +2 -2
  48. package/dist/{chunk-VERK32MO.cjs → chunk-TOFOK7G5.cjs} +37 -37
  49. package/dist/{chunk-VERK32MO.cjs.map → chunk-TOFOK7G5.cjs.map} +1 -1
  50. package/dist/{chunk-QITN43HN.cjs → chunk-U2KPMWO6.cjs} +7 -7
  51. package/dist/{chunk-QITN43HN.cjs.map → chunk-U2KPMWO6.cjs.map} +1 -1
  52. package/dist/{chunk-YGW7T57C.cjs → chunk-V5YWOQBP.cjs} +31 -31
  53. package/dist/{chunk-YGW7T57C.cjs.map → chunk-V5YWOQBP.cjs.map} +1 -1
  54. package/dist/{chunk-ILZ66CS6.js → chunk-VUCYS36H.js} +10 -10
  55. package/dist/chunk-VUCYS36H.js.map +1 -0
  56. package/dist/{chunk-SGDXS7VT.cjs → chunk-WHWDGCQV.cjs} +60 -60
  57. package/dist/chunk-WHWDGCQV.cjs.map +1 -0
  58. package/dist/{chunk-G2H4AKL3.cjs → chunk-YXNWEVER.cjs} +62 -62
  59. package/dist/{chunk-G2H4AKL3.cjs.map → chunk-YXNWEVER.cjs.map} +1 -1
  60. package/dist/components/case-studies/index.cjs +8 -8
  61. package/dist/components/case-studies/index.js +2 -2
  62. package/dist/components/chat/chat-composer.d.ts +8 -1
  63. package/dist/components/chat/chat-composer.d.ts.map +1 -1
  64. package/dist/components/chat/chat-context-memory-bar.d.ts +37 -0
  65. package/dist/components/chat/chat-context-memory-bar.d.ts.map +1 -0
  66. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  67. package/dist/components/chat/chat-message-list.d.ts.map +1 -1
  68. package/dist/components/chat/embeddable-chat.d.ts +14 -6
  69. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  70. package/dist/components/chat/hooks/index.d.ts +0 -1
  71. package/dist/components/chat/hooks/index.d.ts.map +1 -1
  72. package/dist/components/chat/hooks/use-chat.d.ts.map +1 -1
  73. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +15 -48
  74. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  75. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +3 -47
  76. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  77. package/dist/components/chat/index.cjs +12 -2
  78. package/dist/components/chat/index.cjs.map +1 -1
  79. package/dist/components/chat/index.d.ts +2 -0
  80. package/dist/components/chat/index.d.ts.map +1 -1
  81. package/dist/components/chat/index.js +23 -13
  82. package/dist/components/chat/stream/chat-dialog-store.d.ts +184 -0
  83. package/dist/components/chat/stream/chat-dialog-store.d.ts.map +1 -0
  84. package/dist/components/chat/stream/chat-stream-reducer.d.ts +367 -0
  85. package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -0
  86. package/dist/components/chat/stream/delta-batcher.d.ts +51 -0
  87. package/dist/components/chat/stream/delta-batcher.d.ts.map +1 -0
  88. package/dist/components/chat/stream/index.d.ts +17 -0
  89. package/dist/components/chat/stream/index.d.ts.map +1 -0
  90. package/dist/components/chat/stream/message-mutations.d.ts +77 -0
  91. package/dist/components/chat/stream/message-mutations.d.ts.map +1 -0
  92. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts +22 -0
  93. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts.map +1 -0
  94. package/dist/components/chat/types/api.types.d.ts +1 -81
  95. package/dist/components/chat/types/api.types.d.ts.map +1 -1
  96. package/dist/components/chat/types/processing.types.d.ts +2 -90
  97. package/dist/components/chat/types/processing.types.d.ts.map +1 -1
  98. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts +34 -6
  99. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts.map +1 -1
  100. package/dist/components/chat/utils/index.d.ts +2 -3
  101. package/dist/components/chat/utils/index.d.ts.map +1 -1
  102. package/dist/components/chat/utils/process-historical-messages.d.ts +59 -11
  103. package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
  104. package/dist/components/contact/index.cjs +3 -3
  105. package/dist/components/contact/index.js +2 -2
  106. package/dist/components/docs/index.cjs +5 -5
  107. package/dist/components/docs/index.js +4 -4
  108. package/dist/components/embeds/index.cjs +3 -3
  109. package/dist/components/embeds/index.js +2 -2
  110. package/dist/components/faq/index.cjs +3 -3
  111. package/dist/components/faq/index.js +2 -2
  112. package/dist/components/features/index.cjs +2 -2
  113. package/dist/components/features/index.js +1 -1
  114. package/dist/components/help-center-pages/index.cjs +20 -20
  115. package/dist/components/help-center-pages/index.js +11 -11
  116. package/dist/components/index.cjs +174 -130
  117. package/dist/components/index.cjs.map +1 -1
  118. package/dist/components/index.js +65 -21
  119. package/dist/components/index.js.map +1 -1
  120. package/dist/components/navigation/index.cjs +2 -2
  121. package/dist/components/navigation/index.js +1 -1
  122. package/dist/components/onboarding-guides/index.cjs +5 -5
  123. package/dist/components/onboarding-guides/index.js +4 -4
  124. package/dist/components/onboarding-guides/onboarding-guide-detail-view.d.ts.map +1 -1
  125. package/dist/components/related-content/index.cjs +3 -3
  126. package/dist/components/related-content/index.js +2 -2
  127. package/dist/components/shared/product-release/release-detail-page.d.ts.map +1 -1
  128. package/dist/components/tickets/index.cjs +5 -5
  129. package/dist/components/tickets/index.js +4 -4
  130. package/dist/components/ui/index.cjs +46 -2
  131. package/dist/components/ui/index.cjs.map +1 -1
  132. package/dist/components/ui/index.d.ts +1 -2
  133. package/dist/components/ui/index.d.ts.map +1 -1
  134. package/dist/components/ui/index.js +57 -13
  135. package/dist/components/ui/markdown/base-components.d.ts +56 -0
  136. package/dist/components/ui/markdown/base-components.d.ts.map +1 -0
  137. package/dist/components/ui/markdown/engine.d.ts +99 -0
  138. package/dist/components/ui/markdown/engine.d.ts.map +1 -0
  139. package/dist/components/ui/markdown/heading-ids.d.ts +65 -0
  140. package/dist/components/ui/markdown/heading-ids.d.ts.map +1 -0
  141. package/dist/components/ui/markdown/index.d.ts +18 -0
  142. package/dist/components/ui/markdown/index.d.ts.map +1 -0
  143. package/dist/components/ui/markdown/mermaid-diagram.d.ts +79 -0
  144. package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +1 -0
  145. package/dist/components/ui/markdown/rich/embed-overrides.d.ts +14 -0
  146. package/dist/components/ui/markdown/rich/embed-overrides.d.ts.map +1 -0
  147. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +40 -0
  148. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -0
  149. package/dist/components/ui/markdown/rich/shortcodes.d.ts +8 -0
  150. package/dist/components/ui/markdown/rich/shortcodes.d.ts.map +1 -0
  151. package/dist/components/ui/markdown/sanitize.d.ts +153 -0
  152. package/dist/components/ui/markdown/sanitize.d.ts.map +1 -0
  153. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +23 -0
  154. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +1 -0
  155. package/dist/components/ui/markdown/streaming.d.ts +78 -0
  156. package/dist/components/ui/markdown/streaming.d.ts.map +1 -0
  157. package/dist/components/ui/markdown/text-size.d.ts +34 -0
  158. package/dist/components/ui/markdown/text-size.d.ts.map +1 -0
  159. package/dist/index.cjs +62 -2
  160. package/dist/index.cjs.map +1 -1
  161. package/dist/index.js +73 -13
  162. package/dist/utils/index.cjs +169 -40
  163. package/dist/utils/index.cjs.map +1 -1
  164. package/dist/utils/index.d.ts +1 -0
  165. package/dist/utils/index.d.ts.map +1 -1
  166. package/dist/utils/index.js +162 -41
  167. package/dist/utils/index.js.map +1 -1
  168. package/dist/utils/markdown-fences.d.ts +42 -0
  169. package/dist/utils/markdown-fences.d.ts.map +1 -0
  170. package/dist/utils/markdown-heading-id.d.ts +85 -0
  171. package/dist/utils/markdown-heading-id.d.ts.map +1 -0
  172. package/dist/utils/markdown-section-extractor.d.ts.map +1 -1
  173. package/package.json +7 -1
  174. package/src/chat-protocol/__tests__/__snapshots__/nats-decoder-golden.test.ts.snap +307 -0
  175. package/src/chat-protocol/__tests__/chat-protocol.test.ts +515 -0
  176. package/src/chat-protocol/__tests__/env-flag.test.ts +52 -0
  177. package/src/chat-protocol/__tests__/ip-normalize.test.ts +136 -0
  178. package/src/chat-protocol/__tests__/nats-decoder-golden.test.ts +228 -0
  179. package/src/chat-protocol/decode.ts +277 -0
  180. package/src/chat-protocol/encode.ts +71 -0
  181. package/src/chat-protocol/env-flag.ts +39 -0
  182. package/src/chat-protocol/events.ts +228 -0
  183. package/src/chat-protocol/frames.ts +238 -0
  184. package/src/chat-protocol/index.ts +21 -0
  185. package/src/chat-protocol/ip-normalize.ts +146 -0
  186. package/src/chat-protocol/nats-decoder.ts +252 -0
  187. package/src/components/chat/__tests__/chat-message-list.test.tsx +293 -5
  188. package/src/components/chat/__tests__/chat-message-streaming-memo.test.tsx +207 -0
  189. package/src/components/chat/__tests__/chat-pending-turn.test.tsx +209 -0
  190. package/src/components/chat/chat-composer.tsx +32 -5
  191. package/src/components/chat/chat-context-memory-bar.tsx +159 -0
  192. package/src/components/chat/chat-message-enhanced.tsx +111 -17
  193. package/src/components/chat/chat-message-list.tsx +358 -109
  194. package/src/components/chat/embeddable-chat.tsx +23 -15
  195. package/src/components/chat/hooks/.index.md +1 -1
  196. package/src/components/chat/hooks/.use-nats-chat-adapter.md +1 -1
  197. package/src/components/chat/hooks/__tests__/__snapshots__/persisted-state-v1-golden.test.ts.snap +297 -0
  198. package/src/components/chat/hooks/__tests__/__snapshots__/sse-stream-golden.test.ts.snap +0 -0
  199. package/src/components/chat/hooks/__tests__/persisted-state-v1-golden.test.ts +272 -0
  200. package/src/components/chat/hooks/__tests__/sse-stream-golden.test.ts +318 -0
  201. package/src/components/chat/hooks/index.ts +0 -1
  202. package/src/components/chat/hooks/use-chat.ts +8 -0
  203. package/src/components/chat/hooks/use-nats-chat-adapter.ts +243 -822
  204. package/src/components/chat/hooks/use-sse-chat-adapter.ts +318 -666
  205. package/src/components/chat/index.ts +6 -0
  206. package/src/components/chat/stream/__tests__/__snapshots__/chat-stream-reducer-golden.test.ts.snap +937 -0
  207. package/src/components/chat/stream/__tests__/chat-dialog-store.test.ts +756 -0
  208. package/src/components/chat/stream/__tests__/chat-stream-reducer-golden.test.ts +460 -0
  209. package/src/components/chat/stream/__tests__/chat-stream-reducer.test.ts +894 -0
  210. package/src/components/chat/stream/__tests__/delta-batcher.test.ts +255 -0
  211. package/src/components/chat/stream/__tests__/use-chat-stream-reducer.test.ts +98 -0
  212. package/src/components/chat/stream/chat-dialog-store.ts +536 -0
  213. package/src/components/chat/stream/chat-stream-reducer.ts +1796 -0
  214. package/src/components/chat/stream/delta-batcher.ts +159 -0
  215. package/src/components/chat/stream/index.ts +55 -0
  216. package/src/components/chat/stream/message-mutations.ts +338 -0
  217. package/src/components/chat/stream/use-chat-stream-reducer.ts +126 -0
  218. package/src/components/chat/thinking-display.tsx +1 -1
  219. package/src/components/chat/types/.api.types.md +1 -3
  220. package/src/components/chat/types/.processing.types.md +6 -23
  221. package/src/components/chat/types/api.types.ts +6 -73
  222. package/src/components/chat/types/processing.types.ts +11 -52
  223. package/src/components/chat/utils/.index.md +0 -5
  224. package/src/components/chat/utils/__tests__/__snapshots__/process-historical-messages-golden.test.ts.snap +418 -0
  225. package/src/components/chat/utils/__tests__/__snapshots__/segment-accumulator-golden.test.ts.snap +599 -0
  226. package/src/components/chat/utils/__tests__/process-historical-messages-golden.test.ts +317 -0
  227. package/src/components/chat/utils/__tests__/segment-accumulator-golden.test.ts +270 -0
  228. package/src/components/chat/utils/extract-incomplete-message-state.ts +63 -5
  229. package/src/components/chat/utils/index.ts +5 -8
  230. package/src/components/chat/utils/process-historical-messages.ts +352 -383
  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/release-changelog-section.tsx +1 -1
  254. package/src/components/ui/tab-selector.tsx +8 -8
  255. package/src/components/ui/ticket-info-section.tsx +1 -1
  256. package/src/utils/index.ts +1 -0
  257. package/src/utils/markdown-fences.ts +127 -0
  258. package/src/utils/markdown-heading-id.ts +348 -0
  259. package/src/utils/markdown-section-extractor.ts +41 -56
  260. package/dist/chunk-CZFPPNYV.js.map +0 -1
  261. package/dist/chunk-ILZ66CS6.js.map +0 -1
  262. package/dist/chunk-QJ7NIL6A.js.map +0 -1
  263. package/dist/chunk-SGDXS7VT.cjs.map +0 -1
  264. package/dist/chunk-UWW4PQQS.cjs.map +0 -1
  265. package/dist/chunk-WWC75D3J.cjs.map +0 -1
  266. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts +0 -6
  267. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +0 -1
  268. package/dist/components/chat/utils/chunk-parser.d.ts +0 -25
  269. package/dist/components/chat/utils/chunk-parser.d.ts.map +0 -1
  270. package/dist/components/ui/rich-markdown-renderer.d.ts +0 -34
  271. package/dist/components/ui/rich-markdown-renderer.d.ts.map +0 -1
  272. package/dist/components/ui/simple-markdown-renderer.d.ts +0 -73
  273. package/dist/components/ui/simple-markdown-renderer.d.ts.map +0 -1
  274. package/src/components/chat/hooks/.use-realtime-chunk-processor.md +0 -50
  275. package/src/components/chat/hooks/use-realtime-chunk-processor.ts +0 -479
  276. package/src/components/chat/utils/.chunk-parser.md +0 -51
  277. package/src/components/chat/utils/chunk-parser.ts +0 -255
  278. package/src/components/ui/.simple-markdown-renderer.md +0 -40
  279. package/src/components/ui/rich-markdown-renderer.tsx +0 -1223
  280. package/src/components/ui/simple-markdown-renderer.tsx +0 -965
  281. /package/dist/{chunk-BIDOIPIT.js.map → chunk-2BJSRTKU.js.map} +0 -0
  282. /package/dist/{chunk-4DFPQKKJ.js.map → chunk-33FDAZDB.js.map} +0 -0
  283. /package/dist/{chunk-LOWJWKM5.js.map → chunk-4QDFNDVW.js.map} +0 -0
  284. /package/dist/{chunk-GXXLJHQX.js.map → chunk-7I2QMUEZ.js.map} +0 -0
  285. /package/dist/{chunk-NYOQNYSI.js.map → chunk-AW3LVWVV.js.map} +0 -0
  286. /package/dist/{chunk-25YYEVSE.js.map → chunk-DG7TX763.js.map} +0 -0
  287. /package/dist/{chunk-TZSPLSDU.js.map → chunk-GYEZV4GK.js.map} +0 -0
  288. /package/dist/{chunk-ABU37QSG.js.map → chunk-MMF6HJB7.js.map} +0 -0
  289. /package/dist/{chunk-3L44PPMF.js.map → chunk-RPAOSHBN.js.map} +0 -0
@@ -60,6 +60,7 @@ import {
60
60
  ChatContainer,
61
61
  ChatContent,
62
62
  ChatContextChipStrip,
63
+ ChatContextMemoryBar,
63
64
  ChatContextPicker,
64
65
  ChatDialogModals,
65
66
  ChatFooter,
@@ -87,7 +88,9 @@ import {
87
88
  ContextMenuRow,
88
89
  CustomerInterviewCard,
89
90
  CustomerInterviewCardSkeleton,
91
+ DEFAULT_DIALOG_SIDE,
90
92
  DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID,
93
+ DEFAULT_MAX_REDUCERS,
91
94
  DataRoomDocCard,
92
95
  DataRoomDocCardSkeleton,
93
96
  DialogListItem,
@@ -112,6 +115,7 @@ import {
112
115
  ICON_REGISTRY,
113
116
  InvestorUpdateCard,
114
117
  InvestorUpdateCardSkeleton,
118
+ MAX_PENDING_RETAIN_KEYS,
115
119
  MESSAGE_ROLE,
116
120
  MESSAGE_TYPE,
117
121
  MemoizedChatMessageEnhanced,
@@ -178,8 +182,13 @@ import {
178
182
  clickupTaskUrl,
179
183
  computeHistoryPrepend,
180
184
  computeIsNewTab,
185
+ createChatDialogStore,
186
+ createChatStreamReducer,
187
+ createDeltaBatcher,
188
+ createEmptyTurnMeta,
181
189
  createMessageSegmentAccumulator,
182
190
  decideNewTab,
191
+ decodeHistoricalMessageData,
183
192
  defaultBuildProductReleaseCardProps,
184
193
  defaultTableIdForDocumentType,
185
194
  escapeMarkdownInline,
@@ -188,7 +197,7 @@ import {
188
197
  extractEntityIdFilter,
189
198
  extractErrorMessages,
190
199
  extractIncompleteMessageState,
191
- extractTextFromChunk,
200
+ extractIncompleteTailState,
192
201
  fetchEmptyStateConfig,
193
202
  fetchSlashCommands,
194
203
  flattenAssistantContent,
@@ -208,11 +217,8 @@ import {
208
217
  hideOnError,
209
218
  historicalToUnified,
210
219
  interleave,
211
- isControlChunk,
212
220
  isCrossOriginUrl,
213
- isErrorChunk,
214
221
  isHistoricalUserTurn,
215
- isMetadataChunk,
216
222
  isModifierClick,
217
223
  isQuickActionIconSpec,
218
224
  isStructuredContent,
@@ -223,7 +229,6 @@ import {
223
229
  normalizeContent,
224
230
  normalizeHistoricalMessageData,
225
231
  normalizeIconKey,
226
- parseChunkToAction,
227
232
  parseScrollAnchor,
228
233
  parseWireCommandOverride,
229
234
  processHistoricalMessages,
@@ -250,6 +255,7 @@ import {
250
255
  useChatAttachments,
251
256
  useChatCardItem,
252
257
  useChatIdentity,
258
+ useChatStreamReducer,
253
259
  useChunkCatchup,
254
260
  useCloseOnNavigation,
255
261
  useCollapsible,
@@ -259,14 +265,13 @@ import {
259
265
  useNatsChatAdapter,
260
266
  useNatsDialogSubscription,
261
267
  useProxiedImageUrl,
262
- useRealtimeChunkProcessor,
263
268
  useSSE,
264
269
  useScriptedStream,
265
270
  useSlashCommandRegistry,
266
271
  useSlashCommands,
267
272
  useSseChatAdapter,
268
273
  useUnifiedChat
269
- } from "../../chunk-CZFPPNYV.js";
274
+ } from "../../chunk-E6O6XATC.js";
270
275
  import {
271
276
  applyProxyAuth,
272
277
  clearEmbedProxyAuth,
@@ -349,6 +354,7 @@ export {
349
354
  ChatContainer,
350
355
  ChatContent,
351
356
  ChatContextChipStrip,
357
+ ChatContextMemoryBar,
352
358
  ChatContextPicker,
353
359
  ChatDialogModals,
354
360
  ChatFooter,
@@ -377,7 +383,9 @@ export {
377
383
  ContextMenuRow,
378
384
  CustomerInterviewCard,
379
385
  CustomerInterviewCardSkeleton,
386
+ DEFAULT_DIALOG_SIDE,
380
387
  DEFAULT_DOCUMENT_TYPE_TO_TABLE_ID,
388
+ DEFAULT_MAX_REDUCERS,
381
389
  DataRoomDocCard,
382
390
  DataRoomDocCardSkeleton,
383
391
  DialogListItem,
@@ -402,6 +410,7 @@ export {
402
410
  ICON_REGISTRY,
403
411
  InvestorUpdateCard,
404
412
  InvestorUpdateCardSkeleton,
413
+ MAX_PENDING_RETAIN_KEYS,
405
414
  MESSAGE_ROLE,
406
415
  MESSAGE_TYPE,
407
416
  MessageSegmentAccumulator,
@@ -470,8 +479,13 @@ export {
470
479
  clickupTaskUrl,
471
480
  computeHistoryPrepend,
472
481
  computeIsNewTab,
482
+ createChatDialogStore,
483
+ createChatStreamReducer,
484
+ createDeltaBatcher,
485
+ createEmptyTurnMeta,
473
486
  createMessageSegmentAccumulator,
474
487
  decideNewTab,
488
+ decodeHistoricalMessageData,
475
489
  defaultBuildProductReleaseCardProps,
476
490
  defaultTableIdForDocumentType,
477
491
  escapeMarkdownInline,
@@ -480,7 +494,7 @@ export {
480
494
  extractEntityIdFilter,
481
495
  extractErrorMessages,
482
496
  extractIncompleteMessageState,
483
- extractTextFromChunk,
497
+ extractIncompleteTailState,
484
498
  fetchEmptyStateConfig,
485
499
  fetchSlashCommands,
486
500
  flattenAssistantContent,
@@ -502,11 +516,8 @@ export {
502
516
  hideOnError,
503
517
  historicalToUnified,
504
518
  interleave,
505
- isControlChunk,
506
519
  isCrossOriginUrl,
507
- isErrorChunk,
508
520
  isHistoricalUserTurn,
509
- isMetadataChunk,
510
521
  isModifierClick,
511
522
  isQuickActionIconSpec,
512
523
  isStructuredContent,
@@ -517,7 +528,6 @@ export {
517
528
  normalizeContent,
518
529
  normalizeHistoricalMessageData,
519
530
  normalizeIconKey,
520
- parseChunkToAction,
521
531
  parseScrollAnchor,
522
532
  parseWireCommandOverride,
523
533
  processHistoricalMessages,
@@ -545,6 +555,7 @@ export {
545
555
  useChatAttachments,
546
556
  useChatCardItem,
547
557
  useChatIdentity,
558
+ useChatStreamReducer,
548
559
  useChunkCatchup,
549
560
  useCloseOnNavigation,
550
561
  useCollapsible,
@@ -555,7 +566,6 @@ export {
555
566
  useNatsChatAdapter,
556
567
  useNatsDialogSubscription,
557
568
  useProxiedImageUrl,
558
- useRealtimeChunkProcessor,
559
569
  useSSE,
560
570
  useScriptedStream,
561
571
  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"}