gloomberb 0.7.5 → 0.8.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 +27 -6
- package/package.json +2 -3
- package/src/api-client/auth.ts +167 -0
- package/src/api-client/chat.ts +116 -0
- package/src/api-client/data.ts +177 -0
- package/src/api-client/errors.ts +28 -0
- package/src/api-client/index.test.ts +675 -0
- package/src/api-client/index.ts +384 -0
- package/src/api-client/normalizers.ts +61 -0
- package/src/api-client/paths.ts +173 -0
- package/src/api-client/request.ts +124 -0
- package/src/api-client/socket.ts +483 -0
- package/src/api-client/types.ts +490 -0
- package/src/app/app-bootstrap-state.test.ts +157 -0
- package/src/app/app-bootstrap-state.ts +134 -0
- package/src/app/global-shortcuts.test.tsx +166 -0
- package/src/app/global-shortcuts.ts +126 -0
- package/src/app/pane-runtime/index.tsx +297 -0
- package/src/app/pane-runtime/layout-placement.ts +73 -0
- package/src/app/pane-runtime/pane-settings-runtime.tsx +67 -0
- package/src/app/pane-runtime/pane-template-runtime.ts +110 -0
- package/src/app/pane-runtime/plugin-bindings.ts +231 -0
- package/src/app/pane-runtime/ticker-inspector-runtime.ts +167 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +144 -0
- package/src/app/pane-template-dialog-wizard.tsx +52 -0
- package/src/app/runtime/broker-import.ts +109 -0
- package/src/app/runtime/desktop-menu.ts +74 -0
- package/src/app/runtime/plugin-bindings.ts +246 -0
- package/src/app/runtime/startup.ts +126 -0
- package/src/app/runtime/ticker-refresh.ts +249 -0
- package/src/app/runtime/update.ts +86 -0
- package/src/app.tsx +107 -1487
- package/src/brokers/broker-portfolio-sync.ts +186 -0
- package/src/brokers/broker-ticker-sync.ts +141 -0
- package/src/brokers/profile-form.ts +2 -2
- package/src/brokers/remote-broker-adapter.ts +3 -2
- package/src/brokers/sync-broker-instance.test.ts +140 -0
- package/src/brokers/sync-broker-instance.ts +60 -181
- package/src/capabilities/types.ts +4 -4
- package/src/cli/commands/search.ts +1 -1
- package/src/cli/commands/ticker.ts +3 -3
- package/src/cli/context.ts +1 -1
- package/src/cli/desktop-pane-shot.ts +305 -0
- package/src/cli/helpers.ts +1 -1
- package/src/cli/index.ts +34 -0
- package/src/cli/pane-functions/catalog.ts +243 -0
- package/src/cli/pane-functions/data.ts +78 -0
- package/src/cli/pane-functions/discovery.ts +113 -0
- package/src/cli/pane-functions/index.test.ts +114 -0
- package/src/cli/pane-functions/index.ts +112 -0
- package/src/cli/pane-functions/options.ts +249 -0
- package/src/cli/pane-functions/report.ts +180 -0
- package/src/cli/pane-functions/resolver.ts +96 -0
- package/src/cli/pane-functions/screenshot.ts +113 -0
- package/src/cli/registry.ts +3 -2
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli.test.ts +1 -1
- package/src/components/chart/bar-chart-renderer.test.ts +53 -0
- package/src/components/chart/bar-chart-renderer.ts +190 -0
- package/src/components/chart/comparison/data.test.ts +105 -0
- package/src/components/chart/comparison/data.ts +279 -0
- package/src/components/chart/comparison/renderer.test.ts +187 -0
- package/src/components/chart/comparison/renderer.ts +283 -0
- package/src/components/chart/comparison/scene.ts +178 -0
- package/src/components/chart/comparison-stock-chart/axis-width.ts +99 -0
- package/src/components/chart/comparison-stock-chart/canvas.ts +148 -0
- package/src/components/chart/comparison-stock-chart/controls.ts +252 -0
- package/src/components/chart/comparison-stock-chart/helpers.ts +133 -0
- package/src/components/chart/comparison-stock-chart/interactions.ts +202 -0
- package/src/components/chart/comparison-stock-chart/layout-metrics.ts +62 -0
- package/src/components/chart/comparison-stock-chart/layout.tsx +155 -0
- package/src/components/chart/comparison-stock-chart/legend.tsx +73 -0
- package/src/components/chart/comparison-stock-chart/native-surfaces.ts +89 -0
- package/src/components/chart/comparison-stock-chart/render-data.ts +198 -0
- package/src/components/chart/comparison-stock-chart/render-output.ts +145 -0
- package/src/components/chart/comparison-stock-chart/selection-runtime.ts +111 -0
- package/src/components/chart/comparison-stock-chart/sources.ts +47 -0
- package/src/components/chart/comparison-stock-chart/surface-runtime.ts +159 -0
- package/src/components/chart/comparison-stock-chart/toolbar.tsx +107 -0
- package/src/components/chart/comparison-stock-chart/types.ts +22 -0
- package/src/components/chart/comparison-stock-chart/view.tsx +524 -0
- package/src/components/chart/comparison-stock-chart/viewport-runtime.ts +239 -0
- package/src/components/chart/comparison-stock-chart.tsx +12 -2028
- package/src/components/chart/core/axis-format.ts +147 -0
- package/src/components/chart/core/axis-measure.ts +33 -0
- package/src/components/chart/core/controller.test.ts +157 -0
- package/src/components/chart/core/controller.ts +349 -0
- package/src/components/chart/core/data.ts +94 -0
- package/src/components/chart/core/date-window.ts +392 -0
- package/src/components/chart/core/index.test.ts +1007 -0
- package/src/components/chart/core/indicator-selector.tsx +75 -0
- package/src/components/chart/core/keyboard.ts +15 -0
- package/src/components/chart/core/palette.ts +60 -0
- package/src/components/chart/core/pane-settings.test.ts +25 -0
- package/src/components/chart/core/pane-settings.ts +82 -0
- package/src/components/chart/core/pointer.ts +292 -0
- package/src/components/chart/core/projection.ts +333 -0
- package/src/components/chart/core/render-utils.ts +4 -0
- package/src/components/chart/core/renderer.ts +249 -0
- package/src/components/chart/core/resolution.test.ts +99 -0
- package/src/components/chart/core/resolution.ts +380 -0
- package/src/components/chart/core/scene.ts +180 -0
- package/src/components/chart/core/scroll.test.ts +70 -0
- package/src/components/chart/core/scroll.ts +104 -0
- package/src/components/chart/core/time-axis.ts +330 -0
- package/src/components/chart/core/types.ts +124 -0
- package/src/components/chart/core/viewport.test.ts +29 -0
- package/src/components/chart/core/viewport.ts +51 -0
- package/src/components/chart/core/window-viewport.test.ts +69 -0
- package/src/components/chart/core/window-viewport.ts +162 -0
- package/src/components/chart/display-cursor.ts +153 -0
- package/src/components/chart/market-session.ts +1 -1
- package/src/components/chart/multi-line/renderer.test.ts +83 -0
- package/src/components/chart/multi-line/renderer.ts +160 -0
- package/src/components/chart/multi-line/scene.ts +188 -0
- package/src/components/chart/native/canvas-bitmaps.ts +140 -0
- package/src/components/chart/native/chart-rasterizer.ts +18 -865
- package/src/components/chart/native/kitty/adapter.ts +9 -0
- package/src/components/chart/native/kitty/index.test.ts +752 -0
- package/src/components/chart/native/kitty/manager.ts +142 -0
- package/src/components/chart/native/kitty/support.ts +70 -0
- package/src/components/chart/native/raster/comparison-chart.ts +162 -0
- package/src/components/chart/native/raster/crosshair.ts +51 -0
- package/src/components/chart/native/raster/layout.ts +136 -0
- package/src/components/chart/native/raster/placement.ts +132 -0
- package/src/components/chart/native/raster/price-chart.ts +244 -0
- package/src/components/chart/native/raster/primitives.ts +154 -0
- package/src/components/chart/native/raster/types.ts +41 -0
- package/src/components/chart/native/renderer-selection.ts +81 -1
- package/src/components/chart/native/surface/hooks.ts +137 -0
- package/src/components/chart/native/surface/manager.ts +225 -0
- package/src/components/chart/native/surface/rendering.ts +211 -0
- package/src/components/chart/native/surface/sync.ts +34 -0
- package/src/components/chart/native/surface/visibility.ts +48 -0
- package/src/components/chart/price-axis-labels.tsx +4 -4
- package/src/components/chart/rendering/chart-draw.ts +270 -0
- package/src/components/chart/rendering/geometry.ts +95 -0
- package/src/components/chart/rendering/pixel-buffer.ts +267 -0
- package/src/components/chart/scatter-chart-renderer.test.ts +31 -0
- package/src/components/chart/scatter-chart-renderer.ts +223 -0
- package/src/components/chart/static/bar-chart-surface.tsx +85 -0
- package/src/components/chart/static/chart/bitmap.ts +50 -0
- package/src/components/chart/static/chart/surface.test.tsx +51 -0
- package/src/components/chart/static/chart/surface.tsx +181 -0
- package/src/components/chart/static/multi-line-chart-surface.tsx +180 -0
- package/src/components/chart/static/scatter-chart-surface.tsx +83 -0
- package/src/components/chart/stock-chart/auto.ts +216 -0
- package/src/components/chart/stock-chart/axis-width.ts +146 -0
- package/src/components/chart/stock-chart/bitmaps.ts +22 -0
- package/src/components/chart/stock-chart/canvas.ts +202 -0
- package/src/components/chart/stock-chart/controls.tsx +149 -0
- package/src/components/chart/stock-chart/cursor.ts +60 -0
- package/src/components/chart/stock-chart/data-runtime.ts +129 -0
- package/src/components/chart/stock-chart/footer.ts +248 -0
- package/src/components/chart/stock-chart/geometry.ts +160 -0
- package/src/components/chart/stock-chart/index.test.ts +500 -0
- package/src/components/chart/stock-chart/index.tsx +29 -0
- package/src/components/chart/stock-chart/indicators.ts +226 -0
- package/src/components/chart/stock-chart/interaction-runtime.ts +44 -0
- package/src/components/chart/stock-chart/interactions.ts +300 -0
- package/src/components/chart/stock-chart/keyboard.ts +373 -0
- package/src/components/chart/stock-chart/layout-metrics.ts +62 -0
- package/src/components/chart/stock-chart/layout.tsx +177 -0
- package/src/components/chart/stock-chart/native-surfaces.ts +121 -0
- package/src/components/chart/stock-chart/presentation.ts +67 -0
- package/src/components/chart/stock-chart/renderer-switch.test.tsx +263 -0
- package/src/components/chart/stock-chart/rendering/bounds.ts +116 -0
- package/src/components/chart/stock-chart/rendering/candidates.ts +145 -0
- package/src/components/chart/stock-chart/rendering/data.ts +370 -0
- package/src/components/chart/stock-chart/rendering/invalidation.ts +68 -0
- package/src/components/chart/stock-chart/rendering/output.ts +304 -0
- package/src/components/chart/stock-chart/rendering/planning.ts +122 -0
- package/src/components/chart/stock-chart/rendering/projection.test.tsx +98 -0
- package/src/components/chart/stock-chart/rendering/projection.ts +112 -0
- package/src/components/chart/stock-chart/rendering/state.test.ts +70 -0
- package/src/components/chart/stock-chart/rendering/state.ts +283 -0
- package/src/components/chart/stock-chart/requests.ts +337 -0
- package/src/components/chart/stock-chart/resolution-support.ts +96 -0
- package/src/components/chart/stock-chart/resolved/runtime.ts +289 -0
- package/src/components/chart/stock-chart/resolved.tsx +345 -0
- package/src/components/chart/stock-chart/settings.ts +77 -0
- package/src/components/chart/stock-chart/surface-runtime.ts +62 -0
- package/src/components/chart/stock-chart/types.ts +25 -0
- package/src/components/chart/stock-chart/view.tsx +155 -0
- package/src/components/chart/stock-chart/viewport/effects.ts +296 -0
- package/src/components/chart/stock-chart/viewport/index.ts +144 -0
- package/src/components/chart/stock-chart/viewport/runtime.ts +375 -0
- package/src/components/chart/time-axis-label.tsx +4 -3
- package/src/components/command-bar/action-runtime.ts +326 -0
- package/src/components/command-bar/commands/collection.ts +214 -0
- package/src/components/command-bar/commands/direct/index.ts +266 -0
- package/src/components/command-bar/commands/direct/runtime.ts +168 -0
- package/src/components/command-bar/commands/plugin/actions.ts +171 -0
- package/src/components/command-bar/commands/plugin/items.ts +166 -0
- package/src/components/command-bar/commands/registry.ts +263 -0
- package/src/components/command-bar/helpers.test.ts +13 -21
- package/src/components/command-bar/helpers.ts +51 -272
- package/src/components/command-bar/keyboard-handlers.ts +306 -0
- package/src/components/command-bar/keyboard-shortcuts.ts +204 -0
- package/src/components/command-bar/layout-items/current-layout.ts +120 -0
- package/src/components/command-bar/layout-items/focused-pane.ts +143 -0
- package/src/components/command-bar/layout-items/types.ts +25 -0
- package/src/components/command-bar/layout-items/window-mode.ts +72 -0
- package/src/components/command-bar/layout-items.ts +93 -0
- package/src/components/command-bar/list/model.ts +81 -0
- package/src/components/command-bar/list/navigation.ts +125 -0
- package/src/components/command-bar/list/view.tsx +316 -0
- package/src/components/command-bar/multi-select-picker.tsx +219 -0
- package/src/components/command-bar/multi-select-runtime.ts +91 -0
- package/src/components/command-bar/pane-actions.ts +124 -0
- package/src/components/command-bar/pane-settings.ts +227 -0
- package/src/components/command-bar/pane-templates/items.ts +203 -0
- package/src/components/command-bar/pane-templates/workflow-route.ts +81 -0
- package/src/components/command-bar/pane-templates/workflow.ts +282 -0
- package/src/components/command-bar/panel/body.tsx +311 -0
- package/src/components/command-bar/panel/index.tsx +196 -0
- package/src/components/command-bar/panel/layout.ts +117 -0
- package/src/components/command-bar/panel/runtime.ts +280 -0
- package/src/components/command-bar/panel/state.ts +138 -0
- package/src/components/command-bar/panel/types.ts +78 -0
- package/src/components/command-bar/picker-activation.ts +126 -0
- package/src/components/command-bar/routes/root/command-items.ts +176 -0
- package/src/components/command-bar/routes/root/provider-search.ts +200 -0
- package/src/components/command-bar/routes/root/results.ts +233 -0
- package/src/components/command-bar/routes/root/runtime.ts +315 -0
- package/src/components/command-bar/routes/root/selection.ts +228 -0
- package/src/components/command-bar/routes/root/shortcut-feedback.ts +108 -0
- package/src/components/command-bar/routes/root/shortcut-items.ts +159 -0
- package/src/components/command-bar/routes/root/shortcuts.test.ts +151 -0
- package/src/components/command-bar/routes/root/shortcuts.ts +188 -0
- package/src/components/command-bar/routes/ticker-search/actions.ts +142 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +94 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +151 -0
- package/src/components/command-bar/routing/actions.ts +299 -0
- package/src/components/command-bar/routing/confirm.ts +91 -0
- package/src/components/command-bar/routing/effects.ts +82 -0
- package/src/components/command-bar/routing/launch-request.ts +59 -0
- package/src/components/command-bar/routing/list-state.ts +242 -0
- package/src/components/command-bar/routing/navigation-state.ts +147 -0
- package/src/components/command-bar/selection-runtime.ts +291 -0
- package/src/components/command-bar/surface/environment.ts +124 -0
- package/src/components/command-bar/surface/index.test.tsx +864 -0
- package/src/components/command-bar/surface/index.tsx +344 -0
- package/src/components/command-bar/surface/pane.test.tsx +703 -0
- package/src/components/command-bar/surface/portfolio.test.tsx +452 -0
- package/src/components/command-bar/surface/test-harness.tsx +403 -0
- package/src/components/command-bar/theme-preview.ts +84 -0
- package/src/components/command-bar/view-model.test.ts +3 -3
- package/src/components/command-bar/view-model.ts +7 -6
- package/src/components/command-bar/workflow/alert.ts +164 -0
- package/src/components/command-bar/workflow/body.tsx +179 -0
- package/src/components/command-bar/workflow/broker.ts +158 -0
- package/src/components/command-bar/workflow/builtin.ts +134 -0
- package/src/components/command-bar/workflow/collection-actions.ts +257 -0
- package/src/components/command-bar/workflow/coordinator.ts +193 -0
- package/src/components/command-bar/workflow/field-row.tsx +214 -0
- package/src/components/command-bar/workflow/fields.ts +230 -0
- package/src/components/command-bar/workflow/ops.test.ts +197 -0
- package/src/components/command-bar/workflow/ops.ts +268 -0
- package/src/components/command-bar/workflow/route-actions.ts +232 -0
- package/src/components/command-bar/workflow/route-builder.ts +56 -0
- package/src/components/command-bar/workflow/runtime.ts +234 -0
- package/src/components/command-bar/workflow/submit.ts +213 -0
- package/src/components/command-bar/workflow/tickers.ts +214 -0
- package/src/components/command-bar/workflow/types.ts +127 -0
- package/src/components/data-table/stack-view.test.tsx +218 -0
- package/src/components/data-table/stack-view.tsx +59 -0
- package/src/components/data-table/view.test.tsx +254 -0
- package/src/components/data-table/view.tsx +306 -0
- package/src/components/feed-data-table/stack-view.test.tsx +148 -0
- package/src/components/feed-data-table/stack-view.tsx +359 -0
- package/src/components/index.ts +14 -14
- package/src/components/input-search-bar.tsx +94 -0
- package/src/components/layout/detached-pane-shell.tsx +22 -16
- package/src/components/layout/floating-pane.tsx +19 -24
- package/src/components/layout/header.tsx +9 -21
- package/src/components/layout/pane/content.test.tsx +64 -0
- package/src/components/layout/pane/content.tsx +44 -0
- package/src/components/layout/pane/cycle-order.test.ts +30 -0
- package/src/components/layout/pane/cycle-order.ts +32 -0
- package/src/components/layout/pane/footer/index.test.tsx +131 -0
- package/src/components/layout/pane/footer/index.tsx +246 -0
- package/src/components/layout/pane/footer/model.ts +99 -0
- package/src/components/layout/pane/footer/registration.tsx +114 -0
- package/src/components/layout/pane/frame.tsx +55 -0
- package/src/components/layout/pane/header.test.tsx +39 -0
- package/src/components/layout/pane/header.tsx +252 -0
- package/src/components/layout/pane/index.tsx +105 -0
- package/src/components/layout/pane/keyboard-scroll.test.tsx +146 -0
- package/src/components/layout/pane/sizing.ts +66 -0
- package/src/components/layout/pane/title.ts +38 -0
- package/src/components/layout/shell/action-menu-overlay.tsx +72 -0
- package/src/components/layout/shell/active-drag.ts +221 -0
- package/src/components/layout/shell/chrome.ts +8 -0
- package/src/components/layout/shell/drag/index.ts +432 -0
- package/src/components/layout/shell/drag/overlays.tsx +78 -0
- package/src/components/layout/shell/drag/runtime.ts +264 -0
- package/src/components/layout/shell/index.test.tsx +788 -0
- package/src/components/layout/shell/index.tsx +451 -0
- package/src/components/layout/shell/layout-state.ts +97 -0
- package/src/components/layout/shell/menu.ts +152 -0
- package/src/components/layout/shell/native/pointer-runtime.ts +184 -0
- package/src/components/layout/shell/native/surfaces.ts +127 -0
- package/src/components/layout/shell/native/window-state.ts +208 -0
- package/src/components/layout/shell/pane/actions.ts +129 -0
- package/src/components/layout/shell/pane/layers.tsx +234 -0
- package/src/components/layout/shell/pane/management-shortcuts.ts +114 -0
- package/src/components/layout/shell/shortcuts.ts +47 -0
- package/src/components/layout/shell/terminal-pointer-runtime.ts +326 -0
- package/src/components/layout/shell/window-mode/index.ts +253 -0
- package/src/components/layout/shell/window-mode/overlays.tsx +208 -0
- package/src/components/layout/status-bar.test.tsx +1 -101
- package/src/components/layout/status-bar.tsx +1 -1
- package/src/components/layout/window-edit/mode.test.ts +55 -0
- package/src/components/layout/window-edit/mode.ts +422 -0
- package/src/components/layout/window-edit/presentation.ts +123 -0
- package/src/components/layout/window-edit/status.tsx +101 -0
- package/src/components/markdown-text.tsx +3 -3
- package/src/components/onboarding/onboarding-steps.tsx +248 -0
- package/src/components/onboarding/onboarding-wizard.tsx +97 -1035
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +144 -0
- package/src/components/onboarding/portfolio-step/broker-setup-panel.tsx +97 -0
- package/src/components/onboarding/portfolio-step/broker-sync-panel.tsx +42 -0
- package/src/components/onboarding/portfolio-step/choose-panel.tsx +42 -0
- package/src/components/onboarding/portfolio-step/index.tsx +70 -0
- package/src/components/onboarding/portfolio-step/manual-name-panel.tsx +62 -0
- package/src/components/onboarding/portfolio-step/types.ts +25 -0
- package/src/components/onboarding/portfolio-step/utils.ts +15 -0
- package/src/components/onboarding/wizard-broker-sync.ts +230 -0
- package/src/components/onboarding/wizard-keyboard.ts +264 -0
- package/src/components/onboarding/wizard-model.ts +21 -0
- package/src/components/pane-settings-dialog/desktop.tsx +315 -0
- package/src/components/pane-settings-dialog/field-dialogs.tsx +213 -0
- package/src/components/pane-settings-dialog/tui.tsx +73 -0
- package/src/components/pane-settings-dialog/value.ts +36 -0
- package/src/components/pane-settings-dialog.tsx +18 -622
- package/src/components/pane-template-wizard.tsx +1 -1
- package/src/components/price-selector-dialog.tsx +2 -2
- package/src/components/price-sparkline/bitmap.ts +150 -0
- package/src/components/price-sparkline/index.ts +46 -0
- package/src/components/price-sparkline/model.ts +119 -0
- package/src/components/price-sparkline/view.tsx +214 -0
- package/src/components/quote-flash.ts +103 -0
- package/src/components/speedometer-gauge/desktop.tsx +151 -0
- package/src/components/speedometer-gauge/index.tsx +44 -0
- package/src/components/speedometer-gauge/model.ts +60 -0
- package/src/components/speedometer-gauge/terminal.tsx +261 -0
- package/src/components/ticker/badge/format.ts +42 -0
- package/src/components/ticker/badge/index.tsx +100 -0
- package/src/components/ticker/badge/list.tsx +57 -0
- package/src/components/ticker/badge/text.test.tsx +223 -0
- package/src/components/ticker/badge/text.tsx +156 -0
- package/src/components/ticker/list-table-view.tsx +297 -0
- package/src/components/ticker/list-table.test.tsx +177 -0
- package/src/components/toggle-list.tsx +1 -1
- package/src/components/ui/data-table/index.tsx +26 -0
- package/src/components/ui/data-table/opentui/index.tsx +467 -0
- package/src/components/ui/data-table/opentui/model.test.ts +47 -0
- package/src/components/ui/data-table/opentui/model.ts +66 -0
- package/src/components/ui/data-table/types.ts +81 -0
- package/src/components/ui/index.ts +1 -3
- package/src/components/ui/multi-select/dialog.tsx +336 -0
- package/src/components/ui/native-select.tsx +1 -1
- package/src/components/ui/shortcut-hint.tsx +1 -1
- package/src/components/ui/tabs.tsx +11 -5
- package/src/components/ui/toggle.tsx +1 -1
- package/src/components/ui/ui.test.tsx +3 -75
- package/src/components/use-external-link-footer.ts +1 -1
- package/src/core/app-services.ts +3 -0
- package/src/core/state/app/layout-reducer.ts +196 -0
- package/src/core/state/app/layout.ts +406 -0
- package/src/core/state/app/state.ts +340 -0
- package/src/core/state/app/types.ts +116 -0
- package/src/core/state/session-persistence.ts +1 -1
- package/src/data/app-persistence.ts +1 -1
- package/src/data/config/layout.ts +227 -0
- package/src/data/config/store/index.test.ts +500 -0
- package/src/data/config/store/index.ts +64 -0
- package/src/data/config/store/node.ts +101 -0
- package/src/data/config/store/normalize.ts +403 -0
- package/src/data/plugin-state-store.ts +3 -3
- package/src/data/resource-store.ts +3 -3
- package/src/data/session-store.ts +3 -3
- package/src/data/sqlite/cache.test.ts +151 -0
- package/src/data/sqlite/database.ts +68 -0
- package/src/data/sqlite/json.ts +16 -0
- package/src/data/sqlite/retry.test.ts +63 -0
- package/src/data/ticker-repository.ts +1 -1
- package/src/data/ticker-store.ts +2 -2
- package/src/market-data/coordinator/auxiliary.ts +252 -0
- package/src/market-data/coordinator/chart.ts +141 -0
- package/src/market-data/coordinator/entries.ts +129 -0
- package/src/market-data/coordinator/events.ts +74 -0
- package/src/market-data/coordinator/financials.ts +281 -0
- package/src/market-data/coordinator/index.test.ts +840 -0
- package/src/market-data/coordinator/index.ts +388 -0
- package/src/market-data/coordinator/quotes.ts +329 -0
- package/src/market-data/coordinator/subscriptions.test.ts +209 -0
- package/src/market-data/hooks.test.tsx +42 -1
- package/src/market-data/hooks.tsx +83 -18
- package/src/market-data/market/format.test.ts +109 -0
- package/src/market-data/market/format.ts +293 -0
- package/src/market-data/market/freshness.ts +140 -0
- package/src/market-data/market/status.ts +112 -0
- package/src/market-data/quotes/contributions.ts +194 -0
- package/src/market-data/quotes/freshness.test.ts +150 -0
- package/src/market-data/quotes/freshness.ts +36 -0
- package/src/market-data/quotes/resolution.test.ts +277 -0
- package/src/market-data/quotes/resolution.ts +468 -0
- package/src/market-data/quotes/time.test.ts +34 -0
- package/src/market-data/quotes/time.ts +59 -0
- package/src/market-data/request-types.ts +10 -3
- package/src/market-data/result-types.ts +3 -3
- package/src/market-data/selectors.ts +2 -2
- package/src/news/aggregator.ts +29 -219
- package/src/news/news-model.ts +208 -0
- package/src/news/ticker-symbols.ts +1 -1
- package/src/news/types.ts +3 -3
- package/src/plugins/builtin/account-management/footer.ts +39 -0
- package/src/plugins/builtin/account-management/form-components.tsx +162 -0
- package/src/plugins/builtin/account-management/keyboard.ts +90 -0
- package/src/plugins/builtin/account-management/model.ts +97 -0
- package/src/plugins/builtin/account-management/pane.tsx +389 -0
- package/src/plugins/builtin/account-management/password-dialog.tsx +125 -0
- package/src/plugins/builtin/ai/ask-ai-detail-tab.tsx +6 -6
- package/src/plugins/builtin/ai/ask-ai.test.tsx +305 -0
- package/src/plugins/builtin/ai/index.tsx +4 -4
- package/src/plugins/builtin/ai/providers.ts +1 -1
- package/src/plugins/builtin/ai/runner.ts +1 -0
- package/src/plugins/builtin/ai/screener/action-bar.tsx +58 -0
- package/src/plugins/builtin/ai/screener/contract.test.ts +117 -0
- package/src/plugins/builtin/ai/screener/contract.ts +174 -0
- package/src/plugins/builtin/ai/screener/editor-runtime.ts +110 -0
- package/src/plugins/builtin/ai/screener/editor.tsx +125 -0
- package/src/plugins/builtin/ai/screener/footer.ts +93 -0
- package/src/plugins/builtin/ai/screener/keyboard.ts +90 -0
- package/src/plugins/builtin/ai/screener/market-runtime.ts +99 -0
- package/src/plugins/builtin/ai/screener/model.ts +107 -0
- package/src/plugins/builtin/ai/screener/pane.test.tsx +348 -0
- package/src/plugins/builtin/ai/screener/pane.tsx +412 -0
- package/src/plugins/builtin/ai/screener/results-view.tsx +169 -0
- package/src/plugins/builtin/ai/screener/results.ts +139 -0
- package/src/plugins/builtin/ai/screener/runner.ts +144 -0
- package/src/plugins/builtin/ai/screener/tabs-bar.tsx +65 -0
- package/src/plugins/builtin/ai/settings.ts +3 -3
- package/src/plugins/builtin/ai/ticker-context.ts +1 -1
- package/src/plugins/builtin/alerts/command.ts +86 -0
- package/src/plugins/builtin/alerts/constants.ts +3 -0
- package/src/plugins/builtin/alerts/format.ts +68 -0
- package/src/plugins/builtin/alerts/index.test.tsx +5 -4
- package/src/plugins/builtin/alerts/index.tsx +18 -473
- package/src/plugins/builtin/alerts/pane.tsx +304 -0
- package/src/plugins/builtin/alerts/quotes.ts +57 -0
- package/src/plugins/builtin/alerts/storage.ts +20 -0
- package/src/plugins/builtin/analytics/broker-performance.ts +142 -0
- package/src/plugins/builtin/analytics/display.ts +44 -0
- package/src/plugins/builtin/analytics/index.test.tsx +144 -5
- package/src/plugins/builtin/analytics/index.tsx +108 -468
- package/src/plugins/builtin/analytics/metrics.ts +1 -1
- package/src/plugins/builtin/analytics/pane-model.ts +297 -0
- package/src/plugins/builtin/analytics/portfolio-selection.ts +10 -0
- package/src/plugins/builtin/analytics/sector-model.ts +172 -0
- package/src/plugins/builtin/analytics/view.tsx +207 -0
- package/src/plugins/builtin/broker-manager/detail.tsx +232 -0
- package/src/plugins/builtin/broker-manager/footer.ts +62 -0
- package/src/plugins/builtin/broker-manager/index.test.tsx +3 -3
- package/src/plugins/builtin/broker-manager/index.tsx +125 -527
- package/src/plugins/builtin/broker-manager/keyboard.ts +104 -0
- package/src/plugins/builtin/broker-manager/model.test.ts +39 -1
- package/src/plugins/builtin/broker-manager/model.ts +14 -8
- package/src/plugins/builtin/broker-manager/pane-actions.tsx +181 -0
- package/src/plugins/builtin/broker-manager/table.ts +86 -0
- package/src/plugins/builtin/buildout/cells.tsx +203 -0
- package/src/plugins/builtin/buildout/data-runtime.ts +238 -0
- package/src/plugins/builtin/buildout/detail/company.tsx +219 -0
- package/src/plugins/builtin/buildout/detail/index.tsx +105 -0
- package/src/plugins/builtin/buildout/detail/intel.tsx +61 -0
- package/src/plugins/builtin/buildout/detail/satellite-images.tsx +80 -0
- package/src/plugins/builtin/buildout/detail/site.tsx +142 -0
- package/src/plugins/builtin/buildout/detail/ui.tsx +355 -0
- package/src/plugins/builtin/buildout/detail/values.ts +67 -0
- package/src/plugins/builtin/buildout/format.ts +163 -0
- package/src/plugins/builtin/buildout/model/index.ts +135 -0
- package/src/plugins/builtin/buildout/model/normalizers.ts +396 -0
- package/src/plugins/builtin/buildout/model/types.ts +318 -0
- package/src/plugins/builtin/buildout/pane/header.tsx +55 -0
- package/src/plugins/builtin/buildout/pane/index.tsx +405 -0
- package/src/plugins/builtin/buildout/pane/status.tsx +84 -0
- package/src/plugins/builtin/buildout/table-model.ts +367 -0
- package/src/plugins/builtin/changelog/index.tsx +370 -0
- package/src/plugins/builtin/chat/channels.ts +157 -0
- package/src/plugins/builtin/chat/chat.test.tsx +1048 -0
- package/src/plugins/builtin/chat/composer-commands.test.ts +30 -0
- package/src/plugins/builtin/chat/composer-commands.ts +34 -0
- package/src/plugins/builtin/chat/content/channel-navigation.ts +157 -0
- package/src/plugins/builtin/chat/content/composer-runtime.ts +251 -0
- package/src/plugins/builtin/chat/content/composer.tsx +148 -0
- package/src/plugins/builtin/chat/content/index.tsx +407 -0
- package/src/plugins/builtin/chat/content/layout-metrics.ts +72 -0
- package/src/plugins/builtin/chat/content/scroll.ts +278 -0
- package/src/plugins/builtin/chat/content/selection-runtime.ts +66 -0
- package/src/plugins/builtin/chat/content/shortcuts.ts +212 -0
- package/src/plugins/builtin/chat/content/snapshot.ts +154 -0
- package/src/plugins/builtin/chat/content/transcript.tsx +155 -0
- package/src/plugins/builtin/chat/content/types.ts +26 -0
- package/src/plugins/builtin/chat/content/user-map.ts +21 -0
- package/src/plugins/builtin/chat/controller/channel-actions.ts +87 -0
- package/src/plugins/builtin/chat/controller/channels.ts +159 -0
- package/src/plugins/builtin/chat/controller/connections.ts +90 -0
- package/src/plugins/builtin/chat/controller/draft-sync.ts +41 -0
- package/src/plugins/builtin/chat/controller/fetch.ts +83 -0
- package/src/plugins/builtin/chat/controller/index.ts +488 -0
- package/src/plugins/builtin/chat/controller/lifecycle.ts +141 -0
- package/src/plugins/builtin/chat/controller/message-loading.ts +97 -0
- package/src/plugins/builtin/chat/controller/messages.ts +173 -0
- package/src/plugins/builtin/chat/controller/notifications.ts +56 -0
- package/src/plugins/builtin/chat/controller/persistence.ts +166 -0
- package/src/plugins/builtin/chat/controller/realtime.ts +91 -0
- package/src/plugins/builtin/chat/controller/send.ts +89 -0
- package/src/plugins/builtin/chat/controller/session-runtime.ts +156 -0
- package/src/plugins/builtin/chat/controller/session.ts +39 -0
- package/src/plugins/builtin/chat/controller/state.ts +162 -0
- package/src/plugins/builtin/chat/controller/storage.ts +136 -0
- package/src/plugins/builtin/chat/controller/utils.ts +75 -0
- package/src/plugins/builtin/chat/controller/view.ts +96 -0
- package/src/plugins/builtin/chat/controller.test.ts +1302 -0
- package/src/plugins/builtin/chat/index.tsx +4 -0
- package/src/plugins/builtin/chat/layout.ts +330 -0
- package/src/plugins/builtin/chat/message/action-chip.tsx +38 -0
- package/src/plugins/builtin/chat/message/desktop.tsx +158 -0
- package/src/plugins/builtin/chat/message/inline-tokens.tsx +118 -0
- package/src/plugins/builtin/chat/message/profile-popover.tsx +72 -0
- package/src/plugins/builtin/chat/message/render-state.ts +67 -0
- package/src/plugins/builtin/chat/message/terminal.tsx +132 -0
- package/src/plugins/builtin/chat/message/types.ts +18 -0
- package/src/plugins/builtin/chat/pane.tsx +100 -0
- package/src/plugins/builtin/chat/profile-popover.ts +49 -0
- package/src/plugins/builtin/chat/sidebar.test.tsx +455 -0
- package/src/plugins/builtin/chat/sidebar.tsx +296 -0
- package/src/plugins/builtin/chat/status-widget.tsx +103 -0
- package/src/plugins/builtin/chat/test-harness.tsx +212 -0
- package/src/plugins/builtin/cloud/auth-actions.tsx +72 -0
- package/src/plugins/builtin/cloud/auth-commands.ts +115 -0
- package/src/plugins/builtin/cloud/index.tsx +11 -0
- package/src/plugins/builtin/cloud/plugin.tsx +185 -0
- package/src/plugins/builtin/cloud-tweets/footer.ts +40 -0
- package/src/plugins/builtin/cloud-tweets/index.ts +1 -0
- package/src/plugins/builtin/cloud-tweets/keyboard.ts +65 -0
- package/src/plugins/builtin/cloud-tweets/model.ts +257 -0
- package/src/plugins/builtin/cloud-tweets/pane.tsx +318 -0
- package/src/plugins/builtin/cloud-tweets/registration.ts +87 -0
- package/src/plugins/builtin/cloud-tweets/search-bar.tsx +49 -0
- package/src/plugins/builtin/cloud-tweets/table.tsx +331 -0
- package/src/plugins/builtin/comparison-chart/index.test.tsx +645 -0
- package/src/plugins/builtin/comparison-chart/index.tsx +194 -0
- package/src/plugins/builtin/congress-trades/detail.tsx +154 -0
- package/src/plugins/builtin/congress-trades/footer.ts +67 -0
- package/src/plugins/builtin/congress-trades/keyboard.ts +112 -0
- package/src/plugins/builtin/congress-trades/model.ts +224 -0
- package/src/plugins/builtin/congress-trades/pane.tsx +331 -0
- package/src/plugins/builtin/congress-trades/table.tsx +84 -0
- package/src/plugins/builtin/correlation/compute.ts +0 -7
- package/src/plugins/builtin/correlation/index.test.tsx +5 -5
- package/src/plugins/builtin/correlation/index.tsx +36 -208
- package/src/plugins/builtin/correlation/matrix/model.ts +155 -0
- package/src/plugins/builtin/correlation/matrix/symbol-cell.tsx +56 -0
- package/src/plugins/builtin/correlation/relationship/controls.tsx +53 -0
- package/src/plugins/builtin/correlation/relationship/history.ts +72 -0
- package/src/plugins/builtin/correlation/relationship/model.ts +279 -0
- package/src/plugins/builtin/correlation/relationship/pane.tsx +359 -0
- package/src/plugins/builtin/correlation/relationship/view-model.ts +120 -0
- package/src/plugins/builtin/correlation/settings.ts +6 -6
- package/src/plugins/builtin/debug/index.tsx +365 -0
- package/src/plugins/builtin/earnings/data/cache.test.ts +94 -0
- package/src/plugins/builtin/earnings/data/cache.ts +145 -0
- package/src/plugins/builtin/earnings/data/data.test.ts +90 -0
- package/src/plugins/builtin/earnings/data/data.ts +115 -0
- package/src/plugins/builtin/earnings/index.test.ts +12 -0
- package/src/plugins/builtin/earnings/index.tsx +74 -266
- package/src/plugins/builtin/earnings/model.ts +82 -0
- package/src/plugins/builtin/earnings/table.ts +206 -0
- package/src/plugins/builtin/econ/calendar-model.test.ts +48 -0
- package/src/plugins/builtin/econ/calendar-model.ts +217 -0
- package/src/plugins/builtin/econ/calendar-source.ts +1 -1
- package/src/plugins/builtin/econ/detail-view.tsx +319 -0
- package/src/plugins/builtin/econ/fred-cache.test.ts +58 -0
- package/src/plugins/builtin/econ/fred-cache.ts +106 -0
- package/src/plugins/builtin/econ/fred-series-map.ts +0 -4
- package/src/plugins/builtin/econ/index.tsx +46 -474
- package/src/plugins/builtin/fear-greed/cache.test.ts +75 -0
- package/src/plugins/builtin/fear-greed/cache.ts +142 -0
- package/src/plugins/builtin/fear-greed/charts.tsx +305 -0
- package/src/plugins/builtin/fear-greed/data.test.ts +72 -0
- package/src/plugins/builtin/fear-greed/data.ts +370 -0
- package/src/plugins/builtin/fear-greed/format.ts +96 -0
- package/src/plugins/builtin/fear-greed/index.tsx +13 -555
- package/src/plugins/builtin/fear-greed/pane.tsx +169 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +1 -1
- package/src/plugins/builtin/fx-matrix/pairs.ts +0 -22
- package/src/plugins/builtin/help/components.tsx +92 -0
- package/src/plugins/builtin/help/index.test.tsx +167 -0
- package/src/plugins/builtin/help/index.tsx +256 -0
- package/src/plugins/builtin/help/shortcut-model.ts +145 -0
- package/src/plugins/builtin/holders/format.ts +44 -0
- package/src/plugins/builtin/holders/index.test.ts +2 -76
- package/src/plugins/builtin/holders/index.tsx +3 -959
- package/src/plugins/builtin/holders/pane.tsx +331 -0
- package/src/plugins/builtin/holders/table-model.ts +84 -0
- package/src/plugins/builtin/holders/thirteenf-match.ts +76 -0
- package/src/plugins/builtin/holders/treemap-layout.ts +231 -0
- package/src/plugins/builtin/holders/treemap.tsx +318 -0
- package/src/plugins/builtin/holders/types.ts +51 -0
- package/src/plugins/builtin/insider/index.tsx +5 -5
- package/src/plugins/builtin/layout-manager/index.tsx +247 -0
- package/src/plugins/builtin/market-movers/index.tsx +44 -282
- package/src/plugins/builtin/market-movers/model.ts +146 -0
- package/src/plugins/builtin/market-movers/screener.test.ts +31 -1
- package/src/plugins/builtin/market-movers/screener.ts +106 -12
- package/src/plugins/builtin/market-movers/table.ts +95 -0
- package/src/plugins/builtin/news/index.tsx +194 -0
- package/src/plugins/builtin/news/wire/breaking/notifications.test.ts +98 -0
- package/src/plugins/builtin/news/wire/breaking/notifications.ts +110 -0
- package/src/plugins/builtin/news/wire/breaking/pane.test.tsx +156 -0
- package/src/plugins/builtin/news/wire/breaking/pane.tsx +68 -0
- package/src/plugins/builtin/news/wire/categories.ts +114 -0
- package/src/plugins/builtin/news/wire/default-feeds.ts +3 -0
- package/src/plugins/builtin/news/wire/feed-config.test.ts +90 -0
- package/src/plugins/builtin/news/wire/feed-config.ts +216 -0
- package/src/plugins/builtin/news/wire/index.tsx +129 -0
- package/src/plugins/builtin/news/wire/industry-pane.tsx +126 -0
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +306 -0
- package/src/plugins/builtin/news/wire/news/footer.ts +77 -0
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +98 -0
- package/src/plugins/builtin/news/wire/news/query-presets.ts +40 -0
- package/src/plugins/builtin/news/wire/news/table.test.tsx +157 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +270 -0
- package/src/plugins/builtin/news/wire/persisted-articles.ts +98 -0
- package/src/plugins/builtin/news/wire/read-state.ts +76 -0
- package/src/plugins/builtin/news/wire/rss/parser.test.ts +116 -0
- package/src/plugins/builtin/news/wire/rss/parser.ts +213 -0
- package/src/plugins/builtin/news/wire/rss/source.test.ts +104 -0
- package/src/plugins/builtin/news/wire/rss/source.ts +181 -0
- package/src/plugins/builtin/notes/index.tsx +49 -0
- package/src/plugins/builtin/notes/markdown-note-preview.tsx +39 -0
- package/src/plugins/builtin/notes/model.ts +36 -0
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +334 -0
- package/src/plugins/builtin/notes/text-state.ts +11 -0
- package/src/plugins/builtin/notes/ticker-notes-tab.tsx +112 -0
- package/src/plugins/builtin/options/index.tsx +44 -0
- package/src/plugins/builtin/options/table.ts +209 -0
- package/src/plugins/builtin/options/types.ts +33 -0
- package/src/plugins/builtin/options/view.test.tsx +185 -0
- package/src/plugins/builtin/options/view.tsx +264 -0
- package/src/plugins/builtin/plugin-groups.ts +25 -5
- package/src/plugins/builtin/portfolio-list/account-metrics.test.ts +50 -0
- package/src/plugins/builtin/portfolio-list/account-metrics.ts +46 -0
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +224 -0
- package/src/plugins/builtin/portfolio-list/cli/render.ts +203 -0
- package/src/plugins/builtin/portfolio-list/cli/shared.ts +21 -0
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +224 -0
- package/src/plugins/builtin/portfolio-list/column-values.ts +284 -0
- package/src/plugins/builtin/portfolio-list/command-bar.ts +1 -1
- package/src/plugins/builtin/portfolio-list/header.tsx +7 -98
- package/src/plugins/builtin/portfolio-list/index.test.ts +133 -0
- package/src/plugins/builtin/portfolio-list/index.tsx +2 -1
- package/src/plugins/builtin/portfolio-list/metrics.test.ts +242 -0
- package/src/plugins/builtin/portfolio-list/metrics.ts +5 -462
- package/src/plugins/builtin/portfolio-list/pane/data.ts +171 -0
- package/src/plugins/builtin/portfolio-list/pane/index.test.tsx +1267 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +385 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +159 -0
- package/src/plugins/builtin/portfolio-list/position-metrics.ts +123 -0
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +326 -0
- package/src/plugins/builtin/portfolio-list/quick-add/resolution.ts +135 -0
- package/src/plugins/builtin/portfolio-list/settings.ts +5 -3
- package/src/plugins/builtin/portfolio-list/summary/index.test.ts +126 -0
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +392 -0
- package/src/plugins/builtin/portfolio-list/summary/totals.ts +86 -0
- package/src/plugins/builtin/portfolio-list/table.tsx +1 -1
- package/src/plugins/builtin/portfolio-list/use-throttled-cursor-symbol.ts +1 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +383 -0
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +413 -0
- package/src/plugins/builtin/research/index.test.ts +248 -2
- package/src/plugins/builtin/research/index.tsx +30 -760
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +189 -0
- package/src/plugins/builtin/sec/filing-display.tsx +84 -0
- package/src/plugins/builtin/sec/index.tsx +342 -0
- package/src/plugins/builtin/sectors/index.tsx +27 -234
- package/src/plugins/builtin/sectors/sector-data.ts +0 -2
- package/src/plugins/builtin/sectors/sector-model.ts +221 -0
- package/src/plugins/builtin/shared/table-pane.ts +31 -0
- package/src/plugins/builtin/shared/ticker-request.ts +70 -0
- package/src/plugins/builtin/shared/ticker-surface.test.ts +57 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +113 -0
- package/src/plugins/builtin/thirteenf/api.test.ts +58 -0
- package/src/plugins/builtin/thirteenf/api.ts +375 -0
- package/src/plugins/builtin/thirteenf/data.test.ts +95 -0
- package/src/plugins/builtin/thirteenf/data.ts +210 -0
- package/src/plugins/builtin/thirteenf/format.ts +55 -0
- package/src/plugins/builtin/thirteenf/index.tsx +80 -0
- package/src/plugins/builtin/thirteenf/model.test.ts +156 -0
- package/src/plugins/builtin/thirteenf/model.ts +618 -0
- package/src/plugins/builtin/thirteenf/pane.test.tsx +328 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +826 -0
- package/src/plugins/builtin/thirteenf/table.ts +212 -0
- package/src/plugins/builtin/thirteenf/types.ts +187 -0
- package/src/plugins/builtin/ticker-detail/chart-pane.tsx +91 -0
- package/src/plugins/builtin/ticker-detail/chart-tab-switch.test.tsx +282 -0
- package/src/plugins/builtin/ticker-detail/chart-tab.tsx +3 -5
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/content.tsx +158 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/data.ts +62 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/model.ts +234 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/settings.ts +44 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph/types.ts +51 -0
- package/src/plugins/builtin/ticker-detail/data-panes/fundamental-graph.tsx +135 -0
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +192 -0
- package/src/plugins/builtin/ticker-detail/data-panes/provider-search.tsx +172 -0
- package/src/plugins/builtin/ticker-detail/data-panes.test.ts +110 -0
- package/src/plugins/builtin/ticker-detail/financials/aggregation.ts +203 -0
- package/src/plugins/builtin/ticker-detail/financials/model.test.ts +84 -0
- package/src/plugins/builtin/ticker-detail/financials/model.ts +364 -0
- package/src/plugins/builtin/ticker-detail/financials/pane.tsx +27 -0
- package/src/plugins/builtin/ticker-detail/financials/schema.ts +392 -0
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +438 -0
- package/src/plugins/builtin/ticker-detail/index.test.tsx +780 -0
- package/src/plugins/builtin/ticker-detail/index.tsx +174 -17
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +240 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +168 -0
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -0
- package/src/plugins/builtin/ticker-detail/overview/types.ts +17 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +27 -392
- package/src/plugins/builtin/ticker-detail/pane.tsx +24 -136
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +330 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.test.tsx +292 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +180 -0
- package/src/plugins/builtin/ticker-detail/settings.ts +39 -33
- package/src/plugins/builtin/world-indices/footer.ts +28 -0
- package/src/plugins/builtin/world-indices/index.tsx +25 -218
- package/src/plugins/builtin/world-indices/model.ts +120 -0
- package/src/plugins/builtin/world-indices/table.tsx +96 -0
- package/src/plugins/builtin/yahoo/index.ts +72 -0
- package/src/plugins/builtin/yield-curve/index.tsx +5 -5
- package/src/plugins/builtin/yield-curve/treasury-data.ts +1 -1
- package/src/plugins/catalog-ui.ts +7 -9
- package/src/plugins/catalog.ts +1 -1
- package/src/plugins/ibkr/account-cache.ts +2 -10
- package/src/plugins/ibkr/broker-adapter.ts +10 -4
- package/src/plugins/ibkr/config.ts +5 -24
- package/src/plugins/ibkr/dialogs.tsx +0 -1
- package/src/plugins/ibkr/flex/index.test.ts +236 -0
- package/src/plugins/ibkr/flex/index.ts +337 -0
- package/src/plugins/ibkr/flex/statement-client.ts +181 -0
- package/src/plugins/ibkr/gateway/account-loaders.ts +266 -0
- package/src/plugins/ibkr/gateway/account-summary.ts +163 -0
- package/src/plugins/ibkr/gateway/client-lock.ts +154 -0
- package/src/plugins/ibkr/gateway/connection-events.ts +114 -0
- package/src/plugins/ibkr/gateway/connection.ts +152 -0
- package/src/plugins/ibkr/gateway/contracts.ts +132 -0
- package/src/plugins/ibkr/gateway/fundamentals.ts +83 -0
- package/src/plugins/ibkr/gateway/helpers.ts +33 -0
- package/src/plugins/ibkr/gateway/history-requests.ts +158 -0
- package/src/plugins/ibkr/gateway/history.ts +120 -0
- package/src/plugins/ibkr/gateway/instrument-lookup.ts +117 -0
- package/src/plugins/ibkr/gateway/market-data.ts +338 -0
- package/src/plugins/ibkr/gateway/order-execution.ts +218 -0
- package/src/plugins/ibkr/gateway/orders.ts +63 -0
- package/src/plugins/ibkr/gateway/price-normalization.test.ts +44 -0
- package/src/plugins/ibkr/gateway/price-normalization.ts +50 -0
- package/src/plugins/ibkr/gateway/quote-stream-controller.ts +203 -0
- package/src/plugins/ibkr/gateway/quote-stream.ts +171 -0
- package/src/plugins/ibkr/gateway/selection.ts +51 -0
- package/src/plugins/ibkr/gateway/service/index.test.ts +614 -0
- package/src/plugins/ibkr/gateway/service/index.ts +432 -0
- package/src/plugins/ibkr/gateway/service/lifecycle.ts +191 -0
- package/src/plugins/ibkr/gateway/service/manager.ts +52 -0
- package/src/plugins/ibkr/gateway/service/market-data.ts +48 -0
- package/src/plugins/ibkr/gateway/service/native.ts +543 -0
- package/src/plugins/ibkr/gateway/timeouts.ts +13 -0
- package/src/plugins/ibkr/gateway/types.ts +27 -0
- package/src/plugins/ibkr/hash.ts +8 -0
- package/src/plugins/ibkr/index.test.tsx +1 -12
- package/src/plugins/ibkr/index.tsx +8 -9
- package/src/plugins/ibkr/instance-selection.test.ts +2 -2
- package/src/plugins/ibkr/instance-selection.ts +1 -1
- package/src/plugins/ibkr/portfolio-performance.test.ts +32 -0
- package/src/plugins/ibkr/portfolio-performance.ts +129 -0
- package/src/plugins/ibkr/trade/badge.tsx +28 -0
- package/src/plugins/ibkr/trade/dialogs.tsx +44 -0
- package/src/plugins/ibkr/trade/preview-panel.tsx +130 -0
- package/src/plugins/ibkr/trade/tab/actions.tsx +443 -0
- package/src/plugins/ibkr/trade/tab/field-editors.tsx +79 -0
- package/src/plugins/ibkr/trade/tab/footer.ts +67 -0
- package/src/plugins/ibkr/trade/tab/header.tsx +167 -0
- package/src/plugins/ibkr/trade/tab/index.test.tsx +178 -0
- package/src/plugins/ibkr/trade/tab/index.tsx +302 -0
- package/src/plugins/ibkr/trade/tab/model.ts +159 -0
- package/src/plugins/ibkr/trade/tab/order-request.ts +64 -0
- package/src/plugins/ibkr/trade/tab/shortcuts.ts +89 -0
- package/src/plugins/ibkr/trade/tab/state-sync.ts +86 -0
- package/src/plugins/ibkr/trade/ticket-panel.tsx +301 -0
- package/src/plugins/ibkr/trade/utils.test.ts +175 -0
- package/src/plugins/ibkr/trade/utils.ts +150 -0
- package/src/plugins/ibkr/trading/pane-view.tsx +175 -0
- package/src/plugins/ibkr/trading/pane.tsx +332 -0
- package/src/plugins/ibkr/trading/state.test.ts +109 -0
- package/src/plugins/ibkr/trading/state.ts +335 -0
- package/src/plugins/pane-manager/dock-tree.ts +282 -0
- package/src/plugins/pane-manager/docking.ts +202 -0
- package/src/plugins/pane-manager/floating-actions.ts +158 -0
- package/src/plugins/pane-manager/floating.ts +76 -0
- package/src/plugins/pane-manager/gridlock-inference.ts +126 -0
- package/src/plugins/pane-manager/gridlock.ts +34 -0
- package/src/plugins/pane-manager/layout-state.ts +160 -0
- package/src/plugins/pane-manager/queries.ts +75 -0
- package/src/plugins/pane-manager/types.ts +24 -0
- package/src/plugins/pane-manager.test.ts +79 -4
- package/src/plugins/pane-manager.ts +57 -1061
- package/src/plugins/prediction-markets/chart.test.tsx +2 -2
- package/src/plugins/prediction-markets/controller/catalog.ts +317 -0
- package/src/plugins/prediction-markets/controller/data.ts +171 -0
- package/src/plugins/prediction-markets/controller/detail.ts +243 -0
- package/src/plugins/prediction-markets/controller/effects.ts +253 -0
- package/src/plugins/prediction-markets/controller/index.ts +374 -0
- package/src/plugins/prediction-markets/controller/keyboard.ts +220 -0
- package/src/plugins/prediction-markets/controller/live-updates.ts +85 -0
- package/src/plugins/prediction-markets/controller/selection.ts +59 -0
- package/src/plugins/prediction-markets/controller/status.ts +104 -0
- package/src/plugins/prediction-markets/detail/outcomes.tsx +1 -1
- package/src/plugins/prediction-markets/metrics.ts +4 -14
- package/src/plugins/prediction-markets/navigation.ts +0 -13
- package/src/plugins/prediction-markets/pane.test.tsx +2 -198
- package/src/plugins/prediction-markets/plugin.test.tsx +2 -2
- package/src/plugins/prediction-markets/services/fetch.ts +1 -5
- package/src/plugins/prediction-markets/services/kalshi/adapter.ts +299 -0
- package/src/plugins/prediction-markets/services/kalshi/normalize.ts +209 -0
- package/src/plugins/prediction-markets/services/kalshi/types.ts +89 -0
- package/src/plugins/prediction-markets/services/polymarket/adapter.ts +134 -0
- package/src/plugins/prediction-markets/services/polymarket/detail.ts +307 -0
- package/src/plugins/prediction-markets/services/polymarket/normalize.ts +239 -0
- package/src/plugins/prediction-markets/services/polymarket/types.ts +66 -0
- package/src/plugins/prediction-markets/services/polymarket/ws.ts +128 -0
- package/src/plugins/prediction-markets/test-helpers.tsx +12 -76
- package/src/plugins/prediction-markets/types.ts +2 -2
- package/src/plugins/registry/context-menu.ts +36 -0
- package/src/plugins/registry/context.ts +196 -0
- package/src/plugins/registry/contributions.ts +174 -0
- package/src/plugins/registry/index.test.ts +362 -0
- package/src/plugins/registry/index.ts +474 -0
- package/src/plugins/registry/pane-settings.ts +105 -0
- package/src/plugins/registry/plugin-state.ts +123 -0
- package/src/plugins/registry/shared.ts +34 -0
- package/src/plugins/registry/slots.ts +70 -0
- package/src/plugins/runtime/context.tsx +115 -0
- package/src/plugins/runtime/index.test.tsx +328 -0
- package/src/plugins/runtime/index.tsx +111 -0
- package/src/plugins/runtime/state.ts +275 -0
- package/src/plugins/ticker-navigation.test.ts +23 -2
- package/src/plugins/ticker-navigation.ts +9 -3
- package/src/react/input.test.ts +29 -0
- package/src/react/input.ts +9 -0
- package/src/renderers/electrobun/bun/application-menu/click.test.ts +50 -0
- package/src/renderers/electrobun/bun/application-menu/click.ts +58 -0
- package/src/renderers/electrobun/bun/application-menu/index.ts +123 -0
- package/src/renderers/electrobun/bun/context-menu/click.test.ts +67 -0
- package/src/renderers/electrobun/bun/context-menu/normalize.test.ts +52 -0
- package/src/renderers/electrobun/bun/context-menu/normalize.ts +67 -0
- package/src/renderers/electrobun/bun/core-capabilities.ts +3 -0
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +163 -0
- package/src/renderers/electrobun/bun/desktop/capability-bridge.ts +93 -0
- package/src/renderers/electrobun/bun/desktop/detached-windows.ts +263 -0
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +114 -0
- package/src/renderers/electrobun/bun/desktop/http-fetch.ts +56 -0
- package/src/renderers/electrobun/bun/desktop/initialization.ts +139 -0
- package/src/renderers/electrobun/bun/desktop/plugin-state.ts +92 -0
- package/src/renderers/electrobun/bun/desktop/relaunch.ts +48 -0
- package/src/renderers/electrobun/bun/desktop/rpc-registry.ts +43 -0
- package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +76 -0
- package/src/renderers/electrobun/bun/desktop/update.ts +162 -0
- package/src/renderers/electrobun/bun/desktop/window-events.ts +49 -0
- package/src/renderers/electrobun/bun/desktop/workspace/index.test.ts +63 -0
- package/src/renderers/electrobun/bun/desktop/workspace/index.ts +180 -0
- package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +97 -0
- package/src/renderers/electrobun/bun/index.ts +165 -1001
- package/src/renderers/electrobun/bun/tui-entry.ts +6 -0
- package/src/renderers/electrobun/bun/window/focus.ts +37 -0
- package/src/renderers/electrobun/bun/window/frame.test.ts +40 -0
- package/src/renderers/electrobun/shared/protocol.ts +1 -1
- package/src/renderers/electrobun/view/app-services.ts +4 -375
- package/src/renderers/electrobun/view/build-assets.ts +117 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +398 -0
- package/src/renderers/electrobun/view/config-host.ts +1 -1
- package/src/renderers/electrobun/view/context-menu.test.ts +10 -4
- package/src/renderers/electrobun/view/context-menu.ts +1 -1
- package/src/renderers/electrobun/view/data-table/dom.ts +211 -0
- package/src/renderers/electrobun/view/data-table/index.tsx +358 -0
- package/src/renderers/electrobun/view/data-table/row.tsx +335 -0
- package/src/renderers/electrobun/view/desktop/control-styles.ts +77 -0
- package/src/renderers/electrobun/view/desktop/controls.tsx +421 -0
- package/src/renderers/electrobun/view/desktop/list-view.tsx +200 -0
- package/src/renderers/electrobun/view/desktop/window/bridge.ts +70 -0
- package/src/renderers/electrobun/view/desktop/window/snapshot.test.ts +57 -0
- package/src/renderers/electrobun/view/desktop/window/snapshot.ts +41 -0
- package/src/renderers/electrobun/view/fatal-screen.tsx +2 -2
- package/src/renderers/electrobun/view/host/box.tsx +160 -0
- package/src/renderers/electrobun/view/host/chart-surface.tsx +142 -0
- package/src/renderers/electrobun/view/host/input.tsx +294 -0
- package/src/renderers/electrobun/view/host/mouse.ts +139 -0
- package/src/renderers/electrobun/view/host/native.ts +49 -0
- package/src/renderers/electrobun/view/host/scroll-box.tsx +276 -0
- package/src/renderers/electrobun/view/host/style.ts +124 -0
- package/src/renderers/electrobun/view/host/tabs.tsx +255 -0
- package/src/renderers/electrobun/view/host/text.tsx +121 -0
- package/src/renderers/electrobun/view/http-fetch.ts +1 -1
- package/src/renderers/electrobun/view/input-host.tsx +12 -1
- package/src/renderers/electrobun/view/main.tsx +8 -3
- package/src/renderers/electrobun/view/native-stubs/backend-rpc.ts +59 -0
- package/src/renderers/electrobun/view/native-stubs/chart/kitty-support.ts +9 -0
- package/src/renderers/electrobun/view/remote/asset-data-client.ts +201 -0
- package/src/renderers/electrobun/view/remote/persistence.ts +158 -0
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +26 -0
- package/src/renderers/electrobun/view/styles.css +43 -0
- package/src/renderers/electrobun/view/ui-host.tsx +22 -1469
- package/src/renderers/opentui/chart-surface.tsx +4 -5
- package/src/renderers/opentui/host.tsx +30 -4
- package/src/renderers/opentui/image/loader.test.ts +25 -0
- package/src/renderers/opentui/image/loader.ts +105 -0
- package/src/renderers/opentui/image/surface.tsx +266 -0
- package/src/renderers/opentui/input-host.tsx +12 -1
- package/src/renderers/opentui/start.tsx +2 -2
- package/src/renderers/opentui/test-utils.tsx +2 -2
- package/src/renderers/opentui/ui-host.tsx +1 -1
- package/src/sources/gloomberb-cloud/index.test.ts +660 -0
- package/src/sources/gloomberb-cloud/index.ts +444 -0
- package/src/sources/gloomberb-cloud/news.ts +127 -0
- package/src/sources/gloomberb-cloud/normalizers.ts +354 -0
- package/src/sources/provider-errors.ts +8 -2
- package/src/sources/provider-router/batches.ts +170 -0
- package/src/sources/provider-router/brokers.ts +114 -0
- package/src/sources/provider-router/cache.ts +171 -0
- package/src/sources/provider-router/cached-financials.test.ts +498 -0
- package/src/sources/provider-router/document-routes.ts +153 -0
- package/src/sources/provider-router/financial-routes.ts +225 -0
- package/src/sources/provider-router/financials.ts +259 -0
- package/src/sources/provider-router/history.test.ts +383 -0
- package/src/sources/provider-router/history.ts +448 -0
- package/src/sources/provider-router/index.test.ts +1438 -0
- package/src/sources/provider-router/index.ts +389 -0
- package/src/sources/provider-router/news.ts +36 -0
- package/src/sources/provider-router/primary.ts +164 -0
- package/src/sources/provider-router/route-types.ts +34 -0
- package/src/sources/provider-router/routing.ts +58 -0
- package/src/sources/provider-router/search.ts +183 -0
- package/src/sources/provider-router/sources.ts +55 -0
- package/src/sources/provider-router/streaming.ts +92 -0
- package/src/sources/provider-router/supplemental.ts +373 -0
- package/src/sources/provider-router/test-support.ts +136 -0
- package/src/sources/sec-edgar/content.ts +211 -0
- package/src/sources/sec-edgar.ts +9 -217
- package/src/sources/yahoo-finance/financials.ts +339 -0
- package/src/sources/yahoo-finance/history.ts +106 -0
- package/src/sources/yahoo-finance/http.ts +100 -0
- package/src/sources/yahoo-finance/mappers.ts +409 -0
- package/src/sources/yahoo-finance/options.ts +134 -0
- package/src/sources/yahoo-finance/quote-summary.ts +210 -0
- package/src/sources/yahoo-finance/requests.ts +192 -0
- package/src/sources/yahoo-finance/snapshots.ts +236 -0
- package/src/sources/yahoo-finance/symbols.ts +102 -0
- package/src/sources/yahoo-finance/types.ts +167 -0
- package/src/sources/yahoo-finance.test.ts +116 -12
- package/src/sources/yahoo-finance.ts +115 -1408
- package/src/state/app/activity.test.ts +41 -0
- package/src/state/app/activity.ts +106 -0
- package/src/state/app/bootstrap.test.ts +498 -0
- package/src/state/app/bootstrap.ts +412 -0
- package/src/state/app/context/index.test.ts +564 -0
- package/src/state/app/context/index.test.tsx +193 -0
- package/src/state/app/context/index.tsx +476 -0
- package/src/state/app/context/selector.test.tsx +291 -0
- package/src/state/config-save-scheduler.ts +2 -6
- package/src/state/hooks/inline-tickers.test.tsx +123 -0
- package/src/state/hooks/inline-tickers.ts +212 -0
- package/src/state/hooks/quote-streaming.test.ts +31 -0
- package/src/state/hooks/quote-streaming.test.tsx +70 -0
- package/src/state/hooks/quote-streaming.ts +92 -0
- package/src/state/hooks/session-snapshot.ts +99 -0
- package/src/state/pane-scroll-registry.tsx +1 -1
- package/src/state/selectors-ui.ts +1 -1
- package/src/state/selectors.ts +1 -1
- package/src/test-support/plugin-persistence.ts +112 -0
- package/src/test-support/plugin-runtime.ts +2 -1
- package/src/theme/colors.ts +23 -9
- package/src/theme/themes.test.ts +15 -0
- package/src/tickers/list.test.ts +16 -0
- package/src/tickers/open-target.ts +77 -0
- package/src/tickers/search/index.test.ts +252 -0
- package/src/tickers/search/index.ts +367 -0
- package/src/tickers/search/ranking.ts +387 -0
- package/src/tickers/search/result.ts +27 -0
- package/src/tickers/search/types.ts +41 -0
- package/src/tickers/search/upsert.ts +91 -0
- package/src/tickers/tokenizer.test.ts +31 -0
- package/src/tickers/tokenizer.ts +37 -0
- package/src/types/broker.ts +12 -4
- package/src/types/config.ts +42 -23
- package/src/types/context-menu.ts +1 -1
- package/src/types/data-provider.ts +2 -2
- package/src/types/desktop-window.ts +1 -1
- package/src/types/financials.ts +109 -4
- package/src/types/news-source.ts +0 -1
- package/src/types/persistence.ts +1 -1
- package/src/types/plugin.ts +37 -21
- package/src/types/ticker.ts +1 -0
- package/src/types/trading.ts +23 -1
- package/src/ui/context-menu.tsx +6 -5
- package/src/ui/dialog.tsx +6 -3
- package/src/ui/host.tsx +10 -10
- package/src/ui/index.tsx +14 -33
- package/src/updater/github-releases.test.ts +41 -0
- package/src/updater/github-releases.ts +73 -0
- package/src/updater.test.ts +21 -0
- package/src/updater.ts +10 -3
- package/src/utils/back-navigation.ts +2 -2
- package/src/utils/cli-output.ts +4 -4
- package/src/utils/currency-units.test.ts +23 -1
- package/src/utils/currency-units.ts +56 -0
- package/src/utils/datetime-format.ts +40 -0
- package/src/utils/dom-screenshot.ts +2 -2
- package/src/utils/double-escape-close.ts +1 -1
- package/src/utils/exchanges.ts +2 -2
- package/src/utils/format.ts +0 -7
- package/src/utils/fuzzy-search.ts +1 -1
- package/src/utils/inline-content-tokenizer.test.ts +11 -2
- package/src/utils/inline-content-tokenizer.ts +33 -12
- package/src/utils/keyboard.ts +1 -1
- package/src/utils/link-tokenizer.ts +2 -2
- package/src/utils/options.ts +1 -1
- package/src/utils/price-history.test.ts +20 -0
- package/src/utils/price-history.ts +24 -2
- package/src/utils/relative-time.ts +8 -0
- package/src/utils/selection-clipboard.ts +1 -1
- package/src/utils/shortcut-labels.ts +2 -2
- package/src/utils/sort-values.ts +17 -0
- package/src/utils/terminal-input-reset.ts +1 -1
- package/src/utils/text-wrap.ts +20 -0
- package/src/version.ts +1 -1
- package/src/components/chart/chart-controller.test.ts +0 -110
- package/src/components/chart/chart-controller.ts +0 -650
- package/src/components/chart/chart-data.ts +0 -350
- package/src/components/chart/chart-indicator-selector.tsx +0 -75
- package/src/components/chart/chart-pane-settings.ts +0 -37
- package/src/components/chart/chart-renderer.ts +0 -1562
- package/src/components/chart/chart-resolution.test.ts +0 -87
- package/src/components/chart/chart-resolution.ts +0 -405
- package/src/components/chart/chart-scroll.test.ts +0 -70
- package/src/components/chart/chart-scroll.ts +0 -104
- package/src/components/chart/chart-types.ts +0 -119
- package/src/components/chart/chart-viewport.test.ts +0 -29
- package/src/components/chart/chart-viewport.ts +0 -50
- package/src/components/chart/chart.test.ts +0 -922
- package/src/components/chart/comparison-chart-data.test.ts +0 -105
- package/src/components/chart/comparison-chart-data.ts +0 -292
- package/src/components/chart/comparison-chart-renderer.test.ts +0 -187
- package/src/components/chart/comparison-chart-renderer.ts +0 -437
- package/src/components/chart/native/kitty-adapter.ts +0 -9
- package/src/components/chart/native/kitty-manager.ts +0 -142
- package/src/components/chart/native/kitty-support.ts +0 -71
- package/src/components/chart/native/kitty.test.ts +0 -728
- package/src/components/chart/native/surface-manager.ts +0 -225
- package/src/components/chart/native/surface-sync.ts +0 -34
- package/src/components/chart/native/surface-visibility.ts +0 -48
- package/src/components/chart/static-chart-surface.test.tsx +0 -51
- package/src/components/chart/static-chart-surface.tsx +0 -217
- package/src/components/chart/stock-chart-renderer-switch.test.tsx +0 -1323
- package/src/components/chart/stock-chart.test.ts +0 -330
- package/src/components/chart/stock-chart.tsx +0 -4148
- package/src/components/command-bar/__snapshots__/command-bar.test.tsx.snap +0 -109
- package/src/components/command-bar/command-bar.test.tsx +0 -3244
- package/src/components/command-bar/command-bar.tsx +0 -5886
- package/src/components/command-bar/command-registry.ts +0 -267
- package/src/components/command-bar/confirm-body.tsx +0 -51
- package/src/components/command-bar/list-model.ts +0 -80
- package/src/components/command-bar/pane-template-display.ts +0 -8
- package/src/components/command-bar/root-shortcuts.ts +0 -188
- package/src/components/command-bar/workflow-ops.test.ts +0 -144
- package/src/components/command-bar/workflow-ops.ts +0 -459
- package/src/components/command-bar/workflow-types.ts +0 -127
- package/src/components/data-table-stack-view.test.tsx +0 -241
- package/src/components/data-table-stack-view.tsx +0 -59
- package/src/components/data-table-view.test.tsx +0 -211
- package/src/components/data-table-view.tsx +0 -244
- package/src/components/feed-data-table-stack-view.test.tsx +0 -225
- package/src/components/feed-data-table-stack-view.tsx +0 -359
- package/src/components/layout/pane-content.test.tsx +0 -64
- package/src/components/layout/pane-content.tsx +0 -44
- package/src/components/layout/pane-cycle-order.test.ts +0 -30
- package/src/components/layout/pane-cycle-order.ts +0 -32
- package/src/components/layout/pane-footer.test.tsx +0 -195
- package/src/components/layout/pane-footer.tsx +0 -432
- package/src/components/layout/pane-header.test.tsx +0 -39
- package/src/components/layout/pane-header.tsx +0 -248
- package/src/components/layout/pane-keyboard-scroll.test.tsx +0 -226
- package/src/components/layout/pane-sizing.ts +0 -34
- package/src/components/layout/pane-title.ts +0 -38
- package/src/components/layout/pane.tsx +0 -129
- package/src/components/layout/shell.test.tsx +0 -1453
- package/src/components/layout/shell.tsx +0 -1960
- package/src/components/price-sparkline-view.tsx +0 -463
- package/src/components/price-sparkline.ts +0 -46
- package/src/components/speedometer-gauge.test.tsx +0 -45
- package/src/components/speedometer-gauge.tsx +0 -562
- package/src/components/ticker-badge-list.tsx +0 -53
- package/src/components/ticker-badge-text.test.tsx +0 -253
- package/src/components/ticker-badge-text.tsx +0 -113
- package/src/components/ticker-badge.tsx +0 -109
- package/src/components/ticker-list-table-view.tsx +0 -233
- package/src/components/ticker-list-table.test.tsx +0 -210
- package/src/components/ticker-list-table.tsx +0 -458
- package/src/components/ui/data-table.tsx +0 -522
- package/src/components/ui/multi-select-dialog.tsx +0 -336
- package/src/core/state/app-state.ts +0 -1009
- package/src/data/config-layout.ts +0 -225
- package/src/data/config-store-node.ts +0 -478
- package/src/data/config-store.test.ts +0 -481
- package/src/data/config-store.ts +0 -64
- package/src/data/sqlite-cache.test.ts +0 -151
- package/src/data/sqlite-database.ts +0 -68
- package/src/data/sqlite-json.ts +0 -16
- package/src/data/sqlite-retry.test.ts +0 -63
- package/src/market-data/coordinator-subscriptions.test.ts +0 -209
- package/src/market-data/coordinator.test.ts +0 -830
- package/src/market-data/coordinator.ts +0 -1155
- package/src/plugins/builtin/ai/screener-contract.test.ts +0 -117
- package/src/plugins/builtin/ai/screener-contract.ts +0 -174
- package/src/plugins/builtin/ai/screener-pane.test.tsx +0 -348
- package/src/plugins/builtin/ai/screener-pane.tsx +0 -1118
- package/src/plugins/builtin/ai/utils.ts +0 -1
- package/src/plugins/builtin/ask-ai.test.tsx +0 -348
- package/src/plugins/builtin/chat-controller.test.ts +0 -1376
- package/src/plugins/builtin/chat-controller.ts +0 -1248
- package/src/plugins/builtin/chat.test.tsx +0 -2245
- package/src/plugins/builtin/chat.tsx +0 -2267
- package/src/plugins/builtin/cloud-auth-actions.tsx +0 -72
- package/src/plugins/builtin/cloud-tweets.tsx +0 -896
- package/src/plugins/builtin/comparison-chart.test.tsx +0 -532
- package/src/plugins/builtin/comparison-chart.tsx +0 -194
- package/src/plugins/builtin/debug.tsx +0 -365
- package/src/plugins/builtin/earnings/earnings-cache.test.ts +0 -181
- package/src/plugins/builtin/earnings/earnings-cache.ts +0 -145
- package/src/plugins/builtin/earnings/earnings-data.test.ts +0 -90
- package/src/plugins/builtin/earnings/earnings-data.ts +0 -115
- package/src/plugins/builtin/fear-greed/fear-greed-data.test.ts +0 -72
- package/src/plugins/builtin/fear-greed/fear-greed-data.ts +0 -366
- package/src/plugins/builtin/help.test.tsx +0 -166
- package/src/plugins/builtin/help.tsx +0 -450
- package/src/plugins/builtin/layout-manager.tsx +0 -247
- package/src/plugins/builtin/manual-entry.tsx +0 -25
- package/src/plugins/builtin/news-wire/breaking-notifications.test.ts +0 -98
- package/src/plugins/builtin/news-wire/breaking-notifications.ts +0 -110
- package/src/plugins/builtin/news-wire/breaking-pane.test.tsx +0 -156
- package/src/plugins/builtin/news-wire/breaking-pane.tsx +0 -68
- package/src/plugins/builtin/news-wire/categories.ts +0 -114
- package/src/plugins/builtin/news-wire/default-feeds.ts +0 -3
- package/src/plugins/builtin/news-wire/feed-config.test.ts +0 -90
- package/src/plugins/builtin/news-wire/feed-config.ts +0 -216
- package/src/plugins/builtin/news-wire/index.tsx +0 -129
- package/src/plugins/builtin/news-wire/industry-pane.tsx +0 -126
- package/src/plugins/builtin/news-wire/news-detail-view.tsx +0 -299
- package/src/plugins/builtin/news-wire/news-footer.ts +0 -28
- package/src/plugins/builtin/news-wire/news-preset-pane.tsx +0 -98
- package/src/plugins/builtin/news-wire/news-query-presets.ts +0 -40
- package/src/plugins/builtin/news-wire/news-table.test.tsx +0 -206
- package/src/plugins/builtin/news-wire/news-table.tsx +0 -296
- package/src/plugins/builtin/news-wire/persisted-articles.ts +0 -98
- package/src/plugins/builtin/news-wire/read-state.ts +0 -76
- package/src/plugins/builtin/news-wire/rss-parser.test.ts +0 -184
- package/src/plugins/builtin/news-wire/rss-parser.ts +0 -213
- package/src/plugins/builtin/news-wire/rss-source.test.ts +0 -159
- package/src/plugins/builtin/news-wire/rss-source.ts +0 -181
- package/src/plugins/builtin/news.tsx +0 -194
- package/src/plugins/builtin/notes.tsx +0 -561
- package/src/plugins/builtin/options.test.tsx +0 -241
- package/src/plugins/builtin/options.tsx +0 -542
- package/src/plugins/builtin/portfolio-list/cli/commands.ts +0 -657
- package/src/plugins/builtin/portfolio-list/pane.tsx +0 -724
- package/src/plugins/builtin/portfolio-list/quick-add.tsx +0 -422
- package/src/plugins/builtin/portfolio-list/summary.tsx +0 -275
- package/src/plugins/builtin/portfolio-list.test.ts +0 -133
- package/src/plugins/builtin/portfolio-list.test.tsx +0 -1535
- package/src/plugins/builtin/portfolio-metrics.test.ts +0 -236
- package/src/plugins/builtin/quote-monitor.test.tsx +0 -222
- package/src/plugins/builtin/sec-filing-display.tsx +0 -84
- package/src/plugins/builtin/sec.tsx +0 -342
- package/src/plugins/builtin/ticker-detail/financials-tab.tsx +0 -461
- package/src/plugins/builtin/ticker-detail/quote-monitor.tsx +0 -479
- package/src/plugins/builtin/ticker-detail-chart-tab-switch.test.tsx +0 -269
- package/src/plugins/builtin/ticker-detail.test.tsx +0 -888
- package/src/plugins/builtin/ticker-surface.ts +0 -68
- package/src/plugins/builtin/yahoo.ts +0 -72
- package/src/plugins/catalog-ui.test.ts +0 -24
- package/src/plugins/ibkr/__snapshots__/trade-tab.test.tsx.snap +0 -35
- package/src/plugins/ibkr/flex.test.ts +0 -162
- package/src/plugins/ibkr/flex.ts +0 -371
- package/src/plugins/ibkr/gateway-helpers.ts +0 -33
- package/src/plugins/ibkr/gateway-selection.ts +0 -51
- package/src/plugins/ibkr/gateway-service-native.ts +0 -2377
- package/src/plugins/ibkr/gateway-service.test.ts +0 -584
- package/src/plugins/ibkr/gateway-service.ts +0 -433
- package/src/plugins/ibkr/gateway-types.ts +0 -27
- package/src/plugins/ibkr/price-normalization.test.ts +0 -33
- package/src/plugins/ibkr/price-normalization.ts +0 -60
- package/src/plugins/ibkr/trade-badge.tsx +0 -28
- package/src/plugins/ibkr/trade-tab.test.tsx +0 -276
- package/src/plugins/ibkr/trade-tab.tsx +0 -1117
- package/src/plugins/ibkr/trade-utils.test.ts +0 -175
- package/src/plugins/ibkr/trade-utils.ts +0 -150
- package/src/plugins/ibkr/trading-pane.tsx +0 -474
- package/src/plugins/ibkr/trading-state.test.ts +0 -109
- package/src/plugins/ibkr/trading-state.ts +0 -339
- package/src/plugins/plugin-runtime.test.tsx +0 -323
- package/src/plugins/plugin-runtime.tsx +0 -433
- package/src/plugins/prediction-markets/controller-data.ts +0 -785
- package/src/plugins/prediction-markets/controller.ts +0 -659
- package/src/plugins/prediction-markets/services/kalshi-adapter.ts +0 -572
- package/src/plugins/prediction-markets/services/polymarket-adapter.ts +0 -696
- package/src/plugins/prediction-markets/services/polymarket-ws.ts +0 -128
- package/src/plugins/registry.test.ts +0 -362
- package/src/plugins/registry.ts +0 -854
- package/src/renderers/electrobun/bun/application-menu-click.test.ts +0 -50
- package/src/renderers/electrobun/bun/application-menu-click.ts +0 -58
- package/src/renderers/electrobun/bun/application-menu.ts +0 -123
- package/src/renderers/electrobun/bun/context-menu-click.test.ts +0 -67
- package/src/renderers/electrobun/bun/context-menu-normalize.test.ts +0 -52
- package/src/renderers/electrobun/bun/context-menu-normalize.ts +0 -67
- package/src/renderers/electrobun/bun/desktop-workspace.test.ts +0 -63
- package/src/renderers/electrobun/bun/desktop-workspace.ts +0 -180
- package/src/renderers/electrobun/bun/window-focus.ts +0 -37
- package/src/renderers/electrobun/bun/window-frame.test.ts +0 -40
- package/src/renderers/electrobun/view/data-table.tsx +0 -810
- package/src/renderers/electrobun/view/desktop-controls.tsx +0 -673
- package/src/renderers/electrobun/view/desktop-window-bridge.ts +0 -70
- package/src/renderers/electrobun/view/desktop-window-snapshot.test.ts +0 -57
- package/src/renderers/electrobun/view/desktop-window-snapshot.ts +0 -41
- package/src/renderers/electrobun/view/native-stubs/chart-kitty-support.ts +0 -9
- package/src/renderers/opentui/image-loader.test.ts +0 -25
- package/src/renderers/opentui/image-loader.ts +0 -105
- package/src/renderers/opentui/image-surface.tsx +0 -266
- package/src/sources/gloomberb-cloud.test.ts +0 -637
- package/src/sources/gloomberb-cloud.ts +0 -828
- package/src/sources/provider-router.test.ts +0 -2600
- package/src/sources/provider-router.ts +0 -2231
- package/src/state/app-activity.test.ts +0 -41
- package/src/state/app-activity.ts +0 -106
- package/src/state/app-bootstrap.test.ts +0 -498
- package/src/state/app-bootstrap.ts +0 -411
- package/src/state/app-context-selector.test.tsx +0 -369
- package/src/state/app-context.test.ts +0 -670
- package/src/state/app-context.test.tsx +0 -193
- package/src/state/app-context.tsx +0 -485
- package/src/state/use-inline-tickers.test.tsx +0 -73
- package/src/state/use-inline-tickers.ts +0 -188
- package/src/state/use-quote-streaming.test.ts +0 -31
- package/src/state/use-quote-streaming.test.tsx +0 -70
- package/src/state/use-quote-streaming.ts +0 -92
- package/src/state/use-session-snapshot.ts +0 -99
- package/src/utils/api-client.test.ts +0 -603
- package/src/utils/api-client.ts +0 -1379
- package/src/utils/market-format.test.ts +0 -109
- package/src/utils/market-format.ts +0 -299
- package/src/utils/market-status.ts +0 -141
- package/src/utils/quote-freshness.test.ts +0 -150
- package/src/utils/quote-freshness.ts +0 -145
- package/src/utils/quote-resolution.test.ts +0 -277
- package/src/utils/quote-resolution.ts +0 -642
- package/src/utils/quote-time.test.ts +0 -34
- package/src/utils/quote-time.ts +0 -59
- package/src/utils/ticker-list.test.ts +0 -16
- package/src/utils/ticker-search.test.ts +0 -227
- package/src/utils/ticker-search.ts +0 -926
- package/src/utils/ticker-tokenizer.test.ts +0 -31
- package/src/utils/ticker-tokenizer.ts +0 -37
- /package/src/components/chart/native/{kitty-protocol.ts → kitty/protocol.ts} +0 -0
- /package/src/components/ui/{multi-select.ts → multi-select/index.ts} +0 -0
- /package/src/data/{sqlite-retry.ts → sqlite/retry.ts} +0 -0
- /package/src/plugins/builtin/{news-wire → news/wire}/hash.ts +0 -0
- /package/src/plugins/builtin/{news-wire → news/wire}/read-state.test.ts +0 -0
- /package/src/plugins/builtin/{notes-files.ts → notes/files.ts} +0 -0
- /package/src/renderers/electrobun/bun/{context-menu-click.ts → context-menu/click.ts} +0 -0
- /package/src/renderers/electrobun/bun/{window-frame.ts → window/frame.ts} +0 -0
- /package/src/renderers/electrobun/view/native-stubs/{chart-surface-manager.ts → chart/surface-manager.ts} +0 -0
- /package/src/renderers/electrobun/view/native-stubs/{chart-surface-sync.ts → chart/surface-sync.ts} +0 -0
- /package/src/{utils/ticker-list.ts → tickers/list.ts} +0 -0
- /package/src/{utils/ticker-metadata.ts → tickers/metadata.ts} +0 -0
|
@@ -1,101 +1,75 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { dirname, join } from "path";
|
|
3
|
-
import { Buffer } from "node:buffer";
|
|
4
|
-
import Electrobun, { ApplicationMenu, BrowserView, BrowserWindow, Utils, ContextMenu, type UpdateStatusEntry } from "electrobun/bun";
|
|
1
|
+
import Electrobun, { ApplicationMenu, BrowserView, BrowserWindow, Utils } from "electrobun/bun";
|
|
5
2
|
import {
|
|
6
3
|
APP_SESSION_ID,
|
|
7
4
|
APP_SESSION_SCHEMA_VERSION,
|
|
8
5
|
reconcileAppSessionSnapshot,
|
|
9
6
|
} from "../../../core/state/session-persistence";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import * as nodeConfigStoreHost from "../../../data/config
|
|
13
|
-
import {
|
|
7
|
+
import type { AppServices } from "../../../core/app-services";
|
|
8
|
+
import { saveConfig, setConfigStoreHost } from "../../../data/config/store";
|
|
9
|
+
import * as nodeConfigStoreHost from "../../../data/config/store/node";
|
|
10
|
+
import type { AppConfig } from "../../../types/config";
|
|
14
11
|
import type { AppSessionSnapshot } from "../../../core/state/session-persistence";
|
|
15
|
-
import { syncConfigActiveLayoutState, type PaneRuntimeState } from "../../../core/state/app
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
18
|
-
import { buildSoundCommand } from "../../../notifications/app-notifier";
|
|
19
|
-
import { isPaneDetached } from "../../../plugins/pane-manager";
|
|
12
|
+
import { syncConfigActiveLayoutState, type PaneRuntimeState } from "../../../core/state/app/state";
|
|
13
|
+
import type { DesktopSharedStateSnapshot, DesktopThemePreviewState } from "../../../types/desktop-window";
|
|
14
|
+
import type { UpdateProgress } from "../../../updater";
|
|
20
15
|
import { ELECTROBUN_CONTEXT_MENU_ACTION, type DesktopRestartMessage, type ElectrobunDesktopRpcSchema } from "../shared/protocol";
|
|
21
16
|
import { decodeRpcValue, encodeRpcValue } from "../view/rpc-codec";
|
|
22
|
-
import { contextMenuSelectionMessage } from "./context-menu
|
|
23
|
-
import {
|
|
24
|
-
import { createDesktopWorkspace, type DesktopWorkspace } from "./desktop-workspace";
|
|
17
|
+
import { contextMenuSelectionMessage } from "./context-menu/click";
|
|
18
|
+
import type { DesktopWorkspace } from "./desktop/workspace";
|
|
25
19
|
import { buildApplicationMenu } from "./application-menu";
|
|
26
|
-
import { applicationMenuCommand } from "./application-menu
|
|
20
|
+
import { applicationMenuCommand } from "./application-menu/click";
|
|
27
21
|
import { registerElectrobunCoreCapabilities } from "./core-capabilities";
|
|
28
|
-
import { setNativeIbkrGatewayModuleLoader } from "../../../plugins/ibkr/gateway
|
|
29
|
-
import {
|
|
22
|
+
import { setNativeIbkrGatewayModuleLoader } from "../../../plugins/ibkr/gateway/service";
|
|
23
|
+
import {
|
|
24
|
+
runElectrobunDesktopUpdate,
|
|
25
|
+
} from "./desktop/update";
|
|
26
|
+
import { DesktopCapabilityBridge } from "./desktop/capability-bridge";
|
|
30
27
|
import {
|
|
31
28
|
DEFAULT_WINDOW_FRAME,
|
|
32
|
-
DETACHED_WINDOW_MIN_SIZE,
|
|
33
29
|
MAIN_WINDOW_MIN_SIZE,
|
|
34
|
-
normalizeWindowFrame,
|
|
35
30
|
normalizeWindowFrameWithMinimum,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
} from "./
|
|
31
|
+
} from "./window/frame";
|
|
32
|
+
import { MAIN_WINDOW_RPC_KEY } from "./window/focus";
|
|
33
|
+
import { handleHttpFetch } from "./desktop/http-fetch";
|
|
34
|
+
import { handleDesktopPluginStateRequest } from "./desktop/plugin-state";
|
|
35
|
+
import { scheduleDesktopRelaunch } from "./desktop/relaunch";
|
|
39
36
|
import {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
applyWindowMoveEvent,
|
|
38
|
+
applyWindowResizeEvent,
|
|
39
|
+
updateWindowFrameCache,
|
|
40
|
+
type WindowMoveEvent,
|
|
41
|
+
type WindowResizeEvent,
|
|
42
|
+
} from "./desktop/window-events";
|
|
43
|
+
import { createDesktopRpcRegistry } from "./desktop/rpc-registry";
|
|
44
|
+
import { DesktopStateBroadcaster } from "./desktop/state-broadcaster";
|
|
45
|
+
import { DesktopDetachedWindowManager } from "./desktop/detached-windows";
|
|
46
|
+
import { handleDesktopHostRequest } from "./desktop/host-requests";
|
|
47
|
+
import { handleDesktopWorkspaceRequest } from "./desktop/workspace/requests";
|
|
48
|
+
import { handleDesktopBackendRequest } from "./desktop/backend-requests";
|
|
49
|
+
import { initializeDesktopBackend } from "./desktop/initialization";
|
|
45
50
|
|
|
46
51
|
type DesktopRpc = ReturnType<typeof BrowserView.defineRPC<ElectrobunDesktopRpcSchema>>;
|
|
47
|
-
type WindowMoveEvent = { data?: { x?: number; y?: number } };
|
|
48
|
-
type WindowResizeEvent = { data?: Partial<WindowFrame> };
|
|
49
|
-
type PersistedCloudSession = {
|
|
50
|
-
sessionToken?: string | null;
|
|
51
|
-
user?: PersistedAuthUser | null;
|
|
52
|
-
};
|
|
53
52
|
|
|
54
53
|
console.log = (...args) => console.error(...args);
|
|
55
54
|
console.info = (...args) => console.error(...args);
|
|
56
55
|
console.warn = (...args) => console.error(...args);
|
|
57
56
|
|
|
58
57
|
setConfigStoreHost(nodeConfigStoreHost);
|
|
59
|
-
setNativeIbkrGatewayModuleLoader(() => import("../../../plugins/ibkr/gateway
|
|
58
|
+
setNativeIbkrGatewayModuleLoader(() => import("../../../plugins/ibkr/gateway/service/native"));
|
|
60
59
|
|
|
61
60
|
let currentConfig: AppConfig | null = null;
|
|
62
61
|
let services: AppServices | null = null;
|
|
63
62
|
let mainWindow: BrowserWindow | null = null;
|
|
64
63
|
let desktopWorkspace: DesktopWorkspace | null = null;
|
|
65
|
-
let currentDockPreview: DesktopDockPreviewState = { paneId: null, edge: null };
|
|
66
|
-
let currentThemePreview: DesktopThemePreviewState = { theme: null };
|
|
67
|
-
let desktopUpdateInProgress = false;
|
|
68
64
|
let desktopRestartInProgress = false;
|
|
69
65
|
|
|
70
|
-
const
|
|
71
|
-
const detachedFrameTimers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
72
|
-
const detachedDockTimers = new Map<string, ReturnType<typeof setTimeout>>();
|
|
73
|
-
const detachedClosingPanes = new Set<string>();
|
|
74
|
-
const pendingDetachedMoveFlush = new Set<string>();
|
|
75
|
-
const windowRpcs = new Map<string, DesktopRpc>();
|
|
76
|
-
const readyWindowRpcs = new Set<string>();
|
|
77
|
-
const rpcWindowKeys = new Map<DesktopRpc, string>();
|
|
66
|
+
const windowRpcRegistry = createDesktopRpcRegistry<DesktopRpc>();
|
|
78
67
|
const contextMenuRequestRpcs = new Map<string, DesktopRpc>();
|
|
79
68
|
|
|
80
|
-
const capabilitySubscriptions = new Map<string, () => void>();
|
|
81
|
-
|
|
82
69
|
function summarizeError(error: unknown): string {
|
|
83
70
|
return error instanceof Error ? error.stack ?? error.message : String(error);
|
|
84
71
|
}
|
|
85
72
|
|
|
86
|
-
function shellQuote(value: string): string {
|
|
87
|
-
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function findMacAppBundle(execPath: string): string | null {
|
|
91
|
-
let current = dirname(execPath);
|
|
92
|
-
while (current && current !== dirname(current)) {
|
|
93
|
-
if (current.endsWith(".app")) return current;
|
|
94
|
-
current = dirname(current);
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
73
|
function requireServices(): AppServices {
|
|
100
74
|
if (!services) throw new Error("Backend services have not been initialized.");
|
|
101
75
|
return services;
|
|
@@ -118,44 +92,40 @@ function requireDesktopWorkspace(): DesktopWorkspace {
|
|
|
118
92
|
return desktopWorkspace;
|
|
119
93
|
}
|
|
120
94
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}
|
|
131
|
-
windowRpcs.delete(key);
|
|
132
|
-
readyWindowRpcs.delete(key);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function getRpcWindowKey(rpc: DesktopRpc): string | undefined {
|
|
136
|
-
return rpcWindowKeys.get(rpc);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function markWindowRpcReady(rpc: DesktopRpc): void {
|
|
140
|
-
const key = getRpcWindowKey(rpc);
|
|
141
|
-
if (key) readyWindowRpcs.add(key);
|
|
142
|
-
}
|
|
95
|
+
const {
|
|
96
|
+
forEachReadyWindowRpc,
|
|
97
|
+
getRpcWindowKey,
|
|
98
|
+
getWindowRpc,
|
|
99
|
+
isWindowRpcReady,
|
|
100
|
+
markWindowRpcReady,
|
|
101
|
+
registerWindowRpc,
|
|
102
|
+
unregisterWindowRpc,
|
|
103
|
+
} = windowRpcRegistry;
|
|
143
104
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
105
|
+
const capabilityBridge = new DesktopCapabilityBridge<DesktopRpc>({
|
|
106
|
+
getRegistry: () => requireServices().pluginRegistry.capabilities,
|
|
107
|
+
getWindowKey: getRpcWindowKey,
|
|
108
|
+
});
|
|
109
|
+
const desktopStateBroadcaster = new DesktopStateBroadcaster<DesktopRpc>({
|
|
110
|
+
forEachReadyWindowRpc,
|
|
111
|
+
});
|
|
112
|
+
const detachedWindowManager = new DesktopDetachedWindowManager<DesktopRpc>({
|
|
113
|
+
createRpc: createWindowRpc,
|
|
114
|
+
getConfig: requireConfig,
|
|
115
|
+
getCurrentConfig: () => currentConfig,
|
|
116
|
+
getDesktopWorkspace: requireDesktopWorkspace,
|
|
117
|
+
getDesktopWorkspaceOrNull: () => desktopWorkspace,
|
|
118
|
+
getMainWindow: () => mainWindow,
|
|
119
|
+
commitDesktopSnapshot,
|
|
120
|
+
disposeWindowScopedResources,
|
|
121
|
+
unregisterWindowRpc,
|
|
122
|
+
stateBroadcaster: desktopStateBroadcaster,
|
|
123
|
+
});
|
|
150
124
|
|
|
151
125
|
function openMainWindowDevTools(): void {
|
|
152
126
|
mainWindow?.webview.openDevTools();
|
|
153
127
|
}
|
|
154
128
|
|
|
155
|
-
function scopeClientId(rpc: DesktopRpc, id: string): string {
|
|
156
|
-
return `${getRpcWindowKey(rpc) ?? "window"}:${id}`;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
129
|
function syncActiveLayout(
|
|
160
130
|
config: AppConfig,
|
|
161
131
|
paneState: Record<string, PaneRuntimeState> = config.layouts[config.activeLayoutIndex]?.paneState ?? {},
|
|
@@ -165,351 +135,25 @@ function syncActiveLayout(
|
|
|
165
135
|
return syncConfigActiveLayoutState(config, paneState, focusedPaneId, activePanel);
|
|
166
136
|
}
|
|
167
137
|
|
|
168
|
-
function normalizeInitWindowTarget(
|
|
169
|
-
rpc: DesktopRpc,
|
|
170
|
-
payload: Record<string, unknown>,
|
|
171
|
-
): { kind: "main" | "detached"; paneId?: string } {
|
|
172
|
-
const rpcKey = getRpcWindowKey(rpc);
|
|
173
|
-
if (rpcKey === MAIN_WINDOW_RPC_KEY) {
|
|
174
|
-
return { kind: "main" };
|
|
175
|
-
}
|
|
176
|
-
const detachedPaneId = paneIdFromDetachedRpcKey(rpcKey);
|
|
177
|
-
if (detachedPaneId) {
|
|
178
|
-
return {
|
|
179
|
-
kind: "detached",
|
|
180
|
-
paneId: detachedPaneId,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
const kind = payload.kind === "detached" ? "detached" : "main";
|
|
184
|
-
return {
|
|
185
|
-
kind,
|
|
186
|
-
paneId: kind === "detached" && typeof payload.paneId === "string" && payload.paneId.length > 0
|
|
187
|
-
? payload.paneId
|
|
188
|
-
: undefined,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
function clearTimer(
|
|
193
|
-
timers: Map<string, ReturnType<typeof setTimeout>>,
|
|
194
|
-
key: string,
|
|
195
|
-
): void {
|
|
196
|
-
const timer = timers.get(key);
|
|
197
|
-
if (timer) {
|
|
198
|
-
clearTimeout(timer);
|
|
199
|
-
timers.delete(key);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function getWindowFrame(window: BrowserWindow | null): WindowFrame | null {
|
|
204
|
-
if (!window) return null;
|
|
205
|
-
return normalizeWindowFrame(window.frame);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function updateWindowFrameCache(
|
|
209
|
-
window: BrowserWindow | null,
|
|
210
|
-
patch: Partial<WindowFrame>,
|
|
211
|
-
minimumSize?: WindowMinimumSize,
|
|
212
|
-
): WindowFrame | null {
|
|
213
|
-
if (!window) return null;
|
|
214
|
-
const nextFrame = normalizeWindowFrameWithMinimum(patch, getWindowFrame(window) ?? DEFAULT_WINDOW_FRAME, minimumSize);
|
|
215
|
-
window.frame = nextFrame;
|
|
216
|
-
return nextFrame;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function applyWindowMoveEvent(window: BrowserWindow | null, event: WindowMoveEvent): WindowFrame | null {
|
|
220
|
-
return updateWindowFrameCache(window, {
|
|
221
|
-
x: event.data?.x,
|
|
222
|
-
y: event.data?.y,
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function applyWindowResizeEvent(
|
|
227
|
-
window: BrowserWindow | null,
|
|
228
|
-
event: WindowResizeEvent,
|
|
229
|
-
minimumSize?: WindowMinimumSize,
|
|
230
|
-
): WindowFrame | null {
|
|
231
|
-
if (!window) return null;
|
|
232
|
-
const previousFrame = getWindowFrame(window) ?? DEFAULT_WINDOW_FRAME;
|
|
233
|
-
const rawFrame = normalizeWindowFrame(event.data ?? {}, previousFrame);
|
|
234
|
-
const nextFrame = updateWindowFrameCache(window, rawFrame, minimumSize);
|
|
235
|
-
if (nextFrame && (nextFrame.width !== rawFrame.width || nextFrame.height !== rawFrame.height)) {
|
|
236
|
-
window.setFrame(nextFrame.x, nextFrame.y, nextFrame.width, nextFrame.height);
|
|
237
|
-
}
|
|
238
|
-
return nextFrame;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
138
|
function setCurrentConfig(nextConfig: AppConfig): void {
|
|
242
139
|
currentConfig = syncActiveLayout(nextConfig);
|
|
243
140
|
syncConfigAccessors();
|
|
244
141
|
}
|
|
245
142
|
|
|
246
|
-
function normalizeHttpFetchHeaders(headers: unknown): Record<string, string> {
|
|
247
|
-
if (!headers || typeof headers !== "object" || Array.isArray(headers)) {
|
|
248
|
-
return {};
|
|
249
|
-
}
|
|
250
|
-
return Object.fromEntries(
|
|
251
|
-
Object.entries(headers as Record<string, unknown>)
|
|
252
|
-
.filter((entry): entry is [string, string] => typeof entry[1] === "string"),
|
|
253
|
-
);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
function normalizeText(value: unknown): string | undefined {
|
|
257
|
-
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
function playNotificationSound(sound: string | undefined): void {
|
|
261
|
-
if (!sound) return;
|
|
262
|
-
const command = buildSoundCommand(sound);
|
|
263
|
-
if (!command) return;
|
|
264
|
-
try {
|
|
265
|
-
const child = Bun.spawn([command.command, ...command.args], { stdio: ["ignore", "ignore", "ignore"] });
|
|
266
|
-
child.unref();
|
|
267
|
-
} catch (error) {
|
|
268
|
-
console.warn("notification sound failed", {
|
|
269
|
-
command: command.command,
|
|
270
|
-
message: error instanceof Error ? error.message : String(error),
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
function desktopReleasePlatformPrefix(channel: string): string {
|
|
276
|
-
const os = process.platform === "darwin" ? "macos" : process.platform === "win32" ? "win" : "linux";
|
|
277
|
-
const arch = process.arch === "arm64" ? "arm64" : "x64";
|
|
278
|
-
return `${channel}-${os}-${arch}`;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
async function desktopReleaseInfo(updateInfo: {
|
|
282
|
-
version?: string;
|
|
283
|
-
hash?: string;
|
|
284
|
-
}, currentVersion: string): Promise<ReleaseInfo> {
|
|
285
|
-
const [channel, baseUrl] = await Promise.all([
|
|
286
|
-
Electrobun.Updater.localInfo.channel(),
|
|
287
|
-
Electrobun.Updater.localInfo.baseUrl(),
|
|
288
|
-
]);
|
|
289
|
-
const version = updateInfo.version || currentVersion;
|
|
290
|
-
return {
|
|
291
|
-
version,
|
|
292
|
-
tagName: `v${version}`,
|
|
293
|
-
downloadUrl: `${baseUrl.replace(/\/+$/, "")}/${desktopReleasePlatformPrefix(channel)}-update.json`,
|
|
294
|
-
publishedAt: "",
|
|
295
|
-
updateAction: { kind: "desktop" },
|
|
296
|
-
};
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function mapDesktopUpdateStatus(entry: UpdateStatusEntry): UpdateProgress | null {
|
|
300
|
-
const progress = entry.details?.progress;
|
|
301
|
-
switch (entry.status) {
|
|
302
|
-
case "downloading":
|
|
303
|
-
case "download-starting":
|
|
304
|
-
case "checking-local-tar":
|
|
305
|
-
case "local-tar-found":
|
|
306
|
-
case "local-tar-missing":
|
|
307
|
-
case "fetching-patch":
|
|
308
|
-
case "patch-found":
|
|
309
|
-
case "patch-not-found":
|
|
310
|
-
case "downloading-patch":
|
|
311
|
-
case "downloading-full-bundle":
|
|
312
|
-
case "download-progress":
|
|
313
|
-
return {
|
|
314
|
-
phase: "downloading",
|
|
315
|
-
percent: typeof progress === "number" ? progress : undefined,
|
|
316
|
-
};
|
|
317
|
-
case "applying-patch":
|
|
318
|
-
case "patch-applied":
|
|
319
|
-
case "extracting-version":
|
|
320
|
-
case "patch-chain-complete":
|
|
321
|
-
case "decompressing":
|
|
322
|
-
case "download-complete":
|
|
323
|
-
case "applying":
|
|
324
|
-
case "extracting":
|
|
325
|
-
case "replacing-app":
|
|
326
|
-
case "launching-new-version":
|
|
327
|
-
return { phase: "replacing" };
|
|
328
|
-
case "complete":
|
|
329
|
-
return { phase: "done", message: "Update installed, restarting..." };
|
|
330
|
-
case "error":
|
|
331
|
-
return {
|
|
332
|
-
phase: "error",
|
|
333
|
-
error: entry.details?.errorMessage || entry.message,
|
|
334
|
-
};
|
|
335
|
-
default:
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
|
|
340
143
|
function sendUpdateProgress(rpc: DesktopRpc, progress: UpdateProgress): void {
|
|
341
144
|
try {
|
|
342
145
|
rpc.send["update.progress"]({
|
|
343
|
-
progress: encodeRpcValue(progress),
|
|
146
|
+
progress: encodeRpcValue(progress) as UpdateProgress,
|
|
344
147
|
});
|
|
345
148
|
} catch (error) {
|
|
346
149
|
console.warn("update progress send failed", summarizeError(error));
|
|
347
150
|
}
|
|
348
151
|
}
|
|
349
152
|
|
|
350
|
-
async function checkDesktopUpdate(currentVersion: string): Promise<UpdateCheckResult> {
|
|
351
|
-
try {
|
|
352
|
-
const [channel, baseUrl] = await Promise.all([
|
|
353
|
-
Electrobun.Updater.localInfo.channel(),
|
|
354
|
-
Electrobun.Updater.localInfo.baseUrl(),
|
|
355
|
-
]);
|
|
356
|
-
if (channel === "dev" || !baseUrl) {
|
|
357
|
-
return { kind: "disabled" };
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
const info = await Electrobun.Updater.checkForUpdate();
|
|
361
|
-
if (info.error) {
|
|
362
|
-
return { kind: "error", error: info.error };
|
|
363
|
-
}
|
|
364
|
-
if (!info.updateAvailable) {
|
|
365
|
-
return { kind: "current" };
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
return {
|
|
369
|
-
kind: "available",
|
|
370
|
-
release: await desktopReleaseInfo(info, currentVersion),
|
|
371
|
-
};
|
|
372
|
-
} catch (error) {
|
|
373
|
-
return {
|
|
374
|
-
kind: "error",
|
|
375
|
-
error: error instanceof Error ? error.message : "Desktop update check failed",
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
153
|
async function runDesktopUpdate(rpc: DesktopRpc, currentVersion: string): Promise<void> {
|
|
381
|
-
|
|
382
|
-
sendUpdateProgress(rpc, {
|
|
383
|
-
phase: "error",
|
|
384
|
-
error: "A desktop update is already in progress.",
|
|
385
|
-
});
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
desktopUpdateInProgress = true;
|
|
390
|
-
Electrobun.Updater.clearStatusHistory();
|
|
391
|
-
Electrobun.Updater.onStatusChange((entry) => {
|
|
392
|
-
const progress = mapDesktopUpdateStatus(entry);
|
|
393
|
-
if (progress) sendUpdateProgress(rpc, progress);
|
|
394
|
-
});
|
|
395
|
-
|
|
396
|
-
try {
|
|
397
|
-
sendUpdateProgress(rpc, { phase: "downloading", percent: 0 });
|
|
398
|
-
const result = await checkDesktopUpdate(currentVersion);
|
|
399
|
-
if (result.kind === "error") {
|
|
400
|
-
sendUpdateProgress(rpc, { phase: "error", error: result.error });
|
|
401
|
-
return;
|
|
402
|
-
}
|
|
403
|
-
if (result.kind !== "available") {
|
|
404
|
-
sendUpdateProgress(rpc, {
|
|
405
|
-
phase: "done",
|
|
406
|
-
message: result.kind === "disabled" ? "Desktop updates are unavailable in this build" : "Already on the latest version",
|
|
407
|
-
});
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
await Electrobun.Updater.downloadUpdate();
|
|
412
|
-
const updateInfo = Electrobun.Updater.updateInfo();
|
|
413
|
-
if (updateInfo?.error) {
|
|
414
|
-
sendUpdateProgress(rpc, { phase: "error", error: updateInfo.error });
|
|
415
|
-
return;
|
|
416
|
-
}
|
|
417
|
-
if (!updateInfo?.updateReady) {
|
|
418
|
-
sendUpdateProgress(rpc, { phase: "error", error: "Desktop update did not finish downloading." });
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
sendUpdateProgress(rpc, { phase: "replacing" });
|
|
423
|
-
await Electrobun.Updater.applyUpdate();
|
|
424
|
-
} catch (error) {
|
|
425
|
-
sendUpdateProgress(rpc, {
|
|
426
|
-
phase: "error",
|
|
427
|
-
error: error instanceof Error ? error.message : "Desktop update failed",
|
|
428
|
-
});
|
|
429
|
-
} finally {
|
|
430
|
-
desktopUpdateInProgress = false;
|
|
431
|
-
Electrobun.Updater.onStatusChange(null);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
interface PluginStateBackendSetEntry {
|
|
436
|
-
pluginId: string;
|
|
437
|
-
key: string;
|
|
438
|
-
value: unknown;
|
|
439
|
-
schemaVersion?: number;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
function normalizePluginStateSetEntry(entry: unknown): PluginStateBackendSetEntry | null {
|
|
443
|
-
if (!entry || typeof entry !== "object") return null;
|
|
444
|
-
const record = entry as Record<string, unknown>;
|
|
445
|
-
if (typeof record.pluginId !== "string" || typeof record.key !== "string") return null;
|
|
446
|
-
return {
|
|
447
|
-
pluginId: record.pluginId,
|
|
448
|
-
key: record.key,
|
|
449
|
-
value: record.value,
|
|
450
|
-
schemaVersion: typeof record.schemaVersion === "number" ? record.schemaVersion : undefined,
|
|
451
|
-
};
|
|
154
|
+
await runElectrobunDesktopUpdate(currentVersion, (progress) => sendUpdateProgress(rpc, progress));
|
|
452
155
|
}
|
|
453
156
|
|
|
454
|
-
function syncBackendCloudAuthState(pluginId: string, key: string, value: unknown): void {
|
|
455
|
-
if (pluginId !== "gloomberb-cloud" || (key !== "session" && key !== "resume:session")) return;
|
|
456
|
-
|
|
457
|
-
const session = value && typeof value === "object" ? value as PersistedCloudSession : null;
|
|
458
|
-
const token = typeof session?.sessionToken === "string" && session.sessionToken.length > 0
|
|
459
|
-
? session.sessionToken
|
|
460
|
-
: null;
|
|
461
|
-
|
|
462
|
-
apiClient.setSessionToken(token);
|
|
463
|
-
apiClient.setWebSocketToken(null);
|
|
464
|
-
apiClient.restoreCachedUser(token ? session?.user ?? null : null);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
async function handleHttpFetch(payload: Record<string, unknown>) {
|
|
468
|
-
if (typeof payload.url !== "string") {
|
|
469
|
-
throw new Error("http.fetch requires a URL.");
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
const url = new URL(payload.url);
|
|
473
|
-
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
474
|
-
throw new Error(`Unsupported http.fetch protocol: ${url.protocol}`);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
const init =
|
|
478
|
-
payload.init && typeof payload.init === "object" && !Array.isArray(payload.init)
|
|
479
|
-
? payload.init as Record<string, unknown>
|
|
480
|
-
: {};
|
|
481
|
-
const method =
|
|
482
|
-
typeof init.method === "string" && init.method.trim().length > 0
|
|
483
|
-
? init.method.trim().toUpperCase()
|
|
484
|
-
: "GET";
|
|
485
|
-
const body =
|
|
486
|
-
typeof init.body === "string" && method !== "GET" && method !== "HEAD"
|
|
487
|
-
? init.body
|
|
488
|
-
: undefined;
|
|
489
|
-
|
|
490
|
-
const response = await fetch(url, {
|
|
491
|
-
method,
|
|
492
|
-
headers: normalizeHttpFetchHeaders(init.headers),
|
|
493
|
-
body,
|
|
494
|
-
});
|
|
495
|
-
const responseHeaders: Record<string, string> = {};
|
|
496
|
-
response.headers.forEach((value, key) => {
|
|
497
|
-
responseHeaders[key] = value;
|
|
498
|
-
});
|
|
499
|
-
const setCookieHeaders = [...(response.headers.getSetCookie?.() ?? [])];
|
|
500
|
-
const fallbackSetCookie = response.headers.get("set-cookie");
|
|
501
|
-
if (fallbackSetCookie && setCookieHeaders.length === 0) {
|
|
502
|
-
setCookieHeaders.push(fallbackSetCookie);
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return {
|
|
506
|
-
status: response.status,
|
|
507
|
-
statusText: response.statusText,
|
|
508
|
-
headers: responseHeaders,
|
|
509
|
-
setCookie: setCookieHeaders,
|
|
510
|
-
body: await response.text(),
|
|
511
|
-
};
|
|
512
|
-
}
|
|
513
157
|
|
|
514
158
|
function syncConfigAccessors() {
|
|
515
159
|
if (!services || !currentConfig) return;
|
|
@@ -549,21 +193,6 @@ function syncConfigAccessors() {
|
|
|
549
193
|
configurableProvider.setConfigAccessor?.(() => currentConfig!);
|
|
550
194
|
}
|
|
551
195
|
|
|
552
|
-
function loadPluginState() {
|
|
553
|
-
const registry = requireServices().pluginRegistry;
|
|
554
|
-
const state: Record<string, Record<string, unknown>> = {};
|
|
555
|
-
for (const pluginId of registry.allPlugins.keys()) {
|
|
556
|
-
const keys = registry.persistence.pluginState.keys(pluginId);
|
|
557
|
-
if (keys.length === 0) continue;
|
|
558
|
-
state[pluginId] = {};
|
|
559
|
-
for (const key of keys) {
|
|
560
|
-
const record = registry.persistence.pluginState.get(pluginId, key);
|
|
561
|
-
if (record) state[pluginId]![key] = record.value;
|
|
562
|
-
}
|
|
563
|
-
}
|
|
564
|
-
return state;
|
|
565
|
-
}
|
|
566
|
-
|
|
567
196
|
function getSessionSnapshot(): AppSessionSnapshot | null {
|
|
568
197
|
if (!currentConfig || !services) return null;
|
|
569
198
|
const persisted = services.persistence.sessions.get<AppSessionSnapshot>(APP_SESSION_ID, APP_SESSION_SCHEMA_VERSION)?.value ?? null;
|
|
@@ -575,112 +204,27 @@ function getDesktopSnapshot(): DesktopSharedStateSnapshot | null {
|
|
|
575
204
|
}
|
|
576
205
|
|
|
577
206
|
function sendDesktopState(snapshot: DesktopSharedStateSnapshot | null = getDesktopSnapshot()): void {
|
|
578
|
-
|
|
579
|
-
const encodedSnapshot = encodeRpcValue(snapshot);
|
|
580
|
-
forEachReadyWindowRpc((rpc) => {
|
|
581
|
-
rpc.send["desktop.state"]({
|
|
582
|
-
snapshot: encodedSnapshot,
|
|
583
|
-
});
|
|
584
|
-
});
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
function sendDockPreview(preview: DesktopDockPreviewState): void {
|
|
588
|
-
if (currentDockPreview.paneId === preview.paneId && currentDockPreview.edge === preview.edge) {
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
currentDockPreview = preview;
|
|
592
|
-
const encodedPreview = encodeRpcValue(preview);
|
|
593
|
-
forEachReadyWindowRpc((rpc) => {
|
|
594
|
-
rpc.send["desktop.dockPreview"]({
|
|
595
|
-
preview: encodedPreview,
|
|
596
|
-
});
|
|
597
|
-
});
|
|
207
|
+
desktopStateBroadcaster.sendDesktopState(snapshot);
|
|
598
208
|
}
|
|
599
209
|
|
|
600
210
|
function sendThemePreview(preview: DesktopThemePreviewState): void {
|
|
601
|
-
|
|
602
|
-
currentThemePreview = preview;
|
|
603
|
-
const encodedPreview = encodeRpcValue(preview) as DesktopThemePreviewState;
|
|
604
|
-
forEachReadyWindowRpc((rpc) => {
|
|
605
|
-
rpc.send["desktop.themePreview"]({
|
|
606
|
-
preview: encodedPreview,
|
|
607
|
-
});
|
|
608
|
-
});
|
|
211
|
+
desktopStateBroadcaster.sendThemePreview(preview);
|
|
609
212
|
}
|
|
610
213
|
|
|
611
214
|
function clearDockPreview(paneId?: string): void {
|
|
612
|
-
|
|
613
|
-
sendDockPreview({ paneId: null, edge: null });
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
function disposeSubscriptionMap(map: Map<string, () => void>): void {
|
|
617
|
-
for (const unsubscribe of map.values()) {
|
|
618
|
-
try {
|
|
619
|
-
unsubscribe();
|
|
620
|
-
} catch {
|
|
621
|
-
// ignore teardown failures
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
map.clear();
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
function disposeScopedSubscriptionMap(map: Map<string, () => void>, windowKey: string): void {
|
|
628
|
-
const scopedPrefix = `${windowKey}:`;
|
|
629
|
-
for (const [id, unsubscribe] of map) {
|
|
630
|
-
if (!id.startsWith(scopedPrefix)) continue;
|
|
631
|
-
try {
|
|
632
|
-
unsubscribe();
|
|
633
|
-
} catch {
|
|
634
|
-
// ignore teardown failures
|
|
635
|
-
}
|
|
636
|
-
map.delete(id);
|
|
637
|
-
}
|
|
215
|
+
desktopStateBroadcaster.clearDockPreview(paneId);
|
|
638
216
|
}
|
|
639
217
|
|
|
640
218
|
function disposeWindowScopedResources(windowKey: string): void {
|
|
641
|
-
|
|
219
|
+
capabilityBridge.disposeWindow(windowKey);
|
|
642
220
|
}
|
|
643
221
|
|
|
644
222
|
function teardownServices(): void {
|
|
645
|
-
|
|
223
|
+
capabilityBridge.disposeAll();
|
|
646
224
|
services?.destroy();
|
|
647
225
|
services = null;
|
|
648
226
|
}
|
|
649
227
|
|
|
650
|
-
function spawnDetached(command: string[]): void {
|
|
651
|
-
const child = Bun.spawn(command, {
|
|
652
|
-
detached: true,
|
|
653
|
-
stdio: ["ignore", "ignore", "ignore"],
|
|
654
|
-
} as any);
|
|
655
|
-
child.unref();
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
function scheduleDesktopRelaunch(): void {
|
|
659
|
-
const pid = process.pid;
|
|
660
|
-
const macAppBundle = process.platform === "darwin" ? findMacAppBundle(process.execPath) : null;
|
|
661
|
-
|
|
662
|
-
if (macAppBundle) {
|
|
663
|
-
spawnDetached([
|
|
664
|
-
"sh",
|
|
665
|
-
"-c",
|
|
666
|
-
`while kill -0 ${pid} 2>/dev/null; do sleep 0.25; done; sleep 0.5; open ${shellQuote(macAppBundle)}`,
|
|
667
|
-
]);
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
|
|
671
|
-
if (process.platform === "win32") {
|
|
672
|
-
spawnDetached([process.execPath, ...process.argv.slice(1)]);
|
|
673
|
-
return;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
const args = process.argv.slice(1).map(shellQuote).join(" ");
|
|
677
|
-
spawnDetached([
|
|
678
|
-
"sh",
|
|
679
|
-
"-c",
|
|
680
|
-
`while kill -0 ${pid} 2>/dev/null; do sleep 0.25; done; cd ${shellQuote(process.cwd())}; ${shellQuote(process.execPath)}${args ? ` ${args}` : ""}`,
|
|
681
|
-
]);
|
|
682
|
-
}
|
|
683
|
-
|
|
684
228
|
function restartDesktopApp(message: DesktopRestartMessage = {}): void {
|
|
685
229
|
if (desktopRestartInProgress) return;
|
|
686
230
|
desktopRestartInProgress = true;
|
|
@@ -703,60 +247,6 @@ function restartDesktopApp(message: DesktopRestartMessage = {}): void {
|
|
|
703
247
|
Utils.quit();
|
|
704
248
|
}
|
|
705
249
|
|
|
706
|
-
function resolveDetachedWindowTitle(instanceId: string): string {
|
|
707
|
-
const instance = currentConfig ? findPaneInstance(currentConfig.layout, instanceId) : null;
|
|
708
|
-
if (!instance) return "Gloomberb";
|
|
709
|
-
return instance.title?.trim() || instance.paneId;
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
function resolveDetachedWindowFrame(instanceId: string): { x: number; y: number; width: number; height: number } {
|
|
713
|
-
const detachedEntry = requireConfig().layout.detached.find((entry) => entry.instanceId === instanceId);
|
|
714
|
-
if (detachedEntry) {
|
|
715
|
-
return normalizeWindowFrameWithMinimum({
|
|
716
|
-
x: detachedEntry.x,
|
|
717
|
-
y: detachedEntry.y,
|
|
718
|
-
width: detachedEntry.width,
|
|
719
|
-
height: detachedEntry.height,
|
|
720
|
-
}, DEFAULT_WINDOW_FRAME, DETACHED_WINDOW_MIN_SIZE);
|
|
721
|
-
}
|
|
722
|
-
const remembered = findPaneInstance(requireConfig().layout, instanceId)?.placementMemory?.detached;
|
|
723
|
-
if (remembered) {
|
|
724
|
-
return normalizeWindowFrameWithMinimum(remembered, DEFAULT_WINDOW_FRAME, DETACHED_WINDOW_MIN_SIZE);
|
|
725
|
-
}
|
|
726
|
-
const mainFrame = getWindowFrame(mainWindow) ?? DEFAULT_WINDOW_FRAME;
|
|
727
|
-
return normalizeWindowFrameWithMinimum({
|
|
728
|
-
x: mainFrame.x + 72,
|
|
729
|
-
y: mainFrame.y + 72,
|
|
730
|
-
width: Math.max(720, Math.floor(mainFrame.width * 0.45)),
|
|
731
|
-
height: Math.max(420, Math.floor(mainFrame.height * 0.5)),
|
|
732
|
-
}, DEFAULT_WINDOW_FRAME, DETACHED_WINDOW_MIN_SIZE);
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
function resolveDetachedDockEdge(frame: { x: number; y: number; width: number; height: number }): "left" | "right" | "top" | "bottom" | null {
|
|
736
|
-
const mainFrame = getWindowFrame(mainWindow);
|
|
737
|
-
if (!mainFrame) return null;
|
|
738
|
-
const threshold = 72;
|
|
739
|
-
const headerMidX = frame.x + (frame.width / 2);
|
|
740
|
-
const headerMidY = frame.y + 16;
|
|
741
|
-
const overlapsVertically = headerMidY >= mainFrame.y - 32 && headerMidY <= mainFrame.y + mainFrame.height + 32;
|
|
742
|
-
const overlapsHorizontally = headerMidX >= mainFrame.x - 32 && headerMidX <= mainFrame.x + mainFrame.width + 32;
|
|
743
|
-
|
|
744
|
-
if (overlapsVertically && Math.abs(headerMidX - mainFrame.x) <= threshold) return "left";
|
|
745
|
-
if (overlapsVertically && Math.abs(headerMidX - (mainFrame.x + mainFrame.width)) <= threshold) return "right";
|
|
746
|
-
if (overlapsHorizontally && Math.abs(headerMidY - mainFrame.y) <= threshold) return "top";
|
|
747
|
-
if (overlapsHorizontally && Math.abs(headerMidY - (mainFrame.y + mainFrame.height)) <= threshold) return "bottom";
|
|
748
|
-
return null;
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
function cleanupDetachedWindowState(instanceId: string): void {
|
|
752
|
-
disposeWindowScopedResources(detachedRpcKey(instanceId));
|
|
753
|
-
detachedWindows.delete(instanceId);
|
|
754
|
-
clearTimer(detachedFrameTimers, instanceId);
|
|
755
|
-
clearTimer(detachedDockTimers, instanceId);
|
|
756
|
-
pendingDetachedMoveFlush.delete(instanceId);
|
|
757
|
-
unregisterWindowRpc(detachedRpcKey(instanceId));
|
|
758
|
-
}
|
|
759
|
-
|
|
760
250
|
async function commitDesktopSnapshot(
|
|
761
251
|
snapshot: DesktopSharedStateSnapshot,
|
|
762
252
|
options: { persistConfig?: boolean; reconcileWindows?: boolean } = {},
|
|
@@ -775,299 +265,40 @@ async function commitDesktopSnapshot(
|
|
|
775
265
|
return requireDesktopWorkspace().getSnapshot();
|
|
776
266
|
}
|
|
777
267
|
|
|
778
|
-
function createDetachedWindow(
|
|
779
|
-
instanceId: string,
|
|
780
|
-
frame: { x: number; y: number; width: number; height: number },
|
|
781
|
-
): BrowserWindow {
|
|
782
|
-
const rpc = createWindowRpc(detachedRpcKey(instanceId));
|
|
783
|
-
const initialFrame = normalizeWindowFrameWithMinimum(frame, DEFAULT_WINDOW_FRAME, DETACHED_WINDOW_MIN_SIZE);
|
|
784
|
-
const window = new BrowserWindow({
|
|
785
|
-
title: resolveDetachedWindowTitle(instanceId),
|
|
786
|
-
frame: initialFrame,
|
|
787
|
-
url: "views://mainview/index.html",
|
|
788
|
-
renderer: "native",
|
|
789
|
-
rpc,
|
|
790
|
-
titleBarStyle: "hiddenInset",
|
|
791
|
-
navigationRules: JSON.stringify(["views://*"]),
|
|
792
|
-
sandbox: false,
|
|
793
|
-
});
|
|
794
|
-
updateWindowFrameCache(window, initialFrame, DETACHED_WINDOW_MIN_SIZE);
|
|
795
|
-
detachedWindows.set(instanceId, window);
|
|
796
|
-
|
|
797
|
-
(window as any).on?.("close", () => {
|
|
798
|
-
const shouldIgnore = detachedClosingPanes.delete(instanceId);
|
|
799
|
-
cleanupDetachedWindowState(instanceId);
|
|
800
|
-
if (shouldIgnore || !desktopWorkspace || !currentConfig || !isPaneDetached(currentConfig.layout, instanceId)) {
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
void commitDesktopSnapshot(requireDesktopWorkspace().closeDetachedPane(instanceId));
|
|
804
|
-
});
|
|
805
|
-
|
|
806
|
-
(window as any).on?.("move", (event: WindowMoveEvent) => {
|
|
807
|
-
applyWindowMoveEvent(window, event);
|
|
808
|
-
scheduleDetachedWindowMove(instanceId);
|
|
809
|
-
});
|
|
810
|
-
(window as any).on?.("resize", (event: WindowResizeEvent) => {
|
|
811
|
-
applyWindowResizeEvent(window, event, DETACHED_WINDOW_MIN_SIZE);
|
|
812
|
-
scheduleDetachedWindowMove(instanceId);
|
|
813
|
-
});
|
|
814
|
-
|
|
815
|
-
return window;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
function scheduleDetachedWindowMove(instanceId: string): void {
|
|
819
|
-
if (pendingDetachedMoveFlush.has(instanceId)) return;
|
|
820
|
-
pendingDetachedMoveFlush.add(instanceId);
|
|
821
|
-
setTimeout(() => {
|
|
822
|
-
pendingDetachedMoveFlush.delete(instanceId);
|
|
823
|
-
handleDetachedWindowMove(instanceId);
|
|
824
|
-
}, 0);
|
|
825
|
-
}
|
|
826
|
-
|
|
827
268
|
function reconcileDetachedWindows(): void {
|
|
828
|
-
|
|
829
|
-
if (!config) return;
|
|
830
|
-
|
|
831
|
-
const desiredEntries = new Map(config.layout.detached.map((entry) => [entry.instanceId, entry] as const));
|
|
832
|
-
for (const [instanceId, entry] of desiredEntries) {
|
|
833
|
-
const existingWindow = detachedWindows.get(instanceId);
|
|
834
|
-
if (!existingWindow) {
|
|
835
|
-
createDetachedWindow(instanceId, entry);
|
|
836
|
-
continue;
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
const currentFrame = getWindowFrame(existingWindow);
|
|
840
|
-
const hasLiveFrameUpdate = pendingDetachedMoveFlush.has(instanceId)
|
|
841
|
-
|| detachedFrameTimers.has(instanceId)
|
|
842
|
-
|| detachedDockTimers.has(instanceId);
|
|
843
|
-
const nextFrame = currentFrame
|
|
844
|
-
? normalizeWindowFrameWithMinimum(entry, currentFrame, DETACHED_WINDOW_MIN_SIZE)
|
|
845
|
-
: null;
|
|
846
|
-
if (!hasLiveFrameUpdate
|
|
847
|
-
&& currentFrame
|
|
848
|
-
&& nextFrame
|
|
849
|
-
&& (currentFrame.x !== nextFrame.x
|
|
850
|
-
|| currentFrame.y !== nextFrame.y
|
|
851
|
-
|| currentFrame.width !== nextFrame.width
|
|
852
|
-
|| currentFrame.height !== nextFrame.height)) {
|
|
853
|
-
existingWindow.setFrame(nextFrame.x, nextFrame.y, nextFrame.width, nextFrame.height);
|
|
854
|
-
}
|
|
855
|
-
(existingWindow as any).setTitle?.(resolveDetachedWindowTitle(instanceId));
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
for (const [instanceId, window] of detachedWindows) {
|
|
859
|
-
if (desiredEntries.has(instanceId)) continue;
|
|
860
|
-
detachedClosingPanes.add(instanceId);
|
|
861
|
-
cleanupDetachedWindowState(instanceId);
|
|
862
|
-
(window as any).close?.();
|
|
863
|
-
}
|
|
269
|
+
detachedWindowManager.reconcile();
|
|
864
270
|
}
|
|
865
271
|
|
|
866
272
|
function closeAllDetachedWindows(): void {
|
|
867
|
-
|
|
868
|
-
detachedClosingPanes.add(instanceId);
|
|
869
|
-
cleanupDetachedWindowState(instanceId);
|
|
870
|
-
(window as any).close?.();
|
|
871
|
-
}
|
|
872
|
-
currentDockPreview = { paneId: null, edge: null };
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
function handleDetachedWindowMove(
|
|
876
|
-
instanceId: string,
|
|
877
|
-
): void {
|
|
878
|
-
const window = detachedWindows.get(instanceId);
|
|
879
|
-
if (!window || !desktopWorkspace || !currentConfig || !isPaneDetached(currentConfig.layout, instanceId)) {
|
|
880
|
-
return;
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
const frame = getWindowFrame(window);
|
|
884
|
-
if (!frame) return;
|
|
885
|
-
const edge = resolveDetachedDockEdge(frame);
|
|
886
|
-
|
|
887
|
-
clearTimer(detachedFrameTimers, instanceId);
|
|
888
|
-
detachedFrameTimers.set(instanceId, setTimeout(() => {
|
|
889
|
-
detachedFrameTimers.delete(instanceId);
|
|
890
|
-
if (!currentConfig || !desktopWorkspace || !isPaneDetached(currentConfig.layout, instanceId)) return;
|
|
891
|
-
void commitDesktopSnapshot(
|
|
892
|
-
requireDesktopWorkspace().updateDetachedFrame(instanceId, frame),
|
|
893
|
-
{ reconcileWindows: false },
|
|
894
|
-
);
|
|
895
|
-
}, 120));
|
|
896
|
-
|
|
897
|
-
clearTimer(detachedDockTimers, instanceId);
|
|
898
|
-
if (!edge) {
|
|
899
|
-
clearDockPreview(instanceId);
|
|
900
|
-
return;
|
|
901
|
-
}
|
|
902
|
-
|
|
903
|
-
sendDockPreview({ paneId: instanceId, edge });
|
|
904
|
-
detachedDockTimers.set(instanceId, setTimeout(() => {
|
|
905
|
-
detachedDockTimers.delete(instanceId);
|
|
906
|
-
if (!currentConfig || !desktopWorkspace || !isPaneDetached(currentConfig.layout, instanceId)) return;
|
|
907
|
-
if (currentDockPreview.paneId !== instanceId || currentDockPreview.edge !== edge) return;
|
|
908
|
-
clearDockPreview(instanceId);
|
|
909
|
-
void commitDesktopSnapshot(requireDesktopWorkspace().dockDetachedPane(instanceId, edge));
|
|
910
|
-
}, 120));
|
|
273
|
+
detachedWindowManager.closeAll();
|
|
911
274
|
}
|
|
912
275
|
|
|
913
276
|
async function initialize(
|
|
914
277
|
rpc: DesktopRpc,
|
|
915
278
|
payload: Record<string, unknown>,
|
|
916
279
|
) {
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
}
|
|
939
|
-
if (!existsSync(dataDir)) {
|
|
940
|
-
mkdirSync(dataDir, { recursive: true });
|
|
941
|
-
}
|
|
942
|
-
|
|
943
|
-
setCurrentConfig(await initDataDir(dataDir));
|
|
944
|
-
services = createAppServices({ config: requireConfig(), externalPlugins: [] });
|
|
945
|
-
syncConfigAccessors();
|
|
946
|
-
registerCoreCapabilities();
|
|
947
|
-
desktopWorkspace = createDesktopWorkspace(requireConfig(), getSessionSnapshot());
|
|
948
|
-
|
|
949
|
-
reconcileDetachedWindows();
|
|
950
|
-
|
|
951
|
-
return {
|
|
952
|
-
config: requireConfig(),
|
|
953
|
-
sessionSnapshot: getSessionSnapshot(),
|
|
954
|
-
desktopSnapshot: getDesktopSnapshot(),
|
|
955
|
-
desktopThemePreview: currentThemePreview,
|
|
956
|
-
pluginState: loadPluginState(),
|
|
957
|
-
capabilityManifests: requireServices().pluginRegistry.capabilities.manifests({ rendererOnly: true }),
|
|
958
|
-
windowKind: windowTarget.kind,
|
|
959
|
-
paneId: windowTarget.paneId,
|
|
960
|
-
};
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
async function handleDesktop(
|
|
964
|
-
rpc: DesktopRpc,
|
|
965
|
-
method: string,
|
|
966
|
-
payload: Record<string, unknown>,
|
|
967
|
-
) {
|
|
968
|
-
const workspace = requireDesktopWorkspace();
|
|
969
|
-
switch (method) {
|
|
970
|
-
case "desktop.syncMainState": {
|
|
971
|
-
const snapshot = workspace.syncMainState(payload.snapshot as DesktopSharedStateSnapshot);
|
|
972
|
-
setCurrentConfig(snapshot.config);
|
|
973
|
-
reconcileDetachedWindows();
|
|
974
|
-
sendDesktopState(snapshot);
|
|
975
|
-
return null;
|
|
976
|
-
}
|
|
977
|
-
case "desktop.setThemePreview":
|
|
978
|
-
sendThemePreview((payload.preview ?? { theme: null }) as DesktopThemePreviewState);
|
|
979
|
-
return null;
|
|
980
|
-
case "desktop.replaceDetachedPaneState":
|
|
981
|
-
if (typeof payload.paneId !== "string") {
|
|
982
|
-
throw new Error("desktop.replaceDetachedPaneState requires paneId.");
|
|
983
|
-
}
|
|
984
|
-
sendDesktopState(workspace.replaceDetachedPaneState(payload.paneId, payload.paneState as PaneRuntimeState));
|
|
985
|
-
return null;
|
|
986
|
-
case "desktop.popOutPane": {
|
|
987
|
-
if (typeof payload.paneId !== "string") {
|
|
988
|
-
throw new Error("desktop.popOutPane requires paneId.");
|
|
989
|
-
}
|
|
990
|
-
const snapshot = workspace.popOutPane(payload.paneId, resolveDetachedWindowFrame(payload.paneId));
|
|
991
|
-
await commitDesktopSnapshot(snapshot);
|
|
992
|
-
focusWindowForRpcKey(detachedRpcKey(payload.paneId), mainWindow, detachedWindows);
|
|
993
|
-
return null;
|
|
994
|
-
}
|
|
995
|
-
case "desktop.dockDetachedPane": {
|
|
996
|
-
if (typeof payload.paneId !== "string") {
|
|
997
|
-
throw new Error("desktop.dockDetachedPane requires paneId.");
|
|
998
|
-
}
|
|
999
|
-
clearDockPreview(payload.paneId);
|
|
1000
|
-
await commitDesktopSnapshot(
|
|
1001
|
-
workspace.dockDetachedPane(
|
|
1002
|
-
payload.paneId,
|
|
1003
|
-
payload.edge === "left" || payload.edge === "right" || payload.edge === "top" || payload.edge === "bottom"
|
|
1004
|
-
? payload.edge
|
|
1005
|
-
: undefined,
|
|
1006
|
-
),
|
|
1007
|
-
);
|
|
1008
|
-
return null;
|
|
1009
|
-
}
|
|
1010
|
-
case "desktop.closeDetachedPane": {
|
|
1011
|
-
if (typeof payload.paneId !== "string") {
|
|
1012
|
-
throw new Error("desktop.closeDetachedPane requires paneId.");
|
|
1013
|
-
}
|
|
1014
|
-
clearDockPreview(payload.paneId);
|
|
1015
|
-
await commitDesktopSnapshot(workspace.closeDetachedPane(payload.paneId));
|
|
1016
|
-
return null;
|
|
1017
|
-
}
|
|
1018
|
-
case "desktop.focusDetachedPane":
|
|
1019
|
-
if (typeof payload.paneId !== "string") {
|
|
1020
|
-
throw new Error("desktop.focusDetachedPane requires paneId.");
|
|
1021
|
-
}
|
|
1022
|
-
focusWindowForRpcKey(detachedRpcKey(payload.paneId), mainWindow, detachedWindows);
|
|
1023
|
-
return null;
|
|
1024
|
-
default:
|
|
1025
|
-
throw new Error(`Unknown desktop method: ${method}`);
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
async function handleCapability(
|
|
1030
|
-
rpc: DesktopRpc,
|
|
1031
|
-
method: string,
|
|
1032
|
-
payload: Record<string, unknown>,
|
|
1033
|
-
) {
|
|
1034
|
-
const registry = requireServices().pluginRegistry.capabilities;
|
|
1035
|
-
switch (method) {
|
|
1036
|
-
case "capability.invoke":
|
|
1037
|
-
return registry.invoke(
|
|
1038
|
-
payload.capabilityId as string,
|
|
1039
|
-
payload.operationId as string,
|
|
1040
|
-
payload.payload,
|
|
1041
|
-
{ renderer: true },
|
|
1042
|
-
);
|
|
1043
|
-
case "capability.subscribe": {
|
|
1044
|
-
const clientSubscriptionId = payload.subscriptionId as string;
|
|
1045
|
-
const scopedSubscriptionId = scopeClientId(rpc, clientSubscriptionId);
|
|
1046
|
-
capabilitySubscriptions.get(scopedSubscriptionId)?.();
|
|
1047
|
-
await registry.subscribe(
|
|
1048
|
-
payload.capabilityId as string,
|
|
1049
|
-
payload.operationId as string,
|
|
1050
|
-
payload.payload,
|
|
1051
|
-
(event) => {
|
|
1052
|
-
rpc.send["capability.event"]({
|
|
1053
|
-
subscriptionId: clientSubscriptionId,
|
|
1054
|
-
event: encodeRpcValue(event),
|
|
1055
|
-
});
|
|
1056
|
-
},
|
|
1057
|
-
{ renderer: true, subscriptionId: scopedSubscriptionId },
|
|
1058
|
-
);
|
|
1059
|
-
capabilitySubscriptions.set(scopedSubscriptionId, () => registry.unsubscribe(scopedSubscriptionId));
|
|
1060
|
-
return null;
|
|
1061
|
-
}
|
|
1062
|
-
case "capability.unsubscribe": {
|
|
1063
|
-
const scopedSubscriptionId = scopeClientId(rpc, payload.subscriptionId as string);
|
|
1064
|
-
capabilitySubscriptions.get(scopedSubscriptionId)?.();
|
|
1065
|
-
capabilitySubscriptions.delete(scopedSubscriptionId);
|
|
1066
|
-
return null;
|
|
1067
|
-
}
|
|
1068
|
-
default:
|
|
1069
|
-
throw new Error(`Unknown capability method: ${method}`);
|
|
1070
|
-
}
|
|
280
|
+
return initializeDesktopBackend({
|
|
281
|
+
getCurrentConfig: () => currentConfig,
|
|
282
|
+
getCurrentServices: () => services,
|
|
283
|
+
getDesktopSnapshot,
|
|
284
|
+
getDesktopWorkspace: () => desktopWorkspace,
|
|
285
|
+
getRpcWindowKey,
|
|
286
|
+
getSessionSnapshot,
|
|
287
|
+
getThemePreview: () => desktopStateBroadcaster.currentThemePreview,
|
|
288
|
+
markWindowRpcReady,
|
|
289
|
+
payload,
|
|
290
|
+
reconcileDetachedWindows,
|
|
291
|
+
registerCoreCapabilities,
|
|
292
|
+
rpc,
|
|
293
|
+
setCurrentConfig,
|
|
294
|
+
setDesktopWorkspace: (workspace) => {
|
|
295
|
+
desktopWorkspace = workspace;
|
|
296
|
+
},
|
|
297
|
+
setServices: (nextServices) => {
|
|
298
|
+
services = nextServices;
|
|
299
|
+
},
|
|
300
|
+
syncConfigAccessors,
|
|
301
|
+
});
|
|
1071
302
|
}
|
|
1072
303
|
|
|
1073
304
|
async function handleBackendRequest(
|
|
@@ -1079,143 +310,76 @@ async function handleBackendRequest(
|
|
|
1079
310
|
|
|
1080
311
|
if (method === "init") return initialize(rpc, payload);
|
|
1081
312
|
if (method === "http.fetch") return handleHttpFetch(payload);
|
|
1082
|
-
if (method.startsWith("capability.")) return
|
|
1083
|
-
if (method.startsWith("desktop."))
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
)
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
case "ticker.delete":
|
|
1105
|
-
return requireServices().tickerRepository.deleteTicker(payload.symbol as string);
|
|
1106
|
-
case "config.save":
|
|
1107
|
-
setCurrentConfig(payload.config as AppConfig);
|
|
1108
|
-
if (desktopWorkspace) {
|
|
1109
|
-
await commitDesktopSnapshot(desktopWorkspace.replaceConfig(requireConfig(), { layoutChanged: true }));
|
|
1110
|
-
return null;
|
|
1111
|
-
}
|
|
1112
|
-
return saveConfig(requireConfig());
|
|
1113
|
-
case "config.resetAllData":
|
|
1114
|
-
closeAllDetachedWindows();
|
|
1115
|
-
desktopWorkspace = null;
|
|
1116
|
-
teardownServices();
|
|
1117
|
-
currentConfig = null;
|
|
1118
|
-
return resetAllData(payload.dataDir as string);
|
|
1119
|
-
case "config.export":
|
|
1120
|
-
return exportConfig(payload.config as AppConfig, payload.destPath as string);
|
|
1121
|
-
case "config.import":
|
|
1122
|
-
closeAllDetachedWindows();
|
|
1123
|
-
desktopWorkspace = null;
|
|
1124
|
-
teardownServices();
|
|
1125
|
-
setCurrentConfig(await importConfig(payload.dataDir as string, payload.srcPath as string));
|
|
1126
|
-
services = createAppServices({ config: requireConfig(), externalPlugins: [] });
|
|
1127
|
-
syncConfigAccessors();
|
|
1128
|
-
registerCoreCapabilities();
|
|
1129
|
-
desktopWorkspace = createDesktopWorkspace(requireConfig(), getSessionSnapshot());
|
|
1130
|
-
reconcileDetachedWindows();
|
|
1131
|
-
sendDesktopState(requireDesktopWorkspace().getSnapshot());
|
|
1132
|
-
return requireConfig();
|
|
1133
|
-
case "session.set":
|
|
1134
|
-
requireServices().persistence.sessions.set(payload.sessionId as string, payload.value, payload.schemaVersion as number | undefined);
|
|
1135
|
-
return null;
|
|
1136
|
-
case "session.delete":
|
|
1137
|
-
requireServices().persistence.sessions.delete(payload.sessionId as string);
|
|
1138
|
-
return null;
|
|
1139
|
-
case "pluginState.set":
|
|
1140
|
-
requireServices().persistence.pluginState.set(payload.pluginId as string, payload.key as string, payload.value, payload.schemaVersion as number | undefined);
|
|
1141
|
-
syncBackendCloudAuthState(payload.pluginId as string, payload.key as string, payload.value);
|
|
1142
|
-
return null;
|
|
1143
|
-
case "pluginState.setMany": {
|
|
1144
|
-
const entries = Array.isArray(payload.entries)
|
|
1145
|
-
? payload.entries.flatMap((entry) => {
|
|
1146
|
-
const normalized = normalizePluginStateSetEntry(entry);
|
|
1147
|
-
return normalized ? [normalized] : [];
|
|
1148
|
-
})
|
|
1149
|
-
: [];
|
|
1150
|
-
requireServices().persistence.pluginState.setMany(entries);
|
|
1151
|
-
for (const entry of entries) {
|
|
1152
|
-
syncBackendCloudAuthState(entry.pluginId, entry.key, entry.value);
|
|
1153
|
-
}
|
|
1154
|
-
return null;
|
|
1155
|
-
}
|
|
1156
|
-
case "pluginState.delete":
|
|
1157
|
-
requireServices().persistence.pluginState.delete(payload.pluginId as string, payload.key as string);
|
|
1158
|
-
syncBackendCloudAuthState(payload.pluginId as string, payload.key as string, null);
|
|
1159
|
-
return null;
|
|
1160
|
-
case "host.restart":
|
|
1161
|
-
restartDesktopApp({
|
|
1162
|
-
reason: typeof payload.reason === "string" ? payload.reason : undefined,
|
|
1163
|
-
source: typeof payload.source === "string" ? payload.source : "backend-request",
|
|
1164
|
-
});
|
|
1165
|
-
return null;
|
|
1166
|
-
case "host.exit":
|
|
1167
|
-
closeAllDetachedWindows();
|
|
1168
|
-
teardownServices();
|
|
1169
|
-
if (mainWindow) {
|
|
1170
|
-
mainWindow.close();
|
|
313
|
+
if (method.startsWith("capability.")) return capabilityBridge.handle(rpc, method, payload);
|
|
314
|
+
if (method.startsWith("desktop.")) {
|
|
315
|
+
return handleDesktopWorkspaceRequest({
|
|
316
|
+
workspace: requireDesktopWorkspace(),
|
|
317
|
+
method,
|
|
318
|
+
payload,
|
|
319
|
+
setCurrentConfig,
|
|
320
|
+
sendThemePreview,
|
|
321
|
+
clearDockPreview,
|
|
322
|
+
sendDesktopState,
|
|
323
|
+
reconcileDetachedWindows,
|
|
324
|
+
commitDesktopSnapshot,
|
|
325
|
+
resolveDetachedFrame: (paneId) => detachedWindowManager.resolveFrame(paneId),
|
|
326
|
+
focusDetachedPane: (paneId) => detachedWindowManager.focusDetachedPane(paneId),
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
if (method.startsWith("pluginState.")) {
|
|
330
|
+
return handleDesktopPluginStateRequest(requireServices().persistence.pluginState, method, payload);
|
|
331
|
+
}
|
|
332
|
+
if (method.startsWith("host.")) {
|
|
333
|
+
return handleDesktopHostRequest({
|
|
334
|
+
clearMainWindow: () => {
|
|
1171
335
|
mainWindow = null;
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
Utils.clipboardWriteText(normalizeText(payload.text) ?? "");
|
|
1184
|
-
return null;
|
|
1185
|
-
case "host.focusWindow":
|
|
1186
|
-
focusWindowForRpcKey(getRpcWindowKey(rpc), mainWindow, detachedWindows);
|
|
1187
|
-
return null;
|
|
1188
|
-
case "host.copyPngImage": {
|
|
1189
|
-
const pngBase64 = normalizeText(payload.pngBase64);
|
|
1190
|
-
if (!pngBase64) throw new Error("host.copyPngImage requires PNG data.");
|
|
1191
|
-
Utils.clipboardWriteImage(new Uint8Array(Buffer.from(pngBase64, "base64")));
|
|
1192
|
-
return null;
|
|
1193
|
-
}
|
|
1194
|
-
case "host.readText":
|
|
1195
|
-
return Utils.clipboardReadText() ?? "";
|
|
1196
|
-
case "host.notify":
|
|
1197
|
-
playNotificationSound(normalizeText(payload.sound));
|
|
1198
|
-
Utils.showNotification({
|
|
1199
|
-
title: normalizeText(payload.title) ?? "Gloomberb",
|
|
1200
|
-
body: normalizeText(payload.body),
|
|
1201
|
-
subtitle: normalizeText(payload.subtitle),
|
|
1202
|
-
silent: true,
|
|
1203
|
-
});
|
|
1204
|
-
return null;
|
|
1205
|
-
case "host.showContextMenu": {
|
|
1206
|
-
const menu = normalizeContextMenuItems(payload.menu);
|
|
1207
|
-
if (menu.length === 0) return false;
|
|
1208
|
-
const requestId = getContextMenuRequestId(menu);
|
|
1209
|
-
if (requestId) {
|
|
336
|
+
},
|
|
337
|
+
closeAllDetachedWindows,
|
|
338
|
+
focusWindowForRpcKey: (windowKey) => detachedWindowManager.focusWindowForRpcKey(windowKey),
|
|
339
|
+
getMainWindow: () => mainWindow,
|
|
340
|
+
getRpcWindowKey,
|
|
341
|
+
method,
|
|
342
|
+
payload,
|
|
343
|
+
restartDesktopApp,
|
|
344
|
+
rpc,
|
|
345
|
+
teardownServices,
|
|
346
|
+
trackContextMenuRequest: (requestId, targetRpc) => {
|
|
1210
347
|
contextMenuRequestRpcs.clear();
|
|
1211
|
-
contextMenuRequestRpcs.set(requestId,
|
|
1212
|
-
}
|
|
1213
|
-
|
|
1214
|
-
return true;
|
|
1215
|
-
}
|
|
1216
|
-
default:
|
|
1217
|
-
throw new Error(`Unknown backend method: ${method}`);
|
|
348
|
+
contextMenuRequestRpcs.set(requestId, targetRpc);
|
|
349
|
+
},
|
|
350
|
+
});
|
|
1218
351
|
}
|
|
352
|
+
|
|
353
|
+
const backendResult = await handleDesktopBackendRequest({
|
|
354
|
+
clearCurrentConfig: () => {
|
|
355
|
+
currentConfig = null;
|
|
356
|
+
},
|
|
357
|
+
closeAllDetachedWindows,
|
|
358
|
+
commitDesktopSnapshot,
|
|
359
|
+
getConfig: requireConfig,
|
|
360
|
+
getDesktopWorkspace: () => desktopWorkspace,
|
|
361
|
+
getServices: requireServices,
|
|
362
|
+
getSessionSnapshot,
|
|
363
|
+
method,
|
|
364
|
+
payload,
|
|
365
|
+
reconcileDetachedWindows,
|
|
366
|
+
registerCoreCapabilities,
|
|
367
|
+
sendDesktopState,
|
|
368
|
+
setCurrentConfig,
|
|
369
|
+
setDesktopWorkspace: (workspace) => {
|
|
370
|
+
desktopWorkspace = workspace;
|
|
371
|
+
},
|
|
372
|
+
setServices: (nextServices) => {
|
|
373
|
+
services = nextServices;
|
|
374
|
+
},
|
|
375
|
+
startUpdate: (currentVersion) => {
|
|
376
|
+
void runDesktopUpdate(rpc, currentVersion);
|
|
377
|
+
},
|
|
378
|
+
syncConfigAccessors,
|
|
379
|
+
teardownServices,
|
|
380
|
+
});
|
|
381
|
+
if (backendResult.handled) return backendResult.value;
|
|
382
|
+
throw new Error(`Unknown backend method: ${method}`);
|
|
1219
383
|
}
|
|
1220
384
|
|
|
1221
385
|
function installApplicationMenu() {
|
|
@@ -1261,8 +425,8 @@ ApplicationMenu.on("application-menu-clicked", (event: unknown) => {
|
|
|
1261
425
|
openMainWindowDevTools();
|
|
1262
426
|
return;
|
|
1263
427
|
}
|
|
1264
|
-
if (!
|
|
1265
|
-
|
|
428
|
+
if (!isWindowRpcReady(MAIN_WINDOW_RPC_KEY)) return;
|
|
429
|
+
getWindowRpc(MAIN_WINDOW_RPC_KEY)?.send["application-menu.select"]({ command });
|
|
1266
430
|
});
|
|
1267
431
|
|
|
1268
432
|
installApplicationMenu();
|
|
@@ -1280,7 +444,7 @@ mainWindow = new BrowserWindow({
|
|
|
1280
444
|
sandbox: false,
|
|
1281
445
|
});
|
|
1282
446
|
updateWindowFrameCache(mainWindow, DEFAULT_WINDOW_FRAME, MAIN_WINDOW_MIN_SIZE);
|
|
1283
|
-
focusWindowForRpcKey(MAIN_WINDOW_RPC_KEY
|
|
447
|
+
detachedWindowManager.focusWindowForRpcKey(MAIN_WINDOW_RPC_KEY);
|
|
1284
448
|
(mainWindow as any).on?.("move", (event: WindowMoveEvent) => {
|
|
1285
449
|
applyWindowMoveEvent(mainWindow, event);
|
|
1286
450
|
});
|