@flamingo-stack/openframe-frontend-core 0.0.489 → 0.0.490-1506.3944.1

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 (280) hide show
  1. package/dist/chat-protocol/decode.d.ts +58 -0
  2. package/dist/chat-protocol/decode.d.ts.map +1 -0
  3. package/dist/chat-protocol/encode.d.ts +44 -0
  4. package/dist/chat-protocol/encode.d.ts.map +1 -0
  5. package/dist/chat-protocol/env-flag.d.ts +35 -0
  6. package/dist/chat-protocol/env-flag.d.ts.map +1 -0
  7. package/dist/chat-protocol/events.d.ts +196 -0
  8. package/dist/chat-protocol/events.d.ts.map +1 -0
  9. package/dist/chat-protocol/frames.d.ts +213 -0
  10. package/dist/chat-protocol/frames.d.ts.map +1 -0
  11. package/dist/chat-protocol/index.cjs +494 -0
  12. package/dist/chat-protocol/index.cjs.map +1 -0
  13. package/dist/chat-protocol/index.d.ts +18 -0
  14. package/dist/chat-protocol/index.d.ts.map +1 -0
  15. package/dist/chat-protocol/index.js +478 -0
  16. package/dist/chat-protocol/index.js.map +1 -0
  17. package/dist/chat-protocol/ip-normalize.d.ts +44 -0
  18. package/dist/chat-protocol/ip-normalize.d.ts.map +1 -0
  19. package/dist/chat-protocol/nats-decoder.d.ts +26 -0
  20. package/dist/chat-protocol/nats-decoder.d.ts.map +1 -0
  21. package/dist/{chunk-K7MNWYYI.js → chunk-4NWARV5I.js} +2 -2
  22. package/dist/{chunk-2RNJYJWO.cjs → chunk-5CJR2GZ4.cjs} +31 -31
  23. package/dist/{chunk-2RNJYJWO.cjs.map → chunk-5CJR2GZ4.cjs.map} +1 -1
  24. package/dist/{chunk-H3YRJ3LZ.cjs → chunk-5EYRXSY5.cjs} +9 -9
  25. package/dist/{chunk-H3YRJ3LZ.cjs.map → chunk-5EYRXSY5.cjs.map} +1 -1
  26. package/dist/{chunk-IN4IO7BL.cjs → chunk-5LMGFI4J.cjs} +6930 -4755
  27. package/dist/chunk-5LMGFI4J.cjs.map +1 -0
  28. package/dist/{chunk-YMJZOANX.js → chunk-BE6DK7QY.js} +12228 -10053
  29. package/dist/chunk-BE6DK7QY.js.map +1 -0
  30. package/dist/{chunk-TWGYBXYV.js → chunk-CORIBKHG.js} +2 -2
  31. package/dist/{chunk-RO7Q56ZK.cjs → chunk-CSYSYJCF.cjs} +37 -37
  32. package/dist/{chunk-RO7Q56ZK.cjs.map → chunk-CSYSYJCF.cjs.map} +1 -1
  33. package/dist/{chunk-Z7Y63IFU.cjs → chunk-DSDZ5T4P.cjs} +5 -5
  34. package/dist/{chunk-Z7Y63IFU.cjs.map → chunk-DSDZ5T4P.cjs.map} +1 -1
  35. package/dist/{chunk-EU6QNO4S.js → chunk-GTWO5NAY.js} +2 -2
  36. package/dist/{chunk-BGWDDB7Y.js → chunk-HSACATCD.js} +2 -2
  37. package/dist/{chunk-3OIB763B.cjs → chunk-NWX7MMF5.cjs} +15 -15
  38. package/dist/{chunk-3OIB763B.cjs.map → chunk-NWX7MMF5.cjs.map} +1 -1
  39. package/dist/{chunk-J7H32E3R.cjs → chunk-P4WTZU6L.cjs} +11 -11
  40. package/dist/{chunk-J7H32E3R.cjs.map → chunk-P4WTZU6L.cjs.map} +1 -1
  41. package/dist/{chunk-VLOE7MI2.cjs → chunk-Q6E7VJ4W.cjs} +28 -27
  42. package/dist/chunk-Q6E7VJ4W.cjs.map +1 -0
  43. package/dist/{chunk-ZIAS5NNL.cjs → chunk-QSCHCZL3.cjs} +7 -7
  44. package/dist/{chunk-ZIAS5NNL.cjs.map → chunk-QSCHCZL3.cjs.map} +1 -1
  45. package/dist/{chunk-VL4LUO32.js → chunk-RQLBHKXN.js} +2 -2
  46. package/dist/{chunk-5YMY4BAW.cjs → chunk-S2NHJDKQ.cjs} +62 -62
  47. package/dist/{chunk-5YMY4BAW.cjs.map → chunk-S2NHJDKQ.cjs.map} +1 -1
  48. package/dist/{chunk-N4MTNTSX.js → chunk-T2EGSZFN.js} +6 -5
  49. package/dist/chunk-T2EGSZFN.js.map +1 -0
  50. package/dist/{chunk-W6ZUOWSB.js → chunk-TKN5667N.js} +10 -10
  51. package/dist/chunk-TKN5667N.js.map +1 -0
  52. package/dist/{chunk-B4YR342L.js → chunk-UUYRJPGJ.js} +4 -4
  53. package/dist/{chunk-FKPXFTZT.js → chunk-VHG6AX5V.js} +2 -2
  54. package/dist/{chunk-2IHN7NNB.cjs → chunk-VQ523ORK.cjs} +26 -26
  55. package/dist/{chunk-2IHN7NNB.cjs.map → chunk-VQ523ORK.cjs.map} +1 -1
  56. package/dist/{chunk-X2YF5TJS.js → chunk-XQ2B74SI.js} +2 -2
  57. package/dist/{chunk-LLEDO4P7.cjs → chunk-YHOIAA2E.cjs} +60 -60
  58. package/dist/chunk-YHOIAA2E.cjs.map +1 -0
  59. package/dist/{chunk-5VSEMWWE.js → chunk-YZ2OIYQ3.js} +4 -4
  60. package/dist/components/case-studies/index.cjs +8 -8
  61. package/dist/components/case-studies/index.js +2 -2
  62. package/dist/components/chat/chat-message-enhanced.d.ts.map +1 -1
  63. package/dist/components/chat/chat-message-list.d.ts.map +1 -1
  64. package/dist/components/chat/hooks/index.d.ts +0 -1
  65. package/dist/components/chat/hooks/index.d.ts.map +1 -1
  66. package/dist/components/chat/hooks/use-chat.d.ts.map +1 -1
  67. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +15 -48
  68. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  69. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts +10 -57
  70. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  71. package/dist/components/chat/index.cjs +10 -2
  72. package/dist/components/chat/index.cjs.map +1 -1
  73. package/dist/components/chat/index.d.ts +1 -0
  74. package/dist/components/chat/index.d.ts.map +1 -1
  75. package/dist/components/chat/index.js +21 -13
  76. package/dist/components/chat/stream/chat-dialog-store.d.ts +184 -0
  77. package/dist/components/chat/stream/chat-dialog-store.d.ts.map +1 -0
  78. package/dist/components/chat/stream/chat-stream-reducer.d.ts +367 -0
  79. package/dist/components/chat/stream/chat-stream-reducer.d.ts.map +1 -0
  80. package/dist/components/chat/stream/delta-batcher.d.ts +51 -0
  81. package/dist/components/chat/stream/delta-batcher.d.ts.map +1 -0
  82. package/dist/components/chat/stream/index.d.ts +17 -0
  83. package/dist/components/chat/stream/index.d.ts.map +1 -0
  84. package/dist/components/chat/stream/message-mutations.d.ts +77 -0
  85. package/dist/components/chat/stream/message-mutations.d.ts.map +1 -0
  86. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts +22 -0
  87. package/dist/components/chat/stream/use-chat-stream-reducer.d.ts.map +1 -0
  88. package/dist/components/chat/types/api.types.d.ts +1 -81
  89. package/dist/components/chat/types/api.types.d.ts.map +1 -1
  90. package/dist/components/chat/types/processing.types.d.ts +2 -90
  91. package/dist/components/chat/types/processing.types.d.ts.map +1 -1
  92. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts +34 -6
  93. package/dist/components/chat/utils/extract-incomplete-message-state.d.ts.map +1 -1
  94. package/dist/components/chat/utils/index.d.ts +2 -3
  95. package/dist/components/chat/utils/index.d.ts.map +1 -1
  96. package/dist/components/chat/utils/process-historical-messages.d.ts +59 -11
  97. package/dist/components/chat/utils/process-historical-messages.d.ts.map +1 -1
  98. package/dist/components/contact/index.cjs +3 -3
  99. package/dist/components/contact/index.js +2 -2
  100. package/dist/components/docs/index.cjs +5 -5
  101. package/dist/components/docs/index.js +4 -4
  102. package/dist/components/embeds/index.cjs +3 -3
  103. package/dist/components/embeds/index.js +2 -2
  104. package/dist/components/faq/index.cjs +3 -3
  105. package/dist/components/faq/index.js +2 -2
  106. package/dist/components/features/index.cjs +2 -2
  107. package/dist/components/features/index.js +1 -1
  108. package/dist/components/help-center-pages/index.cjs +20 -20
  109. package/dist/components/help-center-pages/index.js +11 -11
  110. package/dist/components/index.cjs +172 -130
  111. package/dist/components/index.cjs.map +1 -1
  112. package/dist/components/index.js +63 -21
  113. package/dist/components/index.js.map +1 -1
  114. package/dist/components/navigation/index.cjs +2 -2
  115. package/dist/components/navigation/index.js +1 -1
  116. package/dist/components/onboarding-guides/index.cjs +5 -5
  117. package/dist/components/onboarding-guides/index.js +4 -4
  118. package/dist/components/onboarding-guides/onboarding-guide-detail-view.d.ts.map +1 -1
  119. package/dist/components/related-content/index.cjs +3 -3
  120. package/dist/components/related-content/index.js +2 -2
  121. package/dist/components/shared/product-release/release-detail-page.d.ts.map +1 -1
  122. package/dist/components/tickets/index.cjs +5 -5
  123. package/dist/components/tickets/index.js +4 -4
  124. package/dist/components/ui/index.cjs +44 -2
  125. package/dist/components/ui/index.cjs.map +1 -1
  126. package/dist/components/ui/index.d.ts +1 -2
  127. package/dist/components/ui/index.d.ts.map +1 -1
  128. package/dist/components/ui/index.js +55 -13
  129. package/dist/components/ui/markdown/base-components.d.ts +51 -0
  130. package/dist/components/ui/markdown/base-components.d.ts.map +1 -0
  131. package/dist/components/ui/markdown/engine.d.ts +99 -0
  132. package/dist/components/ui/markdown/engine.d.ts.map +1 -0
  133. package/dist/components/ui/markdown/heading-ids.d.ts +65 -0
  134. package/dist/components/ui/markdown/heading-ids.d.ts.map +1 -0
  135. package/dist/components/ui/markdown/index.d.ts +18 -0
  136. package/dist/components/ui/markdown/index.d.ts.map +1 -0
  137. package/dist/components/ui/markdown/mermaid-diagram.d.ts +79 -0
  138. package/dist/components/ui/markdown/mermaid-diagram.d.ts.map +1 -0
  139. package/dist/components/ui/markdown/rich/embed-overrides.d.ts +14 -0
  140. package/dist/components/ui/markdown/rich/embed-overrides.d.ts.map +1 -0
  141. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts +40 -0
  142. package/dist/components/ui/markdown/rich/rich-markdown-renderer.d.ts.map +1 -0
  143. package/dist/components/ui/markdown/rich/shortcodes.d.ts +8 -0
  144. package/dist/components/ui/markdown/rich/shortcodes.d.ts.map +1 -0
  145. package/dist/components/ui/markdown/sanitize.d.ts +153 -0
  146. package/dist/components/ui/markdown/sanitize.d.ts.map +1 -0
  147. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts +23 -0
  148. package/dist/components/ui/markdown/simple-markdown-renderer.d.ts.map +1 -0
  149. package/dist/components/ui/markdown/streaming.d.ts +78 -0
  150. package/dist/components/ui/markdown/streaming.d.ts.map +1 -0
  151. package/dist/components/ui/markdown/text-size.d.ts +34 -0
  152. package/dist/components/ui/markdown/text-size.d.ts.map +1 -0
  153. package/dist/index.cjs +60 -2
  154. package/dist/index.cjs.map +1 -1
  155. package/dist/index.js +71 -13
  156. package/dist/utils/index.cjs +169 -40
  157. package/dist/utils/index.cjs.map +1 -1
  158. package/dist/utils/index.d.ts +1 -0
  159. package/dist/utils/index.d.ts.map +1 -1
  160. package/dist/utils/index.js +162 -41
  161. package/dist/utils/index.js.map +1 -1
  162. package/dist/utils/markdown-fences.d.ts +42 -0
  163. package/dist/utils/markdown-fences.d.ts.map +1 -0
  164. package/dist/utils/markdown-heading-id.d.ts +85 -0
  165. package/dist/utils/markdown-heading-id.d.ts.map +1 -0
  166. package/dist/utils/markdown-section-extractor.d.ts.map +1 -1
  167. package/package.json +7 -1
  168. package/src/chat-protocol/__tests__/__snapshots__/nats-decoder-golden.test.ts.snap +307 -0
  169. package/src/chat-protocol/__tests__/chat-protocol.test.ts +516 -0
  170. package/src/chat-protocol/__tests__/env-flag.test.ts +52 -0
  171. package/src/chat-protocol/__tests__/ip-normalize.test.ts +136 -0
  172. package/src/chat-protocol/__tests__/nats-decoder-golden.test.ts +228 -0
  173. package/src/chat-protocol/decode.ts +278 -0
  174. package/src/chat-protocol/encode.ts +71 -0
  175. package/src/chat-protocol/env-flag.ts +39 -0
  176. package/src/chat-protocol/events.ts +232 -0
  177. package/src/chat-protocol/frames.ts +245 -0
  178. package/src/chat-protocol/index.ts +21 -0
  179. package/src/chat-protocol/ip-normalize.ts +146 -0
  180. package/src/chat-protocol/nats-decoder.ts +252 -0
  181. package/src/components/chat/__tests__/chat-message-list.test.tsx +293 -5
  182. package/src/components/chat/__tests__/chat-message-streaming-memo.test.tsx +207 -0
  183. package/src/components/chat/__tests__/chat-pending-turn.test.tsx +209 -0
  184. package/src/components/chat/chat-message-enhanced.tsx +111 -17
  185. package/src/components/chat/chat-message-list.tsx +358 -109
  186. package/src/components/chat/embeddable-chat.tsx +6 -0
  187. package/src/components/chat/hooks/.index.md +30 -33
  188. package/src/components/chat/hooks/.use-nats-chat-adapter.md +36 -55
  189. package/src/components/chat/hooks/__tests__/__snapshots__/conversation-id-persistence-golden.test.ts.snap +37 -0
  190. package/src/components/chat/hooks/__tests__/__snapshots__/sse-stream-golden.test.ts.snap +0 -0
  191. package/src/components/chat/hooks/__tests__/conversation-id-persistence-golden.test.ts +438 -0
  192. package/src/components/chat/hooks/__tests__/sse-stream-golden.test.ts +318 -0
  193. package/src/components/chat/hooks/index.ts +0 -1
  194. package/src/components/chat/hooks/use-chat.ts +8 -0
  195. package/src/components/chat/hooks/use-nats-chat-adapter.ts +243 -823
  196. package/src/components/chat/hooks/use-sse-chat-adapter.ts +380 -684
  197. package/src/components/chat/index.ts +5 -0
  198. package/src/components/chat/stream/__tests__/__snapshots__/chat-stream-reducer-golden.test.ts.snap +940 -0
  199. package/src/components/chat/stream/__tests__/chat-dialog-store.test.ts +756 -0
  200. package/src/components/chat/stream/__tests__/chat-stream-reducer-golden.test.ts +460 -0
  201. package/src/components/chat/stream/__tests__/chat-stream-reducer.test.ts +894 -0
  202. package/src/components/chat/stream/__tests__/delta-batcher.test.ts +255 -0
  203. package/src/components/chat/stream/__tests__/use-chat-stream-reducer.test.ts +98 -0
  204. package/src/components/chat/stream/chat-dialog-store.ts +536 -0
  205. package/src/components/chat/stream/chat-stream-reducer.ts +1796 -0
  206. package/src/components/chat/stream/delta-batcher.ts +159 -0
  207. package/src/components/chat/stream/index.ts +55 -0
  208. package/src/components/chat/stream/message-mutations.ts +338 -0
  209. package/src/components/chat/stream/use-chat-stream-reducer.ts +126 -0
  210. package/src/components/chat/thinking-display.tsx +1 -1
  211. package/src/components/chat/types/.api.types.md +39 -49
  212. package/src/components/chat/types/.processing.types.md +29 -58
  213. package/src/components/chat/types/api.types.ts +6 -73
  214. package/src/components/chat/types/processing.types.ts +11 -52
  215. package/src/components/chat/utils/.index.md +31 -40
  216. package/src/components/chat/utils/__tests__/__snapshots__/process-historical-messages-golden.test.ts.snap +420 -0
  217. package/src/components/chat/utils/__tests__/__snapshots__/segment-accumulator-golden.test.ts.snap +605 -0
  218. package/src/components/chat/utils/__tests__/process-historical-messages-golden.test.ts +317 -0
  219. package/src/components/chat/utils/__tests__/segment-accumulator-golden.test.ts +270 -0
  220. package/src/components/chat/utils/extract-incomplete-message-state.ts +63 -5
  221. package/src/components/chat/utils/index.ts +5 -8
  222. package/src/components/chat/utils/process-historical-messages.ts +352 -384
  223. package/src/components/onboarding-guides/onboarding-guide-detail-view.tsx +22 -4
  224. package/src/components/shared/legal-document/legal-document-page.tsx +1 -1
  225. package/src/components/shared/product-release/release-detail-page.tsx +19 -4
  226. package/src/components/ui/__tests__/__snapshots__/markdown-parity.test.tsx.snap +2420 -0
  227. package/src/components/ui/__tests__/markdown-parity.test.tsx +2528 -0
  228. package/src/components/ui/index.ts +1 -2
  229. package/src/components/ui/markdown/__tests__/mermaid-security.test.ts +115 -0
  230. package/src/components/ui/markdown/__tests__/mermaid-stale-render.test.tsx +95 -0
  231. package/src/components/ui/markdown/__tests__/sanitize-invariant.test.ts +309 -0
  232. package/src/components/ui/markdown/__tests__/streaming.test.tsx +388 -0
  233. package/src/components/ui/markdown/base-components.tsx +360 -0
  234. package/src/components/ui/markdown/engine.tsx +315 -0
  235. package/src/components/ui/markdown/heading-ids.ts +239 -0
  236. package/src/components/ui/markdown/index.ts +49 -0
  237. package/src/components/ui/markdown/mermaid-diagram.tsx +291 -0
  238. package/src/components/ui/markdown/rich/embed-overrides.tsx +199 -0
  239. package/src/components/ui/markdown/rich/rich-markdown-renderer.tsx +184 -0
  240. package/src/components/ui/markdown/rich/shortcodes.ts +170 -0
  241. package/src/components/ui/markdown/sanitize.ts +3499 -0
  242. package/src/components/ui/markdown/simple-markdown-renderer.tsx +28 -0
  243. package/src/components/ui/markdown/streaming.ts +362 -0
  244. package/src/components/ui/markdown/text-size.ts +106 -0
  245. package/src/components/ui/release-changelog-section.tsx +1 -1
  246. package/src/components/ui/ticket-info-section.tsx +1 -1
  247. package/src/utils/index.ts +1 -0
  248. package/src/utils/markdown-fences.ts +127 -0
  249. package/src/utils/markdown-heading-id.ts +348 -0
  250. package/src/utils/markdown-section-extractor.ts +41 -56
  251. package/dist/chunk-IN4IO7BL.cjs.map +0 -1
  252. package/dist/chunk-LLEDO4P7.cjs.map +0 -1
  253. package/dist/chunk-N4MTNTSX.js.map +0 -1
  254. package/dist/chunk-VLOE7MI2.cjs.map +0 -1
  255. package/dist/chunk-W6ZUOWSB.js.map +0 -1
  256. package/dist/chunk-YMJZOANX.js.map +0 -1
  257. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts +0 -6
  258. package/dist/components/chat/hooks/use-realtime-chunk-processor.d.ts.map +0 -1
  259. package/dist/components/chat/utils/chunk-parser.d.ts +0 -25
  260. package/dist/components/chat/utils/chunk-parser.d.ts.map +0 -1
  261. package/dist/components/ui/rich-markdown-renderer.d.ts +0 -34
  262. package/dist/components/ui/rich-markdown-renderer.d.ts.map +0 -1
  263. package/dist/components/ui/simple-markdown-renderer.d.ts +0 -73
  264. package/dist/components/ui/simple-markdown-renderer.d.ts.map +0 -1
  265. package/src/components/chat/hooks/.use-realtime-chunk-processor.md +0 -77
  266. package/src/components/chat/hooks/use-realtime-chunk-processor.ts +0 -479
  267. package/src/components/chat/utils/.chunk-parser.md +0 -62
  268. package/src/components/chat/utils/chunk-parser.ts +0 -256
  269. package/src/components/ui/.simple-markdown-renderer.md +0 -52
  270. package/src/components/ui/rich-markdown-renderer.tsx +0 -1223
  271. package/src/components/ui/simple-markdown-renderer.tsx +0 -964
  272. /package/dist/{chunk-K7MNWYYI.js.map → chunk-4NWARV5I.js.map} +0 -0
  273. /package/dist/{chunk-TWGYBXYV.js.map → chunk-CORIBKHG.js.map} +0 -0
  274. /package/dist/{chunk-EU6QNO4S.js.map → chunk-GTWO5NAY.js.map} +0 -0
  275. /package/dist/{chunk-BGWDDB7Y.js.map → chunk-HSACATCD.js.map} +0 -0
  276. /package/dist/{chunk-VL4LUO32.js.map → chunk-RQLBHKXN.js.map} +0 -0
  277. /package/dist/{chunk-B4YR342L.js.map → chunk-UUYRJPGJ.js.map} +0 -0
  278. /package/dist/{chunk-FKPXFTZT.js.map → chunk-VHG6AX5V.js.map} +0 -0
  279. /package/dist/{chunk-X2YF5TJS.js.map → chunk-XQ2B74SI.js.map} +0 -0
  280. /package/dist/{chunk-5VSEMWWE.js.map → chunk-YZ2OIYQ3.js.map} +0 -0
