@flamingo-stack/openframe-frontend-core 0.0.492-1506.3956.1 → 0.0.492

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 (296) hide show
  1. package/dist/{chunk-KX3K2EH4.cjs → chunk-2XAAFAQT.cjs} +11 -11
  2. package/dist/{chunk-KX3K2EH4.cjs.map → chunk-2XAAFAQT.cjs.map} +1 -1
  3. package/dist/{chunk-JHEIOXXZ.js → chunk-4AWRPTKE.js} +5 -6
  4. package/dist/chunk-4AWRPTKE.js.map +1 -0
  5. package/dist/{chunk-PTXZB2KW.js → chunk-4J3CB4KO.js} +2 -2
  6. package/dist/{chunk-7N7YZCHR.cjs → chunk-4MLOMMDX.cjs} +5519 -7555
  7. package/dist/chunk-4MLOMMDX.cjs.map +1 -0
  8. package/dist/{chunk-MEMRQTOI.js → chunk-56J7RLMM.js} +10434 -12470
  9. package/dist/chunk-56J7RLMM.js.map +1 -0
  10. package/dist/{chunk-MEIGDK7M.cjs → chunk-5ICPQAUI.cjs} +60 -60
  11. package/dist/chunk-5ICPQAUI.cjs.map +1 -0
  12. package/dist/{chunk-BEEPU44B.js → chunk-5RHJVPL7.js} +10 -10
  13. package/dist/chunk-5RHJVPL7.js.map +1 -0
  14. package/dist/{chunk-XOFE2RT4.js → chunk-BTIRYGDT.js} +4 -4
  15. package/dist/{chunk-JSEJ5MH5.cjs → chunk-DY6AJNVK.cjs} +5 -5
  16. package/dist/{chunk-JSEJ5MH5.cjs.map → chunk-DY6AJNVK.cjs.map} +1 -1
  17. package/dist/{chunk-PLB6CQSO.js → chunk-FG5ALORQ.js} +2 -2
  18. package/dist/{chunk-QG2EBIH5.cjs → chunk-J2J36PEN.cjs} +31 -31
  19. package/dist/{chunk-QG2EBIH5.cjs.map → chunk-J2J36PEN.cjs.map} +1 -1
  20. package/dist/{chunk-A6FPYAUD.cjs → chunk-LIRXKEOE.cjs} +15 -15
  21. package/dist/{chunk-A6FPYAUD.cjs.map → chunk-LIRXKEOE.cjs.map} +1 -1
  22. package/dist/{chunk-MSL5NE3N.cjs → chunk-LVDI7R7T.cjs} +37 -37
  23. package/dist/{chunk-MSL5NE3N.cjs.map → chunk-LVDI7R7T.cjs.map} +1 -1
  24. package/dist/{chunk-MPUQFRJG.cjs → chunk-M4SCYPCR.cjs} +7 -7
  25. package/dist/{chunk-MPUQFRJG.cjs.map → chunk-M4SCYPCR.cjs.map} +1 -1
  26. package/dist/{chunk-QDGB2DKY.cjs → chunk-O6S6Q52W.cjs} +26 -26
  27. package/dist/{chunk-QDGB2DKY.cjs.map → chunk-O6S6Q52W.cjs.map} +1 -1
  28. package/dist/{chunk-W56JYDSC.cjs → chunk-OFFYASUY.cjs} +27 -28
  29. package/dist/chunk-OFFYASUY.cjs.map +1 -0
  30. package/dist/{chunk-NCAN6VUF.js → chunk-P3ITKTUE.js} +2 -2
  31. package/dist/{chunk-M6FEGPQJ.cjs → chunk-PI5BMKV3.cjs} +62 -62
  32. package/dist/{chunk-M6FEGPQJ.cjs.map → chunk-PI5BMKV3.cjs.map} +1 -1
  33. package/dist/{chunk-34TDA22K.js → chunk-QHRNQTW5.js} +2 -2
  34. package/dist/{chunk-OL3MJKUI.js → chunk-SZWMJIH3.js} +2 -2
  35. package/dist/{chunk-MZRIRQYV.js → chunk-U5LU56JE.js} +2 -2
  36. package/dist/{chunk-C65NCIMV.cjs → chunk-VML66FJQ.cjs} +9 -9
  37. package/dist/{chunk-C65NCIMV.cjs.map → chunk-VML66FJQ.cjs.map} +1 -1
  38. package/dist/{chunk-3LKB722U.js → chunk-WKWZ7LVC.js} +2 -2
  39. package/dist/{chunk-J3VBVR4W.js → chunk-WPFLV4QJ.js} +4 -4
  40. package/dist/components/case-studies/index.cjs +8 -8
  41. package/dist/components/case-studies/index.js +2 -2
  42. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  43. package/dist/components/chat/chat-message-list.d.ts.map +1 -1
  44. package/dist/components/chat/hooks/index.d.ts +1 -0
  45. package/dist/components/chat/hooks/index.d.ts.map +1 -1
  46. package/dist/components/chat/hooks/use-chat.d.ts.map +1 -1
  47. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +48 -15
  48. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  49. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts +6 -0
  50. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +1 -0
  51. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +57 -10
  52. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  53. package/dist/components/chat/index.cjs +2 -10
  54. package/dist/components/chat/index.cjs.map +1 -1
  55. package/dist/components/chat/index.d.ts +0 -1
  56. package/dist/components/chat/index.d.ts.map +1 -1
  57. package/dist/components/chat/index.js +13 -21
  58. package/dist/components/chat/types/api.types.d.ts +81 -1
  59. package/dist/components/chat/types/api.types.d.ts.map +1 -1
  60. package/dist/components/chat/types/processing.types.d.ts +93 -2
  61. package/dist/components/chat/types/processing.types.d.ts.map +1 -1
  62. package/dist/components/chat/utils/chunk-parser.d.ts +25 -0
  63. package/dist/components/chat/utils/chunk-parser.d.ts.map +1 -0
  64. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts +6 -34
  65. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts.map +1 -1
  66. package/dist/components/chat/utils/index.d.ts +3 -2
  67. package/dist/components/chat/utils/index.d.ts.map +1 -1
  68. package/dist/components/chat/utils/process-historical-messages.d.ts +11 -59
  69. package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
  70. package/dist/components/contact/index.cjs +3 -3
  71. package/dist/components/contact/index.js +2 -2
  72. package/dist/components/docs/index.cjs +5 -5
  73. package/dist/components/docs/index.js +4 -4
  74. package/dist/components/embeds/index.cjs +3 -3
  75. package/dist/components/embeds/index.js +2 -2
  76. package/dist/components/faq/index.cjs +3 -3
  77. package/dist/components/faq/index.js +2 -2
  78. package/dist/components/features/floating-walkthrough-video.d.ts.map +1 -1
  79. package/dist/components/features/index.cjs +2 -2
  80. package/dist/components/features/index.js +1 -1
  81. package/dist/components/help-center-pages/index.cjs +20 -20
  82. package/dist/components/help-center-pages/index.js +11 -11
  83. package/dist/components/index.cjs +130 -172
  84. package/dist/components/index.cjs.map +1 -1
  85. package/dist/components/index.js +21 -63
  86. package/dist/components/index.js.map +1 -1
  87. package/dist/components/navigation/index.cjs +2 -2
  88. package/dist/components/navigation/index.js +1 -1
  89. package/dist/components/navigation/navigation-sidebar-item.d.ts +23 -1
  90. package/dist/components/navigation/navigation-sidebar-item.d.ts.map +1 -1
  91. package/dist/components/navigation/navigation-sidebar.d.ts.map +1 -1
  92. package/dist/components/onboarding-guides/index.cjs +5 -5
  93. package/dist/components/onboarding-guides/index.js +4 -4
  94. package/dist/components/onboarding-guides/onboarding-guide-detail-view.d.ts.map +1 -1
  95. package/dist/components/related-content/index.cjs +3 -3
  96. package/dist/components/related-content/index.js +2 -2
  97. package/dist/components/shared/product-release/release-detail-page.d.ts.map +1 -1
  98. package/dist/components/tickets/index.cjs +5 -5
  99. package/dist/components/tickets/index.js +4 -4
  100. package/dist/components/ui/data-table/data-table-column-filter.d.ts.map +1 -1
  101. package/dist/components/ui/data-table/data-table-header.d.ts.map +1 -1
  102. package/dist/components/ui/data-table/data-table-skeleton.d.ts.map +1 -1
  103. package/dist/components/ui/index.cjs +2 -44
  104. package/dist/components/ui/index.cjs.map +1 -1
  105. package/dist/components/ui/index.d.ts +2 -1
  106. package/dist/components/ui/index.d.ts.map +1 -1
  107. package/dist/components/ui/index.js +13 -55
  108. package/dist/components/ui/rich-markdown-renderer.d.ts +34 -0
  109. package/dist/components/ui/rich-markdown-renderer.d.ts.map +1 -0
  110. package/dist/components/ui/simple-markdown-renderer.d.ts +73 -0
  111. package/dist/components/ui/simple-markdown-renderer.d.ts.map +1 -0
  112. package/dist/components/ui/tab-navigation.d.ts.map +1 -1
  113. package/dist/index.cjs +2 -60
  114. package/dist/index.cjs.map +1 -1
  115. package/dist/index.js +13 -71
  116. package/dist/utils/index.cjs +40 -169
  117. package/dist/utils/index.cjs.map +1 -1
  118. package/dist/utils/index.d.ts +0 -1
  119. package/dist/utils/index.d.ts.map +1 -1
  120. package/dist/utils/index.js +41 -162
  121. package/dist/utils/index.js.map +1 -1
  122. package/dist/utils/markdown-section-extractor.d.ts.map +1 -1
  123. package/package.json +1 -7
  124. package/src/components/chat/__tests__/chat-message-list.test.tsx +5 -293
  125. package/src/components/chat/chat-message-enhanced.tsx +20 -122
  126. package/src/components/chat/chat-message-list.tsx +109 -358
  127. package/src/components/chat/embeddable-chat.tsx +0 -6
  128. package/src/components/chat/hooks/.index.md +33 -30
  129. package/src/components/chat/hooks/.use-nats-chat-adapter.md +55 -36
  130. package/src/components/chat/hooks/.use-realtime-chunk-processor.md +77 -0
  131. package/src/components/chat/hooks/index.ts +1 -0
  132. package/src/components/chat/hooks/use-chat.ts +0 -8
  133. package/src/components/chat/hooks/use-nats-chat-adapter.ts +825 -243
  134. package/src/components/chat/hooks/use-realtime-chunk-processor.ts +489 -0
  135. package/src/components/chat/hooks/use-sse-chat-adapter.ts +684 -380
  136. package/src/components/chat/index.ts +0 -5
  137. package/src/components/chat/thinking-display.tsx +1 -1
  138. package/src/components/chat/types/.api.types.md +49 -39
  139. package/src/components/chat/types/.processing.types.md +58 -29
  140. package/src/components/chat/types/api.types.ts +73 -6
  141. package/src/components/chat/types/processing.types.ts +53 -11
  142. package/src/components/chat/utils/.chunk-parser.md +62 -0
  143. package/src/components/chat/utils/.index.md +40 -31
  144. package/src/components/chat/utils/chunk-parser.ts +262 -0
  145. package/src/components/chat/utils/extract-incomplete-message-state.ts +5 -63
  146. package/src/components/chat/utils/index.ts +8 -5
  147. package/src/components/chat/utils/process-historical-messages.ts +386 -358
  148. package/src/components/features/floating-walkthrough-video.tsx +3 -1
  149. package/src/components/navigation/navigation-sidebar-item.tsx +80 -30
  150. package/src/components/navigation/navigation-sidebar.tsx +106 -46
  151. package/src/components/onboarding-guides/onboarding-guide-detail-view.tsx +4 -22
  152. package/src/components/shared/legal-document/legal-document-page.tsx +1 -1
  153. package/src/components/shared/product-release/release-detail-page.tsx +4 -19
  154. package/src/components/ui/.simple-markdown-renderer.md +52 -0
  155. package/src/components/ui/__tests__/tab-navigation.test.tsx +159 -0
  156. package/src/components/ui/data-table/data-table-column-filter.tsx +7 -1
  157. package/src/components/ui/data-table/data-table-header.tsx +4 -1
  158. package/src/components/ui/data-table/data-table-skeleton.tsx +7 -0
  159. package/src/components/ui/index.ts +2 -1
  160. package/src/components/ui/release-changelog-section.tsx +1 -1
  161. package/src/components/ui/rich-markdown-renderer.tsx +1223 -0
  162. package/src/components/ui/simple-markdown-renderer.tsx +964 -0
  163. package/src/components/ui/tab-navigation.tsx +370 -171
  164. package/src/components/ui/ticket-info-section.tsx +1 -1
  165. package/src/utils/index.ts +0 -1
  166. package/src/utils/markdown-section-extractor.ts +56 -41
  167. package/dist/chat-protocol/decode.d.ts +0 -58
  168. package/dist/chat-protocol/decode.d.ts.map +0 -1
  169. package/dist/chat-protocol/encode.d.ts +0 -44
  170. package/dist/chat-protocol/encode.d.ts.map +0 -1
  171. package/dist/chat-protocol/env-flag.d.ts +0 -35
  172. package/dist/chat-protocol/env-flag.d.ts.map +0 -1
  173. package/dist/chat-protocol/events.d.ts +0 -207
  174. package/dist/chat-protocol/events.d.ts.map +0 -1
  175. package/dist/chat-protocol/frames.d.ts +0 -213
  176. package/dist/chat-protocol/frames.d.ts.map +0 -1
  177. package/dist/chat-protocol/index.cjs +0 -500
  178. package/dist/chat-protocol/index.cjs.map +0 -1
  179. package/dist/chat-protocol/index.d.ts +0 -18
  180. package/dist/chat-protocol/index.d.ts.map +0 -1
  181. package/dist/chat-protocol/index.js +0 -484
  182. package/dist/chat-protocol/index.js.map +0 -1
  183. package/dist/chat-protocol/ip-normalize.d.ts +0 -44
  184. package/dist/chat-protocol/ip-normalize.d.ts.map +0 -1
  185. package/dist/chat-protocol/nats-decoder.d.ts +0 -26
  186. package/dist/chat-protocol/nats-decoder.d.ts.map +0 -1
  187. package/dist/chunk-7N7YZCHR.cjs.map +0 -1
  188. package/dist/chunk-BEEPU44B.js.map +0 -1
  189. package/dist/chunk-JHEIOXXZ.js.map +0 -1
  190. package/dist/chunk-MEIGDK7M.cjs.map +0 -1
  191. package/dist/chunk-MEMRQTOI.js.map +0 -1
  192. package/dist/chunk-W56JYDSC.cjs.map +0 -1
  193. package/dist/components/chat/stream/chat-dialog-store.d.ts +0 -184
  194. package/dist/components/chat/stream/chat-dialog-store.d.ts.map +0 -1
  195. package/dist/components/chat/stream/chat-stream-reducer.d.ts +0 -367
  196. package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +0 -1
  197. package/dist/components/chat/stream/delta-batcher.d.ts +0 -51
  198. package/dist/components/chat/stream/delta-batcher.d.ts.map +0 -1
  199. package/dist/components/chat/stream/index.d.ts +0 -17
  200. package/dist/components/chat/stream/index.d.ts.map +0 -1
  201. package/dist/components/chat/stream/message-mutations.d.ts +0 -77
  202. package/dist/components/chat/stream/message-mutations.d.ts.map +0 -1
  203. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts +0 -22
  204. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts.map +0 -1
  205. package/dist/components/ui/markdown/base-components.d.ts +0 -51
  206. package/dist/components/ui/markdown/base-components.d.ts.map +0 -1
  207. package/dist/components/ui/markdown/engine.d.ts +0 -99
  208. package/dist/components/ui/markdown/engine.d.ts.map +0 -1
  209. package/dist/components/ui/markdown/heading-ids.d.ts +0 -65
  210. package/dist/components/ui/markdown/heading-ids.d.ts.map +0 -1
  211. package/dist/components/ui/markdown/index.d.ts +0 -18
  212. package/dist/components/ui/markdown/index.d.ts.map +0 -1
  213. package/dist/components/ui/markdown/mermaid-diagram.d.ts +0 -79
  214. package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +0 -1
  215. package/dist/components/ui/markdown/rich/embed-overrides.d.ts +0 -14
  216. package/dist/components/ui/markdown/rich/embed-overrides.d.ts.map +0 -1
  217. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +0 -40
  218. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +0 -1
  219. package/dist/components/ui/markdown/rich/shortcodes.d.ts +0 -8
  220. package/dist/components/ui/markdown/rich/shortcodes.d.ts.map +0 -1
  221. package/dist/components/ui/markdown/sanitize.d.ts +0 -153
  222. package/dist/components/ui/markdown/sanitize.d.ts.map +0 -1
  223. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +0 -23
  224. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +0 -1
  225. package/dist/components/ui/markdown/streaming.d.ts +0 -78
  226. package/dist/components/ui/markdown/streaming.d.ts.map +0 -1
  227. package/dist/components/ui/markdown/text-size.d.ts +0 -34
  228. package/dist/components/ui/markdown/text-size.d.ts.map +0 -1
  229. package/dist/utils/markdown-fences.d.ts +0 -42
  230. package/dist/utils/markdown-fences.d.ts.map +0 -1
  231. package/dist/utils/markdown-heading-id.d.ts +0 -85
  232. package/dist/utils/markdown-heading-id.d.ts.map +0 -1
  233. package/src/chat-protocol/__tests__/__snapshots__/nats-decoder-golden.test.ts.snap +0 -317
  234. package/src/chat-protocol/__tests__/chat-protocol.test.ts +0 -516
  235. package/src/chat-protocol/__tests__/env-flag.test.ts +0 -52
  236. package/src/chat-protocol/__tests__/ip-normalize.test.ts +0 -136
  237. package/src/chat-protocol/__tests__/nats-decoder-golden.test.ts +0 -232
  238. package/src/chat-protocol/decode.ts +0 -278
  239. package/src/chat-protocol/encode.ts +0 -71
  240. package/src/chat-protocol/env-flag.ts +0 -39
  241. package/src/chat-protocol/events.ts +0 -245
  242. package/src/chat-protocol/frames.ts +0 -245
  243. package/src/chat-protocol/index.ts +0 -21
  244. package/src/chat-protocol/ip-normalize.ts +0 -146
  245. package/src/chat-protocol/nats-decoder.ts +0 -258
  246. package/src/components/chat/__tests__/chat-message-streaming-memo.test.tsx +0 -207
  247. package/src/components/chat/__tests__/chat-pending-turn.test.tsx +0 -230
  248. package/src/components/chat/hooks/__tests__/__snapshots__/conversation-id-persistence-golden.test.ts.snap +0 -37
  249. package/src/components/chat/hooks/__tests__/__snapshots__/sse-stream-golden.test.ts.snap +0 -0
  250. package/src/components/chat/hooks/__tests__/conversation-id-persistence-golden.test.ts +0 -438
  251. package/src/components/chat/hooks/__tests__/sse-stream-golden.test.ts +0 -318
  252. package/src/components/chat/stream/__tests__/__snapshots__/chat-stream-reducer-golden.test.ts.snap +0 -940
  253. package/src/components/chat/stream/__tests__/chat-dialog-store.test.ts +0 -756
  254. package/src/components/chat/stream/__tests__/chat-stream-reducer-golden.test.ts +0 -460
  255. package/src/components/chat/stream/__tests__/chat-stream-reducer.test.ts +0 -973
  256. package/src/components/chat/stream/__tests__/delta-batcher.test.ts +0 -255
  257. package/src/components/chat/stream/__tests__/use-chat-stream-reducer.test.ts +0 -98
  258. package/src/components/chat/stream/chat-dialog-store.ts +0 -536
  259. package/src/components/chat/stream/chat-stream-reducer.ts +0 -1808
  260. package/src/components/chat/stream/delta-batcher.ts +0 -168
  261. package/src/components/chat/stream/index.ts +0 -55
  262. package/src/components/chat/stream/message-mutations.ts +0 -340
  263. package/src/components/chat/stream/use-chat-stream-reducer.ts +0 -126
  264. package/src/components/chat/utils/__tests__/__snapshots__/process-historical-messages-golden.test.ts.snap +0 -420
  265. package/src/components/chat/utils/__tests__/__snapshots__/segment-accumulator-golden.test.ts.snap +0 -605
  266. package/src/components/chat/utils/__tests__/process-historical-messages-golden.test.ts +0 -394
  267. package/src/components/chat/utils/__tests__/segment-accumulator-golden.test.ts +0 -270
  268. package/src/components/ui/__tests__/__snapshots__/markdown-parity.test.tsx.snap +0 -2420
  269. package/src/components/ui/__tests__/markdown-parity.test.tsx +0 -2528
  270. package/src/components/ui/markdown/__tests__/mermaid-security.test.ts +0 -115
  271. package/src/components/ui/markdown/__tests__/mermaid-stale-render.test.tsx +0 -95
  272. package/src/components/ui/markdown/__tests__/sanitize-invariant.test.ts +0 -309
  273. package/src/components/ui/markdown/__tests__/streaming.test.tsx +0 -388
  274. package/src/components/ui/markdown/base-components.tsx +0 -360
  275. package/src/components/ui/markdown/engine.tsx +0 -315
  276. package/src/components/ui/markdown/heading-ids.ts +0 -239
  277. package/src/components/ui/markdown/index.ts +0 -49
  278. package/src/components/ui/markdown/mermaid-diagram.tsx +0 -291
  279. package/src/components/ui/markdown/rich/embed-overrides.tsx +0 -199
  280. package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +0 -184
  281. package/src/components/ui/markdown/rich/shortcodes.ts +0 -170
  282. package/src/components/ui/markdown/sanitize.ts +0 -3499
  283. package/src/components/ui/markdown/simple-markdown-renderer.tsx +0 -28
  284. package/src/components/ui/markdown/streaming.ts +0 -362
  285. package/src/components/ui/markdown/text-size.ts +0 -106
  286. package/src/utils/markdown-fences.ts +0 -127
  287. package/src/utils/markdown-heading-id.ts +0 -348
  288. /package/dist/{chunk-PTXZB2KW.js.map → chunk-4J3CB4KO.js.map} +0 -0
  289. /package/dist/{chunk-XOFE2RT4.js.map → chunk-BTIRYGDT.js.map} +0 -0
  290. /package/dist/{chunk-PLB6CQSO.js.map → chunk-FG5ALORQ.js.map} +0 -0
  291. /package/dist/{chunk-NCAN6VUF.js.map → chunk-P3ITKTUE.js.map} +0 -0
  292. /package/dist/{chunk-34TDA22K.js.map → chunk-QHRNQTW5.js.map} +0 -0
  293. /package/dist/{chunk-OL3MJKUI.js.map → chunk-SZWMJIH3.js.map} +0 -0
  294. /package/dist/{chunk-MZRIRQYV.js.map → chunk-U5LU56JE.js.map} +0 -0
  295. /package/dist/{chunk-3LKB722U.js.map → chunk-WKWZ7LVC.js.map} +0 -0
  296. /package/dist/{chunk-J3VBVR4W.js.map → chunk-WPFLV4QJ.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"markdown-section-extractor.d.ts","sourceRoot":"","sources":["../../src/utils/markdown-section-extractor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAUH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uDAAuD;IACvD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,8EAA8E;IAC9E,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAUD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,sBAA2B,GACnC,eAAe,EAAE,CA+CnB"}
1
+ {"version":3,"file":"markdown-section-extractor.d.ts","sourceRoot":"","sources":["../../src/utils/markdown-section-extractor.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,uDAAuD;IACvD,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,8EAA8E;IAC9E,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,4DAA4D;IAC5D,qBAAqB,CAAC,EAAE,OAAO,CAAA;CAChC;AAUD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,sBAA2B,GACnC,eAAe,EAAE,CAoEnB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flamingo-stack/openframe-frontend-core",
3
- "version": "0.0.492-1506.3956.1",
3
+ "version": "0.0.492",
4
4
  "description": "Shared design system and components for all Flamingo platforms",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -102,12 +102,6 @@
102
102
  "require": "./dist/platform-domains.cjs",
103
103
  "default": "./dist/platform-domains.js"
104
104
  },
105
- "./chat-protocol": {
106
- "types": "./dist/chat-protocol/index.d.ts",
107
- "import": "./dist/chat-protocol/index.js",
108
- "require": "./dist/chat-protocol/index.cjs",
109
- "default": "./dist/chat-protocol/index.js"
110
- },
111
105
  "./components/ui/file-manager": {
112
106
  "types": "./dist/components/ui/file-manager/index.d.ts",
113
107
  "import": "./dist/components/ui/file-manager/index.js",
@@ -1,4 +1,4 @@
1
- import { act, render } from '@testing-library/react'
1
+ import { render } from '@testing-library/react'
2
2
  import { beforeEach, describe, expect, it, vi } from 'vitest'
3
3
  import type { Message } from '../types/message.types'
4
4
 
@@ -26,16 +26,9 @@ vi.mock('use-stick-to-bottom', () => ({
26
26
 
27
27
  // Keep the row renderer trivial — these tests exercise ChatMessageList's
28
28
  // scroll orchestration, not markdown rendering.
29
- // Forwards the ref because the list registers each row element for the
30
- // per-message `scrollAnchor: 'top'` path.
31
- vi.mock('../chat-message-enhanced', async () => {
32
- const { forwardRef } = await import('react')
33
- return {
34
- ChatMessageEnhanced: forwardRef<HTMLDivElement, { content: string }>(({ content }, ref) => (
35
- <div ref={ref}>{content}</div>
36
- )),
37
- }
38
- })
29
+ vi.mock('../chat-message-enhanced', () => ({
30
+ ChatMessageEnhanced: ({ content }: { content: string }) => <div>{content}</div>,
31
+ }))
39
32
 
40
33
  import { ChatMessageList } from '../chat-message-list'
41
34
 
@@ -47,36 +40,7 @@ class ObserverStub {
47
40
  disconnect() {}
48
41
  }
49
42
  vi.stubGlobal('IntersectionObserver', ObserverStub)
50
-
51
- // Recording RO so the bottom-follow tests can drive a resize by hand.
52
- const resizeCallbacks: Array<() => void> = []
53
- class RecordingResizeObserver {
54
- constructor(cb: () => void) {
55
- resizeCallbacks.push(cb)
56
- }
57
- observe() {}
58
- unobserve() {}
59
- disconnect() {}
60
- }
61
- vi.stubGlobal('ResizeObserver', RecordingResizeObserver)
62
- /** Fire every live ResizeObserver callback — same effect as any content
63
- * or scroller-box size change in the real DOM. */
64
- const fireResize = () => {
65
- for (const cb of resizeCallbacks) cb()
66
- }
67
-
68
- /** jsdom has no layout, so every box metric reads 0. The jump-to-bottom
69
- * button is driven off real geometry, so the tests supply it. */
70
- const setGeometry = (geo: { scrollHeight: number; clientHeight: number; scrollTop: number }) => {
71
- const el = scrollRefMock.current
72
- if (!el) throw new Error('scroller not mounted')
73
- for (const [key, value] of Object.entries(geo)) {
74
- Object.defineProperty(el, key, { value, configurable: true, writable: true })
75
- }
76
- }
77
-
78
- // jsdom has no layout, so `scrollIntoView` is undefined.
79
- Element.prototype.scrollIntoView = vi.fn()
43
+ vi.stubGlobal('ResizeObserver', ObserverStub)
80
44
 
81
45
  const msg = (id: string, role: Message['role']): Message => ({
82
46
  id,
@@ -126,255 +90,3 @@ describe('ChatMessageList force-scroll decisions', () => {
126
90
  expect(scrollToBottom).not.toHaveBeenCalled()
127
91
  })
128
92
  })
129
-
130
- // The library's own `isAtBottom` lock is lost silently when the scroller's
131
- // box changes (source chips mounting below it) or when a card settling out
132
- // of its skeleton produces a resize-driven scroll the library reads as a
133
- // user gesture. The list therefore owns the INTENT and re-asserts on every
134
- // geometry change until a real gesture releases it.
135
- describe('ChatMessageList bottom-follow intent', () => {
136
- beforeEach(() => {
137
- scrollToBottom.mockClear()
138
- resizeCallbacks.length = 0
139
- })
140
-
141
- const sendTurn = () => {
142
- const initial = [msg('m1', 'user'), msg('m2', 'assistant')]
143
- const view = render(<ChatMessageList dialogId="d1" messages={initial} />)
144
- // A user send arms the follow intent for the whole turn.
145
- view.rerender(<ChatMessageList dialogId="d1" messages={[...initial, msg('m3', 'user')]} />)
146
- scrollToBottom.mockClear()
147
- return view
148
- }
149
-
150
- it('re-asserts the bottom on geometry changes after the send', () => {
151
- sendTurn()
152
- fireResize()
153
- expect(scrollToBottom).toHaveBeenCalled()
154
- })
155
-
156
- it('keeps re-asserting for late async growth (cards + covers resolving)', () => {
157
- sendTurn()
158
- fireResize()
159
- fireResize()
160
- fireResize()
161
- expect(scrollToBottom).toHaveBeenCalledTimes(3)
162
- })
163
-
164
- it('releases the intent once the user scrolls up', () => {
165
- sendTurn()
166
- scrollRefMock.current?.dispatchEvent(
167
- new WheelEvent('wheel', { deltaY: -120, bubbles: true }),
168
- )
169
- fireResize()
170
- expect(scrollToBottom).not.toHaveBeenCalled()
171
- })
172
-
173
- it('ignores downward wheel (never an escape from the bottom)', () => {
174
- sendTurn()
175
- scrollRefMock.current?.dispatchEvent(
176
- new WheelEvent('wheel', { deltaY: 120, bubbles: true }),
177
- )
178
- fireResize()
179
- expect(scrollToBottom).toHaveBeenCalled()
180
- })
181
-
182
- it('does not follow when autoScroll is off (passive demo hosts)', () => {
183
- const initial = [msg('m1', 'user'), msg('m2', 'assistant')]
184
- const { rerender } = render(
185
- <ChatMessageList dialogId="d1" messages={initial} autoScroll={false} />,
186
- )
187
- rerender(
188
- <ChatMessageList dialogId="d1" messages={[...initial, msg('m3', 'user')]} autoScroll={false} />,
189
- )
190
- scrollToBottom.mockClear()
191
- fireResize()
192
- expect(scrollToBottom).not.toHaveBeenCalled()
193
- })
194
-
195
- it('hides jump-to-bottom while the thread is at the bottom', () => {
196
- const view = sendTurn()
197
- setGeometry({ scrollHeight: 1000, clientHeight: 500, scrollTop: 500 })
198
- act(() => fireResize())
199
- expect(view.queryByLabelText('Scroll to latest message')).toBeNull()
200
- })
201
-
202
- it('shows jump-to-bottom once the thread is away from the bottom', () => {
203
- const view = sendTurn()
204
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 500 })
205
- act(() => fireResize())
206
- expect(view.queryByLabelText('Scroll to latest message')).not.toBeNull()
207
- })
208
-
209
- it('re-arms the intent when the user clicks jump-to-bottom', () => {
210
- const view = sendTurn()
211
- // User scrolls away: intent released, button appears.
212
- scrollRefMock.current?.dispatchEvent(
213
- new WheelEvent('wheel', { deltaY: -120, bubbles: true }),
214
- )
215
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 500 })
216
- act(() => fireResize())
217
- expect(scrollToBottom).not.toHaveBeenCalled()
218
-
219
- const button = view.getByLabelText('Scroll to latest message')
220
- act(() => {
221
- button.click()
222
- })
223
- expect(scrollToBottom).toHaveBeenCalled()
224
-
225
- // …and the click re-armed the lock, so growth follows again.
226
- scrollToBottom.mockClear()
227
- act(() => fireResize())
228
- expect(scrollToBottom).toHaveBeenCalled()
229
- })
230
-
231
- // A drag that ends OUTSIDE the window (button released off-screen, or the
232
- // tab losing focus mid-drag) never delivers `pointerup`, so a naive
233
- // `pointerDown` flag stays true forever. Afterwards the very thing this
234
- // component exists for — a fetch-mode card settling from skeleton to a
235
- // SHORTER height, which clamps scrollTop down — is misread as a scroll-up
236
- // gesture and silently drops the lock.
237
- const dragThenScrollDown = (endEvent: { target: 'window'; type: string }) => {
238
- sendTurn()
239
- // Park away from the bottom so the at-bottom re-arm below can't mask the
240
- // result, and seed `lastScrollTop`.
241
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 4000 })
242
- window.dispatchEvent(new Event('pointerdown'))
243
- act(() => {
244
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
245
- })
246
- // Drag ends where we can't see it.
247
- if (endEvent.target === 'window') window.dispatchEvent(new Event(endEvent.type))
248
- // Resize clamp: content shrank, scrollTop drops. NOT a gesture.
249
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 3800 })
250
- act(() => {
251
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
252
- })
253
- scrollToBottom.mockClear()
254
- act(() => fireResize())
255
- }
256
-
257
- it('keeps the intent when a pointercancel ended the drag (resize clamp is not a gesture)', () => {
258
- dragThenScrollDown({ target: 'window', type: 'pointercancel' })
259
- expect(scrollToBottom).toHaveBeenCalled()
260
- })
261
-
262
- it('keeps the intent when the window lost focus mid-drag', () => {
263
- dragThenScrollDown({ target: 'window', type: 'blur' })
264
- expect(scrollToBottom).toHaveBeenCalled()
265
- })
266
-
267
- // Focus events do not bubble but they DO capture, so a capture-phase `blur`
268
- // listener on `window` fires for EVERY element blur in the document — the
269
- // classic focus-delegation idiom. Registering the drag-end `blur` that way
270
- // made any focus change during a pointer hold (most commonly the chat input
271
- // blurring as the user presses down on the scrollbar) clear `pointerDown`,
272
- // which is exactly what re-opens the yank-back-mid-drag bug. Only a TRUE
273
- // window blur (which targets `window` itself) may end the drag.
274
- it('a descendant element losing focus does not end the drag', () => {
275
- sendTurn()
276
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 4000 })
277
- window.dispatchEvent(new Event('pointerdown'))
278
- act(() => {
279
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
280
- })
281
- // The chat input loses focus as the pointer goes down elsewhere.
282
- const input = document.createElement('input')
283
- document.body.appendChild(input)
284
- input.focus()
285
- input.blur()
286
- input.remove()
287
- // The drag is still live, so this held scroll-up IS a gesture.
288
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 3800 })
289
- act(() => {
290
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
291
- })
292
- scrollToBottom.mockClear()
293
- act(() => fireResize())
294
- expect(scrollToBottom).not.toHaveBeenCalled()
295
- window.dispatchEvent(new Event('pointerup'))
296
- })
297
-
298
- it('still disarms on a genuine scrollbar drag upward', () => {
299
- sendTurn()
300
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 4000 })
301
- window.dispatchEvent(new Event('pointerdown'))
302
- act(() => {
303
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
304
- })
305
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 3800 })
306
- act(() => {
307
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
308
- })
309
- scrollToBottom.mockClear()
310
- act(() => fireResize())
311
- expect(scrollToBottom).not.toHaveBeenCalled()
312
- window.dispatchEvent(new Event('pointerup'))
313
- })
314
-
315
- // Scrolling back down to the live end by hand expresses exactly the intent
316
- // the jump-to-bottom button does — the lock has to re-arm, or the thread
317
- // renders at-bottom (button hidden) and then silently drifts away.
318
- it('re-arms the intent when the user scrolls back to the bottom by hand', () => {
319
- sendTurn()
320
- scrollRefMock.current?.dispatchEvent(new WheelEvent('wheel', { deltaY: -120, bubbles: true }))
321
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 500 })
322
- act(() => fireResize())
323
- expect(scrollToBottom).not.toHaveBeenCalled()
324
-
325
- // …and back down to the end.
326
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 19500 })
327
- act(() => {
328
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
329
- })
330
- scrollToBottom.mockClear()
331
- act(() => fireResize())
332
- expect(scrollToBottom).toHaveBeenCalled()
333
- })
334
-
335
- it('does not re-arm while the user is still parked above the bottom', () => {
336
- sendTurn()
337
- scrollRefMock.current?.dispatchEvent(new WheelEvent('wheel', { deltaY: -120, bubbles: true }))
338
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 8000 })
339
- act(() => {
340
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
341
- })
342
- scrollToBottom.mockClear()
343
- act(() => fireResize())
344
- expect(scrollToBottom).not.toHaveBeenCalled()
345
- })
346
-
347
- // A short scrollbar drag that starts at the live end and stays inside the
348
- // 70px band disarms on the gesture and would immediately re-arm on the very
349
- // same scroll event if the re-arm didn't wait for the drag to END — yanking
350
- // the reader back down mid-drag, a miniature of the bug this block exists
351
- // to prevent.
352
- it('does not re-arm mid-drag when the drag stays inside the bottom band', () => {
353
- sendTurn()
354
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 19500 })
355
- act(() => {
356
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
357
- })
358
- window.dispatchEvent(new Event('pointerdown'))
359
- setGeometry({ scrollHeight: 20000, clientHeight: 500, scrollTop: 19460 })
360
- act(() => {
361
- scrollRefMock.current?.dispatchEvent(new Event('scroll'))
362
- })
363
- scrollToBottom.mockClear()
364
- act(() => fireResize())
365
- expect(scrollToBottom).not.toHaveBeenCalled()
366
- window.dispatchEvent(new Event('pointerup'))
367
- })
368
-
369
- it('releases the intent for a top-anchored turn (it parks at the message top)', () => {
370
- const initial = [msg('m1', 'user'), msg('m2', 'assistant')]
371
- const { rerender } = render(<ChatMessageList dialogId="d1" messages={initial} />)
372
- const sent = [...initial, msg('m3', 'user')]
373
- rerender(<ChatMessageList dialogId="d1" messages={sent} />)
374
- const anchored: Message = { ...msg('m4', 'assistant'), scrollAnchor: 'top' }
375
- rerender(<ChatMessageList dialogId="d1" messages={[...sent, anchored]} />)
376
- scrollToBottom.mockClear()
377
- fireResize()
378
- expect(scrollToBottom).not.toHaveBeenCalled()
379
- })
380
- })
@@ -1,6 +1,6 @@
1
1
  "use client"
