@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
@@ -76,11 +76,6 @@ export * from './types'
76
76
  // Chat hooks
77
77
  export * from './hooks'
78
78
 
79
- // Chat stream module — master reducer + dialog store + React wrapper
80
- // (Phase 3 of the chat unification; ONE accumulation path for SSE + NATS
81
- // + history replay).
82
- export * from './stream'
83
-
84
79
  // Chat utilities
85
80
  export * from './utils'
86
81
 
@@ -4,7 +4,7 @@ import { forwardRef, useState } from "react"
4
4
 
5
5
  import { cn } from "../../utils/cn"
6
6
  import { DotsLoaderIcon } from "../icons-v2-generated"
7
- import { SimpleMarkdownRenderer } from "../ui/markdown/simple-markdown-renderer"
7
+ import { SimpleMarkdownRenderer } from "../ui/simple-markdown-renderer"
8
8
  import { ExpandChevron } from "./expand-chevron"
9
9
  import { useCollapsible } from "./hooks/use-collapsible"
10
10
  import type { ThinkingDisplayProps } from "./types"
@@ -1,60 +1,70 @@
1
- <!-- source-hash: 60ad035125eceb97fa074f58783d5bc8 -->
2
- Defines TypeScript interfaces for API interactions and React hook contracts used across Flamingo's chat and dialog systems, covering NATS/JetStream subscriptions, real-time chunk processing, and REST-style request/response shapes.
1
+ <!-- source-hash: 76966dd4845d1486e56288fc8033df68 -->
2
+ Defines TypeScript interfaces for API interactions and React hook contracts used in the OpenFrame real-time chat and NATS messaging system.
3
3
 
4
4
  ## Key Components
5
5
 
6
- ### Hook Options
7
- | Interface | Purpose |
8
- |---|---|
9
- | `UseChunkCatchupOptions` | Configure chunk catch-up replay with optional custom fetch function |
10
- | `UseNatsDialogSubscriptionOptions` | Core NATS WebSocket subscription config with reconnection backoff tuning |
11
- | `UseJetStreamDialogSubscriptionOptions` | JetStream-based subscription with sequence-based resume support |
12
-
13
- ### Hook Return Types
14
- | Interface | Purpose |
15
- |---|---|
16
- | `UseChunkCatchupReturn` | Exposes catchup, processing, and buffering controls |
17
- | `UseNatsDialogSubscriptionReturn` | Connection state and reconnection counter |
18
- | `UseJetStreamDialogSubscriptionReturn` | Connection state plus current stream sequence |
19
-
20
- ### Callbacks
21
- - **`RealtimeChunkCallbacks`** — Rich event callback map for streaming events: `onStreamStart`, `onStreamEnd`, `onSegmentsUpdate`, `onTokenUsage`, `onApprove`, `onReject`, `onEscalatedApproval`, `onApprovalResolved`, `onToolExecuted`, `onDialogClosed`, and more.
22
-
23
- ### API Request/Response Types
24
- - **Chat** — `ChatAPIRequest` / `ChatAPIResponse`
25
- - **Dialogs** — `DialogCreateRequest/Response`, `DialogListRequest/Response`
26
- - **Approvals** — `ApprovalRequest` / `ApprovalResponse`
27
- - **Settings** — `ChatSettings`, `UpdateSettingsRequest/Response`
6
+ ### Hook Option Interfaces
7
+ - **`UseChunkCatchupOptions`** — Configuration for chunk catch-up logic, including dialog ID, chunk callbacks, chat type filters, and an optional custom fetch function
8
+ - **`UseNatsDialogSubscriptionOptions`** — NATS WebSocket subscription config with reconnection backoff tuning, auth lifecycle hooks, and client credentials
9
+ - **`UseJetStreamDialogSubscriptionOptions`** — JetStream-specific variant adding stream name, sequence-based replay (`optStartSeq`), and consumer inactivity threshold
10
+ - **`UseRealtimeChunkProcessorOptions`** — Controls chunk processing behavior: approval type routing, batch approvals, direct-mode barrier, and initial accumulator state for reconnection
11
+
12
+ ### Hook Return Interfaces
13
+ - **`UseChunkCatchupReturn`** — Exposes `catchUpChunks`, `processChunk`, `resetAndCatchUp`, and buffering state controls
14
+ - **`UseNatsDialogSubscriptionReturn`** / **`UseJetStreamDialogSubscriptionReturn`** — Connection/subscription status and reconnection counters; JetStream variant also tracks `currentStreamSeq`
15
+ - **`UseRealtimeChunkProcessorReturn`** — `processChunk`, `getSegments`, `reset`, and `updateApprovalStatus`
16
+
17
+ ### Callback & Metadata Interfaces
18
+ - **`RealtimeChunkCallbacks`** — Comprehensive event callback surface covering stream lifecycle (`onStreamStart`, `onStreamEnd`), message types (user, direct, system), tool execution (`onToolExecuted`, `onAgentBusy`), approval flows (`onApprove`, `onReject`, `onEscalatedApproval`, `onApprovalResolved`), token usage, and dialog closure
19
+ - **`SegmentsUpdateMetadata`** — Carries append mode, compaction flags, and JetStream `streamSeq` for history deduplication
28
20
 
