@schlessera/brain-ui-react 0.35.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -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 +32 -32
- 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 +13 -2
- package/dist/components/chat/tool-views.d.ts.map +1 -1
- package/dist/components/chat/tool-views.js +20 -22
- 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 +27 -21
- 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 +4 -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 +23 -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 +4 -3
- 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 +39 -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 +6 -1
- package/dist/components/settings/devices-agents-tab.d.ts.map +1 -1
- package/dist/components/settings/devices-agents-tab.js +55 -20
- package/dist/components/settings/devices-agents-tab.js.map +1 -1
- 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.js +1 -1
- package/dist/components/settings/one-time-agent-credential.js.map +1 -1
- 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 +69 -8
- 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.map +1 -1
- package/dist/hooks/use-vpn-status.js +17 -18
- 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 -384
- 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 +289 -0
- package/dist/lib/api-client.d.ts.map +1 -1
- package/dist/lib/api-client.js +243 -224
- 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/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 +4 -1
- package/dist/lib/push-registration.d.ts.map +1 -1
- package/dist/lib/push-registration.js +20 -2
- package/dist/lib/push-registration.js.map +1 -1
- 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 -336
- 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 +4 -15
- package/dist/stores/principal-store.d.ts.map +1 -1
- package/dist/stores/principal-store.js +7 -28
- package/dist/stores/principal-store.js.map +1 -1
- 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 +41 -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 +21 -60
- 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 +32 -24
- 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 +5 -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 +32 -153
- package/src/components/quick-actions/search-modal.tsx +5 -3
- package/src/components/quick-actions/streaming-modal.tsx +42 -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 +60 -152
- 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 +1 -1
- 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 +232 -21
- 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 +18 -17
- package/src/hooks/use-websocket.ts +12 -428
- 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 +426 -384
- package/src/lib/backend.ts +20 -10
- package/src/lib/diff.ts +28 -62
- 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 +19 -2
- 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 -390
- 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 +10 -37
- 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
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { BrainUiClient } from "@schlessera/brain-ui-sdk/client";
|
|
2
|
+
import { activeChat } from "./stores/chat-state.js";
|
|
3
|
+
import { dispatchServerMessage } from "./hooks/websocket-handlers/index.js";
|
|
4
|
+
import { runStateForFrame } from "./hooks/websocket-handlers/chat.js";
|
|
5
|
+
import { REFUSAL_ATTEMPTS } from "./components/connectivity/connection-state.js";
|
|
6
|
+
/** Every callback and mutable queue belongs to the root supplied here. */
|
|
7
|
+
export function createWebSocketClient(root) {
|
|
8
|
+
let disposed = false;
|
|
9
|
+
let generation = 0;
|
|
10
|
+
let owners = 0;
|
|
11
|
+
let removeListeners;
|
|
12
|
+
/**
|
|
13
|
+
* Does this frame announce the identity of the conversation THIS client just
|
|
14
|
+
* started?
|
|
15
|
+
*
|
|
16
|
+
* The old test was `session_info || result` for any unknown session, which
|
|
17
|
+
* adopted whichever arrived first — an older background turn finishing, or
|
|
18
|
+
* another client's new session, would capture the user's draft and bind it to
|
|
19
|
+
* a transcript they never wrote. `draftId` is minted per draft turn and echoed
|
|
20
|
+
* on `session_info`, so a match is proof.
|
|
21
|
+
*
|
|
22
|
+
* A server too old to echo it sends no `draftId`, and the pre-existing
|
|
23
|
+
* behaviour applies rather than the draft never binding at all: correctness
|
|
24
|
+
* where the information exists, compatibility where it does not.
|
|
25
|
+
*/
|
|
26
|
+
function isOurDraftAnnouncement(state, msg) {
|
|
27
|
+
// A terminal result has no draft correlation. Another client's turn may
|
|
28
|
+
// finish before our session_info arrives, so it can never claim our draft.
|
|
29
|
+
if (msg.type !== "session_info")
|
|
30
|
+
return false;
|
|
31
|
+
const pending = state.pendingDraftId;
|
|
32
|
+
if (msg.draftId)
|
|
33
|
+
return msg.draftId === pending;
|
|
34
|
+
// No echo to compare against.
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Lazily open a session-scoped activity subscription (live subagent rows,
|
|
39
|
+
* server-stamped tool timing). Idempotent per connection; the subscribed set
|
|
40
|
+
* resets when a new socket's server_hello arrives.
|
|
41
|
+
*/
|
|
42
|
+
function ensureActivitySubscription(sessionId) {
|
|
43
|
+
if (!sessionId)
|
|
44
|
+
return;
|
|
45
|
+
const activity = root.stores.activity.getState();
|
|
46
|
+
if (!activity.supported || activity.subscribed[sessionId])
|
|
47
|
+
return;
|
|
48
|
+
activity.markSubscribed(sessionId);
|
|
49
|
+
wsClient?.send({ type: "activity_subscribe", view: "session", sessionId });
|
|
50
|
+
// The subscription snapshot carries OPEN runs; finished runs (history
|
|
51
|
+
// timing, past fan-outs) come from the REST side.
|
|
52
|
+
void root.stores.activity.loadSessionActivityHistory(sessionId);
|
|
53
|
+
}
|
|
54
|
+
const pendingDeltas = new Map();
|
|
55
|
+
let flushScheduled = false;
|
|
56
|
+
let frameId;
|
|
57
|
+
/**
|
|
58
|
+
* Apply every buffered delta, in arrival order, and clear the buffer.
|
|
59
|
+
*
|
|
60
|
+
* Exported so tests can force the frame rather than wait for one; production
|
|
61
|
+
* code never needs to call it, because every path that reads the transcript
|
|
62
|
+
* flushes first.
|
|
63
|
+
*/
|
|
64
|
+
function flushChatDeltas() {
|
|
65
|
+
flushDeltas();
|
|
66
|
+
}
|
|
67
|
+
function flushDeltas() {
|
|
68
|
+
if (frameId !== undefined && typeof cancelAnimationFrame === "function")
|
|
69
|
+
cancelAnimationFrame(frameId);
|
|
70
|
+
frameId = undefined;
|
|
71
|
+
flushScheduled = false;
|
|
72
|
+
if (pendingDeltas.size === 0)
|
|
73
|
+
return;
|
|
74
|
+
const batches = [...pendingDeltas.entries()];
|
|
75
|
+
pendingDeltas.clear();
|
|
76
|
+
const state = root.stores.chat.getState();
|
|
77
|
+
for (const [key, chunks] of batches) {
|
|
78
|
+
for (const chunk of chunks) {
|
|
79
|
+
if (chunk.kind === "text")
|
|
80
|
+
state.appendText(key, chunk.text);
|
|
81
|
+
else
|
|
82
|
+
state.appendThinking(key, chunk.text);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function enqueueDelta(key, kind, text) {
|
|
87
|
+
const chunks = pendingDeltas.get(key);
|
|
88
|
+
if (!chunks) {
|
|
89
|
+
pendingDeltas.set(key, [{ kind, text }]);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const last = chunks[chunks.length - 1];
|
|
93
|
+
if (last.kind === kind)
|
|
94
|
+
last.text += text;
|
|
95
|
+
else
|
|
96
|
+
chunks.push({ kind, text });
|
|
97
|
+
}
|
|
98
|
+
// Outside a browser (unit tests, SSR) there is no frame to wait for, so apply
|
|
99
|
+
// straight away and keep the handler's behaviour synchronous.
|
|
100
|
+
if (typeof requestAnimationFrame !== "function") {
|
|
101
|
+
flushDeltas();
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (!flushScheduled) {
|
|
105
|
+
flushScheduled = true;
|
|
106
|
+
frameId = requestAnimationFrame(flushDeltas);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function handleServerMessage(msg) {
|
|
110
|
+
if (disposed)
|
|
111
|
+
return;
|
|
112
|
+
// Every frame that is not itself a delta must see the transcript fully
|
|
113
|
+
// applied: the demux below reads buffer state, and the store records parts in
|
|
114
|
+
// arrival order, so a tool call landing ahead of buffered text would reorder
|
|
115
|
+
// the message.
|
|
116
|
+
if (msg.type !== "text_delta" && msg.type !== "thinking_delta")
|
|
117
|
+
flushDeltas();
|
|
118
|
+
const state = root.stores.chat.getState();
|
|
119
|
+
// Activity stream frames feed their own store and never touch chat state.
|
|
120
|
+
if (msg.type === "server_hello" ||
|
|
121
|
+
msg.type === "activity_snapshot" ||
|
|
122
|
+
msg.type === "activity_delta") {
|
|
123
|
+
const key = state.activeSessionId;
|
|
124
|
+
dispatchServerMessage(msg, {
|
|
125
|
+
stores: root.stores,
|
|
126
|
+
state,
|
|
127
|
+
frameSessionId: undefined,
|
|
128
|
+
frameTurnId: undefined,
|
|
129
|
+
key,
|
|
130
|
+
buffer: () => (key === null ? state.draft : state.buffers[key]),
|
|
131
|
+
enqueueDelta,
|
|
132
|
+
ensureActivitySubscription,
|
|
133
|
+
requestBrowserLocation,
|
|
134
|
+
resyncIfNeeded,
|
|
135
|
+
coldResumeIfNeeded,
|
|
136
|
+
markHistoryReplaced,
|
|
137
|
+
});
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
// Parallel-session demux (per-session buffers). Every frame is scoped by
|
|
141
|
+
// sessionId; a scoped frame lands in ITS session's buffer, so a background
|
|
142
|
+
// session's transcript keeps accumulating while another one is in view.
|
|
143
|
+
// Frames without a sessionId (legacy single-session servers, or a new
|
|
144
|
+
// session's pre-binding frames) apply to the buffer in view.
|
|
145
|
+
const frameSessionId = msg.sessionId;
|
|
146
|
+
if (frameSessionId) {
|
|
147
|
+
// `detail` on a queued status is the host's queue-pressure note; it rides
|
|
148
|
+
// along so the session's badge can show WHY it is queued deep.
|
|
149
|
+
const queueNote = msg.type === "status" && msg.status === "queued" ? msg.detail : undefined;
|
|
150
|
+
// `message_blocks` arrives AFTER the turn's result (D42); it must not
|
|
151
|
+
// reopen a finished session, and it must not touch a queued follow-up
|
|
152
|
+
// that may already be running, so it takes no part in run state.
|
|
153
|
+
if (msg.type !== "message_blocks") {
|
|
154
|
+
state.setRunState(frameSessionId, runStateForFrame(msg), queueNote);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Resolve the target buffer key for this frame.
|
|
158
|
+
let key;
|
|
159
|
+
if (!frameSessionId) {
|
|
160
|
+
key = state.activeSessionId; // null = the draft view
|
|
161
|
+
}
|
|
162
|
+
else if (state.buffers[frameSessionId]) {
|
|
163
|
+
key = frameSessionId;
|
|
164
|
+
}
|
|
165
|
+
else if (state.draft && isOurDraftAnnouncement(state, msg)) {
|
|
166
|
+
// A draft run just got its server identity: adopt the draft buffer.
|
|
167
|
+
state.bindDraftSession(frameSessionId);
|
|
168
|
+
key = frameSessionId;
|
|
169
|
+
}
|
|
170
|
+
else if (msg.type === "session_info" && frameSessionId === state.activeSessionId) {
|
|
171
|
+
// The ACTIVE session announced itself but has no buffer yet — the cold
|
|
172
|
+
// reattach case (PWA relaunch mid-turn; the server may skip the history
|
|
173
|
+
// frame when a first turn has no history yet). Materialize the buffer so
|
|
174
|
+
// this session_info and every following delta land instead of vanishing.
|
|
175
|
+
state.setActiveSession(frameSessionId);
|
|
176
|
+
key = frameSessionId;
|
|
177
|
+
}
|
|
178
|
+
else if (msg.type === "session_history") {
|
|
179
|
+
// History replay may create a buffer (cold resume / reattach).
|
|
180
|
+
key = frameSessionId;
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
// Scoped frame for a session with no buffer (never opened, or evicted):
|
|
184
|
+
// the badge above is all we track. The transcript heals via
|
|
185
|
+
// session_resume when the user opens it.
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const buffer = () => {
|
|
189
|
+
const s = root.stores.chat.getState();
|
|
190
|
+
return key === null ? s.draft : s.buffers[key];
|
|
191
|
+
};
|
|
192
|
+
dispatchServerMessage(msg, {
|
|
193
|
+
stores: root.stores,
|
|
194
|
+
state,
|
|
195
|
+
frameSessionId,
|
|
196
|
+
frameTurnId: msg.turnId,
|
|
197
|
+
key,
|
|
198
|
+
buffer,
|
|
199
|
+
enqueueDelta,
|
|
200
|
+
ensureActivitySubscription,
|
|
201
|
+
requestBrowserLocation,
|
|
202
|
+
resyncIfNeeded,
|
|
203
|
+
coldResumeIfNeeded,
|
|
204
|
+
markHistoryReplaced,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* The server asked the browser for its location (the agent called
|
|
209
|
+
* `get_current_location`). Read `navigator.geolocation` and reply over the same
|
|
210
|
+
* requestId. The browser shows its own permission prompt on first use; a denial,
|
|
211
|
+
* timeout, or unavailable position comes back as a `location_error` that the
|
|
212
|
+
* server turns into a tool error for the agent.
|
|
213
|
+
*/
|
|
214
|
+
function requestBrowserLocation(msg) {
|
|
215
|
+
const client = wsClient;
|
|
216
|
+
const requestedGeneration = generation;
|
|
217
|
+
const requestedSocket = root.stores.connection.getState().socketOpens;
|
|
218
|
+
const reply = (message) => {
|
|
219
|
+
if (!disposed && requestedGeneration === generation && requestedSocket === root.stores.connection.getState().socketOpens && client === wsClient)
|
|
220
|
+
client?.send(message);
|
|
221
|
+
};
|
|
222
|
+
const { requestId } = msg;
|
|
223
|
+
if (typeof navigator === "undefined" || !navigator.geolocation) {
|
|
224
|
+
reply({
|
|
225
|
+
type: "location_error",
|
|
226
|
+
requestId,
|
|
227
|
+
code: 0,
|
|
228
|
+
message: "Geolocation is not available in this browser.",
|
|
229
|
+
});
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const opts = msg.options ?? {};
|
|
233
|
+
navigator.geolocation.getCurrentPosition((pos) => {
|
|
234
|
+
reply({
|
|
235
|
+
type: "location_response",
|
|
236
|
+
requestId,
|
|
237
|
+
coords: {
|
|
238
|
+
latitude: pos.coords.latitude,
|
|
239
|
+
longitude: pos.coords.longitude,
|
|
240
|
+
accuracy: pos.coords.accuracy,
|
|
241
|
+
altitude: pos.coords.altitude,
|
|
242
|
+
altitudeAccuracy: pos.coords.altitudeAccuracy,
|
|
243
|
+
heading: pos.coords.heading,
|
|
244
|
+
speed: pos.coords.speed,
|
|
245
|
+
},
|
|
246
|
+
timestamp: pos.timestamp,
|
|
247
|
+
});
|
|
248
|
+
}, (err) => {
|
|
249
|
+
reply({
|
|
250
|
+
type: "location_error",
|
|
251
|
+
requestId,
|
|
252
|
+
code: err.code,
|
|
253
|
+
message: err.message || "Failed to retrieve location.",
|
|
254
|
+
});
|
|
255
|
+
}, {
|
|
256
|
+
enableHighAccuracy: opts.enableHighAccuracy ?? false,
|
|
257
|
+
timeout: opts.timeoutMs ?? 15000,
|
|
258
|
+
maximumAge: opts.maximumAgeMs ?? 60000,
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
// Reconnection bookkeeping: after a WS drop, the rendered transcript may have
|
|
262
|
+
// gaps (deltas streamed while offline are lost). We heal by replaying the
|
|
263
|
+
// authoritative session history — immediately if nothing is streaming, or
|
|
264
|
+
// once the in-flight turn settles (result / idle status). The pending resync
|
|
265
|
+
// is keyed to the session that needs healing (the one that was active at the
|
|
266
|
+
// reconnect), so a background session settling first cannot consume it.
|
|
267
|
+
let wasDisconnected = false;
|
|
268
|
+
let resyncSessionId = null;
|
|
269
|
+
function handleSocketClose(close) {
|
|
270
|
+
const connection = root.stores.connection.getState();
|
|
271
|
+
connection.recordWsClose(close.opened, close.code);
|
|
272
|
+
if (!close.opened &&
|
|
273
|
+
root.stores.connection.getState().handshakeFailures >= REFUSAL_ATTEMPTS) {
|
|
274
|
+
root.recheckVpn?.();
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
function resyncIfNeeded(sessionId) {
|
|
278
|
+
if (!resyncSessionId || !sessionId || sessionId !== resyncSessionId)
|
|
279
|
+
return;
|
|
280
|
+
resyncSessionId = null;
|
|
281
|
+
wsClient?.send({ type: "session_resume", sessionId });
|
|
282
|
+
}
|
|
283
|
+
// A cold page / PWA relaunch restores only the stored session id, not the
|
|
284
|
+
// transcript. The server pushes a snapshot on connect only while a session is
|
|
285
|
+
// actively running; when it's idle (the common "agent finished while the phone
|
|
286
|
+
// slept" case) nothing arrives, so the client must fetch the finished
|
|
287
|
+
// session's history itself. Guarded to fire at most once per session id per
|
|
288
|
+
// connection — an empty session would otherwise re-trigger on every idle
|
|
289
|
+
// status and loop.
|
|
290
|
+
let coldResumedSessionId = null;
|
|
291
|
+
function markHistoryReplaced(key) {
|
|
292
|
+
if (key !== null && key === resyncSessionId)
|
|
293
|
+
resyncSessionId = null;
|
|
294
|
+
coldResumedSessionId = key;
|
|
295
|
+
}
|
|
296
|
+
function coldResumeIfNeeded(sessionId, messageCount) {
|
|
297
|
+
if (!sessionId || messageCount > 0)
|
|
298
|
+
return;
|
|
299
|
+
if (coldResumedSessionId === sessionId)
|
|
300
|
+
return;
|
|
301
|
+
coldResumedSessionId = sessionId;
|
|
302
|
+
wsClient?.send({ type: "session_resume", sessionId });
|
|
303
|
+
}
|
|
304
|
+
function handleStatusChange(status) {
|
|
305
|
+
root.stores.connection.getState().setWsStatus(status);
|
|
306
|
+
if (status === "connected") {
|
|
307
|
+
root.stores.connection.getState().noteSocketOpen();
|
|
308
|
+
}
|
|
309
|
+
// A status change can be followed by a history replay that rewrites the
|
|
310
|
+
// buffer, so land whatever is still buffered before anything reads it. In a
|
|
311
|
+
// hidden tab requestAnimationFrame does not run at all, which is exactly the
|
|
312
|
+
// case where deltas could otherwise sit unapplied across a reconnect.
|
|
313
|
+
flushDeltas();
|
|
314
|
+
if (status === "disconnected") {
|
|
315
|
+
wasDisconnected = true;
|
|
316
|
+
// Allow a fresh cold-resume attempt after we reconnect.
|
|
317
|
+
coldResumedSessionId = null;
|
|
318
|
+
}
|
|
319
|
+
else if (status === "connected" && wasDisconnected) {
|
|
320
|
+
wasDisconnected = false;
|
|
321
|
+
const chat = root.stores.chat.getState();
|
|
322
|
+
const active = activeChat(chat);
|
|
323
|
+
if (chat.activeSessionId && active.messages.length > 0) {
|
|
324
|
+
resyncSessionId = chat.activeSessionId;
|
|
325
|
+
// Not mid-stream: replay right away. Mid-stream: the flag holds until
|
|
326
|
+
// the running turn finishes (result or idle status).
|
|
327
|
+
if (!active.isStreaming) {
|
|
328
|
+
resyncIfNeeded(chat.activeSessionId);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
let wsClient = null;
|
|
334
|
+
function sendClientMessage(msg) {
|
|
335
|
+
if (!wsClient)
|
|
336
|
+
return false;
|
|
337
|
+
if (root.stores.connection.getState().wsStatus !== "connected")
|
|
338
|
+
return false;
|
|
339
|
+
return wsClient.send(msg);
|
|
340
|
+
}
|
|
341
|
+
/** Retry this root's socket, skipping any remaining backoff. */
|
|
342
|
+
function reconnectWebSocketNow() {
|
|
343
|
+
wsClient?.reconnectNow();
|
|
344
|
+
}
|
|
345
|
+
/** Acquire a connection lease. Several consumers may share one root safely. */
|
|
346
|
+
function connect() {
|
|
347
|
+
if (disposed)
|
|
348
|
+
throw new Error("Cannot connect a disposed UI root");
|
|
349
|
+
owners++;
|
|
350
|
+
if (!wsClient) {
|
|
351
|
+
const connectedGeneration = ++generation;
|
|
352
|
+
const current = () => !disposed && connectedGeneration === generation;
|
|
353
|
+
root.stores.connection.getState().noteSocketOpen();
|
|
354
|
+
const client = new BrainUiClient({
|
|
355
|
+
url: root.wsUrl(),
|
|
356
|
+
handlers: { onAny: (message) => { if (current())
|
|
357
|
+
handleServerMessage(message); } },
|
|
358
|
+
onStatusChange: (status) => { if (current())
|
|
359
|
+
handleStatusChange(status); },
|
|
360
|
+
onClose: (close) => { if (current())
|
|
361
|
+
handleSocketClose(close); },
|
|
362
|
+
onProtocolError: (err) => {
|
|
363
|
+
if (!current())
|
|
364
|
+
return;
|
|
365
|
+
root.stores.connection.getState().reportError("PROTOCOL_ERROR", err.frameType ? `Dropped a ${err.frameType} frame: ${err.detail}` : `Dropped an unreadable frame: ${err.detail}`);
|
|
366
|
+
},
|
|
367
|
+
});
|
|
368
|
+
wsClient = client;
|
|
369
|
+
client.connect();
|
|
370
|
+
const reconnectNow = () => { if (current())
|
|
371
|
+
client.reconnectNow(); };
|
|
372
|
+
const onVisible = () => { if (document.visibilityState === "visible")
|
|
373
|
+
reconnectNow(); };
|
|
374
|
+
if (typeof window !== "undefined")
|
|
375
|
+
window.addEventListener("online", reconnectNow);
|
|
376
|
+
if (typeof document !== "undefined")
|
|
377
|
+
document.addEventListener("visibilitychange", onVisible);
|
|
378
|
+
removeListeners = () => {
|
|
379
|
+
if (typeof window !== "undefined")
|
|
380
|
+
window.removeEventListener("online", reconnectNow);
|
|
381
|
+
if (typeof document !== "undefined")
|
|
382
|
+
document.removeEventListener("visibilitychange", onVisible);
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
let released = false;
|
|
386
|
+
return () => {
|
|
387
|
+
if (released)
|
|
388
|
+
return;
|
|
389
|
+
released = true;
|
|
390
|
+
if (--owners === 0)
|
|
391
|
+
disconnect();
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function disconnect() {
|
|
395
|
+
generation++;
|
|
396
|
+
removeListeners?.();
|
|
397
|
+
removeListeners = undefined;
|
|
398
|
+
const client = wsClient;
|
|
399
|
+
wsClient = null;
|
|
400
|
+
client?.close();
|
|
401
|
+
handleStatusChange("disconnected");
|
|
402
|
+
root.stores.activity.getState().setSupported(false);
|
|
403
|
+
root.stores.activity.getState().resetSubscriptions();
|
|
404
|
+
}
|
|
405
|
+
return {
|
|
406
|
+
connect,
|
|
407
|
+
send: sendClientMessage,
|
|
408
|
+
reconnectNow: reconnectWebSocketNow,
|
|
409
|
+
handleServerMessage,
|
|
410
|
+
flushChatDeltas,
|
|
411
|
+
dispose() {
|
|
412
|
+
if (disposed)
|
|
413
|
+
return;
|
|
414
|
+
disposed = true;
|
|
415
|
+
disconnect();
|
|
416
|
+
resyncSessionId = null;
|
|
417
|
+
coldResumedSessionId = null;
|
|
418
|
+
},
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
//# sourceMappingURL=connection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAuB,MAAM,iCAAiC,CAAC;AAGrF,OAAO,EAAE,UAAU,EAAgC,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AAEjF,0EAA0E;AAC1E,MAAM,UAAU,qBAAqB,CAAC,IAAqB;IACzD,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,eAAyC,CAAC;IAE9C;;;;;;;;;;;;;OAaG;IACH,SAAS,sBAAsB,CAC7B,KAAgB,EAChB,GAAkB;QAElB,wEAAwE;QACxE,2EAA2E;QAC3E,IAAI,GAAG,CAAC,IAAI,KAAK,cAAc;YAAE,OAAO,KAAK,C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EAAE,KAAK,EAAE,CAAC;QAChB,kBAAkB,CAAC,cAAc,CAAC,CAAC;QACnC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,kBAAkB,EAAE,CAAC;IACvD,CAAC;IAED,OAAO;QACL,OAAO;QACP,IAAI,EAAE,iBAAiB;QACvB,YAAY,EAAE,qBAAqB;QACnC,mBAAmB;QACnB,eAAe;QACf,OAAO;YACL,IAAI,QAAQ;gBAAE,OAAO;YACrB,QAAQ,GAAG,IAAI,CAAC;YAChB,UAAU,EAAE,CAAC;YACb,eAAe,GAAG,IAAI,CAAC;YACvB,oBAAoB,GAAG,IAAI,CAAC;QAC9B,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-root.d.ts","sourceRoot":"","sources":["../src/default-root.ts"],"names":[],"mappings":"AAKA,8EAA8E;AAC9E,eAAO,MAAM,WAAW,iCAA0G,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { defaultToolRendererRegistry, defaultAsrClientRegistry } from "@schlessera/brain-ui-sdk/client";
|
|
2
|
+
import { uiConfig, registerDevHandle } from "./config.js";
|
|
3
|
+
import { api } from "./lib/api-client.js";
|
|
4
|
+
import { createRoot } from "./root.js";
|
|
5
|
+
/** The single application root used by existing shells without a provider. */
|
|
6
|
+
export const defaultRoot = createRoot({ storagePrefix: "", api }, uiConfig, defaultToolRendererRegistry, defaultAsrClientRegistry);
|
|
7
|
+
registerDevHandle(() => {
|
|
8
|
+
if (typeof window === "undefined")
|
|
9
|
+
return;
|
|
10
|
+
Object.assign(window, {
|
|
11
|
+
__chatStore: defaultRoot.stores.chat,
|
|
12
|
+
__graphStore: defaultRoot.stores.graph,
|
|
13
|
+
__activityStore: defaultRoot.stores.activity,
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=default-root.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-root.js","sourceRoot":"","sources":["../src/default-root.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAC,EAAE,aAAa,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,2BAA2B,EAAE,wBAAwB,CAAC,CAAC;AAEnI,iBAAiB,CAAC,GAAG,EAAE;IACrB,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO;IAC1C,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE;QACpB,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI;QACpC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK;QACtC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ;KAC7C,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type ColorScheme } from "../lib/light-dark.js";
|
|
2
|
+
/**
|
|
3
|
+
* The scheme the page is drawing in — `light` or `dark` — for the parts of
|
|
4
|
+
* the app that read a token as a value rather than referencing it (the graph
|
|
5
|
+
* canvas, the diagram theme). Everything else lets `light-dark()` decide.
|
|
6
|
+
*
|
|
7
|
+
* Follows the store's preference and, under `system`, the OS: both are
|
|
8
|
+
* subscribed, and the answer is re-read from the root's computed
|
|
9
|
+
* `color-scheme` after `useApplyTheme` has written the attribute, so a host
|
|
10
|
+
* that sets `data-theme` itself is honoured too. The initial value is read
|
|
11
|
+
* synchronously, so the first paint after a stored preference is right.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useColorScheme(): ColorScheme;
|
|
14
|
+
//# sourceMappingURL=use-color-scheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-color-scheme.d.ts","sourceRoot":"","sources":["../../src/hooks/use-color-scheme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAc5C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useUIStore } from "../stores/ui-store.js";
|
|
3
|
+
import { useMediaQuery } from "./use-media-query.js";
|
|
4
|
+
import { documentColorScheme } from "../lib/light-dark.js";
|
|
5
|
+
/**
|
|
6
|
+
* The scheme the page is drawing in — `light` or `dark` — for the parts of
|
|
7
|
+
* the app that read a token as a value rather than referencing it (the graph
|
|
8
|
+
* canvas, the diagram theme). Everything else lets `light-dark()` decide.
|
|
9
|
+
*
|
|
10
|
+
* Follows the store's preference and, under `system`, the OS: both are
|
|
11
|
+
* subscribed, and the answer is re-read from the root's computed
|
|
12
|
+
* `color-scheme` after `useApplyTheme` has written the attribute, so a host
|
|
13
|
+
* that sets `data-theme` itself is honoured too. The initial value is read
|
|
14
|
+
* synchronously, so the first paint after a stored preference is right.
|
|
15
|
+
*/
|
|
16
|
+
export function useColorScheme() {
|
|
17
|
+
const preference = useUIStore((s) => s.theme);
|
|
18
|
+
const osDark = useMediaQuery("(prefers-color-scheme: dark)");
|
|
19
|
+
const [scheme, setScheme] = useState(() => expected(preference, osDark));
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
// `useApplyTheme` writes `data-theme` in the app root's effect, which runs
|
|
22
|
+
// after this one; the store says what it will write, and the document is
|
|
23
|
+
// re-read on the next frame in case a host wrote something else.
|
|
24
|
+
setScheme(expected(preference, osDark));
|
|
25
|
+
if (typeof requestAnimationFrame !== "function")
|
|
26
|
+
return;
|
|
27
|
+
const frame = requestAnimationFrame(() => setScheme(documentColorScheme()));
|
|
28
|
+
return () => cancelAnimationFrame(frame);
|
|
29
|
+
}, [preference, osDark]);
|
|
30
|
+
return scheme;
|
|
31
|
+
}
|
|
32
|
+
function expected(preference, osDark) {
|
|
33
|
+
if (preference === "system")
|
|
34
|
+
return osDark ? "dark" : "light";
|
|
35
|
+
return preference;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=use-color-scheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-color-scheme.js","sourceRoot":"","sources":["../../src/hooks/use-color-scheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAE7E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc;IAC5B,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,aAAa,CAAC,8BAA8B,CAAC,CAAC;IAC7D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAc,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACtF,SAAS,CAAC,GAAG,EAAE;QACb,2EAA2E;QAC3E,yEAAyE;QACzE,iEAAiE;QACjE,SAAS,CAAC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;QACxC,IAAI,OAAO,qBAAqB,KAAK,UAAU;YAAE,OAAO;QACxD,MAAM,KAAK,GAAG,qBAAqB,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,mBAAmB,EAAE,CAAC,CAAC,CAAC;QAC5E,OAAO,GAAG,EAAE,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;IACzB,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,QAAQ,CAAC,UAAuC,EAAE,MAAe;IACxE,IAAI,UAAU,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAC9D,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-hash-routes.d.ts","sourceRoot":"","sources":["../../src/hooks/use-hash-routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-hash-routes.d.ts","sourceRoot":"","sources":["../../src/hooks/use-hash-routes.ts"],"names":[],"mappings":"AA6BA;;;GAGG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAsEpC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useBrainUiRoot } from "../root-context.js";
|
|
1
2
|
import { useEffect, useRef, useState } from "react";
|
|
2
3
|
import { useFileStore } from "../stores/file-store.js";
|
|
3
4
|
import { useUIStore } from "../stores/ui-store.js";
|
|
@@ -21,6 +22,7 @@ function viewForHash(hash) {
|
|
|
21
22
|
* stores.
|
|
22
23
|
*/
|
|
23
24
|
export function useHashRoutes() {
|
|
25
|
+
const root = useBrainUiRoot();
|
|
24
26
|
const [hash, setHash] = useState(() => window.location.hash);
|
|
25
27
|
const syncingFromHash = useRef(false);
|
|
26
28
|
const activeView = useUIStore((state) => state.activeView);
|
|
@@ -65,11 +67,11 @@ export function useHashRoutes() {
|
|
|
65
67
|
// below never runs and never clears the flag. It would then swallow the
|
|
66
68
|
// NEXT store-driven change, leaving the URL pointing at Activity while the
|
|
67
69
|
// app shows Chat, and a refresh would jump back.
|
|
68
|
-
if (
|
|
70
|
+
if (root.stores.ui.getState().activeView === view)
|
|
69
71
|
return;
|
|
70
72
|
syncingFromHash.current = true;
|
|
71
73
|
setActiveView(view);
|
|
72
|
-
}, [hash, setActiveView]);
|
|
74
|
+
}, [hash, setActiveView, root]);
|
|
73
75
|
useEffect(() => {
|
|
74
76
|
// A hash-driven store write and this effect are flushed together. Skip
|
|
75
77
|
// the stale pre-write render so it cannot rewrite the incoming hash.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-hash-routes.js","sourceRoot":"","sources":["../../src/hooks/use-hash-routes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAmB,MAAM,uBAAuB,CAAC;AAEpE,MAAM,WAAW,GAGZ;IACH,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE;IACrC,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE;CACxC,CAAC;AAEF,SAAS,gBAAgB,CACvB,IAAY,EACZ,IAAiC,EACjC,WAAoB;IAEpB,MAAM,KAAK,GAAG,KAAK,IAAI,EAAE,CAAC;IAC1B,OAAO,IAAI,KAAK,KAAK,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;AACzE,CAAC;AAED,SAAS,WAAW,CAAC,IAAY;IAC/B,KAAK,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,WAAW,EAAE,CAAC;QAChD,IAAI,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC;YAAE,OAAO,IAAI,CAAC;IAC7D,C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AC,OAAO,GAAG,IAAI,CAAC;QAC/B,aAAa,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;IAEhC,SAAS,CAAC,GAAG,EAAE;QACb,uEAAuE;QACvE,qEAAqE;QACrE,IAAI,eAAe,CAAC,OAAO,EAAE,CAAC;YAC5B,eAAe,CAAC,OAAO,GAAG,KAAK,CAAC;YAChC,OAAO;QACT,CAAC;QAED,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;YAC1B,IAAI,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;gBACtC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAC3D,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,MAAM,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,UAAU,CAAE,CAAC;QAC/E,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC;YAC7E,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,UAAU,EAAE,CAAC,CAAC;QACpD,CAAC;IACH,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a media query matches, kept current as the window changes. Reads
|
|
3
|
+
* `false` where there is no `matchMedia` — the server, and the test DOM —
|
|
4
|
+
* so a component that branches on it renders its mobile shape there.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
7
|
+
//# sourceMappingURL=use-media-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-media-query.d.ts","sourceRoot":"","sources":["../../src/hooks/use-media-query.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAgBpD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a media query matches, kept current as the window changes. Reads
|
|
4
|
+
* `false` where there is no `matchMedia` — the server, and the test DOM —
|
|
5
|
+
* so a component that branches on it renders its mobile shape there.
|
|
6
|
+
*/
|
|
7
|
+
export function useMediaQuery(query) {
|
|
8
|
+
const [matches, setMatches] = useState(() => read(query));
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
11
|
+
return;
|
|
12
|
+
let list;
|
|
13
|
+
try {
|
|
14
|
+
list = window.matchMedia(query);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const update = () => setMatches(list.matches);
|
|
20
|
+
update();
|
|
21
|
+
list.addEventListener?.("change", update);
|
|
22
|
+
return () => list.removeEventListener?.("change", update);
|
|
23
|
+
}, [query]);
|
|
24
|
+
return matches;
|
|
25
|
+
}
|
|
26
|
+
function read(query) {
|
|
27
|
+
try {
|
|
28
|
+
return typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(query).matches;
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=use-media-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-media-query.js","sourceRoot":"","sources":["../../src/hooks/use-media-query.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC1D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU;YAAE,OAAO;QACrF,IAAI,IAAoB,CAAC;QACzB,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;QACT,CAAC;QACD,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,EAAE,CAAC;QACT,IAAI,CAAC,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC1C,OAAO,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IACZ,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACzB,IAAI,CAAC;QACH,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,UAAU,KAAK,UAAU,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC;IACtH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-share-intake.d.ts","sourceRoot":"","sources":["../../src/hooks/use-share-intake.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-share-intake.d.ts","sourceRoot":"","sources":["../../src/hooks/use-share-intake.ts"],"names":[],"mappings":"AAMA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,uCAAuC,CAAC;AAmD/C,wBAAgB,cAAc,IAAI;IAChC,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CACxC,CAgJA"}
|