2
2
 
3
- import React, { forwardRef, memo, useEffect, useMemo, useRef } from "react"
3
+ import React, { forwardRef, memo, useMemo, useRef } from "react"
4
4
  import { cn } from "../../utils/cn"
5
5
  import { isToday } from "../../utils/date-utils"
6
6
  import { formatDate, formatTime } from "../../utils/format-date"
@@ -12,7 +12,7 @@ import { ErrorMessageDisplay } from "./error-message-display"
12
12
  import { ContextCompactionDisplay } from "./context-compaction-display"
13
13
  import { ThinkingDisplay } from "./thinking-display"
14
14
  import { GuideDisplay } from "./guide-display"
15
- import { SimpleMarkdownRenderer } from "../ui/markdown/simple-markdown-renderer"
15
+ import { SimpleMarkdownRenderer } from "../ui/simple-markdown-renderer"
16
16
  import type { ChatRef } from "./chat-ref.types"
17
17
  import { remarkCardLinks } from "./remark-card-links"
18
18
  import { remarkMentionChips } from "./remark-mention-chips"
@@ -164,9 +164,9 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
164
164
  | { kind: 'text'; text: string }
165
165
  | { kind: 'block'; key: string; node: React.ReactNode }
166
166
  const partsBySegment = new Map<number, SegmentPart[]>()
