@schlessera/brain-ui-react 0.34.1 → 0.36.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 (763) hide show
  1. package/README.md +89 -4
  2. package/dist/components/activity/activity-page.d.ts +17 -5
  3. package/dist/components/activity/activity-page.d.ts.map +1 -1
  4. package/dist/components/activity/activity-page.js +144 -50
  5. package/dist/components/activity/activity-page.js.map +1 -1
  6. package/dist/components/activity/activity-run-detail.d.ts +16 -1
  7. package/dist/components/activity/activity-run-detail.d.ts.map +1 -1
  8. package/dist/components/activity/activity-run-detail.js +47 -4
  9. package/dist/components/activity/activity-run-detail.js.map +1 -1
  10. package/dist/components/activity/activity-run-list.d.ts +7 -1
  11. package/dist/components/activity/activity-run-list.d.ts.map +1 -1
  12. package/dist/components/activity/activity-run-list.js +16 -8
  13. package/dist/components/activity/activity-run-list.js.map +1 -1
  14. package/dist/components/activity/activity-views.d.ts +63 -0
  15. package/dist/components/activity/activity-views.d.ts.map +1 -0
  16. package/dist/components/activity/activity-views.js +52 -0
  17. package/dist/components/activity/activity-views.js.map +1 -0
  18. package/dist/components/activity/approval-card.d.ts +11 -0
  19. package/dist/components/activity/approval-card.d.ts.map +1 -0
  20. package/dist/components/activity/approval-card.js +46 -0
  21. package/dist/components/activity/approval-card.js.map +1 -0
  22. package/dist/components/activity/digest-card.d.ts +3 -0
  23. package/dist/components/activity/digest-card.d.ts.map +1 -1
  24. package/dist/components/activity/digest-card.js +20 -16
  25. package/dist/components/activity/digest-card.js.map +1 -1
  26. package/dist/components/activity/digest-summary.d.ts +19 -0
  27. package/dist/components/activity/digest-summary.d.ts.map +1 -0
  28. package/dist/components/activity/digest-summary.js +20 -0
  29. package/dist/components/activity/digest-summary.js.map +1 -0
  30. package/dist/components/activity/push-switch.d.ts +25 -0
  31. package/dist/components/activity/push-switch.d.ts.map +1 -0
  32. package/dist/components/activity/push-switch.js +14 -0
  33. package/dist/components/activity/push-switch.js.map +1 -0
  34. package/dist/components/activity/push-toggle.d.ts +7 -0
  35. package/dist/components/activity/push-toggle.d.ts.map +1 -1
  36. package/dist/components/activity/push-toggle.js +72 -47
  37. package/dist/components/activity/push-toggle.js.map +1 -1
  38. package/dist/components/activity/span-bits.d.ts.map +1 -1
  39. package/dist/components/activity/span-bits.js +9 -7
  40. package/dist/components/activity/span-bits.js.map +1 -1
  41. package/dist/components/chat/ask-user-card.d.ts +76 -3
  42. package/dist/components/chat/ask-user-card.d.ts.map +1 -1
  43. package/dist/components/chat/ask-user-card.js +208 -149
  44. package/dist/components/chat/ask-user-card.js.map +1 -1
  45. package/dist/components/chat/ask-user-typed.d.ts +42 -0
  46. package/dist/components/chat/ask-user-typed.d.ts.map +1 -0
  47. package/dist/components/chat/ask-user-typed.js +60 -0
  48. package/dist/components/chat/ask-user-typed.js.map +1 -0
  49. package/dist/components/chat/brain-markdown-links.d.ts +2 -1
  50. package/dist/components/chat/brain-markdown-links.d.ts.map +1 -1
  51. package/dist/components/chat/brain-markdown-links.js +3 -4
  52. package/dist/components/chat/brain-markdown-links.js.map +1 -1
  53. package/dist/components/chat/brain-markdown.d.ts.map +1 -1
  54. package/dist/components/chat/brain-markdown.js +4 -2
  55. package/dist/components/chat/brain-markdown.js.map +1 -1
  56. package/dist/components/chat/chat-page.d.ts.map +1 -1
  57. package/dist/components/chat/chat-page.js +24 -9
  58. package/dist/components/chat/chat-page.js.map +1 -1
  59. package/dist/components/chat/composer-view.d.ts +75 -0
  60. package/dist/components/chat/composer-view.d.ts.map +1 -0
  61. package/dist/components/chat/composer-view.js +31 -0
  62. package/dist/components/chat/composer-view.js.map +1 -0
  63. package/dist/components/chat/composer.d.ts +4 -0
  64. package/dist/components/chat/composer.d.ts.map +1 -1
  65. package/dist/components/chat/composer.js +76 -59
  66. package/dist/components/chat/composer.js.map +1 -1
  67. package/dist/components/chat/markdown-content.d.ts +16 -1
  68. package/dist/components/chat/markdown-content.d.ts.map +1 -1
  69. package/dist/components/chat/markdown-content.js +47 -3
  70. package/dist/components/chat/markdown-content.js.map +1 -1
  71. package/dist/components/chat/mermaid-block.d.ts +4 -0
  72. package/dist/components/chat/mermaid-block.d.ts.map +1 -1
  73. package/dist/components/chat/mermaid-block.js +13 -5
  74. package/dist/components/chat/mermaid-block.js.map +1 -1
  75. package/dist/components/chat/mermaid-share.d.ts +2 -1
  76. package/dist/components/chat/mermaid-share.d.ts.map +1 -1
  77. package/dist/components/chat/mermaid-share.js +7 -8
  78. package/dist/components/chat/mermaid-share.js.map +1 -1
  79. package/dist/components/chat/mermaid-viewer.d.ts.map +1 -1
  80. package/dist/components/chat/mermaid-viewer.js +3 -1
  81. package/dist/components/chat/mermaid-viewer.js.map +1 -1
  82. package/dist/components/chat/message-bubble.d.ts +8 -1
  83. package/dist/components/chat/message-bubble.d.ts.map +1 -1
  84. package/dist/components/chat/message-bubble.js +53 -24
  85. package/dist/components/chat/message-bubble.js.map +1 -1
  86. package/dist/components/chat/message-share.d.ts +2 -1
  87. package/dist/components/chat/message-share.d.ts.map +1 -1
  88. package/dist/components/chat/message-share.js +6 -7
  89. package/dist/components/chat/message-share.js.map +1 -1
  90. package/dist/components/chat/renderers/bind.d.ts +39 -0
  91. package/dist/components/chat/renderers/bind.d.ts.map +1 -0
  92. package/dist/components/chat/renderers/bind.js +43 -0
  93. package/dist/components/chat/renderers/bind.js.map +1 -0
  94. package/dist/components/chat/renderers/brain-ui-tools.d.ts +3 -0
  95. package/dist/components/chat/renderers/brain-ui-tools.d.ts.map +1 -0
  96. package/dist/components/chat/renderers/brain-ui-tools.js +41 -0
  97. package/dist/components/chat/renderers/brain-ui-tools.js.map +1 -0
  98. package/dist/components/chat/renderers/claude-tools.d.ts.map +1 -1
  99. package/dist/components/chat/renderers/claude-tools.js +3 -2
  100. package/dist/components/chat/renderers/claude-tools.js.map +1 -1
  101. package/dist/components/chat/renderers/index.d.ts +10 -2
  102. package/dist/components/chat/renderers/index.d.ts.map +1 -1
  103. package/dist/components/chat/renderers/index.js +15 -10
  104. package/dist/components/chat/renderers/index.js.map +1 -1
  105. package/dist/components/chat/session-drawer.d.ts +4 -0
  106. package/dist/components/chat/session-drawer.d.ts.map +1 -1
  107. package/dist/components/chat/session-drawer.js +55 -40
  108. package/dist/components/chat/session-drawer.js.map +1 -1
  109. package/dist/components/chat/session-list.d.ts +41 -0
  110. package/dist/components/chat/session-list.d.ts.map +1 -0
  111. package/dist/components/chat/session-list.js +10 -0
  112. package/dist/components/chat/session-list.js.map +1 -0
  113. package/dist/components/chat/share-block.d.ts.map +1 -1
  114. package/dist/components/chat/share-block.js +12 -11
  115. package/dist/components/chat/share-block.js.map +1 -1
  116. package/dist/components/chat/share-card.js +2 -2
  117. package/dist/components/chat/share-card.js.map +1 -1
  118. package/dist/components/chat/subagent-view.js +1 -1
  119. package/dist/components/chat/subagent-view.js.map +1 -1
  120. package/dist/components/chat/tool-call-timeline.d.ts.map +1 -1
  121. package/dist/components/chat/tool-call-timeline.js +37 -12
  122. package/dist/components/chat/tool-call-timeline.js.map +1 -1
  123. package/dist/components/chat/tool-cards/block-card.d.ts +28 -0
  124. package/dist/components/chat/tool-cards/block-card.d.ts.map +1 -0
  125. package/dist/components/chat/tool-cards/block-card.js +103 -0
  126. package/dist/components/chat/tool-cards/block-card.js.map +1 -0
  127. package/dist/components/chat/tool-cards/image-mask-card.d.ts +70 -0
  128. package/dist/components/chat/tool-cards/image-mask-card.d.ts.map +1 -0
  129. package/dist/components/chat/tool-cards/image-mask-card.js +142 -0
  130. package/dist/components/chat/tool-cards/image-mask-card.js.map +1 -0
  131. package/dist/components/chat/tool-cards/location-card.d.ts +45 -0
  132. package/dist/components/chat/tool-cards/location-card.d.ts.map +1 -0
  133. package/dist/components/chat/tool-cards/location-card.js +128 -0
  134. package/dist/components/chat/tool-cards/location-card.js.map +1 -0
  135. package/dist/components/chat/tool-views.d.ts +15 -4
  136. package/dist/components/chat/tool-views.d.ts.map +1 -1
  137. package/dist/components/chat/tool-views.js +22 -38
  138. package/dist/components/chat/tool-views.js.map +1 -1
  139. package/dist/components/chat/transcript-turn.d.ts +45 -0
  140. package/dist/components/chat/transcript-turn.d.ts.map +1 -0
  141. package/dist/components/chat/transcript-turn.js +25 -0
  142. package/dist/components/chat/transcript-turn.js.map +1 -0
  143. package/dist/components/chat/use-chat-commands.d.ts.map +1 -1
  144. package/dist/components/chat/use-chat-commands.js +13 -16
  145. package/dist/components/chat/use-chat-commands.js.map +1 -1
  146. package/dist/components/chat/welcome-state.d.ts +7 -0
  147. package/dist/components/chat/welcome-state.d.ts.map +1 -1
  148. package/dist/components/chat/welcome-state.js +13 -5
  149. package/dist/components/chat/welcome-state.js.map +1 -1
  150. package/dist/components/connectivity/connection-gate.d.ts.map +1 -1
  151. package/dist/components/connectivity/connection-gate.js +64 -6
  152. package/dist/components/connectivity/connection-gate.js.map +1 -1
  153. package/dist/components/connectivity/login-form.d.ts +31 -0
  154. package/dist/components/connectivity/login-form.d.ts.map +1 -0
  155. package/dist/components/connectivity/login-form.js +19 -0
  156. package/dist/components/connectivity/login-form.js.map +1 -0
  157. package/dist/components/connectivity/login-screen.d.ts +5 -2
  158. package/dist/components/connectivity/login-screen.d.ts.map +1 -1
  159. package/dist/components/connectivity/login-screen.js +41 -31
  160. package/dist/components/connectivity/login-screen.js.map +1 -1
  161. package/dist/components/dev/share-harness.js +1 -1
  162. package/dist/components/dev/share-harness.js.map +1 -1
  163. package/dist/components/files/file-panel.d.ts +1 -1
  164. package/dist/components/files/file-panel.d.ts.map +1 -1
  165. package/dist/components/files/file-panel.js +74 -0
  166. package/dist/components/files/file-panel.js.map +1 -1
  167. package/dist/components/files/file-tree-view.d.ts +45 -0
  168. package/dist/components/files/file-tree-view.d.ts.map +1 -0
  169. package/dist/components/files/file-tree-view.js +51 -0
  170. package/dist/components/files/file-tree-view.js.map +1 -0
  171. package/dist/components/files/file-tree.d.ts +6 -0
  172. package/dist/components/files/file-tree.d.ts.map +1 -1
  173. package/dist/components/files/file-tree.js +39 -43
  174. package/dist/components/files/file-tree.js.map +1 -1
  175. package/dist/components/files/file-viewer-binary.d.ts.map +1 -1
  176. package/dist/components/files/file-viewer-binary.js +3 -2
  177. package/dist/components/files/file-viewer-binary.js.map +1 -1
  178. package/dist/components/files/file-viewer-frame.d.ts +36 -0
  179. package/dist/components/files/file-viewer-frame.d.ts.map +1 -0
  180. package/dist/components/files/file-viewer-frame.js +26 -0
  181. package/dist/components/files/file-viewer-frame.js.map +1 -0
  182. package/dist/components/files/file-viewer.d.ts +5 -0
  183. package/dist/components/files/file-viewer.d.ts.map +1 -1
  184. package/dist/components/files/file-viewer.js +26 -32
  185. package/dist/components/files/file-viewer.js.map +1 -1
  186. package/dist/components/files/frontmatter-chips.d.ts +18 -0
  187. package/dist/components/files/frontmatter-chips.d.ts.map +1 -0
  188. package/dist/components/files/frontmatter-chips.js +11 -0
  189. package/dist/components/files/frontmatter-chips.js.map +1 -0
  190. package/dist/components/files/frontmatter-panel.d.ts +5 -1
  191. package/dist/components/files/frontmatter-panel.d.ts.map +1 -1
  192. package/dist/components/files/frontmatter-panel.js +7 -6
  193. package/dist/components/files/frontmatter-panel.js.map +1 -1
  194. package/dist/components/files/staleness.d.ts +18 -0
  195. package/dist/components/files/staleness.d.ts.map +1 -0
  196. package/dist/components/files/staleness.js +27 -0
  197. package/dist/components/files/staleness.js.map +1 -0
  198. package/dist/components/graph/graph-canvas.d.ts.map +1 -1
  199. package/dist/components/graph/graph-canvas.js +24 -1
  200. package/dist/components/graph/graph-canvas.js.map +1 -1
  201. package/dist/components/graph/graph-controls-column.d.ts +14 -0
  202. package/dist/components/graph/graph-controls-column.d.ts.map +1 -0
  203. package/dist/components/graph/graph-controls-column.js +44 -0
  204. package/dist/components/graph/graph-controls-column.js.map +1 -0
  205. package/dist/components/graph/graph-controls.d.ts +20 -5
  206. package/dist/components/graph/graph-controls.d.ts.map +1 -1
  207. package/dist/components/graph/graph-controls.js +58 -37
  208. package/dist/components/graph/graph-controls.js.map +1 -1
  209. package/dist/components/graph/graph-form.d.ts +82 -0
  210. package/dist/components/graph/graph-form.d.ts.map +1 -0
  211. package/dist/components/graph/graph-form.js +69 -0
  212. package/dist/components/graph/graph-form.js.map +1 -0
  213. package/dist/components/graph/graph-maintenance.d.ts.map +1 -1
  214. package/dist/components/graph/graph-maintenance.js +6 -10
  215. package/dist/components/graph/graph-maintenance.js.map +1 -1
  216. package/dist/components/graph/graph-node-rail.d.ts +13 -0
  217. package/dist/components/graph/graph-node-rail.d.ts.map +1 -0
  218. package/dist/components/graph/graph-node-rail.js +92 -0
  219. package/dist/components/graph/graph-node-rail.js.map +1 -0
  220. package/dist/components/graph/graph-page.d.ts +7 -0
  221. package/dist/components/graph/graph-page.d.ts.map +1 -1
  222. package/dist/components/graph/graph-page.js +102 -12
  223. package/dist/components/graph/graph-page.js.map +1 -1
  224. package/dist/components/graph/graph-scene.d.ts.map +1 -1
  225. package/dist/components/graph/graph-scene.js +100 -24
  226. package/dist/components/graph/graph-scene.js.map +1 -1
  227. package/dist/components/graph/lib/graph-helpers.d.ts +42 -12
  228. package/dist/components/graph/lib/graph-helpers.d.ts.map +1 -1
  229. package/dist/components/graph/lib/graph-helpers.js +33 -41
  230. package/dist/components/graph/lib/graph-helpers.js.map +1 -1
  231. package/dist/components/graph/node-card.d.ts +28 -0
  232. package/dist/components/graph/node-card.d.ts.map +1 -0
  233. package/dist/components/graph/node-card.js +7 -0
  234. package/dist/components/graph/node-card.js.map +1 -0
  235. package/dist/components/graph/node-popover.d.ts +6 -2
  236. package/dist/components/graph/node-popover.d.ts.map +1 -1
  237. package/dist/components/graph/node-popover.js +13 -31
  238. package/dist/components/graph/node-popover.js.map +1 -1
  239. package/dist/components/graph/use-graph-theme.d.ts +32 -4
  240. package/dist/components/graph/use-graph-theme.d.ts.map +1 -1
  241. package/dist/components/graph/use-graph-theme.js +44 -32
  242. package/dist/components/graph/use-graph-theme.js.map +1 -1
  243. package/dist/components/graph/use-node-actions.d.ts +26 -0
  244. package/dist/components/graph/use-node-actions.d.ts.map +1 -0
  245. package/dist/components/graph/use-node-actions.js +54 -0
  246. package/dist/components/graph/use-node-actions.js.map +1 -0
  247. package/dist/components/images/image-share.d.ts +2 -1
  248. package/dist/components/images/image-share.d.ts.map +1 -1
  249. package/dist/components/images/image-share.js +3 -3
  250. package/dist/components/images/image-share.js.map +1 -1
  251. package/dist/components/images/image-viewer.d.ts.map +1 -1
  252. package/dist/components/images/image-viewer.js +3 -1
  253. package/dist/components/images/image-viewer.js.map +1 -1
  254. package/dist/components/images/mask-editor.d.ts.map +1 -1
  255. package/dist/components/images/mask-editor.js +7 -5
  256. package/dist/components/images/mask-editor.js.map +1 -1
  257. package/dist/components/layout/app-shell.d.ts.map +1 -1
  258. package/dist/components/layout/app-shell.js +5 -1
  259. package/dist/components/layout/app-shell.js.map +1 -1
  260. package/dist/components/layout/desktop-palette.d.ts +23 -0
  261. package/dist/components/layout/desktop-palette.d.ts.map +1 -0
  262. package/dist/components/layout/desktop-palette.js +132 -0
  263. package/dist/components/layout/desktop-palette.js.map +1 -0
  264. package/dist/components/layout/key-cap.d.ts +9 -0
  265. package/dist/components/layout/key-cap.d.ts.map +1 -0
  266. package/dist/components/layout/key-cap.js +10 -0
  267. package/dist/components/layout/key-cap.js.map +1 -0
  268. package/dist/components/layout/mobile-tab-bar.d.ts +13 -0
  269. package/dist/components/layout/mobile-tab-bar.d.ts.map +1 -1
  270. package/dist/components/layout/mobile-tab-bar.js +58 -47
  271. package/dist/components/layout/mobile-tab-bar.js.map +1 -1
  272. package/dist/components/layout/shortcut-switch.d.ts +13 -0
  273. package/dist/components/layout/shortcut-switch.d.ts.map +1 -0
  274. package/dist/components/layout/shortcut-switch.js +22 -0
  275. package/dist/components/layout/shortcut-switch.js.map +1 -0
  276. package/dist/components/layout/side-rail.d.ts +24 -0
  277. package/dist/components/layout/side-rail.d.ts.map +1 -1
  278. package/dist/components/layout/side-rail.js +65 -27
  279. package/dist/components/layout/side-rail.js.map +1 -1
  280. package/dist/components/layout/slide-panel.d.ts +12 -2
  281. package/dist/components/layout/slide-panel.d.ts.map +1 -1
  282. package/dist/components/layout/slide-panel.js +11 -2
  283. package/dist/components/layout/slide-panel.js.map +1 -1
  284. package/dist/components/layout/theme.d.ts +22 -0
  285. package/dist/components/layout/theme.d.ts.map +1 -0
  286. package/dist/components/layout/theme.js +44 -0
  287. package/dist/components/layout/theme.js.map +1 -0
  288. package/dist/components/quick-actions/add-form.d.ts +44 -0
  289. package/dist/components/quick-actions/add-form.d.ts.map +1 -0
  290. package/dist/components/quick-actions/add-form.js +30 -0
  291. package/dist/components/quick-actions/add-form.js.map +1 -0
  292. package/dist/components/quick-actions/add-modal.d.ts +7 -0
  293. package/dist/components/quick-actions/add-modal.d.ts.map +1 -1
  294. package/dist/components/quick-actions/add-modal.js +66 -20
  295. package/dist/components/quick-actions/add-modal.js.map +1 -1
  296. package/dist/components/quick-actions/search-modal.d.ts.map +1 -1
  297. package/dist/components/quick-actions/search-modal.js +48 -19
  298. package/dist/components/quick-actions/search-modal.js.map +1 -1
  299. package/dist/components/quick-actions/streaming-modal.d.ts +6 -0
  300. package/dist/components/quick-actions/streaming-modal.d.ts.map +1 -1
  301. package/dist/components/quick-actions/streaming-modal.js +42 -17
  302. package/dist/components/quick-actions/streaming-modal.js.map +1 -1
  303. package/dist/components/quick-actions/streaming-output.d.ts +38 -0
  304. package/dist/components/quick-actions/streaming-output.d.ts.map +1 -0
  305. package/dist/components/quick-actions/streaming-output.js +22 -0
  306. package/dist/components/quick-actions/streaming-output.js.map +1 -0
  307. package/dist/components/quick-actions/whatsup-modal.d.ts +5 -0
  308. package/dist/components/quick-actions/whatsup-modal.d.ts.map +1 -1
  309. package/dist/components/quick-actions/whatsup-modal.js +36 -10
  310. package/dist/components/quick-actions/whatsup-modal.js.map +1 -1
  311. package/dist/components/settings/devices-agents-tab.d.ts +10 -0
  312. package/dist/components/settings/devices-agents-tab.d.ts.map +1 -0
  313. package/dist/components/settings/devices-agents-tab.js +131 -0
  314. package/dist/components/settings/devices-agents-tab.js.map +1 -0
  315. package/dist/components/settings/models-list.d.ts +39 -0
  316. package/dist/components/settings/models-list.d.ts.map +1 -0
  317. package/dist/components/settings/models-list.js +72 -0
  318. package/dist/components/settings/models-list.js.map +1 -0
  319. package/dist/components/settings/models-tab.d.ts +4 -0
  320. package/dist/components/settings/models-tab.d.ts.map +1 -1
  321. package/dist/components/settings/models-tab.js +52 -102
  322. package/dist/components/settings/models-tab.js.map +1 -1
  323. package/dist/components/settings/one-time-agent-credential.d.ts +3 -0
  324. package/dist/components/settings/one-time-agent-credential.d.ts.map +1 -0
  325. package/dist/components/settings/one-time-agent-credential.js +55 -0
  326. package/dist/components/settings/one-time-agent-credential.js.map +1 -0
  327. package/dist/components/settings/passkey-list.d.ts +35 -0
  328. package/dist/components/settings/passkey-list.d.ts.map +1 -0
  329. package/dist/components/settings/passkey-list.js +34 -0
  330. package/dist/components/settings/passkey-list.js.map +1 -0
  331. package/dist/components/settings/passkey-tab.d.ts +3 -0
  332. package/dist/components/settings/passkey-tab.d.ts.map +1 -1
  333. package/dist/components/settings/passkey-tab.js +53 -45
  334. package/dist/components/settings/passkey-tab.js.map +1 -1
  335. package/dist/components/settings/pi-accounts-list.d.ts +27 -0
  336. package/dist/components/settings/pi-accounts-list.d.ts.map +1 -0
  337. package/dist/components/settings/pi-accounts-list.js +15 -0
  338. package/dist/components/settings/pi-accounts-list.js.map +1 -0
  339. package/dist/components/settings/pi-accounts.d.ts +3 -0
  340. package/dist/components/settings/pi-accounts.d.ts.map +1 -1
  341. package/dist/components/settings/pi-accounts.js +73 -55
  342. package/dist/components/settings/pi-accounts.js.map +1 -1
  343. package/dist/components/settings/principal-list.d.ts +37 -0
  344. package/dist/components/settings/principal-list.d.ts.map +1 -0
  345. package/dist/components/settings/principal-list.js +18 -0
  346. package/dist/components/settings/principal-list.js.map +1 -0
  347. package/dist/components/settings/settings-panel.d.ts +10 -3
  348. package/dist/components/settings/settings-panel.d.ts.map +1 -1
  349. package/dist/components/settings/settings-panel.js +80 -6
  350. package/dist/components/settings/settings-panel.js.map +1 -1
  351. package/dist/components/settings/skills-list.d.ts +53 -0
  352. package/dist/components/settings/skills-list.d.ts.map +1 -0
  353. package/dist/components/settings/skills-list.js +28 -0
  354. package/dist/components/settings/skills-list.js.map +1 -0
  355. package/dist/components/settings/skills-tab.d.ts.map +1 -1
  356. package/dist/components/settings/skills-tab.js +65 -38
  357. package/dist/components/settings/skills-tab.js.map +1 -1
  358. package/dist/components/settings/tool-permissions-list.d.ts +18 -0
  359. package/dist/components/settings/tool-permissions-list.d.ts.map +1 -0
  360. package/dist/components/settings/tool-permissions-list.js +6 -0
  361. package/dist/components/settings/tool-permissions-list.js.map +1 -0
  362. package/dist/components/settings/tool-permissions.d.ts +2 -1
  363. package/dist/components/settings/tool-permissions.d.ts.map +1 -1
  364. package/dist/components/settings/tool-permissions.js +33 -16
  365. package/dist/components/settings/tool-permissions.js.map +1 -1
  366. package/dist/components/settings/web-search-chain.d.ts +41 -0
  367. package/dist/components/settings/web-search-chain.d.ts.map +1 -0
  368. package/dist/components/settings/web-search-chain.js +47 -0
  369. package/dist/components/settings/web-search-chain.js.map +1 -0
  370. package/dist/components/settings/web-search-settings.d.ts +4 -7
  371. package/dist/components/settings/web-search-settings.d.ts.map +1 -1
  372. package/dist/components/settings/web-search-settings.js +54 -76
  373. package/dist/components/settings/web-search-settings.js.map +1 -1
  374. package/dist/components/share/share-menu.d.ts.map +1 -1
  375. package/dist/components/share/share-menu.js +24 -4
  376. package/dist/components/share/share-menu.js.map +1 -1
  377. package/dist/components/voice/dictation-sheet.js +3 -3
  378. package/dist/components/voice/dictation-sheet.js.map +1 -1
  379. package/dist/components/voice/mic-button.js +1 -1
  380. package/dist/components/voice/mic-button.js.map +1 -1
  381. package/dist/components/voice/review-card.js +1 -1
  382. package/dist/components/voice/review-card.js.map +1 -1
  383. package/dist/config.d.ts +5 -2
  384. package/dist/config.d.ts.map +1 -1
  385. package/dist/config.js +15 -5
  386. package/dist/config.js.map +1 -1
  387. package/dist/connection.d.ts +12 -0
  388. package/dist/connection.d.ts.map +1 -0
  389. package/dist/connection.js +421 -0
  390. package/dist/connection.js.map +1 -0
  391. package/dist/default-root.d.ts +3 -0
  392. package/dist/default-root.d.ts.map +1 -0
  393. package/dist/default-root.js +16 -0
  394. package/dist/default-root.js.map +1 -0
  395. package/dist/hooks/use-color-scheme.d.ts +14 -0
  396. package/dist/hooks/use-color-scheme.d.ts.map +1 -0
  397. package/dist/hooks/use-color-scheme.js +37 -0
  398. package/dist/hooks/use-color-scheme.js.map +1 -0
  399. package/dist/hooks/use-hash-routes.d.ts.map +1 -1
  400. package/dist/hooks/use-hash-routes.js +4 -2
  401. package/dist/hooks/use-hash-routes.js.map +1 -1
  402. package/dist/hooks/use-media-query.d.ts +7 -0
  403. package/dist/hooks/use-media-query.d.ts.map +1 -0
  404. package/dist/hooks/use-media-query.js +34 -0
  405. package/dist/hooks/use-media-query.js.map +1 -0
  406. package/dist/hooks/use-share-intake.d.ts.map +1 -1
  407. package/dist/hooks/use-share-intake.js +37 -12
  408. package/dist/hooks/use-share-intake.js.map +1 -1
  409. package/dist/hooks/use-vpn-status.d.ts +1 -1
  410. package/dist/hooks/use-vpn-status.d.ts.map +1 -1
  411. package/dist/hooks/use-vpn-status.js +20 -16
  412. package/dist/hooks/use-vpn-status.js.map +1 -1
  413. package/dist/hooks/use-websocket.d.ts +5 -24
  414. package/dist/hooks/use-websocket.d.ts.map +1 -1
  415. package/dist/hooks/use-websocket.js +11 -382
  416. package/dist/hooks/use-websocket.js.map +1 -1
  417. package/dist/hooks/websocket-handlers/activity.d.ts +2 -2
  418. package/dist/hooks/websocket-handlers/activity.d.ts.map +1 -1
  419. package/dist/hooks/websocket-handlers/activity.js +4 -5
  420. package/dist/hooks/websocket-handlers/activity.js.map +1 -1
  421. package/dist/hooks/websocket-handlers/chat.d.ts +1 -0
  422. package/dist/hooks/websocket-handlers/chat.d.ts.map +1 -1
  423. package/dist/hooks/websocket-handlers/chat.js +27 -5
  424. package/dist/hooks/websocket-handlers/chat.js.map +1 -1
  425. package/dist/hooks/websocket-handlers/connection.d.ts.map +1 -1
  426. package/dist/hooks/websocket-handlers/connection.js +4 -6
  427. package/dist/hooks/websocket-handlers/connection.js.map +1 -1
  428. package/dist/hooks/websocket-handlers/mask.d.ts +1 -1
  429. package/dist/hooks/websocket-handlers/mask.d.ts.map +1 -1
  430. package/dist/hooks/websocket-handlers/mask.js +2 -3
  431. package/dist/hooks/websocket-handlers/mask.js.map +1 -1
  432. package/dist/hooks/websocket-handlers/provider.d.ts.map +1 -1
  433. package/dist/hooks/websocket-handlers/provider.js +4 -6
  434. package/dist/hooks/websocket-handlers/provider.js.map +1 -1
  435. package/dist/hooks/websocket-handlers/types.d.ts +6 -2
  436. package/dist/hooks/websocket-handlers/types.d.ts.map +1 -1
  437. package/dist/index.d.ts +5 -3
  438. package/dist/index.d.ts.map +1 -1
  439. package/dist/index.js +6 -3
  440. package/dist/index.js.map +1 -1
  441. package/dist/lib/api-client.d.ts +321 -0
  442. package/dist/lib/api-client.d.ts.map +1 -1
  443. package/dist/lib/api-client.js +243 -213
  444. package/dist/lib/api-client.js.map +1 -1
  445. package/dist/lib/backend.d.ts +19 -2
  446. package/dist/lib/backend.d.ts.map +1 -1
  447. package/dist/lib/backend.js +15 -9
  448. package/dist/lib/backend.js.map +1 -1
  449. package/dist/lib/diff.d.ts +8 -10
  450. package/dist/lib/diff.d.ts.map +1 -1
  451. package/dist/lib/diff.js +26 -53
  452. package/dist/lib/diff.js.map +1 -1
  453. package/dist/lib/format-time.d.ts +3 -0
  454. package/dist/lib/format-time.d.ts.map +1 -0
  455. package/dist/lib/format-time.js +25 -0
  456. package/dist/lib/format-time.js.map +1 -0
  457. package/dist/lib/light-dark.d.ts +37 -0
  458. package/dist/lib/light-dark.d.ts.map +1 -0
  459. package/dist/lib/light-dark.js +83 -0
  460. package/dist/lib/light-dark.js.map +1 -0
  461. package/dist/lib/mermaid-theme.d.ts +7 -2
  462. package/dist/lib/mermaid-theme.d.ts.map +1 -1
  463. package/dist/lib/mermaid-theme.js +125 -203
  464. package/dist/lib/mermaid-theme.js.map +1 -1
  465. package/dist/lib/passkeys.d.ts +6 -3
  466. package/dist/lib/passkeys.d.ts.map +1 -1
  467. package/dist/lib/passkeys.js +10 -4
  468. package/dist/lib/passkeys.js.map +1 -1
  469. package/dist/lib/push-registration.d.ts +10 -0
  470. package/dist/lib/push-registration.d.ts.map +1 -0
  471. package/dist/lib/push-registration.js +44 -0
  472. package/dist/lib/push-registration.js.map +1 -0
  473. package/dist/lib/share-intake.d.ts +2 -1
  474. package/dist/lib/share-intake.d.ts.map +1 -1
  475. package/dist/lib/share-intake.js +3 -3
  476. package/dist/lib/share-intake.js.map +1 -1
  477. package/dist/lib/share.d.ts +4 -3
  478. package/dist/lib/share.d.ts.map +1 -1
  479. package/dist/lib/share.js +6 -7
  480. package/dist/lib/share.js.map +1 -1
  481. package/dist/lib/single-key.d.ts +30 -0
  482. package/dist/lib/single-key.d.ts.map +1 -0
  483. package/dist/lib/single-key.js +45 -0
  484. package/dist/lib/single-key.js.map +1 -0
  485. package/dist/lib/tool-names.d.ts +8 -6
  486. package/dist/lib/tool-names.d.ts.map +1 -1
  487. package/dist/lib/tool-names.js +17 -7
  488. package/dist/lib/tool-names.js.map +1 -1
  489. package/dist/root-context.d.ts +229 -0
  490. package/dist/root-context.d.ts.map +1 -0
  491. package/dist/root-context.js +33 -0
  492. package/dist/root-context.js.map +1 -0
  493. package/dist/root.d.ts +38 -0
  494. package/dist/root.d.ts.map +1 -0
  495. package/dist/root.js +47 -0
  496. package/dist/root.js.map +1 -0
  497. package/dist/stores/activity-state.d.ts +29 -0
  498. package/dist/stores/activity-state.d.ts.map +1 -0
  499. package/dist/stores/activity-state.js +282 -0
  500. package/dist/stores/activity-state.js.map +1 -0
  501. package/dist/stores/activity-store.d.ts +10 -41
  502. package/dist/stores/activity-store.d.ts.map +1 -1
  503. package/dist/stores/activity-store.js +9 -271
  504. package/dist/stores/activity-store.js.map +1 -1
  505. package/dist/stores/chat-state.d.ts +212 -0
  506. package/dist/stores/chat-state.d.ts.map +1 -0
  507. package/dist/stores/chat-state.js +466 -0
  508. package/dist/stores/chat-state.js.map +1 -0
  509. package/dist/stores/chat-store.d.ts +4 -162
  510. package/dist/stores/chat-store.d.ts.map +1 -1
  511. package/dist/stores/chat-store.js +7 -418
  512. package/dist/stores/chat-store.js.map +1 -1
  513. package/dist/stores/connection-state.d.ts +40 -0
  514. package/dist/stores/connection-state.d.ts.map +1 -0
  515. package/dist/stores/connection-state.js +30 -0
  516. package/dist/stores/connection-state.js.map +1 -0
  517. package/dist/stores/connection-store.d.ts +4 -40
  518. package/dist/stores/connection-store.d.ts.map +1 -1
  519. package/dist/stores/connection-store.js +7 -27
  520. package/dist/stores/connection-store.js.map +1 -1
  521. package/dist/stores/create-stores.d.ts +23 -0
  522. package/dist/stores/create-stores.d.ts.map +1 -0
  523. package/dist/stores/create-stores.js +28 -0
  524. package/dist/stores/create-stores.js.map +1 -0
  525. package/dist/stores/file-state.d.ts +53 -0
  526. package/dist/stores/file-state.d.ts.map +1 -0
  527. package/dist/stores/file-state.js +341 -0
  528. package/dist/stores/file-state.js.map +1 -0
  529. package/dist/stores/file-store.d.ts +4 -52
  530. package/dist/stores/file-store.d.ts.map +1 -1
  531. package/dist/stores/file-store.js +7 -300
  532. package/dist/stores/file-store.js.map +1 -1
  533. package/dist/stores/graph-state.d.ts +95 -0
  534. package/dist/stores/graph-state.d.ts.map +1 -0
  535. package/dist/stores/graph-state.js +252 -0
  536. package/dist/stores/graph-state.js.map +1 -0
  537. package/dist/stores/graph-store.d.ts +7 -83
  538. package/dist/stores/graph-store.d.ts.map +1 -1
  539. package/dist/stores/graph-store.js +8 -249
  540. package/dist/stores/graph-store.js.map +1 -1
  541. package/dist/stores/mask-state.d.ts +21 -0
  542. package/dist/stores/mask-state.d.ts.map +1 -0
  543. package/dist/stores/mask-state.js +9 -0
  544. package/dist/stores/mask-state.js.map +1 -0
  545. package/dist/stores/mask-store.d.ts +4 -21
  546. package/dist/stores/mask-store.d.ts.map +1 -1
  547. package/dist/stores/mask-store.js +7 -6
  548. package/dist/stores/mask-store.js.map +1 -1
  549. package/dist/stores/principal-state.d.ts +16 -0
  550. package/dist/stores/principal-state.d.ts.map +1 -0
  551. package/dist/stores/principal-state.js +31 -0
  552. package/dist/stores/principal-state.js.map +1 -0
  553. package/dist/stores/principal-store.d.ts +5 -0
  554. package/dist/stores/principal-store.d.ts.map +1 -0
  555. package/dist/stores/principal-store.js +8 -0
  556. package/dist/stores/principal-store.js.map +1 -0
  557. package/dist/stores/provider-state.d.ts +24 -0
  558. package/dist/stores/provider-state.d.ts.map +1 -0
  559. package/dist/stores/provider-state.js +68 -0
  560. package/dist/stores/provider-state.js.map +1 -0
  561. package/dist/stores/provider-store.d.ts +4 -23
  562. package/dist/stores/provider-store.d.ts.map +1 -1
  563. package/dist/stores/provider-store.js +7 -64
  564. package/dist/stores/provider-store.js.map +1 -1
  565. package/dist/stores/share-state.d.ts +29 -0
  566. package/dist/stores/share-state.d.ts.map +1 -0
  567. package/dist/stores/share-state.js +21 -0
  568. package/dist/stores/share-state.js.map +1 -0
  569. package/dist/stores/share-store.d.ts +4 -28
  570. package/dist/stores/share-store.d.ts.map +1 -1
  571. package/dist/stores/share-store.js +7 -18
  572. package/dist/stores/share-store.js.map +1 -1
  573. package/dist/stores/store-environment.d.ts +10 -0
  574. package/dist/stores/store-environment.d.ts.map +1 -0
  575. package/dist/stores/store-environment.js +2 -0
  576. package/dist/stores/store-environment.js.map +1 -0
  577. package/dist/stores/ui-state.d.ts +71 -0
  578. package/dist/stores/ui-state.d.ts.map +1 -0
  579. package/dist/stores/ui-state.js +58 -0
  580. package/dist/stores/ui-state.js.map +1 -0
  581. package/dist/stores/ui-store.d.ts +4 -45
  582. package/dist/stores/ui-store.d.ts.map +1 -1
  583. package/dist/stores/ui-store.js +7 -36
  584. package/dist/stores/ui-store.js.map +1 -1
  585. package/dist/styles.css +1 -1
  586. package/dist/theme.css +150 -97
  587. package/dist/voice/asr-clients.d.ts +2 -1
  588. package/dist/voice/asr-clients.d.ts.map +1 -1
  589. package/dist/voice/asr-clients.js +16 -17
  590. package/dist/voice/asr-clients.js.map +1 -1
  591. package/dist/voice/use-dictation.d.ts.map +1 -1
  592. package/dist/voice/use-dictation.js +12 -8
  593. package/dist/voice/use-dictation.js.map +1 -1
  594. package/dist/voice/voice-state.d.ts +25 -0
  595. package/dist/voice/voice-state.d.ts.map +1 -0
  596. package/dist/voice/voice-state.js +29 -0
  597. package/dist/voice/voice-state.js.map +1 -0
  598. package/dist/voice/voice-store.d.ts +4 -25
  599. package/dist/voice/voice-store.d.ts.map +1 -1
  600. package/dist/voice/voice-store.js +7 -26
  601. package/dist/voice/voice-store.js.map +1 -1
  602. package/package.json +3 -2
  603. package/src/components/activity/activity-page.tsx +334 -160
  604. package/src/components/activity/activity-run-detail.tsx +81 -47
  605. package/src/components/activity/activity-run-list.tsx +27 -59
  606. package/src/components/activity/activity-views.tsx +155 -0
  607. package/src/components/activity/approval-card.tsx +80 -0
  608. package/src/components/activity/digest-card.tsx +25 -61
  609. package/src/components/activity/digest-summary.tsx +52 -0
  610. package/src/components/activity/push-switch.tsx +62 -0
  611. package/src/components/activity/push-toggle.tsx +51 -81
  612. package/src/components/activity/span-bits.tsx +8 -7
  613. package/src/components/chat/ask-user-card.tsx +292 -356
  614. package/src/components/chat/ask-user-typed.ts +77 -0
  615. package/src/components/chat/brain-markdown-links.tsx +4 -4
  616. package/src/components/chat/brain-markdown.tsx +4 -2
  617. package/src/components/chat/chat-page.tsx +38 -9
  618. package/src/components/chat/composer-view.tsx +194 -0
  619. package/src/components/chat/composer.tsx +117 -296
  620. package/src/components/chat/markdown-content.tsx +53 -2
  621. package/src/components/chat/mermaid-block.tsx +13 -5
  622. package/src/components/chat/mermaid-share.ts +8 -7
  623. package/src/components/chat/mermaid-viewer.tsx +3 -1
  624. package/src/components/chat/message-bubble.tsx +78 -94
  625. package/src/components/chat/message-share.ts +7 -7
  626. package/src/components/chat/renderers/bind.tsx +94 -0
  627. package/src/components/chat/renderers/brain-ui-tools.tsx +56 -0
  628. package/src/components/chat/renderers/claude-tools.tsx +3 -2
  629. package/src/components/chat/renderers/index.ts +15 -10
  630. package/src/components/chat/session-drawer.tsx +60 -138
  631. package/src/components/chat/session-list.tsx +113 -0
  632. package/src/components/chat/share-block.tsx +16 -12
  633. package/src/components/chat/share-card.tsx +2 -2
  634. package/src/components/chat/subagent-view.tsx +4 -4
  635. package/src/components/chat/tool-call-timeline.tsx +59 -22
  636. package/src/components/chat/tool-cards/block-card.tsx +145 -0
  637. package/src/components/chat/tool-cards/image-mask-card.tsx +214 -0
  638. package/src/components/chat/tool-cards/location-card.tsx +159 -0
  639. package/src/components/chat/tool-views.tsx +23 -73
  640. package/src/components/chat/transcript-turn.tsx +108 -0
  641. package/src/components/chat/use-chat-commands.ts +14 -16
  642. package/src/components/chat/welcome-state.tsx +36 -91
  643. package/src/components/connectivity/connection-gate.tsx +80 -9
  644. package/src/components/connectivity/login-form.tsx +122 -0
  645. package/src/components/connectivity/login-screen.tsx +45 -100
  646. package/src/components/dev/share-harness.tsx +2 -2
  647. package/src/components/files/file-panel.tsx +168 -0
  648. package/src/components/files/file-tree-view.tsx +127 -0
  649. package/src/components/files/file-tree.tsx +55 -109
  650. package/src/components/files/file-viewer-binary.tsx +3 -2
  651. package/src/components/files/file-viewer-frame.tsx +113 -0
  652. package/src/components/files/file-viewer.tsx +40 -95
  653. package/src/components/files/frontmatter-chips.tsx +42 -0
  654. package/src/components/files/frontmatter-panel.tsx +6 -71
  655. package/src/components/files/staleness.ts +29 -0
  656. package/src/components/graph/graph-canvas.tsx +24 -1
  657. package/src/components/graph/graph-controls-column.tsx +92 -0
  658. package/src/components/graph/graph-controls.tsx +83 -127
  659. package/src/components/graph/graph-form.tsx +183 -0
  660. package/src/components/graph/graph-maintenance.tsx +9 -14
  661. package/src/components/graph/graph-node-rail.tsx +147 -0
  662. package/src/components/graph/graph-page.tsx +189 -49
  663. package/src/components/graph/graph-scene.tsx +200 -30
  664. package/src/components/graph/lib/graph-helpers.ts +65 -43
  665. package/src/components/graph/node-card.tsx +64 -0
  666. package/src/components/graph/node-popover.tsx +28 -117
  667. package/src/components/graph/use-graph-theme.ts +69 -32
  668. package/src/components/graph/use-node-actions.ts +56 -0
  669. package/src/components/images/image-share.ts +4 -2
  670. package/src/components/images/image-viewer.tsx +3 -1
  671. package/src/components/images/mask-editor.tsx +7 -4
  672. package/src/components/layout/app-shell.tsx +7 -1
  673. package/src/components/layout/desktop-palette.tsx +151 -0
  674. package/src/components/layout/key-cap.tsx +15 -0
  675. package/src/components/layout/mobile-tab-bar.tsx +80 -157
  676. package/src/components/layout/shortcut-switch.tsx +32 -0
  677. package/src/components/layout/side-rail.tsx +70 -150
  678. package/src/components/layout/slide-panel.tsx +29 -2
  679. package/src/components/layout/theme.tsx +67 -0
  680. package/src/components/quick-actions/add-form.tsx +188 -0
  681. package/src/components/quick-actions/add-modal.tsx +68 -144
  682. package/src/components/quick-actions/search-modal.tsx +49 -19
  683. package/src/components/quick-actions/streaming-modal.tsx +44 -71
  684. package/src/components/quick-actions/streaming-output.tsx +112 -0
  685. package/src/components/quick-actions/whatsup-modal.tsx +38 -60
  686. package/src/components/settings/devices-agents-tab.tsx +139 -0
  687. package/src/components/settings/models-list.tsx +299 -0
  688. package/src/components/settings/models-tab.tsx +63 -337
  689. package/src/components/settings/one-time-agent-credential.tsx +131 -0
  690. package/src/components/settings/passkey-list.tsx +201 -0
  691. package/src/components/settings/passkey-tab.tsx +53 -197
  692. package/src/components/settings/pi-accounts-list.tsx +128 -0
  693. package/src/components/settings/pi-accounts.tsx +71 -170
  694. package/src/components/settings/principal-list.tsx +172 -0
  695. package/src/components/settings/settings-panel.tsx +245 -19
  696. package/src/components/settings/skills-list.tsx +276 -0
  697. package/src/components/settings/skills-tab.tsx +82 -269
  698. package/src/components/settings/tool-permissions-list.tsx +54 -0
  699. package/src/components/settings/tool-permissions.tsx +27 -46
  700. package/src/components/settings/web-search-chain.tsx +300 -0
  701. package/src/components/settings/web-search-settings.tsx +58 -328
  702. package/src/components/share/share-menu.tsx +19 -4
  703. package/src/components/voice/dictation-sheet.tsx +5 -5
  704. package/src/components/voice/mic-button.tsx +1 -1
  705. package/src/components/voice/review-card.tsx +1 -1
  706. package/src/config.ts +21 -7
  707. package/src/connection.ts +443 -0
  708. package/src/default-root.ts +16 -0
  709. package/src/hooks/use-color-scheme.ts +36 -0
  710. package/src/hooks/use-hash-routes.ts +4 -2
  711. package/src/hooks/use-media-query.ts +32 -0
  712. package/src/hooks/use-share-intake.ts +32 -12
  713. package/src/hooks/use-vpn-status.ts +23 -15
  714. package/src/hooks/use-websocket.ts +12 -426
  715. package/src/hooks/websocket-handlers/activity.ts +4 -5
  716. package/src/hooks/websocket-handlers/chat.ts +26 -5
  717. package/src/hooks/websocket-handlers/connection.ts +4 -6
  718. package/src/hooks/websocket-handlers/mask.ts +2 -3
  719. package/src/hooks/websocket-handlers/provider.ts +4 -6
  720. package/src/hooks/websocket-handlers/types.ts +6 -2
  721. package/src/index.ts +7 -3
  722. package/src/lib/api-client.ts +446 -365
  723. package/src/lib/backend.ts +20 -10
  724. package/src/lib/diff.ts +28 -62
  725. package/src/lib/format-time.ts +20 -0
  726. package/src/lib/light-dark.ts +83 -0
  727. package/src/lib/mermaid-theme.ts +183 -214
  728. package/src/lib/passkeys.ts +12 -4
  729. package/src/lib/push-registration.ts +46 -0
  730. package/src/lib/share-intake.ts +6 -3
  731. package/src/lib/share.ts +7 -4
  732. package/src/lib/single-key.ts +47 -0
  733. package/src/lib/tool-names.ts +31 -8
  734. package/src/root-context.tsx +40 -0
  735. package/src/root.ts +83 -0
  736. package/src/stores/activity-state.ts +295 -0
  737. package/src/stores/activity-store.ts +11 -285
  738. package/src/stores/chat-state.ts +795 -0
  739. package/src/stores/chat-store.ts +11 -705
  740. package/src/stores/connection-state.ts +78 -0
  741. package/src/stores/connection-store.ts +11 -76
  742. package/src/stores/create-stores.ts +31 -0
  743. package/src/stores/file-state.ts +399 -0
  744. package/src/stores/file-store.ts +9 -360
  745. package/src/stores/graph-state.ts +368 -0
  746. package/src/stores/graph-store.ts +10 -355
  747. package/src/stores/mask-state.ts +30 -0
  748. package/src/stores/mask-store.ts +10 -27
  749. package/src/stores/principal-state.ts +42 -0
  750. package/src/stores/principal-store.ts +11 -0
  751. package/src/stores/provider-state.ts +103 -0
  752. package/src/stores/provider-store.ts +10 -95
  753. package/src/stores/share-state.ts +56 -0
  754. package/src/stores/share-store.ts +11 -54
  755. package/src/stores/store-environment.ts +10 -0
  756. package/src/stores/ui-state.ts +143 -0
  757. package/src/stores/ui-store.ts +11 -93
  758. package/src/styles.css +4 -1
  759. package/src/theme.css +150 -97
  760. package/src/voice/asr-clients.ts +17 -17
  761. package/src/voice/use-dictation.ts +11 -8
  762. package/src/voice/voice-state.ts +57 -0
  763. package/src/voice/voice-store.ts +11 -55