@@ -1,70 +1,60 @@
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.
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.
3
3
 
4
4
  ## Key Components
5
5
 
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
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`
20
28
 
21
29
  ## Usage Example
22
30
 
23
31
  ```typescript
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)
36
- },
37
- onToolExecuted: (segment) => mergeToolResult(segment),
38
- onApprovalResolved: (requestId, status, approvalType) => {
39
- updateApprovalCard(requestId, status)
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),
40
42
  },
41
- }
42
-
43
- const processorOptions: UseRealtimeChunkProcessorOptions = {
44
- callbacks,
45
- displayApprovalTypes: ['CLIENT'],
46
43
  batchApprovalsEnabled: true,
47
- initialState: {
48
- existingSegments: historicalSegments,
49
- executingTools: new Map(),
50
- },
44
+ displayApprovalTypes: ['CLIENT'],
45
+ enableThinking: false,
51
46
  }
52
47
 
53
48
  const natsOptions: UseNatsDialogSubscriptionOptions = {
54
49
  enabled: true,
55
50
  dialogId: 'dialog-123',
56
- topics: ['message'],
57
51
  getNatsWsUrl: () => 'wss://nats.example.com',
58
- onBeforeReconnect: async () => refreshAuthToken(),
59
52
  reconnectionBackoff: {
60
53
  fastRetries: 3,
61
54
  fastRetryDelayMs: 500,
62
- maxDelayMs: 30_000,
55
+ maxDelayMs: 30000,
63
56
  multiplier: 2,
64
57
  },
58
+ onBeforeReconnect: async () => refreshAuthToken(),
65
59
  }
