@flamingo-stack/openframe-frontend-core 0.0.598 → 0.0.599-2039.5717.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 (206) hide show
  1. package/dist/chat-protocol/index.cjs +8 -1
  2. package/dist/chat-protocol/index.cjs.map +1 -1
  3. package/dist/chat-protocol/index.d.ts +1 -0
  4. package/dist/chat-protocol/index.d.ts.map +1 -1
  5. package/dist/chat-protocol/index.js +7 -2
  6. package/dist/chat-protocol/index.js.map +1 -1
  7. package/dist/chat-protocol/nats-decoder.d.ts.map +1 -1
  8. package/dist/chat-protocol/wire-narrow.d.ts +17 -0
  9. package/dist/chat-protocol/wire-narrow.d.ts.map +1 -0
  10. package/dist/{chunk-BK6CCQG6.js → chunk-2R6F56U5.js} +12 -12
  11. package/dist/{chunk-STYNZ4QM.cjs → chunk-3IXDZI3R.cjs} +3 -3
  12. package/dist/{chunk-STYNZ4QM.cjs.map → chunk-3IXDZI3R.cjs.map} +1 -1
  13. package/dist/{chunk-QIKBISZM.cjs → chunk-4ZAQSPCQ.cjs} +242 -242
  14. package/dist/{chunk-QIKBISZM.cjs.map → chunk-4ZAQSPCQ.cjs.map} +1 -1
  15. package/dist/{chunk-JVZVVZOZ.cjs → chunk-5DORSDXA.cjs} +9 -9
  16. package/dist/{chunk-JVZVVZOZ.cjs.map → chunk-5DORSDXA.cjs.map} +1 -1
  17. package/dist/{chunk-YWBAIFI2.cjs → chunk-6D4DUONA.cjs} +105 -105
  18. package/dist/{chunk-YWBAIFI2.cjs.map → chunk-6D4DUONA.cjs.map} +1 -1
  19. package/dist/{chunk-KHOZ52NR.js → chunk-7654NDQB.js} +6 -6
  20. package/dist/{chunk-DI3SVVY5.cjs → chunk-AC5SWE3S.cjs} +85 -85
  21. package/dist/{chunk-DI3SVVY5.cjs.map → chunk-AC5SWE3S.cjs.map} +1 -1
  22. package/dist/{chunk-R4UV366K.js → chunk-AJU3NYAA.js} +6 -6
  23. package/dist/{chunk-GHYFVT52.js → chunk-B23ID4DM.js} +5 -5
  24. package/dist/{chunk-SE3PVN64.js → chunk-B6HSRLC5.js} +2 -2
  25. package/dist/{chunk-EVMHJB6X.js → chunk-BLUL2TE3.js} +4 -4
  26. package/dist/{chunk-GGQZBSFN.js → chunk-BVQEU5JB.js} +2 -2
  27. package/dist/{chunk-75YW6ET4.js → chunk-C4APMQWW.js} +4 -4
  28. package/dist/{chunk-H64ZHSYR.cjs → chunk-CCWI3622.cjs} +4 -4
  29. package/dist/{chunk-H64ZHSYR.cjs.map → chunk-CCWI3622.cjs.map} +1 -1
  30. package/dist/{chunk-WPN545FW.js → chunk-CVYVYSP2.js} +12 -12
  31. package/dist/{chunk-YH6IQTPI.cjs → chunk-EHAYNUOL.cjs} +3 -3
  32. package/dist/{chunk-YH6IQTPI.cjs.map → chunk-EHAYNUOL.cjs.map} +1 -1
  33. package/dist/{chunk-VIRTMRS4.js → chunk-EZOI5UR3.js} +7 -7
  34. package/dist/{chunk-WZJOILPU.js → chunk-F2KBCLUG.js} +2 -2
  35. package/dist/{chunk-MYBXCWEI.js → chunk-FKBM6U43.js} +2 -2
  36. package/dist/{chunk-2SYX2Z7R.cjs → chunk-GIG3WQTF.cjs} +34 -34
  37. package/dist/{chunk-2SYX2Z7R.cjs.map → chunk-GIG3WQTF.cjs.map} +1 -1
  38. package/dist/{chunk-LRQCKSZC.js → chunk-IW746HJ7.js} +2 -2
  39. package/dist/{chunk-YBPFIXV4.cjs → chunk-IYEKAU4X.cjs} +801 -482
  40. package/dist/chunk-IYEKAU4X.cjs.map +1 -0
  41. package/dist/{chunk-VLJTJAHJ.cjs → chunk-J3ODLFCA.cjs} +25 -25
  42. package/dist/{chunk-VLJTJAHJ.cjs.map → chunk-J3ODLFCA.cjs.map} +1 -1
  43. package/dist/{chunk-UE7OFLLS.cjs → chunk-J4RRF2EP.cjs} +14 -14
  44. package/dist/{chunk-UE7OFLLS.cjs.map → chunk-J4RRF2EP.cjs.map} +1 -1
  45. package/dist/{chunk-M4YQUHOR.cjs → chunk-JJUV7Z4L.cjs} +15 -15
  46. package/dist/{chunk-M4YQUHOR.cjs.map → chunk-JJUV7Z4L.cjs.map} +1 -1
  47. package/dist/{chunk-UG7JNQZY.cjs → chunk-JKFWKPHW.cjs} +37 -37
  48. package/dist/{chunk-UG7JNQZY.cjs.map → chunk-JKFWKPHW.cjs.map} +1 -1
  49. package/dist/{chunk-3WSS7C2V.cjs → chunk-KAHI4QWA.cjs} +15 -15
  50. package/dist/{chunk-3WSS7C2V.cjs.map → chunk-KAHI4QWA.cjs.map} +1 -1
  51. package/dist/{chunk-VNSRNVPD.js → chunk-KJ5EQ6P6.js} +728 -409
  52. package/dist/chunk-KJ5EQ6P6.js.map +1 -0
  53. package/dist/{chunk-V2QK5W3O.cjs → chunk-L64FTMML.cjs} +3 -3
  54. package/dist/{chunk-V2QK5W3O.cjs.map → chunk-L64FTMML.cjs.map} +1 -1
  55. package/dist/{chunk-P24VPJTT.cjs → chunk-LT6GIGMZ.cjs} +15 -15
  56. package/dist/{chunk-P24VPJTT.cjs.map → chunk-LT6GIGMZ.cjs.map} +1 -1
  57. package/dist/{chunk-WDWCQD75.js → chunk-LVVDTK5X.js} +9 -9
  58. package/dist/{chunk-HWAYIK4U.cjs → chunk-MSPYY2F4.cjs} +22 -22
  59. package/dist/{chunk-HWAYIK4U.cjs.map → chunk-MSPYY2F4.cjs.map} +1 -1
  60. package/dist/{chunk-QD64Q4I2.cjs → chunk-N7LOLURS.cjs} +9 -9
  61. package/dist/{chunk-QD64Q4I2.cjs.map → chunk-N7LOLURS.cjs.map} +1 -1
  62. package/dist/{chunk-TZPVRWPU.js → chunk-O33JVUR5.js} +5 -5
  63. package/dist/{chunk-HLPAVYK7.js → chunk-ODPN724R.js} +4 -4
  64. package/dist/{chunk-NIAMPMKV.js → chunk-OQNKAF4F.js} +4 -4
  65. package/dist/{chunk-SAEJGTCI.cjs → chunk-QPAPUIF3.cjs} +35 -35
  66. package/dist/{chunk-SAEJGTCI.cjs.map → chunk-QPAPUIF3.cjs.map} +1 -1
  67. package/dist/{chunk-BPVHDDNY.cjs → chunk-R2VBMBPJ.cjs} +8 -8
  68. package/dist/{chunk-BPVHDDNY.cjs.map → chunk-R2VBMBPJ.cjs.map} +1 -1
  69. package/dist/{chunk-UAAXUFK6.js → chunk-RU3IKVY2.js} +3 -3
  70. package/dist/{chunk-EZM5DNII.js → chunk-S6WBBSII.js} +3 -3
  71. package/dist/{chunk-2JNCZDJR.js → chunk-TSCIVH7T.js} +2 -2
  72. package/dist/{chunk-PX4IPM7Q.js → chunk-TYY6HOTI.js} +3 -3
  73. package/dist/{chunk-RDTOMWDN.cjs → chunk-UPKZU6QU.cjs} +1 -1
  74. package/dist/chunk-UPKZU6QU.cjs.map +1 -0
  75. package/dist/{chunk-WCBRZCU4.cjs → chunk-UQEOAPAI.cjs} +9 -9
  76. package/dist/{chunk-WCBRZCU4.cjs.map → chunk-UQEOAPAI.cjs.map} +1 -1
  77. package/dist/{chunk-O4VZOA2Q.cjs → chunk-UXOOVP77.cjs} +3 -3
  78. package/dist/{chunk-O4VZOA2Q.cjs.map → chunk-UXOOVP77.cjs.map} +1 -1
  79. package/dist/{chunk-PTK3CINU.js → chunk-VELZVF3F.js} +5 -5
  80. package/dist/{chunk-BZEWPW5A.cjs → chunk-VIBREYUK.cjs} +3 -3
  81. package/dist/{chunk-BZEWPW5A.cjs.map → chunk-VIBREYUK.cjs.map} +1 -1
  82. package/dist/{chunk-RYXIRVDC.js → chunk-YB6FI2G3.js} +1 -1
  83. package/dist/chunk-YB6FI2G3.js.map +1 -0
  84. package/dist/{chunk-DAPOBLAK.cjs → chunk-YEO6W4CT.cjs} +39 -39
  85. package/dist/{chunk-DAPOBLAK.cjs.map → chunk-YEO6W4CT.cjs.map} +1 -1
  86. package/dist/{chunk-XNPAVMPB.js → chunk-YUELNVD5.js} +5 -5
  87. package/dist/components/case-studies/index.cjs +14 -14
  88. package/dist/components/case-studies/index.js +8 -8
  89. package/dist/components/chat/embeddable-chat.d.ts +10 -19
  90. package/dist/components/chat/embeddable-chat.d.ts.map +1 -1
  91. package/dist/components/chat/hooks/index.d.ts +1 -0
  92. package/dist/components/chat/hooks/index.d.ts.map +1 -1
  93. package/dist/components/chat/hooks/use-chat-history-hydration.d.ts +13 -3
  94. package/dist/components/chat/hooks/use-chat-history-hydration.d.ts.map +1 -1
  95. package/dist/components/chat/hooks/use-managed-dialog-list.d.ts +53 -0
  96. package/dist/components/chat/hooks/use-managed-dialog-list.d.ts.map +1 -0
  97. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts +2 -16
  98. package/dist/components/chat/hooks/use-nats-chat-adapter.d.ts.map +1 -1
  99. package/dist/components/chat/hooks/use-sse-chat-adapter.d.ts.map +1 -1
  100. package/dist/components/chat/hooks/use-unified-chat.d.ts +12 -1
  101. package/dist/components/chat/hooks/use-unified-chat.d.ts.map +1 -1
  102. package/dist/components/chat/index.cjs +11 -5
  103. package/dist/components/chat/index.cjs.map +1 -1
  104. package/dist/components/chat/index.js +10 -4
  105. package/dist/components/chat/types/unified-chat-state.types.d.ts +86 -6
  106. package/dist/components/chat/types/unified-chat-state.types.d.ts.map +1 -1
  107. package/dist/components/chat/utils/chat-conversations-api.d.ts +29 -0
  108. package/dist/components/chat/utils/chat-conversations-api.d.ts.map +1 -0
  109. package/dist/components/chat/utils/index.d.ts +1 -0
  110. package/dist/components/chat/utils/index.d.ts.map +1 -1
  111. package/dist/components/contact/index.cjs +9 -9
  112. package/dist/components/contact/index.js +8 -8
  113. package/dist/components/docs/index.cjs +12 -12
  114. package/dist/components/docs/index.js +11 -11
  115. package/dist/components/embeds/index.cjs +9 -9
  116. package/dist/components/embeds/index.js +8 -8
  117. package/dist/components/faq/index.cjs +10 -10
  118. package/dist/components/faq/index.js +9 -9
  119. package/dist/components/features/index.cjs +8 -8
  120. package/dist/components/features/index.js +7 -7
  121. package/dist/components/help-center-pages/index.cjs +31 -31
  122. package/dist/components/help-center-pages/index.js +22 -22
  123. package/dist/components/index.cjs +72 -66
  124. package/dist/components/index.cjs.map +1 -1
  125. package/dist/components/index.js +28 -22
  126. package/dist/components/index.js.map +1 -1
  127. package/dist/components/meeting-scheduler/index.cjs +49 -49
  128. package/dist/components/meeting-scheduler/index.js +9 -9
  129. package/dist/components/navigation/index.cjs +11 -11
  130. package/dist/components/navigation/index.js +10 -10
  131. package/dist/components/onboarding-guides/index.cjs +12 -12
  132. package/dist/components/onboarding-guides/index.js +11 -11
  133. package/dist/components/related-content/index.cjs +7 -7
  134. package/dist/components/related-content/index.js +6 -6
  135. package/dist/components/tickets/index.cjs +13 -13
  136. package/dist/components/tickets/index.js +12 -12
  137. package/dist/components/ui/index.cjs +14 -8
  138. package/dist/components/ui/index.cjs.map +1 -1
  139. package/dist/components/ui/index.js +13 -7
  140. package/dist/contexts/chat-runtime-context.d.ts +12 -0
  141. package/dist/contexts/chat-runtime-context.d.ts.map +1 -1
  142. package/dist/contexts/index.cjs +2 -2
  143. package/dist/contexts/index.js +1 -1
  144. package/dist/hooks/index.cjs +5 -5
  145. package/dist/hooks/index.js +4 -4
  146. package/dist/index.cjs +18 -12
  147. package/dist/index.cjs.map +1 -1
  148. package/dist/index.js +17 -11
  149. package/dist/index.js.map +1 -1
  150. package/package.json +1 -1
  151. package/src/chat-protocol/index.ts +1 -0
  152. package/src/chat-protocol/nats-decoder.ts +1 -5
  153. package/src/chat-protocol/wire-narrow.ts +22 -0
  154. package/src/components/chat/.embeddable-chat.md +4 -2
  155. package/src/components/chat/embeddable-chat.tsx +131 -87
  156. package/src/components/chat/hooks/.index.md +1 -1
  157. package/src/components/chat/hooks/.use-managed-dialog-list.md +31 -0
  158. package/src/components/chat/hooks/.use-nats-chat-adapter.md +3 -1
  159. package/src/components/chat/hooks/.use-sse-chat-adapter.md +8 -1
  160. package/src/components/chat/hooks/.use-unified-chat.md +2 -2
  161. package/src/components/chat/hooks/__tests__/managed-dialog-list.test.ts +280 -0
  162. package/src/components/chat/hooks/__tests__/nats-adapter-managed-dialogs.test.ts +193 -0
  163. package/src/components/chat/hooks/__tests__/sse-managed-dialogs.test.ts +310 -0
  164. package/src/components/chat/hooks/__tests__/unified-chat-dialog-capabilities.test.ts +129 -0
  165. package/src/components/chat/hooks/index.ts +2 -0
  166. package/src/components/chat/hooks/use-chat-history-hydration.ts +67 -24
  167. package/src/components/chat/hooks/use-managed-dialog-list.ts +339 -0
  168. package/src/components/chat/hooks/use-nats-chat-adapter.ts +64 -150
  169. package/src/components/chat/hooks/use-sse-chat-adapter.ts +238 -59
  170. package/src/components/chat/hooks/use-unified-chat.ts +26 -2
  171. package/src/components/chat/types/.unified-chat-state.types.md +13 -1
  172. package/src/components/chat/types/unified-chat-state.types.ts +93 -6
  173. package/src/components/chat/utils/.chat-conversations-api.md +16 -0
  174. package/src/components/chat/utils/.index.md +1 -1
  175. package/src/components/chat/utils/__tests__/chat-conversations-api-golden.test.ts +105 -0
  176. package/src/components/chat/utils/chat-conversations-api.ts +83 -0
  177. package/src/components/chat/utils/index.ts +7 -0
  178. package/src/contexts/.chat-runtime-context.md +3 -1
  179. package/src/contexts/chat-runtime-context.tsx +12 -0
  180. package/dist/chunk-RDTOMWDN.cjs.map +0 -1
  181. package/dist/chunk-RYXIRVDC.js.map +0 -1
  182. package/dist/chunk-VNSRNVPD.js.map +0 -1
  183. package/dist/chunk-YBPFIXV4.cjs.map +0 -1
  184. /package/dist/{chunk-BK6CCQG6.js.map → chunk-2R6F56U5.js.map} +0 -0
  185. /package/dist/{chunk-KHOZ52NR.js.map → chunk-7654NDQB.js.map} +0 -0
  186. /package/dist/{chunk-R4UV366K.js.map → chunk-AJU3NYAA.js.map} +0 -0
  187. /package/dist/{chunk-GHYFVT52.js.map → chunk-B23ID4DM.js.map} +0 -0
  188. /package/dist/{chunk-SE3PVN64.js.map → chunk-B6HSRLC5.js.map} +0 -0
  189. /package/dist/{chunk-EVMHJB6X.js.map → chunk-BLUL2TE3.js.map} +0 -0
  190. /package/dist/{chunk-GGQZBSFN.js.map → chunk-BVQEU5JB.js.map} +0 -0
  191. /package/dist/{chunk-75YW6ET4.js.map → chunk-C4APMQWW.js.map} +0 -0
  192. /package/dist/{chunk-WPN545FW.js.map → chunk-CVYVYSP2.js.map} +0 -0
  193. /package/dist/{chunk-VIRTMRS4.js.map → chunk-EZOI5UR3.js.map} +0 -0
  194. /package/dist/{chunk-WZJOILPU.js.map → chunk-F2KBCLUG.js.map} +0 -0
  195. /package/dist/{chunk-MYBXCWEI.js.map → chunk-FKBM6U43.js.map} +0 -0
  196. /package/dist/{chunk-LRQCKSZC.js.map → chunk-IW746HJ7.js.map} +0 -0
  197. /package/dist/{chunk-WDWCQD75.js.map → chunk-LVVDTK5X.js.map} +0 -0
  198. /package/dist/{chunk-TZPVRWPU.js.map → chunk-O33JVUR5.js.map} +0 -0
  199. /package/dist/{chunk-HLPAVYK7.js.map → chunk-ODPN724R.js.map} +0 -0
  200. /package/dist/{chunk-NIAMPMKV.js.map → chunk-OQNKAF4F.js.map} +0 -0
  201. /package/dist/{chunk-UAAXUFK6.js.map → chunk-RU3IKVY2.js.map} +0 -0
  202. /package/dist/{chunk-EZM5DNII.js.map → chunk-S6WBBSII.js.map} +0 -0
  203. /package/dist/{chunk-2JNCZDJR.js.map → chunk-TSCIVH7T.js.map} +0 -0
  204. /package/dist/{chunk-PX4IPM7Q.js.map → chunk-TYY6HOTI.js.map} +0 -0
  205. /package/dist/{chunk-PTK3CINU.js.map → chunk-VELZVF3F.js.map} +0 -0
  206. /package/dist/{chunk-XNPAVMPB.js.map → chunk-YUELNVD5.js.map} +0 -0