29
21
  ## Usage Example
30
22
 
31
23
  ```typescript
32
- const options: ChatStreamReducerOptions = {
33
- callbacks: {
34
- onSegmentsUpdate: (segments, meta) => {
35
- if (meta?.append) appendToLastMessage(segments)
36
- else setSegments(segments)
37
- },
38
- onApprovalResolved: (requestId, status, approvalType) => {
39
- updateApprovalBadge(requestId, status)
40
- },
41
- onTokenUsage: (data) => console.log('Tokens used:', data),
24
+ import type {
25
+ UseNatsDialogSubscriptionOptions,
26
+ UseRealtimeChunkProcessorOptions,
27
+ RealtimeChunkCallbacks,
28
+ } from './api.types'
29
+
30
+ const callbacks: RealtimeChunkCallbacks = {
31
+ onStreamStart: () => setStreaming(true),
32
+ onStreamEnd: () => setStreaming(false),
33
+ onSegmentsUpdate: (segments, meta) => {
34
+ if (meta?.append) appendSegments(segments)
35
+ else setSegments(segments)
42
36
  },
43
- batchApprovalsEnabled: true,
37
+ onToolExecuted: (segment) => mergeToolResult(segment),
38
+ onApprovalResolved: (requestId, status, approvalType) => {
39
+ updateApprovalCard(requestId, status)
40
+ },
41
+ }
42
+
43
+ const processorOptions: UseRealtimeChunkProcessorOptions = {
44
+ callbacks,
44
45
  displayApprovalTypes: ['CLIENT'],
45
- enableThinking: false,
46
+ batchApprovalsEnabled: true,
47
+ initialState: {
48
+ existingSegments: historicalSegments,
49
+ executingTools: new Map(),
50
+ },
46
51
  }
47
52
 
48
53
  const natsOptions: UseNatsDialogSubscriptionOptions = {
49
54
  enabled: true,
50
55
  dialogId: 'dialog-123',
56
+ topics: ['message'],
51
57
  getNatsWsUrl: () => 'wss://nats.example.com',
58
+ onBeforeReconnect: async () => refreshAuthToken(),
52
59
  reconnectionBackoff: {
53
60
  fastRetries: 3,
54
61
  fastRetryDelayMs: 500,
55
- maxDelayMs: 30000,
62
+ maxDelayMs: 30_000,
56
63
  multiplier: 2,
57
64
  },
58
- onBeforeReconnect: async () => refreshAuthToken(),
59
65
  }
60
- ```
66
+ ```
67
+
68
+ ## Source
69
+
70
+ [`api.types.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/api.types.ts)
@@ -1,51 +1,80 @@
1
- <!-- source-hash: 118d3a4cacf89174498282067448e4bf -->
2
- Defines TypeScript types for message processing pipeline operations, including chunk parsing, accumulator state management, stream control, and buffer management for AI chat message flows.
1
+ <!-- source-hash: bdb71cca9908cf9cfebf089a00d84db8 -->
2
+ Defines TypeScript types for the message processing pipeline, covering chunk parsing, state accumulation, stream control, and buffer management.
3
3
 