@@ -0,0 +1,466 @@
1
+ import { createStore } from "zustand/vanilla";
2
+ /** Retained transcript buffers beyond the active one (LRU-evicted). */
3
+ const MAX_BUFFERS = 8;
4
+ function emptyChat() {
5
+ return { messages: [], isStreaming: false, askUser: null, lastTouched: Date.now() };
6
+ }
7
+ /** Frozen empty buffer for selectors when nothing is in view. */
8
+ const EMPTY_CHAT = Object.freeze({
9
+ messages: Object.freeze([]),
10
+ isStreaming: false,
11
+ askUser: null,
12
+ lastTouched: 0,
13
+ });
14
+ /** The buffer currently in view (draft when no session is bound). */
15
+ export function activeChat(state) {
16
+ if (state.activeSessionId)
17
+ return state.buffers[state.activeSessionId] ?? EMPTY_CHAT;
18
+ return state.draft ?? EMPTY_CHAT;
19
+ }
20
+ /** True when ANY buffer is streaming (service-worker busy check, etc.). */
21
+ export function anyStreaming(state) {
22
+ if (state.draft?.isStreaming)
23
+ return true;
24
+ return Object.values(state.buffers).some((b) => b.isStreaming);
25
+ }
26
+ /** Append text to the last part if it has the same kind, else start a new part. */
27
+ function appendPart(parts, kind, text) {
28
+ const last = parts[parts.length - 1];
29
+ if (last && last.kind === kind) {
30
+ return [...parts.slice(0, -1), { kind, text: last.text + text }];
31
+ }
32
+ return [...parts, { kind, text }];
33
+ }
34
+ /** Free object URLs held by live message previews before dropping them. */
35
+ function revokeAttachmentUrls(messages) {
36
+ for (const m of messages) {
37
+ for (const a of m.attachments ?? []) {
38
+ if (a.previewUrl.startsWith("blob:"))
39
+ URL.revokeObjectURL(a.previewUrl);
40
+ }
41
+ }
42
+ }
43
+ /**
44
+ * Every tool call waiting on the user, across every buffer (D37: an approval
45
+ * that arrived while you were reading something else cannot only exist as a
46
+ * scroll position — the Actions pane lists it beside the inbox). The key is
47
+ * the buffer's, so the decision can be resolved on the right transcript.
48
+ */
49
+ export function pendingApprovals(state) {
50
+ const out = [];
51
+ const scan = (key, chat) => {
52
+ if (!chat)
53
+ return;
54
+ for (const message of chat.messages) {
55
+ for (const tool of message.toolCalls)
56
+ if (tool.status === "pending_approval")
57
+ out.push({ key, tool });
58
+ }
59
+ };
60
+ for (const [id, chat] of Object.entries(state.buffers))
61
+ scan(id, chat);
62
+ scan(null, state.draft);
63
+ return out;
64
+ }
65
+ /** Evict least-recently-touched non-active buffers beyond MAX_BUFFERS. */
66
+ function evictStale(buffers, activeSessionId) {
67
+ const ids = Object.keys(buffers);
68
+ if (ids.length <= MAX_BUFFERS)
69
+ return buffers;
70
+ const evictable = ids
71
+ .filter((id) => id !== activeSessionId && !buffers[id].isStreaming)
72
+ .sort((a, b) => buffers[a].lastTouched - buffers[b].lastTouched);
73
+ const next = { ...buffers };
74
+ for (const id of evictable.slice(0, ids.length - MAX_BUFFERS)) {
75
+ revokeAttachmentUrls(next[id].messages);
76
+ delete next[id];
77
+ }
78
+ return next;
79
+ }
80
+ export function createChatStore(env, provider) {
81
+ let messageCounter = 0;
82
+ function nextId() {
83
+ return `msg-${++messageCounter}-${Date.now()}`;
84
+ }
85
+ const SESSION_ID_KEY = env.storageKey("brain-sessionId");
86
+ /**
87
+ * Persist the active session id to localStorage when a DOM is present (the
88
+ * browser). A no-op in non-DOM environments (tests, SSR) so creating the store
89
+ * never throws on a missing `localStorage`.
90
+ */
91
+ function persistSessionId(id) {
92
+ const storage = env.storage();
93
+ if (!storage)
94
+ return;
95
+ if (id)
96
+ env.storage()?.setItem(SESSION_ID_KEY, id);
97
+ else
98
+ env.storage()?.removeItem(SESSION_ID_KEY);
99
+ }
100
+ function readPersistedSessionId() {
101
+ const storage = env.storage();
102
+ if (!storage)
103
+ return null;
104
+ return storage.getItem(SESSION_ID_KEY);
105
+ }
106
+ return createStore((set, get) => {
107
+ /**
108
+ * Immutably update one buffer. Draft mutations (key null) create the draft
109
+ * on demand; session mutations require an existing buffer — a frame for an
110
+ * evicted/never-opened session must not materialize a partial transcript
111
+ * (the view heals via session_resume instead).
112
+ */
113
+ function mutateBuffer(key, fn, createIfMissing = false) {
114
+ set((state) => {
115
+ if (key === null) {
116
+ const draft = state.draft ?? emptyChat();
117
+ return { draft: { ...draft, ...fn(draft), lastTouched: Date.now() } };
118
+ }
119
+ const existing = state.buffers[key] ?? (createIfMissing ? emptyChat() : undefined);
120
+ if (!existing)
121
+ return state;
122
+ return {
123
+ buffers: {
124
+ ...state.buffers,
125
+ [key]: { ...existing, ...fn(existing), lastTouched: Date.now() },
126
+ },
127
+ };
128
+ });
129
+ }
130
+ /** Update the last message of a buffer when it is an assistant message. */
131
+ function mutateLastAssistant(key, fn, extra) {
132
+ mutateBuffer(key, (chat) => {
133
+ const msgs = [...chat.messages];
134
+ // The last ASSISTANT message, not the last message.
135
+ //
136
+ // A follow-up sent mid-stream appends a user message to the end of the
137
+ // buffer while the assistant is still streaming into the message before
138
+ // it. Indexing the end therefore aimed every subsequent delta at the
139
+ // user's own message, where `role === "assistant"` failed and the write
140
+ // was silently discarded — the turn kept running and its output stopped
141
+ // appearing. Scanning backwards costs nothing at these lengths and
142
+ // leaves single-message behaviour identical.
143
+ let index = -1;
144
+ for (let i = msgs.length - 1; i >= 0; i--) {
145
+ if (msgs[i].role === "assistant") {
146
+ index = i;
147
+ break;
148
+ }
149
+ }
150
+ let out = {};
151
+ if (index !== -1) {
152
+ msgs[index] = fn(msgs[index]);
153
+ out = { messages: msgs };
154
+ }
155
+ return extra ? { ...out, ...extra(chat) } : out;
156
+ });
157
+ }
158
+ return {
159
+ buffers: {},
160
+ draft: null,
161
+ pendingDraftId: null,
162
+ // localStorage (not sessionStorage) so the active session id survives the
163
+ // PWA process being killed on mobile — that durability is what lets a cold
164
+ // relaunch re-request the full transcript instead of showing nothing.
165
+ activeSessionId: readPersistedSessionId(),
166
+ runStates: {},
167
+ queueNotes: {},
168
+ backendIds: {},
169
+ // createIfMissing: a user-initiated send must never be dropped, even when
170
+ // the active session's buffer hasn't been materialized yet (cold start
171
+ // racing the history replay).
172
+ addUserMessage: (key, text, source, attachments) => mutateBuffer(key, (chat) => ({
173
+ messages: [
174
+ ...chat.messages,
175
+ {
176
+ id: nextId(),
177
+ role: "user",
178
+ content: text,
179
+ toolCalls: [],
180
+ parts: [],
181
+ isStreaming: false,
182
+ timestamp: Date.now(),
183
+ source: source ?? "typed",
184
+ ...(attachments && attachments.length > 0
185
+ ? { attachments, attachmentCount: attachments.length }
186
+ : {}),
187
+ },
188
+ ],
189
+ }), true),
190
+ startAssistantMessage: (key, turnId) => mutateBuffer(key, (chat) => ({
191
+ messages: [
192
+ ...chat.messages,
193
+ {
194
+ id: nextId(),
195
+ role: "assistant",
196
+ content: "",
197
+ thinking: "",
198
+ toolCalls: [],
199
+ parts: [],
200
+ isStreaming: true,
201
+ timestamp: Date.now(),
202
+ ...(turnId ? { turnId } : {}),
203
+ },
204
+ ],
205
+ isStreaming: true,
206
+ })),
207
+ appendText: (key, text) => mutateLastAssistant(key, (last) => ({
208
+ ...last,
209
+ content: last.content + text,
210
+ parts: appendPart(last.parts, "text", text),
211
+ })),
212
+ appendThinking: (key, text) => mutateLastAssistant(key, (last) => ({
213
+ ...last,
214
+ thinking: (last.thinking || "") + text,
215
+ parts: appendPart(last.parts, "thinking", text),
216
+ })),
217
+ startToolCall: (key, toolUseId, toolName) => mutateLastAssistant(key, (last) => ({
218
+ ...last,
219
+ parts: [...last.parts, { kind: "tool", toolIndex: last.toolCalls.length }],
220
+ toolCalls: [
221
+ ...last.toolCalls,
222
+ {
223
+ id: toolUseId,
224
+ name: toolName,
225
+ input: {},
226
+ inputJson: "",
227
+ status: "streaming",
228
+ startedAt: Date.now(),
229
+ },
230
+ ],
231
+ })),
232
+ appendToolInput: (key, partialJson) => mutateLastAssistant(key, (last) => {
233
+ if (last.toolCalls.length === 0)
234
+ return last;
235
+ const tools = [...last.toolCalls];
236
+ const lastTool = tools[tools.length - 1];
237
+ tools[tools.length - 1] = {
238
+ ...lastTool,
239
+ inputJson: lastTool.inputJson + partialJson,
240
+ };
241
+ return { ...last, toolCalls: tools };
242
+ }),
243
+ completeToolCall: (key, toolUseId, toolName, input) => mutateLastAssistant(key, (last) => ({
244
+ ...last,
245
+ toolCalls: last.toolCalls.map((t) => t.id === toolUseId || (t.name === toolName && t.status === "streaming")
246
+ ? {
247
+ ...t,
248
+ id: toolUseId,
249
+ input,
250
+ status: "complete",
251
+ // Input finished streaming — execution starts about now
252
+ startedAt: Date.now(),
253
+ }
254
+ : t),
255
+ })),
256
+ requestToolApproval: (key, toolUseId, toolName, input, _description, kind) => mutateLastAssistant(key, (last) => {
257
+ // Check if tool call already exists (from streaming)
258
+ const existingIdx = last.toolCalls.findIndex((t) => t.id === toolUseId || (t.name === toolName && t.status === "streaming"));
259
+ const tools = [...last.toolCalls];
260
+ const toolCall = {
261
+ id: toolUseId,
262
+ name: toolName,
263
+ input,
264
+ inputJson: JSON.stringify(input, null, 2),
265
+ status: "pending_approval",
266
+ ...(kind ? { approvalKind: kind } : {}),
267
+ };
268
+ let parts = last.parts;
269
+ if (existingIdx >= 0) {
270
+ tools[existingIdx] = toolCall;
271
+ }
272
+ else {
273
+ // Approval request for a tool that never streamed a start event —
274
+ // give it a chronological slot too.
275
+ parts = [...parts, { kind: "tool", toolIndex: tools.length }];
276
+ tools.push(toolCall);
277
+ }
278
+ return { ...last, toolCalls: tools, parts };
279
+ }),
280
+ resolveToolApproval: (key, toolUseId, approved) => mutateLastAssistant(key, (last) => ({
281
+ ...last,
282
+ toolCalls: last.toolCalls.map((t) => t.id === toolUseId
283
+ ? {
284
+ ...t,
285
+ status: approved ? "approved" : "denied",
286
+ // Don't let approval wait time inflate the duration badge
287
+ ...(approved ? { startedAt: Date.now() } : {}),
288
+ }
289
+ : t),
290
+ })),
291
+ setToolResult: (key, toolUseId, output, isError) => mutateLastAssistant(key, (last) => ({
292
+ ...last,
293
+ toolCalls: last.toolCalls.map((t) => t.id === toolUseId
294
+ ? {
295
+ ...t,
296
+ output,
297
+ isError,
298
+ status: "complete",
299
+ endedAt: Date.now(),
300
+ }
301
+ : t),
302
+ })),
303
+ setAskUserRequest: (key, requestId, questions) => mutateBuffer(key, (chat) => {
304
+ const exchange = { requestId, questions };
305
+ const msgs = [...chat.messages];
306
+ const lastIdx = msgs.length - 1;
307
+ const last = msgs[lastIdx];
308
+ if (last?.role === "assistant") {
309
+ msgs[lastIdx] = {
310
+ ...last,
311
+ askUserExchanges: [...(last.askUserExchanges ?? []), exchange],
312
+ };
313
+ }
314
+ return { messages: msgs, askUser: exchange };
315
+ }),
316
+ submitAskUserAnswers: (key, requestId, answers, annotations, typed) => mutateBuffer(key, (chat) => {
317
+ const answeredAt = Date.now();
318
+ const update = (e) => e.requestId === requestId
319
+ ? { ...e, answers, annotations, answeredAt, ...(typed ? { typed: true } : {}) }
320
+ : e;
321
+ const msgs = chat.messages.map((m) => m.askUserExchanges?.some((e) => e.requestId === requestId)
322
+ ? { ...m, askUserExchanges: m.askUserExchanges.map(update) }
323
+ : m);
324
+ const askUser = chat.askUser?.requestId === requestId ? update(chat.askUser) : chat.askUser;
325
+ return { messages: msgs, askUser };
326
+ }),
327
+ cancelAskUser: (key, requestId) => mutateBuffer(key, (chat) => {
328
+ const update = (e) => e.requestId === requestId ? { ...e, cancelled: true } : e;
329
+ const msgs = chat.messages.map((m) => m.askUserExchanges?.some((e) => e.requestId === requestId)
330
+ ? { ...m, askUserExchanges: m.askUserExchanges.map(update) }
331
+ : m);
332
+ const askUser = chat.askUser?.requestId === requestId ? update(chat.askUser) : chat.askUser;
333
+ return { messages: msgs, askUser };
334
+ }),
335
+ clearAskUser: (key) => mutateBuffer(key, () => ({ askUser: null })),
336
+ finishAssistantMessage: (key) => mutateLastAssistant(key, (last) => ({ ...last, isStreaming: false }), () => ({ isStreaming: false })),
337
+ setMessageBlocks: (key, blocks, turnId) => mutateBuffer(key, (chat) => {
338
+ const msgs = [...chat.messages];
339
+ let index = -1;
340
+ if (turnId) {
341
+ for (let i = msgs.length - 1; i >= 0; i--) {
342
+ if (msgs[i].role === "assistant" && msgs[i].turnId === turnId) {
343
+ index = i;
344
+ break;
345
+ }
346
+ }
347
+ }
348
+ if (index === -1) {
349
+ // No message carries the turn (an optimistic message opened by
350
+ // the composer, or a frame without one): the last assistant
351
+ // message, but only once it has finished — never a follow-up
352
+ // still streaming.
353
+ for (let i = msgs.length - 1; i >= 0; i--) {
354
+ if (msgs[i].role === "assistant") {
355
+ if (!msgs[i].isStreaming)
356
+ index = i;
357
+ break;
358
+ }
359
+ }
360
+ }
361
+ if (index === -1)
362
+ return {};
363
+ msgs[index] = { ...msgs[index], blocks };
364
+ return { messages: msgs };
365
+ }),
366
+ stampTurn: (key, turnId) => mutateLastAssistant(key, (last) => last.isStreaming && !last.turnId ? { ...last, turnId } : last),
367
+ setStreaming: (key, streaming) => mutateBuffer(key, () => ({ isStreaming: streaming })),
368
+ setMessages: (key, messages) => set((state) => {
369
+ if (key === null) {
370
+ if (state.draft)
371
+ revokeAttachmentUrls(state.draft.messages);
372
+ return {
373
+ draft: { ...emptyChat(), messages },
374
+ };
375
+ }
376
+ const existing = state.buffers[key];
377
+ if (existing)
378
+ revokeAttachmentUrls(existing.messages);
379
+ const buffers = {
380
+ ...state.buffers,
381
+ [key]: { ...emptyChat(), messages },
382
+ };
383
+ return { buffers: evictStale(buffers, state.activeSessionId) };
384
+ }),
385
+ appendMessages: (key, messages) => set((state) => {
386
+ if (key === null) {
387
+ const draft = state.draft ?? emptyChat();
388
+ return { draft: { ...draft, messages: [...draft.messages, ...messages] } };
389
+ }
390
+ const existing = state.buffers[key] ?? emptyChat();
391
+ return {
392
+ buffers: {
393
+ ...state.buffers,
394
+ [key]: {
395
+ ...existing,
396
+ messages: [...existing.messages, ...messages],
397
+ lastTouched: Date.now(),
398
+ },
399
+ },
400
+ };
401
+ }),
402
+ startDraftTurn: () => {
403
+ const id = typeof crypto !== "undefined" && "randomUUID" in crypto
404
+ ? crypto.randomUUID()
405
+ : `draft-${Date.now()}-${Math.random().toString(36).slice(2)}`;
406
+ set({ pendingDraftId: id });
407
+ return id;
408
+ },
409
+ bindDraftSession: (sessionId) => set((state) => {
410
+ const adopted = state.buffers[sessionId] ?? state.draft ?? emptyChat();
411
+ const buffers = evictStale({ ...state.buffers, [sessionId]: { ...adopted, lastTouched: Date.now() } }, sessionId);
412
+ const followView = state.activeSessionId === null;
413
+ if (followView)
414
+ persistSessionId(sessionId);
415
+ return {
416
+ buffers,
417
+ draft: null,
418
+ pendingDraftId: null,
419
+ ...(followView ? { activeSessionId: sessionId } : {}),
420
+ };
421
+ }),
422
+ setActiveSession: (sessionId) => set((state) => {
423
+ persistSessionId(sessionId);
424
+ if (sessionId === null)
425
+ return { activeSessionId: null };
426
+ const existing = state.buffers[sessionId];
427
+ const buffers = existing
428
+ ? state.buffers
429
+ : evictStale({ ...state.buffers, [sessionId]: emptyChat() }, sessionId);
430
+ return { activeSessionId: sessionId, buffers };
431
+ }),
432
+ setRunState: (sessionId, runState, note) => set((state) => {
433
+ const noteChanged = (state.queueNotes[sessionId] ?? undefined) !== note;
434
+ if (state.runStates[sessionId] === runState && !noteChanged)
435
+ return state;
436
+ const runStates = { ...state.runStates };
437
+ if (runState === "idle")
438
+ delete runStates[sessionId];
439
+ else
440
+ runStates[sessionId] = runState;
441
+ // The note belongs to the queued state; anything else ends it. A
442
+ // `queued` frame with no note also clears, so a queue that drained back
443
+ // under the warn mark stops claiming it is heavy.
444
+ const queueNotes = { ...state.queueNotes };
445
+ if (runState === "queued" && note)
446
+ queueNotes[sessionId] = note;
447
+ else
448
+ delete queueNotes[sessionId];
449
+ return { runStates, queueNotes };
450
+ }),
451
+ setSessionBackend: (sessionId, backendId) => set((state) => state.backendIds[sessionId] === backendId
452
+ ? state
453
+ : { backendIds: { ...state.backendIds, [sessionId]: backendId } }),
454
+ clearMessages: () => {
455
+ const state = get();
456
+ if (state.draft)
457
+ revokeAttachmentUrls(state.draft.messages);
458
+ persistSessionId(null);
459
+ // Starting fresh: unpin the provider so the picker unlocks.
460
+ provider.getState().setPinned(null);
461
+ set({ draft: null, activeSessionId: null });
462
+ },
463
+ };
464
+ });
465
+ }
466
+ //# sourceMappingURL=chat-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-state.js","sourceRoot":"","sources":["../../src/stores/chat-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AA8H9C,uEAAuE;AACvE,MAAM,WAAW,GAAG,CAAC,CAAC;AAuHtB,SAAS,SAAS;IAChB,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;AACtF,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,GAAgB,MAAM,CAAC,MAAM,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAA6B;IACvD,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,IAAI;IACb,WAAW,EAAE,CAAC;CACf,CAAC,CAAC;AAEH,qEAAqE;AACrE,MAAM,U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,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,CAAC;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;AAEL,CAAC"}
@@ -1,163 +1,5 @@
1
- import type { MessageSource, MessagePart, AskUserQuestion, AskUserAnnotation } from "@schlessera/brain-ui-sdk/protocol";
2
- export type { MessagePart };
3
- export interface ChatMessage {
4
- id: string;
5
- role: "user" | "assistant";
6
- content: string;
7
- thinking?: string;
8
- toolCalls: ToolCall[];
9
- /**
10
- * Chronological thinking/text/tool segments, in arrival order. `content`,
11
- * `thinking` and `toolCalls` remain the aggregated views (used for sharing
12
- * and tool state); `parts` drives rendering order.
13
- */
14
- parts: MessagePart[];
15
- isStreaming: boolean;
16
- timestamp: number;
17
- source?: MessageSource;
18
- /** AskUserQuestion exchanges raised during this assistant turn. */
19
- askUserExchanges?: AskUserExchange[];
20
- /**
21
- * Image attachments on a user message. Live messages carry a local
22
- * `previewUrl` (object URL, revoked on clear). History-loaded messages
23
- * carry no data — only `attachmentCount` — since base64 is never replayed.
24
- */
25
- attachments?: MessageAttachment[];
26
- /** Attachment count for history-loaded messages without preview data. */
27
- attachmentCount?: number;
28
- }
29
- export interface MessageAttachment {
30
- previewUrl: string;
31
- mediaType: string;
32
- }
33
- export interface ToolCall {
34
- id: string;
35
- name: string;
36
- input: Record<string, unknown>;
37
- inputJson: string;
38
- output?: string;
39
- isError?: boolean;
40
- status: "streaming" | "pending_approval" | "approved" | "denied" | "complete";
41
- /**
42
- * What the pending approval is for: "tool" may be remembered via "Always
43
- * allow"; "command" (a destructive-bash confirmation) is per-use only.
44
- */
45
- approvalKind?: "tool" | "command";
46
- /**
47
- * Execution timing for the duration badge. `startedAt` is (re)stamped when
48
- * the input finishes streaming or an approval is granted — so approval
49
- * wait time doesn't inflate the reported duration. `endedAt` is stamped by
50
- * the tool result. History-loaded messages carry no timing.
51
- */
52
- startedAt?: number;
53
- endedAt?: number;
54
- }
55
- export interface AskUserExchange {
56
- requestId: string;
57
- questions: AskUserQuestion[];
58
- /** Filled in once the user submits. Keyed by question text. */
59
- answers?: Record<string, string>;
60
- annotations?: Record<string, AskUserAnnotation>;
61
- cancelled?: boolean;
62
- }
63
- /**
64
- * One session's live transcript state. Every session the user has viewed (or
65
- * that bound from the draft) keeps its own buffer, so frames from a background
66
- * session accumulate in THAT session's transcript instead of being discarded —
67
- * the multi-session contract the old single-active-buffer store violated.
68
- */
69
- export interface SessionChat {
70
- messages: ChatMessage[];
71
- isStreaming: boolean;
72
- /**
73
- * The currently-pending ask-user exchange in this session (no answers yet).
74
- * Mirrors the same exchange that lives on the streaming assistant message;
75
- * held here for fast lookup by hooks/components.
76
- */
77
- askUser: AskUserExchange | null;
78
- /** LRU stamp for buffer eviction. */
79
- lastTouched: number;
80
- }
81
- /**
82
- * Buffer key: a server sessionId, or null for the DRAFT buffer — the new
83
- * conversation that has no server identity yet. `session_info` re-keys the
84
- * draft onto its real sessionId via bindDraftSession().
85
- */
86
- export type ChatKey = string | null;
87
- interface ChatState {
88
- /** Per-session transcript buffers, keyed by server sessionId. */
89
- buffers: Record<string, SessionChat>;
90
- /** The unbound new-conversation buffer, if one is in progress. */
91
- draft: SessionChat | null;
92
- /**
93
- * Correlation id for the conversation the draft is currently starting.
94
- *
95
- * A client starting a conversation has no session id, so it used to adopt
96
- * the FIRST `session_info` for an unknown session — which could be an older
97
- * background turn's, or another client's, silently binding the user's draft
98
- * to someone else's transcript. The id is sent on `chat_message` and echoed
99
- * on `session_info`; adoption now requires a match. Null when no draft turn
100
- * is in flight.
101
- */
102
- pendingDraftId: string | null;
103
- /** The session in view; null = the draft / new-chat view. */
104
- activeSessionId: string | null;
105
- /**
106
- * Live run-state per session id, for the session-list badges. Maintained for
107
- * every session frame regardless of whether a buffer exists. "idle" is the
108
- * absence of a running/queued turn.
109
- */
110
- runStates: Record<string, "streaming" | "queued" | "idle">;
111
- /**
112
- * Backend that owns each session, from `session_info` (or the session list
113
- * for history sessions). Scopes tool-call renderer resolution per backend;
114
- * absence falls back to the deployment default.
115
- */
116
- backendIds: Record<string, string>;
117
- /**
118
- * Per-session note attached to a `queued` status — the host sends one once a
119
- * session's follow-up queue grows heavy. Cleared when the session leaves the
120
- * queued state, so a stale warning cannot outlive the queue it described.
121
- */
122
- queueNotes: Record<string, string>;
123
- addUserMessage: (key: ChatKey, text: string, source?: MessageSource, attachments?: MessageAttachment[]) => void;
124
- startAssistantMessage: (key: ChatKey) => void;
125
- appendText: (key: ChatKey, text: string) => void;
126
- appendThinking: (key: ChatKey, text: string) => void;
127
- startToolCall: (key: ChatKey, toolUseId: string, toolName: string) => void;
128
- appendToolInput: (key: ChatKey, partialJson: string) => void;
129
- completeToolCall: (key: ChatKey, toolUseId: string, toolName: string, input: Record<string, unknown>) => void;
130
- requestToolApproval: (key: ChatKey, toolUseId: string, toolName: string, input: Record<string, unknown>, description?: string, kind?: "tool" | "command") => void;
131
- resolveToolApproval: (key: ChatKey, toolUseId: string, approved: boolean) => void;
132
- setToolResult: (key: ChatKey, toolUseId: string, output: string, isError: boolean) => void;
133
- setAskUserRequest: (key: ChatKey, requestId: string, questions: AskUserQuestion[]) => void;
134
- submitAskUserAnswers: (key: ChatKey, requestId: string, answers: Record<string, string>, annotations?: Record<string, AskUserAnnotation>) => void;
135
- cancelAskUser: (key: ChatKey, requestId: string) => void;
136
- clearAskUser: (key: ChatKey) => void;
137
- finishAssistantMessage: (key: ChatKey) => void;
138
- setStreaming: (key: ChatKey, streaming: boolean) => void;
139
- /** Replace a session's transcript (first replayed history chunk). Creates the buffer. */
140
- setMessages: (key: ChatKey, messages: ChatMessage[]) => void;
141
- /** Concatenate a continuation chunk of replayed history. Creates the buffer. */
142
- appendMessages: (key: ChatKey, messages: ChatMessage[]) => void;
143
- /**
144
- * Adopt the draft buffer as `sessionId` (the server just named the session).
145
- * If the draft view is active, the view follows. No-op draft = empty buffer.
146
- */
147
- bindDraftSession: (sessionId: string) => void;
148
- /** Mint and remember the correlation id for a draft turn about to be sent. */
149
- startDraftTurn: () => string;
150
- /** Switch the view to a session (creating an empty buffer if none), or to the draft (null). */
151
- setActiveSession: (sessionId: string | null) => void;
152
- /** New chat: drop the draft, unbind the view, unpin the provider. */
153
- clearMessages: () => void;
154
- setRunState: (sessionId: string, state: "streaming" | "queued" | "idle", note?: string) => void;
155
- /** Record which backend owns a session (idempotent). */
156
- setSessionBackend: (sessionId: string, backendId: string) => void;
157
- }
158
- /** The buffer currently in view (draft when no session is bound). */
159
- export declare function activeChat(state: ChatState): SessionChat;
160
- /** True when ANY buffer is streaming (service-worker busy check, etc.). */
161
- export declare function anyStreaming(state: ChatState): boolean;
162
- export declare const useChatStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ChatState>>;
1
+ import { defaultRoot } from "../default-root.js";
2
+ export * from "./chat-state.js";
3
+ /** Hook reads the current provider. Statics address the default app only. */
4
+ export declare const useChatStore: (<T>(selector: (state: ReturnType<typeof defaultRoot.stores.chat.getState>) => T) => T) & import("zustand").StoreApi<import("./chat-state.js").ChatState>;
163
5
  //# sourceMappingURL=chat-store.d.ts.map