167
- const usedKeys = new Set<string>()
168
- if (!render) return { inlineByKey, partsBySegment, usedKeys }
167
+ if (!render) return { inlineByKey, partsBySegment }
169
168
  const cache = renderedCardNodeCache.current
169
+ const usedKeys = new Set<string>()
170
170
  // Card keys already emitted as a hoisted block (`b-<key>`). The same
171
171
  // marker can legitimately appear twice in one message (LLM references
172
172
  // the same entity twice); we hoist the FIRST occurrence and skip the
@@ -281,99 +281,20 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
281
281
  partsBySegment.set(segIdx, parts)
282
282
  }
283
283
  })
284
- return { inlineByKey, partsBySegment, usedKeys }
285
- }, [hasMarkerSupport, chatRefs, renderEntityCard, segments])
286
-
287
- // Drop cached nodes for markers no longer present so the cache can't grow
288
- // unbounded as a long message's markers change. Deliberately an EFFECT,
289
- // not part of the memo above: pruning is a mutation, and doing it in the
290
- // render phase is non-idempotent (StrictMode's double-invoke, or a render
291
- // React throws away, would evict nodes the committed tree still uses and
292
- // remount the cards it was built to preserve).
293
- useEffect(() => {
294
- const cache = renderedCardNodeCache.current
295
- const usedKeys = renderingPlan?.usedKeys
296
- if (!usedKeys) return
297
- if (cache.size <= usedKeys.size) return
298
- for (const k of [...cache.keys()]) {
299
- if (!usedKeys.has(k)) cache.delete(k)
284
+ // Drop cached nodes for markers no longer present so the cache can't
285
+ // grow unbounded as a long message's markers change.
286
+ if (cache.size > usedKeys.size) {
287
+ for (const k of cache.keys()) {
288
+ if (!usedKeys.has(k)) cache.delete(k)
289
+ }
300
290
  }
301
- }, [renderingPlan])
302
-
303
- // The plan is read through a REF inside the `<a>` override, not captured
304
- // in the override's closure. `renderingPlan` is rebuilt on every text
305
- // delta (its `segments` dep is a fresh array per delta), so depending on
306
- // it here would give `cardComponentOverrides` a new identity every token
307
- // — which re-creates the markdown engine's `components` memo and defeats
308
- // its per-block `StreamingBlockRenderer` memoization for the WHOLE
309
- // message, on every token. The ref keeps the override identity stable
310
- // while still reading the current plan at call time.
311
- const renderingPlanRef = useRef(renderingPlan)
312
- renderingPlanRef.current = renderingPlan
313
- const chatRefsRef = useRef(chatRefs)
314
- chatRefsRef.current = chatRefs
315
-
316
- // Ref-SET token. The override reads `chatRefsRef` at CALL time, but the
317
- // markdown engine memoizes completed blocks on the override map's
318
- // identity — so on a COMPLETED (no longer streaming) message, a ref that
319
- // resolves late would never be re-read: nothing else about the renderer's
320
- // props changes, the engine's memo bails, and the pill stays stuck on its
321
- // fallback (`refMatch.title`, or the raw cardId) forever. Streaming is
322
- // covered because `card://` blocks are excluded from the block cache; the
323
- // completed path has no other escape.
324
- //
325
- // The token fingerprints VALUES, not just the key set: a later refs frame
326
- // REPLACES the whole map for a send index, and the enrichment case that
327
- // matters most — a `title` going from the raw cardId to the resolved
328
- // document title — keeps the key set IDENTICAL. A key-only token would be
329
- // unchanged, the override map would keep its identity, the engine's
330
- // completed-block memo would bail, and the pill would stay on its fallback
331
- // forever. Every `ChatRef` field is included because the host's
332
- // `renderEntityCard` receives the whole ref and may render any of them.
333
- //
334
- // Still STABLE per text delta (the refs map doesn't change while tokens
335
- // stream), and the cost is one pass over a handful of refs per CHANGED
336
- // `chatRefs` identity — the dep list is unchanged.
337
- //
338
- // Fields are joined by `JSON.stringify`, NOT by a separator character.
339
- // `title`, `preview` and `url` are free-form HOST strings, so any
340
- // delimiter we pick is one the data may also contain: joined with a plain
341
- // space, `title: 'a b'` + empty `url` fingerprints identically to
342
- // `title: 'a'` + `url: 'b'`, silently reintroducing the stale-pill memo
343
- // bail this token exists to fix. (An earlier revision used a literal NUL
344
- // byte as the separator: collision-free in practice, but it made the
345
- // source file itself binary to grep and diff tooling.) `JSON.stringify`
346
- // escapes every field, so no value can forge a boundary.
347
- //
348
- // Caveat worth stating: `JSON.stringify` on `metadata` is key-ORDER
349
- // dependent: two structurally equal objects built in different insertion
350
- // orders fingerprint differently. Acceptable here because every refs map
351
- // arrives from ONE decoder with a fixed field order, and the failure mode
352
- // is a redundant re-render, never a stale pill.
353
- const refsKey = useMemo(
354
- () =>
355
- Object.entries(chatRefs ?? {})
356
- .sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
357
- .map(([k, v]) =>
358
- JSON.stringify([
359
- k,
360
- v.type,
361
- v.sourceRepo ?? null,
362
- v.id,
363
- v.title,
364
- v.url ?? null,
365
- v.targetPlatform ?? null,
366
- v.date ?? null,
367
- v.preview ?? null,
368
- v.metadata ?? null,
369
- ]),
370
- )
371
- .join('|'),
372
- [chatRefs],
373
- )
291
+ return { inlineByKey, partsBySegment }
292
+ }, [hasMarkerSupport, chatRefs, renderEntityCard, segments])
374
293
 