4
4
  ## Key Components
5
5
 
6
- | Export | Type | Description |
7
- |--------|------|-------------|
8
- | `AccumulatorState` | Interface | Stateful container tracking message segments, pending approvals, and executing tools during stream processing |
9
- | `PendingApproval` | Interface | Represents an approval request awaiting user action (command, explanation, type) |
10
- | `MessageProcessingOptions` | Interface | Configuration for assistant rendering, approval callbacks, chat filtering, and batch approval UI |
11
- | `StreamProcessor` | Interface | Full lifecycle control (start/stop/pause/resume/reset) for stream consumers |
12
- | `StreamState` | Interface | Snapshot of stream health: active status, buffered chunks, error log, and last activity timestamp |
13
- | `BufferManager` | Interface | CRUD-style contract for managing `ChunkData` buffers |
14
- | `BufferOptions` | Interface | Configuration for buffer capacity, flush intervals, and overflow handling callbacks |
6
+ ### Union Types
7
+ - **`ParsedChunkAction`** — Discriminated union of all possible chunk parse results: `message_start`, `message_end`, `error`, `metadata`, `text`, `thinking`, `tool_execution`, `approval_request`, `approval_batch`, `approval_result`, `token_usage`, `direct_message`, `system`, `context_compaction_start/end`, `dialog_closed`
8
+
9
+ ### Accumulator State
10
+ - **`AccumulatorState`** — Tracks in-flight message segments, pending approvals, and executing tool states during streaming
11
+ - **`PendingApproval`** — Holds command, explanation, and approval type for a deferred approval card
12
+
13
+ ### Processing Configuration
14
+ - **`MessageProcessingOptions`** — Runtime options passed to the processor: assistant identity, approval callbacks, chat type filter, approval status map, `displayApprovalTypes`, and `batchApprovalsEnabled` (consumer-owned feature flag)
15
+
16
+ ### Chunk Processing
17
+ - **`ChunkProcessor`** — Interface for stateful chunk parsing with `processChunk` and `reset`
18
+ - **`ChunkProcessorOptions`** — Lifecycle callbacks for chunk events (`onText`, `onToolExecution`, `onApprovalRequest`, etc.)
19
+
20
+ ### Message Transformation
21
+ - **`MessageTransformer`** — Single and batch transform interface producing `ProcessedMessage` outputs
22
+ - **`TransformationOptions`** — Flags for segment merging, timestamp formatting, and metadata inclusion
23
+
24
+ ### Stream & Buffer Management
25
+ - **`StreamProcessor`** — Lifecycle control (`start`, `stop`, `pause`, `resume`, `reset`, `getState`)
26
+ - **`StreamState`** — Runtime counters: active state, pause flag, processed message count, buffered chunks, error log
27
+ - **`BufferManager`** — FIFO buffer operations (`add`, `flush`, `clear`, `size`, `isEmpty`, `isFull`)
28
+ - **`BufferOptions`** — Max size, flush interval, and overflow/flush callbacks
15
29
 
16
30
  ## Usage Example
17
31
 
