@schlessera/brain-ui-react 0.35.0 → 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 (755) hide show
  1. package/README.md +82 -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 +32 -32
  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 +13 -2
  136. package/dist/components/chat/tool-views.d.ts.map +1 -1
  137. package/dist/components/chat/tool-views.js +20 -22
  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 +27 -21
  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 +4 -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 +23 -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 +4 -3
  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 +39 -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 +6 -1
  312. package/dist/components/settings/devices-agents-tab.d.ts.map +1 -1
  313. package/dist/components/settings/devices-agents-tab.js +55 -20
  314. package/dist/components/settings/devices-agents-tab.js.map +1 -1
  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.js +1 -1
  324. package/dist/components/settings/one-time-agent-credential.js.map +1 -1
  325. package/dist/components/settings/passkey-list.d.ts +35 -0
  326. package/dist/components/settings/passkey-list.d.ts.map +1 -0
  327. package/dist/components/settings/passkey-list.js +34 -0
  328. package/dist/components/settings/passkey-list.js.map +1 -0
  329. package/dist/components/settings/passkey-tab.d.ts +3 -0
  330. package/dist/components/settings/passkey-tab.d.ts.map +1 -1
  331. package/dist/components/settings/passkey-tab.js +53 -45
  332. package/dist/components/settings/passkey-tab.js.map +1 -1
  333. package/dist/components/settings/pi-accounts-list.d.ts +27 -0
  334. package/dist/components/settings/pi-accounts-list.d.ts.map +1 -0
  335. package/dist/components/settings/pi-accounts-list.js +15 -0
  336. package/dist/components/settings/pi-accounts-list.js.map +1 -0
  337. package/dist/components/settings/pi-accounts.d.ts +3 -0
  338. package/dist/components/settings/pi-accounts.d.ts.map +1 -1
  339. package/dist/components/settings/pi-accounts.js +73 -55
  340. package/dist/components/settings/pi-accounts.js.map +1 -1
  341. package/dist/components/settings/principal-list.d.ts +37 -0
  342. package/dist/components/settings/principal-list.d.ts.map +1 -0
  343. package/dist/components/settings/principal-list.js +18 -0
  344. package/dist/components/settings/principal-list.js.map +1 -0
  345. package/dist/components/settings/settings-panel.d.ts +10 -3
  346. package/dist/components/settings/settings-panel.d.ts.map +1 -1
  347. package/dist/components/settings/settings-panel.js +69 -8
  348. package/dist/components/settings/settings-panel.js.map +1 -1
  349. package/dist/components/settings/skills-list.d.ts +53 -0
  350. package/dist/components/settings/skills-list.d.ts.map +1 -0
  351. package/dist/components/settings/skills-list.js +28 -0
  352. package/dist/components/settings/skills-list.js.map +1 -0
  353. package/dist/components/settings/skills-tab.d.ts.map +1 -1
  354. package/dist/components/settings/skills-tab.js +65 -38
  355. package/dist/components/settings/skills-tab.js.map +1 -1
  356. package/dist/components/settings/tool-permissions-list.d.ts +18 -0
  357. package/dist/components/settings/tool-permissions-list.d.ts.map +1 -0
  358. package/dist/components/settings/tool-permissions-list.js +6 -0
  359. package/dist/components/settings/tool-permissions-list.js.map +1 -0
  360. package/dist/components/settings/tool-permissions.d.ts +2 -1
  361. package/dist/components/settings/tool-permissions.d.ts.map +1 -1
  362. package/dist/components/settings/tool-permissions.js +33 -16
  363. package/dist/components/settings/tool-permissions.js.map +1 -1
  364. package/dist/components/settings/web-search-chain.d.ts +41 -0
  365. package/dist/components/settings/web-search-chain.d.ts.map +1 -0
  366. package/dist/components/settings/web-search-chain.js +47 -0
  367. package/dist/components/settings/web-search-chain.js.map +1 -0
  368. package/dist/components/settings/web-search-settings.d.ts +4 -7
  369. package/dist/components/settings/web-search-settings.d.ts.map +1 -1
  370. package/dist/components/settings/web-search-settings.js +54 -76
  371. package/dist/components/settings/web-search-settings.js.map +1 -1
  372. package/dist/components/share/share-menu.d.ts.map +1 -1
  373. package/dist/components/share/share-menu.js +24 -4
  374. package/dist/components/share/share-menu.js.map +1 -1
  375. package/dist/components/voice/dictation-sheet.js +3 -3
  376. package/dist/components/voice/dictation-sheet.js.map +1 -1
  377. package/dist/components/voice/mic-button.js +1 -1
  378. package/dist/components/voice/mic-button.js.map +1 -1
  379. package/dist/components/voice/review-card.js +1 -1
  380. package/dist/components/voice/review-card.js.map +1 -1
  381. package/dist/config.d.ts +5 -2
  382. package/dist/config.d.ts.map +1 -1
  383. package/dist/config.js +15 -5
  384. package/dist/config.js.map +1 -1
  385. package/dist/connection.d.ts +12 -0
  386. package/dist/connection.d.ts.map +1 -0
  387. package/dist/connection.js +421 -0
  388. package/dist/connection.js.map +1 -0
  389. package/dist/default-root.d.ts +3 -0
  390. package/dist/default-root.d.ts.map +1 -0
  391. package/dist/default-root.js +16 -0
  392. package/dist/default-root.js.map +1 -0
  393. package/dist/hooks/use-color-scheme.d.ts +14 -0
  394. package/dist/hooks/use-color-scheme.d.ts.map +1 -0
  395. package/dist/hooks/use-color-scheme.js +37 -0
  396. package/dist/hooks/use-color-scheme.js.map +1 -0
  397. package/dist/hooks/use-hash-routes.d.ts.map +1 -1
  398. package/dist/hooks/use-hash-routes.js +4 -2
  399. package/dist/hooks/use-hash-routes.js.map +1 -1
  400. package/dist/hooks/use-media-query.d.ts +7 -0
  401. package/dist/hooks/use-media-query.d.ts.map +1 -0
  402. package/dist/hooks/use-media-query.js +34 -0
  403. package/dist/hooks/use-media-query.js.map +1 -0
  404. package/dist/hooks/use-share-intake.d.ts.map +1 -1
  405. package/dist/hooks/use-share-intake.js +37 -12
  406. package/dist/hooks/use-share-intake.js.map +1 -1
  407. package/dist/hooks/use-vpn-status.d.ts.map +1 -1
  408. package/dist/hooks/use-vpn-status.js +17 -18
  409. package/dist/hooks/use-vpn-status.js.map +1 -1
  410. package/dist/hooks/use-websocket.d.ts +5 -24
  411. package/dist/hooks/use-websocket.d.ts.map +1 -1
  412. package/dist/hooks/use-websocket.js +11 -384
  413. package/dist/hooks/use-websocket.js.map +1 -1
  414. package/dist/hooks/websocket-handlers/activity.d.ts +2 -2
  415. package/dist/hooks/websocket-handlers/activity.d.ts.map +1 -1
  416. package/dist/hooks/websocket-handlers/activity.js +4 -5
  417. package/dist/hooks/websocket-handlers/activity.js.map +1 -1
  418. package/dist/hooks/websocket-handlers/chat.d.ts +1 -0
  419. package/dist/hooks/websocket-handlers/chat.d.ts.map +1 -1
  420. package/dist/hooks/websocket-handlers/chat.js +27 -5
  421. package/dist/hooks/websocket-handlers/chat.js.map +1 -1
  422. package/dist/hooks/websocket-handlers/connection.d.ts.map +1 -1
  423. package/dist/hooks/websocket-handlers/connection.js +4 -6
  424. package/dist/hooks/websocket-handlers/connection.js.map +1 -1
  425. package/dist/hooks/websocket-handlers/mask.d.ts +1 -1
  426. package/dist/hooks/websocket-handlers/mask.d.ts.map +1 -1
  427. package/dist/hooks/websocket-handlers/mask.js +2 -3
  428. package/dist/hooks/websocket-handlers/mask.js.map +1 -1
  429. package/dist/hooks/websocket-handlers/provider.d.ts.map +1 -1
  430. package/dist/hooks/websocket-handlers/provider.js +4 -6
  431. package/dist/hooks/websocket-handlers/provider.js.map +1 -1
  432. package/dist/hooks/websocket-handlers/types.d.ts +6 -2
  433. package/dist/hooks/websocket-handlers/types.d.ts.map +1 -1
  434. package/dist/index.d.ts +5 -3
  435. package/dist/index.d.ts.map +1 -1
  436. package/dist/index.js +6 -3
  437. package/dist/index.js.map +1 -1
  438. package/dist/lib/api-client.d.ts +289 -0
  439. package/dist/lib/api-client.d.ts.map +1 -1
  440. package/dist/lib/api-client.js +243 -224
  441. package/dist/lib/api-client.js.map +1 -1
  442. package/dist/lib/backend.d.ts +19 -2
  443. package/dist/lib/backend.d.ts.map +1 -1
  444. package/dist/lib/backend.js +15 -9
  445. package/dist/lib/backend.js.map +1 -1
  446. package/dist/lib/diff.d.ts +8 -10
  447. package/dist/lib/diff.d.ts.map +1 -1
  448. package/dist/lib/diff.js +26 -53
  449. package/dist/lib/diff.js.map +1 -1
  450. package/dist/lib/light-dark.d.ts +37 -0
  451. package/dist/lib/light-dark.d.ts.map +1 -0
  452. package/dist/lib/light-dark.js +83 -0
  453. package/dist/lib/light-dark.js.map +1 -0
  454. package/dist/lib/mermaid-theme.d.ts +7 -2
  455. package/dist/lib/mermaid-theme.d.ts.map +1 -1
  456. package/dist/lib/mermaid-theme.js +125 -203
  457. package/dist/lib/mermaid-theme.js.map +1 -1
  458. package/dist/lib/passkeys.d.ts +6 -3
  459. package/dist/lib/passkeys.d.ts.map +1 -1
  460. package/dist/lib/passkeys.js +10 -4
  461. package/dist/lib/passkeys.js.map +1 -1
  462. package/dist/lib/push-registration.d.ts +4 -1
  463. package/dist/lib/push-registration.d.ts.map +1 -1
  464. package/dist/lib/push-registration.js +20 -2
  465. package/dist/lib/push-registration.js.map +1 -1
  466. package/dist/lib/share-intake.d.ts +2 -1
  467. package/dist/lib/share-intake.d.ts.map +1 -1
  468. package/dist/lib/share-intake.js +3 -3
  469. package/dist/lib/share-intake.js.map +1 -1
  470. package/dist/lib/share.d.ts +4 -3
  471. package/dist/lib/share.d.ts.map +1 -1
  472. package/dist/lib/share.js +6 -7
  473. package/dist/lib/share.js.map +1 -1
  474. package/dist/lib/single-key.d.ts +30 -0
  475. package/dist/lib/single-key.d.ts.map +1 -0
  476. package/dist/lib/single-key.js +45 -0
  477. package/dist/lib/single-key.js.map +1 -0
  478. package/dist/lib/tool-names.d.ts +8 -6
  479. package/dist/lib/tool-names.d.ts.map +1 -1
  480. package/dist/lib/tool-names.js +17 -7
  481. package/dist/lib/tool-names.js.map +1 -1
  482. package/dist/root-context.d.ts +229 -0
  483. package/dist/root-context.d.ts.map +1 -0
  484. package/dist/root-context.js +33 -0
  485. package/dist/root-context.js.map +1 -0
  486. package/dist/root.d.ts +38 -0
  487. package/dist/root.d.ts.map +1 -0
  488. package/dist/root.js +47 -0
  489. package/dist/root.js.map +1 -0
  490. package/dist/stores/activity-state.d.ts +29 -0
  491. package/dist/stores/activity-state.d.ts.map +1 -0
  492. package/dist/stores/activity-state.js +282 -0
  493. package/dist/stores/activity-state.js.map +1 -0
  494. package/dist/stores/activity-store.d.ts +10 -41
  495. package/dist/stores/activity-store.d.ts.map +1 -1
  496. package/dist/stores/activity-store.js +9 -271
  497. package/dist/stores/activity-store.js.map +1 -1
  498. package/dist/stores/chat-state.d.ts +212 -0
  499. package/dist/stores/chat-state.d.ts.map +1 -0
  500. package/dist/stores/chat-state.js +466 -0
  501. package/dist/stores/chat-state.js.map +1 -0
  502. package/dist/stores/chat-store.d.ts +4 -162
  503. package/dist/stores/chat-store.d.ts.map +1 -1
  504. package/dist/stores/chat-store.js +7 -418
  505. package/dist/stores/chat-store.js.map +1 -1
  506. package/dist/stores/connection-state.d.ts +40 -0
  507. package/dist/stores/connection-state.d.ts.map +1 -0
  508. package/dist/stores/connection-state.js +30 -0
  509. package/dist/stores/connection-state.js.map +1 -0
  510. package/dist/stores/connection-store.d.ts +4 -40
  511. package/dist/stores/connection-store.d.ts.map +1 -1
  512. package/dist/stores/connection-store.js +7 -27
  513. package/dist/stores/connection-store.js.map +1 -1
  514. package/dist/stores/create-stores.d.ts +23 -0
  515. package/dist/stores/create-stores.d.ts.map +1 -0
  516. package/dist/stores/create-stores.js +28 -0
  517. package/dist/stores/create-stores.js.map +1 -0
  518. package/dist/stores/file-state.d.ts +53 -0
  519. package/dist/stores/file-state.d.ts.map +1 -0
  520. package/dist/stores/file-state.js +341 -0
  521. package/dist/stores/file-state.js.map +1 -0
  522. package/dist/stores/file-store.d.ts +4 -52
  523. package/dist/stores/file-store.d.ts.map +1 -1
  524. package/dist/stores/file-store.js +7 -336
  525. package/dist/stores/file-store.js.map +1 -1
  526. package/dist/stores/graph-state.d.ts +95 -0
  527. package/dist/stores/graph-state.d.ts.map +1 -0
  528. package/dist/stores/graph-state.js +252 -0
  529. package/dist/stores/graph-state.js.map +1 -0
  530. package/dist/stores/graph-store.d.ts +7 -83
  531. package/dist/stores/graph-store.d.ts.map +1 -1
  532. package/dist/stores/graph-store.js +8 -249
  533. package/dist/stores/graph-store.js.map +1 -1
  534. package/dist/stores/mask-state.d.ts +21 -0
  535. package/dist/stores/mask-state.d.ts.map +1 -0
  536. package/dist/stores/mask-state.js +9 -0
  537. package/dist/stores/mask-state.js.map +1 -0
  538. package/dist/stores/mask-store.d.ts +4 -21
  539. package/dist/stores/mask-store.d.ts.map +1 -1
  540. package/dist/stores/mask-store.js +7 -6
  541. package/dist/stores/mask-store.js.map +1 -1
  542. package/dist/stores/principal-state.d.ts +16 -0
  543. package/dist/stores/principal-state.d.ts.map +1 -0
  544. package/dist/stores/principal-state.js +31 -0
  545. package/dist/stores/principal-state.js.map +1 -0
  546. package/dist/stores/principal-store.d.ts +4 -15
  547. package/dist/stores/principal-store.d.ts.map +1 -1
  548. package/dist/stores/principal-store.js +7 -28
  549. package/dist/stores/principal-store.js.map +1 -1
  550. package/dist/stores/provider-state.d.ts +24 -0
  551. package/dist/stores/provider-state.d.ts.map +1 -0
  552. package/dist/stores/provider-state.js +68 -0
  553. package/dist/stores/provider-state.js.map +1 -0
  554. package/dist/stores/provider-store.d.ts +4 -23
  555. package/dist/stores/provider-store.d.ts.map +1 -1
  556. package/dist/stores/provider-store.js +7 -64
  557. package/dist/stores/provider-store.js.map +1 -1
  558. package/dist/stores/share-state.d.ts +29 -0
  559. package/dist/stores/share-state.d.ts.map +1 -0
  560. package/dist/stores/share-state.js +21 -0
  561. package/dist/stores/share-state.js.map +1 -0
  562. package/dist/stores/share-store.d.ts +4 -28
  563. package/dist/stores/share-store.d.ts.map +1 -1
  564. package/dist/stores/share-store.js +7 -18
  565. package/dist/stores/share-store.js.map +1 -1
  566. package/dist/stores/store-environment.d.ts +10 -0
  567. package/dist/stores/store-environment.d.ts.map +1 -0
  568. package/dist/stores/store-environment.js +2 -0
  569. package/dist/stores/store-environment.js.map +1 -0
  570. package/dist/stores/ui-state.d.ts +71 -0
  571. package/dist/stores/ui-state.d.ts.map +1 -0
  572. package/dist/stores/ui-state.js +58 -0
  573. package/dist/stores/ui-state.js.map +1 -0
  574. package/dist/stores/ui-store.d.ts +4 -45
  575. package/dist/stores/ui-store.d.ts.map +1 -1
  576. package/dist/stores/ui-store.js +7 -36
  577. package/dist/stores/ui-store.js.map +1 -1
  578. package/dist/styles.css +1 -1
  579. package/dist/theme.css +150 -97
  580. package/dist/voice/asr-clients.d.ts +2 -1
  581. package/dist/voice/asr-clients.d.ts.map +1 -1
  582. package/dist/voice/asr-clients.js +16 -17
  583. package/dist/voice/asr-clients.js.map +1 -1
  584. package/dist/voice/use-dictation.d.ts.map +1 -1
  585. package/dist/voice/use-dictation.js +12 -8
  586. package/dist/voice/use-dictation.js.map +1 -1
  587. package/dist/voice/voice-state.d.ts +25 -0
  588. package/dist/voice/voice-state.d.ts.map +1 -0
  589. package/dist/voice/voice-state.js +29 -0
  590. package/dist/voice/voice-state.js.map +1 -0
  591. package/dist/voice/voice-store.d.ts +4 -25
  592. package/dist/voice/voice-store.d.ts.map +1 -1
  593. package/dist/voice/voice-store.js +7 -26
  594. package/dist/voice/voice-store.js.map +1 -1
  595. package/package.json +3 -2
  596. package/src/components/activity/activity-page.tsx +334 -160
  597. package/src/components/activity/activity-run-detail.tsx +81 -47
  598. package/src/components/activity/activity-run-list.tsx +27 -59
  599. package/src/components/activity/activity-views.tsx +155 -0
  600. package/src/components/activity/approval-card.tsx +80 -0
  601. package/src/components/activity/digest-card.tsx +25 -61
  602. package/src/components/activity/digest-summary.tsx +52 -0
  603. package/src/components/activity/push-switch.tsx +62 -0
  604. package/src/components/activity/push-toggle.tsx +51 -81
  605. package/src/components/activity/span-bits.tsx +8 -7
  606. package/src/components/chat/ask-user-card.tsx +292 -356
  607. package/src/components/chat/ask-user-typed.ts +77 -0
  608. package/src/components/chat/brain-markdown-links.tsx +4 -4
  609. package/src/components/chat/brain-markdown.tsx +4 -2
  610. package/src/components/chat/chat-page.tsx +38 -9
  611. package/src/components/chat/composer-view.tsx +194 -0
  612. package/src/components/chat/composer.tsx +117 -296
  613. package/src/components/chat/markdown-content.tsx +53 -2
  614. package/src/components/chat/mermaid-block.tsx +13 -5
  615. package/src/components/chat/mermaid-share.ts +8 -7
  616. package/src/components/chat/mermaid-viewer.tsx +3 -1
  617. package/src/components/chat/message-bubble.tsx +78 -94
  618. package/src/components/chat/message-share.ts +7 -7
  619. package/src/components/chat/renderers/bind.tsx +94 -0
  620. package/src/components/chat/renderers/brain-ui-tools.tsx +56 -0
  621. package/src/components/chat/renderers/claude-tools.tsx +3 -2
  622. package/src/components/chat/renderers/index.ts +15 -10
  623. package/src/components/chat/session-drawer.tsx +41 -138
  624. package/src/components/chat/session-list.tsx +113 -0
  625. package/src/components/chat/share-block.tsx +16 -12
  626. package/src/components/chat/share-card.tsx +2 -2
  627. package/src/components/chat/subagent-view.tsx +4 -4
  628. package/src/components/chat/tool-call-timeline.tsx +59 -22
  629. package/src/components/chat/tool-cards/block-card.tsx +145 -0
  630. package/src/components/chat/tool-cards/image-mask-card.tsx +214 -0
  631. package/src/components/chat/tool-cards/location-card.tsx +159 -0
  632. package/src/components/chat/tool-views.tsx +21 -60
  633. package/src/components/chat/transcript-turn.tsx +108 -0
  634. package/src/components/chat/use-chat-commands.ts +14 -16
  635. package/src/components/chat/welcome-state.tsx +36 -91
  636. package/src/components/connectivity/connection-gate.tsx +32 -24
  637. package/src/components/connectivity/login-form.tsx +122 -0
  638. package/src/components/connectivity/login-screen.tsx +45 -100
  639. package/src/components/dev/share-harness.tsx +2 -2
  640. package/src/components/files/file-panel.tsx +168 -0
  641. package/src/components/files/file-tree-view.tsx +127 -0
  642. package/src/components/files/file-tree.tsx +55 -109
  643. package/src/components/files/file-viewer-binary.tsx +3 -2
  644. package/src/components/files/file-viewer-frame.tsx +113 -0
  645. package/src/components/files/file-viewer.tsx +40 -95
  646. package/src/components/files/frontmatter-chips.tsx +42 -0
  647. package/src/components/files/frontmatter-panel.tsx +6 -71
  648. package/src/components/files/staleness.ts +29 -0
  649. package/src/components/graph/graph-canvas.tsx +24 -1
  650. package/src/components/graph/graph-controls-column.tsx +92 -0
  651. package/src/components/graph/graph-controls.tsx +83 -127
  652. package/src/components/graph/graph-form.tsx +183 -0
  653. package/src/components/graph/graph-maintenance.tsx +9 -14
  654. package/src/components/graph/graph-node-rail.tsx +147 -0
  655. package/src/components/graph/graph-page.tsx +189 -49
  656. package/src/components/graph/graph-scene.tsx +200 -30
  657. package/src/components/graph/lib/graph-helpers.ts +65 -43
  658. package/src/components/graph/node-card.tsx +64 -0
  659. package/src/components/graph/node-popover.tsx +28 -117
  660. package/src/components/graph/use-graph-theme.ts +69 -32
  661. package/src/components/graph/use-node-actions.ts +56 -0
  662. package/src/components/images/image-share.ts +4 -2
  663. package/src/components/images/image-viewer.tsx +3 -1
  664. package/src/components/images/mask-editor.tsx +7 -4
  665. package/src/components/layout/app-shell.tsx +5 -1
  666. package/src/components/layout/desktop-palette.tsx +151 -0
  667. package/src/components/layout/key-cap.tsx +15 -0
  668. package/src/components/layout/mobile-tab-bar.tsx +80 -157
  669. package/src/components/layout/shortcut-switch.tsx +32 -0
  670. package/src/components/layout/side-rail.tsx +70 -150
  671. package/src/components/layout/slide-panel.tsx +29 -2
  672. package/src/components/layout/theme.tsx +67 -0
  673. package/src/components/quick-actions/add-form.tsx +188 -0
  674. package/src/components/quick-actions/add-modal.tsx +32 -153
  675. package/src/components/quick-actions/search-modal.tsx +5 -3
  676. package/src/components/quick-actions/streaming-modal.tsx +42 -71
  677. package/src/components/quick-actions/streaming-output.tsx +112 -0
  678. package/src/components/quick-actions/whatsup-modal.tsx +38 -60
  679. package/src/components/settings/devices-agents-tab.tsx +60 -152
  680. package/src/components/settings/models-list.tsx +299 -0
  681. package/src/components/settings/models-tab.tsx +63 -337
  682. package/src/components/settings/one-time-agent-credential.tsx +1 -1
  683. package/src/components/settings/passkey-list.tsx +201 -0
  684. package/src/components/settings/passkey-tab.tsx +53 -197
  685. package/src/components/settings/pi-accounts-list.tsx +128 -0
  686. package/src/components/settings/pi-accounts.tsx +71 -170
  687. package/src/components/settings/principal-list.tsx +172 -0
  688. package/src/components/settings/settings-panel.tsx +232 -21
  689. package/src/components/settings/skills-list.tsx +276 -0
  690. package/src/components/settings/skills-tab.tsx +82 -269
  691. package/src/components/settings/tool-permissions-list.tsx +54 -0
  692. package/src/components/settings/tool-permissions.tsx +27 -46
  693. package/src/components/settings/web-search-chain.tsx +300 -0
  694. package/src/components/settings/web-search-settings.tsx +58 -328
  695. package/src/components/share/share-menu.tsx +19 -4
  696. package/src/components/voice/dictation-sheet.tsx +5 -5
  697. package/src/components/voice/mic-button.tsx +1 -1
  698. package/src/components/voice/review-card.tsx +1 -1
  699. package/src/config.ts +21 -7
  700. package/src/connection.ts +443 -0
  701. package/src/default-root.ts +16 -0
  702. package/src/hooks/use-color-scheme.ts +36 -0
  703. package/src/hooks/use-hash-routes.ts +4 -2
  704. package/src/hooks/use-media-query.ts +32 -0
  705. package/src/hooks/use-share-intake.ts +32 -12
  706. package/src/hooks/use-vpn-status.ts +18 -17
  707. package/src/hooks/use-websocket.ts +12 -428
  708. package/src/hooks/websocket-handlers/activity.ts +4 -5
  709. package/src/hooks/websocket-handlers/chat.ts +26 -5
  710. package/src/hooks/websocket-handlers/connection.ts +4 -6
  711. package/src/hooks/websocket-handlers/mask.ts +2 -3
  712. package/src/hooks/websocket-handlers/provider.ts +4 -6
  713. package/src/hooks/websocket-handlers/types.ts +6 -2
  714. package/src/index.ts +7 -3
  715. package/src/lib/api-client.ts +426 -384
  716. package/src/lib/backend.ts +20 -10
  717. package/src/lib/diff.ts +28 -62
  718. package/src/lib/light-dark.ts +83 -0
  719. package/src/lib/mermaid-theme.ts +183 -214
  720. package/src/lib/passkeys.ts +12 -4
  721. package/src/lib/push-registration.ts +19 -2
  722. package/src/lib/share-intake.ts +6 -3
  723. package/src/lib/share.ts +7 -4
  724. package/src/lib/single-key.ts +47 -0
  725. package/src/lib/tool-names.ts +31 -8
  726. package/src/root-context.tsx +40 -0
  727. package/src/root.ts +83 -0
  728. package/src/stores/activity-state.ts +295 -0
  729. package/src/stores/activity-store.ts +11 -285
  730. package/src/stores/chat-state.ts +795 -0
  731. package/src/stores/chat-store.ts +11 -705
  732. package/src/stores/connection-state.ts +78 -0
  733. package/src/stores/connection-store.ts +11 -76
  734. package/src/stores/create-stores.ts +31 -0
  735. package/src/stores/file-state.ts +399 -0
  736. package/src/stores/file-store.ts +9 -390
  737. package/src/stores/graph-state.ts +368 -0
  738. package/src/stores/graph-store.ts +10 -355
  739. package/src/stores/mask-state.ts +30 -0
  740. package/src/stores/mask-store.ts +10 -27
  741. package/src/stores/principal-state.ts +42 -0
  742. package/src/stores/principal-store.ts +10 -37
  743. package/src/stores/provider-state.ts +103 -0
  744. package/src/stores/provider-store.ts +10 -95
  745. package/src/stores/share-state.ts +56 -0
  746. package/src/stores/share-store.ts +11 -54
  747. package/src/stores/store-environment.ts +10 -0
  748. package/src/stores/ui-state.ts +143 -0
  749. package/src/stores/ui-store.ts +11 -93
  750. package/src/styles.css +4 -1
  751. package/src/theme.css +150 -97
  752. package/src/voice/asr-clients.ts +17 -17
  753. package/src/voice/use-dictation.ts +11 -8
  754. package/src/voice/voice-state.ts +57 -0
  755. package/src/voice/voice-store.ts +11 -55
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Button, Chip, Placeholder } from "@schlessera/brain-ui-kit";
3
+ import { Check, Fingerprint, Pencil, Trash2, X } from "lucide-react";
4
+ import { useState } from "react";
5
+ export function PasskeyList(p) {
6
+ const canAdd = p.status === "ready" && p.supported;
7
+ return (_jsxs("div", { className: "flex h-full flex-col", children: [_jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [_jsx("h3", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Passkeys" }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Sign in with Face ID, fingerprint, or a security key instead of the password. Passkeys only work on the site they were added on." }), p.status === "loading" ? (_jsx("div", { className: "mt-4", children: _jsx(Placeholder, { variant: "loading", lines: 2 }) })) : (_jsxs("ul", { className: "mt-4 flex flex-col gap-2", children: [p.credentials.map((credential) => (_jsx(PasskeyRow, { credential: credential, foreign: credential.rpId !== p.hostname, onDelete: () => p.onDelete(credential.id), onRename: (label) => p.onRename(credential.id, label) }, credential.id))), p.credentials.length === 0 && p.status === "ready" && (_jsx("li", { children: _jsx(Placeholder, { variant: "empty", message: "No passkeys yet.", icon: "passkey" }) }))] })), p.error && (_jsx("p", { role: "alert", className: "mt-3 text-xs text-destructive", children: p.error })), canAdd ? (_jsx("div", { className: "mt-4", children: _jsx(Button, { label: p.busy ? "Adding a passkey…" : "Add a passkey", icon: "add", tone: "primary", size: "md", center: true, disabled: p.busy, onClick: p.onAdd }) })) : (_jsx("p", { className: "mt-4 text-xs text-muted-foreground", children: p.status === "unavailable"
8
+ ? "Passkeys need password auth mode on the server."
9
+ : "This browser does not support passkeys." }))] }), _jsx("div", { className: "border-t border-border p-4", children: _jsx(Button, { label: "Sign out everywhere", icon: "hand", tone: "danger", size: "md", center: true, onClick: p.onSignOut }) })] }));
10
+ }
11
+ function PasskeyRow({ credential, foreign, onDelete, onRename, }) {
12
+ const [editing, setEditing] = useState(false);
13
+ const [draft, setDraft] = useState(credential.label);
14
+ const displayName = credential.label ||
15
+ `Passkey · ${new Date(credential.createdAt).toLocaleDateString()}`;
16
+ function commit() {
17
+ setEditing(false);
18
+ const label = draft.trim();
19
+ if (label !== credential.label)
20
+ onRename(label);
21
+ }
22
+ return (_jsxs("li", { className: "rounded-lg border border-border-subtle bg-surface p-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Fingerprint, { className: "h-4 w-4 shrink-0 text-primary" }), editing ? (_jsxs("span", { className: "flex flex-1 items-center gap-1", children: [_jsx("input", { autoFocus: true, value: draft, "aria-label": "Passkey name", onChange: (e) => setDraft(e.target.value), onKeyDown: (e) => {
23
+ if (e.key === "Enter")
24
+ commit();
25
+ if (e.key === "Escape")
26
+ setEditing(false);
27
+ }, className: "w-full rounded border border-border-subtle bg-background px-2 py-0.5 text-sm text-foreground outline-none focus:border-primary" }), _jsx("button", { type: "button", onClick: commit, title: "Save", className: "p-1 text-muted-foreground hover:text-foreground", children: _jsx(Check, { className: "h-3.5 w-3.5" }) }), _jsx("button", { type: "button", onClick: () => setEditing(false), title: "Cancel", className: "p-1 text-muted-foreground hover:text-foreground", children: _jsx(X, { className: "h-3.5 w-3.5" }) })] })) : (_jsx("span", { className: "flex-1 truncate text-sm text-foreground", children: displayName })), !editing && (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => {
28
+ setDraft(credential.label);
29
+ setEditing(true);
30
+ }, title: "Rename", className: "p-1 text-muted-foreground transition-colors hover:text-foreground", children: _jsx(Pencil, { className: "h-3.5 w-3.5" }) }), _jsx("button", { type: "button", onClick: onDelete, title: "Remove", className: "p-1 text-muted-foreground transition-colors hover:text-destructive", children: _jsx(Trash2, { className: "h-3.5 w-3.5" }) })] }))] }), _jsxs("div", { className: "mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 pl-6 text-[11px] text-muted-foreground", children: [credential.backedUp && _jsx(Chip, { label: "synced", variant: "kv", tone: "teal" }), foreign && (_jsx("span", { title: `Registered on ${credential.rpId}; only usable there.`, className: "flex", children: _jsx(Chip, { label: credential.rpId, variant: "mono", tone: "neutral" }) })), _jsx("span", { children: credential.lastUsedAt
31
+ ? `Last used ${new Date(credential.lastUsedAt).toLocaleDateString()}`
32
+ : `Added ${new Date(credential.createdAt).toLocaleDateString()}` })] })] }));
33
+ }
34
+ //# sourceMappingURL=passkey-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey-list.js","sourceRoot":"","sources":["../../../src/components/settings/passkey-list.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAoCjC,MAAM,UAAU,WAAW,CAAC,CAAmB;IAC7C,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,KAAK,OAAO,IAAI,CAAC,CAAC,SAAS,CAAC;IACnD,OAAO,CACL,eAAK,SAAS,EAAC,sBAAsB,aACnC,eAAK,SAAS,EAAC,4BAA4B,aACzC,aAAI,SAAS,EAAC,mEAAmE,yBAE5E,EACL,YAAG,SAAS,EAAC,oCAAoC,iJAG7C,EA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E9E,KAAC,MAAM,IAAC,SAAS,EAAC,aAAa,GAAG,GAC3B,IACR,CACJ,IACG,EACN,eAAK,SAAS,EAAC,2FAA2F,aACvG,UAAU,CAAC,QAAQ,IAAI,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,GAAG,EACvE,OAAO,IAAI,CACV,eAAM,KAAK,EAAE,iBAAiB,UAAU,CAAC,IAAI,sBAAsB,EAAE,SAAS,EAAC,MAAM,YACnF,KAAC,IAAI,IAAC,KAAK,EAAE,UAAU,CAAC,IAAI,EAAE,OAAO,EAAC,MAAM,EAAC,IAAI,EAAC,SAAS,GAAG,GACzD,CACR,EACD,yBACG,UAAU,CAAC,UAAU;4BACpB,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,kBAAkB,EAAE,EAAE;4BACrE,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,kBAAkB,EAAE,EAAE,GAC7D,IACH,IACH,CACN,CAAC;AACJ,CAAC"}
@@ -6,6 +6,9 @@
6
6
  *