375
294
  const cardComponentOverrides = useMemo(() => {
376
295
  if (!hasMarkerSupport && !hasMentionSupport) return undefined
296
+ const refs = chatRefs ?? {}
297
+ const inlineByKey = renderingPlan?.inlineByKey
377
298
  return {
378
299
  // Override `<a>` to detect `card://` URLs emitted by `remarkCardLinks`.
379
300
  // The render result was pre-computed in `renderingPlan` so block-level
@@ -401,7 +322,7 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
401
322
  const cardType = stripped.slice(0, sepIdx)
402
323
  const cardId = stripped.slice(sepIdx + 1)
403
324
  const key = `${cardType}:${cardId}`
404
- const inline = renderingPlanRef.current?.inlineByKey.get(key)
325
+ const inline = inlineByKey?.get(key)
405
326
  if (inline != null) return inline
406
327
  // Three fallback cases — keep them DISTINCT, never blur them
407
328
  // together. Mixing them up (which the old code did by reaching
@@ -425,7 +346,7 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
425
346
  // title from an unrelated ref — that hides the bug and
426
347
  // deceives the reader into thinking they're looking at
427
348
  // a real card.
428
- const refMatch: ChatRef | undefined = chatRefsRef.current?.[key]
349
+ const refMatch: ChatRef | undefined = refs[key]
429
350
  if (refMatch) {
430
351
  return <span className="text-ods-text-primary">{refMatch.title}</span>
431
352
  }
@@ -467,13 +388,7 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
467
388
  )
468
389
  },
469
390
  }