18
32
  ```typescript
19
33
  import type {
34
+ ParsedChunkAction,
20
35
  AccumulatorState,
21
36
  MessageProcessingOptions,
22
- StreamState
37
+ StreamState,
23
38
  } from './processing.types'
24
39
 
25
-
26
- // Initializing accumulator state
27
- const state: AccumulatorState = {
28
- segments: [],
29
- pendingApprovals: new Map(),
30
- executingTools: new Map()
40
+ // Narrow a parsed chunk action by discriminant
41
+ function handleChunk(action: ParsedChunkAction) {
42
+ switch (action.action) {
43
+ case 'text':
44
+ console.log('Text received:', action.text)
45
+ break
46
+ case 'tool_execution':
47
+ console.log('Tool segment:', action.segment)
48
+ break
49
+ case 'approval_batch':
50
+ console.log('Batch approval', action.requestId, action.toolCalls)
51
+ break
52
+ case 'error':
53
+ console.error(action.error, action.details)
54
+ break
55
+ }
31
56
  }
32
57
 
33
- // Configuring message processing
58
+ // Configure message processing with batch approvals enabled
34
59
  const options: MessageProcessingOptions = {
35
60
  assistantName: 'Mingo',
36
61
  assistantType: 'mingo',
37
- batchApprovalsEnabled: true,
38
- displayApprovalTypes: ['shell', 'file'],
62
+ batchApprovalsEnabled: true, // consumer sets this from their feature flag
63
+ displayApprovalTypes: ['shell', 'file_write'],
39
64
  onApprove: async (requestId) => {
40
- await submitApproval(requestId)
65
+ await fetch(`/api/approvals/${requestId}/approve`, { method: 'POST' })
41
66
  },
42
- onReject: (requestId) => {
43
- logRejection(requestId)
44
- }
67
+ onReject: async (requestId) => {
68
+ await fetch(`/api/approvals/${requestId}/reject`, { method: 'POST' })
69
+ },
70
+ }
71
+
72
+ // Initialize accumulator state
73
+ const state: AccumulatorState = {
74
+ segments: [],
75
+ pendingApprovals: new Map(),
76
+ executingTools: new Map(),
45
77
  }
46
78
  ```
47
79
 