@@ -79,7 +79,6 @@ import { useChatDialogManager } from './hooks/use-chat-dialog-manager';
79
79
  import { useChatIdentity } from './hooks/use-chat-identity';
80
80
  import { useCloseOnNavigation } from './hooks/use-close-on-navigation';
81
81
  import { useEmptyStateConfig } from './hooks/use-empty-state-config';
82
- import type { FetchDialogsParams, FetchDialogsResult } from './hooks/use-nats-chat-adapter';
83
82
  import { fetchSlashCommands, useSlashCommandRegistry, type SlashCommandSummary } from './hooks/use-slash-commands';
84
83
  import type { ChatSource, UseSseChatAdapterOptions } from './hooks/use-sse-chat-adapter';
85
84
  import { useUnifiedChat, type ChatMode, type UseUnifiedChatModes } from './hooks/use-unified-chat';
@@ -91,10 +90,10 @@ import { MingoWelcome, type MingoWelcomeProps } from './mingo-welcome';
91
90
  import { NavLinkAnchorViaRuntime } from './nav-link-anchor-via-runtime';
92
91
  import { accentFromIdentityIcon, getAgentAccent } from './quick-action-chip';
93
92
  import { SourceActionButton } from './source-action-button';
94
- import type { ChatInputRef, DialogItem, SlashCommandActionId } from './types/component.types';
93
+ import type { ChatInputRef, SlashCommandActionId } from './types/component.types';
95
94
  import type { ChatContextItem, ChatContextPickerConfig } from './types/context-item.types';