470
- // DEPS ARE DELIBERATELY MINIMAL — every one of them is stable across a
471
- // streaming turn (booleans + host-stable fn/component identities, both
472
- // enforced by this file's `memo` comparator). The rendering plan and the
473
- // refs MAP are read through refs above precisely so they do NOT appear
474
- // here; `refsKey` is the one ref-derived dep, and it only moves when the
475
- // ref set OR any ref VALUE does (see its definition).
476
- }, [hasMarkerSupport, hasMentionSupport, renderMention, NavLinkAnchor, refsKey])
391
+ }, [hasMarkerSupport, hasMentionSupport, renderMention, chatRefs, renderingPlan, NavLinkAnchor])
477
392
 
478
393
  /**
479
394
  * Body of a markdown-bearing segment (`text` / `guide`).
@@ -488,13 +403,8 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
488
403
  * end). Stable React keys come from the card key (block) and chunk position
489
404
  * (text); streaming token-by-token reuses the same React instances so
490
405
  * `<Video>` doesn't remount mid-play.
491
- *
492
- * `isStreaming` opts the segment into the markdown engine's streaming path
493
- * (atomic-block memoization + fence tail-completion + aria-live). Only the
494
- * actively streaming segment gets it, and within a marker-split segment
495
- * only the LAST text chunk — the earlier chunks are already final.
496
406
  */