48
- > NOTE: the wire-chunk vocabulary now lives in `src/chat-protocol/events.ts`
49
- > (`ChatStreamEvent`, produced by `decodeNatsChunk`). The old
50
- > `ParsedChunkAction` union and the `ChunkProcessor` contract were deleted
51
- > together with the legacy `chunk-parser`.
80
+ **Source:** [`processing.types.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/processing.types.ts)
@@ -213,12 +213,79 @@ export interface RealtimeChunkCallbacks {
213
213
  onDialogClosed?: () => void
214
214
  }
215
215
 
216
- // NOTE: `UseRealtimeChunkProcessorOptions` / `UseRealtimeChunkProcessorReturn`
217
- // were DELETED along with the `useRealtimeChunkProcessor` compat hook. The
218
- // equivalents are `ChatStreamReducerOptions` + `ChatStreamReducer` in
219
- // `../stream/chat-stream-reducer`. `RealtimeChunkCallbacks` above SURVIVES:
220
- // it is still the canonical description of the effect names/args the reducer
221
- // emits via `ChatReducerEffect`.
216
+ export interface UseRealtimeChunkProcessorOptions {
217
+ callbacks: RealtimeChunkCallbacks
218
+ /**
219
+ * Filter approval types that should be displayed directly
220
+ * Others will trigger onEscalatedApproval
221
+ * Default: ['CLIENT']
222
+ */
223
+ displayApprovalTypes?: string[]
224
+ /**
225
+ * Map of existing approval statuses
226
+ */
227
+ approvalStatuses?: Record<string, ChatApprovalStatus>
228
+ /**
229
+ * Initialize accumulator with existing state from incomplete historical message
230
+ * Used to continue building messages across page refreshes or reconnections
231
+ */
232
+ initialState?: {
233
+ /** Existing segments to continue building upon */
234
+ existingSegments?: MessageSegment[]
235
+ /** Pending approvals that haven't been resolved */
236
+ pendingApprovals?: Map<string, { command: string; explanation?: string; approvalType: string }>
237
+ /** Executing tools waiting for completion */
238
+ executingTools?: Map<string, ExecutingToolState>
239
+ /** Escalated approvals */
240
+ escalatedApprovals?: Map<
241
+ string,
242
+ { command: string; explanation?: string; approvalType: string; toolCalls?: PendingToolCallData[] }
243
+ >
244
+ }
245
+ /**
246
+ * Consumer-owned (e.g. set in `openframe-oss-tenant` chat client via the
247
+ * `'batch-approvals'` feature flag and forwarded here). The lib does NOT
248
+ * default this to a batch-on behavior — when omitted it falls back to the
249
+ * legacy single-card rendering.
250
+ *
251
+ * When true: `APPROVAL_REQUEST` chunks containing `toolCalls[]` are rendered
252
+ * as a single batch card. When false / omitted: the batch is split into N
253
+ * legacy approval cards (one per tool that requires approval), all sharing
254
+ * the same `approvalRequestId`. Tools with `requiresApproval=false` are
255
+ * dropped from the UI in the unfolded mode.
256
+ */
257
+ batchApprovalsEnabled?: boolean
258
+ /**
259
+ * Engages the direct-mode barrier optimistically: once true, all AI-assistant
260
+ * chunks (text, thinking, tool executions, approvals, metadata, errors, etc.)
261
+ * are dropped and any open stream is torn down, leaving only human/control
262
+ * messages. A `DIRECT_MESSAGE` chunk engages the same barrier automatically
263
+ * regardless of this flag. Pass this from a host that already knows the dialog
264
+ * switched to direct mode (e.g. an optimistic mode toggle) to close the race
265
+ * window before the server emits the first `DIRECT_MESSAGE`.
266
+ *
267
+ * Do NOT set this when the host reconstructs history by replaying chunks
268
+ * through `processChunk` — a static flag would drop legitimate pre-switch AI
269
+ * history. Rely on the in-order `DIRECT_MESSAGE` detection instead.
270
+ */
271
+ isDirectMode?: boolean
272
+ }
273
+
274
+ export interface UseRealtimeChunkProcessorReturn {
275
+ /** Process a single chunk */
276
+ processChunk: (chunk: unknown) => void
277
+ /** Get current segments */
278
+ getSegments: () => MessageSegment[]
279
+ /** Reset the accumulator */
280
+ reset: () => void
281
+ /** Update approval status for a request */
282
+ updateApprovalStatus: (requestId: string, status: ChatApprovalStatus, resolvedByName?: string | null) => MessageSegment[]
283
+ /** Get pending approval requests */
284
+ getPendingApprovals: () => Map<
285
+ string,
286
+ { command: string; explanation?: string; approvalType: string; toolCalls?: PendingToolCallData[] }
287
+ >
288
+ }
222
289
 
223
290
  // ========== API Request Types ==========
224
291
 
@@ -3,14 +3,38 @@
3
3
  * Contains types for message parsing, accumulation, and processing
4
4
  */
5
5
 
6
- import type { MessageSegment, PendingToolCallData, ExecutingToolState } from './message.types'
6
+ import type { MessageSegment, ProcessedMessage, ToolExecutionSegment, TokenUsageData, PendingToolCallData, ExecutingToolState } from './message.types'
7
7
  import type { ChatApprovalStatus, AssistantType } from './chat.types'
8
- import type { ChunkData } from './network.types'
9
-
10
- // NOTE: the `ParsedChunkAction` union that used to live here was DELETED
11
- // alongside the legacy `chunk-parser`. The wire → normalized-event
12
- // vocabulary is now `ChatStreamEvent` in `src/chat-protocol/events.ts`,
13
- // produced by `decodeNatsChunk`.
8
+ import type { ChunkData, NatsMessageType } from './network.types'
9
+
10
+ // ========== Parsed Chunk Result Types ==========
11
+
12
+ export type ParsedChunkAction =
13
+ | { action: 'message_start' }
14
+ | { action: 'message_end' }
15
+ | { action: 'error'; error: string; details?: string }
16
+ | { action: 'metadata'; modelDisplayName: string; modelName: string; providerName: string; contextWindow: number }
17
+ | { action: 'text'; text: string }
18
+ | { action: 'thinking'; text: string }
19
+ | { action: 'guide'; text: string }
20
+ | { action: 'tool_execution'; segment: ToolExecutionSegment }
21
+ | { action: 'approval_request'; requestId: string; command: string; explanation?: string; approvalType: string }
22
+ | { action: 'approval_batch'; requestId: string; approvalType: string; toolCalls: PendingToolCallData[] }
23
+ | { action: 'approval_result'; requestId: string; approved: boolean; approvalType: string; resolvedByName?: string | null }
24
+ | {
25
+ action: 'message_request'
26
+ text: string
27
+ ownerType?: string
28
+ displayName?: string
29
+ userId?: string
30
+ contextItems?: Array<{ type: string; id: string }>
31
+ }
32
+ | { action: 'token_usage'; data: TokenUsageData }
33
+ | { action: 'direct_message'; text: string; ownerType?: string; displayName?: string; userId?: string }
34
+ | { action: 'system'; text: string }
35
+ | { action: 'context_compaction_start' }
36
+ | { action: 'context_compaction_end'; summary?: string }
37
+ | { action: 'dialog_closed' }
14
38
 
15
39
  // ========== Accumulator State ==========
16
40
 
@@ -58,13 +82,31 @@ export interface MessageProcessingOptions {
58
82
  batchApprovalsEnabled?: boolean
59
83
  }
60
84
 
61
- // NOTE: `ChunkProcessorOptions` (the options bag of the deleted
62
- // `ChunkProcessor`) and `MessageTransformer` were DELETED — both were left
63
- // behind by the chunk-processor removal with zero references in lib, hub, or
64
- // app.
85
+ // ========== Chunk Processing Types ==========
86
+
87
+ export interface ChunkProcessor {
88
+ processChunk: (chunk: ChunkData, messageType: NatsMessageType) => ParsedChunkAction | null
89
+ reset: () => void
90
+ }
91
+
92
+ export interface ChunkProcessorOptions {
93
+ onMessageStart?: () => void
94
+ onMessageEnd?: () => void
95
+ onError?: (error: string, details?: string) => void
96
+ onText?: (text: string) => void
97
+ onToolExecution?: (segment: MessageSegment) => void
98
+ onApprovalRequest?: (data: any) => void
99
+ onApprovalResult?: (data: any) => void
100
+ onMetadata?: (data: any) => void
101
+ }
65
102
 
66
103
  // ========== Message Transformation Types ==========
67
104
 
105
+ export interface MessageTransformer {
106
+ transform: (input: any) => ProcessedMessage | null
107
+ batch: (inputs: any[]) => ProcessedMessage[]
108
+ }
109
+
68
110
  export interface TransformationOptions {
69
111
  preserveOriginal?: boolean
70
112
  mergeSegments?: boolean
@@ -0,0 +1,62 @@
1
+ <!-- source-hash: c8c1cef3b3966f8791e7003c4f74429f -->
2
+ Utilities for parsing raw NATS message chunks into typed, structured action objects consumed by the OpenFrame chat pipeline.
3
+
4
+ ## Key Components
5
+
6
+ ### `parseChunkToAction(chunk: unknown): ParsedChunkAction | null`
7
+ The primary export. Accepts an untyped NATS chunk, inspects its `type` field against `MESSAGE_TYPE` constants, and returns a discriminated `ParsedChunkAction` union or `null` for unrecognized types. Handles the full message lifecycle including:
8
+
9
+ - **Lifecycle signals:** `message_start`, `message_end`, `dialog_closed`
10
+ - **Content:** `text`, `thinking`, `system`, `direct_message`
11
+ - **Tool execution:** `tool_execution` (both `EXECUTING_TOOL` and `EXECUTED_TOOL` states)
12
+ - **Approval flow:** `approval_request`, `approval_batch`, `approval_result`
13
+ - **Metadata & telemetry:** `metadata`, `token_usage`, `context_compaction_start/end`
14
+ - **Error handling:** `error`
15
+
16
+ ### `normalizeToolCalls(raw: unknown): PendingToolCallData[]` *(internal)*
17
+ Safely coerces an untyped array into `PendingToolCallData[]`, filtering non-objects and providing safe defaults for all fields.
18
+
19
+ ### Predicate helpers
20
+ Lightweight type guards for fast chunk classification without full parsing:
21
+
22
+ | Function | Returns `true` when |
23
+ |---|---|
24
+ | `isControlChunk` | `MESSAGE_START` or `MESSAGE_END` |
25
+ | `isErrorChunk` | `ERROR` type |
26
+ | `isMetadataChunk` | `AI_METADATA` type |
27
+ | `extractTextFromChunk` | `TEXT` type — returns the string or `null` |
28
+
29
+ ## Usage Example
30
+
31
+ ```typescript
32
+ import {
33
+ parseChunkToAction,
34
+ isControlChunk,
35
+ isErrorChunk,
36
+ } from './chunk-parser'
37
+
38
+ // Parse an incoming NATS chunk
39
+ const action = parseChunkToAction(rawChunk)
40
+
41
+ if (action?.action === 'text') {
42
+ appendToTranscript(action.text)
43
+ } else if (action?.action === 'approval_batch') {
44
+ promptUserApproval(action.toolCalls)
45
+ }
46
+
47
+ // Fast-path guards before full parse
48
+ if (isErrorChunk(rawChunk)) {
49
+ handleError()
50
+ }
51
+ if (isControlChunk(rawChunk)) {
52
+ resetStreamState()
53
+ }
54
+ ```
55
+
56
+ ## Notes
57
+
58
+ - All field access is defensive — missing or wrong-typed properties fall back to safe defaults rather than throwing.
59
+ - `approval_result` accepts both `resolvedByName` and `displayName` so realtime NATS chunks and GraphQL history replays produce identical output shapes.
60
+ - `contextItems` on `message_request` back-fills `label` from `id` to satisfy the required `ChatContextItem` contract when no label is present on the wire.
61
+
62
+ **Source:** [`https://github.com/flamingo-stack/openframe-oss-lib/blob/main/chunk-parser.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/chunk-parser.ts)
@@ -1,48 +1,57 @@
1
- <!-- source-hash: 85c0af6cd361347beeabcd097260378a -->
2
- Barrel export module that consolidates and re-exports all message processing, chat navigation, UI styling, and content utility functions for chat interfaces.
1
+ <!-- source-hash: 0435e7889d0ba1d3a5186507e28737c9 -->
2
+ Barrel export module for the message processing utilities library, re-exporting all public APIs from specialized sub-modules covering chat message parsing, navigation, attachments, icons, and more.
3
3
 
4
4
  ## Key Components
5
5
 
6
- | Category | Exports |
7
- |----------|---------|
8
- | **Message Accumulation** | `MessageSegmentAccumulator`, `createMessageSegmentAccumulator`, `AccumulatorCallbacks` |
9
- | **Historical Messages** | `processHistoricalMessages`, `extractErrorMessages`, `processHistoricalMessagesWithErrors` |
10
- | **Chat Navigation** | `handleChatNavClick`, `resolveExternalNavigation`, `decideNewTab`, `computeIsNewTab`, `buildAnchorProps` |
11
- | **Proxy Auth** | `getChatProxyAuth`, `setChatProxyAuth`, `clearChatProxyAuth`, `applyProxyAuth`, `chatAuthedFetch` |
12
- | **Attachments** | `formatChatAttachmentMarkdownForBubble`, `stripChatAttachmentMarkdown`, `buildChatAttachmentViewUrl` |
13
- | **UI / Styling** | `chatChipClass`, compact card class constants (`COMPACT_CARD_*`), `getStatusColorScheme` |
14
- | **Icon Registry** | `ICON_REGISTRY`, `getIconComponent`, `normalizeIconKey`, `getDynamicIcon` |
15
- | **Source Utilities** | `getSourceIconName`, `getSourceLabel`, `resolveSourceRowCTA`, `resolveSourceIcon` |
16
- | **Slash Commands** | `parseWireCommandOverride`, `sanitizeTitleForChat`, `buildDiscussAddendum` |
6
+ | Export Group | Source Module | Description |
7
+ |---|---|---|
8
+ | Chunk parsing | `chunk-parser` | Parse streaming chunks into actions, detect control/error/metadata chunks |
9
+ | Segment accumulator | `message-segment-accumulator` | Accumulate streaming message segments with callbacks |
10
+ | Historical messages | `process-historical-messages` | Process and reconcile chat history with error extraction |
11
+ | History merge | `history-merge` | Reconcile persisted history with realtime stream data |
12
+ | Navigation | `execute-navigation`, `nav-click-handler`, `decide-new-tab` | Unified navigation primitive for new-tab/same-tab, internal/external, embed/host routing |
13
+ | Chat attachment | `chat-attachment-markdown` | Format and strip attachment markdown, URL/token helpers |
14
+ | Icon registry | `icon-registry`, `icon-library`, `source-icons` | Single source of truth for icon-name → component lookups |
15
+ | Proxy auth | `chat-proxy-auth-storage`, `chat-authed-fetch` | localStorage adapter and authenticated fetch wrapper |
16
+ | Slash commands | `slash-dispatch-utils` | Command parsing, entity filtering, and dispatch utilities |
17
+ | Compact card | `compact-card-classes` | Shared CSS class constants and safe-href guard |
18
+ | Scripted stream | `scripted-stream` | Re-exported wholesale via `export *` |
17
19
 
18
20
  ## Usage Example
19
21
 
20
22
  ```typescript
21
23
  import {
24
+ parseChunkToAction,
22
25
  createMessageSegmentAccumulator,
23
- handleChatNavClick,
24
- getChatProxyAuth,
25
- getIconComponent,
26
- formatChatAttachmentMarkdownForBubble,
27
- decideNewTab,
26
+ executeNavigation,
27
+ resolveIcon,
28
28
  getStatusColorScheme,
29
- } from '@flamingo/chat-utils'
29
+ mergeHistoryWithRealtime,
30
+ formatChatAttachmentMarkdownForBubble,
31
+ } from '@openframe/chat-utils'
32
+
33
+ // Parse a streaming chunk
34
+ const action = parseChunkToAction(rawChunk)
30
35
 
31
- // Accumulate streamed message segments
36
+ // Accumulate message segments from a stream
32
37
  const accumulator = createMessageSegmentAccumulator({
33
- onSegmentComplete: (segment) => console.log('Segment:', segment),
38
+ onSegmentComplete: (segment) => console.log('Segment done:', segment),
34
39
  })
35
40
 
36
- // Resolve navigation target for a chat link
37
- const { openInNewTab } = decideNewTab({
38
- href: 'https://app.example.com/tickets/123',
39
- surface: 'chat-bubble',
40
- mode: 'web',
41
+ // Execute navigation respecting new-tab rules
42
+ executeNavigation({
43
+ href: '/tickets/123',
44
+ event: clickEvent,
45
+ surface: 'chat',
41
46
  })
42
47
 
43
- // Look up a registered icon by kebab-case key
44
- const Icon = getIconComponent('clickup')
48
+ // Resolve an icon by name
49
+ const Icon = resolveIcon('clickup')
50
+
51
+ // Get agent status color scheme
52
+ const colors = getStatusColorScheme('online')
53
+ ```
54
+
55
+ ## Source
45
56
 
46
- // Apply agent status color scheme to UI
47
- const colors = getStatusColorScheme('running')
48
- ```
57
+ [`index.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/index.ts)