@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.
- package/README.md +89 -4
- package/dist/components/activity/activity-page.d.ts +17 -5
- package/dist/components/activity/activity-page.d.ts.map +1 -1
- package/dist/components/activity/activity-page.js +144 -50
- package/dist/components/activity/activity-page.js.map +1 -1
- package/dist/components/activity/activity-run-detail.d.ts +16 -1
- package/dist/components/activity/activity-run-detail.d.ts.map +1 -1
- package/dist/components/activity/activity-run-detail.js +47 -4
- package/dist/components/activity/activity-run-detail.js.map +1 -1
- package/dist/components/activity/activity-run-list.d.ts +7 -1
- package/dist/components/activity/activity-run-list.d.ts.map +1 -1
- package/dist/components/activity/activity-run-list.js +16 -8
- package/dist/components/activity/activity-run-list.js.map +1 -1
- package/dist/components/activity/activity-views.d.ts +63 -0
- package/dist/components/activity/activity-views.d.ts.map +1 -0
- package/dist/components/activity/activity-views.js +52 -0
- package/dist/components/activity/activity-views.js.map +1 -0
- package/dist/components/activity/approval-card.d.ts +11 -0
- package/dist/components/activity/approval-card.d.ts.map +1 -0
- package/dist/components/activity/approval-card.js +46 -0
- package/dist/components/activity/approval-card.js.map +1 -0
- package/dist/components/activity/digest-card.d.ts +3 -0
- package/dist/components/activity/digest-card.d.ts.map +1 -1
- package/dist/components/activity/digest-card.js +20 -16
- package/dist/components/activity/digest-card.js.map +1 -1
- package/dist/components/activity/digest-summary.d.ts +19 -0
- package/dist/components/activity/digest-summary.d.ts.map +1 -0
- package/dist/components/activity/digest-summary.js +20 -0
- package/dist/components/activity/digest-summary.js.map +1 -0
- package/dist/components/activity/push-switch.d.ts +25 -0
- package/dist/components/activity/push-switch.d.ts.map +1 -0
- package/dist/components/activity/push-switch.js +14 -0
- package/dist/components/activity/push-switch.js.map +1 -0
- package/dist/components/activity/push-toggle.d.ts +7 -0
- package/dist/components/activity/push-toggle.d.ts.map +1 -1
- package/dist/components/activity/push-toggle.js +72 -47
- package/dist/components/activity/push-toggle.js.map +1 -1
- package/dist/components/activity/span-bits.d.ts.map +1 -1
- package/dist/components/activity/span-bits.js +9 -7
- package/dist/components/activity/span-bits.js.map +1 -1
- package/dist/components/chat/ask-user-card.d.ts +76 -3
- package/dist/components/chat/ask-user-card.d.ts.map +1 -1
- package/dist/components/chat/ask-user-card.js +208 -149
- package/dist/components/chat/ask-user-card.js.map +1 -1
- package/dist/components/chat/ask-user-typed.d.ts +42 -0
- package/dist/components/chat/ask-user-typed.d.ts.map +1 -0
- package/dist/components/chat/ask-user-typed.js +60 -0
- package/dist/components/chat/ask-user-typed.js.map +1 -0
- package/dist/components/chat/brain-markdown-links.d.ts +2 -1
- package/dist/components/chat/brain-markdown-links.d.ts.map +1 -1
- package/dist/components/chat/brain-markdown-links.js +3 -4
- package/dist/components/chat/brain-markdown-links.js.map +1 -1
- package/dist/components/chat/brain-markdown.d.ts.map +1 -1
- package/dist/components/chat/brain-markdown.js +4 -2
- package/dist/components/chat/brain-markdown.js.map +1 -1
- package/dist/components/chat/chat-page.d.ts.map +1 -1
- package/dist/components/chat/chat-page.js +24 -9
- package/dist/components/chat/chat-page.js.map +1 -1
- package/dist/components/chat/composer-view.d.ts +75 -0
- package/dist/components/chat/composer-view.d.ts.map +1 -0
- package/dist/components/chat/composer-view.js +31 -0
- package/dist/components/chat/composer-view.js.map +1 -0
- package/dist/components/chat/composer.d.ts +4 -0
- package/dist/components/chat/composer.d.ts.map +1 -1
- package/dist/components/chat/composer.js +76 -59
- package/dist/components/chat/composer.js.map +1 -1
- package/dist/components/chat/markdown-content.d.ts +16 -1
- package/dist/components/chat/markdown-content.d.ts.map +1 -1
- package/dist/components/chat/markdown-content.js +47 -3
- package/dist/components/chat/markdown-content.js.map +1 -1
- package/dist/components/chat/mermaid-block.d.ts +4 -0
- package/dist/components/chat/mermaid-block.d.ts.map +1 -1
- package/dist/components/chat/mermaid-block.js +13 -5
- package/dist/components/chat/mermaid-block.js.map +1 -1
- package/dist/components/chat/mermaid-share.d.ts +2 -1
- package/dist/components/chat/mermaid-share.d.ts.map +1 -1
- package/dist/components/chat/mermaid-share.js +7 -8
- package/dist/components/chat/mermaid-share.js.map +1 -1
- package/dist/components/chat/mermaid-viewer.d.ts.map +1 -1
- package/dist/components/chat/mermaid-viewer.js +3 -1
- package/dist/components/chat/mermaid-viewer.js.map +1 -1
- package/dist/components/chat/message-bubble.d.ts +8 -1
- package/dist/components/chat/message-bubble.d.ts.map +1 -1
- package/dist/components/chat/message-bubble.js +53 -24
- package/dist/components/chat/message-bubble.js.map +1 -1
- package/dist/components/chat/message-share.d.ts +2 -1
- package/dist/components/chat/message-share.d.ts.map +1 -1
- package/dist/components/chat/message-share.js +6 -7
- package/dist/components/chat/message-share.js.map +1 -1
- package/dist/components/chat/renderers/bind.d.ts +39 -0
- package/dist/components/chat/renderers/bind.d.ts.map +1 -0
- package/dist/components/chat/renderers/bind.js +43 -0
- package/dist/components/chat/renderers/bind.js.map +1 -0
- package/dist/components/chat/renderers/brain-ui-tools.d.ts +3 -0
- package/dist/components/chat/renderers/brain-ui-tools.d.ts.map +1 -0
- package/dist/components/chat/renderers/brain-ui-tools.js +41 -0
- package/dist/components/chat/renderers/brain-ui-tools.js.map +1 -0
- package/dist/components/chat/renderers/claude-tools.d.ts.map +1 -1
- package/dist/components/chat/renderers/claude-tools.js +3 -2
- package/dist/components/chat/renderers/claude-tools.js.map +1 -1
- package/dist/components/chat/renderers/index.d.ts +10 -2
- package/dist/components/chat/renderers/index.d.ts.map +1 -1
- package/dist/components/chat/renderers/index.js +15 -10
- package/dist/components/chat/renderers/index.js.map +1 -1
- package/dist/components/chat/session-drawer.d.ts +4 -0
- package/dist/components/chat/session-drawer.d.ts.map +1 -1
- package/dist/components/chat/session-drawer.js +55 -40
- package/dist/components/chat/session-drawer.js.map +1 -1
- package/dist/components/chat/session-list.d.ts +41 -0
- package/dist/components/chat/session-list.d.ts.map +1 -0
- package/dist/components/chat/session-list.js +10 -0
- package/dist/components/chat/session-list.js.map +1 -0
- package/dist/components/chat/share-block.d.ts.map +1 -1
- package/dist/components/chat/share-block.js +12 -11
- package/dist/components/chat/share-block.js.map +1 -1
- package/dist/components/chat/share-card.js +2 -2
- package/dist/components/chat/share-card.js.map +1 -1
- package/dist/components/chat/subagent-view.js +1 -1
- package/dist/components/chat/subagent-view.js.map +1 -1
- package/dist/components/chat/tool-call-timeline.d.ts.map +1 -1
- package/dist/components/chat/tool-call-timeline.js +37 -12
- package/dist/components/chat/tool-call-timeline.js.map +1 -1
- package/dist/components/chat/tool-cards/block-card.d.ts +28 -0
- package/dist/components/chat/tool-cards/block-card.d.ts.map +1 -0
- package/dist/components/chat/tool-cards/block-card.js +103 -0
- package/dist/components/chat/tool-cards/block-card.js.map +1 -0
- package/dist/components/chat/tool-cards/image-mask-card.d.ts +70 -0
- package/dist/components/chat/tool-cards/image-mask-card.d.ts.map +1 -0
- package/dist/components/chat/tool-cards/image-mask-card.js +142 -0
- package/dist/components/chat/tool-cards/image-mask-card.js.map +1 -0
- package/dist/components/chat/tool-cards/location-card.d.ts +45 -0
- package/dist/components/chat/tool-cards/location-card.d.ts.map +1 -0
- package/dist/components/chat/tool-cards/location-card.js +128 -0
- package/dist/components/chat/tool-cards/location-card.js.map +1 -0
- package/dist/components/chat/tool-views.d.ts +15 -4
- package/dist/components/chat/tool-views.d.ts.map +1 -1
- package/dist/components/chat/tool-views.js +22 -38
- package/dist/components/chat/tool-views.js.map +1 -1
- package/dist/components/chat/transcript-turn.d.ts +45 -0
- package/dist/components/chat/transcript-turn.d.ts.map +1 -0
- package/dist/components/chat/transcript-turn.js +25 -0
- package/dist/components/chat/transcript-turn.js.map +1 -0
- package/dist/components/chat/use-chat-commands.d.ts.map +1 -1
- package/dist/components/chat/use-chat-commands.js +13 -16
- package/dist/components/chat/use-chat-commands.js.map +1 -1
- package/dist/components/chat/welcome-state.d.ts +7 -0
- package/dist/components/chat/welcome-state.d.ts.map +1 -1
- package/dist/components/chat/welcome-state.js +13 -5
- package/dist/components/chat/welcome-state.js.map +1 -1
- package/dist/components/connectivity/connection-gate.d.ts.map +1 -1
- package/dist/components/connectivity/connection-gate.js +64 -6
- package/dist/components/connectivity/connection-gate.js.map +1 -1
- package/dist/components/connectivity/login-form.d.ts +31 -0
- package/dist/components/connectivity/login-form.d.ts.map +1 -0
- package/dist/components/connectivity/login-form.js +19 -0
- package/dist/components/connectivity/login-form.js.map +1 -0
- package/dist/components/connectivity/login-screen.d.ts +5 -2
- package/dist/components/connectivity/login-screen.d.ts.map +1 -1
- package/dist/components/connectivity/login-screen.js +41 -31
- package/dist/components/connectivity/login-screen.js.map +1 -1
- package/dist/components/dev/share-harness.js +1 -1
- package/dist/components/dev/share-harness.js.map +1 -1
- package/dist/components/files/file-panel.d.ts +1 -1
- package/dist/components/files/file-panel.d.ts.map +1 -1
- package/dist/components/files/file-panel.js +74 -0
- package/dist/components/files/file-panel.js.map +1 -1
- package/dist/components/files/file-tree-view.d.ts +45 -0
- package/dist/components/files/file-tree-view.d.ts.map +1 -0
- package/dist/components/files/file-tree-view.js +51 -0
- package/dist/components/files/file-tree-view.js.map +1 -0
- package/dist/components/files/file-tree.d.ts +6 -0
- package/dist/components/files/file-tree.d.ts.map +1 -1
- package/dist/components/files/file-tree.js +39 -43
- package/dist/components/files/file-tree.js.map +1 -1
- package/dist/components/files/file-viewer-binary.d.ts.map +1 -1
- package/dist/components/files/file-viewer-binary.js +3 -2
- package/dist/components/files/file-viewer-binary.js.map +1 -1
- package/dist/components/files/file-viewer-frame.d.ts +36 -0
- package/dist/components/files/file-viewer-frame.d.ts.map +1 -0
- package/dist/components/files/file-viewer-frame.js +26 -0
- package/dist/components/files/file-viewer-frame.js.map +1 -0
- package/dist/components/files/file-viewer.d.ts +5 -0
- package/dist/components/files/file-viewer.d.ts.map +1 -1
- package/dist/components/files/file-viewer.js +26 -32
- package/dist/components/files/file-viewer.js.map +1 -1
- package/dist/components/files/frontmatter-chips.d.ts +18 -0
- package/dist/components/files/frontmatter-chips.d.ts.map +1 -0
- package/dist/components/files/frontmatter-chips.js +11 -0
- package/dist/components/files/frontmatter-chips.js.map +1 -0
- package/dist/components/files/frontmatter-panel.d.ts +5 -1
- package/dist/components/files/frontmatter-panel.d.ts.map +1 -1
- package/dist/components/files/frontmatter-panel.js +7 -6
- package/dist/components/files/frontmatter-panel.js.map +1 -1
- package/dist/components/files/staleness.d.ts +18 -0
- package/dist/components/files/staleness.d.ts.map +1 -0
- package/dist/components/files/staleness.js +27 -0
- package/dist/components/files/staleness.js.map +1 -0
- package/dist/components/graph/graph-canvas.d.ts.map +1 -1
- package/dist/components/graph/graph-canvas.js +24 -1
- package/dist/components/graph/graph-canvas.js.map +1 -1
- package/dist/components/graph/graph-controls-column.d.ts +14 -0
- package/dist/components/graph/graph-controls-column.d.ts.map +1 -0
- package/dist/components/graph/graph-controls-column.js +44 -0
- package/dist/components/graph/graph-controls-column.js.map +1 -0
- package/dist/components/graph/graph-controls.d.ts +20 -5
- package/dist/components/graph/graph-controls.d.ts.map +1 -1
- package/dist/components/graph/graph-controls.js +58 -37
- package/dist/components/graph/graph-controls.js.map +1 -1
- package/dist/components/graph/graph-form.d.ts +82 -0
- package/dist/components/graph/graph-form.d.ts.map +1 -0
- package/dist/components/graph/graph-form.js +69 -0
- package/dist/components/graph/graph-form.js.map +1 -0
- package/dist/components/graph/graph-maintenance.d.ts.map +1 -1
- package/dist/components/graph/graph-maintenance.js +6 -10
- package/dist/components/graph/graph-maintenance.js.map +1 -1
- package/dist/components/graph/graph-node-rail.d.ts +13 -0
- package/dist/components/graph/graph-node-rail.d.ts.map +1 -0
- package/dist/components/graph/graph-node-rail.js +92 -0
- package/dist/components/graph/graph-node-rail.js.map +1 -0
- package/dist/components/graph/graph-page.d.ts +7 -0
- package/dist/components/graph/graph-page.d.ts.map +1 -1
- package/dist/components/graph/graph-page.js +102 -12
- package/dist/components/graph/graph-page.js.map +1 -1
- package/dist/components/graph/graph-scene.d.ts.map +1 -1
- package/dist/components/graph/graph-scene.js +100 -24
- package/dist/components/graph/graph-scene.js.map +1 -1
- package/dist/components/graph/lib/graph-helpers.d.ts +42 -12
- package/dist/components/graph/lib/graph-helpers.d.ts.map +1 -1
- package/dist/components/graph/lib/graph-helpers.js +33 -41
- package/dist/components/graph/lib/graph-helpers.js.map +1 -1
- package/dist/components/graph/node-card.d.ts +28 -0
- package/dist/components/graph/node-card.d.ts.map +1 -0
- package/dist/components/graph/node-card.js +7 -0
- package/dist/components/graph/node-card.js.map +1 -0
- package/dist/components/graph/node-popover.d.ts +6 -2
- package/dist/components/graph/node-popover.d.ts.map +1 -1
- package/dist/components/graph/node-popover.js +13 -31
- package/dist/components/graph/node-popover.js.map +1 -1
- package/dist/components/graph/use-graph-theme.d.ts +32 -4
- package/dist/components/graph/use-graph-theme.d.ts.map +1 -1
- package/dist/components/graph/use-graph-theme.js +44 -32
- package/dist/components/graph/use-graph-theme.js.map +1 -1
- package/dist/components/graph/use-node-actions.d.ts +26 -0
- package/dist/components/graph/use-node-actions.d.ts.map +1 -0
- package/dist/components/graph/use-node-actions.js +54 -0
- package/dist/components/graph/use-node-actions.js.map +1 -0
- package/dist/components/images/image-share.d.ts +2 -1
- package/dist/components/images/image-share.d.ts.map +1 -1
- package/dist/components/images/image-share.js +3 -3
- package/dist/components/images/image-share.js.map +1 -1
- package/dist/components/images/image-viewer.d.ts.map +1 -1
- package/dist/components/images/image-viewer.js +3 -1
- package/dist/components/images/image-viewer.js.map +1 -1
- package/dist/components/images/mask-editor.d.ts.map +1 -1
- package/dist/components/images/mask-editor.js +7 -5
- package/dist/components/images/mask-editor.js.map +1 -1
- package/dist/components/layout/app-shell.d.ts.map +1 -1
- package/dist/components/layout/app-shell.js +5 -1
- package/dist/components/layout/app-shell.js.map +1 -1
- package/dist/components/layout/desktop-palette.d.ts +23 -0
- package/dist/components/layout/desktop-palette.d.ts.map +1 -0
- package/dist/components/layout/desktop-palette.js +132 -0
- package/dist/components/layout/desktop-palette.js.map +1 -0
- package/dist/components/layout/key-cap.d.ts +9 -0
- package/dist/components/layout/key-cap.d.ts.map +1 -0
- package/dist/components/layout/key-cap.js +10 -0
- package/dist/components/layout/key-cap.js.map +1 -0
- package/dist/components/layout/mobile-tab-bar.d.ts +13 -0
- package/dist/components/layout/mobile-tab-bar.d.ts.map +1 -1
- package/dist/components/layout/mobile-tab-bar.js +58 -47
- package/dist/components/layout/mobile-tab-bar.js.map +1 -1
- package/dist/components/layout/shortcut-switch.d.ts +13 -0
- package/dist/components/layout/shortcut-switch.d.ts.map +1 -0
- package/dist/components/layout/shortcut-switch.js +22 -0
- package/dist/components/layout/shortcut-switch.js.map +1 -0
- package/dist/components/layout/side-rail.d.ts +24 -0
- package/dist/components/layout/side-rail.d.ts.map +1 -1
- package/dist/components/layout/side-rail.js +65 -27
- package/dist/components/layout/side-rail.js.map +1 -1
- package/dist/components/layout/slide-panel.d.ts +12 -2
- package/dist/components/layout/slide-panel.d.ts.map +1 -1
- package/dist/components/layout/slide-panel.js +11 -2
- package/dist/components/layout/slide-panel.js.map +1 -1
- package/dist/components/layout/theme.d.ts +22 -0
- package/dist/components/layout/theme.d.ts.map +1 -0
- package/dist/components/layout/theme.js +44 -0
- package/dist/components/layout/theme.js.map +1 -0
- package/dist/components/quick-actions/add-form.d.ts +44 -0
- package/dist/components/quick-actions/add-form.d.ts.map +1 -0
- package/dist/components/quick-actions/add-form.js +30 -0
- package/dist/components/quick-actions/add-form.js.map +1 -0
- package/dist/components/quick-actions/add-modal.d.ts +7 -0
- package/dist/components/quick-actions/add-modal.d.ts.map +1 -1
- package/dist/components/quick-actions/add-modal.js +66 -20
- package/dist/components/quick-actions/add-modal.js.map +1 -1
- package/dist/components/quick-actions/search-modal.d.ts.map +1 -1
- package/dist/components/quick-actions/search-modal.js +48 -19
- package/dist/components/quick-actions/search-modal.js.map +1 -1
- package/dist/components/quick-actions/streaming-modal.d.ts +6 -0
- package/dist/components/quick-actions/streaming-modal.d.ts.map +1 -1
- package/dist/components/quick-actions/streaming-modal.js +42 -17
- package/dist/components/quick-actions/streaming-modal.js.map +1 -1
- package/dist/components/quick-actions/streaming-output.d.ts +38 -0
- package/dist/components/quick-actions/streaming-output.d.ts.map +1 -0
- package/dist/components/quick-actions/streaming-output.js +22 -0
- package/dist/components/quick-actions/streaming-output.js.map +1 -0
- package/dist/components/quick-actions/whatsup-modal.d.ts +5 -0
- package/dist/components/quick-actions/whatsup-modal.d.ts.map +1 -1
- package/dist/components/quick-actions/whatsup-modal.js +36 -10
- package/dist/components/quick-actions/whatsup-modal.js.map +1 -1
- package/dist/components/settings/devices-agents-tab.d.ts +10 -0
- package/dist/components/settings/devices-agents-tab.d.ts.map +1 -0
- package/dist/components/settings/devices-agents-tab.js +131 -0
- package/dist/components/settings/devices-agents-tab.js.map +1 -0
- package/dist/components/settings/models-list.d.ts +39 -0
- package/dist/components/settings/models-list.d.ts.map +1 -0
- package/dist/components/settings/models-list.js +72 -0
- package/dist/components/settings/models-list.js.map +1 -0
- package/dist/components/settings/models-tab.d.ts +4 -0
- package/dist/components/settings/models-tab.d.ts.map +1 -1
- package/dist/components/settings/models-tab.js +52 -102
- package/dist/components/settings/models-tab.js.map +1 -1
- package/dist/components/settings/one-time-agent-credential.d.ts +3 -0
- package/dist/components/settings/one-time-agent-credential.d.ts.map +1 -0
- package/dist/components/settings/one-time-agent-credential.js +55 -0
- package/dist/components/settings/one-time-agent-credential.js.map +1 -0
- package/dist/components/settings/passkey-list.d.ts +35 -0
- package/dist/components/settings/passkey-list.d.ts.map +1 -0
- package/dist/components/settings/passkey-list.js +34 -0
- package/dist/components/settings/passkey-list.js.map +1 -0
- package/dist/components/settings/passkey-tab.d.ts +3 -0
- package/dist/components/settings/passkey-tab.d.ts.map +1 -1
- package/dist/components/settings/passkey-tab.js +53 -45
- package/dist/components/settings/passkey-tab.js.map +1 -1
- package/dist/components/settings/pi-accounts-list.d.ts +27 -0
- package/dist/components/settings/pi-accounts-list.d.ts.map +1 -0
- package/dist/components/settings/pi-accounts-list.js +15 -0
- package/dist/components/settings/pi-accounts-list.js.map +1 -0
- package/dist/components/settings/pi-accounts.d.ts +3 -0
- package/dist/components/settings/pi-accounts.d.ts.map +1 -1
- package/dist/components/settings/pi-accounts.js +73 -55
- package/dist/components/settings/pi-accounts.js.map +1 -1
- package/dist/components/settings/principal-list.d.ts +37 -0
- package/dist/components/settings/principal-list.d.ts.map +1 -0
- package/dist/components/settings/principal-list.js +18 -0
- package/dist/components/settings/principal-list.js.map +1 -0
- package/dist/components/settings/settings-panel.d.ts +10 -3
- package/dist/components/settings/settings-panel.d.ts.map +1 -1
- package/dist/components/settings/settings-panel.js +80 -6
- package/dist/components/settings/settings-panel.js.map +1 -1
- package/dist/components/settings/skills-list.d.ts +53 -0
- package/dist/components/settings/skills-list.d.ts.map +1 -0
- package/dist/components/settings/skills-list.js +28 -0
- package/dist/components/settings/skills-list.js.map +1 -0
- package/dist/components/settings/skills-tab.d.ts.map +1 -1
- package/dist/components/settings/skills-tab.js +65 -38
- package/dist/components/settings/skills-tab.js.map +1 -1
- package/dist/components/settings/tool-permissions-list.d.ts +18 -0
- package/dist/components/settings/tool-permissions-list.d.ts.map +1 -0
- package/dist/components/settings/tool-permissions-list.js +6 -0
- package/dist/components/settings/tool-permissions-list.js.map +1 -0
- package/dist/components/settings/tool-permissions.d.ts +2 -1
- package/dist/components/settings/tool-permissions.d.ts.map +1 -1
- package/dist/components/settings/tool-permissions.js +33 -16
- package/dist/components/settings/tool-permissions.js.map +1 -1
- package/dist/components/settings/web-search-chain.d.ts +41 -0
- package/dist/components/settings/web-search-chain.d.ts.map +1 -0
- package/dist/components/settings/web-search-chain.js +47 -0
- package/dist/components/settings/web-search-chain.js.map +1 -0
- package/dist/components/settings/web-search-settings.d.ts +4 -7
- package/dist/components/settings/web-search-settings.d.ts.map +1 -1
- package/dist/components/settings/web-search-settings.js +54 -76
- package/dist/components/settings/web-search-settings.js.map +1 -1
- package/dist/components/share/share-menu.d.ts.map +1 -1
- package/dist/components/share/share-menu.js +24 -4
- package/dist/components/share/share-menu.js.map +1 -1
- package/dist/components/voice/dictation-sheet.js +3 -3
- package/dist/components/voice/dictation-sheet.js.map +1 -1
- package/dist/components/voice/mic-button.js +1 -1
- package/dist/components/voice/mic-button.js.map +1 -1
- package/dist/components/voice/review-card.js +1 -1
- package/dist/components/voice/review-card.js.map +1 -1
- package/dist/config.d.ts +5 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -5
- package/dist/config.js.map +1 -1
- package/dist/connection.d.ts +12 -0
- package/dist/connection.d.ts.map +1 -0
- package/dist/connection.js +421 -0
- package/dist/connection.js.map +1 -0
- package/dist/default-root.d.ts +3 -0
- package/dist/default-root.d.ts.map +1 -0
- package/dist/default-root.js +16 -0
- package/dist/default-root.js.map +1 -0
- package/dist/hooks/use-color-scheme.d.ts +14 -0
- package/dist/hooks/use-color-scheme.d.ts.map +1 -0
- package/dist/hooks/use-color-scheme.js +37 -0
- package/dist/hooks/use-color-scheme.js.map +1 -0
- package/dist/hooks/use-hash-routes.d.ts.map +1 -1
- package/dist/hooks/use-hash-routes.js +4 -2
- package/dist/hooks/use-hash-routes.js.map +1 -1
- package/dist/hooks/use-media-query.d.ts +7 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +34 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-share-intake.d.ts.map +1 -1
- package/dist/hooks/use-share-intake.js +37 -12
- package/dist/hooks/use-share-intake.js.map +1 -1
- package/dist/hooks/use-vpn-status.d.ts +1 -1
- package/dist/hooks/use-vpn-status.d.ts.map +1 -1
- package/dist/hooks/use-vpn-status.js +20 -16
- package/dist/hooks/use-vpn-status.js.map +1 -1
- package/dist/hooks/use-websocket.d.ts +5 -24
- package/dist/hooks/use-websocket.d.ts.map +1 -1
- package/dist/hooks/use-websocket.js +11 -382
- package/dist/hooks/use-websocket.js.map +1 -1
- package/dist/hooks/websocket-handlers/activity.d.ts +2 -2
- package/dist/hooks/websocket-handlers/activity.d.ts.map +1 -1
- package/dist/hooks/websocket-handlers/activity.js +4 -5
- package/dist/hooks/websocket-handlers/activity.js.map +1 -1
- package/dist/hooks/websocket-handlers/chat.d.ts +1 -0
- package/dist/hooks/websocket-handlers/chat.d.ts.map +1 -1
- package/dist/hooks/websocket-handlers/chat.js +27 -5
- package/dist/hooks/websocket-handlers/chat.js.map +1 -1
- package/dist/hooks/websocket-handlers/connection.d.ts.map +1 -1
- package/dist/hooks/websocket-handlers/connection.js +4 -6
- package/dist/hooks/websocket-handlers/connection.js.map +1 -1
- package/dist/hooks/websocket-handlers/mask.d.ts +1 -1
- package/dist/hooks/websocket-handlers/mask.d.ts.map +1 -1
- package/dist/hooks/websocket-handlers/mask.js +2 -3
- package/dist/hooks/websocket-handlers/mask.js.map +1 -1
- package/dist/hooks/websocket-handlers/provider.d.ts.map +1 -1
- package/dist/hooks/websocket-handlers/provider.js +4 -6
- package/dist/hooks/websocket-handlers/provider.js.map +1 -1
- package/dist/hooks/websocket-handlers/types.d.ts +6 -2
- package/dist/hooks/websocket-handlers/types.d.ts.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/api-client.d.ts +321 -0
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +243 -213
- package/dist/lib/api-client.js.map +1 -1
- package/dist/lib/backend.d.ts +19 -2
- package/dist/lib/backend.d.ts.map +1 -1
- package/dist/lib/backend.js +15 -9
- package/dist/lib/backend.js.map +1 -1
- package/dist/lib/diff.d.ts +8 -10
- package/dist/lib/diff.d.ts.map +1 -1
- package/dist/lib/diff.js +26 -53
- package/dist/lib/diff.js.map +1 -1
- package/dist/lib/format-time.d.ts +3 -0
- package/dist/lib/format-time.d.ts.map +1 -0
- package/dist/lib/format-time.js +25 -0
- package/dist/lib/format-time.js.map +1 -0
- package/dist/lib/light-dark.d.ts +37 -0
- package/dist/lib/light-dark.d.ts.map +1 -0
- package/dist/lib/light-dark.js +83 -0
- package/dist/lib/light-dark.js.map +1 -0
- package/dist/lib/mermaid-theme.d.ts +7 -2
- package/dist/lib/mermaid-theme.d.ts.map +1 -1
- package/dist/lib/mermaid-theme.js +125 -203
- package/dist/lib/mermaid-theme.js.map +1 -1
- package/dist/lib/passkeys.d.ts +6 -3
- package/dist/lib/passkeys.d.ts.map +1 -1
- package/dist/lib/passkeys.js +10 -4
- package/dist/lib/passkeys.js.map +1 -1
- package/dist/lib/push-registration.d.ts +10 -0
- package/dist/lib/push-registration.d.ts.map +1 -0
- package/dist/lib/push-registration.js +44 -0
- package/dist/lib/push-registration.js.map +1 -0
- package/dist/lib/share-intake.d.ts +2 -1
- package/dist/lib/share-intake.d.ts.map +1 -1
- package/dist/lib/share-intake.js +3 -3
- package/dist/lib/share-intake.js.map +1 -1
- package/dist/lib/share.d.ts +4 -3
- package/dist/lib/share.d.ts.map +1 -1
- package/dist/lib/share.js +6 -7
- package/dist/lib/share.js.map +1 -1
- package/dist/lib/single-key.d.ts +30 -0
- package/dist/lib/single-key.d.ts.map +1 -0
- package/dist/lib/single-key.js +45 -0
- package/dist/lib/single-key.js.map +1 -0
- package/dist/lib/tool-names.d.ts +8 -6
- package/dist/lib/tool-names.d.ts.map +1 -1
- package/dist/lib/tool-names.js +17 -7
- package/dist/lib/tool-names.js.map +1 -1
- package/dist/root-context.d.ts +229 -0
- package/dist/root-context.d.ts.map +1 -0
- package/dist/root-context.js +33 -0
- package/dist/root-context.js.map +1 -0
- package/dist/root.d.ts +38 -0
- package/dist/root.d.ts.map +1 -0
- package/dist/root.js +47 -0
- package/dist/root.js.map +1 -0
- package/dist/stores/activity-state.d.ts +29 -0
- package/dist/stores/activity-state.d.ts.map +1 -0
- package/dist/stores/activity-state.js +282 -0
- package/dist/stores/activity-state.js.map +1 -0
- package/dist/stores/activity-store.d.ts +10 -41
- package/dist/stores/activity-store.d.ts.map +1 -1
- package/dist/stores/activity-store.js +9 -271
- package/dist/stores/activity-store.js.map +1 -1
- package/dist/stores/chat-state.d.ts +212 -0
- package/dist/stores/chat-state.d.ts.map +1 -0
- package/dist/stores/chat-state.js +466 -0
- package/dist/stores/chat-state.js.map +1 -0
- package/dist/stores/chat-store.d.ts +4 -162
- package/dist/stores/chat-store.d.ts.map +1 -1
- package/dist/stores/chat-store.js +7 -418
- package/dist/stores/chat-store.js.map +1 -1
- package/dist/stores/connection-state.d.ts +40 -0
- package/dist/stores/connection-state.d.ts.map +1 -0
- package/dist/stores/connection-state.js +30 -0
- package/dist/stores/connection-state.js.map +1 -0
- package/dist/stores/connection-store.d.ts +4 -40
- package/dist/stores/connection-store.d.ts.map +1 -1
- package/dist/stores/connection-store.js +7 -27
- package/dist/stores/connection-store.js.map +1 -1
- package/dist/stores/create-stores.d.ts +23 -0
- package/dist/stores/create-stores.d.ts.map +1 -0
- package/dist/stores/create-stores.js +28 -0
- package/dist/stores/create-stores.js.map +1 -0
- package/dist/stores/file-state.d.ts +53 -0
- package/dist/stores/file-state.d.ts.map +1 -0
- package/dist/stores/file-state.js +341 -0
- package/dist/stores/file-state.js.map +1 -0
- package/dist/stores/file-store.d.ts +4 -52
- package/dist/stores/file-store.d.ts.map +1 -1
- package/dist/stores/file-store.js +7 -300
- package/dist/stores/file-store.js.map +1 -1
- package/dist/stores/graph-state.d.ts +95 -0
- package/dist/stores/graph-state.d.ts.map +1 -0
- package/dist/stores/graph-state.js +252 -0
- package/dist/stores/graph-state.js.map +1 -0
- package/dist/stores/graph-store.d.ts +7 -83
- package/dist/stores/graph-store.d.ts.map +1 -1
- package/dist/stores/graph-store.js +8 -249
- package/dist/stores/graph-store.js.map +1 -1
- package/dist/stores/mask-state.d.ts +21 -0
- package/dist/stores/mask-state.d.ts.map +1 -0
- package/dist/stores/mask-state.js +9 -0
- package/dist/stores/mask-state.js.map +1 -0
- package/dist/stores/mask-store.d.ts +4 -21
- package/dist/stores/mask-store.d.ts.map +1 -1
- package/dist/stores/mask-store.js +7 -6
- package/dist/stores/mask-store.js.map +1 -1
- package/dist/stores/principal-state.d.ts +16 -0
- package/dist/stores/principal-state.d.ts.map +1 -0
- package/dist/stores/principal-state.js +31 -0
- package/dist/stores/principal-state.js.map +1 -0
- package/dist/stores/principal-store.d.ts +5 -0
- package/dist/stores/principal-store.d.ts.map +1 -0
- package/dist/stores/principal-store.js +8 -0
- package/dist/stores/principal-store.js.map +1 -0
- package/dist/stores/provider-state.d.ts +24 -0
- package/dist/stores/provider-state.d.ts.map +1 -0
- package/dist/stores/provider-state.js +68 -0
- package/dist/stores/provider-state.js.map +1 -0
- package/dist/stores/provider-store.d.ts +4 -23
- package/dist/stores/provider-store.d.ts.map +1 -1
- package/dist/stores/provider-store.js +7 -64
- package/dist/stores/provider-store.js.map +1 -1
- package/dist/stores/share-state.d.ts +29 -0
- package/dist/stores/share-state.d.ts.map +1 -0
- package/dist/stores/share-state.js +21 -0
- package/dist/stores/share-state.js.map +1 -0
- package/dist/stores/share-store.d.ts +4 -28
- package/dist/stores/share-store.d.ts.map +1 -1
- package/dist/stores/share-store.js +7 -18
- package/dist/stores/share-store.js.map +1 -1
- package/dist/stores/store-environment.d.ts +10 -0
- package/dist/stores/store-environment.d.ts.map +1 -0
- package/dist/stores/store-environment.js +2 -0
- package/dist/stores/store-environment.js.map +1 -0
- package/dist/stores/ui-state.d.ts +71 -0
- package/dist/stores/ui-state.d.ts.map +1 -0
- package/dist/stores/ui-state.js +58 -0
- package/dist/stores/ui-state.js.map +1 -0
- package/dist/stores/ui-store.d.ts +4 -45
- package/dist/stores/ui-store.d.ts.map +1 -1
- package/dist/stores/ui-store.js +7 -36
- package/dist/stores/ui-store.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme.css +150 -97
- package/dist/voice/asr-clients.d.ts +2 -1
- package/dist/voice/asr-clients.d.ts.map +1 -1
- package/dist/voice/asr-clients.js +16 -17
- package/dist/voice/asr-clients.js.map +1 -1
- package/dist/voice/use-dictation.d.ts.map +1 -1
- package/dist/voice/use-dictation.js +12 -8
- package/dist/voice/use-dictation.js.map +1 -1
- package/dist/voice/voice-state.d.ts +25 -0
- package/dist/voice/voice-state.d.ts.map +1 -0
- package/dist/voice/voice-state.js +29 -0
- package/dist/voice/voice-state.js.map +1 -0
- package/dist/voice/voice-store.d.ts +4 -25
- package/dist/voice/voice-store.d.ts.map +1 -1
- package/dist/voice/voice-store.js +7 -26
- package/dist/voice/voice-store.js.map +1 -1
- package/package.json +3 -2
- package/src/components/activity/activity-page.tsx +334 -160
- package/src/components/activity/activity-run-detail.tsx +81 -47
- package/src/components/activity/activity-run-list.tsx +27 -59
- package/src/components/activity/activity-views.tsx +155 -0
- package/src/components/activity/approval-card.tsx +80 -0
- package/src/components/activity/digest-card.tsx +25 -61
- package/src/components/activity/digest-summary.tsx +52 -0
- package/src/components/activity/push-switch.tsx +62 -0
- package/src/components/activity/push-toggle.tsx +51 -81
- package/src/components/activity/span-bits.tsx +8 -7
- package/src/components/chat/ask-user-card.tsx +292 -356
- package/src/components/chat/ask-user-typed.ts +77 -0
- package/src/components/chat/brain-markdown-links.tsx +4 -4
- package/src/components/chat/brain-markdown.tsx +4 -2
- package/src/components/chat/chat-page.tsx +38 -9
- package/src/components/chat/composer-view.tsx +194 -0
- package/src/components/chat/composer.tsx +117 -296
- package/src/components/chat/markdown-content.tsx +53 -2
- package/src/components/chat/mermaid-block.tsx +13 -5
- package/src/components/chat/mermaid-share.ts +8 -7
- package/src/components/chat/mermaid-viewer.tsx +3 -1
- package/src/components/chat/message-bubble.tsx +78 -94
- package/src/components/chat/message-share.ts +7 -7
- package/src/components/chat/renderers/bind.tsx +94 -0
- package/src/components/chat/renderers/brain-ui-tools.tsx +56 -0
- package/src/components/chat/renderers/claude-tools.tsx +3 -2
- package/src/components/chat/renderers/index.ts +15 -10
- package/src/components/chat/session-drawer.tsx +60 -138
- package/src/components/chat/session-list.tsx +113 -0
- package/src/components/chat/share-block.tsx +16 -12
- package/src/components/chat/share-card.tsx +2 -2
- package/src/components/chat/subagent-view.tsx +4 -4
- package/src/components/chat/tool-call-timeline.tsx +59 -22
- package/src/components/chat/tool-cards/block-card.tsx +145 -0
- package/src/components/chat/tool-cards/image-mask-card.tsx +214 -0
- package/src/components/chat/tool-cards/location-card.tsx +159 -0
- package/src/components/chat/tool-views.tsx +23 -73
- package/src/components/chat/transcript-turn.tsx +108 -0
- package/src/components/chat/use-chat-commands.ts +14 -16
- package/src/components/chat/welcome-state.tsx +36 -91
- package/src/components/connectivity/connection-gate.tsx +80 -9
- package/src/components/connectivity/login-form.tsx +122 -0
- package/src/components/connectivity/login-screen.tsx +45 -100
- package/src/components/dev/share-harness.tsx +2 -2
- package/src/components/files/file-panel.tsx +168 -0
- package/src/components/files/file-tree-view.tsx +127 -0
- package/src/components/files/file-tree.tsx +55 -109
- package/src/components/files/file-viewer-binary.tsx +3 -2
- package/src/components/files/file-viewer-frame.tsx +113 -0
- package/src/components/files/file-viewer.tsx +40 -95
- package/src/components/files/frontmatter-chips.tsx +42 -0
- package/src/components/files/frontmatter-panel.tsx +6 -71
- package/src/components/files/staleness.ts +29 -0
- package/src/components/graph/graph-canvas.tsx +24 -1
- package/src/components/graph/graph-controls-column.tsx +92 -0
- package/src/components/graph/graph-controls.tsx +83 -127
- package/src/components/graph/graph-form.tsx +183 -0
- package/src/components/graph/graph-maintenance.tsx +9 -14
- package/src/components/graph/graph-node-rail.tsx +147 -0
- package/src/components/graph/graph-page.tsx +189 -49
- package/src/components/graph/graph-scene.tsx +200 -30
- package/src/components/graph/lib/graph-helpers.ts +65 -43
- package/src/components/graph/node-card.tsx +64 -0
- package/src/components/graph/node-popover.tsx +28 -117
- package/src/components/graph/use-graph-theme.ts +69 -32
- package/src/components/graph/use-node-actions.ts +56 -0
- package/src/components/images/image-share.ts +4 -2
- package/src/components/images/image-viewer.tsx +3 -1
- package/src/components/images/mask-editor.tsx +7 -4
- package/src/components/layout/app-shell.tsx +7 -1
- package/src/components/layout/desktop-palette.tsx +151 -0
- package/src/components/layout/key-cap.tsx +15 -0
- package/src/components/layout/mobile-tab-bar.tsx +80 -157
- package/src/components/layout/shortcut-switch.tsx +32 -0
- package/src/components/layout/side-rail.tsx +70 -150
- package/src/components/layout/slide-panel.tsx +29 -2
- package/src/components/layout/theme.tsx +67 -0
- package/src/components/quick-actions/add-form.tsx +188 -0
- package/src/components/quick-actions/add-modal.tsx +68 -144
- package/src/components/quick-actions/search-modal.tsx +49 -19
- package/src/components/quick-actions/streaming-modal.tsx +44 -71
- package/src/components/quick-actions/streaming-output.tsx +112 -0
- package/src/components/quick-actions/whatsup-modal.tsx +38 -60
- package/src/components/settings/devices-agents-tab.tsx +139 -0
- package/src/components/settings/models-list.tsx +299 -0
- package/src/components/settings/models-tab.tsx +63 -337
- package/src/components/settings/one-time-agent-credential.tsx +131 -0
- package/src/components/settings/passkey-list.tsx +201 -0
- package/src/components/settings/passkey-tab.tsx +53 -197
- package/src/components/settings/pi-accounts-list.tsx +128 -0
- package/src/components/settings/pi-accounts.tsx +71 -170
- package/src/components/settings/principal-list.tsx +172 -0
- package/src/components/settings/settings-panel.tsx +245 -19
- package/src/components/settings/skills-list.tsx +276 -0
- package/src/components/settings/skills-tab.tsx +82 -269
- package/src/components/settings/tool-permissions-list.tsx +54 -0
- package/src/components/settings/tool-permissions.tsx +27 -46
- package/src/components/settings/web-search-chain.tsx +300 -0
- package/src/components/settings/web-search-settings.tsx +58 -328
- package/src/components/share/share-menu.tsx +19 -4
- package/src/components/voice/dictation-sheet.tsx +5 -5
- package/src/components/voice/mic-button.tsx +1 -1
- package/src/components/voice/review-card.tsx +1 -1
- package/src/config.ts +21 -7
- package/src/connection.ts +443 -0
- package/src/default-root.ts +16 -0
- package/src/hooks/use-color-scheme.ts +36 -0
- package/src/hooks/use-hash-routes.ts +4 -2
- package/src/hooks/use-media-query.ts +32 -0
- package/src/hooks/use-share-intake.ts +32 -12
- package/src/hooks/use-vpn-status.ts +23 -15
- package/src/hooks/use-websocket.ts +12 -426
- package/src/hooks/websocket-handlers/activity.ts +4 -5
- package/src/hooks/websocket-handlers/chat.ts +26 -5
- package/src/hooks/websocket-handlers/connection.ts +4 -6
- package/src/hooks/websocket-handlers/mask.ts +2 -3
- package/src/hooks/websocket-handlers/provider.ts +4 -6
- package/src/hooks/websocket-handlers/types.ts +6 -2
- package/src/index.ts +7 -3
- package/src/lib/api-client.ts +446 -365
- package/src/lib/backend.ts +20 -10
- package/src/lib/diff.ts +28 -62
- package/src/lib/format-time.ts +20 -0
- package/src/lib/light-dark.ts +83 -0
- package/src/lib/mermaid-theme.ts +183 -214
- package/src/lib/passkeys.ts +12 -4
- package/src/lib/push-registration.ts +46 -0
- package/src/lib/share-intake.ts +6 -3
- package/src/lib/share.ts +7 -4
- package/src/lib/single-key.ts +47 -0
- package/src/lib/tool-names.ts +31 -8
- package/src/root-context.tsx +40 -0
- package/src/root.ts +83 -0
- package/src/stores/activity-state.ts +295 -0
- package/src/stores/activity-store.ts +11 -285
- package/src/stores/chat-state.ts +795 -0
- package/src/stores/chat-store.ts +11 -705
- package/src/stores/connection-state.ts +78 -0
- package/src/stores/connection-store.ts +11 -76
- package/src/stores/create-stores.ts +31 -0
- package/src/stores/file-state.ts +399 -0
- package/src/stores/file-store.ts +9 -360
- package/src/stores/graph-state.ts +368 -0
- package/src/stores/graph-store.ts +10 -355
- package/src/stores/mask-state.ts +30 -0
- package/src/stores/mask-store.ts +10 -27
- package/src/stores/principal-state.ts +42 -0
- package/src/stores/principal-store.ts +11 -0
- package/src/stores/provider-state.ts +103 -0
- package/src/stores/provider-store.ts +10 -95
- package/src/stores/share-state.ts +56 -0
- package/src/stores/share-store.ts +11 -54
- package/src/stores/store-environment.ts +10 -0
- package/src/stores/ui-state.ts +143 -0
- package/src/stores/ui-store.ts +11 -93
- package/src/styles.css +4 -1
- package/src/theme.css +150 -97
- package/src/voice/asr-clients.ts +17 -17
- package/src/voice/use-dictation.ts +11 -8
- package/src/voice/voice-state.ts +57 -0
- package/src/voice/voice-store.ts +11 -55
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { useBrainUiRoot } from "../../root-context.js";
|
|
1
2
|
import { useState, useEffect, useRef } from "react";
|
|
2
|
-
import { Loader2, CheckCircle2, XCircle } from "lucide-react";
|
|
3
3
|
import { SlidePanel } from "../layout/slide-panel.js";
|
|
4
4
|
import { linkifyPaths } from "../chat/brain-markdown.js";
|
|
5
|
+
import { StreamingOutput, type StreamState } from "./streaming-output.js";
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The container (S6) for a streamed backend job: the request, the SSE reader
|
|
9
|
+
* loop, the abort controller and the "still my stream" checks live here;
|
|
10
|
+
* `StreamingOutput` draws from props.
|
|
11
|
+
*/
|
|
8
12
|
export function StreamingPanel({
|
|
9
13
|
open,
|
|
10
14
|
onClose,
|
|
@@ -15,9 +19,11 @@ export function StreamingPanel({
|
|
|
15
19
|
open: boolean;
|
|
16
20
|
onClose: () => void;
|
|
17
21
|
title: string;
|
|
22
|
+
/** Backend-relative path, resolved against the current root. */
|
|
18
23
|
endpoint: string;
|
|
19
24
|
method?: string;
|
|
20
25
|
}) {
|
|
26
|
+
const root = useBrainUiRoot();
|
|
21
27
|
const [state, setState] = useState<StreamState>("idle");
|
|
22
28
|
const [lines, setLines] = useState<string[]>([]);
|
|
23
29
|
const scrollRef = useRef<HTMLDivElement>(null);
|
|
@@ -29,28 +35,41 @@ export function StreamingPanel({
|
|
|
29
35
|
setState("running");
|
|
30
36
|
setLines([]);
|
|
31
37
|
|
|
38
|
+
let disposed = false;
|
|
39
|
+
let reader: ReadableStreamDefaultReader<Uint8Array> | undefined;
|
|
32
40
|
const controller = new AbortController();
|
|
41
|
+
const cancelReader = () => { void reader?.cancel().catch(() => {}); };
|
|
42
|
+
controller.signal.addEventListener("abort", cancelReader);
|
|
33
43
|
controllerRef.current = controller;
|
|
34
44
|
|
|
35
45
|
(async () => {
|
|
36
46
|
try {
|
|
37
|
-
const res = await
|
|
47
|
+
const res = await root.request(root.backendUrl(endpoint), {
|
|
38
48
|
method,
|
|
39
49
|
signal: controller.signal,
|
|
40
50
|
});
|
|
41
51
|
|
|
52
|
+
if (disposed || controller.signal.aborted) {
|
|
53
|
+
await res.body?.cancel();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
42
57
|
if (!res.ok || !res.body) {
|
|
58
|
+
const body = await res.json().catch(() => null);
|
|
59
|
+
if (disposed || controller.signal.aborted) return;
|
|
43
60
|
setState("error");
|
|
44
|
-
|
|
61
|
+
const message = typeof body?.error === "string" ? body.error : `HTTP ${res.status}: ${res.statusText}`;
|
|
62
|
+
if (!controller.signal.aborted) setLines((l) => [...l, message]);
|
|
45
63
|
return;
|
|
46
64
|
}
|
|
47
65
|
|
|
48
|
-
|
|
66
|
+
reader = res.body.getReader();
|
|
49
67
|
const decoder = new TextDecoder();
|
|
50
68
|
let buffer = "";
|
|
51
69
|
|
|
52
70
|
while (true) {
|
|
53
71
|
const { done, value } = await reader.read();
|
|
72
|
+
if (disposed || controller.signal.aborted) return;
|
|
54
73
|
if (done) break;
|
|
55
74
|
|
|
56
75
|
buffer += decoder.decode(value, { stream: true });
|
|
@@ -75,6 +94,7 @@ export function StreamingPanel({
|
|
|
75
94
|
}
|
|
76
95
|
}
|
|
77
96
|
} catch (err: any) {
|
|
97
|
+
if (disposed || controller.signal.aborted) return;
|
|
78
98
|
if (err.name === "AbortError") {
|
|
79
99
|
setLines((l) => [...l, "Cancelled."]);
|
|
80
100
|
setState("cancelled");
|
|
@@ -83,15 +103,18 @@ export function StreamingPanel({
|
|
|
83
103
|
setLines((l) => [...l, `Error: ${err.message}`]);
|
|
84
104
|
}
|
|
85
105
|
} finally {
|
|
86
|
-
|
|
106
|
+
controller.signal.removeEventListener("abort", cancelReader);
|
|
107
|
+
reader?.releaseLock();
|
|
108
|
+
if (controllerRef.current === controller) controllerRef.current = null;
|
|
87
109
|
}
|
|
88
110
|
})();
|
|
89
111
|
|
|
90
112
|
return () => {
|
|
113
|
+
disposed = true;
|
|
91
114
|
controller.abort();
|
|
92
|
-
controllerRef.current = null;
|
|
115
|
+
if (controllerRef.current === controller) controllerRef.current = null;
|
|
93
116
|
};
|
|
94
|
-
}, [open, endpoint, method]);
|
|
117
|
+
}, [open, endpoint, method, root]);
|
|
95
118
|
|
|
96
119
|
// Auto-scroll
|
|
97
120
|
useEffect(() => {
|
|
@@ -101,68 +124,18 @@ export function StreamingPanel({
|
|
|
101
124
|
const isRunning = state === "running";
|
|
102
125
|
|
|
103
126
|
return (
|
|
104
|
-
<SlidePanel
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<CheckCircle2 className="h-3.5 w-3.5 text-green-500" />
|
|
117
|
-
)}
|
|
118
|
-
{(state === "error" || state === "cancelled") && (
|
|
119
|
-
<XCircle className="h-3.5 w-3.5 text-destructive" />
|
|
120
|
-
)}
|
|
121
|
-
<span className="text-xs text-muted-foreground">
|
|
122
|
-
{isRunning
|
|
123
|
-
? "Running..."
|
|
124
|
-
: state === "success"
|
|
125
|
-
? "Complete"
|
|
126
|
-
: state === "error"
|
|
127
|
-
? "Failed"
|
|
128
|
-
: state === "cancelled"
|
|
129
|
-
? "Cancelled"
|
|
130
|
-
: "Ready"}
|
|
131
|
-
</span>
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
{/* Log output */}
|
|
135
|
-
<div className="flex-1 overflow-y-auto p-4 font-[family-name:var(--font-mono)] text-xs leading-relaxed text-muted-foreground">
|
|
136
|
-
{lines.map((line, i) => (
|
|
137
|
-
<div key={i} className="whitespace-pre-wrap">
|
|
138
|
-
{linkifyPaths(line)}
|
|
139
|
-
</div>
|
|
140
|
-
))}
|
|
141
|
-
{isRunning && lines.length === 0 && (
|
|
142
|
-
<div className="text-muted-foreground/50">Starting...</div>
|
|
143
|
-
)}
|
|
144
|
-
<div ref={scrollRef} />
|
|
145
|
-
</div>
|
|
146
|
-
|
|
147
|
-
{/* Footer */}
|
|
148
|
-
<div className="border-t border-border px-5 py-3 flex justify-end">
|
|
149
|
-
{isRunning ? (
|
|
150
|
-
<button
|
|
151
|
-
onClick={() => controllerRef.current?.abort()}
|
|
152
|
-
className="rounded-lg border border-destructive/30 px-4 py-1.5 text-xs font-medium text-destructive transition-colors hover:bg-destructive/10"
|
|
153
|
-
>
|
|
154
|
-
Cancel
|
|
155
|
-
</button>
|
|
156
|
-
) : (
|
|
157
|
-
<button
|
|
158
|
-
onClick={onClose}
|
|
159
|
-
className="rounded-lg bg-surface-raised px-4 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-surface-overlay"
|
|
160
|
-
>
|
|
161
|
-
Close
|
|
162
|
-
</button>
|
|
163
|
-
)}
|
|
164
|
-
</div>
|
|
165
|
-
</div>
|
|
127
|
+
<SlidePanel open={open} onClose={isRunning ? () => {} : onClose} title={title}>
|
|
128
|
+
<StreamingOutput
|
|
129
|
+
state={state}
|
|
130
|
+
lines={lines.map((line) => linkifyPaths(line))}
|
|
131
|
+
anchor={<div ref={scrollRef} />}
|
|
132
|
+
onCancel={() => {
|
|
133
|
+
controllerRef.current?.abort();
|
|
134
|
+
setState("cancelled");
|
|
135
|
+
setLines((lines) => [...lines, "Cancelled."]);
|
|
136
|
+
}}
|
|
137
|
+
onClose={onClose}
|
|
138
|
+
/>
|
|
166
139
|
</SlidePanel>
|
|
167
140
|
);
|
|
168
141
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Button, Placeholder, StatusDot } from "@schlessera/brain-ui-kit";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import type { Tone } from "@schlessera/brain-ui-kit";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* What a streamed backend job looks like while it runs and once it has
|
|
7
|
+
* finished — rendered from props (S6). `StreamingPanel` and `WhatsupPanel`
|
|
8
|
+
* are the containers: they own the request, the reader loop, the abort
|
|
9
|
+
* controller and the "is this still my stream" checks; the two views here
|
|
10
|
+
* own the status row, the output area and the one button in the footer.
|
|
11
|
+
*
|
|
12
|
+
* `state` is the job's, in the container's vocabulary: `running` is the only
|
|
13
|
+
* state with a Cancel; every other state offers Close. The status dot is the
|
|
14
|
+
* kit's — amber breathing while running, teal when it completed, red for a
|
|
15
|
+
* failure or a cancellation — and the row is a polite live region so a
|
|
16
|
+
* screen reader hears "Complete" once, not every line.
|
|
17
|
+
*/
|
|
18
|
+
export type StreamState = "idle" | "running" | "success" | "error" | "cancelled";
|
|
19
|
+
|
|
20
|
+
const STATUS: Record<StreamState, { tone: Tone; pulse: boolean; text: string }> = {
|
|
21
|
+
idle: { tone: "neutral", pulse: false, text: "Ready" },
|
|
22
|
+
running: { tone: "amber", pulse: true, text: "Running..." },
|
|
23
|
+
success: { tone: "teal", pulse: false, text: "Complete" },
|
|
24
|
+
error: { tone: "red", pulse: false, text: "Failed" },
|
|
25
|
+
cancelled: { tone: "red", pulse: false, text: "Cancelled" },
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export interface StreamingOutputProps {
|
|
29
|
+
state: StreamState;
|
|
30
|
+
/** The job's lines so far, already turned into nodes by the container (paths linkified). */
|
|
31
|
+
lines: ReactNode[];
|
|
32
|
+
onCancel: () => void;
|
|
33
|
+
onClose: () => void;
|
|
34
|
+
/** Wire to the scroll anchor the container keeps in view. */
|
|
35
|
+
anchor?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function StreamingOutput(p: StreamingOutputProps) {
|
|
39
|
+
const running = p.state === "running";
|
|
40
|
+
const s = STATUS[p.state];
|
|
41
|
+
return (
|
|
42
|
+
<div className="flex h-full flex-col">
|
|
43
|
+
<div className="flex items-center gap-2 border-b border-border px-5 py-2" aria-live="polite">
|
|
44
|
+
<StatusDot tone={s.tone} pulse={s.pulse} size={7} />
|
|
45
|
+
<span className="text-xs text-muted-foreground">{s.text}</span>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<div className="flex-1 overflow-y-auto p-4 font-[family-name:var(--font-mono)] text-xs leading-relaxed text-muted-foreground">
|
|
49
|
+
{p.lines.map((line, i) => (
|
|
50
|
+
<div key={i} className="whitespace-pre-wrap">
|
|
51
|
+
{line}
|
|
52
|
+
</div>
|
|
53
|
+
))}
|
|
54
|
+
{running && p.lines.length === 0 && <div className="text-muted-foreground/50">Starting...</div>}
|
|
55
|
+
{p.anchor}
|
|
56
|
+
</div>
|
|
57
|
+
|
|
58
|
+
<StreamFooter running={running} onCancel={p.onCancel} onClose={p.onClose} />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The briefing: one document rather than a log, so it loads behind a skeleton
|
|
65
|
+
* and renders as prose once it has all arrived. `content` is the container's
|
|
66
|
+
* rendered markdown node; the view does not know what it is made of.
|
|
67
|
+
*/
|
|
68
|
+
export interface BriefingOutputProps {
|
|
69
|
+
state: "loading" | "done" | "error" | "cancelled";
|
|
70
|
+
content: ReactNode;
|
|
71
|
+
onCancel: () => void;
|
|
72
|
+
onClose: () => void;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function BriefingOutput(p: BriefingOutputProps) {
|
|
76
|
+
const loading = p.state === "loading";
|
|
77
|
+
return (
|
|
78
|
+
<div className="flex h-full flex-col">
|
|
79
|
+
{(p.state === "error" || p.state === "cancelled") && (
|
|
80
|
+
<div className="flex items-center gap-2 border-b border-border px-5 py-2" aria-live="polite">
|
|
81
|
+
<StatusDot tone="red" pulse={false} size={7} />
|
|
82
|
+
<span className="text-xs text-muted-foreground">Failed</span>
|
|
83
|
+
</div>
|
|
84
|
+
)}
|
|
85
|
+
|
|
86
|
+
<div className="flex-1 overflow-y-auto p-5">
|
|
87
|
+
{loading ? (
|
|
88
|
+
<div className="flex flex-col gap-3">
|
|
89
|
+
<Placeholder variant="loading" lines={4} bordered={false} pad={0} />
|
|
90
|
+
<p className="text-sm text-muted-foreground">Generating briefing...</p>
|
|
91
|
+
</div>
|
|
92
|
+
) : (
|
|
93
|
+
p.content
|
|
94
|
+
)}
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<StreamFooter running={loading} onCancel={p.onCancel} onClose={p.onClose} />
|
|
98
|
+
</div>
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function StreamFooter({ running, onCancel, onClose }: { running: boolean; onCancel: () => void; onClose: () => void }) {
|
|
103
|
+
return (
|
|
104
|
+
<div className="flex justify-end border-t border-border px-5 py-3">
|
|
105
|
+
{running ? (
|
|
106
|
+
<Button label="Cancel" icon="cancel" tone="danger" size="sm" block={false} onClick={onCancel} />
|
|
107
|
+
) : (
|
|
108
|
+
<Button label="Close" tone="quiet" size="sm" block={false} onClick={onClose} />
|
|
109
|
+
)}
|
|
110
|
+
</div>
|
|
111
|
+
);
|
|
112
|
+
}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { useBrainUiRoot } from "../../root-context.js";
|
|
1
2
|
import { useState, useEffect, useRef } from "react";
|
|
2
|
-
import { Loader2, XCircle } from "lucide-react";
|
|
3
3
|
import { SlidePanel } from "../layout/slide-panel.js";
|
|
4
4
|
import { BrainMarkdown } from "../chat/brain-markdown.js";
|
|
5
|
-
import {
|
|
5
|
+
import { BriefingOutput } from "./streaming-output.js";
|
|
6
6
|
|
|
7
7
|
type State = "loading" | "done" | "error" | "cancelled";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* The container (S6) for the briefing: the request, the SSE reader loop, the
|
|
11
|
+
* abort controller and the "still my stream" checks live here;
|
|
12
|
+
* `BriefingOutput` draws from props.
|
|
13
|
+
*/
|
|
9
14
|
export function WhatsupPanel({
|
|
10
15
|
open,
|
|
11
16
|
onClose,
|
|
@@ -13,6 +18,7 @@ export function WhatsupPanel({
|
|
|
13
18
|
open: boolean;
|
|
14
19
|
onClose: () => void;
|
|
15
20
|
}) {
|
|
21
|
+
const root = useBrainUiRoot();
|
|
16
22
|
const [state, setState] = useState<State>("loading");
|
|
17
23
|
const [content, setContent] = useState("");
|
|
18
24
|
const controllerRef = useRef<AbortController | null>(null);
|
|
@@ -23,29 +29,39 @@ export function WhatsupPanel({
|
|
|
23
29
|
setState("loading");
|
|
24
30
|
setContent("");
|
|
25
31
|
|
|
32
|
+
let disposed = false;
|
|
33
|
+
let reader: ReadableStreamDefaultReader<Uint8Array> | undefined;
|
|
26
34
|
const controller = new AbortController();
|
|
35
|
+
const cancelReader = () => { void reader?.cancel().catch(() => {}); };
|
|
36
|
+
controller.signal.addEventListener("abort", cancelReader);
|
|
27
37
|
controllerRef.current = controller;
|
|
28
38
|
|
|
29
39
|
(async () => {
|
|
30
40
|
try {
|
|
31
|
-
const res = await
|
|
41
|
+
const res = await root.request(root.backendUrl("/api/brain/whatsup"), {
|
|
32
42
|
method: "POST",
|
|
33
43
|
signal: controller.signal,
|
|
34
44
|
});
|
|
35
45
|
|
|
46
|
+
if (disposed || controller.signal.aborted) {
|
|
47
|
+
await res.body?.cancel();
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
36
51
|
if (!res.ok || !res.body) {
|
|
37
52
|
setState("error");
|
|
38
53
|
setContent(`HTTP ${res.status}: ${res.statusText}`);
|
|
39
54
|
return;
|
|
40
55
|
}
|
|
41
56
|
|
|
42
|
-
|
|
57
|
+
reader = res.body.getReader();
|
|
43
58
|
const decoder = new TextDecoder();
|
|
44
59
|
let buffer = "";
|
|
45
60
|
const lines: string[] = [];
|
|
46
61
|
|
|
47
62
|
while (true) {
|
|
48
63
|
const { done, value } = await reader.read();
|
|
64
|
+
if (disposed || controller.signal.aborted) return;
|
|
49
65
|
if (done) break;
|
|
50
66
|
|
|
51
67
|
buffer += decoder.decode(value, { stream: true });
|
|
@@ -72,6 +88,7 @@ export function WhatsupPanel({
|
|
|
72
88
|
|
|
73
89
|
setContent(lines.join("\n"));
|
|
74
90
|
} catch (err: any) {
|
|
91
|
+
if (disposed || controller.signal.aborted) return;
|
|
75
92
|
if (err.name === "AbortError") {
|
|
76
93
|
setState("cancelled");
|
|
77
94
|
setContent("Cancelled.");
|
|
@@ -80,70 +97,31 @@ export function WhatsupPanel({
|
|
|
80
97
|
setContent(`Error: ${err.message}`);
|
|
81
98
|
}
|
|
82
99
|
} finally {
|
|
83
|
-
|
|
100
|
+
controller.signal.removeEventListener("abort", cancelReader);
|
|
101
|
+
reader?.releaseLock();
|
|
102
|
+
if (controllerRef.current === controller) controllerRef.current = null;
|
|
84
103
|
}
|
|
85
104
|
})();
|
|
86
105
|
|
|
87
106
|
return () => {
|
|
107
|
+
disposed = true;
|
|
88
108
|
controller.abort();
|
|
89
|
-
controllerRef.current = null;
|
|
109
|
+
if (controllerRef.current === controller) controllerRef.current = null;
|
|
90
110
|
};
|
|
91
|
-
}, [open]);
|
|
92
|
-
|
|
93
|
-
const isLoading = state === "loading";
|
|
111
|
+
}, [open, root]);
|
|
94
112
|
|
|
95
113
|
return (
|
|
96
|
-
<SlidePanel
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
<span className="text-xs text-muted-foreground">Failed</span>
|
|
108
|
-
</div>
|
|
109
|
-
)}
|
|
110
|
-
|
|
111
|
-
{/* Content */}
|
|
112
|
-
<div className="flex-1 overflow-y-auto p-5">
|
|
113
|
-
{isLoading ? (
|
|
114
|
-
<div className="flex items-center justify-center h-32 text-muted-foreground text-sm">
|
|
115
|
-
<Loader2 className="h-5 w-5 animate-spin mr-2 text-primary" />
|
|
116
|
-
Generating briefing...
|
|
117
|
-
</div>
|
|
118
|
-
) : (
|
|
119
|
-
<BrainMarkdown
|
|
120
|
-
content={content}
|
|
121
|
-
className="whatsup-briefing brain-prose"
|
|
122
|
-
entityTags
|
|
123
|
-
fileLinks
|
|
124
|
-
/>
|
|
125
|
-
)}
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
{/* Footer */}
|
|
129
|
-
<div className="border-t border-border px-5 py-3 flex justify-end">
|
|
130
|
-
{isLoading ? (
|
|
131
|
-
<button
|
|
132
|
-
onClick={() => controllerRef.current?.abort()}
|
|
133
|
-
className="rounded-lg border border-destructive/30 px-4 py-1.5 text-xs font-medium text-destructive transition-colors hover:bg-destructive/10"
|
|
134
|
-
>
|
|
135
|
-
Cancel
|
|
136
|
-
</button>
|
|
137
|
-
) : (
|
|
138
|
-
<button
|
|
139
|
-
onClick={onClose}
|
|
140
|
-
className="rounded-lg bg-surface-raised px-4 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-surface-overlay"
|
|
141
|
-
>
|
|
142
|
-
Close
|
|
143
|
-
</button>
|
|
144
|
-
)}
|
|
145
|
-
</div>
|
|
146
|
-
</div>
|
|
114
|
+
<SlidePanel open={open} onClose={onClose} title="Whatsup" wide>
|
|
115
|
+
<BriefingOutput
|
|
116
|
+
state={state}
|
|
117
|
+
content={<BrainMarkdown content={content} className="whatsup-briefing brain-prose" entityTags fileLinks />}
|
|
118
|
+
onCancel={() => {
|
|
119
|
+
controllerRef.current?.abort();
|
|
120
|
+
setState("cancelled");
|
|
121
|
+
setContent("Cancelled.");
|
|
122
|
+
}}
|
|
123
|
+
onClose={onClose}
|
|
124
|
+
/>
|
|
147
125
|
</SlidePanel>
|
|
148
126
|
);
|
|
149
127
|
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
import type { PrincipalSummary } from "../../lib/api-client.js";
|
|
3
|
+
import { useBrainApi } from "../../root-context.js";
|
|
4
|
+
import { formatRelativeTime } from "../../lib/format-time.js";
|
|
5
|
+
import { usePrincipalStore } from "../../stores/principal-store.js";
|
|
6
|
+
import { PrincipalList } from "./principal-list.js";
|
|
7
|
+
|
|
8
|
+
const MAX_LABEL_LENGTH = 64;
|
|
9
|
+
const NOT_ENABLED = "Principal management is not enabled";
|
|
10
|
+
|
|
11
|
+
function displayLabel(label: string): string {
|
|
12
|
+
return Array.from(label).slice(0, MAX_LABEL_LENGTH).join("");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Active devices and delegated agents, with owner-only mint and revoke
|
|
17
|
+
* controls. This is the container (S7): the principals request, the mint
|
|
18
|
+
* through the principal store and the revoke with its confirm live here;
|
|
19
|
+
* `PrincipalList` draws the list and the form on the kit.
|
|
20
|
+
*/
|
|
21
|
+
export function DevicesAgentsTab({ active }: { active: boolean }) {
|
|
22
|
+
const api = useBrainApi();
|
|
23
|
+
const lifetime = useRef(0);
|
|
24
|
+
const request = useRef(0);
|
|
25
|
+
const [principals, setPrincipals] = useState<PrincipalSummary[]>([]);
|
|
26
|
+
const [loading, setLoading] = useState(false);
|
|
27
|
+
const [enabled, setEnabled] = useState(true);
|
|
28
|
+
const [loadFailed, setLoadFailed] = useState(false);
|
|
29
|
+
const [error, setError] = useState<string | null>(null);
|
|
30
|
+
const [label, setLabel] = useState("");
|
|
31
|
+
const [ttlDays, setTtlDays] = useState(7);
|
|
32
|
+
const busy = usePrincipalStore((state) => state.mintPending);
|
|
33
|
+
const mintError = usePrincipalStore((state) => state.mintError);
|
|
34
|
+
const oneTimeCredential = usePrincipalStore(
|
|
35
|
+
(state) => state.oneTimeCredential
|
|
36
|
+
);
|
|
37
|
+
const mintAgent = usePrincipalStore((state) => state.mintAgent);
|
|
38
|
+
|
|
39
|
+
const refresh = useCallback(async () => {
|
|
40
|
+
const generation = lifetime.current;
|
|
41
|
+
const token = ++request.current;
|
|
42
|
+
const current = () => generation === lifetime.current && token === request.current;
|
|
43
|
+
setLoading(true);
|
|
44
|
+
setLoadFailed(false);
|
|
45
|
+
setError(null);
|
|
46
|
+
try {
|
|
47
|
+
const data = await api.principals();
|
|
48
|
+
if (!current()) return;
|
|
49
|
+
setPrincipals(data.principals);
|
|
50
|
+
setEnabled(true);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
if (!current()) return;
|
|
53
|
+
setPrincipals([]);
|
|
54
|
+
if (err instanceof Error && err.message === NOT_ENABLED) {
|
|
55
|
+
setEnabled(false);
|
|
56
|
+
} else {
|
|
57
|
+
setEnabled(true);
|
|
58
|
+
setLoadFailed(true);
|
|
59
|
+
setError(err instanceof Error ? err.message : "Could not load devices and agents");
|
|
60
|
+
}
|
|
61
|
+
} finally {
|
|
62
|
+
if (current()) setLoading(false);
|
|
63
|
+
}
|
|
64
|
+
}, [api]);
|
|
65
|
+
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
lifetime.current++;
|
|
68
|
+
setPrincipals([]);
|
|
69
|
+
setLoading(false);
|
|
70
|
+
setEnabled(true);
|
|
71
|
+
setLoadFailed(false);
|
|
72
|
+
setError(null);
|
|
73
|
+
setLabel("");
|
|
74
|
+
setTtlDays(7);
|
|
75
|
+
if (active) void refresh();
|
|
76
|
+
const invalidate = () => { lifetime.current++; };
|
|
77
|
+
return invalidate;
|
|
78
|
+
}, [active, refresh]);
|
|
79
|
+
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!oneTimeCredential) return;
|
|
82
|
+
setLabel("");
|
|
83
|
+
if (active) void refresh();
|
|
84
|
+
}, [active, oneTimeCredential, refresh]);
|
|
85
|
+
|
|
86
|
+
function onMint() {
|
|
87
|
+
const trimmed = label.trim();
|
|
88
|
+
if (!trimmed || busy) return;
|
|
89
|
+
setError(null);
|
|
90
|
+
void mintAgent(trimmed, ttlDays);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function onRevoke(principal: PrincipalSummary) {
|
|
94
|
+
const consequence = principal.is_own
|
|
95
|
+
? "This device will be signed out immediately, and you will return to sign in."
|
|
96
|
+
: principal.kind === "agent"
|
|
97
|
+
? "That agent will lose access immediately."
|
|
98
|
+
: "That device will be signed out immediately.";
|
|
99
|
+
if (!window.confirm(`${consequence} You can't undo this.`)) return;
|
|
100
|
+
|
|
101
|
+
const generation = lifetime.current;
|
|
102
|
+
setError(null);
|
|
103
|
+
try {
|
|
104
|
+
await api.principalRevoke(principal.id);
|
|
105
|
+
if (generation !== lifetime.current) return;
|
|
106
|
+
setPrincipals((rows) => rows.filter((row) => row.id !== principal.id));
|
|
107
|
+
if (principal.is_own) window.location.reload();
|
|
108
|
+
} catch (err) {
|
|
109
|
+
if (generation !== lifetime.current) return;
|
|
110
|
+
setError(err instanceof Error ? err.message : "Could not revoke access");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<PrincipalList
|
|
116
|
+
state={loading ? "loading" : !enabled ? "unavailable" : loadFailed ? "error" : "ready"}
|
|
117
|
+
principals={principals.map((principal) => ({
|
|
118
|
+
id: principal.id,
|
|
119
|
+
label: displayLabel(principal.label),
|
|
120
|
+
kind: principal.kind,
|
|
121
|
+
isOwn: principal.is_own,
|
|
122
|
+
created: formatRelativeTime(principal.created_at),
|
|
123
|
+
lastSeen: principal.last_seen_at ? formatRelativeTime(principal.last_seen_at) : "Never",
|
|
124
|
+
expires: formatRelativeTime(principal.expires_at),
|
|
125
|
+
}))}
|
|
126
|
+
error={error ?? mintError}
|
|
127
|
+
label={label}
|
|
128
|
+
ttlDays={ttlDays}
|
|
129
|
+
minting={busy}
|
|
130
|
+
onLabel={setLabel}
|
|
131
|
+
onTtlDays={setTtlDays}
|
|
132
|
+
onMint={onMint}
|
|
133
|
+
onRevoke={(id) => {
|
|
134
|
+
const principal = principals.find((row) => row.id === id);
|
|
135
|
+
if (principal) void onRevoke(principal);
|
|
136
|
+
}}
|
|
137
|
+
/>
|
|
138
|
+
);
|
|
139
|
+
}
|