7
7
  * `active` is "this tab is on screen": the list reloads when it becomes visible
8
8
  * rather than on mount, so switching tabs picks up changes made elsewhere.
9
+ *
10
+ * This is the container (S6): the request, the ceremony, the per-root abort
11
+ * signal and the confirm dialog live here; `PasskeyList` draws from props.
9
12
  */
10
13
  export declare function PasskeyTab({ active }: {
11
14
  active: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"passkey-tab.d.ts","sourceRoot":"","sources":["../../../src/components/settings/passkey-tab.tsx"],"names":[],"mappings":"AAiBA;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,+BAuJzD"}
1
+ {"version":3,"file":"passkey-tab.d.ts","sourceRoot":"","sources":["../../../src/components/settings/passkey-tab.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,+BAiHzD"}
@@ -1,9 +1,8 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
3
- import { Check, Cloud, Fingerprint, Loader2, LogOut, Pencil, Plus, Trash2, X, } from "lucide-react";
4
- import { api } from "../../lib/api-client.js";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useRef, useState } from "react";
3
+ import { useBrainUiRoot } from "../../root-context.js";
5
4
  import { isUserCancel, registerPasskey, supportsPasskeys } from "../../lib/passkeys.js";
6
- import { cn } from "../../lib/utils.js";
5
+ import { PasskeyList } from "./passkey-list.js";
7
6
  /**
8
7
  * Passkey management + sign out — the Security tab of the settings panel.
9
8
  * Registration requires the current session (routes are behind the auth guard);
@@ -12,110 +11,119 @@ import { cn } from "../../lib/utils.js";
12
11
  *
13
12
  * `active` is "this tab is on screen": the list reloads when it becomes visible
14
13
  * rather than on mount, so switching tabs picks up changes made elsewhere.
14
+ *
15
+ * This is the container (S6): the request, the ceremony, the per-root abort
16
+ * signal and the confirm dialog live here; `PasskeyList` draws from props.
15
17
  */
16
18
  export function PasskeyTab({ active }) {
19
+ const root = useBrainUiRoot();
20
+ const api = root.api;
21
+ const lifetime = useRef(new AbortController());
22
+ const listRequest = useRef(0);
17
23
  const [credentials, setCredentials] = useState([]);
18
24
  const [loading, setLoading] = useState(false);
19
25
  const [busy, setBusy] = useState(false);
20
26
  const [error, setError] = useState(null);
21
27
  const [passkeyMode, setPasskeyMode] = useState(true);
22
28
  const webAuthnSupported = supportsPasskeys();
23
- async function refresh() {
29
+ const refresh = useCallback(async () => {
30
+ const signal = lifetime.current.signal;
31
+ const request = ++listRequest.current;
32
+ const current = () => !signal.aborted && request === listRequest.current;
24
33
  setLoading(true);
25
34
  try {
26
35
  const data = await api.passkeyList();
36
+ if (!current())
37
+ return;
27
38
  setCredentials(data.credentials);
28
39
  setPasskeyMode(true);
29
40
  }
30
41
  catch {
42
+ if (!current())
43
+ return;
31
44
  // 400 = server not in password mode; anything else degrades the same way.
32
45
  setPasskeyMode(false);
33
46
  setCredentials([]);
34
47
  }
35
48
  finally {
36
- setLoading(false);
49
+ if (current())
50
+ setLoading(false);
37
51
  }
38
- }
52
+ }, [api]);
39
53
  useEffect(() => {
40
- if (active) {
41
- setError(null);
54
+ const controller = new AbortController();
55
+ lifetime.current = controller;
56
+ setCredentials([]);
57
+ setLoading(false);
58
+ setBusy(false);
59
+ setError(null);
60
+ setPasskeyMode(true);
61
+ if (active)
42
62
  void refresh();
43
- }
44
- }, [active]);
63
+ return () => controller.abort();
64
+ }, [active, root, refresh]);
45
65
  async function onAdd() {
46
66
  if (busy)
47
67
  return;
68
+ const signal = lifetime.current.signal;
48
69
  setBusy(true);
49
70
  setError(null);
50
71
  try {
51
- await registerPasskey();
72
+ await registerPasskey(api, undefined, signal);
73
+ if (signal.aborted)
74
+ return;
52
75
  await refresh();
53
76
  }
54
77
  catch (err) {
55
- if (!isUserCancel(err)) {
78
+ if (!signal.aborted && !isUserCancel(err)) {
56
79
  setError(err instanceof Error ? err.message : "Registration failed");
57
80
  }
58
81
  }
59
82
  finally {
60
- setBusy(false);
83
+ if (!signal.aborted)
84
+ setBusy(false);
61
85
  }
62
86
  }
63
87
  async function onDelete(id) {
64
88
  if (!window.confirm("Remove this passkey? You can't undo this."))
65
89
  return;
90
+ const signal = lifetime.current.signal;
66
91
  setError(null);
67
92
  try {
68
93
  await api.passkeyDelete(id);
94
+ if (signal.aborted)
95
+ return;
69
96
  setCredentials((rows) => rows.filter((row) => row.id !== id));
70
97
  }
71
98
  catch (err) {
72
- setError(err instanceof Error ? err.message : "Delete failed");
99
+ if (!signal.aborted)
100
+ setError(err instanceof Error ? err.message : "Delete failed");
73
101
  }
74
102
  }
75
103
  async function onRename(id, label) {
104
+ const signal = lifetime.current.signal;
76
105
  setError(null);
77
106
  try {
78
107
  await api.passkeyRename(id, label);
108
+ if (signal.aborted)
109
+ return;
79
110
  setCredentials((rows) => rows.map((row) => (row.id === id ? { ...row, label } : row)));
80
111
  }
81
112
  catch (err) {
82
- setError(err instanceof Error ? err.message : "Rename failed");
113
+ if (!signal.aborted)
114
+ setError(err instanceof Error ? err.message : "Rename failed");
83
115
  }
84
116
  }
85
117
  async function onSignOut() {
118
+ const signal = lifetime.current.signal;
86
119
  try {
87
120
  await api.logout();
88
121
  }
89
122
  finally {
90
- window.location.reload();
123
+ if (!signal.aborted)
124
+ window.location.reload();
91
125
  }
92
126
  }
93
- return (_jsxs("div", { className: "flex h-full flex-col", children: [_jsxs("div", { className: "flex-1 overflow-y-auto p-4", children: [_jsx("h3", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Passkeys" }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Sign in with Face ID, fingerprint, or a security key instead of the password. Passkeys only work on the site they were added on." }), loading ? (_jsx("div", { className: "mt-6 flex justify-center", children: _jsx(Loader2, { className: "h-5 w-5 animate-spin text-muted-foreground" }) })) : (_jsxs("ul", { className: "mt-4 flex flex-col gap-2", children: [credentials.map((credential) => (_jsx(PasskeyRow, { credential: credential, onDelete: () => onDelete(credential.id), onRename: (label) => onRename(credential.id, label) }, credential.id))), credentials.length === 0 && passkeyMode && (_jsx("li", { className: "rounded-lg border border-dashed border-border-subtle p-4 text-center text-xs text-muted-foreground", children: "No passkeys yet." }))] })), error && (_jsx("p", { role: "alert", className: "mt-3 text-xs text-destructive", children: error })), passkeyMode && webAuthnSupported ? (_jsxs("button", { onClick: onAdd, disabled: busy, className: "mt-4 flex w-full items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:brightness-110 disabled:opacity-50", children: [busy ? (_jsx(Loader2, { className: "h-4 w-4 animate-spin" })) : (_jsx(Plus, { className: "h-4 w-4" })), "Add a passkey"] })) : (_jsx("p", { className: "mt-4 text-xs text-muted-foreground", children: passkeyMode
94
- ? "This browser does not support passkeys."
95
- : "Passkeys need password auth mode on the server." }))] }), _jsx("div", { className: "border-t border-border p-4", children: _jsxs("button", { onClick: onSignOut, className: "flex w-full items-center justify-center gap-2 rounded-lg border border-border-subtle bg-surface px-4 py-2 text-sm font-medium text-foreground transition-colors hover:border-destructive hover:text-destructive", children: [_jsx(LogOut, { className: "h-4 w-4" }), "Sign out everywhere"] }) })] }));
96
- }
97
- function PasskeyRow({ credential, onDelete, onRename, }) {
98
- const [editing, setEditing] = useState(false);
99
- const [draft, setDraft] = useState(credential.label);
100
- const foreignRp = typeof window !== "undefined" && credential.rpId !== window.location.hostname;
101
- const displayName = credential.label ||
102
- `Passkey · ${new Date(credential.createdAt).toLocaleDateString()}`;
103
- function commit() {
104
- setEditing(false);
105
- const label = draft.trim();
106
- if (label !== credential.label)
107
- onRename(label);
108
- }
109
- return (_jsxs("li", { className: "rounded-lg border border-border-subtle bg-surface p-3", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Fingerprint, { className: "h-4 w-4 shrink-0 text-primary" }), editing ? (_jsxs("span", { className: "flex flex-1 items-center gap-1", children: [_jsx("input", { autoFocus: true, value: draft, onChange: (e) => setDraft(e.target.value), onKeyDown: (e) => {
110
- if (e.key === "Enter")
111
- commit();
112
- if (e.key === "Escape")
113
- setEditing(false);
114
- }, className: "w-full rounded border border-border-subtle bg-background px-2 py-0.5 text-sm text-foreground outline-none focus:border-primary" }), _jsx("button", { onClick: commit, title: "Save", className: "p-1 text-muted-foreground hover:text-foreground", children: _jsx(Check, { className: "h-3.5 w-3.5" }) }), _jsx("button", { onClick: () => setEditing(false), title: "Cancel", className: "p-1 text-muted-foreground hover:text-foreground", children: _jsx(X, { className: "h-3.5 w-3.5" }) })] })) : (_jsx("span", { className: "flex-1 truncate text-sm text-foreground", children: displayName })), !editing && (_jsxs(_Fragment, { children: [_jsx("button", { onClick: () => {
115
- setDraft(credential.label);
116
- setEditing(true);
117
- }, title: "Rename", className: "p-1 text-muted-foreground transition-colors hover:text-foreground", children: _jsx(Pencil, { className: "h-3.5 w-3.5" }) }), _jsx("button", { onClick: onDelete, title: "Remove", className: "p-1 text-muted-foreground transition-colors hover:text-destructive", children: _jsx(Trash2, { className: "h-3.5 w-3.5" }) })] }))] }), _jsxs("div", { className: "mt-1.5 flex flex-wrap items-center gap-x-3 gap-y-1 pl-6 text-[11px] text-muted-foreground", children: [credential.backedUp && (_jsxs("span", { className: "flex items-center gap-1", children: [_jsx(Cloud, { className: "h-3 w-3" }), " Synced"] })), foreignRp && (_jsx("span", { className: cn("rounded bg-surface-raised px-1.5 py-0.5 font-medium text-foreground/70"), title: `Registered on ${credential.rpId}; only usable there.`, children: credential.rpId })), _jsx("span", { children: credential.lastUsedAt
118
- ? `Last used ${new Date(credential.lastUsedAt).toLocaleDateString()}`
119
- : `Added ${new Date(credential.createdAt).toLocaleDateString()}` })] })] }));
127
+ return (_jsx(PasskeyList, { credentials: credentials, status: loading ? "loading" : passkeyMode ? "ready" : "unavailable", busy: busy, error: error, supported: webAuthnSupported, hostname: typeof window !== "undefined" ? window.location.hostname : "", onAdd: () => void onAdd(), onRename: (id, label) => void onRename(id, label), onDelete: (id) => void onDelete(id), onSignOut: () => void onSignOut() }));
120
128
  }