66
- ```
67
-
68
- ## Source
69
-
70
- [`api.types.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/api.types.ts)
60
+ ```
@@ -1,80 +1,51 @@
1
- <!-- source-hash: bdb71cca9908cf9cfebf089a00d84db8 -->
2
- Defines TypeScript types for the message processing pipeline, covering chunk parsing, state accumulation, stream control, and buffer management.
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.
3
3
 
4
4
  ## Key Components
5
5
 
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
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 |
29
15
 
30
16
  ## Usage Example
31
17
 
32
18
  ```typescript
33
19
  import type {
34
- ParsedChunkAction,
35
20
  AccumulatorState,
36
21
  MessageProcessingOptions,
37
- StreamState,
22
+ StreamState
38
23
  } from './processing.types'
39
24
 
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
- }
25
+
26
+ // Initializing accumulator state
27
+ const state: AccumulatorState = {
28
+ segments: [],
29
+ pendingApprovals: new Map(),
30
+ executingTools: new Map()
56
31
  }
57
32
 
58
- // Configure message processing with batch approvals enabled
33
+ // Configuring message processing
59
34
  const options: MessageProcessingOptions = {
60
35
  assistantName: 'Mingo',
61
36
  assistantType: 'mingo',
62
- batchApprovalsEnabled: true, // consumer sets this from their feature flag
63
- displayApprovalTypes: ['shell', 'file_write'],
37
+ batchApprovalsEnabled: true,
38
+ displayApprovalTypes: ['shell', 'file'],
64
39
  onApprove: async (requestId) => {
65
- await fetch(`/api/approvals/${requestId}/approve`, { method: 'POST' })
66
- },
67
- onReject: async (requestId) => {
68
- await fetch(`/api/approvals/${requestId}/reject`, { method: 'POST' })
40
+ await submitApproval(requestId)
69
41
  },
70
- }
71
-
72
- // Initialize accumulator state
73
- const state: AccumulatorState = {
74
- segments: [],
75
- pendingApprovals: new Map(),
76
- executingTools: new Map(),
42
+ onReject: (requestId) => {
43
+ logRejection(requestId)
44
+ }
77
45
  }
