@iota-uz/sdk 0.4.43 → 0.5.0

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 (406) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +11 -142
  3. package/dist/client-host/applet.d.ts +52 -0
  4. package/dist/client-host/applet.d.ts.map +1 -0
  5. package/dist/client-host/applet.js +24 -0
  6. package/dist/client-host/cache.d.ts +15 -0
  7. package/dist/client-host/cache.d.ts.map +1 -0
  8. package/dist/client-host/cache.js +27 -0
  9. package/dist/client-host/errors.d.ts +16 -0
  10. package/dist/client-host/errors.d.ts.map +1 -0
  11. package/dist/client-host/errors.js +45 -0
  12. package/dist/client-host/identity.d.ts +21 -0
  13. package/dist/client-host/identity.d.ts.map +1 -0
  14. package/dist/client-host/identity.js +28 -0
  15. package/dist/client-host/index.d.ts +11 -0
  16. package/dist/client-host/index.d.ts.map +1 -0
  17. package/dist/client-host/index.js +10 -0
  18. package/dist/client-host/portals.d.ts +30 -0
  19. package/dist/client-host/portals.d.ts.map +1 -0
  20. package/dist/client-host/portals.js +149 -0
  21. package/dist/client-host/protocol.d.ts +2 -0
  22. package/dist/client-host/protocol.d.ts.map +1 -0
  23. package/dist/client-host/protocol.js +2 -0
  24. package/dist/client-host/route.d.ts +29 -0
  25. package/dist/client-host/route.d.ts.map +1 -0
  26. package/dist/client-host/route.js +32 -0
  27. package/dist/client-host/rpc.d.ts +46 -0
  28. package/dist/client-host/rpc.d.ts.map +1 -0
  29. package/dist/client-host/rpc.js +90 -0
  30. package/dist/client-host/streaming.d.ts +43 -0
  31. package/dist/client-host/streaming.d.ts.map +1 -0
  32. package/dist/client-host/streaming.js +141 -0
  33. package/dist/client-host/transport.d.ts +26 -0
  34. package/dist/client-host/transport.d.ts.map +1 -0
  35. package/dist/client-host/transport.js +53 -0
  36. package/dist/lens/CascadePanel-DqOZFdR-.js +512 -0
  37. package/dist/lens/ChartDataEquivalent-BFDdHoQn.js +52 -0
  38. package/dist/lens/ChartHost-Bl2lxIqU.js +68 -0
  39. package/dist/lens/ChartPanel-CTIp_4YE.js +720 -0
  40. package/dist/lens/CoveragePanel-DZZWkjSv.js +131 -0
  41. package/dist/lens/DashboardPanels.d.ts +36 -0
  42. package/dist/lens/DashboardPanels.d.ts.map +1 -0
  43. package/dist/lens/GaugePanel-BcNdd_Wj.js +43 -0
  44. package/dist/lens/LensDashboard.d.ts +21 -0
  45. package/dist/lens/LensDashboard.d.ts.map +1 -0
  46. package/dist/lens/MapPanel-6sI_Ei9L.js +178 -0
  47. package/dist/lens/MetricFlowPanel-LzqevSPs.js +70 -0
  48. package/dist/lens/MetricHierarchyPanel-h6tJqRPg.js +72 -0
  49. package/dist/lens/MetricRelationshipPanel-CgckUvvJ.js +54 -0
  50. package/dist/lens/PrintReport-DJv4Rm_U.js +1351 -0
  51. package/dist/lens/TablePanel-Dh6bXlwM.js +619 -0
  52. package/dist/lens/adapter-zBDC8hbZ.js +29093 -0
  53. package/dist/lens/breakpoints.d.ts +37 -0
  54. package/dist/lens/breakpoints.d.ts.map +1 -0
  55. package/dist/lens/charts/adapter.d.ts +157 -0
  56. package/dist/lens/charts/adapter.d.ts.map +1 -0
  57. package/dist/lens/charts/echarts/adapter.d.ts +9 -0
  58. package/dist/lens/charts/echarts/adapter.d.ts.map +1 -0
  59. package/dist/lens/charts/echarts/distributions.d.ts +9 -0
  60. package/dist/lens/charts/echarts/distributions.d.ts.map +1 -0
  61. package/dist/lens/charts/echarts/events.d.ts +7 -0
  62. package/dist/lens/charts/echarts/events.d.ts.map +1 -0
  63. package/dist/lens/charts/echarts/options.d.ts +163 -0
  64. package/dist/lens/charts/echarts/options.d.ts.map +1 -0
  65. package/dist/lens/charts/echarts/theme.d.ts +49 -0
  66. package/dist/lens/charts/echarts/theme.d.ts.map +1 -0
  67. package/dist/lens/charts/echarts/tooltip.d.ts +79 -0
  68. package/dist/lens/charts/echarts/tooltip.d.ts.map +1 -0
  69. package/dist/lens/charts/index.d.ts +9 -0
  70. package/dist/lens/charts/index.d.ts.map +1 -0
  71. package/dist/lens/charts/keys.d.ts +8 -0
  72. package/dist/lens/charts/keys.d.ts.map +1 -0
  73. package/dist/lens/charts/overlays.d.ts +134 -0
  74. package/dist/lens/charts/overlays.d.ts.map +1 -0
  75. package/dist/lens/charts/palette.d.ts +54 -0
  76. package/dist/lens/charts/palette.d.ts.map +1 -0
  77. package/dist/lens/charts/scales.d.ts +26 -0
  78. package/dist/lens/charts/scales.d.ts.map +1 -0
  79. package/dist/lens/charts/shares.d.ts +44 -0
  80. package/dist/lens/charts/shares.d.ts.map +1 -0
  81. package/dist/lens/charts/text.d.ts +23 -0
  82. package/dist/lens/charts/text.d.ts.map +1 -0
  83. package/dist/lens/contract/index.d.ts +4 -0
  84. package/dist/lens/contract/index.d.ts.map +1 -0
  85. package/dist/lens/contract/palette.d.ts +13 -0
  86. package/dist/lens/contract/palette.d.ts.map +1 -0
  87. package/dist/lens/contract/schemas.d.ts +132 -0
  88. package/dist/lens/contract/schemas.d.ts.map +1 -0
  89. package/dist/lens/contract/types.d.ts +788 -0
  90. package/dist/lens/contract/types.d.ts.map +1 -0
  91. package/dist/lens/controls/Calendar.d.ts +24 -0
  92. package/dist/lens/controls/Calendar.d.ts.map +1 -0
  93. package/dist/lens/controls/CompareFilterControl.d.ts +23 -0
  94. package/dist/lens/controls/CompareFilterControl.d.ts.map +1 -0
  95. package/dist/lens/controls/FacetFilterMenu.d.ts +29 -0
  96. package/dist/lens/controls/FacetFilterMenu.d.ts.map +1 -0
  97. package/dist/lens/controls/FilterBar.d.ts +30 -0
  98. package/dist/lens/controls/FilterBar.d.ts.map +1 -0
  99. package/dist/lens/controls/PeriodFilterControl.d.ts +50 -0
  100. package/dist/lens/controls/PeriodFilterControl.d.ts.map +1 -0
  101. package/dist/lens/controls/SegmentedFilterControl.d.ts +22 -0
  102. package/dist/lens/controls/SegmentedFilterControl.d.ts.map +1 -0
  103. package/dist/lens/controls/facetOptions.d.ts +33 -0
  104. package/dist/lens/controls/facetOptions.d.ts.map +1 -0
  105. package/dist/lens/controls/index.d.ts +6 -0
  106. package/dist/lens/controls/index.d.ts.map +1 -0
  107. package/dist/lens/controls/model.d.ts +181 -0
  108. package/dist/lens/controls/model.d.ts.map +1 -0
  109. package/dist/lens/drillPrefetch-Bs-6Oyxa.js +68 -0
  110. package/dist/lens/element.d.ts +12 -0
  111. package/dist/lens/element.d.ts.map +1 -0
  112. package/dist/lens/explore/ContextMiniChart.d.ts +18 -0
  113. package/dist/lens/explore/ContextMiniChart.d.ts.map +1 -0
  114. package/dist/lens/explore/DrillOverlay.d.ts +66 -0
  115. package/dist/lens/explore/DrillOverlay.d.ts.map +1 -0
  116. package/dist/lens/explore/ExplorePanel.d.ts +8 -0
  117. package/dist/lens/explore/ExplorePanel.d.ts.map +1 -0
  118. package/dist/lens/explore/FocusContextHeader.d.ts +20 -0
  119. package/dist/lens/explore/FocusContextHeader.d.ts.map +1 -0
  120. package/dist/lens/explore/LensSelector.d.ts +17 -0
  121. package/dist/lens/explore/LensSelector.d.ts.map +1 -0
  122. package/dist/lens/explore/SourceDataDisclosure.d.ts +15 -0
  123. package/dist/lens/explore/SourceDataDisclosure.d.ts.map +1 -0
  124. package/dist/lens/explore/actions.d.ts +22 -0
  125. package/dist/lens/explore/actions.d.ts.map +1 -0
  126. package/dist/lens/explore/focusModel.d.ts +55 -0
  127. package/dist/lens/explore/focusModel.d.ts.map +1 -0
  128. package/dist/lens/explore/index.d.ts +9 -0
  129. package/dist/lens/explore/index.d.ts.map +1 -0
  130. package/dist/lens/explore/model.d.ts +59 -0
  131. package/dist/lens/explore/model.d.ts.map +1 -0
  132. package/dist/lens/export-B0U20F4u.js +57 -0
  133. package/dist/lens/icons.d.ts +103 -0
  134. package/dist/lens/icons.d.ts.map +1 -0
  135. package/dist/lens/idlePrefetch-Bi4Wk1uR.js +80 -0
  136. package/dist/lens/index-C45DAO6w.js +10883 -0
  137. package/dist/lens/index-CspKnSQn.js +11 -0
  138. package/dist/lens/index.d.ts +7 -0
  139. package/dist/lens/index.d.ts.map +1 -0
  140. package/dist/lens/index.js +17 -0
  141. package/dist/lens/install-3GLgv_LN.js +2028 -0
  142. package/dist/lens/install-B5oSx3pv.js +233 -0
  143. package/dist/lens/install-DT0AQkUj.js +1490 -0
  144. package/dist/lens/install-DyXK20dR.js +307 -0
  145. package/dist/lens/keys-DenV5HsJ.js +12 -0
  146. package/dist/lens/listSearch.d.ts +12 -0
  147. package/dist/lens/listSearch.d.ts.map +1 -0
  148. package/dist/lens/metricViews-QvoFHVdh.js +170 -0
  149. package/dist/lens/panels/CascadePanel.d.ts +138 -0
  150. package/dist/lens/panels/CascadePanel.d.ts.map +1 -0
  151. package/dist/lens/panels/ChartDataEquivalent.d.ts +23 -0
  152. package/dist/lens/panels/ChartDataEquivalent.d.ts.map +1 -0
  153. package/dist/lens/panels/ChartHost.d.ts +14 -0
  154. package/dist/lens/panels/ChartHost.d.ts.map +1 -0
  155. package/dist/lens/panels/ChartPanel.d.ts +29 -0
  156. package/dist/lens/panels/ChartPanel.d.ts.map +1 -0
  157. package/dist/lens/panels/CopyValueButton.d.ts +15 -0
  158. package/dist/lens/panels/CopyValueButton.d.ts.map +1 -0
  159. package/dist/lens/panels/CoveragePanel.d.ts +17 -0
  160. package/dist/lens/panels/CoveragePanel.d.ts.map +1 -0
  161. package/dist/lens/panels/ExportMenu.d.ts +12 -0
  162. package/dist/lens/panels/ExportMenu.d.ts.map +1 -0
  163. package/dist/lens/panels/GaugePanel.d.ts +6 -0
  164. package/dist/lens/panels/GaugePanel.d.ts.map +1 -0
  165. package/dist/lens/panels/InfoTip.d.ts +50 -0
  166. package/dist/lens/panels/InfoTip.d.ts.map +1 -0
  167. package/dist/lens/panels/MapPanel.d.ts +17 -0
  168. package/dist/lens/panels/MapPanel.d.ts.map +1 -0
  169. package/dist/lens/panels/MetricFlowPanel.d.ts +6 -0
  170. package/dist/lens/panels/MetricFlowPanel.d.ts.map +1 -0
  171. package/dist/lens/panels/MetricHierarchyPanel.d.ts +6 -0
  172. package/dist/lens/panels/MetricHierarchyPanel.d.ts.map +1 -0
  173. package/dist/lens/panels/MetricRelationshipPanel.d.ts +14 -0
  174. package/dist/lens/panels/MetricRelationshipPanel.d.ts.map +1 -0
  175. package/dist/lens/panels/PanelExportMenu.d.ts +5 -0
  176. package/dist/lens/panels/PanelExportMenu.d.ts.map +1 -0
  177. package/dist/lens/panels/PanelFrame.d.ts +42 -0
  178. package/dist/lens/panels/PanelFrame.d.ts.map +1 -0
  179. package/dist/lens/panels/PanelOverlay.d.ts +19 -0
  180. package/dist/lens/panels/PanelOverlay.d.ts.map +1 -0
  181. package/dist/lens/panels/QualityChip.d.ts +51 -0
  182. package/dist/lens/panels/QualityChip.d.ts.map +1 -0
  183. package/dist/lens/panels/ShareSliceButton.d.ts +3 -0
  184. package/dist/lens/panels/ShareSliceButton.d.ts.map +1 -0
  185. package/dist/lens/panels/Skeleton.d.ts +67 -0
  186. package/dist/lens/panels/Skeleton.d.ts.map +1 -0
  187. package/dist/lens/panels/StatPanel.d.ts +52 -0
  188. package/dist/lens/panels/StatPanel.d.ts.map +1 -0
  189. package/dist/lens/panels/StatValueTicker.d.ts +27 -0
  190. package/dist/lens/panels/StatValueTicker.d.ts.map +1 -0
  191. package/dist/lens/panels/TablePanel.d.ts +19 -0
  192. package/dist/lens/panels/TablePanel.d.ts.map +1 -0
  193. package/dist/lens/panels/WaterfallPlot.d.ts +51 -0
  194. package/dist/lens/panels/WaterfallPlot.d.ts.map +1 -0
  195. package/dist/lens/panels/actions.d.ts +75 -0
  196. package/dist/lens/panels/actions.d.ts.map +1 -0
  197. package/dist/lens/panels/context.d.ts +32 -0
  198. package/dist/lens/panels/context.d.ts.map +1 -0
  199. package/dist/lens/panels/data.d.ts +95 -0
  200. package/dist/lens/panels/data.d.ts.map +1 -0
  201. package/dist/lens/panels/kinds.d.ts +4 -0
  202. package/dist/lens/panels/kinds.d.ts.map +1 -0
  203. package/dist/lens/panels/metricViews.d.ts +79 -0
  204. package/dist/lens/panels/metricViews.d.ts.map +1 -0
  205. package/dist/lens/panels/registry.d.ts +45 -0
  206. package/dist/lens/panels/registry.d.ts.map +1 -0
  207. package/dist/lens/panels/useIsClamped.d.ts +16 -0
  208. package/dist/lens/panels/useIsClamped.d.ts.map +1 -0
  209. package/dist/lens/panels/useMenuButton.d.ts +68 -0
  210. package/dist/lens/panels/useMenuButton.d.ts.map +1 -0
  211. package/dist/lens/prefetch-Dov5CBoH.js +74 -0
  212. package/dist/lens/prefetchPanels-B7bIY0bM.js +31 -0
  213. package/dist/lens/print/PrintReport.d.ts +12 -0
  214. package/dist/lens/print/PrintReport.d.ts.map +1 -0
  215. package/dist/lens/print/footnotes.d.ts +29 -0
  216. package/dist/lens/print/footnotes.d.ts.map +1 -0
  217. package/dist/lens/print/formula.d.ts +9 -0
  218. package/dist/lens/print/formula.d.ts.map +1 -0
  219. package/dist/lens/print/narrative.d.ts +41 -0
  220. package/dist/lens/print/narrative.d.ts.map +1 -0
  221. package/dist/lens/print/outline.d.ts +94 -0
  222. package/dist/lens/print/outline.d.ts.map +1 -0
  223. package/dist/lens/print/palette.d.ts +23 -0
  224. package/dist/lens/print/palette.d.ts.map +1 -0
  225. package/dist/lens/print/quality.d.ts +32 -0
  226. package/dist/lens/print/quality.d.ts.map +1 -0
  227. package/dist/lens/print/units.d.ts +23 -0
  228. package/dist/lens/print/units.d.ts.map +1 -0
  229. package/dist/lens/print/values.d.ts +28 -0
  230. package/dist/lens/print/values.d.ts.map +1 -0
  231. package/dist/lens/print-CwcB0fug.js +216 -0
  232. package/dist/lens/runtime/clipboard.d.ts +11 -0
  233. package/dist/lens/runtime/clipboard.d.ts.map +1 -0
  234. package/dist/lens/runtime/document.d.ts +9 -0
  235. package/dist/lens/runtime/document.d.ts.map +1 -0
  236. package/dist/lens/runtime/drawer.d.ts +21 -0
  237. package/dist/lens/runtime/drawer.d.ts.map +1 -0
  238. package/dist/lens/runtime/drill.d.ts +54 -0
  239. package/dist/lens/runtime/drill.d.ts.map +1 -0
  240. package/dist/lens/runtime/drillPrefetch.d.ts +22 -0
  241. package/dist/lens/runtime/drillPrefetch.d.ts.map +1 -0
  242. package/dist/lens/runtime/export.d.ts +21 -0
  243. package/dist/lens/runtime/export.d.ts.map +1 -0
  244. package/dist/lens/runtime/filters.d.ts +51 -0
  245. package/dist/lens/runtime/filters.d.ts.map +1 -0
  246. package/dist/lens/runtime/focusTrap.d.ts +4 -0
  247. package/dist/lens/runtime/focusTrap.d.ts.map +1 -0
  248. package/dist/lens/runtime/format.d.ts +81 -0
  249. package/dist/lens/runtime/format.d.ts.map +1 -0
  250. package/dist/lens/runtime/idlePrefetch.d.ts +35 -0
  251. package/dist/lens/runtime/idlePrefetch.d.ts.map +1 -0
  252. package/dist/lens/runtime/index.d.ts +15 -0
  253. package/dist/lens/runtime/index.d.ts.map +1 -0
  254. package/dist/lens/runtime/navigate.d.ts +12 -0
  255. package/dist/lens/runtime/navigate.d.ts.map +1 -0
  256. package/dist/lens/runtime/navigation.d.ts +77 -0
  257. package/dist/lens/runtime/navigation.d.ts.map +1 -0
  258. package/dist/lens/runtime/overlayContainer.d.ts +24 -0
  259. package/dist/lens/runtime/overlayContainer.d.ts.map +1 -0
  260. package/dist/lens/runtime/panel.d.ts +47 -0
  261. package/dist/lens/runtime/panel.d.ts.map +1 -0
  262. package/dist/lens/runtime/panelImage.d.ts +28 -0
  263. package/dist/lens/runtime/panelImage.d.ts.map +1 -0
  264. package/dist/lens/runtime/prefetch.d.ts +48 -0
  265. package/dist/lens/runtime/prefetch.d.ts.map +1 -0
  266. package/dist/lens/runtime/prefetchPanels.d.ts +17 -0
  267. package/dist/lens/runtime/prefetchPanels.d.ts.map +1 -0
  268. package/dist/lens/runtime/print.d.ts +50 -0
  269. package/dist/lens/runtime/print.d.ts.map +1 -0
  270. package/dist/lens/runtime/provider.d.ts +195 -0
  271. package/dist/lens/runtime/provider.d.ts.map +1 -0
  272. package/dist/lens/runtime/query.d.ts +32 -0
  273. package/dist/lens/runtime/query.d.ts.map +1 -0
  274. package/dist/lens/runtime/recovery.d.ts +26 -0
  275. package/dist/lens/runtime/recovery.d.ts.map +1 -0
  276. package/dist/lens/runtime/snapshotLease.d.ts +2 -0
  277. package/dist/lens/runtime/snapshotLease.d.ts.map +1 -0
  278. package/dist/lens/runtime/theme.d.ts +4 -0
  279. package/dist/lens/runtime/theme.d.ts.map +1 -0
  280. package/dist/lens/runtime/url.d.ts +23 -0
  281. package/dist/lens/runtime/url.d.ts.map +1 -0
  282. package/dist/lens/scales-DKkoQGtJ.js +195 -0
  283. package/dist/lens/snapshotLease-LjBaqKs-.js +14 -0
  284. package/dist/lens/style.css +1 -0
  285. package/dist/lens/visualRegression.d.ts +2 -0
  286. package/dist/lens/visualRegression.d.ts.map +1 -0
  287. package/dist/sdk-identity.cjs +6 -0
  288. package/dist/sdk-identity.d.ts +4 -0
  289. package/dist/sdk-identity.js +4 -0
  290. package/dist/sdk-identity.json +5 -0
  291. package/package.json +22 -123
  292. package/assets/fonts/Actay/Actay-Regular.otf +0 -0
  293. package/assets/fonts/Actay/Actay-RegularItalic.otf +0 -0
  294. package/assets/fonts/Actay/ActayCondensed-Thin.otf +0 -0
  295. package/assets/fonts/Actay/ActayCondensed-ThinItalic.otf +0 -0
  296. package/assets/fonts/Actay/ActayWide-Bold.otf +0 -0
  297. package/assets/fonts/Actay/ActayWide-BoldItalic.otf +0 -0
  298. package/assets/fonts/Gilroy/Gilroy-Black.woff2 +0 -0
  299. package/assets/fonts/Gilroy/Gilroy-BlackItalic.woff2 +0 -0
  300. package/assets/fonts/Gilroy/Gilroy-Bold.woff2 +0 -0
  301. package/assets/fonts/Gilroy/Gilroy-BoldItalic.woff2 +0 -0
  302. package/assets/fonts/Gilroy/Gilroy-Extrabold.woff2 +0 -0
  303. package/assets/fonts/Gilroy/Gilroy-ExtraboldItalic.woff2 +0 -0
  304. package/assets/fonts/Gilroy/Gilroy-Heavy.woff2 +0 -0
  305. package/assets/fonts/Gilroy/Gilroy-HeavyItalic.woff2 +0 -0
  306. package/assets/fonts/Gilroy/Gilroy-Light.woff2 +0 -0
  307. package/assets/fonts/Gilroy/Gilroy-LightItalic.woff2 +0 -0
  308. package/assets/fonts/Gilroy/Gilroy-Medium.woff2 +0 -0
  309. package/assets/fonts/Gilroy/Gilroy-MediumItalic.woff2 +0 -0
  310. package/assets/fonts/Gilroy/Gilroy-Regular.woff2 +0 -0
  311. package/assets/fonts/Gilroy/Gilroy-RegularItalic.woff2 +0 -0
  312. package/assets/fonts/Gilroy/Gilroy-Semibold.woff2 +0 -0
  313. package/assets/fonts/Gilroy/Gilroy-SemiboldItalic.woff2 +0 -0
  314. package/assets/fonts/Gilroy/Gilroy-Thin.woff2 +0 -0
  315. package/assets/fonts/Gilroy/Gilroy-ThinItalic.woff2 +0 -0
  316. package/assets/fonts/Gilroy/Gilroy-UltraLight.woff2 +0 -0
  317. package/assets/fonts/Gilroy/Gilroy-UltraLightItalic.woff2 +0 -0
  318. package/assets/fonts/Inter.var.woff2 +0 -0
  319. package/dist/applet/core.cjs +0 -412
  320. package/dist/applet/core.cjs.map +0 -1
  321. package/dist/applet/core.d.cts +0 -187
  322. package/dist/applet/core.d.ts +0 -187
  323. package/dist/applet/core.mjs +0 -396
  324. package/dist/applet/core.mjs.map +0 -1
  325. package/dist/applet/devtools.cjs +0 -147
  326. package/dist/applet/devtools.cjs.map +0 -1
  327. package/dist/applet/devtools.d.cts +0 -7
  328. package/dist/applet/devtools.d.ts +0 -7
  329. package/dist/applet/devtools.mjs +0 -144
  330. package/dist/applet/devtools.mjs.map +0 -1
  331. package/dist/applet/host.cjs +0 -397
  332. package/dist/applet/host.cjs.map +0 -1
  333. package/dist/applet/host.d.cts +0 -42
  334. package/dist/applet/host.d.ts +0 -42
  335. package/dist/applet/host.mjs +0 -392
  336. package/dist/applet/host.mjs.map +0 -1
  337. package/dist/applet/vite.cjs +0 -219
  338. package/dist/applet/vite.cjs.map +0 -1
  339. package/dist/applet/vite.d.cts +0 -99
  340. package/dist/applet/vite.d.ts +0 -99
  341. package/dist/applet/vite.mjs +0 -203
  342. package/dist/applet/vite.mjs.map +0 -1
  343. package/dist/applet-runtime/index.cjs +0 -890
  344. package/dist/applet-runtime/index.cjs.map +0 -1
  345. package/dist/applet-runtime/index.d.cts +0 -191
  346. package/dist/applet-runtime/index.d.ts +0 -191
  347. package/dist/applet-runtime/index.mjs +0 -876
  348. package/dist/applet-runtime/index.mjs.map +0 -1
  349. package/dist/bichat/index.cjs +0 -20774
  350. package/dist/bichat/index.cjs.map +0 -1
  351. package/dist/bichat/index.css +0 -618
  352. package/dist/bichat/index.css.map +0 -1
  353. package/dist/bichat/index.d.cts +0 -4515
  354. package/dist/bichat/index.d.ts +0 -4515
  355. package/dist/bichat/index.mjs +0 -20602
  356. package/dist/bichat/index.mjs.map +0 -1
  357. package/dist/bichat/styles.css +0 -774
  358. package/dist/bichat/tailwind.cjs +0 -103
  359. package/dist/bichat/tailwind.cjs.map +0 -1
  360. package/dist/bichat/tailwind.d.cts +0 -21
  361. package/dist/bichat/tailwind.d.ts +0 -21
  362. package/dist/bichat/tailwind.mjs +0 -95
  363. package/dist/bichat/tailwind.mjs.map +0 -1
  364. package/dist/fonts/Actay/Actay-Regular.otf +0 -0
  365. package/dist/fonts/Actay/Actay-RegularItalic.otf +0 -0
  366. package/dist/fonts/Actay/ActayCondensed-Thin.otf +0 -0
  367. package/dist/fonts/Actay/ActayCondensed-ThinItalic.otf +0 -0
  368. package/dist/fonts/Actay/ActayWide-Bold.otf +0 -0
  369. package/dist/fonts/Actay/ActayWide-BoldItalic.otf +0 -0
  370. package/dist/fonts/Gilroy/Gilroy-Black.woff2 +0 -0
  371. package/dist/fonts/Gilroy/Gilroy-BlackItalic.woff2 +0 -0
  372. package/dist/fonts/Gilroy/Gilroy-Bold.woff2 +0 -0
  373. package/dist/fonts/Gilroy/Gilroy-BoldItalic.woff2 +0 -0
  374. package/dist/fonts/Gilroy/Gilroy-Extrabold.woff2 +0 -0
  375. package/dist/fonts/Gilroy/Gilroy-ExtraboldItalic.woff2 +0 -0
  376. package/dist/fonts/Gilroy/Gilroy-Heavy.woff2 +0 -0
  377. package/dist/fonts/Gilroy/Gilroy-HeavyItalic.woff2 +0 -0
  378. package/dist/fonts/Gilroy/Gilroy-Light.woff2 +0 -0
  379. package/dist/fonts/Gilroy/Gilroy-LightItalic.woff2 +0 -0
  380. package/dist/fonts/Gilroy/Gilroy-Medium.woff2 +0 -0
  381. package/dist/fonts/Gilroy/Gilroy-MediumItalic.woff2 +0 -0
  382. package/dist/fonts/Gilroy/Gilroy-Regular.woff2 +0 -0
  383. package/dist/fonts/Gilroy/Gilroy-RegularItalic.woff2 +0 -0
  384. package/dist/fonts/Gilroy/Gilroy-Semibold.woff2 +0 -0
  385. package/dist/fonts/Gilroy/Gilroy-SemiboldItalic.woff2 +0 -0
  386. package/dist/fonts/Gilroy/Gilroy-Thin.woff2 +0 -0
  387. package/dist/fonts/Gilroy/Gilroy-ThinItalic.woff2 +0 -0
  388. package/dist/fonts/Gilroy/Gilroy-UltraLight.woff2 +0 -0
  389. package/dist/fonts/Gilroy/Gilroy-UltraLightItalic.woff2 +0 -0
  390. package/dist/fonts/Inter.var.woff2 +0 -0
  391. package/dist/index-Cs_xWkhC.d.cts +0 -84
  392. package/dist/index-Cs_xWkhC.d.ts +0 -84
  393. package/dist/index.cjs +0 -777
  394. package/dist/index.cjs.map +0 -1
  395. package/dist/index.d.cts +0 -7
  396. package/dist/index.d.ts +0 -7
  397. package/dist/index.mjs +0 -755
  398. package/dist/index.mjs.map +0 -1
  399. package/dist/rpc-fh942_dj.d.cts +0 -31
  400. package/dist/rpc-fh942_dj.d.ts +0 -31
  401. package/tailwind/compiled.css +0 -2
  402. package/tailwind/create-config.cjs +0 -90
  403. package/tailwind/iota.css +0 -1195
  404. package/tailwind/main.css +0 -2
  405. package/tailwind/sdk-content.cjs +0 -177
  406. package/tailwind/sdk-theme.cjs +0 -120
