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