@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
@@ -1 +1 @@
1
- {"version":3,"file":"connection-store.js","sourceRoot":"","sources":["../../src/stores/connection-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAgDjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAkB,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAClE,QAAQ,EAAE,cAAc;IACxB,SAAS,EAAE,UAAU;IACrB,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,IAAI;IACnB,WAAW,EAAE,CAAC;IACd,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5C,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;IAC/C,aAAa,EAAE,CAAC,MAAM,EAAE,aAAa,EAAE,EAAE,CACvC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACd,aAAa;QACb,iBAAiB,EAAE,MAAM;YACvB,CAAC,CAAC,KAAK,CAAC,iBAAiB;YACzB,CAAC,CAAC,KAAK,CAAC,iBAAiB,GAAG,CAAC;KAChC,CAAC,CAAC;IACL,cAAc,EAAE,GAAG,EAAE,CACnB,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACd,iBAAiB,EAAE,CAAC;QACpB,0EAA0E;QAC1E,sEAAsE;QACtE,sEAAsE;QACtE,aAAa,EAAE,IAAI;QACnB,WAAW,EAAE,KAAK,CAAC,WAAW,GAAG,CAAC;KACnC,CAAC,CAAC;IACL,WAAW,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,EAAE,CAAC;IACrF,UAAU,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;CAC3C,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"connection-store.js","sourceRoot":"","sources":["../../src/stores/connection-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,cAAc,uBAAuB,CAAC;AAEtC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAC7C,SAAS,kBAAkB,CAAI,QAAiF;IAC9G,OAAO,YAAY,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC,EACD,WAAW,CAAC,MAAM,CAAC,UAAU,CAC9B,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { StoreEnvironment } from "./store-environment.js";
2
+ export declare function createBrainStores(env: StoreEnvironment): {
3
+ provider: import("zustand").StoreApi<import("./provider-state.js").ProviderState>;
4
+ chat: import("zustand").StoreApi<import("./chat-state.js").ChatState>;
5
+ ui: import("zustand").StoreApi<import("./ui-state.js").UIState>;
6
+ connection: import("zustand").StoreApi<import("./connection-state.js").ConnectionState>;
7
+ file: import("zustand").StoreApi<import("./file-state.js").FileState>;
8
+ graph: import("zustand").StoreApi<import("./graph-state.js").GraphState> & {
9
+ clearSceneCache: () => void;
10
+ dispose(): void;
11
+ };
12
+ activity: import("zustand").StoreApi<import("./activity-store-types.js").ActivityState> & {
13
+ loadSessionActivityHistory: (sessionId: string) => Promise<void>;
14
+ loadSpanPayloads: (spanId: string) => Promise<void>;
15
+ dispose(): void;
16
+ };
17
+ principal: import("zustand").StoreApi<import("./principal-state.js").PrincipalState>;
18
+ mask: import("zustand").StoreApi<import("./mask-state.js").MaskState>;
19
+ share: import("zustand").StoreApi<import("./share-state.js").ShareIntakeState>;
20
+ voice: import("zustand").StoreApi<import("../voice/voice-state.js").VoiceState>;
21
+ };
22
+ export type BrainStores = ReturnType<typeof createBrainStores>;
23
+ //# sourceMappingURL=create-stores.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-stores.d.ts","sourceRoot":"","sources":["../../src/stores/create-stores.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;EAetD;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { createUIStore } from "./ui-state.js";
2
+ import { createConnectionStore } from "./connection-state.js";
3
+ import { createProviderStore } from "./provider-state.js";
4
+ import { createChatStore } from "./chat-state.js";
5
+ import { createFileStore } from "./file-state.js";
6
+ import { createGraphStore } from "./graph-state.js";
7
+ import { createActivityStore } from "./activity-state.js";
8
+ import { createPrincipalStore } from "./principal-state.js";
9
+ import { createMaskStore } from "./mask-state.js";
10
+ import { createShareStore } from "./share-state.js";
11
+ import { createVoiceStore } from "../voice/voice-state.js";
12
+ export function createBrainStores(env) {
13
+ const provider = createProviderStore(env);
14
+ return {
15
+ provider,
16
+ chat: createChatStore(env, provider),
17
+ ui: createUIStore(env),
18
+ connection: createConnectionStore(),
19
+ file: createFileStore(env),
20
+ graph: createGraphStore(env),
21
+ activity: createActivityStore(env),
22
+ principal: createPrincipalStore(env),
23
+ mask: createMaskStore(),
24
+ share: createShareStore(),
25
+ voice: createVoiceStore(),
26
+ };
27
+ }
28
+ //# sourceMappingURL=create-stores.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-stores.js","sourceRoot":"","sources":["../../src/stores/create-stores.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,MAAM,UAAU,iBAAiB,CAAC,GAAqB;IACrD,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO;QACL,QAAQ;QACR,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,QAAQ,CAAC;QACpC,EAAE,EAAE,aAAa,CAAC,GAAG,CAAC;QACtB,UAAU,EAAE,qBAAqB,EAAE;QACnC,IAAI,EAAE,eAAe,CAAC,GAAG,CAAC;QAC1B,KAAK,EAAE,gBAAgB,CAAC,GAAG,CAAC;QAC5B,QAAQ,EAAE,mBAAmB,CAAC,GAAG,CAAC;QAClC,SAAS,EAAE,oBAAoB,CAAC,GAAG,CAAC;QACpC,IAAI,EAAE,eAAe,EAAE;QACvB,KAAK,EAAE,gBAAgB,EAAE;QACzB,KAAK,EAAE,gBAAgB,EAAE;KAC1B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ import type { FileEntry, FileContentResponse } from "@schlessera/brain-ui-sdk/protocol";
2
+ import type { StoreEnvironment } from "./store-environment.js";
3
+ export interface FileState {
4
+ dirCache: Record<string, FileEntry[]>;
5
+ loadingDirs: Set<string>;
6
+ dirErrors: Record<string, string>;
7
+ expandedDirs: Set<string>;
8
+ currentPath: string | null;
9
+ currentContent: FileContentResponse | null;
10
+ contentLoading: boolean;
11
+ contentError: string | null;
12
+ viewMode: ViewMode;
13
+ treeExpanded: boolean;
14
+ /**
15
+ * Whether the frontmatter table at the top of markdown files is collapsed.
16
+ * Persisted in localStorage so the preference carries across files.
17
+ */
18
+ frontmatterCollapsed: boolean;
19
+ /**
20
+ * Directory most recently navigated to via openDir. Used by the tree to
21
+ * apply a brief highlight + scroll the node into view. Cleared shortly
22
+ * after by openDir itself.
23
+ */
24
+ highlightedDir: string | null;
25
+ /**
26
+ * Lowercase slug -> repo-relative .md path. Lazily loaded the first
27
+ * time a markdown surface needs to resolve a [[wikilink]].
28
+ */
29
+ wikilinkMap: Record<string, string>;
30
+ wikilinkLoaded: boolean;
31
+ wikilinkLoading: boolean;
32
+ loadDir: (path: string) => Promise<void>;
33
+ toggleDir: (path: string) => Promise<void>;
34
+ setExpanded: (path: string, expanded: boolean) => void;
35
+ openFile: (path: string) => Promise<void>;
36
+ openDir: (path: string) => Promise<void>;
37
+ closeFile: () => void;
38
+ setViewMode: (mode: ViewMode) => void;
39
+ setTreeExpanded: (expanded: boolean) => void;
40
+ toggleFrontmatter: () => void;
41
+ setHighlightedDir: (path: string | null) => void;
42
+ ensureWikilinks: () => Promise<void>;
43
+ reset: () => void;
44
+ }
45
+ export type ViewMode = "preview" | "raw";
46
+ export declare function createFileStore(env: StoreEnvironment): import("zustand").StoreApi<FileState>;
47
+ export declare function isInternalRepoPath(href: string | undefined): href is string;
48
+ export declare function isInternalRepoDir(href: string | undefined): href is string;
49
+ export type RepoPathKind = "file" | "dir";
50
+ export declare function classifyRepoPath(href: string | undefined): RepoPathKind | null;
51
+ /** Normalize a directory ref by trimming the trailing slash. */
52
+ export declare function normalizeDirPath(path: string): string;
53
+ //# sourceMappingURL=file-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-state.d.ts","sourceRoot":"","sources":["../../src/stores/file-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EAGpB,MAAM,mCAAmC,CAAC;AAE3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAG/D,MAAM,WAAW,SAAS;IAExB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACtC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAG1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC3C,cAAc,EAAE,OAAO,CAAC;IACxB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,OAAO,CAAC;IACtB;;;O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,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,IAAI,MAAM,CAI1E;AAED,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,KAAK,CAAC;AAE1C,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,GAAG,SAAS,GACvB,YAAY,GAAG,IAAI,CAIrB;AAED,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAErD"}
@@ -0,0 +1,341 @@
1
+ import { createStore } from "zustand/vanilla";
2
+ import { FILE_SIZE_CAP_BYTES } from "@schlessera/brain-ui-sdk/protocol";
3
+ import { isMermaidPath } from "../lib/mermaid.js";
4
+ /** Kinds/paths the viewer can render as a preview (vs raw text only). */
5
+ function hasPreview(content) {
6
+ return (content.kind === "markdown" ||
7
+ content.kind === "html" ||
8
+ (content.kind === "text" && isMermaidPath(content.path)));
9
+ }
10
+ export function createFileStore(env) {
11
+ const apiBase = env.apiBase;
12
+ const fetch = env.request;
13
+ const FRONTMATTER_COLLAPSED_KEY = env.storageKey("brain-ui:frontmatter-collapsed");
14
+ function readFrontmatterCollapsed() {
15
+ const storage = env.storage();
16
+ if (!storage)
17
+ return false;
18
+ return env.storage()?.getItem(FRONTMATTER_COLLAPSED_KEY) === "1";
19
+ }
20
+ async function fetchTree(path) {
21
+ const url = `${apiBase()}/files/tree${path ? `?path=${encodeURIComponent(path)}` : ""}`;
22
+ const res = await fetch(url);
23
+ if (!res.ok) {
24
+ const body = await res.json().catch(() => ({ error: res.statusText }));
25
+ throw new Error(body.error || `HTTP ${res.status}`);
26
+ }
27
+ const data = await res.json();
28
+ return data.entries;
29
+ }
30
+ async function fetchContent(path, signal) {
31
+ const res = await fetch(`${apiBase()}/files/content?path=${encodeURIComponent(path)}`, { signal });
32
+ if (!res.ok) {
33
+ const body = await res.json().catch(() => ({ error: res.statusText }));
34
+ const err = new Error(body.error || `HTTP ${res.status}`);
35
+ err.status = res.status;
36
+ if (body.size)
37
+ err.size = body.size;
38
+ throw err;
39
+ }
40
+ return res.json();
41
+ }
42
+ async function fetchResolve(path, signal) {
43
+ const res = await fetch(`${apiBase()}/files/resolve?path=${encodeURIComponent(path)}`, { signal });
44
+ if (!res.ok) {
45
+ const body = await res.json().catch(() => ({ error: res.statusText }));
46
+ throw new Error(body.error || `HTTP ${res.status}`);
47
+ }
48
+ return res.json();
49
+ }
50
+ async function fetchWikilinks() {
51
+ const res = await fetch(`${apiBase()}/files/wikilinks`);
52
+ if (!res.ok) {
53
+ const body = await res.json().catch(() => ({ error: res.statusText }));
54
+ throw new Error(body.error || `HTTP ${res.status}`);
55
+ }
56
+ return res.json();
57
+ }
58
+ let fileRequest = null;
59
+ let directoryRequest = null;
60
+ let cacheEpoch = 0;
61
+ return createStore((set, get) => ({
62
+ dirCache: {},
63
+ loadingDirs: new Set(),
64
+ dirErrors: {},
65
+ expandedDirs: new Set([""]),
66
+ currentPath: null,
67
+ currentContent: null,
68
+ contentLoading: false,
69
+ contentError: null,
70
+ viewMode: "preview",
71
+ treeExpanded: true,
72
+ frontmatterCollapsed: readFrontmatterCollapsed(),
73
+ highlightedDir: null,
74
+ wikilinkMap: {},
75
+ wikilinkLoaded: false,
76
+ wikilinkLoading: false,
77
+ loadDir: async (path) => {
78
+ const epoch = cacheEpoch;
79
+ const { dirCache, loadingDirs } = get();
80
+ if (dirCache[path] || loadingDirs.has(path))
81
+ return;
82
+ const next = new Set(loadingDirs);
83
+ next.add(path);
84
+ set({ loadingDirs: next });
85
+ try {
86
+ const entries = await fetchTree(path);
87
+ if (epoch !== cacheEpoch)
88
+ return;
89
+ set((s) => {
90
+ const loading = new Set(s.loadingDirs);
91
+ loading.delete(path);
92
+ const errors = { ...s.dirErrors };
93
+ delete errors[path];
94
+ return {
95
+ dirCache: { ...s.dirCache, [path]: entries },
96
+ loadingDirs: loading,
97
+ dirErrors: errors,
98
+ };
99
+ });
100
+ }
101
+ catch (err) {
102
+ if (epoch !== cacheEpoch)
103
+ return;
104
+ set((s) => {
105
+ const loading = new Set(s.loadingDirs);
106
+ loading.delete(path);
107
+ return {
108
+ loadingDirs: loading,
109
+ dirErrors: { ...s.dirErrors, [path]: err instanceof Error ? err.message : "load_failed" },
110
+ };
111
+ });
112
+ }
113
+ },
114
+ toggleDir: async (path) => {
115
+ const { expandedDirs } = get();
116
+ if (expandedDirs.has(path)) {
117
+ const next = new Set(expandedDirs);
118
+ next.delete(path);
119
+ set({ expandedDirs: next });
120
+ }
121
+ else {
122
+ const next = new Set(expandedDirs);
123
+ next.add(path);
124
+ set({ expandedDirs: next });
125
+ await get().loadDir(path);
126
+ }
127
+ },
128
+ setExpanded: (path, expanded) => {
129
+ set((s) => {
130
+ const next = new Set(s.expandedDirs);
131
+ if (expanded)
132
+ next.add(path);
133
+ else
134
+ next.delete(path);
135
+ return { expandedDirs: next };
136
+ });
137
+ },
138
+ openFile: async (path) => {
139
+ fileRequest?.abort();
140
+ directoryRequest?.abort();
141
+ const request = new AbortController();
142
+ fileRequest = request;
143
+ const ownsRequest = () => fileRequest === request && !request.signal.aborted;
144
+ const normalized = path.replace(/^\/+/, "").replace(/\\/g, "/");
145
+ set({ currentPath: normalized, contentLoading: true, contentError: null, currentContent: null, treeExpanded: false });
146
+ // Fire-and-await: load ancestor chain then content in parallel
147
+ const ancestorsPromise = (async () => {
148
+ try {
149
+ const r = await fetchResolve(normalized, request.signal);
150
+ if (!ownsRequest())
151
+ return;
152
+ // Expand each ancestor and root, load their contents
153
+ const dirsToLoad = ["", ...r.ancestors];
154
+ set((s) => {
155
+ const next = new Set(s.expandedDirs);
156
+ for (const d of dirsToLoad)
157
+ next.add(d);
158
+ return { expandedDirs: next };
159
+ });
160
+ await Promise.all(dirsToLoad.map((d) => get().loadDir(d)));
161
+ }
162
+ catch {
163
+ // Tree expansion best-effort
164
+ }
165
+ })();
166
+ try {
167
+ const content = await fetchContent(normalized, request.signal);
168
+ // Drop a response the user has already navigated away from. Two rapid
169
+ // clicks race, and without this the SLOWER fetch wins: the viewer showed
170
+ // the newer file's path with the older file's content, which reads as
171
+ // corruption rather than as a stale load.
172
+ if (!ownsRequest())
173
+ return;
174
+ set({ currentContent: content, contentLoading: false });
175
+ // Default mode: prefer preview when available; persist otherwise
176
+ const { viewMode } = get();
177
+ if (!hasPreview(content) && viewMode === "preview") {
178
+ set({ viewMode: "raw" });
179
+ }
180
+ else if (hasPreview(content) && viewMode === "raw") {
181
+ // Keep raw if user toggled — but on a fresh open default back to preview
182
+ set({ viewMode: "preview" });
183
+ }
184
+ }
185
+ catch (err) {
186
+ const e = err;
187
+ let msg = e.message || "load_failed";
188
+ if (e.status === 413 && e.size)
189
+ msg = `File too large (${(e.size / 1024 / 1024).toFixed(2)} MB; cap ${(FILE_SIZE_CAP_BYTES / 1024 / 1024).toFixed(0)} MB).`;
190
+ else if (e.status === 404)
191
+ msg = "File not found.";
192
+ else if (e.message === "invalid_path")
193
+ msg = "Invalid path.";
194
+ // Same guard: a failure for a file the user already left must not
195
+ // replace the file they are now looking at with an error.
196
+ if (!ownsRequest())
197
+ return;
198
+ set({ contentError: msg, contentLoading: false });
199
+ }
200
+ finally {
201
+ await ancestorsPromise;
202
+ }
203
+ },
204
+ closeFile: () => {
205
+ fileRequest?.abort();
206
+ fileRequest = null;
207
+ set({ currentPath: null, currentContent: null, contentError: null, contentLoading: false, treeExpanded: true });
208
+ },
209
+ openDir: async (path) => {
210
+ directoryRequest?.abort();
211
+ const request = new AbortController();
212
+ directoryRequest = request;
213
+ const normalized = path
214
+ .replace(/^\/+/, "")
215
+ .replace(/\\/g, "/")
216
+ .replace(/\/+$/, "");
217
+ if (!normalized) {
218
+ // Just expand the root view
219
+ set({ treeExpanded: true });
220
+ return;
221
+ }
222
+ // Make the tree visible even if a file is currently open.
223
+ set({ treeExpanded: true, highlightedDir: normalized });
224
+ try {
225
+ const r = await fetchResolve(normalized, request.signal);
226
+ if (directoryRequest !== request || request.signal.aborted)
227
+ return;
228
+ const dirs = ["", ...r.ancestors, normalized];
229
+ set((s) => {
230
+ const next = new Set(s.expandedDirs);
231
+ for (const d of dirs)
232
+ next.add(d);
233
+ return { expandedDirs: next };
234
+ });
235
+ await Promise.all(dirs.map((d) => get().loadDir(d)));
236
+ }
237
+ catch {
238
+ // Best-effort expansion — failure surfaces via per-dir error state
239
+ }
240
+ },
241
+ setViewMode: (mode) => set({ viewMode: mode }),
242
+ setTreeExpanded: (expanded) => set({ treeExpanded: expanded }),
243
+ setHighlightedDir: (path) => set({ highlightedDir: path }),
244
+ ensureWikilinks: async () => {
245
+ const epoch = cacheEpoch;
246
+ const { wikilinkLoaded, wikilinkLoading } = get();
247
+ if (wikilinkLoaded || wikilinkLoading)
248
+ return;
249
+ set({ wikilinkLoading: true });
250
+ try {
251
+ const data = await fetchWikilinks();
252
+ if (epoch !== cacheEpoch)
253
+ return;
254
+ set({
255
+ wikilinkMap: data.slugs,
256
+ wikilinkLoaded: true,
257
+ wikilinkLoading: false,
258
+ });
259
+ }
260
+ catch {
261
+ // Soft-fail — leave the map empty; wikilinks will render as plain text
262
+ if (epoch !== cacheEpoch)
263
+ return;
264
+ set({ wikilinkLoading: false });
265
+ }
266
+ },
267
+ toggleFrontmatter: () => set((s) => {
268
+ const next = !s.frontmatterCollapsed;
269
+ if (env.storage() !== null) {
270
+ if (next)
271
+ env.storage()?.setItem(FRONTMATTER_COLLAPSED_KEY, "1");
272
+ else
273
+ env.storage()?.removeItem(FRONTMATTER_COLLAPSED_KEY);
274
+ }
275
+ return { frontmatterCollapsed: next };
276
+ }),
277
+ reset: () => {
278
+ fileRequest?.abort();
279
+ directoryRequest?.abort();
280
+ fileRequest = null;
281
+ directoryRequest = null;
282
+ cacheEpoch++;
283
+ set({
284
+ dirCache: {}, loadingDirs: new Set(), dirErrors: {}, expandedDirs: new Set([""]),
285
+ highlightedDir: null, wikilinkMap: {}, wikilinkLoaded: false, wikilinkLoading: false,
286
+ currentPath: null,
287
+ currentContent: null,
288
+ contentLoading: false,
289
+ contentError: null,
290
+ viewMode: "preview",
291
+ treeExpanded: true,
292
+ });
293
+ },
294
+ }));
295
+ }
296
+ /**
297
+ * Heuristics: is this string a plausible repo-relative path reference?
298
+ *
299
+ * Files require a trailing `.ext` (1-8 alphanumeric chars). Directories
300
+ * require at least one `/` segment and a trailing `/`. Neither may look
301
+ * like a URL, an absolute path, or a version number.
302
+ */
303
+ const FILE_REF_RE = /^[a-z0-9_.-]+(\/[a-z0-9_.-]+)*\.[a-z0-9]{1,8}$/i;
304
+ const DIR_REF_RE = /^[a-z0-9_.-]+(\/[a-z0-9_.-]+)+\/$/i;
305
+ const URL_LIKE_RE = /^(?:https?:|mailto:|tel:|#|\/)/i;
306
+ const VERSION_RE = /^\d+(\.\d+){1,3}$/;
307
+ function rejectsCommonNonPath(href) {
308
+ if (URL_LIKE_RE.test(href))
309
+ return true;
310
+ if (VERSION_RE.test(href))
311
+ return true;
312
+ if (href.includes(" "))
313
+ return true;
314
+ return false;
315
+ }
316
+ export function isInternalRepoPath(href) {
317
+ if (!href)
318
+ return false;
319
+ if (rejectsCommonNonPath(href))
320
+ return false;
321
+ return FILE_REF_RE.test(href);
322
+ }
323
+ export function isInternalRepoDir(href) {
324
+ if (!href)
325
+ return false;
326
+ if (rejectsCommonNonPath(href))
327
+ return false;
328
+ return DIR_REF_RE.test(href);
329
+ }
330
+ export function classifyRepoPath(href) {
331
+ if (isInternalRepoPath(href))
332
+ return "file";
333
+ if (isInternalRepoDir(href))
334
+ return "dir";
335
+ return null;
336
+ }
337
+ /** Normalize a directory ref by trimming the trailing slash. */
338
+ export function normalizeDirPath(path) {
339
+ return path.replace(/\/+$/, "");
340
+ }
341
+ //# sourceMappingURL=file-state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file-state.js","sourceRoot":"","sources":["../../src/stores/file-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAO9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAExE,OA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iB,CAAC,IAAwB;IACxD,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACxB,IAAI,oBAAoB,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC;AAID,MAAM,UAAU,gBAAgB,CAC9B,IAAwB;IAExB,IAAI,kBAAkB,CAAC,IAAI,CAAC;QAAE,OAAO,MAAM,CAAC;IAC5C,IAAI,iBAAiB,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,OAAO,IAAI,CAAC;AACd,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAClC,CAAC"}
@@ -1,53 +1,5 @@
1
- import type { FileEntry, FileContentResponse } from "@schlessera/brain-ui-sdk/protocol";
2
- export type ViewMode = "preview" | "raw";
3
- interface FileState {
4
- dirCache: Record<string, FileEntry[]>;
5
- loadingDirs: Set<string>;
6
- dirErrors: Record<string, string>;
7
- expandedDirs: Set<string>;
8
- currentPath: string | null;
9
- currentContent: FileContentResponse | null;
10
- contentLoading: boolean;
11
- contentError: string | null;
12
- viewMode: ViewMode;
13
- treeExpanded: boolean;
14
- /**
15
- * Whether the frontmatter table at the top of markdown files is collapsed.
16
- * Persisted in localStorage so the preference carries across files.
17
- */
18
- frontmatterCollapsed: boolean;
19
- /**
20
- * Directory most recently navigated to via openDir. Used by the tree to
21
- * apply a brief highlight + scroll the node into view. Cleared shortly
22
- * after by openDir itself.
23
- */
24
- highlightedDir: string | null;
25
- /**
26
- * Lowercase slug -> repo-relative .md path. Lazily loaded the first
27
- * time a markdown surface needs to resolve a [[wikilink]].
28
- */
29
- wikilinkMap: Record<string, string>;
30
- wikilinkLoaded: boolean;
31
- wikilinkLoading: boolean;
32
- loadDir: (path: string) => Promise<void>;
33
- toggleDir: (path: string) => Promise<void>;
34
- setExpanded: (path: string, expanded: boolean) => void;
35
- openFile: (path: string) => Promise<void>;
36
- openDir: (path: string) => Promise<void>;
37
- closeFile: () => void;
38
- setViewMode: (mode: ViewMode) => void;
39
- setTreeExpanded: (expanded: boolean) => void;
40
- toggleFrontmatter: () => void;
41
- setHighlightedDir: (path: string | null) => void;
42
- ensureWikilinks: () => Promise<void>;
43
- reset: () => void;
44
- }
45
- export declare const useFileStore: import("zustand").UseBoundStore<import("zustand").StoreApi<FileState>>;
46
- export declare function isInternalRepoPath(href: string | undefined): href is string;
47
- export declare function isInternalRepoDir(href: string | undefined): href is string;
48
- export type RepoPathKind = "file" | "dir";
49
- export declare function classifyRepoPath(href: string | undefined): RepoPathKind | null;
50
- /** Normalize a directory ref by trimming the trailing slash. */
51
- export declare function normalizeDirPath(path: string): string;
52
- export {};
1
+ import { defaultRoot } from "../default-root.js";
2
+ export * from "./file-state.js";
3
+ /** Hook reads the current provider. Statics address the default app only. */
4
+ export declare const useFileStore: (<T>(selector: (state: ReturnType<typeof defaultRoot.stores.file.getState>) => T) => T) & import("zustand").StoreApi<import("./file-state.js").FileState>;
53
5
  //# sourceMappingURL=file-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-store.d.ts","sourceRoot":"","sources":["../../src/stores/file-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,SAAS,EACT,mBAAmB,EAGpB,MAAM,mCAAmC,CAAC;AAK3C,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,KAAK,CAAC;AAkBzC,UAAU,SAAS;IAEjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;IACtC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAG1B,WAAW,EAAE,MAAM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