96
95
  import type { MessageSegment, Message } from './types/message.types';
97
- import type { UnifiedChatState } from './types/unified-chat-state.types';
96
+ import type { ChatDialogCapabilities, UnifiedChatState } from './types/unified-chat-state.types';
98
97
  import { formatChatAttachmentMarkdownForBubble } from './utils/chat-attachment-markdown';
99
98
  import { resolveHrefForRuntime } from './utils/chat-nav-resolution';
100
99
  import { chatChipClass } from './utils/chip-styles';
@@ -105,16 +104,41 @@ import { formatSingularLookupInvocation } from './utils/slash-dispatch-utils';
105
104
  import { getSourceIconName } from './utils/source-icons';
106
105
  import { resolveSourceRowCTA, sourceRowCtxFromRuntime } from './utils/source-row-cta';
107
106
 
107
+ /**
108
+ * Split (wide) Mingo layout metrics (Figma 113:60931 / 113:63630). The
109
+ * "Current Chats" rail is a fixed 320px column; the chat block fills the rest
110
+ * with a 400px floor. Below their sum the panel is too tight for two columns,
111
+ * so the layout falls back to the stacked (single-column) view where the
112
+ * history renders inline in the Mingo empty state. Purely width-driven and
113
+ * self-contained — the host wires nothing.
114
+ */
115
+ const HISTORY_RAIL_WIDTH = 320;
116
+ const CHAT_BLOCK_MIN_WIDTH = 400;
117
+ const SPLIT_MIN_WIDTH = HISTORY_RAIL_WIDTH + CHAT_BLOCK_MIN_WIDTH;
118
+
108
119
  // Desktop drawer opens at this fraction of the viewport width (clamped to the