78
46
  ```
79
47
 
80
- **Source:** [`processing.types.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/processing.types.ts)
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`.
@@ -213,79 +213,12 @@ export interface RealtimeChunkCallbacks {
213
213
  onDialogClosed?: () => void
214
214
  }
215
215
 
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
- }
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`.
289
222
 
290
223
  // ========== API Request Types ==========
291
224
 
@@ -3,37 +3,14 @@
3
3
  * Contains types for message parsing, accumulation, and processing
4
4
  */
5
5
 
6
- import type { MessageSegment, ProcessedMessage, ToolExecutionSegment, TokenUsageData, PendingToolCallData, ExecutingToolState } from './message.types'
6
+ import type { MessageSegment, PendingToolCallData, ExecutingToolState } from './message.types'
7
7
  import type { ChatApprovalStatus, AssistantType } from './chat.types'
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: 'tool_execution'; segment: ToolExecutionSegment }
20
- | { action: 'approval_request'; requestId: string; command: string; explanation?: string; approvalType: string }
21
- | { action: 'approval_batch'; requestId: string; approvalType: string; toolCalls: PendingToolCallData[] }
22
- | { action: 'approval_result'; requestId: string; approved: boolean; approvalType: string; resolvedByName?: string | null }
23
- | {
24
- action: 'message_request'
25
- text: string
26
- ownerType?: string
27
- displayName?: string
28
- userId?: string
29
- contextItems?: Array<{ type: string; id: string }>
30
- }
31
- | { action: 'token_usage'; data: TokenUsageData }
32
- | { action: 'direct_message'; text: string; ownerType?: string; displayName?: string; userId?: string }
33
- | { action: 'system'; text: string }
34
- | { action: 'context_compaction_start' }
35
- | { action: 'context_compaction_end'; summary?: string }
36
- | { action: 'dialog_closed' }
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`.
37
14
 
38
15
  // ========== Accumulator State ==========
39
16
 
@@ -81,31 +58,13 @@ export interface MessageProcessingOptions {
81
58
  batchApprovalsEnabled?: boolean
82
59
  }
83
60
 
84
- // ========== Chunk Processing Types ==========
85
-
86
- export interface ChunkProcessor {
87
- processChunk: (chunk: ChunkData, messageType: NatsMessageType) => ParsedChunkAction | null
88
- reset: () => void
89
- }
90
-
91
- export interface ChunkProcessorOptions {
92
- onMessageStart?: () => void
93
- onMessageEnd?: () => void
94
- onError?: (error: string, details?: string) => void
95
- onText?: (text: string) => void
96
- onToolExecution?: (segment: MessageSegment) => void
97
- onApprovalRequest?: (data: any) => void
98
- onApprovalResult?: (data: any) => void
99
- onMetadata?: (data: any) => void
100
- }
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.
101
65
 
102
66
  // ========== Message Transformation Types ==========
103
67
 
104
- export interface MessageTransformer {
105
- transform: (input: any) => ProcessedMessage | null
106
- batch: (inputs: any[]) => ProcessedMessage[]
107
- }
108
-
109
68
  export interface TransformationOptions {
110
69
  preserveOriginal?: boolean
111
70
  mergeSegments?: boolean
@@ -1,57 +1,48 @@
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.
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.
3
3
 
4
4
  ## Key Components
5
5
 
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 *` |
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` |
19
17
 
20
18
  ## Usage Example
21
19
 
22
20
  ```typescript