121
129
  //# sourceMappingURL=passkey-tab.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"passkey-tab.js","sourceRoot":"","sources":["../../../src/components/settings/passkey-tab.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,EACP,MAAM,EACN,MAAM,EACN,IAAI,EACJ,MAAM,EACN,CAAC,GACF,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C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AAG,EAAE,CAAC,KAAK,KAAK,EAAE,EACzB,QAAQ,EAAE,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,EACjD,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,QAAQ,CAAC,EAAE,CAAC,EACnC,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,SAAS,EAAE,GACjC,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { PiAuthProviderStatus, PiLoginFlow } from "../../lib/api-client.js";
2
+ /**
3
+ * Provider accounts, rendered from props (S7, the `settings` directory).
4
+ * `PiAccountsSection` is the container: the providers request, the login
5
+ * flow and its polling, the cancel and the disconnect live there; this
6
+ * draws the rows and the device-code card.
7
+ *
8
+ * A provider is a kit card `ListRow` with its state as the trailing value
9
+ * (teal "connected"); Connect and Disconnect are kit `Button`s beside it.
10
+ * The pending flow is an amber `Callout` carrying the code the user types
11
+ * at the provider's page — the verification link stays an anchor, because
12
+ * a link is what it is — and the settled flow is a teal or red `Callout`
13
+ * with a dismiss.
14
+ */
15
+ export interface AccountsListProps {
16
+ providers: PiAuthProviderStatus[];
17
+ /** The provider whose connect or disconnect is in flight. */
18
+ busy: string | null;
19
+ flow: PiLoginFlow | null;
20
+ error: string | null;
21
+ onConnect: (providerId: string) => void;
22
+ onDisconnect: (providerId: string) => void;
23
+ onCancelFlow: () => void;
24
+ onDismissFlow: () => void;
25
+ }
26
+ export declare function AccountsList(p: AccountsListProps): import("react").JSX.Element;
27
+ //# sourceMappingURL=pi-accounts-list.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-accounts-list.d.ts","sourceRoot":"","sources":["../../../src/components/settings/pi-accounts-list.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEjF;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,oBAAoB,EAAE,CAAC;IAClC,6DAA6D;IAC7D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,iBAAiB,+BAuDhD"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button, Callout, ListRow, StatusDot } from "@schlessera/brain-ui-kit";
3
+ export function AccountsList(p) {
4
+ const pending = p.flow?.status === "pending";
5
+ return (_jsxs("div", { className: "mt-6", children: [_jsx("h3", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Accounts" }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Model providers that sign in with an account instead of an API key." }), _jsx("ul", { className: "mt-4 flex flex-col gap-2", children: p.providers.map((provider) => (_jsxs("li", { className: "flex flex-col gap-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(ListRow, { variant: "card", icon: "model", iconTone: provider.configured ? "teal" : "neutral", title: provider.name, subtitle: provider.configured ? `Connected${provider.source ? ` · ${provider.source}` : ""}` : "Not connected", value: provider.configured ? "connected" : undefined, valueTone: "teal" }) }), provider.oauth && !provider.configured && (_jsx(Button, { label: p.busy === provider.providerId ? "Connecting…" : "Connect", icon: "passkey", tone: "ghost", size: "sm", block: false, disabled: p.busy !== null || pending, onClick: () => p.onConnect(provider.providerId) })), provider.configured && provider.source === "stored" && (_jsx("span", { title: "Disconnect", className: "flex", children: _jsx(Button, { label: "Disconnect", icon: "hand", tone: "quiet", size: "sm", block: false, disabled: p.busy !== null, onClick: () => p.onDisconnect(provider.providerId) }) }))] }), p.flow && p.flow.providerId === provider.providerId && (_jsx(LoginFlowCard, { flow: p.flow, onCancel: p.onCancelFlow, onDismiss: p.onDismissFlow }))] }, provider.providerId))) }), p.error && (_jsx("div", { role: "alert", className: "mt-3", children: _jsx(Callout, { tone: "red", variant: "banner", icon: "failed", mono: true, text: p.error }) }))] }));
6
+ }
7
+ function LoginFlowCard({ flow, onCancel, onDismiss }) {
8
+ if (flow.status === "pending") {
9
+ return (_jsx(Callout, { tone: "amber", variant: "boxed", icon: "passkey", children: _jsxs("div", { className: "flex flex-col gap-2", children: [_jsx("p", { className: "text-xs text-muted-foreground", children: "Enter this code at the provider's device page \u2014 on this or any other device:" }), _jsx("p", { className: "select-all text-center font-[family-name:var(--font-mono)] text-xl font-semibold tracking-widest text-foreground", children: flow.userCode ?? "…" }), _jsxs("div", { className: "flex flex-wrap items-center justify-center gap-2", children: [flow.verificationUri && (_jsx("a", { href: flow.verificationUri, target: "_blank", rel: "noreferrer", className: "flex items-center gap-1.5 rounded-[9px] bg-[var(--bk-amber-fill)] px-3 py-1.5 text-[11.5px] font-semibold text-[var(--bk-on-fill)] transition-[filter] hover:brightness-110", children: "Open verification page \u2197" })), _jsx(Button, { label: "Cancel", icon: "cancel", tone: "quiet", size: "sm", block: false, onClick: onCancel })] }), _jsxs("p", { className: "flex items-center justify-center gap-1.5 text-center text-[11px] text-muted-foreground", "aria-live": "polite", children: [_jsx(StatusDot, { tone: "amber", pulse: true, size: 6 }), "Waiting for approval\u2026"] })] }) }));
10
+ }
11
+ const ok = flow.status === "success";
12
+ const message = ok ? "Connected." : flow.status === "cancelled" ? "Login cancelled." : flow.error ?? "Login failed.";
13
+ return (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "min-w-0 flex-1", children: _jsx(Callout, { tone: ok ? "teal" : "red", variant: "banner", icon: ok ? "confirm" : "failed", mono: true, text: message }) }), _jsx(Button, { label: "Dismiss", tone: "quiet", size: "sm", block: false, onClick: onDismiss })] }));
14
+ }
15
+ //# sourceMappingURL=pi-accounts-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pi-accounts-list.js","sourceRoot":"","sources":["../../../src/components/settings/pi-accounts-list.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AA4B/E,MAAM,UAAU,YAAY,CAAC,CAAoB;IAC/C,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,SAAS,CAAC;IAC7C,OAAO,CACL,eAAK,SAAS,EAAC,MAAM,aACnB,aAAI,SAAS,EAAC,mEAAmE,yBAE5E,EACL,YAAG,SAAS,EAAC,oCAAoC,oFAE7C,EACJ,aAAI,SAAS,EAAC,0BAA0B,YACrC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAC7B,cAA8B,SAAS,EAAC,qBAAqB,aAC3D,eAAK,SAAS,EAAC,yBAAyB,aACtC,cAAK,SAAS,EAAC,gBAAgB,YAC7B,KAAC,OAAO,IACN,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,EAClD,KAAK,EAAE,QAAQ,CAAC,IAAI,EACpB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,EAC9G,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC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,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,eAAe,CAAC;IACrH,OAAO,CACL,eAAK,SAAS,EAAC,yBAAyB,aACtC,cAAK,SAAS,EAAC,gBAAgB,YAC7B,KAAC,OAAO,IAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,EAAE,OAAO,EAAC,QAAQ,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,IAAI,QAAC,IAAI,EAAE,OAAO,GAAI,GACxG,EACN,KAAC,MAAM,IAAC,KAAK,EAAC,SAAS,EAAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,GAAI,IAC/E,CACP,CAAC;AACJ,CAAC"}
@@ -6,6 +6,9 @@
6
6
  *
7
7
  * Renders nothing when the server reports no pi providers (pi not
8
8
  * configured), so the Models tab is unchanged for Claude-only deployments.
9
+ *
10
+ * This is the container (S7): the request, the flow and its polling, the
11
+ * cancel and the disconnect live here; `AccountsList` draws the rows.
9
12
  */
10
13
  export declare function PiAccountsSection({ active }: {
11
14
  active: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"pi-accounts.d.ts","sourceRoot":"","sources":["../../../src/components/settings/pi-accounts.tsx"],"names":[],"mappings":"AAMA;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,sCA+KhE"}
1
+ {"version":3,"file":"pi-accounts.d.ts","sourceRoot":"","sources":["../../../src/components/settings/pi-accounts.tsx"],"names":[],"mappings":"AAMA;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,sCAkJhE"}
@@ -1,9 +1,7 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect, useRef, useState } from "react";
3
- import { Check, ExternalLink, Loader2, LogOut, X } from "lucide-react";
4
- import { api } from "../../lib/api-client.js";
5
- import { useProviderStore } from "../../stores/provider-store.js";
6
- import { cn } from "../../lib/utils.js";
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useBrainUiRoot } from "../../root-context.js";
3
+ import { useCallback, useEffect, useRef, useState } from "react";
4
+ import { AccountsList } from "./pi-accounts-list.js";
7
5
  /**
8
6
  * Provider sign-in for the pi backend's OAuth vendors — most importantly
9
7
  * OpenAI (ChatGPT Plus/Pro), whose device-code flow needs no browser callback
@@ -12,12 +10,26 @@ import { cn } from "../../lib/utils.js";
12
10
  *
13
11
  * Renders nothing when the server reports no pi providers (pi not
14
12
  * configured), so the Models tab is unchanged for Claude-only deployments.
13
+ *
14
+ * This is the container (S7): the request, the flow and its polling, the
15
+ * cancel and the disconnect live here; `AccountsList` draws the rows.
15
16
  */
16
17
  export function PiAccountsSection({ active }) {
18
+ const root = useBrainUiRoot();
19
+ const api = root.api;
20
+ const lifetime = useRef(0);
21
+ const listRequest = useRef(0);
22
+ const flowRequest = useRef(0);
17
23
  const [providers, setProviders] = useState([]);
18
24
  const [error, setError] = useState(null);
19
25
  const [busy, setBusy] = useState(null);
20
- const [flow, setFlow] = useState(null);
26
+ const [ownedFlow, setOwnedFlow] = useState(null);
27
+ // The first render after root replacement must not poll the previous flow
28
+ // through the new API, even before the reset effect has run.
29
+ const flow = ownedFlow?.root === root ? ownedFlow.flow : null;
30
+ const setFlow = useCallback((flow) => {
31
+ setOwnedFlow(flow ? { root, flow } : null);
32
+ }, [root]);
21
33
  const pollTimer = useRef(null);
22
34
  function stopPolling() {
23
35
  if (pollTimer.current) {
@@ -25,56 +37,63 @@ export function PiAccountsSection({ active }) {
25
37
  pollTimer.current = null;
26
38
  }
27
39
  }
28
- async function reload() {
40
+ const reload = useCallback(async (quiet = false) => {
41
+ const generation = lifetime.current;
42
+ const request = ++listRequest.current;
43
+ const current = () => generation === lifetime.current && request === listRequest.current;
29
44
  try {
30
45
  const { providers } = await api.piAuthProviders();
31
- setProviders(providers);
46
+ if (current())
47
+ setProviders(providers);
32
48
  }
33
49
  catch (err) {
34
- setError(err instanceof Error ? err.message : "Could not load accounts");
50
+ if (!current())
51
+ return;
52
+ // Older servers without this endpoint simply hide the initial card.
53
+ if (quiet)
54
+ setProviders([]);
55
+ else
56
+ setError(err instanceof Error ? err.message : "Could not load accounts");
35
57
  }
36
- }
58
+ }, [api]);
37
59
  useEffect(() => {
38
- if (!active)
39
- return;
40
- let cancelled = false;
41
- api
42
- .piAuthProviders()
43
- .then(({ providers }) => {
44
- if (!cancelled)
45
- setProviders(providers);
46
- })
47
- .catch(() => {
48
- // A server without the endpoint (older release) just hides the card.
49
- if (!cancelled)
50
- setProviders([]);
51
- });
52
- return () => {
53
- cancelled = true;
54
- };
55
- }, [active]);
60
+ lifetime.current++;
61
+ setProviders([]);
62
+ setError(null);
63
+ setBusy(null);
64
+ setFlow(null);
65
+ if (active)
66
+ void reload(true);
67
+ const invalidate = () => { lifetime.current++; };
68
+ return invalidate;
69
+ }, [active, root, reload, setFlow]);
56
70
  // Poll the pending flow until it settles. Chained timeouts rather than an
57
71
  // interval, so a slow response never stacks requests.
58
72
  useEffect(() => {
59
- if (!flow || flow.status !== "pending")
73
+ if (!active || !flow || flow.status !== "pending")
60
74
  return;
75
+ const generation = lifetime.current;
76
+ const request = flowRequest.current;
61
77
  let disposed = false;
78
+ const current = () => !disposed && generation === lifetime.current && request === flowRequest.current;
62
79
  const delayMs = (flow.intervalSeconds ?? 5) * 1000;
63
80
  const tick = async () => {
64
81
  try {
82
+ if (!current())
83
+ return;
65
84
  const { flow: next } = await api.piAuthFlow(flow.id);
66
- if (disposed)
85
+ if (!current())
67
86
  return;
68
87
  setFlow(next);
69
88
  if (next.status === "success") {
70
89
  void reload();
71
90
  // A connected subscription account can change the picker's default
72
91
  // ordering — refresh the composer's roster copy too.
73
- void useProviderStore.getState().loadProviders();
92
+ void root.stores.provider.getState().loadProviders();
74
93
  }
75
94
  }
76
95
  catch {
77
- if (disposed)
96
+ if (!current())
78
97
  return;
79
98
  // Transient poll failure: keep trying until the flow expires.
80
99
  pollTimer.current = setTimeout(tick, delayMs);
@@ -86,66 +105,65 @@ export function PiAccountsSection({ active }) {
86
105
  disposed = true;
87
106
  stopPolling();
88
107
  };
89
- }, [flow]);
108
+ }, [active, flow, root, api, reload, setFlow]);
90
109
  async function connect(providerId) {
110
+ const generation = lifetime.current;
111
+ const request = ++flowRequest.current;
112
+ const current = () => generation === lifetime.current && request === flowRequest.current;
91
113
  setBusy(providerId);
92
114
  setError(null);
93
115
  try {
94
116
  const { flow } = await api.piAuthStart(providerId);
117
+ if (!current())
118
+ return;
95
119
  setFlow(flow);
96
120
  if (flow.status === "error")
97
121
  setError(flow.error ?? "Login failed");
98
122
  }
99
123
  catch (err) {
100
- setError(err instanceof Error ? err.message : "Could not start login");
124
+ if (current())
125
+ setError(err instanceof Error ? err.message : "Could not start login");
101
126
  }
102
127
  finally {
103
- setBusy(null);
128
+ if (current())
129
+ setBusy(null);
104
130
  }
105
131
  }
106
132
  async function cancel() {
107
133
  if (!flow)
108
134
  return;
135
+ flowRequest.current++;
109
136
  stopPolling();
137
+ setFlow(null);
110
138
  try {
111
139
  await api.piAuthCancel(flow.id);
112
140
  }
113
141
  catch {
114
142
  // The flow record may already be gone; clearing locally is enough.
115
143
  }
116
- setFlow(null);
117
144
  }
118
145
  async function disconnect(providerId) {
146
+ const generation = lifetime.current;
147
+ const current = () => generation === lifetime.current;
119
148
  setBusy(providerId);
120
149
  setError(null);
121
150
  try {
122
151
  await api.piAuthLogout(providerId);
152
+ if (!current())
153
+ return;
123
154
  await reload();
124
155
  }
125
156
  catch (err) {
126
- setError(err instanceof Error ? err.message : "Could not disconnect");
157
+ if (current())
158
+ setError(err instanceof Error ? err.message : "Could not disconnect");
127
159
  }
128
160
  finally {
129
- setBusy(null);
161
+ if (current())
162
+ setBusy(null);
130
163
  }
131
164
  }
132
165
  if (providers.length === 0)
133
166
  return null;
134
- return (_jsxs("div", { className: "mt-6", children: [_jsx("h3", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Accounts" }), _jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: "Model providers that sign in with an account instead of an API key." }), _jsx("ul", { className: "mt-4 flex flex-col gap-2", children: providers.map((provider) => (_jsxs("li", { className: "rounded-lg border border-border-subtle bg-surface p-3", children: [_jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("div", { className: "min-w-0 flex-1", children: [_jsx("p", { className: "truncate text-sm text-foreground", children: provider.name }), _jsx("p", { className: "truncate text-[11px] text-muted-foreground", children: provider.configured
135
- ? `Connected${provider.source ? ` · ${provider.source}` : ""}`
136
- : "Not connected" })] }), provider.configured && (_jsx(Check, { className: "h-4 w-4 shrink-0 text-accent" })), provider.oauth && !provider.configured && (_jsx("button", { onClick: () => connect(provider.providerId), disabled: busy !== null || flow?.status === "pending", className: "shrink-0 rounded-lg border border-border-subtle bg-surface px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:border-primary hover:text-primary disabled:opacity-50", children: busy === provider.providerId ? (_jsx(Loader2, { className: "h-3.5 w-3.5 animate-spin" })) : ("Connect") })), provider.configured && provider.source === "stored" && (_jsx("button", { onClick: () => disconnect(provider.providerId), disabled: busy !== null, title: "Disconnect", className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-muted-foreground transition-colors hover:bg-surface-raised hover:text-destructive", children: _jsx(LogOut, { className: "h-4 w-4" }) }))] }), flow && flow.providerId === provider.providerId && (_jsx(LoginFlowCard, { flow: flow, onCancel: cancel, onDismiss: () => setFlow(null) }))] }, provider.providerId))) }), error && (_jsx("p", { role: "alert", className: "mt-3 text-xs text-destructive", children: error }))] }));
137
- }
138
- function LoginFlowCard({ flow, onCancel, onDismiss, }) {
139
- if (flow.status === "pending") {
140
- return (_jsxs("div", { className: "mt-3 rounded-lg border border-primary/40 bg-primary/5 p-3", children: [_jsx("p", { className: "text-xs text-muted-foreground", children: "Enter this code at the provider's device page \u2014 on this or any other device:" }), _jsx("p", { className: "mt-2 select-all text-center font-[family-name:var(--font-mono)] text-xl font-semibold tracking-widest text-foreground", children: flow.userCode ?? "…" }), _jsxs("div", { className: "mt-3 flex items-center justify-center gap-2", children: [flow.verificationUri && (_jsxs("a", { href: flow.verificationUri, target: "_blank", rel: "noreferrer", className: "flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground transition-colors hover:brightness-110", children: [_jsx(ExternalLink, { className: "h-3 w-3" }), "Open verification page"] })), _jsxs("button", { onClick: onCancel, className: "flex items-center gap-1.5 rounded-lg border border-border-subtle px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground", children: [_jsx(X, { className: "h-3 w-3" }), "Cancel"] })] }), _jsxs("p", { className: "mt-2 flex items-center justify-center gap-1.5 text-center text-[11px] text-muted-foreground", children: [_jsx(Loader2, { className: "h-3 w-3 animate-spin" }), "Waiting for approval\u2026"] })] }));
141
- }
142
- const message = flow.status === "success"
143
- ? "Connected."
144
- : flow.status === "cancelled"
145
- ? "Login cancelled."
146
- : flow.error ?? "Login failed.";
147
- return (_jsxs("div", { className: cn("mt-3 flex items-center justify-between rounded-lg border p-3 text-xs", flow.status === "success"
148
- ? "border-border-subtle text-muted-foreground"
149
- : "border-destructive/30 text-destructive"), children: [_jsx("span", { children: message }), _jsx("button", { onClick: onDismiss, className: "text-muted-foreground transition-colors hover:text-foreground", children: _jsx(X, { className: "h-3.5 w-3.5" }) })] }));
167
+ return (_jsx(AccountsList, { providers: providers, busy: busy, flow: flow, error: error, onConnect: (id) => void connect(id), onDisconnect: (id) => void disconnect(id), onCancelFlow: () => void cancel(), onDismissFlow: () => setFlow(null) }));
150
168
  }
151
169
  //# sourceMappingURL=pi-accounts.js.map