497
- const renderSegmentBody = (segIndex: number, text: string, isStreaming: boolean) => {
407
+ const renderSegmentBody = (segIndex: number, text: string) => {
498
408
  const parts = renderingPlan?.partsBySegment.get(segIndex)
499
409
  if (!parts || parts.length === 0) {
500
410
  return (
@@ -503,7 +413,6 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
503
413
  textSize="compact"
504
414
  additionalRemarkPlugins={cardRemarkPlugins}
505
415
  componentOverrides={cardComponentOverrides}
506
- streaming={isStreaming}
507
416
  />
508
417
  )
509
418
  }
@@ -516,7 +425,6 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
516
425
  textSize="compact"
517
426
  additionalRemarkPlugins={cardRemarkPlugins}
518
427
  componentOverrides={cardComponentOverrides}
519
- streaming={isStreaming && pIdx === parts.length - 1}
520
428
  />
521
429
  )
522
430
  }
@@ -631,12 +539,6 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
631
539
  {/* Message segments — hidden for system messages without content */}
632
540
  {(!isSystem || segments.length > 0) && <div className="flex flex-col gap-2">
633
541
  {segments.map((segment, index) => {
634
- // The engine's streaming path (atomic-block memoization +
635
- // fence tail-completion + aria-live) applies ONLY to the
636
- // actively streaming segment: last segment of a message that
637
- // is still typing. On completion `isTyping` flips false and
638
- // the engine does one authoritative whole-document parse.
639
- const segmentIsStreaming = index === segments.length - 1 && !!isTyping
640
542
  if (segment.type === 'text') {
641
543
  return (
642
544
  <div
@@ -646,15 +548,11 @@ const ChatMessageEnhanced = forwardRef<HTMLDivElement, ChatMessageEnhancedProps>
646
548
  isError ? "text-ods-error" : "text-ods-text-primary",
647
549
  )}
648
550
  >
649
- {renderSegmentBody(index, segment.text, segmentIsStreaming)}
551
+ {renderSegmentBody(index, segment.text)}
650
552
  </div>
651
553
  )
652
554
  } else if (segment.type === 'guide') {
653
- return (
654
- <GuideDisplay key={index}>
655
- {renderSegmentBody(index, segment.text, segmentIsStreaming)}
656
- </GuideDisplay>
657
- )
555
+ return <GuideDisplay key={index}>{renderSegmentBody(index, segment.text)}</GuideDisplay>
658
556
  } else if (segment.type === 'tool_execution') {
659
557
  return (
660
558
  <ToolExecutionDisplay