23
21
  import {
24
- parseChunkToAction,
25
22
  createMessageSegmentAccumulator,
26
- executeNavigation,
27
- resolveIcon,
28
- getStatusColorScheme,
29
- mergeHistoryWithRealtime,
23
+ handleChatNavClick,
24
+ getChatProxyAuth,
25
+ getIconComponent,
30
26
  formatChatAttachmentMarkdownForBubble,
31
- } from '@openframe/chat-utils'
32
-
33
- // Parse a streaming chunk
34
- const action = parseChunkToAction(rawChunk)
27
+ decideNewTab,
28
+ getStatusColorScheme,
29
+ } from '@flamingo/chat-utils'
35
30
 
36
- // Accumulate message segments from a stream
31
+ // Accumulate streamed message segments
37
32
  const accumulator = createMessageSegmentAccumulator({
38
- onSegmentComplete: (segment) => console.log('Segment done:', segment),
33
+ onSegmentComplete: (segment) => console.log('Segment:', segment),
39
34
  })
40
35
 
41
- // Execute navigation respecting new-tab rules
42
- executeNavigation({
43
- href: '/tickets/123',
44
- event: clickEvent,
45
- surface: 'chat',
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',
46
41
  })
47
42
 
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
43
+ // Look up a registered icon by kebab-case key
44
+ const Icon = getIconComponent('clickup')
56
45
 
57
- [`index.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/index.ts)
46
+ // Apply agent status color scheme to UI
47
+ const colors = getStatusColorScheme('running')
48
+ ```