@@ -1,4515 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import * as react from 'react';
3
- import react__default, { ReactNode, Component, ErrorInfo, FC, HTMLAttributes, ReactElement, ImgHTMLAttributes, ButtonHTMLAttributes, RefObject } from 'react';
4
- import { Icon, File as File$1 } from '@phosphor-icons/react';
5
- import { I as InitialContext, A as AppConfig$1, L as LocaleContext$1, T as TenantContext$1, U as UserContext$1 } from '../index-Cs_xWkhC.cjs';
6
-
7
- /**
8
- * Split data source interfaces for BiChat.
9
- *
10
- * ChatDataSource was a single interface mixing CRUD, streaming, artifacts,
11
- * and admin. These focused interfaces let consumers implement only what
12
- * they need. ChatDataSource keeps the same shape (with optional artifact
13
- * and admin methods) for backwards compatibility — it is NOT a strict
14
- * intersection of these interfaces.
15
- */
16
-
17
- interface SessionStore {
18
- createSession(): Promise<Session$1>;
19
- fetchSession(id: string): Promise<{
20
- session: Session$1;
21
- turns: ConversationTurn$1[];
22
- pendingQuestion?: PendingQuestion$1 | null;
23
- } | null>;
24
- listSessions(options?: {
25
- limit?: number;
26
- offset?: number;
27
- includeArchived?: boolean;
28
- }): Promise<SessionListResult$1>;
29
- archiveSession(sessionId: string): Promise<Session$1>;
30
- unarchiveSession(sessionId: string): Promise<Session$1>;
31
- pinSession(sessionId: string): Promise<Session$1>;
32
- unpinSession(sessionId: string): Promise<Session$1>;
33
- deleteSession(sessionId: string): Promise<void>;
34
- renameSession(sessionId: string, title: string): Promise<Session$1>;
35
- regenerateSessionTitle(sessionId: string): Promise<Session$1>;
36
- clearSessionHistory(sessionId: string): Promise<{
37
- success: boolean;
38
- deletedMessages: number;
39
- deletedArtifacts: number;
40
- }>;
41
- compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
42
- }
43
- interface MessageTransport {
44
- sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
45
- submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
46
- success: boolean;
47
- data?: AsyncRunAccepted;
48
- error?: string;
49
- }>;
50
- rejectPendingQuestion(sessionId: string): Promise<{
51
- success: boolean;
52
- data?: AsyncRunAccepted;
53
- error?: string;
54
- }>;
55
- }
56
- interface ArtifactStore {
57
- fetchSessionArtifacts(sessionId: string, options?: {
58
- limit?: number;
59
- offset?: number;
60
- }): Promise<{
61
- artifacts: SessionArtifact[];
62
- hasMore?: boolean;
63
- nextOffset?: number;
64
- }>;
65
- uploadSessionArtifacts(sessionId: string, files: File[]): Promise<{
66
- artifacts: SessionArtifact[];
67
- }>;
68
- renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
69
- deleteSessionArtifact(artifactId: string): Promise<void>;
70
- }
71
- interface AdminStore {
72
- listUsers(): Promise<SessionUser$1[]>;
73
- listAllSessions(options?: {
74
- limit?: number;
75
- offset?: number;
76
- includeArchived?: boolean;
77
- userId?: string | null;
78
- }): Promise<{
79
- sessions: Session$1[];
80
- total: number;
81
- hasMore: boolean;
82
- }>;
83
- listSessionMembers(sessionId: string): Promise<SessionMember$1[]>;
84
- addSessionMember(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
85
- updateSessionMemberRole(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
86
- removeSessionMember(sessionId: string, userId: string): Promise<void>;
87
- }
88
-
89
- /**
90
- * Type definitions for BI-Chat UI components
91
- */
92
- interface Session$1 {
93
- id: string;
94
- title: string;
95
- status: "active" | "archived";
96
- pinned: boolean;
97
- createdAt: string;
98
- updatedAt: string;
99
- owner?: SessionUser$1;
100
- isGroup?: boolean;
101
- memberCount?: number;
102
- access?: SessionAccess$1;
103
- }
104
- interface SessionAccess$1 {
105
- role: "owner" | "editor" | "viewer" | "read_all" | "none";
106
- source: "owner" | "member" | "permission" | "none";
107
- canRead: boolean;
108
- canWrite: boolean;
109
- canManageMembers: boolean;
110
- }
111
- /**
112
- * A conversation turn groups a user message with its assistant response.
113
- * This provides a cleaner mental model than flat message lists.
114
- */
115
- interface ConversationTurn$1 {
116
- id: string;
117
- sessionId: string;
118
- userTurn: UserTurn$1;
119
- assistantTurn?: AssistantTurn$1;
120
- createdAt: string;
121
- }
122
- /**
123
- * Content of a user's message in a conversation turn
124
- */
125
- interface UserTurn$1 {
126
- id: string;
127
- content: string;
128
- attachments: Attachment$1[];
129
- author?: SessionUser$1;
130
- createdAt: string;
131
- }
132
- /**
133
- * Assistant turn lifecycle used by renderers to distinguish completed output
134
- * from HITL checkpoints that require user input.
135
- */
136
- type AssistantTurnLifecycle = "complete" | "waiting_for_human_input";
137
- /**
138
- * Content of an assistant's response in a conversation turn
139
- */
140
- interface AssistantTurn$1 {
141
- id: string;
142
- role: MessageRole;
143
- content: string;
144
- explanation?: string;
145
- citations: Citation$1[];
146
- toolCalls?: ToolCall$1[];
147
- charts?: ChartData[];
148
- renderTables?: RenderTableData[];
149
- artifacts: Artifact$1[];
150
- codeOutputs: CodeOutput$1[];
151
- lifecycle: AssistantTurnLifecycle;
152
- debug?: DebugTrace$1;
153
- createdAt: string;
154
- }
155
- /**
156
- * Role of a message in a conversation
157
- */
158
- declare enum MessageRole {
159
- User = "user",
160
- Assistant = "assistant",
161
- System = "system",
162
- Tool = "tool"
163
- }
164
- /**
165
- * A tool/function call made by the assistant
166
- */
167
- interface ToolCall$1 {
168
- id: string;
169
- name: string;
170
- arguments: string;
171
- result?: string;
172
- error?: string;
173
- durationMs?: number;
174
- }
175
- /**
176
- * Citation with position information for inline replacement
177
- */
178
- interface Citation$1 {
179
- id: string;
180
- /** Type of citation (e.g., "url_citation") */
181
- type: string;
182
- /** Title of the cited source */
183
- title: string;
184
- /** URL of the cited source */
185
- url: string;
186
- /** Starting character index in the message content where this citation is referenced */
187
- startIndex: number;
188
- /** Ending character index in the message content where this citation is referenced */
189
- endIndex: number;
190
- /** Optional excerpt from the source */
191
- excerpt?: string;
192
- }
193
- interface Attachment$1 {
194
- id?: string;
195
- clientKey: string;
196
- uploadId?: number;
197
- filename: string;
198
- mimeType: string;
199
- sizeBytes: number;
200
- base64Data?: string;
201
- url?: string;
202
- preview?: string;
203
- }
204
- type ImageAttachment = Attachment$1 & {
205
- base64Data: string;
206
- preview: string;
207
- };
208
- /**
209
- * Output from code interpreter tool
210
- */
211
- interface CodeOutput$1 {
212
- type: "image" | "text" | "error";
213
- content: string;
214
- /** File metadata for downloadable outputs */
215
- filename?: string;
216
- mimeType?: string;
217
- sizeBytes?: number;
218
- }
219
- /**
220
- * Queued message for offline/loading state
221
- */
222
- interface QueuedMessage {
223
- content: string;
224
- attachments: Attachment$1[];
225
- }
226
- /**
227
- * Chart visualization data for ApexCharts
228
- */
229
- interface ChartData {
230
- /** Type of chart: line, bar, pie, area, or donut */
231
- chartType: "line" | "bar" | "area" | "pie" | "donut";
232
- /** Chart title displayed above the chart */
233
- title: string;
234
- /** Data series (multiple allowed for line/bar/area, single for pie/donut) */
235
- series: ChartSeries[];
236
- /** X-axis category labels or segment labels for pie/donut */
237
- labels?: string[];
238
- /** Hex color codes for series (e.g., '#4CAF50') */
239
- colors?: string[];
240
- /** Chart height in pixels */
241
- height?: number;
242
- /** Optional original Apex options (used by richer renderers) */
243
- options?: Record<string, unknown>;
244
- /** Optional logarithmic Y-axis hint */
245
- logarithmic?: boolean;
246
- }
247
- /**
248
- * A single data series in a chart
249
- */
250
- interface ChartSeries {
251
- /** Display name for this series */
252
- name: string;
253
- /** Numeric data values */
254
- data: number[];
255
- }
256
- interface RenderTableExport {
257
- url: string;
258
- filename: string;
259
- rowCount?: number;
260
- fileSizeKB?: number;
261
- }
262
- interface RenderTableData {
263
- id: string;
264
- title?: string;
265
- query: string;
266
- columns: string[];
267
- columnTypes?: string[];
268
- headers: string[];
269
- rows: unknown[][];
270
- totalRows: number;
271
- pageSize: number;
272
- truncated: boolean;
273
- truncatedReason?: string;
274
- export?: RenderTableExport;
275
- exportPrompt?: string;
276
- }
277
- interface Artifact$1 {
278
- type: "excel" | "pdf";
279
- filename: string;
280
- url: string;
281
- sizeReadable?: string;
282
- rowCount?: number;
283
- description?: string;
284
- }
285
- interface SessionArtifact {
286
- id: string;
287
- sessionId: string;
288
- messageId?: string;
289
- uploadId?: number;
290
- type: string;
291
- name: string;
292
- description?: string;
293
- mimeType?: string;
294
- url?: string;
295
- sizeBytes: number;
296
- metadata?: Record<string, unknown>;
297
- createdAt: string;
298
- }
299
- interface PendingQuestion$1 {
300
- id: string;
301
- turnId: string;
302
- agentName?: string;
303
- questions: Question[];
304
- status: "PENDING" | "ANSWER_SUBMITTED" | "REJECT_SUBMITTED" | "ANSWER_RESUME_FAILED" | "REJECT_RESUME_FAILED" | "ANSWERED" | "REJECTED" | "CANCELLED";
305
- }
306
- interface Question {
307
- id: string;
308
- text: string;
309
- type: "SINGLE_CHOICE" | "MULTIPLE_CHOICE";
310
- options?: QuestionOption[];
311
- required?: boolean;
312
- }
313
- interface QuestionOption {
314
- id: string;
315
- label: string;
316
- value: string;
317
- }
318
- /**
319
- * Answer data for a single question, including predefined options and custom "Other" text.
320
- */
321
- interface QuestionAnswerData {
322
- /** Selected predefined options (option IDs) */
323
- options: string[];
324
- /** Custom text entered for an "Other" answer; mutually exclusive with options */
325
- customText?: string;
326
- }
327
- /**
328
- * Map of question IDs to answer data.
329
- * Supports both multi-select options and custom "Other" text input.
330
- */
331
- interface QuestionAnswers {
332
- [questionId: string]: QuestionAnswerData;
333
- }
334
- /**
335
- * A single step in the ephemeral activity trace shown during streaming.
336
- * Steps represent thinking, tool calls, or sub-agent delegations.
337
- */
338
- interface ActivityStep {
339
- id: string;
340
- type: "thinking" | "tool" | "agent_delegation";
341
- toolName: string;
342
- /** Raw tool arguments JSON string (used for label interpolation, e.g., delegation agent name). */
343
- arguments?: string;
344
- agentName?: string;
345
- status: "active" | "completed" | "failed";
346
- startedAt: number;
347
- completedAt?: number;
348
- durationMs?: number;
349
- error?: string;
350
- }
351
- type StreamEvent = {
352
- type: "content";
353
- content: string;
354
- } | {
355
- type: "thinking";
356
- content: string;
357
- } | {
358
- type: "tool_start";
359
- tool: StreamToolPayload;
360
- } | {
361
- type: "tool_end";
362
- tool: StreamToolPayload;
363
- } | {
364
- type: "usage";
365
- usage: DebugUsage$1;
366
- } | {
367
- type: "user_message";
368
- sessionId: string;
369
- } | {
370
- type: "interrupt";
371
- interrupt: StreamInterruptPayload;
372
- sessionId?: string;
373
- } | {
374
- type: "text_block_end";
375
- seq: number;
376
- } | {
377
- type: "done";
378
- sessionId?: string;
379
- generationMs?: number;
380
- } | {
381
- type: "error";
382
- error: string;
383
- };
384
- /** Partial state when resuming a stream after refresh */
385
- interface StreamSnapshotPayload {
386
- partialContent?: string;
387
- partialMetadata?: Record<string, unknown>;
388
- }
389
- /** Active stream status for a session (from GET /stream/status) */
390
- interface StreamStatus {
391
- active: boolean;
392
- runId?: string;
393
- snapshot?: StreamSnapshotPayload;
394
- startedAt?: number;
395
- }
396
- interface AsyncRunAccepted {
397
- accepted: true;
398
- operation: "question_submit" | "question_reject" | "session_compact";
399
- sessionId: string;
400
- runId: string;
401
- startedAt: number;
402
- }
403
- /**
404
- * @deprecated Use `StreamEvent` instead. `StreamChunk` is kept for backwards
405
- * compatibility but the flat all-optional shape is unsound.
406
- */
407
- interface StreamChunk {
408
- type: "chunk" | "content" | "thinking" | "tool_start" | "tool_end" | "usage" | "done" | "error" | "user_message" | "interrupt" | "snapshot" | "stream_started" | "text_block_end";
409
- content?: string;
410
- error?: string;
411
- sessionId?: string;
412
- usage?: DebugUsage$1;
413
- tool?: StreamToolPayload;
414
- interrupt?: StreamInterruptPayload;
415
- generationMs?: number;
416
- timestamp?: number;
417
- snapshot?: StreamSnapshotPayload;
418
- /** Set when type is 'stream_started'; client should store for refresh-safe resume */
419
- runId?: string;
420
- /**
421
- * Zero-based ordinal of the assistant text segment that just ended.
422
- * Populated only when type === "text_block_end". Used to split the
423
- * accumulated assistant content into distinct blocks interleaved with
424
- * tool_call UI (text → tool → text → tool → final_text).
425
- */
426
- textBlockSeq?: number;
427
- }
428
- /**
429
- * Per-tenant active-run status event. Delivered via the
430
- * GET /bi-chat/stream/active-runs SSE endpoint. The first batch after
431
- * connect carries `event === "snapshot"` for each currently-running
432
- * session; subsequent rows carry `event === "update"` as runs
433
- * transition (queued → streaming → completed / cancelled / failed).
434
- */
435
- interface ActiveRunDelivery {
436
- event: "snapshot" | "update";
437
- sessionId: string;
438
- runId: string;
439
- status: "queued" | "streaming" | "completed" | "cancelled" | "failed";
440
- updatedAt: number;
441
- }
442
- interface StreamInterruptPayload {
443
- checkpointId: string;
444
- agentName?: string;
445
- questions: StreamInterruptQuestion[];
446
- }
447
- interface StreamInterruptQuestion {
448
- id: string;
449
- text: string;
450
- type: string;
451
- options: Array<{
452
- id: string;
453
- label: string;
454
- }>;
455
- }
456
- interface DebugUsage$1 {
457
- promptTokens: number;
458
- completionTokens: number;
459
- totalTokens: number;
460
- cachedTokens?: number;
461
- cost?: number;
462
- }
463
- interface StreamToolPayload {
464
- callId?: string;
465
- name: string;
466
- arguments?: string;
467
- result?: string;
468
- error?: string;
469
- durationMs?: number;
470
- agentName?: string;
471
- }
472
- interface DebugTrace$1 {
473
- schemaVersion?: string;
474
- startedAt?: string;
475
- completedAt?: string;
476
- generationMs?: number;
477
- usage?: DebugUsage$1;
478
- tools: StreamToolPayload[];
479
- attempts?: DebugGeneration$1[];
480
- spans?: DebugSpan$1[];
481
- events?: DebugEvent$1[];
482
- traceId?: string;
483
- traceUrl?: string;
484
- sessionId?: string;
485
- thinking?: string;
486
- observationReason?: string;
487
- }
488
- interface DebugGeneration$1 {
489
- id?: string;
490
- requestId?: string;
491
- model?: string;
492
- provider?: string;
493
- finishReason?: string;
494
- promptTokens?: number;
495
- completionTokens?: number;
496
- totalTokens?: number;
497
- cachedTokens?: number;
498
- cost?: number;
499
- latencyMs?: number;
500
- input?: string;
501
- output?: string;
502
- thinking?: string;
503
- observationReason?: string;
504
- startedAt?: string;
505
- completedAt?: string;
506
- toolCalls?: StreamToolPayload[];
507
- }
508
- interface DebugSpan$1 {
509
- id?: string;
510
- parentId?: string;
511
- generationId?: string;
512
- name?: string;
513
- type?: string;
514
- status?: string;
515
- level?: string;
516
- callId?: string;
517
- toolName?: string;
518
- input?: string;
519
- output?: string;
520
- error?: string;
521
- durationMs?: number;
522
- startedAt?: string;
523
- completedAt?: string;
524
- attributes?: Record<string, unknown>;
525
- }
526
- interface DebugEvent$1 {
527
- id?: string;
528
- name?: string;
529
- type?: string;
530
- level?: string;
531
- message?: string;
532
- reason?: string;
533
- spanId?: string;
534
- generationId?: string;
535
- timestamp?: string;
536
- attributes?: Record<string, unknown>;
537
- }
538
- interface DebugLimits {
539
- policyMaxTokens: number;
540
- modelMaxTokens: number;
541
- effectiveMaxTokens: number;
542
- completionReserveTokens: number;
543
- }
544
- interface SessionDebugUsage {
545
- promptTokens: number;
546
- completionTokens: number;
547
- totalTokens: number;
548
- turnsWithUsage: number;
549
- latestPromptTokens: number;
550
- latestCompletionTokens: number;
551
- latestTotalTokens: number;
552
- }
553
- interface SendMessageOptions {
554
- debugMode?: boolean;
555
- replaceFromMessageID?: string;
556
- reasoningEffort?: string;
557
- model?: string;
558
- /**
559
- * Client-generated idempotency key. Duplicate sends sharing the same
560
- * requestId within the backend's dedupe window (~30 min) converge on
561
- * a single server-side run. Omit to disable dedupe for a particular
562
- * send; the data source auto-generates one per call otherwise.
563
- */
564
- requestId?: string;
565
- }
566
- interface SessionListResult$1 {
567
- sessions: Session$1[];
568
- total: number;
569
- hasMore: boolean;
570
- }
571
- interface SessionUser$1 {
572
- id: string;
573
- firstName: string;
574
- lastName: string;
575
- initials: string;
576
- }
577
- interface SessionMember$1 {
578
- user: SessionUser$1;
579
- role: "owner" | "editor" | "viewer";
580
- createdAt: string;
581
- updatedAt: string;
582
- }
583
- interface SessionGroup {
584
- name: string;
585
- sessions: Session$1[];
586
- }
587
-
588
- /**
589
- * Full data source interface for BiChat.
590
- *
591
- * Combines session CRUD, message transport, and optional artifact/admin
592
- * methods. Existing implementations satisfy this without changes.
593
- *
594
- * For new code, prefer the focused interfaces (`SessionStore`,
595
- * `MessageTransport`, `ArtifactStore`, `AdminStore`) when you only need a
596
- * subset of capabilities.
597
- */
598
- interface ChatDataSource {
599
- createSession(): Promise<Session$1>;
600
- fetchSession(id: string): Promise<{
601
- session: Session$1;
602
- turns: ConversationTurn$1[];
603
- pendingQuestion?: PendingQuestion$1 | null;
604
- } | null>;
605
- fetchSessionArtifacts?(sessionId: string, options?: {
606
- limit?: number;
607
- offset?: number;
608
- }): Promise<{
609
- artifacts: SessionArtifact[];
610
- hasMore?: boolean;
611
- nextOffset?: number;
612
- }>;
613
- uploadSessionArtifacts?(sessionId: string, files: File[]): Promise<{
614
- artifacts: SessionArtifact[];
615
- }>;
616
- renameSessionArtifact?(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
617
- deleteSessionArtifact?(artifactId: string): Promise<void>;
618
- sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
619
- clearSessionHistory(sessionId: string): Promise<{
620
- success: boolean;
621
- deletedMessages: number;
622
- deletedArtifacts: number;
623
- }>;
624
- compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
625
- submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
626
- success: boolean;
627
- data?: AsyncRunAccepted;
628
- error?: string;
629
- }>;
630
- rejectPendingQuestion(sessionId: string): Promise<{
631
- success: boolean;
632
- data?: AsyncRunAccepted;
633
- error?: string;
634
- }>;
635
- /**
636
- * Stops the active stream for the given session. No partial assistant message is persisted.
637
- * Optional for backward compatibility with data sources that do not support stop.
638
- */
639
- stopGeneration?(sessionId: string): Promise<void>;
640
- /**
641
- * Returns active stream status for the session (for refresh-safe resume).
642
- * Optional; if absent, no resume/passive flow is used.
643
- */
644
- getStreamStatus?(sessionId: string): Promise<StreamStatus | null>;
645
- /**
646
- * Resumes an active stream: delivers snapshot then new chunks. Use when getStreamStatus
647
- * reported active and the client has the same-browser run marker.
648
- * Optional; if absent, resume is not supported.
649
- */
650
- resumeStream?(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
651
- /**
652
- * Tail a run via native EventSource against GET /stream/events. Honours
653
- * Last-Event-ID for auto-reconnect on wifi drops / tab sleep. Prefer
654
- * over resumeStream when connecting to a run that was started by
655
- * another tab (same request_id) or that needs to survive a reload
656
- * via cursor-based replay. Optional; data sources that don't
657
- * implement it fall back to resumeStream.
658
- */
659
- subscribeRunEvents?(sessionId: string, runId: string, options: {
660
- lastEventId?: string;
661
- onChunk: (chunk: StreamChunk) => void;
662
- onError?: (event: Event) => void;
663
- signal?: AbortSignal;
664
- }): Promise<void>;
665
- /**
666
- * Subscribe to the per-tenant active-run fan-out
667
- * (GET /stream/active-runs). Emits one "snapshot" event per
668
- * currently-running session on connect, then live "update" deltas.
669
- * Optional; data sources that don't implement it fall back to
670
- * per-session polling via getStreamStatus.
671
- */
672
- subscribeActiveRuns?(options: {
673
- onEvent: (event: ActiveRunDelivery) => void;
674
- onError?: (event: Event) => void;
675
- signal?: AbortSignal;
676
- }): Promise<void>;
677
- listSessions(options?: {
678
- limit?: number;
679
- offset?: number;
680
- includeArchived?: boolean;
681
- }): Promise<SessionListResult$1>;
682
- archiveSession(sessionId: string): Promise<Session$1>;
683
- unarchiveSession(sessionId: string): Promise<Session$1>;
684
- pinSession(sessionId: string): Promise<Session$1>;
685
- unpinSession(sessionId: string): Promise<Session$1>;
686
- deleteSession(sessionId: string): Promise<void>;
687
- renameSession(sessionId: string, title: string): Promise<Session$1>;
688
- regenerateSessionTitle(sessionId: string): Promise<Session$1>;
689
- listUsers?(): Promise<SessionUser$1[]>;
690
- listAllSessions?(options?: {
691
- limit?: number;
692
- offset?: number;
693
- includeArchived?: boolean;
694
- userId?: string | null;
695
- }): Promise<{
696
- sessions: Session$1[];
697
- total: number;
698
- hasMore: boolean;
699
- }>;
700
- listSessionMembers?(sessionId: string): Promise<SessionMember$1[]>;
701
- addSessionMember?(sessionId: string, userId: string, role: "editor" | "viewer"): Promise<void>;
702
- updateSessionMemberRole?(sessionId: string, userId: string, role: "editor" | "viewer"): Promise<void>;
703
- removeSessionMember?(sessionId: string, userId: string): Promise<void>;
704
- }
705
- interface ChatSessionStateValue {
706
- session: Session$1 | null;
707
- currentSessionId?: string;
708
- fetching: boolean;
709
- error: string | null;
710
- errorRetryable: boolean;
711
- debugMode: boolean;
712
- sessionDebugUsage: SessionDebugUsage;
713
- debugLimits: DebugLimits | null;
714
- reasoningEffort: string | undefined;
715
- reasoningEffortOptions: string[] | undefined;
716
- model: string | undefined;
717
- setError: (error: string | null) => void;
718
- retryFetchSession: () => void;
719
- setReasoningEffort: (effort: string) => void;
720
- setModel: (model: string | undefined) => void;
721
- }
722
- interface ChatMessagingStateValue {
723
- turns: ConversationTurn$1[];
724
- streamingContent: string;
725
- isStreaming: boolean;
726
- streamError: string | null;
727
- streamErrorRetryable: boolean;
728
- loading: boolean;
729
- pendingQuestion: PendingQuestion$1 | null;
730
- codeOutputs: CodeOutput$1[];
731
- isCompacting: boolean;
732
- compactionSummary: string | null;
733
- /** Bumped when artifacts should be refetched (e.g. tool_end for artifact-producing tools). */
734
- artifactsInvalidationTrigger: number;
735
- /** Ephemeral reasoning/thinking content, cleared when final answer arrives. */
736
- thinkingContent: string;
737
- /** Ephemeral activity steps (tools, thinking, delegations), cleared on done. */
738
- activeSteps: ActivityStep[];
739
- showActivityTrace: boolean;
740
- showTypingIndicator: boolean;
741
- sendMessage: (content: string, attachments?: Attachment$1[]) => Promise<void>;
742
- handleRegenerate?: (turnId: string, model?: string) => Promise<void>;
743
- handleEdit?: (turnId: string, newContent: string) => Promise<void>;
744
- handleCopy: (text: string) => Promise<void>;
745
- handleSubmitQuestionAnswers: (answers: QuestionAnswers) => void;
746
- handleRejectPendingQuestion: () => Promise<void>;
747
- retryLastMessage: () => Promise<void>;
748
- clearStreamError: () => void;
749
- cancel: () => void;
750
- setCodeOutputs: (outputs: CodeOutput$1[]) => void;
751
- }
752
- interface ChatInputStateValue {
753
- message: string;
754
- inputError: string | null;
755
- messageQueue: QueuedMessage[];
756
- setMessage: (message: string) => void;
757
- setInputError: (error: string | null) => void;
758
- handleSubmit: (e: {
759
- preventDefault: () => void;
760
- }, attachments?: Attachment$1[]) => void;
761
- handleUnqueue: () => {
762
- content: string;
763
- attachments: Attachment$1[];
764
- } | null;
765
- enqueueMessage: (content: string, attachments: Attachment$1[]) => boolean;
766
- removeQueueItem: (index: number) => void;
767
- updateQueueItem: (index: number, content: string) => void;
768
- }
769
- interface ChatSessionContextValue extends ChatSessionStateValue, ChatMessagingStateValue, ChatInputStateValue {
770
- /**
771
- * @deprecated Use `retryLastMessage` from `ChatMessagingStateValue` instead.
772
- * This field is not populated by the current ChatMachine-based provider and
773
- * will always be `undefined` at runtime.
774
- */
775
- handleRetry?: () => Promise<void>;
776
- }
777
-
778
- /**
779
- * Per-session rate limiter
780
- * Prevents excessive requests within a time window
781
- */
782
- interface RateLimiterConfig {
783
- maxRequests: number;
784
- windowMs: number;
785
- }
786
- declare class RateLimiter {
787
- private timestamps;
788
- private maxRequests;
789
- private windowMs;
790
- constructor(config: RateLimiterConfig);
791
- /**
792
- * Check if a request can be made
793
- * Updates internal state if request is allowed
794
- */
795
- canMakeRequest(): boolean;
796
- /**
797
- * Get milliseconds until next request is allowed
798
- * Returns 0 if request can be made immediately
799
- */
800
- getTimeUntilNextRequest(): number;
801
- /**
802
- * Reset the rate limiter state
803
- */
804
- reset(): void;
805
- }
806
-
807
- interface ChatSessionProps {
808
- dataSource: ChatDataSource;
809
- sessionId?: string;
810
- /** Optional rate limiter to throttle sendMessage */
811
- rateLimiter?: RateLimiter;
812
- /**
813
- * Called when a new session is created (e.g. on first message in a "new
814
- * chat"). Use this to navigate your SPA router to the new session URL.
815
- */
816
- onSessionCreated?: (sessionId: string) => void;
817
- /** Alias for isReadOnly (preferred) */
818
- readOnly?: boolean;
819
- isReadOnly?: boolean;
820
- /** Custom render function for user turns */
821
- renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
822
- /** Custom render function for assistant turns */
823
- renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
824
- className?: string;
825
- /** Custom content to display as header */
826
- headerSlot?: ReactNode;
827
- /** Custom welcome screen component (replaces default WelcomeContent) */
828
- welcomeSlot?: ReactNode;
829
- /** Custom logo for the header */
830
- logoSlot?: ReactNode;
831
- /** Custom action buttons for the header */
832
- actionsSlot?: ReactNode;
833
- /** Custom content rendered above the message input (e.g., model selector) */
834
- inputHeaderSlot?: ReactNode;
835
- /** Callback when user navigates back */
836
- onBack?: () => void;
837
- /** Custom verbs for the typing indicator (e.g. ['Thinking', 'Analyzing', ...]) */
838
- thinkingVerbs?: string[];
839
- /** Callback invoked after an archived session is restored (e.g. to navigate or refresh) */
840
- onSessionRestored?: (sessionId: string) => void;
841
- /** Enables the built-in right-side artifacts panel for persisted session artifacts */
842
- showArtifactsPanel?: boolean;
843
- /** Initial expanded state for artifacts panel when no persisted preference exists */
844
- artifactsPanelDefaultExpanded?: boolean;
845
- /** localStorage key for artifacts panel expanded/collapsed state */
846
- artifactsPanelStorageKey?: string;
847
- }
848
- declare function ChatSession(props: ChatSessionProps): react_jsx_runtime.JSX.Element;
849
-
850
- declare function ModelSelector(): react_jsx_runtime.JSX.Element | null;
851
-
852
- interface SessionArtifactsPanelProps {
853
- dataSource: ChatDataSource;
854
- sessionId: string;
855
- isStreaming: boolean;
856
- allowDrop?: boolean;
857
- className?: string;
858
- /** When provided, used instead of useChatMessaging().artifactsInvalidationTrigger (allows use outside SDK ChatSessionProvider). */
859
- artifactsInvalidationTrigger?: number;
860
- }
861
- declare function SessionArtifactsPanel({ dataSource, sessionId, isStreaming, allowDrop, className, artifactsInvalidationTrigger: artifactsInvalidationTriggerProp, }: SessionArtifactsPanelProps): react_jsx_runtime.JSX.Element;
862
-
863
- interface SessionArtifactListProps {
864
- artifacts: SessionArtifact[];
865
- selectedArtifactId?: string;
866
- onSelect: (artifact: SessionArtifact) => void;
867
- }
868
- declare function SessionArtifactList({ artifacts, selectedArtifactId, onSelect, }: SessionArtifactListProps): react_jsx_runtime.JSX.Element;
869
-
870
- interface SessionArtifactPreviewProps {
871
- artifact: SessionArtifact;
872
- }
873
- declare function SessionArtifactPreview({ artifact }: SessionArtifactPreviewProps): react_jsx_runtime.JSX.Element;
874
-
875
- interface ChatHeaderProps {
876
- session: Session$1 | null;
877
- onBack?: () => void;
878
- readOnly?: boolean;
879
- /** Custom logo component to display */
880
- logoSlot?: ReactNode;
881
- /** Custom action buttons */
882
- actionsSlot?: ReactNode;
883
- /** Members to display in avatar stack for group chats */
884
- members?: Array<{
885
- firstName: string;
886
- lastName: string;
887
- initials?: string;
888
- }>;
889
- /** Callback when avatar stack is clicked (to open members modal) */
890
- onMembersClick?: () => void;
891
- }
892
- declare function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot, members, onMembersClick }: ChatHeaderProps): react_jsx_runtime.JSX.Element;
893
-
894
- interface MessageListProps {
895
- renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
896
- renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
897
- thinkingVerbs?: string[];
898
- readOnly?: boolean;
899
- }
900
- declare function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readOnly }: MessageListProps): react_jsx_runtime.JSX.Element;
901
-
902
- interface UserMessageAvatarSlotProps {
903
- /** Default initials */
904
- initials: string;
905
- }
906
- interface UserMessageContentSlotProps {
907
- /** Message content text */
908
- content: string;
909
- }
910
- interface UserMessageAttachmentsSlotProps {
911
- /** Message attachments */
912
- attachments: Attachment$1[];
913
- /** Handler to open image viewer */
914
- onView: (index: number) => void;
915
- }
916
- interface UserMessageActionsSlotProps {
917
- /** Copy content to clipboard */
918
- onCopy: () => void;
919
- /** Edit message (if available) */
920
- onEdit?: () => void;
921
- /** Formatted timestamp */
922
- timestamp: string;
923
- /** Whether copy action is available */
924
- canCopy: boolean;
925
- /** Whether edit action is available */
926
- canEdit: boolean;
927
- }
928
- interface UserMessageSlots {
929
- /** Custom avatar renderer */
930
- avatar?: ReactNode | ((props: UserMessageAvatarSlotProps) => ReactNode);
931
- /** Custom content renderer */
932
- content?: ReactNode | ((props: UserMessageContentSlotProps) => ReactNode);
933
- /** Custom attachments renderer */
934
- attachments?: ReactNode | ((props: UserMessageAttachmentsSlotProps) => ReactNode);
935
- /** Custom actions renderer */
936
- actions?: ReactNode | ((props: UserMessageActionsSlotProps) => ReactNode);
937
- }
938
- interface UserMessageClassNames {
939
- /** Root container */
940
- root?: string;
941
- /** Inner content wrapper */
942
- wrapper?: string;
943
- /** Avatar container */
944
- avatar?: string;
945
- /** Message bubble */
946
- bubble?: string;
947
- /** Content text */
948
- content?: string;
949
- /** Attachments container */
950
- attachments?: string;
951
- /** Actions container */
952
- actions?: string;
953
- /** Action button */
954
- actionButton?: string;
955
- /** Timestamp */
956
- timestamp?: string;
957
- }
958
- interface UserMessageProps {
959
- /** User turn data */
960
- turn: UserTurn$1;
961
- /** Turn ID for edit operations */
962
- turnId?: string;
963
- /** User initials for avatar */
964
- initials?: string;
965
- /** Optional sender name for shared/group chats */
966
- authorName?: string;
967
- /** Slot overrides */
968
- slots?: UserMessageSlots;
969
- /** Class name overrides */
970
- classNames?: UserMessageClassNames;
971
- /** Copy handler */
972
- onCopy?: (content: string) => Promise<void> | void;
973
- /** Edit handler */
974
- onEdit?: (turnId: string, newContent: string) => void;
975
- /** Hide avatar */
976
- hideAvatar?: boolean;
977
- /** Hide actions */
978
- hideActions?: boolean;
979
- /** Hide timestamp */
980
- hideTimestamp?: boolean;
981
- /** Whether edit action should be available */
982
- allowEdit?: boolean;
983
- }
984
- declare function UserMessage({ turn, turnId, initials, authorName, slots, classNames: classNameOverrides, onCopy, onEdit, hideAvatar, hideActions, hideTimestamp, allowEdit, }: UserMessageProps): react_jsx_runtime.JSX.Element;
985
-
986
- interface UserTurnViewProps {
987
- /** The conversation turn containing the user message */
988
- turn: ConversationTurn$1;
989
- /** Slot overrides for customization */
990
- slots?: UserMessageSlots;
991
- /** Class name overrides */
992
- classNames?: UserMessageClassNames;
993
- /** User initials for avatar */
994
- initials?: string;
995
- /** Hide avatar */
996
- hideAvatar?: boolean;
997
- /** Hide actions */
998
- hideActions?: boolean;
999
- /** Hide timestamp */
1000
- hideTimestamp?: boolean;
1001
- /** Whether edit action should be available */
1002
- allowEdit?: boolean;
1003
- /** Show sender identity label above the message bubble */
1004
- showAuthorName?: boolean;
1005
- }
1006
- declare function UserTurnView({ turn, slots, classNames, initials, hideAvatar, hideActions, hideTimestamp, allowEdit, showAuthorName, }: UserTurnViewProps): react_jsx_runtime.JSX.Element;
1007
-
1008
- interface AssistantMessageAvatarSlotProps {
1009
- /** Default text */
1010
- text: string;
1011
- }
1012
- interface AssistantMessageContentSlotProps {
1013
- /** Message content (markdown) */
1014
- content: string;
1015
- /** Citations */
1016
- citations?: Citation$1[];
1017
- /** Whether streaming is active */
1018
- isStreaming: boolean;
1019
- }
1020
- interface AssistantMessageSourcesSlotProps {
1021
- /** Citations to display */
1022
- citations: Citation$1[];
1023
- }
1024
- interface AssistantMessageChartsSlotProps {
1025
- /** Chart data array */
1026
- charts: ChartData[];
1027
- }
1028
- interface AssistantMessageCodeOutputsSlotProps {
1029
- /** Code execution outputs */
1030
- outputs: CodeOutput$1[];
1031
- }
1032
- interface AssistantMessageTablesSlotProps {
1033
- /** Interactive table payloads */
1034
- tables: RenderTableData[];
1035
- }
1036
- interface AssistantMessageArtifactsSlotProps {
1037
- /** Downloadable artifacts */
1038
- artifacts: Artifact$1[];
1039
- }
1040
- interface AssistantMessageActionsSlotProps {
1041
- /** Copy content to clipboard */
1042
- onCopy: () => void;
1043
- /** Regenerate response, optionally with a specific model id */
1044
- onRegenerate?: (model?: string) => void;
1045
- /** Available models that can be picked for regenerate */
1046
- regenerateModels?: RegenerateModelOption[];
1047
- /** Formatted timestamp */
1048
- timestamp: string;
1049
- /** Whether copy action is available */
1050
- canCopy: boolean;
1051
- /** Whether regenerate action is available */
1052
- canRegenerate: boolean;
1053
- }
1054
- interface RegenerateModelOption {
1055
- /** Model id passed to onRegenerate */
1056
- id: string;
1057
- /** Translation key (or label) shown in the picker */
1058
- label: string;
1059
- }
1060
- interface AssistantMessageExplanationSlotProps {
1061
- /** Explanation content (markdown) */
1062
- explanation: string;
1063
- /** Whether expanded */
1064
- isExpanded: boolean;
1065
- /** Toggle expansion */
1066
- onToggle: () => void;
1067
- }
1068
- interface AssistantMessageSlots {
1069
- /** Custom avatar renderer */
1070
- avatar?: ReactNode | ((props: AssistantMessageAvatarSlotProps) => ReactNode);
1071
- /** Custom content renderer */
1072
- content?: ReactNode | ((props: AssistantMessageContentSlotProps) => ReactNode);
1073
- /** Custom sources renderer */
1074
- sources?: ReactNode | ((props: AssistantMessageSourcesSlotProps) => ReactNode);
1075
- /** Custom charts renderer */
1076
- charts?: ReactNode | ((props: AssistantMessageChartsSlotProps) => ReactNode);
1077
- /** Custom code outputs renderer */
1078
- codeOutputs?: ReactNode | ((props: AssistantMessageCodeOutputsSlotProps) => ReactNode);
1079
- /** Custom table renderer */
1080
- tables?: ReactNode | ((props: AssistantMessageTablesSlotProps) => ReactNode);
1081
- /** Custom artifacts renderer */
1082
- artifacts?: ReactNode | ((props: AssistantMessageArtifactsSlotProps) => ReactNode);
1083
- /** Custom actions renderer */
1084
- actions?: ReactNode | ((props: AssistantMessageActionsSlotProps) => ReactNode);
1085
- /** Custom explanation renderer */
1086
- explanation?: ReactNode | ((props: AssistantMessageExplanationSlotProps) => ReactNode);
1087
- }
1088
- interface AssistantMessageClassNames {
1089
- /** Root container */
1090
- root?: string;
1091
- /** Inner content wrapper */
1092
- wrapper?: string;
1093
- /** Avatar container */
1094
- avatar?: string;
1095
- /** Message bubble */
1096
- bubble?: string;
1097
- /** Code outputs container */
1098
- codeOutputs?: string;
1099
- /** Charts container */
1100
- charts?: string;
1101
- /** Tables container */
1102
- tables?: string;
1103
- /** Artifacts container */
1104
- artifacts?: string;
1105
- /** Sources container */
1106
- sources?: string;
1107
- /** Explanation container */
1108
- explanation?: string;
1109
- /** Actions container */
1110
- actions?: string;
1111
- /** Action button */
1112
- actionButton?: string;
1113
- /** Timestamp */
1114
- timestamp?: string;
1115
- }
1116
- interface AssistantMessageProps {
1117
- /** Assistant turn data */
1118
- turn: AssistantTurn$1;
1119
- /** Turn ID for regenerate operations */
1120
- turnId?: string;
1121
- /** When true, this is the last turn (Regenerate button shown only on last assistant message) */
1122
- isLastTurn?: boolean;
1123
- /** Whether response is being streamed */
1124
- isStreaming?: boolean;
1125
- /** Pending question for HITL */
1126
- pendingQuestion?: PendingQuestion$1 | null;
1127
- /** Slot overrides */
1128
- slots?: AssistantMessageSlots;
1129
- /** Class name overrides */
1130
- classNames?: AssistantMessageClassNames;
1131
- /** Copy handler */
1132
- onCopy?: (content: string) => Promise<void> | void;
1133
- /** Regenerate handler. The optional `model` argument is the id chosen from the
1134
- * Fast/Deep picker; when omitted the current session model is used. */
1135
- onRegenerate?: (turnId: string, model?: string) => Promise<void> | void;
1136
- /** Models offered when the user clicks the regenerate button. When two or more
1137
- * options are provided a Fast/Deep picker is shown; otherwise regenerate is
1138
- * triggered immediately with the active model. */
1139
- regenerateModels?: RegenerateModelOption[];
1140
- /** Send message handler (for markdown links) */
1141
- onSendMessage?: (content: string) => void;
1142
- /** Whether sending is disabled */
1143
- sendDisabled?: boolean;
1144
- /** Hide avatar */
1145
- hideAvatar?: boolean;
1146
- /** Hide actions */
1147
- hideActions?: boolean;
1148
- /** Hide timestamp */
1149
- hideTimestamp?: boolean;
1150
- /** Show debug panel */
1151
- showDebug?: boolean;
1152
- }
1153
- declare function AssistantMessage({ turn, turnId, isLastTurn, isStreaming, pendingQuestion, slots, classNames: classNameOverrides, onCopy, onRegenerate, regenerateModels, onSendMessage, sendDisabled, hideAvatar, hideActions, hideTimestamp, showDebug, }: AssistantMessageProps): react_jsx_runtime.JSX.Element;
1154
-
1155
- interface AssistantTurnViewProps {
1156
- /** The conversation turn containing the assistant response */
1157
- turn: ConversationTurn$1;
1158
- /** When true, this is the last turn in the list (Regenerate button shown only on last assistant message) */
1159
- isLastTurn?: boolean;
1160
- /** Whether the response is currently being streamed */
1161
- isStreaming?: boolean;
1162
- /** Slot overrides for customization */
1163
- slots?: AssistantMessageSlots;
1164
- /** Class name overrides */
1165
- classNames?: AssistantMessageClassNames;
1166
- /** Hide avatar */
1167
- hideAvatar?: boolean;
1168
- /** Hide actions */
1169
- hideActions?: boolean;
1170
- /** Hide timestamp */
1171
- hideTimestamp?: boolean;
1172
- /** Whether regenerate action should be available */
1173
- allowRegenerate?: boolean;
1174
- }
1175
- declare function AssistantTurnView({ turn, isLastTurn, isStreaming, slots, classNames, hideAvatar, hideActions, hideTimestamp, allowRegenerate, }: AssistantTurnViewProps): react_jsx_runtime.JSX.Element | null;
1176
-
1177
- interface TurnBubbleClassNames {
1178
- /** Root container */
1179
- root?: string;
1180
- /** User turn wrapper */
1181
- userTurn?: string;
1182
- /** Assistant turn wrapper */
1183
- assistantTurn?: string;
1184
- }
1185
- interface TurnBubbleProps {
1186
- /** The conversation turn containing user and optional assistant content */
1187
- turn: ConversationTurn$1;
1188
- /** When true, this turn is the last in the list (e.g. Regenerate shows only on last assistant message) */
1189
- isLastTurn?: boolean;
1190
- /** Custom render function for user turn (full control) */
1191
- renderUserTurn?: (turn: ConversationTurn$1) => ReactNode;
1192
- /** Custom render function for assistant turn (full control) */
1193
- renderAssistantTurn?: (turn: ConversationTurn$1) => ReactNode;
1194
- /** Props passed to UserTurnView (when not using custom renderer) */
1195
- userTurnProps?: Omit<UserTurnViewProps, 'turn'>;
1196
- /** Props passed to AssistantTurnView (when not using custom renderer) */
1197
- assistantTurnProps?: Omit<AssistantTurnViewProps, 'turn'>;
1198
- /** Slots for user message customization */
1199
- userMessageSlots?: UserMessageSlots;
1200
- /** Slots for assistant message customization */
1201
- assistantMessageSlots?: AssistantMessageSlots;
1202
- /** Class names for user message */
1203
- userMessageClassNames?: UserMessageClassNames;
1204
- /** Class names for assistant message */
1205
- assistantMessageClassNames?: AssistantMessageClassNames;
1206
- /** Class names for turn bubble container */
1207
- classNames?: TurnBubbleClassNames;
1208
- /** Whether assistant response is streaming */
1209
- isStreaming?: boolean;
1210
- }
1211
- declare function TurnBubble({ turn, isLastTurn, renderUserTurn, renderAssistantTurn, userTurnProps, assistantTurnProps, userMessageSlots, assistantMessageSlots, userMessageClassNames, assistantMessageClassNames, classNames, isStreaming, }: TurnBubbleProps): react_jsx_runtime.JSX.Element;
1212
-
1213
- interface MarkdownRendererProps {
1214
- /** Markdown content to render */
1215
- content: string;
1216
- /** Optional citations to process and display */
1217
- citations?: Citation$1[] | null;
1218
- /** Optional function to send messages (enables table export) */
1219
- sendMessage?: (content: string) => void;
1220
- /** Whether message sending is disabled */
1221
- sendDisabled?: boolean;
1222
- /** Copy button label for code blocks */
1223
- copyLabel?: string;
1224
- /** Copied confirmation label for code blocks */
1225
- copiedLabel?: string;
1226
- /** Export button label for tables */
1227
- exportLabel?: string;
1228
- }
1229
- declare function MarkdownRenderer({ content, citations, sendMessage, sendDisabled, copyLabel, copiedLabel, exportLabel, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element;
1230
- declare const MemoizedMarkdownRenderer: react.MemoExoticComponent<typeof MarkdownRenderer>;
1231
-
1232
- /** External container control. When provided, the card runs in embedded mode. */
1233
- interface ChartCardHost {
1234
- isFullscreen: boolean;
1235
- }
1236
- interface ChartCardProps {
1237
- chartData: ChartData;
1238
- onExportError?: (error: string) => void;
1239
- /** When provided, the card runs in embedded mode — strips outer chrome, fills container height in fullscreen. */
1240
- host?: ChartCardHost;
1241
- }
1242
- /**
1243
- * ChartCard renders a single chart visualization with optional PNG export.
1244
- */
1245
- declare function ChartCard({ chartData, onExportError, host }: ChartCardProps): react_jsx_runtime.JSX.Element;
1246
-
1247
- interface SourcesPanelProps {
1248
- citations: Citation$1[];
1249
- }
1250
- declare function SourcesPanel({ citations }: SourcesPanelProps): react_jsx_runtime.JSX.Element | null;
1251
-
1252
- interface DownloadCardProps {
1253
- artifact: Artifact$1;
1254
- }
1255
- declare function DownloadCard({ artifact }: DownloadCardProps): react_jsx_runtime.JSX.Element;
1256
-
1257
- interface InlineQuestionFormProps {
1258
- pendingQuestion: PendingQuestion$1;
1259
- }
1260
- declare function InlineQuestionForm({ pendingQuestion, }: InlineQuestionFormProps): react_jsx_runtime.JSX.Element;
1261
-
1262
- interface MessageInputRef {
1263
- focus: () => void;
1264
- clear: () => void;
1265
- }
1266
- interface MessageInputProps {
1267
- message: string;
1268
- loading: boolean;
1269
- isStreaming?: boolean;
1270
- fetching?: boolean;
1271
- disabled?: boolean;
1272
- commandError?: string | null;
1273
- debugMode?: boolean;
1274
- debugSessionUsage?: SessionDebugUsage;
1275
- debugLimits?: DebugLimits | null;
1276
- messageQueue?: QueuedMessage[];
1277
- onClearCommandError?: () => void;
1278
- onMessageChange: (value: string) => void;
1279
- onSubmit: (e: React.FormEvent, attachments: Attachment$1[]) => void;
1280
- onCancelStreaming?: () => void;
1281
- onUnqueue?: () => {
1282
- content: string;
1283
- attachments: Attachment$1[];
1284
- } | null;
1285
- onRemoveQueueItem?: (index: number) => void;
1286
- onUpdateQueueItem?: (index: number, content: string) => void;
1287
- placeholder?: string;
1288
- maxFiles?: number;
1289
- maxFileSize?: number;
1290
- containerClassName?: string;
1291
- formClassName?: string;
1292
- reasoningEffortOptions?: string[];
1293
- reasoningEffort?: string;
1294
- onReasoningEffortChange?: (effort: string) => void;
1295
- }
1296
- declare const MessageInput: react.ForwardRefExoticComponent<MessageInputProps & react.RefAttributes<MessageInputRef>>;
1297
-
1298
- interface AttachmentGridProps {
1299
- attachments: Attachment$1[];
1300
- onRemove?: (index: number) => void;
1301
- onView?: (index: number) => void;
1302
- className?: string;
1303
- readonly?: boolean;
1304
- maxDisplay?: number;
1305
- maxCapacity?: number;
1306
- emptyMessage?: string;
1307
- showCount?: boolean;
1308
- /** Number of files currently being processed (shows shimmer placeholders) */
1309
- pendingCount?: number;
1310
- }
1311
- declare function AttachmentGrid({ attachments, onRemove, onView, className, readonly, maxDisplay, maxCapacity, emptyMessage, showCount, pendingCount, }: AttachmentGridProps): react_jsx_runtime.JSX.Element | null;
1312
- declare const MemoizedAttachmentGrid: react__default.MemoExoticComponent<typeof AttachmentGrid>;
1313
-
1314
- interface ImageModalProps {
1315
- isOpen: boolean;
1316
- onClose: () => void;
1317
- attachment: ImageAttachment;
1318
- allAttachments?: ImageAttachment[];
1319
- currentIndex?: number;
1320
- onNavigate?: (direction: 'prev' | 'next') => void;
1321
- }
1322
- declare function ImageModal({ isOpen, onClose, attachment, allAttachments, currentIndex, onNavigate, }: ImageModalProps): react_jsx_runtime.JSX.Element;
1323
-
1324
- interface WelcomeContentProps {
1325
- onPromptSelect?: (prompt: string) => void;
1326
- title?: string;
1327
- description?: string;
1328
- disabled?: boolean;
1329
- /** Custom prompts to replace the default i18n prompts. Icons cycle from defaults if not provided. */
1330
- prompts?: Array<{
1331
- category: string;
1332
- text: string;
1333
- icon?: Icon;
1334
- }>;
1335
- }
1336
- declare function WelcomeContent({ onPromptSelect, title, description, disabled, prompts: customPrompts, }: WelcomeContentProps): react_jsx_runtime.JSX.Element;
1337
-
1338
- interface CodeOutputsPanelProps {
1339
- outputs: CodeOutput$1[];
1340
- }
1341
- declare function CodeOutputsPanel({ outputs }: CodeOutputsPanelProps): react_jsx_runtime.JSX.Element | null;
1342
-
1343
- /**
1344
- * StreamingCursor Component
1345
- * Animated cursor shown during AI response streaming
1346
- */
1347
- declare function StreamingCursor(): react_jsx_runtime.JSX.Element;
1348
-
1349
- /**
1350
- * ScrollToBottomButton Component
1351
- * Floating button to scroll chat to bottom, shown when user scrolls up
1352
- */
1353
- interface ScrollToBottomButtonProps {
1354
- show: boolean;
1355
- onClick: () => void;
1356
- unreadCount?: number;
1357
- disabled?: boolean;
1358
- /** When set, renders a pill-style button with this label (e.g. "New messages") */
1359
- label?: string;
1360
- }
1361
- declare function ScrollToBottomButton({ show, onClick, unreadCount, disabled, label, }: ScrollToBottomButtonProps): react_jsx_runtime.JSX.Element;
1362
-
1363
- interface CompactionDoodleProps {
1364
- title: string;
1365
- subtitle: string;
1366
- }
1367
- declare function CompactionDoodle({ title, subtitle }: CompactionDoodleProps): react_jsx_runtime.JSX.Element;
1368
-
1369
- interface EmptyStateProps {
1370
- /** Optional icon to display */
1371
- icon?: ReactNode;
1372
- /** Main title text */
1373
- title: string;
1374
- /** Optional description text */
1375
- description?: string;
1376
- /** Optional action element (button, link, etc.) */
1377
- action?: ReactNode;
1378
- /** Additional CSS classes */
1379
- className?: string;
1380
- /** Size variant */
1381
- size?: 'sm' | 'md' | 'lg';
1382
- }
1383
- declare function EmptyState({ icon, title, description, action, className, size, }: EmptyStateProps): react_jsx_runtime.JSX.Element;
1384
- declare const MemoizedEmptyState: react.MemoExoticComponent<typeof EmptyState>;
1385
-
1386
- /**
1387
- * EditableText Component
1388
- * Inline editable text with double-click to edit
1389
- * Features: auto-focus, auto-select, Enter to save, Escape to cancel
1390
- * Can be triggered programmatically via ref.startEditing()
1391
- */
1392
- interface EditableTextProps {
1393
- /** Current text value */
1394
- value: string;
1395
- /** Callback when text is saved */
1396
- onSave: (newValue: string) => void;
1397
- /** Maximum character length */
1398
- maxLength?: number;
1399
- /** Whether the component is in loading state */
1400
- isLoading?: boolean;
1401
- /** Placeholder text when empty */
1402
- placeholder?: string;
1403
- /** Additional CSS classes for the text display */
1404
- className?: string;
1405
- /** Additional CSS classes for the input */
1406
- inputClassName?: string;
1407
- /** Font size variant */
1408
- size?: 'sm' | 'md' | 'lg';
1409
- }
1410
- interface EditableTextRef {
1411
- /** Programmatically start editing mode */
1412
- startEditing: () => void;
1413
- /** Programmatically cancel editing */
1414
- cancelEditing: () => void;
1415
- }
1416
- declare const MemoizedEditableText: react.MemoExoticComponent<react.ForwardRefExoticComponent<EditableTextProps & react.RefAttributes<EditableTextRef>>>;
1417
-
1418
- /**
1419
- * SearchInput Component
1420
- * Reusable search input with icon, clear button, and keyboard shortcuts
1421
- */
1422
- interface SearchInputProps {
1423
- /** Current search value */
1424
- value: string;
1425
- /** Callback when value changes */
1426
- onChange: (value: string) => void;
1427
- /** Placeholder text */
1428
- placeholder?: string;
1429
- /** Auto-focus on mount */
1430
- autoFocus?: boolean;
1431
- /** Callback when Enter is pressed */
1432
- onSubmit?: (value: string) => void;
1433
- /** Callback when Escape is pressed */
1434
- onEscape?: () => void;
1435
- /** Additional CSS classes for the container */
1436
- className?: string;
1437
- /** Size variant */
1438
- size?: 'sm' | 'md' | 'lg';
1439
- /** Disable the input */
1440
- disabled?: boolean;
1441
- /** ARIA label for accessibility */
1442
- ariaLabel?: string;
1443
- }
1444
- declare function SearchInput({ value, onChange, placeholder, autoFocus, onSubmit, onEscape, className, size, disabled, ariaLabel, }: SearchInputProps): react_jsx_runtime.JSX.Element;
1445
- declare const MemoizedSearchInput: react.MemoExoticComponent<typeof SearchInput>;
1446
-
1447
- /**
1448
- * Skeleton Component
1449
- * Reusable loading skeleton with multiple variants
1450
- */
1451
- interface SkeletonProps {
1452
- /** Skeleton variant */
1453
- variant?: 'text' | 'circular' | 'rectangular' | 'rounded';
1454
- /** Width (CSS value or number for pixels) */
1455
- width?: string | number;
1456
- /** Height (CSS value or number for pixels) */
1457
- height?: string | number;
1458
- /** Additional CSS classes */
1459
- className?: string;
1460
- /** Enable animation */
1461
- animate?: boolean;
1462
- }
1463
- interface SkeletonGroupProps {
1464
- /** Number of skeleton items to render */
1465
- count?: number;
1466
- /** Gap between items */
1467
- gap?: 'sm' | 'md' | 'lg';
1468
- /** Additional CSS classes for the container */
1469
- className?: string;
1470
- /** Render function for each skeleton item */
1471
- children?: (index: number) => React.ReactNode;
1472
- }
1473
- declare function Skeleton({ variant, width, height, className, animate, }: SkeletonProps): react_jsx_runtime.JSX.Element;
1474
- /**
1475
- * SkeletonGroup - Renders multiple skeleton items
1476
- */
1477
- declare function SkeletonGroup({ count, gap, className, children, }: SkeletonGroupProps): react_jsx_runtime.JSX.Element;
1478
- /**
1479
- * SkeletonText - Text line skeleton with configurable width
1480
- */
1481
- declare function SkeletonText({ lines, className, }: {
1482
- lines?: number;
1483
- className?: string;
1484
- }): react_jsx_runtime.JSX.Element;
1485
- /**
1486
- * SkeletonAvatar - Circular avatar skeleton
1487
- */
1488
- declare function SkeletonAvatar({ size, className, }: {
1489
- size?: number;
1490
- className?: string;
1491
- }): react_jsx_runtime.JSX.Element;
1492
- /**
1493
- * SkeletonCard - Card-shaped skeleton
1494
- */
1495
- declare function SkeletonCard({ width, height, className, }: {
1496
- width?: string | number;
1497
- height?: string | number;
1498
- className?: string;
1499
- }): react_jsx_runtime.JSX.Element;
1500
- /**
1501
- * ListItemSkeleton - Common list item skeleton with icon and text
1502
- */
1503
- declare function ListItemSkeleton({ className }: {
1504
- className?: string;
1505
- }): react_jsx_runtime.JSX.Element;
1506
- declare const MemoizedSkeleton: react.MemoExoticComponent<typeof Skeleton>;
1507
-
1508
- /**
1509
- * CodeBlock Component
1510
- * Syntax highlighted code blocks with copy functionality and dark mode support
1511
- */
1512
- interface CodeBlockProps {
1513
- /** Programming language for syntax highlighting */
1514
- language: string;
1515
- /** Code content to display */
1516
- value: string;
1517
- /** Whether to render as inline code */
1518
- inline?: boolean;
1519
- /** Copy button label (defaults to "Copy") */
1520
- copyLabel?: string;
1521
- /** Copied confirmation label (defaults to "Copied!") */
1522
- copiedLabel?: string;
1523
- }
1524
- declare function CodeBlock({ language, value, inline, copyLabel, copiedLabel, }: CodeBlockProps): react_jsx_runtime.JSX.Element;
1525
- declare const MemoizedCodeBlock: react.MemoExoticComponent<typeof CodeBlock>;
1526
-
1527
- /**
1528
- * LoadingSpinner Component
1529
- * Displays animated loading indicators
1530
- */
1531
- type SpinnerVariant = 'spinner' | 'dots' | 'pulse';
1532
- interface LoadingSpinnerProps {
1533
- variant?: SpinnerVariant;
1534
- size?: 'sm' | 'md' | 'lg';
1535
- message?: string;
1536
- }
1537
- declare function LoadingSpinner({ variant, size, message }: LoadingSpinnerProps): react_jsx_runtime.JSX.Element;
1538
- declare const MemoizedLoadingSpinner: react.MemoExoticComponent<typeof LoadingSpinner>;
1539
-
1540
- /**
1541
- * TableExportButton Component
1542
- * Small inline button for exporting markdown tables to Excel
1543
- */
1544
- interface TableExportButtonProps {
1545
- /** Click handler for export action */
1546
- onClick: () => void;
1547
- /** Whether the button should be disabled */
1548
- disabled?: boolean;
1549
- /** Export button label (defaults to "Export") */
1550
- label?: string;
1551
- /** Disabled tooltip text */
1552
- disabledTooltip?: string;
1553
- }
1554
- declare const TableExportButton: react.NamedExoticComponent<TableExportButtonProps>;
1555
-
1556
- interface TableWithExportProps {
1557
- /** The table content to render */
1558
- children: ReactNode;
1559
- /** Function to send a message (from chat context) */
1560
- sendMessage?: (content: string) => void;
1561
- /** Whether sending is disabled (loading or streaming) */
1562
- disabled?: boolean;
1563
- /** Custom export message to send */
1564
- exportMessage?: string;
1565
- /** Export button label */
1566
- exportLabel?: string;
1567
- }
1568
- declare const TableWithExport: react.NamedExoticComponent<TableWithExportProps>;
1569
-
1570
- type ColumnType = 'string' | 'number' | 'boolean' | 'date' | 'url' | 'null';
1571
- interface FormattedCell {
1572
- display: string;
1573
- raw: unknown;
1574
- type: ColumnType;
1575
- isNull: boolean;
1576
- }
1577
-
1578
- interface ColumnMeta {
1579
- index: number;
1580
- name: string;
1581
- header: string;
1582
- type: ColumnType;
1583
- width: number | null;
1584
- visible: boolean;
1585
- }
1586
- interface SortState {
1587
- columnIndex: number;
1588
- direction: 'asc' | 'desc';
1589
- }
1590
- interface ColumnStats {
1591
- sum: number;
1592
- avg: number;
1593
- min: number;
1594
- max: number;
1595
- count: number;
1596
- nullCount: number;
1597
- }
1598
- interface DataTableOptions {
1599
- defaultPageSize?: number;
1600
- enableSearch?: boolean;
1601
- enableSort?: boolean;
1602
- enableResize?: boolean;
1603
- enableColumnVisibility?: boolean;
1604
- }
1605
- interface UseDataTableReturn {
1606
- columns: ColumnMeta[];
1607
- visibleColumns: ColumnMeta[];
1608
- page: number;
1609
- pageSize: number;
1610
- totalPages: number;
1611
- totalFilteredRows: number;
1612
- pageSizeOptions: number[];
1613
- pageRows: unknown[][];
1614
- setPage: (page: number) => void;
1615
- setPageSize: (size: number) => void;
1616
- sort: SortState | null;
1617
- toggleSort: (columnIndex: number) => void;
1618
- clearSort: () => void;
1619
- searchQuery: string;
1620
- setSearchQuery: (query: string) => void;
1621
- columnStats: Map<number, ColumnStats>;
1622
- toggleColumnVisibility: (columnIndex: number) => void;
1623
- resetColumnVisibility: () => void;
1624
- setColumnWidth: (columnIndex: number, width: number) => void;
1625
- formatCell: (value: unknown, columnIndex: number) => FormattedCell;
1626
- getCellAlignment: (columnIndex: number) => 'left' | 'right';
1627
- getTableAsTSV: () => string;
1628
- }
1629
- declare function useDataTable(table: RenderTableData, options?: DataTableOptions): UseDataTableReturn;
1630
-
1631
- /** External container control. When provided, the card runs in embedded mode. */
1632
- interface TableCardHost {
1633
- onToggleFullscreen: () => void;
1634
- isFullscreen: boolean;
1635
- }
1636
- interface InteractiveTableCardProps {
1637
- table: RenderTableData;
1638
- onSendMessage?: (content: string) => void;
1639
- sendDisabled?: boolean;
1640
- options?: DataTableOptions;
1641
- /** When provided, the card runs in embedded mode — strips outer chrome, hides header, delegates fullscreen to the host. */
1642
- host?: TableCardHost;
1643
- }
1644
- declare const InteractiveTableCard: react.NamedExoticComponent<InteractiveTableCardProps>;
1645
-
1646
- interface TabbedTableGroupProps {
1647
- tables: RenderTableData[];
1648
- onSendMessage?: (content: string) => void;
1649
- sendDisabled?: boolean;
1650
- }
1651
- declare const TabbedTableGroup: react.NamedExoticComponent<TabbedTableGroupProps>;
1652
-
1653
- interface TabbedChartGroupProps {
1654
- charts: ChartData[];
1655
- }
1656
- declare const TabbedChartGroup: react.NamedExoticComponent<TabbedChartGroupProps>;
1657
-
1658
- /**
1659
- * useToast Hook
1660
- * Manages toast notification state
1661
- */
1662
- type ToastType = 'success' | 'error' | 'info' | 'warning';
1663
- interface ToastAction {
1664
- label: string;
1665
- onClick: () => void;
1666
- }
1667
- interface ToastItem {
1668
- id: string;
1669
- type: ToastType;
1670
- message: string;
1671
- duration?: number;
1672
- action?: ToastAction;
1673
- }
1674
- interface UseToastReturn {
1675
- toasts: ToastItem[];
1676
- success: (msg: string, duration?: number, action?: ToastAction) => void;
1677
- error: (msg: string, duration?: number, action?: ToastAction) => void;
1678
- info: (msg: string, duration?: number, action?: ToastAction) => void;
1679
- warning: (msg: string, duration?: number, action?: ToastAction) => void;
1680
- dismiss: (id: string) => void;
1681
- dismissAll: () => void;
1682
- }
1683
- /**
1684
- * Hook for managing toast notifications
1685
- *
1686
- * @example
1687
- * ```tsx
1688
- * const { toasts, success, error, dismiss } = useToast()
1689
- *
1690
- * // Show a success toast
1691
- * success('Operation completed!')
1692
- *
1693
- * // Show an error toast with custom duration
1694
- * error('Something went wrong', 10000)
1695
- *
1696
- * // Render toasts
1697
- * <ToastContainer toasts={toasts} onDismiss={dismiss} />
1698
- * ```
1699
- */
1700
- declare function useToast(): UseToastReturn;
1701
-
1702
- interface ToastProps {
1703
- id: string;
1704
- type: ToastType;
1705
- message: string;
1706
- duration?: number;
1707
- onDismiss: (id: string) => void;
1708
- /** Label for dismiss button (defaults to "Dismiss") */
1709
- dismissLabel?: string;
1710
- /** Optional action button rendered in the toast */
1711
- action?: ToastAction;
1712
- }
1713
- declare function Toast({ id, type, message, duration, onDismiss, dismissLabel, action, }: ToastProps): react_jsx_runtime.JSX.Element;
1714
-
1715
- interface ToastContainerProps {
1716
- toasts: ToastItem[];
1717
- onDismiss: (id: string) => void;
1718
- /** Label for dismiss buttons */
1719
- dismissLabel?: string;
1720
- }
1721
- declare function ToastContainer({ toasts, onDismiss, dismissLabel }: ToastContainerProps): react_jsx_runtime.JSX.Element | null;
1722
-
1723
- /**
1724
- * ConfirmModal Component
1725
- * Polished confirmation dialog with contextual icon, refined typography,
1726
- * and smooth micro-interactions.
1727
- * Uses @headlessui/react Dialog for accessible modal behavior.
1728
- */
1729
- interface ConfirmModalProps {
1730
- /** Whether the modal is open */
1731
- isOpen: boolean;
1732
- /** Modal title */
1733
- title: string;
1734
- /** Modal message/description */
1735
- message: string;
1736
- /** Callback when user confirms */
1737
- onConfirm: () => void;
1738
- /** Callback when user cancels */
1739
- onCancel: () => void;
1740
- /** Confirm button text (defaults to "Confirm") */
1741
- confirmText?: string;
1742
- /** Cancel button text (defaults to "Cancel") */
1743
- cancelText?: string;
1744
- /** Whether this is a danger/destructive action (red confirm button) */
1745
- isDanger?: boolean;
1746
- }
1747
- declare function ConfirmModalBase({ isOpen, title, message, onConfirm, onCancel, confirmText, cancelText, isDanger, }: ConfirmModalProps): react_jsx_runtime.JSX.Element;
1748
- declare const ConfirmModal: react.MemoExoticComponent<typeof ConfirmModalBase>;
1749
-
1750
- /**
1751
- * UserAvatar Component
1752
- * Displays user initials with deterministic color from a color palette
1753
- */
1754
- interface UserAvatarProps {
1755
- /** User's first name */
1756
- firstName: string;
1757
- /** User's last name */
1758
- lastName: string;
1759
- /** Override initials (defaults to first letters of first and last name) */
1760
- initials?: string;
1761
- /** Avatar size */
1762
- size?: 'xs' | 'sm' | 'md' | 'lg';
1763
- /** Additional CSS classes */
1764
- className?: string;
1765
- }
1766
- declare function UserAvatar({ firstName, lastName, initials: providedInitials, size, className, }: UserAvatarProps): react_jsx_runtime.JSX.Element;
1767
- declare const MemoizedUserAvatar: react.MemoExoticComponent<typeof UserAvatar>;
1768
-
1769
- /**
1770
- * AvatarStack Component
1771
- * Displays overlapping user avatars with an overflow "+N" indicator.
1772
- * Used in ChatHeader and SessionItem for group chat visualization.
1773
- */
1774
- interface AvatarStackProps {
1775
- /** List of users to display */
1776
- users: Array<{
1777
- firstName: string;
1778
- lastName: string;
1779
- initials?: string;
1780
- }>;
1781
- /** Maximum avatars to show before "+N" (default: 3) */
1782
- max?: number;
1783
- /** Avatar size */
1784
- size?: 'xs' | 'sm';
1785
- /** Click handler — makes the stack interactive */
1786
- onClick?: () => void;
1787
- /** Additional CSS classes */
1788
- className?: string;
1789
- }
1790
- declare function AvatarStackInner({ users, max, size, onClick, className, }: AvatarStackProps): react_jsx_runtime.JSX.Element;
1791
- declare const AvatarStack: react.MemoExoticComponent<typeof AvatarStackInner>;
1792
-
1793
- interface SessionMembersModalProps {
1794
- isOpen: boolean;
1795
- sessionId?: string;
1796
- dataSource: ChatDataSource;
1797
- onClose: () => void;
1798
- }
1799
- declare function SessionMembersModal({ isOpen, sessionId, dataSource, onClose }: SessionMembersModalProps): react_jsx_runtime.JSX.Element;
1800
-
1801
- interface PermissionGuardProps {
1802
- /** Permission names to check */
1803
- permissions: string[];
1804
- /** Check mode: 'all' requires all permissions (AND), 'any' requires at least one (OR) */
1805
- mode?: 'all' | 'any';
1806
- /** Function to check if user has a specific permission */
1807
- hasPermission: (permission: string) => boolean;
1808
- /** Fallback to render when permissions are not satisfied */
1809
- fallback?: ReactNode;
1810
- /** Children to render when permissions are satisfied */
1811
- children: ReactNode;
1812
- }
1813
- /**
1814
- * Permission guard component.
1815
- * Conditionally renders children based on permission checks.
1816
- */
1817
- declare function PermissionGuard({ permissions, mode, hasPermission, fallback, children, }: PermissionGuardProps): react_jsx_runtime.JSX.Element;
1818
-
1819
- interface ErrorBoundaryProps {
1820
- children: ReactNode;
1821
- /** Optional custom error UI */
1822
- fallback?: ReactNode | ((error: Error | null, reset: () => void) => ReactNode);
1823
- /** Callback when an error is caught */
1824
- onError?: (error: Error, errorInfo: ErrorInfo) => void;
1825
- /** Pre-translated strings for the emergency fallback (hook-free). Cache these before errors occur. */
1826
- emergencyStrings?: {
1827
- title: string;
1828
- fallback: string;
1829
- retry: string;
1830
- };
1831
- }
1832
- interface ErrorBoundaryState {
1833
- hasError: boolean;
1834
- error: Error | null;
1835
- }
1836
- /**
1837
- * Default error UI component
1838
- */
1839
- declare function DefaultErrorContent({ error, onReset, resetLabel, errorTitle, }: {
1840
- error: Error | null;
1841
- onReset?: () => void;
1842
- resetLabel?: string;
1843
- errorTitle?: string;
1844
- }): react_jsx_runtime.JSX.Element;
1845
- declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
1846
- constructor(props: ErrorBoundaryProps);
1847
- static getDerivedStateFromError(error: Error): ErrorBoundaryState;
1848
- componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
1849
- handleReset: () => void;
1850
- handleFallbackError: (error: Error, errorInfo: ErrorInfo) => void;
1851
- render(): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
1852
- }
1853
-
1854
- /**
1855
- * TypingIndicator Component
1856
- * Displays rotating verbs with shimmer animation to show AI is thinking/processing.
1857
- * Verbs are configurable via props. When not provided, defaults are pulled from translations.
1858
- */
1859
- interface TypingIndicatorProps {
1860
- /** Custom thinking verbs to rotate through */
1861
- verbs?: string[];
1862
- /** Verb rotation interval in ms (defaults to 3000) */
1863
- rotationInterval?: number;
1864
- /** Additional CSS classes */
1865
- className?: string;
1866
- }
1867
- declare function TypingIndicator({ verbs: verbsProp, rotationInterval, className, }: TypingIndicatorProps): react_jsx_runtime.JSX.Element;
1868
- declare const MemoizedTypingIndicator: react.MemoExoticComponent<typeof TypingIndicator>;
1869
-
1870
- interface ActivityTraceProps {
1871
- thinkingContent: string;
1872
- activeSteps: ActivityStep[];
1873
- /** Consumer tool label prefix (e.g. 'Ali.Tools') for custom tool translations. */
1874
- toolLabelPrefix?: string;
1875
- className?: string;
1876
- }
1877
- declare function ActivityTraceInner({ thinkingContent, activeSteps, toolLabelPrefix, className, }: ActivityTraceProps): react_jsx_runtime.JSX.Element | null;
1878
- declare const ActivityTrace: react.MemoExoticComponent<typeof ActivityTraceInner>;
1879
-
1880
- type ActiveTab = 'my-chats' | 'all-chats';
1881
- interface SidebarProps {
1882
- dataSource: ChatDataSource;
1883
- onSessionSelect: (sessionId: string) => void;
1884
- onNewChat: () => void;
1885
- onArchivedView?: () => void;
1886
- activeSessionId?: string;
1887
- creating?: boolean;
1888
- showAllChatsTab?: boolean;
1889
- isOpen?: boolean;
1890
- onClose?: () => void;
1891
- headerSlot?: react__default.ReactNode;
1892
- footerSlot?: react__default.ReactNode;
1893
- className?: string;
1894
- /** Controlled active tab. When provided, overrides internal state. */
1895
- activeTab?: ActiveTab;
1896
- /** Called when tab changes. Use with activeTab for controlled mode. */
1897
- onTabChange?: (tab: ActiveTab) => void;
1898
- }
1899
- declare function Sidebar({ dataSource, onSessionSelect, onNewChat, onArchivedView, activeSessionId, creating, showAllChatsTab, isOpen: _isOpen, onClose, headerSlot, footerSlot, className, activeTab: controlledActiveTab, onTabChange, }: SidebarProps): react_jsx_runtime.JSX.Element;
1900
-
1901
- /**
1902
- * SessionItem Component
1903
- * Individual chat session item in the sidebar with actions menu
1904
- * Router-agnostic: uses onSelect callback instead of Link
1905
- */
1906
-
1907
- interface SessionItemProps {
1908
- session: Session$1;
1909
- isActive: boolean;
1910
- mode?: 'active' | 'archived';
1911
- onSelect: (sessionId: string) => void;
1912
- onArchive?: () => void;
1913
- onRestore?: () => void;
1914
- onPin?: () => void;
1915
- onRename?: (newTitle: string) => void;
1916
- onRegenerateTitle?: () => void;
1917
- onDelete?: () => void;
1918
- testIdPrefix?: string;
1919
- className?: string;
1920
- }
1921
- declare const SessionItem: react__default.NamedExoticComponent<SessionItemProps>;
1922
-
1923
- interface ArchivedChatListProps {
1924
- dataSource: ChatDataSource;
1925
- onBack: () => void;
1926
- onSessionSelect: (sessionId: string) => void;
1927
- activeSessionId?: string;
1928
- className?: string;
1929
- toast?: UseToastReturn;
1930
- }
1931
- declare function ArchivedChatList({ dataSource, onBack, onSessionSelect, activeSessionId, className, toast: toastFromProps, }: ArchivedChatListProps): react_jsx_runtime.JSX.Element;
1932
-
1933
- interface AllChatsListProps {
1934
- dataSource: ChatDataSource;
1935
- onSessionSelect: (sessionId: string) => void;
1936
- activeSessionId?: string;
1937
- }
1938
- declare function AllChatsList({ dataSource, onSessionSelect, activeSessionId }: AllChatsListProps): react_jsx_runtime.JSX.Element;
1939
-
1940
- interface UserFilterProps {
1941
- users: SessionUser$1[];
1942
- selectedUser: SessionUser$1 | null;
1943
- onUserChange: (user: SessionUser$1 | null) => void;
1944
- loading?: boolean;
1945
- }
1946
- declare function UserFilter({ users, selectedUser, onUserChange, loading }: UserFilterProps): react_jsx_runtime.JSX.Element;
1947
- declare const MemoizedUserFilter: react.MemoExoticComponent<typeof UserFilter>;
1948
-
1949
- interface DateGroupHeaderProps {
1950
- groupName: string;
1951
- count: number;
1952
- }
1953
- /**
1954
- * Sticky header for date-based session groups
1955
- * Displays group name and session count
1956
- */
1957
- declare function DateGroupHeader({ groupName, count }: DateGroupHeaderProps): react_jsx_runtime.JSX.Element;
1958
-
1959
- interface SessionSkeletonProps {
1960
- count?: number;
1961
- }
1962
- declare function SessionSkeleton({ count }: SessionSkeletonProps): react_jsx_runtime.JSX.Element;
1963
-
1964
- /**
1965
- * useSidebarState — mobile breakpoint detection + drawer open/close state.
1966
- * SSR-safe. Auto-closes drawer when resizing to desktop.
1967
- */
1968
- interface UseSidebarStateReturn {
1969
- isMobile: boolean;
1970
- isMobileOpen: boolean;
1971
- openMobile: () => void;
1972
- closeMobile: () => void;
1973
- toggleMobile: () => void;
1974
- }
1975
- declare function useSidebarState(): UseSidebarStateReturn;
1976
-
1977
- interface SidebarDrawerProps {
1978
- onClose?: () => void;
1979
- }
1980
- interface BiChatLayoutProps {
1981
- /** Render function for the sidebar. Receives `{ onClose }` when in mobile drawer mode. */
1982
- renderSidebar: (props: SidebarDrawerProps) => react__default.ReactNode;
1983
- /** Main page content */
1984
- children: react__default.ReactNode;
1985
- /** Callback for Cmd+N keyboard shortcut */
1986
- onNewChat?: () => void;
1987
- /** Key for AnimatePresence page transitions (e.g. location.pathname). Omit to disable transitions. */
1988
- routeKey?: string;
1989
- /** Custom class for the root container */
1990
- className?: string;
1991
- }
1992
- declare function BiChatLayout({ renderSidebar, children, onNewChat, routeKey, className, }: BiChatLayoutProps): react_jsx_runtime.JSX.Element;
1993
-
1994
- interface SystemMessageProps {
1995
- content: string;
1996
- createdAt: string;
1997
- onCopy?: (content: string) => Promise<void> | void;
1998
- hideActions?: boolean;
1999
- hideTimestamp?: boolean;
2000
- }
2001
- declare function SystemMessage({ content, createdAt, onCopy, hideActions, hideTimestamp, }: SystemMessageProps): react_jsx_runtime.JSX.Element;
2002
-
2003
- interface DebugPanelProps {
2004
- trace?: DebugTrace$1;
2005
- }
2006
- declare function DebugPanel({ trace }: DebugPanelProps): react_jsx_runtime.JSX.Element;
2007
-
2008
- /**
2009
- * Alert Component
2010
- * Standardized error/success/warning/info messages with retry capability
2011
- */
2012
- type AlertVariant = 'error' | 'success' | 'warning' | 'info';
2013
- interface AlertProps {
2014
- variant?: AlertVariant;
2015
- message: string;
2016
- title?: string;
2017
- onDismiss?: () => void;
2018
- onRetry?: () => void;
2019
- show?: boolean;
2020
- dismissible?: boolean;
2021
- }
2022
- declare function Alert({ variant, message, title, onDismiss, onRetry, show, dismissible, }: AlertProps): react_jsx_runtime.JSX.Element;
2023
- declare const _default$1: react.MemoExoticComponent<typeof Alert>;
2024
-
2025
- /**
2026
- * Archive Banner Component
2027
- * Displays when a chat session is archived and provides a restore button
2028
- */
2029
- interface ArchiveBannerProps {
2030
- show?: boolean;
2031
- onRestore?: () => Promise<void>;
2032
- restoring?: boolean;
2033
- onRestoreComplete?: () => void;
2034
- }
2035
- declare function ArchiveBanner({ show, onRestore, restoring, onRestoreComplete, }: ArchiveBannerProps): react_jsx_runtime.JSX.Element;
2036
- declare const _default: react.MemoExoticComponent<typeof ArchiveBanner>;
2037
-
2038
- /**
2039
- * RetryActionArea Component
2040
- * Displays a retry action area inline where the assistant message would appear
2041
- * (typically after an interrupted request or connection loss)
2042
- *
2043
- * Styled to match assistant message positioning (left-aligned) so users see
2044
- * the retry button contextually in the conversation flow.
2045
- */
2046
- interface RetryActionAreaProps {
2047
- /** Callback when retry button is clicked */
2048
- onRetry: () => void;
2049
- }
2050
- declare const RetryActionArea: react.NamedExoticComponent<RetryActionAreaProps>;
2051
-
2052
- /**
2053
- * StreamError Component
2054
- * Error recovery UI for streaming failures
2055
- */
2056
- interface StreamErrorProps {
2057
- /** Error message to display */
2058
- error: string;
2059
- /** Callback to retry the failed operation */
2060
- onRetry?: () => void;
2061
- /** Callback to regenerate the message */
2062
- onRegenerate?: () => void;
2063
- /** Callback to dismiss the error */
2064
- onDismiss?: () => void;
2065
- /** Whether to show compact mode (less padding) */
2066
- compact?: boolean;
2067
- }
2068
- declare function StreamError({ error, onRetry, onRegenerate, onDismiss, compact, }: StreamErrorProps): react_jsx_runtime.JSX.Element;
2069
-
2070
- interface ActionableMessage {
2071
- id: string;
2072
- role: MessageRole;
2073
- content: string;
2074
- }
2075
- interface MessageActionsProps {
2076
- message: ActionableMessage;
2077
- onCopy: (text: string) => Promise<void>;
2078
- onRegenerate?: (messageId: string) => Promise<void>;
2079
- onEdit?: (message: ActionableMessage) => void;
2080
- }
2081
- declare function MessageActions({ message, onCopy, onRegenerate, onEdit, }: MessageActionsProps): react_jsx_runtime.JSX.Element;
2082
-
2083
- interface AttachmentPreviewProps {
2084
- /** The attachment to display */
2085
- attachment: ImageAttachment;
2086
- /** Optional callback when remove button is clicked */
2087
- onRemove?: () => void;
2088
- /** Optional callback when thumbnail is clicked (for enlargement) */
2089
- onClick?: () => void;
2090
- /** If true, hide remove button and disable click interactions */
2091
- readonly?: boolean;
2092
- }
2093
- declare const AttachmentPreview: react.NamedExoticComponent<AttachmentPreviewProps>;
2094
-
2095
- interface AttachmentUploadProps {
2096
- /** Callback fired when files are successfully converted and validated */
2097
- onAttachmentsSelected: (attachments: Attachment$1[]) => void;
2098
- /** Maximum number of attachments allowed (default: 10) */
2099
- maxAttachments?: number;
2100
- /** Maximum file size in bytes (default: 20 MB) */
2101
- maxSizeBytes?: number;
2102
- /** Whether the component is disabled */
2103
- disabled?: boolean;
2104
- }
2105
- declare const AttachmentUpload: react.NamedExoticComponent<AttachmentUploadProps>;
2106
-
2107
- interface ScreenReaderAnnouncerProps {
2108
- message: string;
2109
- politeness?: 'polite' | 'assertive';
2110
- clearAfter?: number;
2111
- }
2112
- /**
2113
- * Screen reader announcer component for live region updates
2114
- * Uses ARIA live regions to announce dynamic content changes
2115
- *
2116
- * @param message - The message to announce
2117
- * @param politeness - 'polite' (wait for pause) or 'assertive' (immediate)
2118
- * @param clearAfter - Optional milliseconds to clear message after announcement
2119
- *
2120
- * @example
2121
- * <ScreenReaderAnnouncer
2122
- * message="New message received"
2123
- * politeness="polite"
2124
- * />
2125
- */
2126
- declare function ScreenReaderAnnouncer({ message, politeness, clearAfter, }: ScreenReaderAnnouncerProps): react_jsx_runtime.JSX.Element;
2127
-
2128
- /**
2129
- * Skip to main content link for keyboard navigation
2130
- * Hidden by default, visible on keyboard focus
2131
- * Allows users to skip navigation and go directly to main content
2132
- */
2133
- declare function SkipLink(): react_jsx_runtime.JSX.Element;
2134
-
2135
- interface ContextMenuItem {
2136
- id: string;
2137
- label: string;
2138
- icon?: ReactNode;
2139
- onClick: () => void;
2140
- variant?: 'default' | 'danger';
2141
- disabled?: boolean;
2142
- }
2143
- interface TouchContextMenuProps {
2144
- items: ContextMenuItem[];
2145
- isOpen: boolean;
2146
- onClose: () => void;
2147
- anchorRect: DOMRect | null;
2148
- }
2149
- declare const TouchContextMenu: FC<TouchContextMenuProps>;
2150
-
2151
- interface QuestionFormProps {
2152
- pendingQuestion: PendingQuestion$1;
2153
- sessionId: string;
2154
- onSubmit: (answers: QuestionAnswers) => Promise<void>;
2155
- onCancel: () => void;
2156
- }
2157
- declare function QuestionForm({ pendingQuestion, onSubmit, onCancel, }: QuestionFormProps): react_jsx_runtime.JSX.Element;
2158
-
2159
- interface QuestionStepProps {
2160
- question: Question;
2161
- selectedAnswers: QuestionAnswers;
2162
- onAnswer: (answerData: QuestionAnswerData) => void;
2163
- }
2164
- declare function QuestionStep({ question, selectedAnswers, onAnswer, }: QuestionStepProps): react_jsx_runtime.JSX.Element;
2165
-
2166
- interface ConfirmationStepProps {
2167
- questions: Question[];
2168
- answers: QuestionAnswers;
2169
- }
2170
- declare function ConfirmationStep({ questions, answers, }: ConfirmationStepProps): react_jsx_runtime.JSX.Element;
2171
-
2172
- interface SlotProps extends HTMLAttributes<HTMLElement> {
2173
- children?: ReactNode;
2174
- }
2175
- /**
2176
- * Slot component that merges its props with its child element's props
2177
- * Used for the asChild pattern to allow consumers to customize the rendered element
2178
- */
2179
- declare const Slot: react.ForwardRefExoticComponent<SlotProps & react.RefAttributes<HTMLElement>>;
2180
- /**
2181
- * Helper type for components that support asChild
2182
- * Extends the HTML attributes while adding asChild option
2183
- */
2184
- type AsChildProps<T extends HTMLAttributes<HTMLElement> = HTMLAttributes<HTMLElement>> = T & {
2185
- /** Merge props with child element instead of rendering wrapper */
2186
- asChild?: boolean;
2187
- };
2188
- /**
2189
- * Get children count (flattens fragments)
2190
- */
2191
- declare function getValidChildren(children: ReactNode): ReactElement[];
2192
-
2193
- interface TurnContextValue {
2194
- /** Turn identifier */
2195
- turnId?: string;
2196
- }
2197
- declare function useTurnContext(): TurnContextValue;
2198
- type TurnRootProps = AsChildProps<HTMLAttributes<HTMLDivElement>> & {
2199
- /** Turn identifier for tracking */
2200
- turnId?: string;
2201
- };
2202
- type TurnUserProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
2203
- type TurnAssistantProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
2204
- type TurnTimestampProps = AsChildProps<HTMLAttributes<HTMLTimeElement>> & {
2205
- /** ISO date string or Date object */
2206
- date?: string | Date;
2207
- /** Custom formatter */
2208
- formatter?: (date: Date) => string;
2209
- };
2210
- type TurnActionsProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
2211
- declare const Turn: {
2212
- Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2213
- asChild?: boolean;
2214
- } & {
2215
- /** Turn identifier for tracking */
2216
- turnId?: string;
2217
- } & react.RefAttributes<HTMLDivElement>>;
2218
- User: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2219
- asChild?: boolean;
2220
- } & react.RefAttributes<HTMLDivElement>>;
2221
- Assistant: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2222
- asChild?: boolean;
2223
- } & react.RefAttributes<HTMLDivElement>>;
2224
- Timestamp: react.ForwardRefExoticComponent<HTMLAttributes<HTMLTimeElement> & {
2225
- asChild?: boolean;
2226
- } & {
2227
- /** ISO date string or Date object */
2228
- date?: string | Date;
2229
- /** Custom formatter */
2230
- formatter?: (date: Date) => string;
2231
- } & react.RefAttributes<HTMLTimeElement>>;
2232
- Actions: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2233
- asChild?: boolean;
2234
- } & react.RefAttributes<HTMLDivElement>>;
2235
- };
2236
-
2237
- type ImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';
2238
- interface AvatarContextValue {
2239
- imageLoadingStatus: ImageLoadingStatus;
2240
- setImageLoadingStatus: (status: ImageLoadingStatus) => void;
2241
- }
2242
- declare function useAvatarContext(): AvatarContextValue;
2243
- type AvatarRootProps = AsChildProps<HTMLAttributes<HTMLSpanElement>>;
2244
- type AvatarImageProps = AsChildProps<ImgHTMLAttributes<HTMLImageElement>> & {
2245
- /** Called when loading status changes */
2246
- onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
2247
- };
2248
- type AvatarFallbackProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
2249
- /** Delay before showing fallback (in ms) */
2250
- delayMs?: number;
2251
- };
2252
- declare const Avatar: {
2253
- Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
2254
- asChild?: boolean;
2255
- } & react.RefAttributes<HTMLSpanElement>>;
2256
- Image: react.ForwardRefExoticComponent<ImgHTMLAttributes<HTMLImageElement> & {
2257
- asChild?: boolean;
2258
- } & {
2259
- /** Called when loading status changes */
2260
- onLoadingStatusChange?: (status: ImageLoadingStatus) => void;
2261
- } & react.RefAttributes<HTMLImageElement>>;
2262
- Fallback: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
2263
- asChild?: boolean;
2264
- } & {
2265
- /** Delay before showing fallback (in ms) */
2266
- delayMs?: number;
2267
- } & react.RefAttributes<HTMLSpanElement>>;
2268
- };
2269
-
2270
- type BubbleVariant = 'user' | 'assistant' | 'system';
2271
- interface BubbleContextValue {
2272
- variant?: BubbleVariant;
2273
- }
2274
- declare function useBubbleContext(): BubbleContextValue;
2275
- type BubbleRootProps = AsChildProps<HTMLAttributes<HTMLDivElement>> & {
2276
- /** Bubble variant (affects data attribute for styling) */
2277
- variant?: BubbleVariant;
2278
- };
2279
- type BubbleContentProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
2280
- type BubbleHeaderProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
2281
- type BubbleFooterProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
2282
- type BubbleMetadataProps = AsChildProps<HTMLAttributes<HTMLDivElement>>;
2283
- declare const Bubble: {
2284
- Root: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2285
- asChild?: boolean;
2286
- } & {
2287
- /** Bubble variant (affects data attribute for styling) */
2288
- variant?: BubbleVariant;
2289
- } & react.RefAttributes<HTMLDivElement>>;
2290
- Content: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2291
- asChild?: boolean;
2292
- } & react.RefAttributes<HTMLDivElement>>;
2293
- Header: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2294
- asChild?: boolean;
2295
- } & react.RefAttributes<HTMLDivElement>>;
2296
- Footer: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2297
- asChild?: boolean;
2298
- } & react.RefAttributes<HTMLDivElement>>;
2299
- Metadata: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
2300
- asChild?: boolean;
2301
- } & react.RefAttributes<HTMLDivElement>>;
2302
- };
2303
-
2304
- interface ActionButtonContextValue {
2305
- isHovered: boolean;
2306
- isFocused: boolean;
2307
- isPressed: boolean;
2308
- isDisabled: boolean;
2309
- }
2310
- declare function useActionButtonContext(): ActionButtonContextValue;
2311
- type ActionButtonRootProps = AsChildProps<ButtonHTMLAttributes<HTMLButtonElement>>;
2312
- type ActionButtonIconProps = AsChildProps<HTMLAttributes<HTMLSpanElement>>;
2313
- type ActionButtonLabelProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
2314
- /** Visually hidden but accessible to screen readers */
2315
- srOnly?: boolean;
2316
- };
2317
- type ActionButtonTooltipProps = AsChildProps<HTMLAttributes<HTMLSpanElement>> & {
2318
- /** Position relative to button */
2319
- position?: 'top' | 'bottom' | 'left' | 'right';
2320
- /** Only show when hovered */
2321
- showOnHover?: boolean;
2322
- };
2323
- declare const ActionButton: {
2324
- Root: react.ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & {
2325
- asChild?: boolean;
2326
- } & react.RefAttributes<HTMLButtonElement>>;
2327
- Icon: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
2328
- asChild?: boolean;
2329
- } & react.RefAttributes<HTMLSpanElement>>;
2330
- Label: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
2331
- asChild?: boolean;
2332
- } & {
2333
- /** Visually hidden but accessible to screen readers */
2334
- srOnly?: boolean;
2335
- } & react.RefAttributes<HTMLSpanElement>>;
2336
- Tooltip: react.ForwardRefExoticComponent<HTMLAttributes<HTMLSpanElement> & {
2337
- asChild?: boolean;
2338
- } & {
2339
- /** Position relative to button */
2340
- position?: "top" | "bottom" | "left" | "right";
2341
- /** Only show when hovered */
2342
- showOnHover?: boolean;
2343
- } & react.RefAttributes<HTMLSpanElement>>;
2344
- };
2345
-
2346
- /**
2347
- * useStreaming hook
2348
- * BiChat-specific streaming hook that composes on top of applet-core's useStreaming.
2349
- * Adds content accumulation, error state, and chunk type dispatch.
2350
- */
2351
-
2352
- interface UseStreamingOptions {
2353
- onChunk?: (content: string) => void;
2354
- onError?: (error: string) => void;
2355
- onDone?: () => void;
2356
- }
2357
- declare function useStreaming(options?: UseStreamingOptions): {
2358
- content: string;
2359
- isStreaming: boolean;
2360
- error: Error | null;
2361
- processStream: (stream: AsyncGenerator<StreamChunk>, signal?: AbortSignal) => Promise<void>;
2362
- cancel: () => void;
2363
- reset: () => void;
2364
- };
2365
-
2366
- /**
2367
- * useActiveRuns — live map of per-session generation status.
2368
- *
2369
- * Subscribes to the data source's `subscribeActiveRuns` channel
2370
- * (`GET /bi-chat/stream/active-runs`) and maintains a
2371
- * sessionId → status dictionary so the sidebar can render a status
2372
- * dot next to each session card without polling /stream/status per
2373
- * session.
2374
- *
2375
- * The hook is a no-op when:
2376
- * - the data source does not implement subscribeActiveRuns (older
2377
- * backends without the active-run index);
2378
- * - `enabled` is false (e.g. the user is offline).
2379
- */
2380
-
2381
- interface ActiveRunSnapshot {
2382
- runId: string;
2383
- status: ActiveRunDelivery['status'];
2384
- updatedAt: number;
2385
- }
2386
- interface UseActiveRunsOptions {
2387
- enabled?: boolean;
2388
- /** Optional hook for raw SSE errors. */
2389
- onError?: (event: Event) => void;
2390
- /**
2391
- * Keep terminal-status entries in the map for this many milliseconds
2392
- * before pruning them. Default 0 preserves the previous behaviour
2393
- * (synchronous delete). Useful when consumers want to render a
2394
- * "completed" pulse animation before the dot disappears.
2395
- */
2396
- retainTerminalMs?: number;
2397
- /**
2398
- * How long to wait for an initial snapshot batch before declaring
2399
- * the hook `ready` when the server has zero active runs.
2400
- * Default 250ms.
2401
- */
2402
- emptyStateTimeoutMs?: number;
2403
- }
2404
- interface UseActiveRunsResult {
2405
- /** sessionId → current live status. Terminal statuses are emitted then the entry is removed. */
2406
- runs: Record<string, ActiveRunSnapshot>;
2407
- /** True once the initial HGETALL snapshot is delivered. */
2408
- ready: boolean;
2409
- /** Convenience: undefined when not active. */
2410
- status: (sessionId: string) => ActiveRunDelivery['status'] | undefined;
2411
- }
2412
- declare function useActiveRuns(dataSource: Pick<ChatDataSource, 'subscribeActiveRuns'>, options?: UseActiveRunsOptions): UseActiveRunsResult;
2413
-
2414
- /**
2415
- * Translation hook using locale from IotaContext
2416
- */
2417
- declare function useTranslation(): {
2418
- t: (key: string, params?: Record<string, string | number | boolean>) => string;
2419
- locale: string;
2420
- };
2421
-
2422
- declare function useModalLock(isOpen: boolean): void;
2423
-
2424
- /**
2425
- * Hook to trap focus within a container (for modals, sidebars)
2426
- * Ensures Tab and Shift+Tab cycle through focusable elements only
2427
- *
2428
- * @param containerRef - React ref to the container element
2429
- * @param isActive - Whether the focus trap is currently active
2430
- * @param restoreFocusOnDeactivate - Element to restore focus to when deactivated
2431
- *
2432
- * @example
2433
- * const modalRef = useRef<HTMLDivElement>(null)
2434
- * useFocusTrap(modalRef, isOpen)
2435
- */
2436
- declare function useFocusTrap(containerRef: RefObject<HTMLElement | null>, isActive: boolean, restoreFocusOnDeactivate?: HTMLElement | null): void;
2437
-
2438
- /**
2439
- * useImageGallery Hook
2440
- * Manages image modal/gallery state and navigation
2441
- */
2442
-
2443
- interface UseImageGalleryOptions {
2444
- /** Initial images to display */
2445
- images?: ImageAttachment[];
2446
- /** Wrap navigation at boundaries (default: false) */
2447
- wrap?: boolean;
2448
- /** Callback when modal opens */
2449
- onOpen?: (index: number) => void;
2450
- /** Callback when modal closes */
2451
- onClose?: () => void;
2452
- /** Callback when navigation occurs */
2453
- onNavigate?: (index: number, direction: 'prev' | 'next') => void;
2454
- }
2455
- interface UseImageGalleryReturn {
2456
- /** Whether the gallery modal is open */
2457
- isOpen: boolean;
2458
- /** Current image index */
2459
- currentIndex: number;
2460
- /** Current image (or undefined if none) */
2461
- currentImage: ImageAttachment | undefined;
2462
- /** All images in the gallery */
2463
- images: ImageAttachment[];
2464
- /** Whether there's a previous image */
2465
- hasPrev: boolean;
2466
- /** Whether there's a next image */
2467
- hasNext: boolean;
2468
- /** Open gallery at specific index */
2469
- open: (index: number, newImages?: ImageAttachment[]) => void;
2470
- /** Close the gallery */
2471
- close: () => void;
2472
- /** Navigate to previous image */
2473
- prev: () => void;
2474
- /** Navigate to next image */
2475
- next: () => void;
2476
- /** Navigate to specific index */
2477
- goTo: (index: number) => void;
2478
- /** Set images without opening */
2479
- setImages: (images: ImageAttachment[]) => void;
2480
- }
2481
- /**
2482
- * Hook for managing image gallery/modal state
2483
- *
2484
- * @example
2485
- * ```tsx
2486
- * const gallery = useImageGallery({ images: attachments })
2487
- *
2488
- * // Open gallery
2489
- * <button onClick={() => gallery.open(0)}>View Images</button>
2490
- *
2491
- * // Render gallery
2492
- * {gallery.isOpen && (
2493
- * <ImageModal
2494
- * image={gallery.currentImage}
2495
- * onClose={gallery.close}
2496
- * onPrev={gallery.prev}
2497
- * onNext={gallery.next}
2498
- * hasPrev={gallery.hasPrev}
2499
- * hasNext={gallery.hasNext}
2500
- * />
2501
- * )}
2502
- * ```
2503
- */
2504
- declare function useImageGallery(options?: UseImageGalleryOptions): UseImageGalleryReturn;
2505
-
2506
- /**
2507
- * useAutoScroll Hook
2508
- * Manages auto-scroll behavior for chat containers
2509
- */
2510
- interface UseAutoScrollOptions {
2511
- /** Threshold in pixels from bottom to consider "at bottom" (default: 100) */
2512
- threshold?: number;
2513
- /** Smooth scroll behavior (default: true) */
2514
- smooth?: boolean;
2515
- /** Callback when scroll position changes */
2516
- onScroll?: (isAtBottom: boolean) => void;
2517
- }
2518
- interface UseAutoScrollReturn {
2519
- /** Ref to attach to the scrollable container */
2520
- containerRef: React.RefObject<HTMLDivElement>;
2521
- /** Whether the container is scrolled to the bottom */
2522
- isAtBottom: boolean;
2523
- /** Whether auto-scroll should be active */
2524
- shouldAutoScroll: boolean;
2525
- /** Manually scroll to bottom */
2526
- scrollToBottom: (smooth?: boolean) => void;
2527
- /** Enable/disable auto-scroll */
2528
- setAutoScroll: (enabled: boolean) => void;
2529
- /** Handle scroll event (attach to container if not using ref) */
2530
- handleScroll: (e: React.UIEvent<HTMLDivElement>) => void;
2531
- }
2532
- /**
2533
- * Hook for managing auto-scroll behavior in chat containers
2534
- *
2535
- * @example
2536
- * ```tsx
2537
- * const scroll = useAutoScroll({ threshold: 50 })
2538
- *
2539
- * // Attach to container
2540
- * <div ref={scroll.containerRef} onScroll={scroll.handleScroll}>
2541
- * {messages.map(msg => <Message key={msg.id} />)}
2542
- * </div>
2543
- *
2544
- * // Scroll button
2545
- * {!scroll.isAtBottom && (
2546
- * <button onClick={() => scroll.scrollToBottom()}>
2547
- * Scroll to bottom
2548
- * </button>
2549
- * )}
2550
- * ```
2551
- */
2552
- declare function useAutoScroll(options?: UseAutoScrollOptions): UseAutoScrollReturn;
2553
-
2554
- /**
2555
- * useMessageActions Hook
2556
- * Provides copy, regenerate, and edit functionality for messages
2557
- */
2558
- interface UseMessageActionsOptions {
2559
- /** Callback when copy succeeds */
2560
- onCopy?: (content: string) => void;
2561
- /** Callback when copy fails */
2562
- onCopyError?: (error: Error) => void;
2563
- /** Callback when regenerate is triggered */
2564
- onRegenerate?: () => void | Promise<void>;
2565
- /** Callback when edit is triggered */
2566
- onEdit?: (content: string) => void | Promise<void>;
2567
- /** Duration to show "copied" state in ms (default: 2000) */
2568
- copiedDuration?: number;
2569
- }
2570
- interface UseMessageActionsReturn {
2571
- /** Whether content was recently copied */
2572
- isCopied: boolean;
2573
- /** Whether regenerate is in progress */
2574
- isRegenerating: boolean;
2575
- /** Whether edit is in progress */
2576
- isEditing: boolean;
2577
- /** Copy content to clipboard */
2578
- copy: (content: string) => Promise<void>;
2579
- /** Trigger regenerate action */
2580
- regenerate: () => Promise<void>;
2581
- /** Trigger edit action */
2582
- edit: (content: string) => Promise<void>;
2583
- /** Reset all states */
2584
- reset: () => void;
2585
- }
2586
- /**
2587
- * Hook for managing message actions (copy, regenerate, edit)
2588
- *
2589
- * @example
2590
- * ```tsx
2591
- * const actions = useMessageActions({
2592
- * onRegenerate: () => chatContext.regenerateMessage(messageId),
2593
- * onEdit: (content) => chatContext.editMessage(messageId, content),
2594
- * onCopy: () => toast.success('Copied!'),
2595
- * })
2596
- *
2597
- * <button onClick={() => actions.copy(message.content)}>
2598
- * {actions.isCopied ? 'Copied!' : 'Copy'}
2599
- * </button>
2600
- *
2601
- * <button onClick={actions.regenerate} disabled={actions.isRegenerating}>
2602
- * {actions.isRegenerating ? 'Regenerating...' : 'Regenerate'}
2603
- * </button>
2604
- * ```
2605
- */
2606
- declare function useMessageActions(options?: UseMessageActionsOptions): UseMessageActionsReturn;
2607
-
2608
- /**
2609
- * useAttachments Hook
2610
- * Manages file upload state, validation, and preview
2611
- */
2612
-
2613
- interface FileValidationError {
2614
- file: File;
2615
- reason: 'size' | 'type' | 'count' | 'custom';
2616
- message: string;
2617
- }
2618
- interface UseAttachmentsOptions {
2619
- /** Maximum number of files (default: 10) */
2620
- maxFiles?: number;
2621
- /** Maximum file size in bytes (default: 20MB) */
2622
- maxFileSize?: number;
2623
- /** Allowed MIME types (default: attachment allowlist) */
2624
- allowedTypes?: string[];
2625
- /** Custom validation function */
2626
- validate?: (file: File) => string | null;
2627
- /** Callback when files are added */
2628
- onAdd?: (files: Attachment$1[]) => void;
2629
- /** Callback when a file is removed */
2630
- onRemove?: (file: Attachment$1) => void;
2631
- /** Callback when validation fails */
2632
- onError?: (errors: FileValidationError[]) => void;
2633
- }
2634
- interface UseAttachmentsReturn {
2635
- /** Current attachments */
2636
- files: Attachment$1[];
2637
- /** Validation errors from last operation */
2638
- errors: FileValidationError[];
2639
- /** Whether files are being processed */
2640
- isProcessing: boolean;
2641
- /** Whether max file limit is reached */
2642
- isMaxReached: boolean;
2643
- /** Number of remaining slots */
2644
- remainingSlots: number;
2645
- /** Add files (validates and processes) */
2646
- add: (files: FileList | File[]) => Promise<void>;
2647
- /** Remove a specific file */
2648
- remove: (fileOrId: Attachment$1 | string) => void;
2649
- /** Clear all files */
2650
- clear: () => void;
2651
- /** Clear errors */
2652
- clearErrors: () => void;
2653
- /** Set files directly (for controlled mode) */
2654
- setFiles: (files: Attachment$1[]) => void;
2655
- }
2656
- /**
2657
- * Hook for managing file attachments
2658
- *
2659
- * @example
2660
- * ```tsx
2661
- * const attachments = useAttachments({
2662
- * maxFiles: 5,
2663
- * maxFileSize: 5 * 1024 * 1024, // 5MB
2664
- * onError: (errors) => errors.forEach(e => toast.error(e.message)),
2665
- * })
2666
- *
2667
- * <input
2668
- * type="file"
2669
- * multiple
2670
- * accept="image/*"
2671
- * onChange={(e) => attachments.add(e.target.files)}
2672
- * />
2673
- *
2674
- * {attachments.files.map(file => (
2675
- * <AttachmentPreview
2676
- * key={file.id}
2677
- * attachment={file}
2678
- * onRemove={() => attachments.remove(file)}
2679
- * />
2680
- * ))}
2681
- *
2682
- * {attachments.errors.length > 0 && (
2683
- * <ErrorList errors={attachments.errors} />
2684
- * )}
2685
- * ```
2686
- */
2687
- declare function useAttachments(options?: UseAttachmentsOptions): UseAttachmentsReturn;
2688
-
2689
- /**
2690
- * useMarkdownCopy Hook
2691
- * Manages copy-to-clipboard state for code blocks in markdown
2692
- */
2693
- interface UseMarkdownCopyOptions {
2694
- /** Duration to show "copied" state in ms (default: 2000) */
2695
- copiedDuration?: number;
2696
- /** Callback when copy succeeds */
2697
- onCopy?: (content: string, language?: string) => void;
2698
- /** Callback when copy fails */
2699
- onError?: (error: Error) => void;
2700
- }
2701
- interface UseMarkdownCopyReturn {
2702
- /** Map of copied states by block ID */
2703
- copiedStates: Map<string, boolean>;
2704
- /** Check if a specific block is in copied state */
2705
- isCopied: (blockId: string) => boolean;
2706
- /** Copy content with block ID tracking */
2707
- copy: (blockId: string, content: string, language?: string) => Promise<void>;
2708
- /** Reset copied state for a specific block */
2709
- reset: (blockId: string) => void;
2710
- /** Reset all copied states */
2711
- resetAll: () => void;
2712
- }
2713
- /**
2714
- * Hook for managing copy states for multiple code blocks
2715
- *
2716
- * @example
2717
- * ```tsx
2718
- * const markdownCopy = useMarkdownCopy({
2719
- * onCopy: (content, lang) => console.log(`Copied ${lang} code`),
2720
- * })
2721
- *
2722
- * function CodeBlock({ id, code, language }) {
2723
- * return (
2724
- * <div>
2725
- * <pre>{code}</pre>
2726
- * <button onClick={() => markdownCopy.copy(id, code, language)}>
2727
- * {markdownCopy.isCopied(id) ? 'Copied!' : 'Copy'}
2728
- * </button>
2729
- * </div>
2730
- * )
2731
- * }
2732
- * ```
2733
- */
2734
- declare function useMarkdownCopy(options?: UseMarkdownCopyOptions): UseMarkdownCopyReturn;
2735
-
2736
- /**
2737
- * useScrollToBottom Hook
2738
- * Manages scroll-to-bottom functionality with smart auto-scroll
2739
- * Only scrolls if user is near the bottom (within threshold)
2740
- */
2741
- interface UseScrollToBottomReturn {
2742
- /**
2743
- * Ref to attach to the messages container
2744
- */
2745
- containerRef: React.RefObject<HTMLDivElement>;
2746
- /**
2747
- * Whether to show the scroll-to-bottom button
2748
- */
2749
- showScrollButton: boolean;
2750
- /**
2751
- * Function to scroll to bottom
2752
- */
2753
- scrollToBottom: () => void;
2754
- }
2755
- /**
2756
- * Hook for managing scroll-to-bottom behavior
2757
- * Automatically scrolls if user is near the bottom
2758
- * Shows button only when scrolled up significantly
2759
- */
2760
- declare function useScrollToBottom(items: unknown[]): UseScrollToBottomReturn;
2761
-
2762
- interface ShortcutConfig {
2763
- key: string;
2764
- ctrl?: boolean;
2765
- shift?: boolean;
2766
- alt?: boolean;
2767
- meta?: boolean;
2768
- callback: () => void;
2769
- preventDefault?: boolean;
2770
- description?: string;
2771
- }
2772
- /**
2773
- * Hook for managing global keyboard shortcuts
2774
- * Automatically handles modifier keys and input field exclusion
2775
- *
2776
- * @param shortcuts - Array of keyboard shortcut configurations
2777
- *
2778
- * @example
2779
- * useKeyboardShortcuts([
2780
- * { key: 'k', ctrl: true, callback: () => focusSearch(), description: 'Focus search' },
2781
- * { key: '?', callback: () => setShowHelp(true), description: 'Show keyboard shortcuts' },
2782
- * ])
2783
- */
2784
- declare function useKeyboardShortcuts(shortcuts: ShortcutConfig[]): void;
2785
-
2786
- interface LongPressOptions {
2787
- delay?: number;
2788
- onLongPress: (e: React.TouchEvent | React.MouseEvent) => void;
2789
- onPressStart?: () => void;
2790
- onPressCancel?: () => void;
2791
- moveThreshold?: number;
2792
- hapticFeedback?: boolean;
2793
- }
2794
- interface LongPressEventHandlers {
2795
- onTouchStart: (e: React.TouchEvent) => void;
2796
- onTouchEnd: (e: React.TouchEvent) => void;
2797
- onTouchMove: (e: React.TouchEvent) => void;
2798
- onMouseDown?: (e: React.MouseEvent) => void;
2799
- onMouseUp?: (e: React.MouseEvent) => void;
2800
- onMouseLeave?: (e: React.MouseEvent) => void;
2801
- }
2802
- interface LongPressResult {
2803
- handlers: LongPressEventHandlers;
2804
- isPressed: boolean;
2805
- }
2806
- declare function useLongPress(options: LongPressOptions): LongPressResult;
2807
-
2808
- type BichatRPC = {
2809
- "bichat.artifact.delete": {
2810
- params: ArtifactIDParams;
2811
- result: OkResult;
2812
- };
2813
- "bichat.artifact.update": {
2814
- params: ArtifactUpdateParams;
2815
- result: ArtifactResult;
2816
- };
2817
- "bichat.ping": {
2818
- params: PingParams;
2819
- result: PingResult;
2820
- };
2821
- "bichat.question.reject": {
2822
- params: QuestionCancelParams;
2823
- result: AsyncRunAcceptedResult;
2824
- };
2825
- "bichat.question.submit": {
2826
- params: QuestionSubmitParams;
2827
- result: AsyncRunAcceptedResult;
2828
- };
2829
- "bichat.session.archive": {
2830
- params: SessionIDParams;
2831
- result: SessionCreateResult;
2832
- };
2833
- "bichat.session.artifacts": {
2834
- params: SessionArtifactsParams;
2835
- result: SessionArtifactsResult;
2836
- };
2837
- "bichat.session.clear": {
2838
- params: SessionIDParams;
2839
- result: SessionClearResult;
2840
- };
2841
- "bichat.session.compact": {
2842
- params: SessionIDParams;
2843
- result: AsyncRunAcceptedResult;
2844
- };
2845
- "bichat.session.create": {
2846
- params: SessionCreateParams;
2847
- result: SessionCreateResult;
2848
- };
2849
- "bichat.session.delete": {
2850
- params: SessionIDParams;
2851
- result: OkResult;
2852
- };
2853
- "bichat.session.get": {
2854
- params: SessionGetParams;
2855
- result: SessionGetResult;
2856
- };
2857
- "bichat.session.list": {
2858
- params: SessionListParams;
2859
- result: SessionListResult;
2860
- };
2861
- "bichat.session.listAll": {
2862
- params: SessionListAllParams;
2863
- result: SessionListAllResult;
2864
- };
2865
- "bichat.session.members.add": {
2866
- params: SessionMembersUpsertParams;
2867
- result: OkResult;
2868
- };
2869
- "bichat.session.members.list": {
2870
- params: SessionMembersListParams;
2871
- result: SessionMembersListResult;
2872
- };
2873
- "bichat.session.members.remove": {
2874
- params: SessionMembersRemoveParams;
2875
- result: OkResult;
2876
- };
2877
- "bichat.session.members.updateRole": {
2878
- params: SessionMembersUpsertParams;
2879
- result: OkResult;
2880
- };
2881
- "bichat.session.pin": {
2882
- params: SessionIDParams;
2883
- result: SessionCreateResult;
2884
- };
2885
- "bichat.session.regenerateTitle": {
2886
- params: SessionIDParams;
2887
- result: SessionCreateResult;
2888
- };
2889
- "bichat.session.unarchive": {
2890
- params: SessionIDParams;
2891
- result: SessionCreateResult;
2892
- };
2893
- "bichat.session.unpin": {
2894
- params: SessionIDParams;
2895
- result: SessionCreateResult;
2896
- };
2897
- "bichat.session.updateTitle": {
2898
- params: SessionUpdateTitleParams;
2899
- result: SessionCreateResult;
2900
- };
2901
- "bichat.session.uploadArtifacts": {
2902
- params: SessionUploadArtifactsParams;
2903
- result: SessionUploadArtifactsResult;
2904
- };
2905
- "bichat.user.list": {
2906
- params: UserListParams;
2907
- result: UserListResult;
2908
- };
2909
- };
2910
- interface Artifact {
2911
- id: string;
2912
- sessionId: string;
2913
- messageId?: string;
2914
- uploadId?: number | null;
2915
- type: string;
2916
- name: string;
2917
- description?: string;
2918
- mimeType?: string;
2919
- url?: string;
2920
- sizeBytes: number;
2921
- metadata?: Record<string, unknown>;
2922
- createdAt: string;
2923
- }
2924
- interface ArtifactIDParams {
2925
- id: string;
2926
- }
2927
- interface ArtifactResult {
2928
- artifact: Artifact;
2929
- }
2930
- interface ArtifactUpdateParams {
2931
- id: string;
2932
- name: string;
2933
- description?: string;
2934
- }
2935
- interface AssistantTurn {
2936
- id: string;
2937
- role?: string;
2938
- content: string;
2939
- explanation?: string;
2940
- citations: Citation[];
2941
- toolCalls?: ToolCall[];
2942
- debug?: DebugTrace | null;
2943
- artifacts: unknown[];
2944
- codeOutputs: CodeOutput[];
2945
- createdAt: string;
2946
- }
2947
- interface AsyncRunAcceptedResult {
2948
- accepted: boolean;
2949
- operation: string;
2950
- sessionId: string;
2951
- runId: string;
2952
- startedAt: number;
2953
- }
2954
- interface Attachment {
2955
- id: string;
2956
- uploadId?: number | null;
2957
- filename: string;
2958
- mimeType: string;
2959
- sizeBytes: number;
2960
- url?: string;
2961
- }
2962
- interface Citation {
2963
- id: string;
2964
- type: string;
2965
- title: string;
2966
- url: string;
2967
- startIndex: number;
2968
- endIndex: number;
2969
- excerpt?: string;
2970
- source?: string;
2971
- }
2972
- interface CodeOutput {
2973
- type: string;
2974
- content: string;
2975
- filename?: string;
2976
- mimeType?: string;
2977
- sizeBytes?: number;
2978
- }
2979
- interface ConversationTurn {
2980
- id: string;
2981
- sessionId: string;
2982
- userTurn: UserTurn;
2983
- assistantTurn?: AssistantTurn | null;
2984
- createdAt: string;
2985
- }
2986
- interface DebugEvent {
2987
- id?: string;
2988
- name?: string;
2989
- type?: string;
2990
- level?: string;
2991
- message?: string;
2992
- reason?: string;
2993
- spanId?: string;
2994
- generationId?: string;
2995
- timestamp?: string;
2996
- attributes?: Record<string, unknown>;
2997
- }
2998
- interface DebugGeneration {
2999
- id?: string;
3000
- requestId?: string;
3001
- model?: string;
3002
- provider?: string;
3003
- finishReason?: string;
3004
- promptTokens?: number;
3005
- completionTokens?: number;
3006
- totalTokens?: number;
3007
- cachedTokens?: number;
3008
- cost?: number;
3009
- latencyMs?: number;
3010
- input?: string;
3011
- output?: string;
3012
- thinking?: string;
3013
- observationReason?: string;
3014
- startedAt?: string;
3015
- completedAt?: string;
3016
- toolCalls?: DebugToolCall[];
3017
- }
3018
- interface DebugSpan {
3019
- id?: string;
3020
- parentId?: string;
3021
- generationId?: string;
3022
- name?: string;
3023
- type?: string;
3024
- status?: string;
3025
- level?: string;
3026
- callId?: string;
3027
- toolName?: string;
3028
- input?: string;
3029
- output?: string;
3030
- error?: string;
3031
- durationMs?: number;
3032
- startedAt?: string;
3033
- completedAt?: string;
3034
- attributes?: Record<string, unknown>;
3035
- }
3036
- interface DebugToolCall {
3037
- callId?: string;
3038
- name?: string;
3039
- arguments?: string;
3040
- result?: string;
3041
- error?: string;
3042
- durationMs?: number;
3043
- }
3044
- interface DebugTrace {
3045
- schemaVersion?: string;
3046
- startedAt?: string;
3047
- completedAt?: string;
3048
- usage?: DebugUsage | null;
3049
- generationMs?: number;
3050
- tools?: DebugToolCall[];
3051
- attempts?: DebugGeneration[];
3052
- spans?: DebugSpan[];
3053
- events?: DebugEvent[];
3054
- traceId?: string;
3055
- traceUrl?: string;
3056
- sessionId?: string;
3057
- thinking?: string;
3058
- observationReason?: string;
3059
- }
3060
- interface DebugUsage {
3061
- promptTokens: number;
3062
- completionTokens: number;
3063
- totalTokens: number;
3064
- cachedTokens: number;
3065
- cost: number;
3066
- }
3067
- interface OkResult {
3068
- ok: boolean;
3069
- }
3070
- interface PendingQuestion {
3071
- checkpointId: string;
3072
- agentName?: string;
3073
- turnId: string;
3074
- questions: PendingQuestionItem[];
3075
- status: string;
3076
- }
3077
- interface PendingQuestionItem {
3078
- id: string;
3079
- text: string;
3080
- type: string;
3081
- options: PendingQuestionOption[];
3082
- }
3083
- interface PendingQuestionOption {
3084
- id: string;
3085
- label: string;
3086
- }
3087
- type PingParams = Record<string, never>;
3088
- interface PingResult {
3089
- ok: boolean;
3090
- tenantId: string;
3091
- }
3092
- interface QuestionCancelParams {
3093
- sessionId: string;
3094
- }
3095
- interface QuestionSubmitParams {
3096
- sessionId: string;
3097
- checkpointId: string;
3098
- answers: Record<string, string>;
3099
- }
3100
- interface Session {
3101
- id: string;
3102
- title: string;
3103
- status: string;
3104
- pinned: boolean;
3105
- createdAt: string;
3106
- updatedAt: string;
3107
- owner?: SessionUser | null;
3108
- isGroup?: boolean;
3109
- memberCount?: number;
3110
- access?: SessionAccess | null;
3111
- }
3112
- interface SessionAccess {
3113
- role: string;
3114
- source: string;
3115
- canRead: boolean;
3116
- canWrite: boolean;
3117
- canManageMembers: boolean;
3118
- }
3119
- interface SessionArtifactsParams {
3120
- sessionId: string;
3121
- limit: number;
3122
- offset: number;
3123
- }
3124
- interface SessionArtifactsResult {
3125
- artifacts: Artifact[];
3126
- hasMore: boolean;
3127
- nextOffset: number;
3128
- }
3129
- interface SessionClearResult {
3130
- success: boolean;
3131
- deletedMessages: number;
3132
- deletedArtifacts: number;
3133
- }
3134
- interface SessionCreateParams {
3135
- title: string;
3136
- }
3137
- interface SessionCreateResult {
3138
- session: Session;
3139
- }
3140
- interface SessionGetParams {
3141
- id: string;
3142
- }
3143
- interface SessionGetResult {
3144
- session: Session;
3145
- turns: ConversationTurn[];
3146
- pendingQuestion?: PendingQuestion | null;
3147
- }
3148
- interface SessionIDParams {
3149
- id: string;
3150
- }
3151
- interface SessionListAllParams {
3152
- limit: number;
3153
- offset: number;
3154
- includeArchived: boolean;
3155
- userId?: string | null;
3156
- }
3157
- interface SessionListAllResult {
3158
- sessions: Session[];
3159
- total?: number;
3160
- hasMore: boolean;
3161
- }
3162
- interface SessionListParams {
3163
- limit: number;
3164
- offset: number;
3165
- includeArchived: boolean;
3166
- }
3167
- interface SessionListResult {
3168
- sessions: Session[];
3169
- total?: number;
3170
- hasMore: boolean;
3171
- }
3172
- interface SessionMember {
3173
- user: SessionUser;
3174
- role: string;
3175
- createdAt: string;
3176
- updatedAt: string;
3177
- }
3178
- interface SessionMembersListParams {
3179
- sessionId: string;
3180
- }
3181
- interface SessionMembersListResult {
3182
- members: SessionMember[];
3183
- }
3184
- interface SessionMembersRemoveParams {
3185
- sessionId: string;
3186
- userId: string;
3187
- }
3188
- interface SessionMembersUpsertParams {
3189
- sessionId: string;
3190
- userId: string;
3191
- role: string;
3192
- }
3193
- interface SessionUpdateTitleParams {
3194
- id: string;
3195
- title: string;
3196
- }
3197
- interface SessionUploadArtifactsParams {
3198
- sessionId: string;
3199
- attachments: Attachment[];
3200
- }
3201
- interface SessionUploadArtifactsResult {
3202
- artifacts: Artifact[];
3203
- }
3204
- interface SessionUser {
3205
- id: string;
3206
- firstName: string;
3207
- lastName: string;
3208
- initials: string;
3209
- }
3210
- interface ToolCall {
3211
- id: string;
3212
- name: string;
3213
- arguments: string;
3214
- result?: string;
3215
- error?: string;
3216
- durationMs?: number;
3217
- }
3218
- type UserListParams = Record<string, never>;
3219
- interface UserListResult {
3220
- users: SessionUser[];
3221
- }
3222
- interface UserTurn {
3223
- id: string;
3224
- content: string;
3225
- attachments: Attachment[];
3226
- author?: SessionUser | null;
3227
- createdAt: string;
3228
- }
3229
-
3230
- /**
3231
- * Session lifecycle management: create, list, get, delete, archive, pin, rename.
3232
- *
3233
- * @internal — Not part of the public API. Consumed by HttpDataSource.
3234
- */
3235
-
3236
- interface SessionState {
3237
- session: Session$1;
3238
- turns: ConversationTurn$1[];
3239
- pendingQuestion?: PendingQuestion$1 | null;
3240
- }
3241
-
3242
- /**
3243
- * Message sending, SSE streaming, and HITL question handling.
3244
- *
3245
- * @internal — Not part of the public API. Consumed by HttpDataSource.
3246
- */
3247
-
3248
- /**
3249
- * Thrown by {@link subscribeRunEvents} when the underlying EventSource
3250
- * emits `onerror` before the first event arrives within the
3251
- * initial-connect grace window. Distinguishes boundary failures
3252
- * (401 / 404 / 503) from transient mid-run flaps, which the browser's
3253
- * native auto-reconnect continues to handle silently.
3254
- */
3255
- declare class RunEventsConnectError extends Error {
3256
- readonly cause?: Event;
3257
- constructor(message: string, cause?: Event);
3258
- }
3259
- interface SubscribeRunEventsOptions {
3260
- /** When set, start from the last seen event id instead of a full replay. */
3261
- lastEventId?: string;
3262
- /** Fires for every chunk (content / tool / snapshot / done / error / …). */
3263
- onChunk: (chunk: StreamChunk) => void;
3264
- /** Optional hook for raw SSE errors (connection blips, parse failures). */
3265
- onError?: (event: Event) => void;
3266
- /** AbortSignal closes the underlying EventSource. */
3267
- signal?: AbortSignal;
3268
- }
3269
- interface SubscribeActiveRunsOptions {
3270
- onEvent: (event: ActiveRunDelivery) => void;
3271
- onError?: (event: Event) => void;
3272
- signal?: AbortSignal;
3273
- }
3274
-
3275
- /**
3276
- * Built-in HTTP data source with SSE streaming and AbortController
3277
- * Implements ChatDataSource interface with real HTTP/RPC calls
3278
- *
3279
- * Uses turn-based architecture - fetches ConversationTurns instead of flat messages.
3280
- *
3281
- * This file is a thin facade that delegates to focused internal modules:
3282
- * - SessionManager.ts — session CRUD (create, list, get, delete, archive, pin)
3283
- * - MessageTransport.ts — send messages, stream responses, HITL questions
3284
- * - ArtifactManager.ts — artifact fetch, upload, rename, delete
3285
- * - AttachmentUploader.ts — file decode, normalize, upload
3286
- * - mappers.ts — RPC-to-domain type mapping and sanitization
3287
- */
3288
-
3289
- interface HttpDataSourceConfig {
3290
- baseUrl: string;
3291
- rpcEndpoint: string;
3292
- streamEndpoint?: string;
3293
- uploadEndpoint?: string;
3294
- csrfToken?: string | (() => string);
3295
- headers?: Record<string, string>;
3296
- rpcTimeoutMs?: number;
3297
- streamConnectTimeoutMs?: number;
3298
- }
3299
- declare class HttpDataSource implements ChatDataSource {
3300
- private config;
3301
- private abortController;
3302
- private rpc;
3303
- constructor(config: HttpDataSourceConfig);
3304
- private getCSRFToken;
3305
- private createHeaders;
3306
- private createUploadHeaders;
3307
- private callRPC;
3308
- private boundCallRPC;
3309
- private boundUploadFile;
3310
- createSession(): Promise<Session$1>;
3311
- fetchSession(id: string): Promise<SessionState | null>;
3312
- listSessions(options?: {
3313
- limit?: number;
3314
- offset?: number;
3315
- includeArchived?: boolean;
3316
- }): Promise<SessionListResult$1>;
3317
- archiveSession(sessionId: string): Promise<Session$1>;
3318
- unarchiveSession(sessionId: string): Promise<Session$1>;
3319
- pinSession(sessionId: string): Promise<Session$1>;
3320
- unpinSession(sessionId: string): Promise<Session$1>;
3321
- deleteSession(sessionId: string): Promise<void>;
3322
- renameSession(sessionId: string, title: string): Promise<Session$1>;
3323
- regenerateSessionTitle(sessionId: string): Promise<Session$1>;
3324
- clearSessionHistory(sessionId: string): Promise<{
3325
- success: boolean;
3326
- deletedMessages: number;
3327
- deletedArtifacts: number;
3328
- }>;
3329
- compactSessionHistory(sessionId: string): Promise<AsyncRunAccepted>;
3330
- listUsers(): Promise<SessionUser$1[]>;
3331
- listAllSessions(options?: {
3332
- limit?: number;
3333
- offset?: number;
3334
- includeArchived?: boolean;
3335
- userId?: string | null;
3336
- }): Promise<{
3337
- sessions: Session$1[];
3338
- total: number;
3339
- hasMore: boolean;
3340
- }>;
3341
- listSessionMembers(sessionId: string): Promise<SessionMember$1[]>;
3342
- addSessionMember(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
3343
- updateSessionMemberRole(sessionId: string, userId: string, role: 'editor' | 'viewer'): Promise<void>;
3344
- removeSessionMember(sessionId: string, userId: string): Promise<void>;
3345
- stopGeneration(sessionId: string): Promise<void>;
3346
- getStreamStatus(sessionId: string): Promise<StreamStatus | null>;
3347
- resumeStream(sessionId: string, runId: string, onChunk: (chunk: StreamChunk) => void, signal?: AbortSignal): Promise<void>;
3348
- /**
3349
- * Open a native EventSource against GET /stream/events for the given
3350
- * run. Used by components that want browser-native auto-reconnect
3351
- * with Last-Event-ID (tab close, wifi drop, device switch). Prefer
3352
- * over resumeStream when tailing an already-running generation that
3353
- * another tab started.
3354
- */
3355
- subscribeRunEvents(sessionId: string, runId: string, options: SubscribeRunEventsOptions): Promise<void>;
3356
- /**
3357
- * Subscribe to the per-tenant active-run fan-out
3358
- * (GET /stream/active-runs). Never resolves until the caller aborts
3359
- * via the signal; use from a top-level component (sidebar container)
3360
- * that mounts for the lifetime of the chat app.
3361
- */
3362
- subscribeActiveRuns(options: SubscribeActiveRunsOptions): Promise<void>;
3363
- sendMessage(sessionId: string, content: string, attachments?: Attachment$1[], signal?: AbortSignal, options?: SendMessageOptions): AsyncGenerator<StreamChunk>;
3364
- cancelStream(): void;
3365
- submitQuestionAnswers(sessionId: string, questionId: string, answers: QuestionAnswers): Promise<{
3366
- success: boolean;
3367
- data?: AsyncRunAccepted;
3368
- error?: string;
3369
- }>;
3370
- rejectPendingQuestion(sessionId: string): Promise<{
3371
- success: boolean;
3372
- data?: AsyncRunAccepted;
3373
- error?: string;
3374
- }>;
3375
- fetchSessionArtifacts(sessionId: string, options?: {
3376
- limit?: number;
3377
- offset?: number;
3378
- }): Promise<{
3379
- artifacts: SessionArtifact[];
3380
- hasMore?: boolean;
3381
- nextOffset?: number;
3382
- }>;
3383
- uploadSessionArtifacts(sessionId: string, files: File[]): Promise<{
3384
- artifacts: SessionArtifact[];
3385
- }>;
3386
- renameSessionArtifact(artifactId: string, name: string, description?: string): Promise<SessionArtifact>;
3387
- deleteSessionArtifact(artifactId: string): Promise<void>;
3388
- }
3389
- /**
3390
- * Factory function to create HttpDataSource
3391
- */
3392
- declare function createHttpDataSource(config: HttpDataSourceConfig): ChatDataSource;
3393
-
3394
- /**
3395
- * Builds HttpDataSourceConfig from window.__APPLET_CONTEXT__.
3396
- * For use with createHttpDataSource when the app is embedded via the applet framework.
3397
- *
3398
- * Expects the host to inject context with:
3399
- * - config.rpcUIEndpoint, config.streamEndpoint
3400
- * - session.csrfToken (or window.__CSRF_TOKEN__)
3401
- */
3402
-
3403
- /**
3404
- * Returns HttpDataSourceConfig derived from window.__APPLET_CONTEXT__.
3405
- * Use with createHttpDataSource() for RPC and SSE endpoints.
3406
- *
3407
- * @throws Error if window.__APPLET_CONTEXT__ is not available
3408
- */
3409
- declare function useHttpDataSourceConfigFromApplet(options?: {
3410
- rpcTimeoutMs?: number;
3411
- streamConnectTimeoutMs?: number;
3412
- }): HttpDataSourceConfig;
3413
-
3414
- /**
3415
- * Router adapter for BiChat sidebar and archived list.
3416
- * Consumes a navigate function and location (pathname) and returns
3417
- * activeSessionId plus callbacks for use with SDK Sidebar and ArchivedChatList.
3418
- *
3419
- * Router-agnostic: pass useNavigate()/useLocation() from react-router-dom
3420
- * or equivalent from your router.
3421
- */
3422
- interface UseBichatRouterParams {
3423
- /** Navigate to a path (e.g. from useNavigate()) */
3424
- navigate: (path: string) => void;
3425
- /** Current pathname (e.g. location.pathname from useLocation()) */
3426
- pathname: string;
3427
- /** Optional: close mobile sidebar after navigation (e.g. closeMobile from useSidebarState) */
3428
- onNavigate?: () => void;
3429
- }
3430
- interface UseBichatRouterReturn {
3431
- /** Session ID extracted from pathname (e.g. /session/:id -> id) */
3432
- activeSessionId: string | undefined;
3433
- /** Navigate to session or home when sessionId is empty */
3434
- onSessionSelect: (sessionId: string) => void;
3435
- /** Navigate to new chat (home) */
3436
- onNewChat: () => void;
3437
- /** Navigate to archived list */
3438
- onArchivedView: () => void;
3439
- /** Navigate back (e.g. to home) */
3440
- onBack: () => void;
3441
- /** Navigate to all-chats view */
3442
- onAllChatsView: () => void;
3443
- /** Current sidebar tab derived from URL */
3444
- sidebarTab: 'my-chats' | 'all-chats';
3445
- /** Handler to change sidebar tab (navigates to appropriate URL) */
3446
- onSidebarTabChange: (tab: 'my-chats' | 'all-chats') => void;
3447
- }
3448
- /**
3449
- * Derives BiChat navigation callbacks and activeSessionId from router state.
3450
- * Use with SDK Sidebar (onSessionSelect, onNewChat, onArchivedView, activeSessionId)
3451
- * and ArchivedChatList (onBack, onSessionSelect).
3452
- */
3453
- declare function useBichatRouter({ navigate, pathname, onNavigate, }: UseBichatRouterParams): UseBichatRouterReturn;
3454
-
3455
- /**
3456
- * Framer Motion animation variants for BiChat UI
3457
- * Subtle, professional animations for enterprise applications
3458
- *
3459
- * Reduced-motion handling: Framer Motion's built-in `<MotionConfig reducedMotion="user">`
3460
- * or the `useReducedMotion()` hook handle OS-level accessibility preferences reactively.
3461
- * Variant objects declare their intended durations; Framer suppresses them automatically.
3462
- */
3463
- /**
3464
- * Fade in animation
3465
- */
3466
- declare const fadeInVariants: {
3467
- initial: {
3468
- opacity: number;
3469
- };
3470
- animate: {
3471
- opacity: number;
3472
- transition: {
3473
- duration: number;
3474
- };
3475
- };
3476
- exit: {
3477
- opacity: number;
3478
- transition: {
3479
- duration: number;
3480
- };
3481
- };
3482
- };
3483
- /**
3484
- * Fade in with subtle slide up
3485
- */
3486
- declare const fadeInUpVariants: {
3487
- initial: {
3488
- opacity: number;
3489
- y: number;
3490
- };
3491
- animate: {
3492
- opacity: number;
3493
- y: number;
3494
- transition: {
3495
- duration: number;
3496
- ease: number[];
3497
- };
3498
- };
3499
- exit: {
3500
- opacity: number;
3501
- y: number;
3502
- transition: {
3503
- duration: number;
3504
- };
3505
- };
3506
- };
3507
- /**
3508
- * Scale fade for modals and popups
3509
- */
3510
- declare const scaleFadeVariants: {
3511
- initial: {
3512
- opacity: number;
3513
- scale: number;
3514
- };
3515
- animate: {
3516
- opacity: number;
3517
- scale: number;
3518
- transition: {
3519
- duration: number;
3520
- };
3521
- };
3522
- exit: {
3523
- opacity: number;
3524
- scale: number;
3525
- transition: {
3526
- duration: number;
3527
- };
3528
- };
3529
- };
3530
- /**
3531
- * Modal backdrop
3532
- */
3533
- declare const backdropVariants: {
3534
- initial: {
3535
- opacity: number;
3536
- };
3537
- animate: {
3538
- opacity: number;
3539
- transition: {
3540
- duration: number;
3541
- };
3542
- };
3543
- exit: {
3544
- opacity: number;
3545
- transition: {
3546
- duration: number;
3547
- };
3548
- };
3549
- };
3550
- /**
3551
- * Button press feedback
3552
- */
3553
- declare const buttonVariants: {
3554
- tap: {
3555
- scale: number;
3556
- };
3557
- };
3558
- /**
3559
- * Stagger container for lists
3560
- */
3561
- declare const staggerContainerVariants: {
3562
- hidden: {
3563
- opacity: number;
3564
- };
3565
- visible: {
3566
- opacity: number;
3567
- transition: {
3568
- staggerChildren: number;
3569
- delayChildren: number;
3570
- };
3571
- };
3572
- };
3573
- /**
3574
- * List item animation
3575
- */
3576
- declare const listItemVariants: {
3577
- initial: {
3578
- opacity: number;
3579
- x: number;
3580
- };
3581
- animate: {
3582
- opacity: number;
3583
- x: number;
3584
- transition: {
3585
- duration: number;
3586
- };
3587
- };
3588
- exit: {
3589
- opacity: number;
3590
- x: number;
3591
- transition: {
3592
- duration: number;
3593
- };
3594
- };
3595
- };
3596
- /**
3597
- * Message entrance animation
3598
- */
3599
- declare const messageVariants: {
3600
- initial: {
3601
- opacity: number;
3602
- y: number;
3603
- };
3604
- animate: {
3605
- opacity: number;
3606
- y: number;
3607
- transition: {
3608
- duration: number;
3609
- ease: number[];
3610
- };
3611
- };
3612
- exit: {
3613
- opacity: number;
3614
- transition: {
3615
- duration: number;
3616
- };
3617
- };
3618
- };
3619
- /**
3620
- * Container for staggered messages
3621
- */
3622
- declare const messageContainerVariants: {
3623
- initial: {
3624
- opacity: number;
3625
- };
3626
- animate: {
3627
- opacity: number;
3628
- transition: {
3629
- staggerChildren: number;
3630
- delayChildren: number;
3631
- };
3632
- };
3633
- };
3634
- /**
3635
- * Typing indicator dots
3636
- */
3637
- declare const typingDotVariants: {
3638
- initial: {
3639
- opacity: number;
3640
- };
3641
- animate: {
3642
- opacity: number[];
3643
- transition: {
3644
- duration: number;
3645
- repeat: number;
3646
- ease: string;
3647
- };
3648
- };
3649
- };
3650
- /**
3651
- * Verb transition for typing indicator
3652
- * Smooth slide-up animation for rotating text
3653
- */
3654
- declare const verbTransitionVariants: {
3655
- initial: {
3656
- y: number;
3657
- opacity: number;
3658
- };
3659
- animate: {
3660
- y: number;
3661
- opacity: number;
3662
- transition: {
3663
- duration: number;
3664
- ease: string;
3665
- };
3666
- };
3667
- exit: {
3668
- y: number;
3669
- opacity: number;
3670
- transition: {
3671
- duration: number;
3672
- };
3673
- };
3674
- };
3675
- /**
3676
- * Floating button (scroll to bottom, etc.)
3677
- */
3678
- declare const floatingButtonVariants: {
3679
- initial: {
3680
- opacity: number;
3681
- scale: number;
3682
- };
3683
- animate: {
3684
- opacity: number;
3685
- scale: number;
3686
- transition: {
3687
- duration: number;
3688
- };
3689
- };
3690
- exit: {
3691
- opacity: number;
3692
- scale: number;
3693
- transition: {
3694
- duration: number;
3695
- };
3696
- };
3697
- };
3698
- /**
3699
- * Dropdown menu
3700
- */
3701
- declare const dropdownVariants: {
3702
- initial: {
3703
- opacity: number;
3704
- y: number;
3705
- };
3706
- animate: {
3707
- opacity: number;
3708
- y: number;
3709
- transition: {
3710
- duration: number;
3711
- };
3712
- };
3713
- exit: {
3714
- opacity: number;
3715
- y: number;
3716
- transition: {
3717
- duration: number;
3718
- };
3719
- };
3720
- };
3721
- /**
3722
- * Session item with subtle slide-right on hover
3723
- */
3724
- declare const sessionItemVariants: {
3725
- initial: {
3726
- opacity: number;
3727
- x: number;
3728
- };
3729
- animate: {
3730
- opacity: number;
3731
- x: number;
3732
- transition: {
3733
- duration: number;
3734
- };
3735
- };
3736
- hover: {
3737
- x: number;
3738
- transition: {
3739
- duration: number;
3740
- };
3741
- };
3742
- exit: {
3743
- opacity: number;
3744
- x: number;
3745
- transition: {
3746
- duration: number;
3747
- };
3748
- };
3749
- };
3750
- /**
3751
- * Error/alert message slide-in
3752
- */
3753
- declare const errorMessageVariants: {
3754
- initial: {
3755
- opacity: number;
3756
- y: number;
3757
- height: number;
3758
- };
3759
- animate: {
3760
- opacity: number;
3761
- y: number;
3762
- height: string;
3763
- transition: {
3764
- duration: number;
3765
- ease: number[];
3766
- };
3767
- };
3768
- exit: {
3769
- opacity: number;
3770
- y: number;
3771
- height: number;
3772
- transition: {
3773
- duration: number;
3774
- };
3775
- };
3776
- };
3777
-
3778
- interface ChatSessionProviderProps {
3779
- dataSource: ChatDataSource;
3780
- sessionId?: string;
3781
- /**
3782
- * External rate limiter instance. Captured once at mount — changing this prop
3783
- * after initial render has no effect. For most cases, use `rateLimitConfig`
3784
- * instead and let the provider create the limiter internally.
3785
- */
3786
- rateLimiter?: RateLimiter;
3787
- /**
3788
- * Configuration for the built-in rate limiter (ignored when `rateLimiter` is
3789
- * provided). Captured once at mount — changing after initial render has no effect.
3790
- */
3791
- rateLimitConfig?: RateLimiterConfig;
3792
- /**
3793
- * Called when the machine creates a new session (e.g. on first message in a
3794
- * "new chat"). Use this to navigate your SPA router to the new session URL.
3795
- */
3796
- onSessionCreated?: (sessionId: string) => void;
3797
- children: ReactNode;
3798
- }
3799
- declare function ChatSessionProvider({ dataSource, sessionId, rateLimiter: externalRateLimiter, rateLimitConfig, onSessionCreated, children, }: ChatSessionProviderProps): react_jsx_runtime.JSX.Element;
3800
- declare function useChatSession(): ChatSessionStateValue;
3801
- declare function useChatMessaging(): ChatMessagingStateValue;
3802
- /** Returns messaging context or null when outside ChatSessionProvider. */
3803
- declare function useOptionalChatMessaging(): ChatMessagingStateValue | null;
3804
- declare function useChatInput(): ChatInputStateValue;
3805
-
3806
- /**
3807
- * BiChat context types layered on top of canonical applet-core context contracts.
3808
- */
3809
-
3810
- type UserContext = UserContext$1;
3811
- type TenantContext = TenantContext$1;
3812
- type LocaleContext = LocaleContext$1;
3813
- type AppConfig = AppConfig$1 & {
3814
- streamEndpoint: string;
3815
- basePath: string;
3816
- assetsBasePath: string;
3817
- rpcUIEndpoint: string;
3818
- };
3819
- interface Extensions {
3820
- branding?: {
3821
- appName?: string;
3822
- logoUrl?: string;
3823
- theme?: {
3824
- primary?: string;
3825
- secondary?: string;
3826
- accent?: string;
3827
- };
3828
- welcome?: {
3829
- title?: string;
3830
- description?: string;
3831
- examplePrompts?: Array<{
3832
- category: string;
3833
- text: string;
3834
- icon: string;
3835
- }>;
3836
- };
3837
- colors?: {
3838
- primary?: string;
3839
- secondary?: string;
3840
- accent?: string;
3841
- };
3842
- logo?: {
3843
- src?: string;
3844
- alt?: string;
3845
- };
3846
- };
3847
- features?: {
3848
- vision?: boolean;
3849
- webSearch?: boolean;
3850
- codeInterpreter?: boolean;
3851
- multiAgent?: boolean;
3852
- };
3853
- llm?: {
3854
- provider?: string;
3855
- apiKeyConfigured?: boolean;
3856
- reasoningEffortOptions?: string[];
3857
- models?: Array<{
3858
- id: string;
3859
- label: string;
3860
- default?: boolean;
3861
- }>;
3862
- };
3863
- debug?: {
3864
- limits?: {
3865
- policyMaxTokens: number;
3866
- modelMaxTokens: number;
3867
- effectiveMaxTokens: number;
3868
- completionReserveTokens: number;
3869
- };
3870
- };
3871
- }
3872
- type IotaContext = Omit<InitialContext, 'config' | 'extensions'> & {
3873
- config: AppConfig;
3874
- extensions?: Extensions;
3875
- };
3876
- declare global {
3877
- interface Window {
3878
- __APPLET_CONTEXT__: IotaContext;
3879
- __CSRF_TOKEN__: string;
3880
- }
3881
- }
3882
-
3883
- interface IotaContextProviderProps {
3884
- /**
3885
- * Explicit context object. When provided, the window global is not read.
3886
- * Useful for tests, Storybook, or apps that manage their own context.
3887
- */
3888
- context?: IotaContext;
3889
- children: ReactNode;
3890
- }
3891
- declare function IotaContextProvider({ context, children }: IotaContextProviderProps): react_jsx_runtime.JSX.Element;
3892
- declare function useIotaContext(): IotaContext;
3893
- /**
3894
- * Check if user has a specific permission
3895
- */
3896
- declare function hasPermission(permission: string): boolean;
3897
-
3898
- /** @deprecated Use `IotaContextProvider` with its `context` prop instead. */
3899
- interface BiChatConfig {
3900
- user: {
3901
- id: string;
3902
- email: string;
3903
- firstName: string;
3904
- lastName: string;
3905
- permissions: string[];
3906
- };
3907
- tenant: {
3908
- id: string;
3909
- name: string;
3910
- };
3911
- locale: {
3912
- language: string;
3913
- translations: Record<string, string>;
3914
- };
3915
- endpoints: {
3916
- rpc: string;
3917
- stream: string;
3918
- };
3919
- csrfToken?: string;
3920
- }
3921
- interface ConfigProviderProps {
3922
- config?: BiChatConfig;
3923
- useGlobalConfig?: boolean;
3924
- children: ReactNode;
3925
- }
3926
- /**
3927
- * @deprecated Use `IotaContextProvider` with its `context` prop instead.
3928
- *
3929
- * ConfigProvider component — provides configuration to the BiChat library.
3930
- *
3931
- * @param config - Configuration object (preferred method)
3932
- * @param useGlobalConfig - If true, falls back to window.__APPLET_CONTEXT__ when config is not provided
3933
- * @param children - React children
3934
- */
3935
- declare function ConfigProvider({ config, useGlobalConfig, children }: ConfigProviderProps): react_jsx_runtime.JSX.Element;
3936
- /**
3937
- * Hook to access BiChat configuration
3938
- * Returns null if no configuration is available
3939
- */
3940
- declare function useConfig(): BiChatConfig | null;
3941
- /**
3942
- * Hook to access BiChat configuration (required)
3943
- * Throws an error if configuration is not available
3944
- */
3945
- declare function useRequiredConfig(): BiChatConfig;
3946
-
3947
- /**
3948
- * Theme system type definitions
3949
- */
3950
- interface Theme {
3951
- name: string;
3952
- colors: ThemeColors;
3953
- spacing: ThemeSpacing;
3954
- borderRadius: ThemeBorderRadius;
3955
- }
3956
- interface ThemeColors {
3957
- background: string;
3958
- surface: string;
3959
- primary: string;
3960
- secondary: string;
3961
- text: string;
3962
- textMuted: string;
3963
- border: string;
3964
- error: string;
3965
- success: string;
3966
- warning: string;
3967
- userBubble: string;
3968
- assistantBubble: string;
3969
- userText: string;
3970
- assistantText: string;
3971
- }
3972
- interface ThemeSpacing {
3973
- xs: string;
3974
- sm: string;
3975
- md: string;
3976
- lg: string;
3977
- xl: string;
3978
- }
3979
- interface ThemeBorderRadius {
3980
- sm: string;
3981
- md: string;
3982
- lg: string;
3983
- full: string;
3984
- }
3985
-
3986
- interface ThemeProviderProps {
3987
- theme?: Theme | 'light' | 'dark' | 'system';
3988
- children: ReactNode;
3989
- }
3990
- /**
3991
- * Theme provider component
3992
- * Wraps the application and provides theme context
3993
- */
3994
- declare function ThemeProvider({ theme, children }: ThemeProviderProps): react_jsx_runtime.JSX.Element;
3995
- /**
3996
- * Hook to access current theme
3997
- */
3998
- declare function useTheme(): Theme;
3999
-
4000
- /**
4001
- * Predefined theme configurations
4002
- */
4003
-
4004
- declare const lightTheme: Theme;
4005
- declare const darkTheme: Theme;
4006
-
4007
- /**
4008
- * CSRF token management for API requests
4009
- */
4010
- /**
4011
- * Get CSRF token from window object
4012
- * @returns CSRF token string
4013
- */
4014
- declare function getCSRFToken(): string;
4015
- /**
4016
- * Add CSRF token to request headers
4017
- * @param headers - Headers object to modify
4018
- * @returns Modified headers object
4019
- */
4020
- declare function addCSRFHeader(headers: Headers): Headers;
4021
- /**
4022
- * Create headers with CSRF token
4023
- * @param init - Optional initial headers
4024
- * @returns Headers object with CSRF token
4025
- */
4026
- declare function createHeadersWithCSRF(init?: HeadersInit): Headers;
4027
-
4028
- /**
4029
- * Internal types for the ChatMachine.
4030
- *
4031
- * These are implementation details — consumers use the existing
4032
- * ChatSessionStateValue / ChatMessagingStateValue / ChatInputStateValue
4033
- * types via the public hooks.
4034
- */
4035
-
4036
- interface ChatMachineConfig {
4037
- dataSource: ChatDataSource;
4038
- rateLimiter: RateLimiter;
4039
- onSessionCreated?: (sessionId: string) => void;
4040
- }
4041
- /**
4042
- * Mirrors ChatSessionStateValue. Methods are stable (bound once on
4043
- * machine construction) so they never trigger re-renders by identity change.
4044
- */
4045
- interface SessionSnapshot {
4046
- session: Session$1 | null;
4047
- currentSessionId?: string;
4048
- fetching: boolean;
4049
- error: string | null;
4050
- errorRetryable: boolean;
4051
- debugMode: boolean;
4052
- sessionDebugUsage: SessionDebugUsage;
4053
- debugLimits: DebugLimits | null;
4054
- reasoningEffort: string | undefined;
4055
- reasoningEffortOptions: string[] | undefined;
4056
- model: string | undefined;
4057
- setError: (error: string | null) => void;
4058
- retryFetchSession: () => void;
4059
- setReasoningEffort: (effort: string) => void;
4060
- setModel: (model: string | undefined) => void;
4061
- }
4062
- /** Superset of ChatMessagingStateValue used internally by the state machine; includes internal-only fields such as generationInProgress. */
4063
- interface MessagingSnapshot {
4064
- turns: ConversationTurn$1[];
4065
- streamingContent: string;
4066
- isStreaming: boolean;
4067
- streamError: string | null;
4068
- streamErrorRetryable: boolean;
4069
- loading: boolean;
4070
- pendingQuestion: PendingQuestion$1 | null;
4071
- codeOutputs: CodeOutput$1[];
4072
- isCompacting: boolean;
4073
- compactionSummary: string | null;
4074
- artifactsInvalidationTrigger: number;
4075
- thinkingContent: string;
4076
- activeSteps: ActivityStep[];
4077
- generationInProgress: boolean;
4078
- showActivityTrace: boolean;
4079
- showTypingIndicator: boolean;
4080
- sendMessage: (content: string, attachments?: Attachment$1[]) => Promise<void>;
4081
- handleRegenerate?: (turnId: string, model?: string) => Promise<void>;
4082
- handleEdit?: (turnId: string, newContent: string) => Promise<void>;
4083
- handleCopy: (text: string) => Promise<void>;
4084
- handleSubmitQuestionAnswers: (answers: QuestionAnswers) => void;
4085
- handleRejectPendingQuestion: () => Promise<void>;
4086
- retryLastMessage: () => Promise<void>;
4087
- clearStreamError: () => void;
4088
- cancel: () => void;
4089
- setCodeOutputs: (outputs: CodeOutput$1[]) => void;
4090
- }
4091
- /** Mirrors ChatInputStateValue. */
4092
- interface InputSnapshot {
4093
- message: string;
4094
- inputError: string | null;
4095
- messageQueue: QueuedMessage[];
4096
- setMessage: (message: string) => void;
4097
- setInputError: (error: string | null) => void;
4098
- handleSubmit: (e: {
4099
- preventDefault: () => void;
4100
- }, attachments?: Attachment$1[]) => void;
4101
- handleUnqueue: () => {
4102
- content: string;
4103
- attachments: Attachment$1[];
4104
- } | null;
4105
- enqueueMessage: (content: string, attachments: Attachment$1[]) => boolean;
4106
- removeQueueItem: (index: number) => void;
4107
- updateQueueItem: (index: number, content: string) => void;
4108
- }
4109
-
4110
- /**
4111
- * ChatMachine — framework-agnostic state machine for BiChat.
4112
- *
4113
- * Owns all async logic that was previously in ChatContext.tsx:
4114
- * - Session fetch (with race-condition guards)
4115
- * - Message sending + streaming
4116
- * - Slash commands (/debug, /clear, /compact)
4117
- * - HITL question submission / rejection
4118
- * - Message queue (auto-drain)
4119
- * - Rate limiting
4120
- * - Abort / cancel
4121
- *
4122
- * Zero React dependency. Designed for `useSyncExternalStore`:
4123
- * three subscribe/getSnapshot pairs map to the existing 3-context split.
4124
- */
4125
-
4126
- type Listener = () => void;
4127
- declare class ChatMachine {
4128
- private dataSource;
4129
- private rateLimiter;
4130
- private onSessionCreated?;
4131
- private state;
4132
- private abortController;
4133
- private lastSendAttempt;
4134
- /** Prevents fetchSession effect from clobbering state while stream is active. */
4135
- private sendingSessionId;
4136
- /**
4137
- * Monotonic counter bumped on every real session switch. An async op (send
4138
- * stream, post-stream sync, queue drain, resume, HITL) captures it at start
4139
- * and re-checks before writing to the single shared `state.messaging`; a stale
4140
- * epoch means the user navigated to a different session, so the write is
4141
- * dropped instead of bleeding into / clobbering the now-visible session.
4142
- */
4143
- private viewEpoch;
4144
- private fetchCancelled;
4145
- private disposed;
4146
- private reasoningEffortOptions;
4147
- private reasoningEffortOptionSet;
4148
- /** Memoized sessionDebugUsage — avoids unnecessary session re-renders during streaming. */
4149
- private lastSessionDebugUsage;
4150
- /** Interval handle for passive polling when another tab has an active stream. */
4151
- private passivePollingId;
4152
- private sessionListeners;
4153
- private messagingListeners;
4154
- private inputListeners;
4155
- private cachedSessionSnapshot;
4156
- private cachedMessagingSnapshot;
4157
- private cachedInputSnapshot;
4158
- private sessionSnapshotVersion;
4159
- private messagingSnapshotVersion;
4160
- private inputSnapshotVersion;
4161
- private lastSessionSnapshotVersion;
4162
- private lastMessagingSnapshotVersion;
4163
- private lastInputSnapshotVersion;
4164
- readonly setError: (error: string | null) => void;
4165
- readonly retryFetchSession: () => void;
4166
- readonly sendMessage: (content: string, attachments?: Attachment$1[]) => Promise<void>;
4167
- readonly handleRegenerate: (turnId: string, model?: string) => Promise<void>;
4168
- readonly handleEdit: (turnId: string, newContent: string) => Promise<void>;
4169
- readonly handleCopy: (text: string) => Promise<void>;
4170
- readonly handleSubmitQuestionAnswers: (answers: QuestionAnswers) => void;
4171
- readonly handleRejectPendingQuestion: () => Promise<void>;
4172
- readonly retryLastMessage: () => Promise<void>;
4173
- readonly clearStreamError: () => void;
4174
- readonly cancel: () => void;
4175
- readonly setCodeOutputs: (outputs: CodeOutput$1[]) => void;
4176
- readonly setMessage: (message: string) => void;
4177
- readonly setInputError: (error: string | null) => void;
4178
- readonly handleSubmit: (e: {
4179
- preventDefault: () => void;
4180
- }, attachments?: Attachment$1[]) => void;
4181
- readonly handleUnqueue: () => {
4182
- content: string;
4183
- attachments: Attachment$1[];
4184
- } | null;
4185
- readonly enqueueMessage: (content: string, attachments: Attachment$1[]) => boolean;
4186
- readonly removeQueueItem: (index: number) => void;
4187
- readonly updateQueueItem: (index: number, content: string) => void;
4188
- readonly setReasoningEffort: (effort: string) => void;
4189
- readonly setModel: (model: string | undefined) => void;
4190
- constructor(config: ChatMachineConfig);
4191
- private buildReasoningEffortOptions;
4192
- private sanitizeReasoningEffort;
4193
- /**
4194
- * Set the active session ID. Triggers fetch when transitioning to a real
4195
- * session, or resets state for 'new'/undefined.
4196
- */
4197
- setSessionId(id: string | undefined): void;
4198
- /**
4199
- * Update mutable config that may change across parent re-renders.
4200
- * Called from the React provider's useEffect to keep the machine in sync.
4201
- */
4202
- updateConfig(config: Pick<ChatMachineConfig, "dataSource" | "onSessionCreated">): void;
4203
- dispose(): void;
4204
- subscribeSession: (listener: Listener) => (() => void);
4205
- getSessionSnapshot: () => SessionSnapshot;
4206
- subscribeMessaging: (listener: Listener) => (() => void);
4207
- getMessagingSnapshot: () => MessagingSnapshot;
4208
- subscribeInput: (listener: Listener) => (() => void);
4209
- getInputSnapshot: () => InputSnapshot;
4210
- private _updateSession;
4211
- private _notifySession;
4212
- private _updateMessaging;
4213
- private _notifyMessaging;
4214
- private _updateInput;
4215
- private _notifyInput;
4216
- private _persistQueue;
4217
- /**
4218
- * True while `epoch` is still the active view — i.e. the machine has not been
4219
- * disposed and no session switch has happened since `epoch` was captured.
4220
- * Async ops gate their writes to the shared messaging state on this.
4221
- */
4222
- private _isCurrentEpoch;
4223
- /** A send can't start while generating, mid-resume, or with an open question. */
4224
- private _isBlockedForSend;
4225
- /**
4226
- * Send the next queued message, but only if we still own the view (`epoch`)
4227
- * and nothing is blocking (an in-flight generation or an open question). The
4228
- * item is dequeued optimistically and restored to the front if it turns out we
4229
- * can't send when the deferred tick fires — so a queued message is never
4230
- * silently dropped.
4231
- */
4232
- private _drainQueueIfReady;
4233
- private _setDebugModeForSession;
4234
- private _hydrateDebugModeForSession;
4235
- private _setReasoningEffort;
4236
- private _setModel;
4237
- private _fetchSessionIfNeeded;
4238
- /**
4239
- * Sets turns from fetch, preserving pending user-only turns if server hasn't caught up.
4240
- * Applies `turns` + optional `pendingQuestion` in a single messaging update to avoid
4241
- * transient intermediate UI states between separate notifications.
4242
- */
4243
- private _setTurnsFromFetch;
4244
- /**
4245
- * After fetch: if backend has an active stream, either resume (same-browser) or poll (passive).
4246
- */
4247
- private _checkStreamStatusAndResumeOrPoll;
4248
- private _stopPassivePolling;
4249
- private _startPassivePolling;
4250
- private _runResumeStream;
4251
- private _resumeAcceptedRunOrPoll;
4252
- private _setError;
4253
- private _retryFetchSession;
4254
- private _clearStreamError;
4255
- private _notifySessionsUpdated;
4256
- private _cancel;
4257
- private _setCodeOutputs;
4258
- private _setMessage;
4259
- private _setInputError;
4260
- private _executeSlashCommand;
4261
- private _insertOptimisticTurn;
4262
- private _resolveSendSession;
4263
- private _syncSessionFromServer;
4264
- private _runSendStream;
4265
- private _ensureSessionSyncAfterStream;
4266
- private _finalizeSuccessfulSend;
4267
- private _handleSendError;
4268
- private _preservePartialAssistant;
4269
- /**
4270
- * Public entry point (no options). Calls _sendMessageCore internally.
4271
- */
4272
- private _sendMessage;
4273
- /**
4274
- * Internal entry point with options (for regenerate/edit).
4275
- */
4276
- private _sendMessageDirect;
4277
- /**
4278
- * Core send-message logic. Handles slash commands, rate limiting, streaming,
4279
- * session creation, optimistic turns, and auto-queue-drain.
4280
- */
4281
- private _sendMessageCore;
4282
- private _handleThinkingChunk;
4283
- private _handleToolStart;
4284
- private _handleToolEnd;
4285
- /** Match a step to a tool_end event. Use callId when present; fall back to name + agentName. */
4286
- private _matchStep;
4287
- private _retryLastMessage;
4288
- private _handleRegenerate;
4289
- private _handleEdit;
4290
- private _handleCopy;
4291
- private _handleSubmitQuestionAnswers;
4292
- private _handleRejectPendingQuestion;
4293
- private _handleSubmit;
4294
- private _handleUnqueue;
4295
- private _enqueueMessage;
4296
- private _removeQueueItem;
4297
- private _updateQueueItem;
4298
- }
4299
-
4300
- /**
4301
- * SSE stream parser for consuming Server-Sent Events.
4302
- */
4303
-
4304
- interface SSEEvent {
4305
- type: string;
4306
- content?: string;
4307
- error?: string;
4308
- sessionId?: string;
4309
- toolName?: string;
4310
- toolCallId?: string;
4311
- durationMs?: number;
4312
- success?: boolean;
4313
- [key: string]: unknown;
4314
- }
4315
- /**
4316
- * Parses an SSE stream and yields parsed JSON events.
4317
- */
4318
- declare function parseSSEStream(reader: ReadableStreamDefaultReader<Uint8Array>): AsyncGenerator<SSEEvent, void, unknown>;
4319
- /**
4320
- * Parses BiChat SSE stream with normalization and terminal event guarantee.
4321
- *
4322
- * Guarantees that the generator always yields a terminal event (`done` or
4323
- * `error`) as its last item — even when the underlying stream closes silently
4324
- * without one.
4325
- */
4326
- declare function parseBichatStream(reader: ReadableStreamDefaultReader<Uint8Array>): AsyncGenerator<StreamChunk, void, unknown>;
4327
- /**
4328
- * Type-safe version of `parseBichatStream` that yields `StreamEvent`
4329
- * discriminated union members instead of the flat `StreamChunk`.
4330
- *
4331
- * Use this in new code for proper type narrowing on `event.type`.
4332
- */
4333
- declare function parseBichatStreamEvents(reader: ReadableStreamDefaultReader<Uint8Array>): AsyncGenerator<StreamEvent, void, unknown>;
4334
-
4335
- /**
4336
- * Tool label resolution for the Activity Trace.
4337
- *
4338
- * Convention: `BiChat.Tools.{toolName}` for SDK-provided tools.
4339
- * Upstream consumers can extend with their own prefix (e.g., `Ali.Tools.{customTool}`).
4340
- */
4341
- type TranslateFn = (key: string, params?: Record<string, string | number | boolean>) => string;
4342
- /**
4343
- * Resolve a human-readable label for a tool invocation.
4344
- *
4345
- * Lookup order:
4346
- * 1. Consumer prefix (if provided), e.g. `Ali.Tools.custom_tool`
4347
- * 2. SDK default prefix `BiChat.Tools.{name}`
4348
- * 3. Fallback: humanise the raw tool name
4349
- */
4350
- declare function getToolLabel(t: TranslateFn, name: string, args?: string, prefix?: string): string;
4351
-
4352
- /**
4353
- * Utility functions for activity step processing.
4354
- */
4355
-
4356
- /**
4357
- * Group activity steps by agent — top-level steps (no agentName) and
4358
- * agent groups (keyed by agentName).
4359
- */
4360
- declare function groupSteps(steps: ActivityStep[]): {
4361
- topLevel: ActivityStep[];
4362
- agentGroups: [string, ActivityStep[]][];
4363
- };
4364
-
4365
- /**
4366
- * File Utilities
4367
- * Validation, conversion, and formatting for file attachments
4368
- */
4369
- declare const ATTACHMENT_ACCEPT_ATTRIBUTE: string;
4370
- declare function isImageMimeType(mimeType: string): boolean;
4371
- /**
4372
- * Validates a file against size and type constraints
4373
- * @throws Error if validation fails
4374
- */
4375
- declare function validateAttachmentFile(file: File$1, maxSizeBytes?: number): void;
4376
- /**
4377
- * Backward-compatible image validator used by older components/stories.
4378
- */
4379
- declare function validateImageFile(file: File$1, maxSizeBytes?: number): void;
4380
- /**
4381
- * Converts a file to base64 string (without data URL prefix).
4382
- * Prefers FileReader data URLs, then falls back to buffer-based encoding.
4383
- */
4384
- declare function convertToBase64(file: File$1): Promise<string>;
4385
- /**
4386
- * Creates a data URL from base64 string and MIME type
4387
- */
4388
- declare function createDataUrl(base64: string, mimeType: string): string;
4389
- /**
4390
- * Formats file size in human-readable format
4391
- */
4392
- declare function formatFileSize(bytes: number): string;
4393
- /**
4394
- * Validates multiple files don't exceed count limit
4395
- * @throws Error if count exceeds limit
4396
- */
4397
- declare function validateFileCount(currentCount: number, newCount: number, maxCount?: number): void;
4398
-
4399
- interface FileVisual {
4400
- /** Phosphor icon component */
4401
- icon: typeof File$1;
4402
- /** Tailwind text-color classes for the icon (light + dark) */
4403
- iconColor: string;
4404
- /** Tailwind background classes for the icon container (light + dark) */
4405
- bgColor: string;
4406
- /** Short label (PDF, CSV, XLS, etc.) */
4407
- label: string;
4408
- }
4409
- /**
4410
- * Resolves visual metadata (icon, colors, label) for a file based on
4411
- * its MIME type and/or filename. Single source of truth used by
4412
- * AttachmentGrid, SessionArtifactList, DownloadCard, etc.
4413
- */
4414
- declare function getFileVisual(mimeType?: string, filename?: string): FileVisual;
4415
- /** Chart-specific visual (not mime-based, used for artifact type = 'chart') */
4416
- declare const CHART_VISUAL: FileVisual;
4417
-
4418
- /**
4419
- * Groups chat sessions by date relative to today
4420
- * Categories: Today, Yesterday, Last 7 Days, Last 30 Days, Older
4421
- * Sessions within each group are sorted by updatedAt (most recent first)
4422
- */
4423
- declare function groupSessionsByDate(sessions: Session$1[], t?: (key: string) => string): SessionGroup[];
4424
-
4425
- /**
4426
- * Error display utilities for structured RPC error handling.
4427
- * Distinguishes permission-denied errors (amber styling) from generic errors (red styling).
4428
- */
4429
- interface RPCErrorDisplay {
4430
- title: string;
4431
- description: string;
4432
- isPermissionDenied: boolean;
4433
- }
4434
- /**
4435
- * Check whether an error represents a permission-denied / forbidden response.
4436
- */
4437
- declare function isPermissionDeniedError(error: unknown): boolean;
4438
- /**
4439
- * Convert an unknown error into a structured display object.
4440
- */
4441
- declare function toErrorDisplay(error: unknown, fallbackTitle: string): RPCErrorDisplay;
4442
-
4443
- /**
4444
- * Utilities for splitting accumulated assistant content into the distinct
4445
- * text blocks the server emitted.
4446
- *
4447
- * Background: the executor interleaves text with tool calls within one
4448
- * turn — `text → tool_call → text → tool_call → final_text`. Before the
4449
- * backend emitted `text_block_end` markers (iota-uz/iota-sdk#732 M1),
4450
- * all text segments collapsed into one paragraph on the client. Now the
4451
- * server emits a `text_block_end` event before each tool_start and at
4452
- * snapshot time carries byte offsets in `partialMetadata.text_block_offsets`.
4453
- *
4454
- * `splitIntoTextBlocks` is the client-side inverse: given the
4455
- * accumulated content string and the ordered list of byte offsets that
4456
- * mark segment ends, return one entry per segment. The trailing un-closed
4457
- * segment (if any) is included as the last entry.
4458
- */
4459
- interface AssistantTextBlock {
4460
- /** Zero-based index matching the seq carried on text_block_end events. */
4461
- seq: number;
4462
- /** Markdown source for this segment. */
4463
- content: string;
4464
- }
4465
- /**
4466
- * Split an accumulated assistant content string into blocks using byte
4467
- * offsets emitted by the server. Offsets are EXCLUSIVE end markers —
4468
- * i.e. `offsets[0]` is the length of block 0.
4469
- *
4470
- * - When `offsets` is empty or undefined, returns a single block with
4471
- * the full content.
4472
- * - When offsets are provided but content is shorter than the last
4473
- * offset (e.g. stale metadata), offsets beyond the content length are
4474
- * clamped so no crash propagates up.
4475
- * - Trailing content after the last offset is included as an extra
4476
- * block (the un-closed segment during streaming / the final segment
4477
- * after the last tool call).
4478
- */
4479
- declare function splitIntoTextBlocks(content: string, offsets?: ReadonlyArray<number> | null): AssistantTextBlock[];
4480
- /**
4481
- * Normalise partialMetadata.text_block_offsets from a StreamSnapshotPayload
4482
- * into a number[]. Guards against malformed server data (non-array,
4483
- * non-numeric entries) so UI code never has to think about shapes.
4484
- */
4485
- declare function readTextBlockOffsets(partialMetadata?: Record<string, unknown> | null): number[];
4486
-
4487
- /**
4488
- * Hand-mirrored copy of the backend's pkg/httpdto.StreamEventType
4489
- * constant set. Used by subscribeRunEvents / subscribeActiveRuns /
4490
- * openManagedEventSource to register addEventListener handlers that
4491
- * match every `event:` label the server emits.
4492
- *
4493
- * Drift between this file and the Go definition is caught by
4494
- * eventNames.test.ts — the test reads the sibling Go source at test
4495
- * time and diffs the constant set. When the Go file is absent (CI
4496
- * without the SDK sidecar checkout) the drift guard self-skips.
4497
- */
4498
- declare const STREAM_EVENT_TYPES: readonly ["chunk", "content", "thinking", "tool_start", "tool_end", "text_block_end", "snapshot", "interrupt", "citation", "usage", "ping", "stream_started", "done", "cancelled", "error", "failed"];
4499
- type StreamEventType = typeof STREAM_EVENT_TYPES[number];
4500
- /**
4501
- * Subset of {@link STREAM_EVENT_TYPES} that terminates a run from the
4502
- * client's perspective. Callers should close the EventSource and
4503
- * settle their promise on any of these.
4504
- */
4505
- declare const TERMINAL_STREAM_EVENT_TYPES: readonly ["done", "cancelled", "error", "failed"];
4506
- type TerminalStreamEventType = typeof TERMINAL_STREAM_EVENT_TYPES[number];
4507
- /**
4508
- * Narrow + type-guard helper. Returns true when `name` is one of the
4509
- * terminal stream event types. The guard narrows precisely to the
4510
- * terminal subset — callers receiving `true` get {@link TerminalStreamEventType},
4511
- * not the full {@link StreamEventType} union.
4512
- */
4513
- declare function isTerminalEvent(name: string): name is TerminalStreamEventType;
4514
-
4515
- export { ATTACHMENT_ACCEPT_ATTRIBUTE, ActionButton, type ActionButtonIconProps, type ActionButtonLabelProps, type ActionButtonRootProps, type ActionButtonTooltipProps, type ActiveRunDelivery, type ActiveRunSnapshot, type ActiveTab, type ActivityStep, ActivityTrace, type ActivityTraceProps, type AdminStore, _default$1 as Alert, AllChatsList, type AppConfig, _default as ArchiveBanner, ArchivedChatList, type Artifact$1 as Artifact, type ArtifactStore, type AsChildProps, AssistantMessage, type AssistantMessageActionsSlotProps, type AssistantMessageArtifactsSlotProps, type AssistantMessageAvatarSlotProps, type AssistantMessageChartsSlotProps, type AssistantMessageClassNames, type AssistantMessageCodeOutputsSlotProps, type AssistantMessageContentSlotProps, type AssistantMessageExplanationSlotProps, type AssistantMessageProps, type AssistantMessageSlots, type AssistantMessageSourcesSlotProps, type AssistantMessageTablesSlotProps, type AssistantTextBlock, type AssistantTurn$1 as AssistantTurn, AssistantTurnView, type AssistantTurnViewProps, type Attachment$1 as Attachment, MemoizedAttachmentGrid as AttachmentGrid, AttachmentPreview, AttachmentUpload, Avatar, type AvatarFallbackProps, type AvatarImageProps, type AvatarRootProps, AvatarStack, type AvatarStackProps, type BiChatConfig, BiChatLayout, type BiChatLayoutProps, type BichatRPC, Bubble, type BubbleContentProps, type BubbleFooterProps, type BubbleHeaderProps, type BubbleMetadataProps, type BubbleRootProps, type BubbleVariant, CHART_VISUAL, ChartCard, type ChartCardHost, type ChartData, type ChartSeries, type ChatDataSource, ChatHeader, type ChatInputStateValue, ChatMachine, type ChatMachineConfig, type ChatMessagingStateValue, ChatSession, type ChatSessionContextValue, type ChatSessionProps, ChatSessionProvider, type ChatSessionProviderProps, type ChatSessionStateValue, type Citation$1 as Citation, MemoizedCodeBlock as CodeBlock, type CodeOutput$1 as CodeOutput, CodeOutputsPanel, type ColumnMeta, type ColumnStats, type ColumnType, CompactionDoodle, ConfigProvider, ConfirmModal, type ConfirmModalProps, ConfirmationStep, type ConversationTurn$1 as ConversationTurn, type DataTableOptions, DateGroupHeader, DebugPanel, type DebugPanelProps, DefaultErrorContent, DownloadCard, MemoizedEditableText as EditableText, type EditableTextProps, type EditableTextRef, MemoizedEmptyState as EmptyState, type EmptyStateProps, ErrorBoundary, type FileValidationError, type FileVisual, type FormattedCell, HttpDataSource, type HttpDataSourceConfig, type ImageAttachment, type ImageLoadingStatus, ImageModal, InlineQuestionForm, InteractiveTableCard, type IotaContext, IotaContextProvider, ListItemSkeleton, MemoizedLoadingSpinner as LoadingSpinner, type LocaleContext, MemoizedMarkdownRenderer as MarkdownRenderer, MessageActions, MessageInput, type MessageInputProps, type MessageInputRef, MessageList, MessageRole, type MessageTransport, ModelSelector, type PendingQuestion$1 as PendingQuestion, PermissionGuard, type PermissionGuardProps, type Question, type QuestionAnswerData, type QuestionAnswers, QuestionForm, type QuestionOption, QuestionStep, type QueuedMessage, type RPCErrorDisplay, RateLimiter, type RateLimiterConfig, type RegenerateModelOption, type RenderTableData, type RenderTableExport, RetryActionArea, RunEventsConnectError, STREAM_EVENT_TYPES, ScreenReaderAnnouncer, ScrollToBottomButton, MemoizedSearchInput as SearchInput, type SearchInputProps, type Session$1 as Session, type SessionAccess$1 as SessionAccess, type SessionArtifact, SessionArtifactList, SessionArtifactPreview, SessionArtifactsPanel, type SessionGroup, SessionItem, type SessionListResult$1 as SessionListResult, type SessionMember$1 as SessionMember, SessionMembersModal, type SessionMembersModalProps, SessionSkeleton, type SessionStore, type SessionUser$1 as SessionUser, type ShortcutConfig, Sidebar, type SidebarDrawerProps, type SidebarProps, MemoizedSkeleton as Skeleton, SkeletonAvatar, SkeletonCard, SkeletonGroup, type SkeletonGroupProps, type SkeletonProps, SkeletonText, SkipLink, Slot, type SlotProps, type SortState, SourcesPanel, type StreamChunk, StreamError, type StreamEvent, type StreamEventType, StreamingCursor, SystemMessage, TERMINAL_STREAM_EVENT_TYPES, TabbedChartGroup, type TabbedChartGroupProps, TabbedTableGroup, type TabbedTableGroupProps, type TableCardHost, TableExportButton, TableWithExport, type TenantContext, type TerminalStreamEventType, type Theme, type ThemeBorderRadius, type ThemeColors, ThemeProvider, type ThemeSpacing, Toast, type ToastAction, ToastContainer, type ToastItem, type ToastProps, type ToastType, type ToolCall$1 as ToolCall, TouchContextMenu, Turn, type TurnActionsProps, type TurnAssistantProps, TurnBubble, type TurnBubbleClassNames, type TurnBubbleProps, type TurnRootProps, type TurnTimestampProps, type TurnUserProps, MemoizedTypingIndicator as TypingIndicator, type TypingIndicatorProps, type UseActiveRunsOptions, type UseActiveRunsResult, type UseAttachmentsOptions, type UseAttachmentsReturn, type UseAutoScrollOptions, type UseAutoScrollReturn, type UseBichatRouterParams, type UseBichatRouterReturn, type UseDataTableReturn, type UseImageGalleryOptions, type UseImageGalleryReturn, type UseMarkdownCopyOptions, type UseMarkdownCopyReturn, type UseMessageActionsOptions, type UseMessageActionsReturn, type UseSidebarStateReturn, type UseToastReturn, MemoizedUserAvatar as UserAvatar, type UserAvatarProps, type UserContext, MemoizedUserFilter as UserFilter, UserMessage, type UserMessageActionsSlotProps, type UserMessageAttachmentsSlotProps, type UserMessageAvatarSlotProps, type UserMessageClassNames, type UserMessageContentSlotProps, type UserMessageProps, type UserMessageSlots, type UserTurn$1 as UserTurn, UserTurnView, type UserTurnViewProps, WelcomeContent, addCSRFHeader, backdropVariants, buttonVariants, convertToBase64, createDataUrl, createHeadersWithCSRF, createHttpDataSource, darkTheme, dropdownVariants, errorMessageVariants, fadeInUpVariants, fadeInVariants, floatingButtonVariants, formatFileSize, getCSRFToken, getFileVisual, getToolLabel, getValidChildren, groupSessionsByDate, groupSteps, hasPermission, isImageMimeType, isPermissionDeniedError, isTerminalEvent, lightTheme, listItemVariants, messageContainerVariants, messageVariants, parseBichatStream, parseBichatStreamEvents, parseSSEStream, readTextBlockOffsets, scaleFadeVariants, sessionItemVariants, splitIntoTextBlocks, staggerContainerVariants, toErrorDisplay, typingDotVariants, useActionButtonContext, useActiveRuns, useAttachments, useAutoScroll, useAvatarContext, useBichatRouter, useBubbleContext, useChatInput, useChatMessaging, useChatSession, useConfig, useDataTable, useFocusTrap, useHttpDataSourceConfigFromApplet, useImageGallery, useIotaContext, useKeyboardShortcuts, useLongPress, useMarkdownCopy, useMessageActions, useModalLock, useOptionalChatMessaging, useRequiredConfig, useScrollToBottom, useSidebarState, useStreaming, useTheme, useToast, useTranslation, useTurnContext, validateAttachmentFile, validateFileCount, validateImageFile, verbTransitionVariants };