109
120
  // Drawer's own min/max). The user can still resize (persisted per DRAWER_WIDTH_KEY).
110
121
  const DRAWER_DEFAULT_WIDTH_RATIO = 0.5;
111
122
  // Bump the suffix whenever the default policy changes so previously-persisted
112
123
  // widths (e.g. the old fixed 750px / earlier 30% default) reset on next open.
113
- const DRAWER_WIDTH_KEY = 'mingo-chat-width-v3';
124
+ const DRAWER_WIDTH_KEY = 'mingo-chat-width-v4';
114
125
  const DRAWER_DEFAULT_WIDTH_PX = 750; // SSR fallback before the viewport is known
115
- function drawerDefaultWidth(): number {
126
+ /**
127
+ * A panel that owns a dialog list opens WIDE ENOUGH TO SPLIT, so the "Current
128
+ * Chats" rail sits beside the conversation instead of replacing it.
129
+ *
130
+ * 50% of the viewport is under `SPLIT_MIN_WIDTH` on any screen narrower than
131
+ * 1440, which silently downgraded every such user to the stacked single-column
132
+ * list — the layout meant for phones. The floor is the measured panel width the
133
+ * split needs plus a few px of chrome, and the Drawer still clamps it to the
134
+ * viewport, so a genuinely small screen keeps the stacked view.
135
+ */
136
+ const SPLIT_DEFAULT_WIDTH_ALLOWANCE = 16;
137
+ function drawerDefaultWidth(withHistoryRail: boolean): number {
116
138
  if (typeof window === 'undefined') return DRAWER_DEFAULT_WIDTH_PX;
117
- return Math.round(window.innerWidth * DRAWER_DEFAULT_WIDTH_RATIO);
139
+ const ratioWidth = Math.round(window.innerWidth * DRAWER_DEFAULT_WIDTH_RATIO);
140
+ if (!withHistoryRail) return ratioWidth;
141
+ return Math.max(ratioWidth, SPLIT_MIN_WIDTH + SPLIT_DEFAULT_WIDTH_ALLOWANCE);
118
142
  }
119
143
 
120
144
  // =============================================================================
@@ -214,23 +238,16 @@ export interface EmbeddableChatProps {
214
238
  * When the host injects `mingoState`, it doesn't pass `modes.mingo` (that
215
239
  * would re-activate the idle built-in adapter), so the rename/archive/
216
240
  * restore/archive-page affordances can't read their capability flags off the
217
- * callback config. Supply them here instead. `canRename`/`canArchive` default
218
- * to `true` when `mingoState` is set; the archive page + restore are shown
219
- * only when their callbacks are provided. Ignored unless `mingoState` is set.
241
+ * callback config. Supply them here instead. Default OFF: the row ⋯ menu and
242
+ * the archive page appear only when the host opts in, so nothing advertises
243
+ * an action the host hasn't wired. Ignored unless `mingoState` is set.
244
+ *
245
+ * Same shape an adapter reports through `UnifiedChatState.dialogCapabilities`
246
+ * (`ChatDialogCapabilities`) — one type, whether the list is host-owned or
247
+ * adapter-owned. `onCopyLink` adds "Copy chat link" to the header ⋯ menu and
248
+ * every row menu; the host owns the URL shape and the clipboard write.
220
249
  */
221
- mingoDialogCapabilities?: {
222
- canRename?: boolean;
223
- canArchive?: boolean;
224
- fetchArchivedDialogs?: (params: FetchDialogsParams) => Promise<FetchDialogsResult>;
225
- unarchiveDialog?: (id: string) => Promise<void>;
226
- searchQuery?: string;
227
- onSearchChange?: (query: string) => void;
228
- /** Copy a shareable link to a conversation — adds "Copy chat link" to the
229
- * header ⋯ menu and every dialog row menu. The host owns the URL shape and
230
- * the clipboard write; the panel knows neither the app's routes nor whether
231
- * a clipboard is available. Omit to hide the action. */
232
- onCopyLink?: (dialog: DialogItem) => void;
233
- };
250
+ mingoDialogCapabilities?: ChatDialogCapabilities;
234
251
 
235
252
  /**
236
253
  * Controlled active-mode. When provided, `onActiveModeChange` MUST
@@ -424,18 +441,6 @@ const mentionTokenOf = (key: string, markerByType: Map<string, string>): string
424
441
  */
425
442
  const FALLBACK_TOP_RETRIEVED = 3;
426
443
 
427
- /**
428
- * Split (wide) Mingo layout metrics (Figma 113:60931 / 113:63630). The
429
- * "Current Chats" rail is a fixed 320px column; the chat block fills the rest
430
- * with a 400px floor. Below their sum the panel is too tight for two columns,
431
- * so the layout falls back to the stacked (single-column) view where the
432
- * history renders inline in the Mingo empty state. Purely width-driven and
433
- * self-contained — the host wires nothing.
434
- */
435
- const HISTORY_RAIL_WIDTH = 320;
436
- const CHAT_BLOCK_MIN_WIDTH = 400;
437
- const SPLIT_MIN_WIDTH = HISTORY_RAIL_WIDTH + CHAT_BLOCK_MIN_WIDTH;
438
-
439
444
  /** Persists the user's rail collapse choice across drawer open/close + reloads. */
440
445
  const RAIL_COLLAPSED_STORAGE_KEY = 'mingo-chat-history-collapsed';
441
446
 
@@ -1074,38 +1079,6 @@ function EmbeddableChatInner({
1074
1079
  return { guide: guideOptions };
1075
1080
  }, [modes, tableIdForDocumentType]);
1076
1081
 
1077
- // Resolve dialog-management capabilities (rename / archive / archive-page /
1078
- // restore) from a single source. With injected `mingoState` they come from
1079
- // `mingoDialogCapabilities` (the host doesn't pass `modes.mingo`); otherwise
1080
- // from the callback-config shape, where the presence of a callback IS the
1081
- // capability. Both feed the same gating below so the JSX has one source.
1082
- const mingoCaps = useMemo(() => {
1083
- if (mingoState) {
1084
- // Default OFF: the row ⋯ menu (Rename / Archive) and the archive page are
1085
- // shown only when the host explicitly opts in — same capability-gating as
1086
- // the archive button (`fetchArchivedDialogs` presence). Otherwise the menu
1087
- // would advertise actions the host hasn't actually wired (no-ops).
1088
- return {
1089
- canRename: mingoDialogCapabilities?.canRename ?? false,
1090
- canArchive: mingoDialogCapabilities?.canArchive ?? false,
1091
- fetchArchivedDialogs: mingoDialogCapabilities?.fetchArchivedDialogs,
1092
- unarchiveDialog: mingoDialogCapabilities?.unarchiveDialog,
1093
- searchQuery: mingoDialogCapabilities?.searchQuery,
1094
- onSearchChange: mingoDialogCapabilities?.onSearchChange,
1095
- onCopyLink: mingoDialogCapabilities?.onCopyLink,
1096
- };
1097
- }
1098
- return {
1099
- canRename: !!effectiveModes.mingo?.renameDialog,
1100
- canArchive: !!effectiveModes.mingo?.archiveDialog,
1101
- fetchArchivedDialogs: effectiveModes.mingo?.fetchArchivedDialogs,
1102
- unarchiveDialog: effectiveModes.mingo?.unarchiveDialog,
1103
- searchQuery: undefined as string | undefined,
1104
- onSearchChange: undefined as ((query: string) => void) | undefined,
1105
- onCopyLink: undefined as ((dialog: DialogItem) => void) | undefined,
1106
- };
1107
- }, [mingoState, mingoDialogCapabilities, effectiveModes]);
1108
-
1109
1082
  // "Does Mingo mode exist?" — true via either the callback config OR injected
1110
1083
  // state. Gates the guide↔mingo back-chevron and the guide-mode banner.
1111
1084
  const hasMingoMode = !!effectiveModes.mingo || !!mingoState;
@@ -1239,7 +1212,31 @@ function EmbeddableChatInner({
1239
1212
  setDialogScope,
1240
1213
  hasMoreMessages,
1241
1214
  loadMoreMessages,
1242
- } = useUnifiedChat({ modes: effectiveModes, activeMode, mingoStateOverride: mingoState });
1215
+ dialogCapabilities,
1216
+ } = useUnifiedChat({
1217
+ modes: effectiveModes,
1218
+ activeMode,
1219
+ mingoStateOverride: mingoState,
1220
+ injectedDialogCapabilities: mingoDialogCapabilities,
1221
+ });
1222
+
1223
+ // THE conversation-list gate. `dialogCapabilities` is present iff the ACTIVE
1224
+ // state owns a conversation list, so the panel never asks which transport it
1225
+ // is talking to: `useUnifiedChat` already resolved which state won, and the
1226
+ // adapters already know whether they own a list. Absent = single-thread.
1227
+ const historyListMode = dialogCapabilities !== undefined;
1228
+
1229
+ // Non-optional view of the same object for the JSX below. `canRename` /
1230
+ // `canArchive` default OFF: the ⋯ menu must never advertise an action
1231
+ // nothing has wired.
1232
+ const mingoCaps = useMemo<ChatDialogCapabilities>(
1233
+ () => ({
1234
+ ...dialogCapabilities,
1235
+ canRename: dialogCapabilities?.canRename ?? false,
1236
+ canArchive: dialogCapabilities?.canArchive ?? false,
1237
+ }),
1238
+ [dialogCapabilities],
1239
+ );
1243
1240
 
1244
1241
  // ── One-shot Guide-mode launcher prompt ────────────────────────────────────
1245
1242
  // A host launcher (e.g. an "Ask Mingo about X" empty-state button) requests
@@ -1780,7 +1777,17 @@ function EmbeddableChatInner({
1780
1777
  // that wants a message-list skeleton (real header + composer, skeleton bubbles)
1781
1778
  // signals it via `isMessagesLoading` — treat that as an open conversation so
1782
1779
  // the content branch shows the skeleton instead of the new-user welcome.
1783
- const hasConversation = hasMessages || isOpeningDialog || isViewingArchived || (previewMode && isMessagesLoading);
1780
+ // …and so does a panel loading the messages of a dialog it ALREADY has
1781
+ // selected — a restored conversation on mount, where nothing was clicked so
1782
+ // `isOpeningDialog` is false. Keyed on the dialog id being set rather than on
1783
+ // any transport: `isMessagesLoading` is only ever about the ACTIVE dialog.
1784
+ const isLoadingActiveDialogMessages = activeDialogId != null && isMessagesLoading;
1785
+ const hasConversation =
1786
+ hasMessages ||
1787
+ isOpeningDialog ||
1788
+ isViewingArchived ||
1789
+ isLoadingActiveDialogMessages ||
1790
+ (previewMode && isMessagesLoading);
1784
1791
  // Opening a dialog whose history hasn't arrived yet — show a message-list
1785
1792
  // skeleton instead of an empty thread so the open reads as "loading" rather
1786
1793
  // than a blank flash before the bubbles stream in.
@@ -1865,26 +1872,38 @@ function EmbeddableChatInner({
1865
1872
  // mode / archive page) it stays the stacked single-column layout with the
1866
1873
  // history inline in the empty state. Fully self-contained — the host opts
1867
1874
  // into nothing; the switch is width-driven inside this component.
1875
+ //
1876
+ // Measured off the panel NODE (state), not a ref read once on mount. In the
1877
+ // `drawer` shell the panel body does not exist until the drawer opens, so a
1878
+ // mount-time ref read saw `null`, bailed, and — with `[]` deps — never ran
1879
+ // again: `panelWidth` stayed 0, `canSplit` stayed false, and EVERY drawer
1880
+ // host was silently pinned to the stacked single-column list no matter how
1881
+ // wide it was. Only `shell="none"` hosts (the panel is inline and present at
1882
+ // mount) ever reached the split layout.
1868
1883
  const [panelWidth, setPanelWidth] = useState(0);
1869
- const panelMeasureRef = useRef<HTMLDivElement | null>(null);
1870
1884
  useEffect(() => {
1871
- const el = panelMeasureRef.current;
1872
- if (!el || typeof ResizeObserver === 'undefined') return undefined;
1885
+ if (!panelBoundary || typeof ResizeObserver === 'undefined') return undefined;
1873
1886
  const ro = new ResizeObserver(entries => {
1874
1887
  const w = entries[0]?.contentRect?.width;
1875
1888
  if (typeof w === 'number') setPanelWidth(w);
1876
1889
  });
1877
- ro.observe(el);
1878
- setPanelWidth(el.clientWidth);
1890
+ ro.observe(panelBoundary);
1879
1891
  return () => ro.disconnect();
1880
- }, []);
1892
+ }, [panelBoundary]);
1881
1893
 
1882
- // One ref for two consumers: the width measurement above (a plain ref, read
1883
- // once on mount) and the collision-boundary context (state, so provider
1884
- // consumers re-render once the node exists).
1894
+ // ONE node for two consumers: the width measurement above and the
1895
+ // collision-boundary context. State, not a ref, so both re-run when the node
1896
+ // appears (the drawer shell mounts its body only on open).
1897
+ //
1898
+ // The width is ALSO seeded here, in the commit-phase ref callback: the
1899
+ // ResizeObserver's first callback is delivered asynchronously, so seeding
1900
+ // only there would leave a split-eligible panel painting one stacked frame at
1901
+ // width 0 before flipping. Seeding in the effect instead is what the
1902
+ // pre-refactor code did, but `react-hooks/set-state-in-effect` rejects it in
1903
+ // a reactive (non-mount-only) effect.
1885
1904
  const setPanelNode = useCallback((node: HTMLDivElement | null) => {
1886
- panelMeasureRef.current = node;
1887
1905
  setPanelBoundary(node);
1906
+ if (node) setPanelWidth(node.clientWidth);
1888
1907
  }, []);
1889
1908
 
1890
1909
  // Rail collapse toggle (Figma ⟶| control), persisted so it survives the
@@ -1929,7 +1948,7 @@ function EmbeddableChatInner({
1929
1948
  // page stays split-eligible: in wide mode it opens INSIDE the left rail (the
1930
1949
  // right chat block stays put), and only falls back to the full-panel archive
1931
1950
  // when stacked/collapsed.
1932
- const splitEligible = activeMode === 'mingo';
1951
+ const splitEligible = historyListMode;
1933
1952
  const canSplit = panelWidth >= SPLIT_MIN_WIDTH;
1934
1953
  // Embedded previews (hero demo tabs) always use the compact single-column
1935
1954
  // header, never the two-column split — so `previewMode` opts out of `wideMingo`.
@@ -1960,23 +1979,44 @@ function EmbeddableChatInner({
1960
1979
  // the SAME render the conversation opened in. Guarded, so the extra render
1961
1980
  // pass takes the early exit.
1962
1981
  if (hasConversation && composeOpen) setComposeOpen(false);
1963
- const isMingoMode = activeMode === 'mingo';
1982
+ const isMingoMode = historyListMode;
1964
1983
  // The stacked "Current Chats" list — the NARROW single-column Mingo view. It
1965
1984
  // is a narrow-only layout: in any wide layout the chat list lives in the rail,
1966
1985
  // and collapsing the rail (`wideCollapsed`) shows the chat / new-chat welcome
1967
1986
  // in the fill column (navigation is via re-expanding the rail), NOT the list.
1968
1987
  // Requires no open conversation, no archive, and not composing (the composer
1969
1988
  // lives on the compose view).
1970
- const stackedListView = isMingoMode && !hasConversation && !archiveOpen && !wideMingo && !composeOpen;
1989
+ // …unless the list owner asked to skip an empty one
1990
+ // (`emptyListSkipsToCompose`), in which case a settled-empty, unsearched list
1991
+ // lands on the composer instead of a "Current Chats" screen with nothing in
1992
+ // it. Whether that is the right landing is the list owner's policy, not this
1993
+ // component's guess — a public panel skips, a workspace panel keeps the list.
1994
+ // Gated on the first page having settled so it never flashes mid-load.
1995
+ const emptyListSkipped =
1996
+ mingoCaps.emptyListSkipsToCompose === true &&
1997
+ dialogs.length === 0 &&
1998
+ !dialogsInitialLoading &&
1999
+ !mingoCaps.searchQuery;
2000
+ const stackedListView =
2001
+ isMingoMode && !hasConversation && !archiveOpen && !wideMingo && !composeOpen && !emptyListSkipped;
1971
2002
 
1972
2003
  // Shared header derivations — consumed by the stacked `ChatPanelHeader`, its
1973
2004
  // mobile fallback, and the desktop split header's right cell, so the title /
1974
2005
  // back / ⋯ semantics can't drift between layouts.
1975
2006
  const headerShowBack = hasConversation || guideCanReturnToMingo;
2007
+ /**
2008
+ * What a conversation with nothing in it is called — ONE definition, read by
2009
+ * the shared header derivation below, the narrow compose header and the wide
2010
+ * split header, so a draft can't be titled three different ways.
2011
+ *
2012
+ * Guide's empty state IS the assistant's own welcome screen, so it wears the
2013
+ * assistant name; anywhere else a draft is a "New Chat".
2014
+ */
2015
+ const freshConversationTitle = isGuideEmpty ? (headerAssistantName ?? 'Mingo Guide') : 'New Chat';
1976
2016
  const headerTitle = hasConversation
1977
- ? activeDialog?.title || 'New Chat'
2017
+ ? activeDialog?.title || freshConversationTitle
1978
2018
  : isGuideEmpty
1979
- ? (headerAssistantName ?? 'Mingo Guide')
2019
+ ? freshConversationTitle
1980
2020
  : 'Current Chats';
1981
2021
  const headerBackAriaLabel = hasConversation ? (isViewingArchived ? 'Back to archive' : 'Back') : 'Back to Mingo';
1982
2022
  const headerOnBack = hasConversation ? handleBack : () => handleActiveModeChange('mingo');
@@ -2037,12 +2077,16 @@ function EmbeddableChatInner({
2037
2077
  // Chats" list header (search + archive, no back) and a "New Chat" compose
2038
2078
  // header (back to the list); conversations + guide keep the shared header
2039
2079
  // derivations. Wide mode uses its own two-cell header instead.
2040
- const narrowMingoEmpty = isMingoMode && !hasConversation && !archiveOpen;
2080
+ // `!emptyListSkipped` for the same reason as `stackedListView`: with the list
2081
+ // skipped the BODY renders the welcome, so a "Current Chats" header above it
2082
+ // would be half of the empty screen the skip exists to remove. The
2083
+ // else-branch header keeps the assistant name and the archive entry point.
2084
+ const narrowMingoEmpty = isMingoMode && !hasConversation && !archiveOpen && !emptyListSkipped;
2041
2085
  const narrowHeaderProps: ChatPanelHeaderProps = narrowMingoEmpty
2042
2086
  ? composeOpen
2043
2087
  ? {
2044
2088
  showBack: true,
2045
- title: 'New Chat',
2089
+ title: freshConversationTitle,
2046
2090
  subtitle: headerUserName,
2047
2091
  avatar: headerAvatar,
2048
2092
  backAriaLabel: 'Back to chats',
@@ -2212,7 +2256,7 @@ function EmbeddableChatInner({
2212
2256
  <div className="flex min-w-0 flex-1 items-center gap-[var(--spacing-system-m)] px-[var(--spacing-system-mf)] py-[var(--spacing-system-sf)]">
2213
2257
  <div className="flex min-w-0 flex-col">
2214
2258
  <p className="truncate leading-tight text-ods-text-primary text-h3">
2215
- {headerShowBack ? headerTitle : 'New Chat'}
2259
+ {headerShowBack || isGuideEmpty ? headerTitle : freshConversationTitle}
2216
2260
  </p>
2217
2261
  {headerPersonName && (
2218
2262
  <p className="truncate leading-tight text-ods-text-secondary text-h6">{headerPersonName}</p>
@@ -2659,7 +2703,7 @@ function EmbeddableChatInner({
2659
2703
  resizable
2660
2704
  minSize={480}
2661
2705
  maxSize={1600}
2662
- defaultSize={drawerDefaultWidth()}
2706
+ defaultSize={drawerDefaultWidth(historyListMode)}
2663
2707
  storageKey={DRAWER_WIDTH_KEY}
2664
2708
  resizeAriaLabel="Resize chat panel"
2665
2709
  overlayClassName="mingo-chat-overlay"
@@ -1,4 +1,4 @@
1
- <!-- source-hash: d1cebe46eff04115f214c16b75a69467 -->
1
+ <!-- source-hash: d460fe7481ce4297ddeae04cf82f3fce -->
2
2
  Barrel export file for the chat hooks module, re-exporting all public hooks from their individual files into a single `'use client'` entry point.
3
3
 
4
4
  ## Key Components
@@ -0,0 +1,31 @@
1
+ <!-- source-hash: d18d474fc595dcd22de25996000d540f -->
2
+ The ONE dialog-list state machine shared by both transport adapters — NATS/Mingo managed-dialog mode and the SSE/Guide adapter when `ChatRuntime.endpoints.chatConversationsUrl` is set. The Chat Archive page keeps its own local pager in `useChatDialogManager`, deliberately untouched. Extracted from `useNatsChatAdapter` so Guide mode reuses the exact list/paging/mutation semantics openframe-frontend already relies on.
3
+
4
+ ## Key Components
5
+
6
+ ### `useManagedDialogList(args)`
7
+ Owns the loaded `DialogItem[]` page, the server cursor, first-page loading/error state (with the retry re-arm), cursor pagination, an optional server-side `search` term (a change re-runs page 1) and the optimistic rename / archive / delete mutations. Does NOT own the active dialog id, message history or the transport — the adapters layer those on top via `onDialogRemoved`.
8
+
9
+ ### `UseManagedDialogListArgs`
10
+ - `autoLoad` — gates the AUTOMATIC first-page load only; the adapters pass their own `active` gate so an idle transport does no network
11
+ - `fetchDialogs` / `renameDialog` / `archiveDialog` / `deleteDialog` — host callbacks; presence IS the capability (absent = inert / no-op)
12
+ - `pageSize` — sent as `limit`
13
+ - `search` — `undefined` = no search support (NATS keeps `{cursor, limit}` wire params); any string change reloads page 1 with `search`
14
+ - `onDialogRemoved(id, 'archived' | 'deleted')` — fires AFTER the local removal, read through a latest-ref
15
+ - `logTag` — console prefix for failure logs
16
+
17
+ ### `UseManagedDialogListResult`
18
+ `dialogs`, `dialogsNextCursor`, `isDialogsLoading`, `dialogsError`, `hasMoreDialogs`, `loadDialogsPage`, `reloadDialogs`, `loadMoreDialogs`, `renameDialog`, `archiveDialog`, `deleteDialog`, plus `upsertDialogTop(item)` (prepend + dedupe) and `bumpDialogToTop(id)` (re-head with a fresh timestamp, matching the server's `last_message_at desc`).
19
+
20
+ ## Behavioural contracts
21
+
22
+ - `isDialogsLoading` reads true from the FIRST render whenever a first page is coming (and again synchronously on every search change, including clearing one), so a consumer branching on "the list is empty" never sees a settled-and-empty frame before the request starts.
23
+ - A monotonic request id means only the LATEST page-1 load may touch the list, cursor or flags — search-as-you-type, the end-of-turn refresh and an unarchive all overlap, and without it the last-resolving response wins.
24
+ - Appends dedupe by id: a row whose `last_message_at` moved between page fetches can come back on a later page.
25
+ - Only the FIRST page failing sets `dialogsError`; a pagination failure keeps the loaded rows.
26
+ - Archive and delete failures are logged AND re-thrown, so `useChatDialogManager.handleConfirmArchive` (which awaits and catches) can keep its modal open for a retry instead of closing over a write the server rejected. Rename is the exception: it is logged and SWALLOWED after rolling its optimistic title back, matching the pre-extraction NATS adapter, because `handleConfirmRename` fires it as `void renameDialog(...)` and a rejection would only surface as an unhandled rejection.
27
+ - Rename is optimistic; the rollback title is read synchronously from a live ref at call time (capturing it inside a `setState` updater was unreliable — the updater may run after an immediately-rejecting callback reaches the catch).
28
+
29
+ ## Source
30
+
31
+ [`use-managed-dialog-list.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/use-managed-dialog-list.ts)
@@ -1,4 +1,4 @@
1
- <!-- source-hash: 6c5780e92306ea381bac35aaf97c435f -->
1
+ <!-- source-hash: e0a0d9d83da014a4ea0e680d05f2f41f -->
2
2
  Provides the NATS/Mingo-mode transport adapter for the unified chat surface, implementing the `UnifiedChatState` contract so the `useChat({ mode })` dispatcher can switch between NATS and SSE adapters without shell-side branching.
3
3
 
4
4
  ## Key Components
@@ -28,6 +28,8 @@ useChunkCatchup → back-fills missed chunks on reconnect/activation
28
28
 
29
29
  Returns a full `UnifiedChatState` object including `messages`, `isLoading`, `streamingPhase`, `sendMessage`, `stopMessage`, and `clearMessages`.
30
30
 
31
+ In managed-dialog mode (`fetchDialogs` provided) the dialog list itself — paging, retry, optimistic rename/archive/delete — is the SHARED `useManagedDialogList` hook (also behind the SSE/Guide adapter); this adapter only layers the active-id and reducer-store side effects on top through `onDialogRemoved`. `dialogCapabilities` is reported ALWAYS, managed or not: this is the Mingo transport, whose panel owns a conversation list either way, and an unmanaged config simply advertises no affordances (presence of a host callback = the capability). That is what lets `EmbeddableChat` gate on the object's presence instead of on the mode name without changing a bare host's surface. `FetchDialogsParams` / `FetchDialogsResult` now live in `unified-chat-state.types.ts` and are re-exported here.
32
+
31
33
  ## Usage Example
32
34
 
33
35
  ```typescript
@@ -1,4 +1,4 @@
1
- <!-- source-hash: b64329bea22eab16802f8dbf5b7a58c5 -->
1
+ <!-- source-hash: f1d79f0c43477c986d3e200dff047ef5 -->
2
2
  Provides the SSE (Server-Sent Events) transport adapter for the unified chat surface, implementing `UnifiedChatState` for Guide mode. Serves as the canonical replacement for the legacy `useEmbeddedChat` hook following the unified-chat refactor.
3
3
 
4
4
  ## Key Components
@@ -40,6 +40,13 @@ const chatState = useSseChatAdapter(options, { active: true })
40
40
  - `tableIdForDocumentType` defaults to `defaultTableIdForDocumentType` (lib-baked map), so Ask / Display buttons work in embedders without any wiring
41
41
  - The SSE decoder/buffer lives inside the per-call closure to prevent cross-stream buffer corruption on rapid send-stop-send sequences
42
42
 
43
+ **Managed conversation list (`ChatRuntime.endpoints.chatConversationsUrl`):**
44
+
45
+ - With the endpoint set, the adapter runs the SAME `useManagedDialogList` state machine as the NATS adapter, with its callbacks built by `createChatConversationsApi` — the server transcript store becomes the dialog list (`dialogs`, `activeDialogId`, `selectDialog`, `renameDialog`, `archiveDialog`, paging, and a `dialogCapabilities` object covering archive page / restore / server-side search, plus `emptyListSkipsToCompose: true` so a first-time visitor to a public panel lands on the composer instead of an empty list).
46
+ - `selectDialog(id)` aborts any in-flight stream, resets the reducer, re-arms the hydration guard and commits the id (ref + state + localStorage); `useChatHistoryHydration` then re-fetches through `chatHistoryUrl`. `isMessagesLoading` mirrors that fetch.
47
+ - A first send that mints a new id pre-seeds the hydration guard (the streamed turn IS the history — no prepend), inserts an optimistic row, and re-reads the list at end of turn so the server's derived title lands.
48
+ - Without the endpoint the single-thread stubs are returned unchanged and `dialogCapabilities` is `undefined` — its ABSENCE is what keeps such a panel single-thread, and it is zero behaviour change for hosts that never set the endpoint.
49
+
43
50
  ## Source
44
51
 
45
52
  [`use-sse-chat-adapter.ts`](https://github.com/flamingo-stack/openframe-oss-lib/blob/main/use-sse-chat-adapter.ts)
@@ -1,4 +1,4 @@
1
- <!-- source-hash: bed5f9e4619da46892b2552f6d7eb1d6 -->
1
+ <!-- source-hash: bcceb65532410ccd0f0f71674eae6645 -->
2
2
  Unified entry point hook that dispatches chat state between two transport adapters — SSE/Guide and NATS/Mingo — based on the `activeMode` flag, while keeping both hooks always mounted to satisfy React's rules of hooks.
3
3
 
4
4
  ## Key Components
@@ -31,7 +31,7 @@ Main hook. Returns a stable `UnifiedChatState` composed of:
31
31
  the NATS/Mingo adapters omit it, because consumers gate the card menu's "Display" row on the
32
32
  callback being there; forwarding an always-truthy wrapper around a missing method would advertise
33
33
  a display path that isn't there and throw on click.
34
- - **Dialog management** — `selectDialog`, `startNewDialog`, `deleteDialog`, `renameDialog`, `archiveDialog`, `loadMoreDialogs`, `setDialogScope`, `reloadDialogs`, `loadMoreMessages`
34
+ - **Dialog management** — `selectDialog`, `startNewDialog`, `deleteDialog`, `renameDialog`, `archiveDialog`, `loadMoreDialogs`, `setDialogScope`, `reloadDialogs`, `loadMoreMessages`; plus `dialogCapabilities`, THE conversation-list signal, resolved here because this is the one place that decides which state won. It is the active state's own object, except for a `mingoStateOverride` that carries none, which falls back to the `injectedDialogCapabilities` companion option and then to `EMPTY_DIALOG_CAPABILITIES` — injecting a state must never cost a host its list surface. `EmbeddableChat` then gates the history UI on presence alone, never on the transport
35
35
  - **Approvals** — `approveRequest`, `rejectRequest`
36
36
 
37
37
  Callbacks are bound through `activeStateRef` (a live ref updated every render) so their identities remain referentially stable across streaming chunks, preventing unnecessary downstream re-renders.