gloomberb 0.10.4 → 0.11.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/LICENSE +1 -1
- package/README.md +30 -3
- package/README.zh-CN.md +1 -1
- package/package.json +5 -5
- package/src/api-client/auth.ts +34 -0
- package/src/api-client/data.ts +25 -0
- package/src/api-client/index.test.ts +81 -0
- package/src/api-client/index.ts +37 -0
- package/src/api-client/request.test.ts +30 -0
- package/src/api-client/request.ts +44 -20
- package/src/api-client/socket-health.test.ts +79 -0
- package/src/api-client/socket.ts +108 -5
- package/src/api-client/types.ts +139 -0
- package/src/app/global-shortcuts.test.tsx +144 -9
- package/src/app/global-shortcuts.ts +33 -11
- package/src/app/runtime/broker-import.ts +39 -5
- package/src/app/runtime/startup.ts +7 -1
- package/src/app/runtime/update.ts +26 -1
- package/src/app.tsx +36 -19
- package/src/brokers/broker-ticker-sync.ts +3 -8
- package/src/brokers/sync-broker-instance.test.ts +59 -0
- package/src/brokers/sync-broker-instance.ts +37 -13
- package/src/capabilities/chart-series.ts +318 -0
- package/src/capabilities/factories.ts +46 -0
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/registry.test.ts +135 -0
- package/src/capabilities/registry.ts +31 -4
- package/src/capabilities/types.ts +52 -0
- package/src/cli/commands/overview.ts +2 -2
- package/src/cli/desktop-pane-shot.ts +2 -0
- package/src/cli/entry.ts +11 -1
- package/src/cli/native-smoke.ts +5 -0
- package/src/cli/pane-functions/catalog.ts +4 -0
- package/src/cli/pane-functions/data.ts +6 -1
- package/src/cli/pane-functions/discovery.ts +76 -10
- package/src/cli/pane-functions/report.test.ts +76 -0
- package/src/cli/pane-functions/report.ts +7 -1
- package/src/cli/pane-functions/resolver.ts +4 -1
- package/src/cli/pane-functions/screenshot.test.ts +56 -3
- package/src/cli/pane-functions/screenshot.ts +68 -5
- package/src/components/chart/composite/composite-chart.test.tsx +54 -0
- package/src/components/chart/composite/composite-chart.tsx +92 -15
- package/src/components/chart/composite/downsample.test.ts +136 -0
- package/src/components/chart/composite/downsample.ts +208 -0
- package/src/components/chart/composite/panel-series.test.ts +66 -0
- package/src/components/chart/composite/panel-series.ts +101 -0
- package/src/components/chart/multi-line/renderer.ts +1 -0
- package/src/components/chart/native/kitty/index.test.ts +25 -3
- package/src/components/chart/native/kitty/support.ts +37 -3
- package/src/components/chart/native/use-chart-text-fallback.ts +19 -0
- package/src/components/chart/static/chart/surface.tsx +43 -12
- package/src/components/chart/static/multi-line-chart-surface.tsx +41 -5
- package/src/components/command-bar/commands/direct/index.ts +18 -0
- package/src/components/command-bar/commands/registry.ts +14 -0
- package/src/components/command-bar/routes/root/article-results.test.ts +83 -0
- package/src/components/command-bar/routes/root/article-results.ts +55 -0
- package/src/components/command-bar/routes/root/command-items.ts +3 -0
- package/src/components/command-bar/routes/root/provider-search.ts +7 -3
- package/src/components/command-bar/routes/root/results.ts +38 -11
- package/src/components/command-bar/routes/root/runtime.ts +6 -2
- package/src/components/command-bar/routes/ticker-search/actions.ts +1 -1
- package/src/components/command-bar/routes/ticker-search/results.test.ts +34 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +4 -6
- package/src/components/command-bar/routes/ticker-search/route.ts +2 -2
- package/src/components/command-bar/routing/list-state.ts +2 -1
- package/src/components/command-bar/surface/assist.test.tsx +13 -6
- package/src/components/command-bar/surface/index.test.tsx +65 -0
- package/src/components/command-bar/surface/index.tsx +35 -0
- package/src/components/command-bar/view-model.test.ts +43 -0
- package/src/components/command-bar/view-model.ts +41 -4
- package/src/components/command-bar/workflow/collection-actions.test.ts +94 -0
- package/src/components/command-bar/workflow/collection-actions.ts +14 -3
- package/src/components/command-bar/workflow/ops.test.ts +136 -0
- package/src/components/command-bar/workflow/ops.ts +71 -1
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.test.tsx +35 -0
- package/src/components/layout/header.tsx +101 -9
- package/src/components/layout/pane/cycle-order.test.ts +0 -1
- package/src/components/layout/pane/footer/index.test.tsx +19 -19
- package/src/components/layout/pane/header.tsx +2 -13
- package/src/components/layout/shell/index.tsx +3 -0
- package/src/components/layout/status-bar.test.tsx +36 -1
- package/src/components/layout/status-bar.tsx +48 -2
- package/src/components/onboarding/account-step/chooser-panel.tsx +27 -50
- package/src/components/onboarding/account-step/form-panel.tsx +85 -29
- package/src/components/onboarding/account-step/index.tsx +10 -1
- package/src/components/onboarding/account-step/model.ts +3 -3
- package/src/components/onboarding/account-step/qr-panel.tsx +68 -0
- package/src/components/onboarding/account-step/signed-in-panel.tsx +4 -7
- package/src/components/onboarding/onboarding-frame.tsx +517 -0
- package/src/components/onboarding/onboarding-steps.tsx +0 -264
- package/src/components/onboarding/onboarding-wizard.test.tsx +626 -200
- package/src/components/onboarding/onboarding-wizard.tsx +848 -266
- package/src/components/onboarding/portfolio-step/broker-fields-panel.tsx +81 -51
- package/src/components/onboarding/portfolio-step/broker-setup-panel.tsx +14 -20
- package/src/components/onboarding/portfolio-step/broker-sync-panel.tsx +8 -11
- package/src/components/onboarding/portfolio-step/choose-panel.tsx +18 -22
- package/src/components/onboarding/portfolio-step/index.tsx +3 -0
- package/src/components/onboarding/portfolio-step/types.ts +3 -0
- package/src/components/onboarding/wizard-account.ts +38 -3
- package/src/components/onboarding/wizard-broker-sync.ts +45 -67
- package/src/components/onboarding/wizard-model.ts +18 -2
- package/src/components/ui/data-table/opentui/index.tsx +29 -9
- package/src/components/ui/data-table/types.ts +2 -0
- package/src/components/ui/external-link.tsx +4 -2
- package/src/components/ui/loading.tsx +1 -1
- package/src/components/ui/status.tsx +76 -4
- package/src/components/ui/table-layout.test.ts +24 -0
- package/src/components/ui/table-layout.ts +90 -23
- package/src/components/ui/tabs.tsx +86 -4
- package/src/core/app-services.ts +14 -3
- package/src/core/connection-health.test.ts +143 -0
- package/src/core/connection-health.ts +295 -0
- package/src/core/state/app/layout-reducer.ts +34 -0
- package/src/core/state/app/layout.ts +21 -0
- package/src/core/state/app/state.ts +10 -0
- package/src/core/state/app/types.ts +7 -1
- package/src/data/config/chart-settings.ts +11 -2
- package/src/data/config/store/index.test.ts +83 -9
- package/src/data/config/store/migrations.ts +16 -0
- package/src/data/config/store/normalize.ts +59 -1
- package/src/data/fred-series.ts +8 -2
- package/src/i18n/es.ts +126 -0
- package/src/i18n/ja.ts +126 -0
- package/src/i18n/ko.ts +126 -0
- package/src/i18n/zh-cn.ts +126 -0
- package/src/i18n/zh-tw.ts +126 -0
- package/src/market-data/coordinator/chart.ts +3 -2
- package/src/market-data/hooks.tsx +3 -2
- package/src/market-data/market/status.test.ts +12 -0
- package/src/market-data/market/status.ts +34 -17
- package/src/news/aggregator.test.ts +39 -0
- package/src/news/aggregator.ts +78 -22
- package/src/news/hooks.ts +4 -0
- package/src/notifications/app-notifier.test.ts +28 -6
- package/src/notifications/app-notifier.ts +24 -5
- package/src/plugins/broker-sync/broker-sync.test.ts +130 -0
- package/src/plugins/broker-sync/native-loader.ts +10 -0
- package/src/plugins/broker-sync/normalize.ts +271 -0
- package/src/plugins/broker-sync/public.ts +122 -0
- package/src/plugins/broker-sync/robinhood-native.ts +367 -0
- package/src/plugins/broker-sync/robinhood.ts +114 -0
- package/src/plugins/broker-sync/simplefin-native.ts +201 -0
- package/src/plugins/broker-sync/simplefin.ts +70 -0
- package/src/plugins/builtin/account-management/footer.ts +8 -19
- package/src/plugins/builtin/account-management/pane.tsx +13 -8
- package/src/plugins/builtin/ai/pi/host.ts +6 -5
- package/src/plugins/builtin/ai/providers.ts +1 -1
- package/src/plugins/builtin/ai/screener/footer.ts +0 -7
- package/src/plugins/builtin/ai/screener/pane.test.tsx +2 -1
- package/src/plugins/builtin/ai/screener/pane.tsx +3 -1
- package/src/plugins/builtin/ai/screener/results-view.tsx +8 -0
- package/src/plugins/builtin/ai/screener/runner.ts +7 -3
- package/src/plugins/builtin/ai/workspace/pane.tsx +13 -2
- package/src/plugins/builtin/alerts/alert-engine.ts +13 -0
- package/src/plugins/builtin/alerts/constants.ts +2 -1
- package/src/plugins/builtin/alerts/index.tsx +67 -36
- package/src/plugins/builtin/alerts/pane.tsx +17 -65
- package/src/plugins/builtin/analytics/index.tsx +24 -11
- package/src/plugins/builtin/analytics/pane-model.ts +48 -14
- package/src/plugins/builtin/analytics/portfolio-selection.ts +19 -0
- package/src/plugins/builtin/analytics/view.tsx +5 -3
- package/src/plugins/builtin/broker-manager/detail.tsx +7 -2
- package/src/plugins/builtin/broker-manager/footer.ts +4 -9
- package/src/plugins/builtin/broker-manager/index.tsx +1 -6
- package/src/plugins/builtin/buildout/detail/ui.tsx +15 -4
- package/src/plugins/builtin/buildout/pane/header.tsx +1 -0
- package/src/plugins/builtin/changelog/index.tsx +60 -45
- package/src/plugins/builtin/chart-composer/catalog-inventory.test.ts +97 -0
- package/src/plugins/builtin/chart-composer/catalog-inventory.ts +366 -0
- package/src/plugins/builtin/chart-composer/chart-spec.ts +21 -1
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +307 -0
- package/src/plugins/builtin/chart-composer/editor/controller.ts +1 -1
- package/src/plugins/builtin/chart-composer/index.tsx +45 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +7 -88
- package/src/plugins/builtin/chart-composer/presets.test.ts +48 -0
- package/src/plugins/builtin/chart-composer/presets.ts +69 -3
- package/src/plugins/builtin/chart-composer/quick-add.tsx +8 -5
- package/src/plugins/builtin/chart-composer/semantic.ts +18 -14
- package/src/plugins/builtin/chart-composer/series-catalog.test.ts +39 -0
- package/src/plugins/builtin/chart-composer/series-catalog.ts +104 -3
- package/src/plugins/builtin/chart-composer/shortcuts.test.ts +10 -10
- package/src/plugins/builtin/chart-composer/shortcuts.ts +4 -12
- package/src/plugins/builtin/chart-composer/use-series-catalog.ts +230 -23
- package/src/plugins/builtin/chat/chat.test.tsx +22 -0
- package/src/plugins/builtin/chat/content/composer.tsx +6 -4
- package/src/plugins/builtin/chat/content/index.tsx +7 -0
- package/src/plugins/builtin/chat/content/snapshot.ts +9 -2
- package/src/plugins/builtin/chat/content/transcript.tsx +10 -0
- package/src/plugins/builtin/chat/controller/channel-actions.ts +11 -1
- package/src/plugins/builtin/chat/controller/channels.ts +13 -3
- package/src/plugins/builtin/chat/controller/index.ts +61 -7
- package/src/plugins/builtin/chat/controller/lifecycle.ts +3 -0
- package/src/plugins/builtin/chat/controller/message-loading.ts +5 -1
- package/src/plugins/builtin/chat/controller/messages.ts +3 -1
- package/src/plugins/builtin/chat/controller/notifications.ts +32 -11
- package/src/plugins/builtin/chat/controller/state.ts +7 -0
- package/src/plugins/builtin/chat/controller/view.ts +1 -0
- package/src/plugins/builtin/chat/controller.test.ts +117 -28
- package/src/plugins/builtin/cloud/auth-commands.ts +18 -0
- package/src/plugins/builtin/cloud/device-signin-dialog.tsx +243 -0
- package/src/plugins/builtin/cloud/device-signin.test.ts +217 -0
- package/src/plugins/builtin/cloud/device-signin.ts +240 -0
- package/src/plugins/builtin/cloud/plugin.tsx +7 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +57 -10
- package/src/plugins/builtin/composite-plugins.ts +39 -5
- package/src/plugins/builtin/congress-trades/detail.tsx +2 -4
- package/src/plugins/builtin/congress-trades/footer.ts +7 -16
- package/src/plugins/builtin/congress-trades/pane.tsx +12 -20
- package/src/plugins/builtin/connections/index.ts +53 -0
- package/src/plugins/builtin/connections/pane.test.tsx +79 -0
- package/src/plugins/builtin/connections/pane.tsx +258 -0
- package/src/plugins/builtin/correlation/index.test.tsx +2 -1
- package/src/plugins/builtin/correlation/index.tsx +58 -19
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -7
- package/src/plugins/builtin/correlation/relationship/pane.tsx +43 -19
- package/src/plugins/builtin/correlation/settings.ts +1 -1
- package/src/plugins/builtin/credit-conditions/client.test.ts +80 -0
- package/src/plugins/builtin/credit-conditions/client.ts +105 -0
- package/src/plugins/builtin/credit-conditions/index.test.tsx +111 -0
- package/src/plugins/builtin/credit-conditions/index.tsx +227 -0
- package/src/plugins/builtin/credit-conditions/model.test.ts +43 -0
- package/src/plugins/builtin/credit-conditions/model.ts +64 -0
- package/src/plugins/builtin/debug/index.tsx +11 -6
- package/src/plugins/builtin/dividend-yield/client.test.ts +58 -0
- package/src/plugins/builtin/dividend-yield/client.ts +252 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +61 -0
- package/src/plugins/builtin/dividend-yield/model.ts +83 -0
- package/src/plugins/builtin/dividend-yield/pane.tsx +305 -0
- package/src/plugins/builtin/dividend-yield/types.ts +22 -0
- package/src/plugins/builtin/earnings/data/cache.test.ts +10 -7
- package/src/plugins/builtin/earnings/data/cache.ts +23 -9
- package/src/plugins/builtin/earnings/index.tsx +57 -6
- package/src/plugins/builtin/econ/calendar-model.test.ts +37 -3
- package/src/plugins/builtin/econ/calendar-model.ts +32 -26
- package/src/plugins/builtin/econ/fred-cache.test.ts +8 -1
- package/src/plugins/builtin/econ/fred-series-map.ts +18 -0
- package/src/plugins/builtin/econ/index.test.tsx +105 -0
- package/src/plugins/builtin/econ/index.tsx +95 -52
- package/src/plugins/builtin/fear-greed/cache.test.ts +18 -3
- package/src/plugins/builtin/fear-greed/cache.ts +18 -6
- package/src/plugins/builtin/fear-greed/charts.tsx +9 -2
- package/src/plugins/builtin/fear-greed/format.ts +0 -9
- package/src/plugins/builtin/fear-greed/pane.tsx +21 -21
- package/src/plugins/builtin/futures/contracts.ts +100 -0
- package/src/plugins/builtin/futures/index.tsx +298 -0
- package/src/plugins/builtin/futures/model.test.ts +129 -0
- package/src/plugins/builtin/futures/model.ts +136 -0
- package/src/plugins/builtin/futures/pane.test.tsx +239 -0
- package/src/plugins/builtin/futures/table.test.ts +155 -0
- package/src/plugins/builtin/futures/table.tsx +241 -0
- package/src/plugins/builtin/fx-matrix/index.tsx +160 -134
- package/src/plugins/builtin/fx-matrix/pairs.ts +12 -1
- package/src/plugins/builtin/fx-matrix/pane.test.tsx +109 -0
- package/src/plugins/builtin/help/components.tsx +1 -30
- package/src/plugins/builtin/help/index.tsx +5 -25
- package/src/plugins/builtin/holders/pane.tsx +17 -12
- package/src/plugins/builtin/holders/treemap.tsx +4 -2
- package/src/plugins/builtin/insider/index.tsx +20 -10
- package/src/plugins/builtin/ipo-calendar/cache.ts +101 -0
- package/src/plugins/builtin/ipo-calendar/client.test.ts +31 -0
- package/src/plugins/builtin/ipo-calendar/client.ts +296 -0
- package/src/plugins/builtin/ipo-calendar/index.tsx +65 -0
- package/src/plugins/builtin/ipo-calendar/model.ts +145 -0
- package/src/plugins/builtin/ipo-calendar/pane.tsx +328 -0
- package/src/plugins/builtin/ipo-calendar/types.ts +19 -0
- package/src/plugins/builtin/kelly-sizer/index.test.tsx +3 -3
- package/src/plugins/builtin/kelly-sizer/model.ts +8 -1
- package/src/plugins/builtin/kelly-sizer/pane.tsx +33 -15
- package/src/plugins/builtin/kelly-sizer/view.tsx +12 -5
- package/src/plugins/builtin/market-halts/client.ts +114 -0
- package/src/plugins/builtin/market-halts/index.tsx +29 -0
- package/src/plugins/builtin/market-halts/model.test.ts +187 -0
- package/src/plugins/builtin/market-halts/model.ts +291 -0
- package/src/plugins/builtin/market-halts/pane.tsx +256 -0
- package/src/plugins/builtin/market-heatmap/data.test.ts +1 -0
- package/src/plugins/builtin/market-heatmap/data.ts +12 -3
- package/src/plugins/builtin/market-heatmap/index.tsx +131 -46
- package/src/plugins/builtin/market-movers/index.tsx +145 -63
- package/src/plugins/builtin/market-movers/model.ts +19 -3
- package/src/plugins/builtin/market-movers/screener.test.ts +108 -0
- package/src/plugins/builtin/market-movers/screener.ts +168 -10
- package/src/plugins/builtin/news/index.tsx +78 -99
- package/src/plugins/builtin/news/wire/article-search.test.ts +72 -0
- package/src/plugins/builtin/news/wire/article-search.ts +140 -0
- package/src/plugins/builtin/news/wire/breaking/pane.tsx +18 -8
- package/src/plugins/builtin/news/wire/categories.ts +35 -0
- package/src/plugins/builtin/news/wire/default-feeds.ts +47 -1
- package/src/plugins/builtin/news/wire/feed-config.test.ts +10 -5
- package/src/plugins/builtin/news/wire/index.tsx +41 -4
- package/src/plugins/builtin/news/wire/industry-pane.tsx +38 -19
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +10 -5
- package/src/plugins/builtin/news/wire/news/footer.ts +1 -0
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +15 -6
- package/src/plugins/builtin/news/wire/news/query-presets.ts +16 -2
- package/src/plugins/builtin/news/wire/news/table.test.tsx +54 -0
- package/src/plugins/builtin/news/wire/news/table.tsx +111 -17
- package/src/plugins/builtin/notes/files.test.ts +18 -0
- package/src/plugins/builtin/notes/files.ts +10 -4
- package/src/plugins/builtin/notes/index.tsx +4 -1
- package/src/plugins/builtin/notes/quick-notes-pane.test.tsx +182 -0
- package/src/plugins/builtin/notes/quick-notes-pane.tsx +74 -31
- package/src/plugins/builtin/notes/ticker-notes-tab.test.tsx +380 -0
- package/src/plugins/builtin/notes/ticker-notes-tab.tsx +97 -40
- package/src/plugins/builtin/options/calc-seed.test.ts +118 -0
- package/src/plugins/builtin/options/calc-seed.ts +52 -0
- package/src/plugins/builtin/options/footer.ts +4 -1
- package/src/plugins/builtin/options/index.tsx +22 -1
- package/src/plugins/builtin/options/live-quotes.ts +8 -0
- package/src/plugins/builtin/options/table.ts +3 -1
- package/src/plugins/builtin/options/view.test.tsx +5 -1
- package/src/plugins/builtin/options/view.tsx +112 -17
- package/src/plugins/builtin/options-calculator/index.tsx +35 -0
- package/src/plugins/builtin/options-calculator/model.test.ts +172 -0
- package/src/plugins/builtin/options-calculator/model.ts +273 -0
- package/src/plugins/builtin/options-calculator/pane.test.tsx +138 -0
- package/src/plugins/builtin/options-calculator/pane.tsx +218 -0
- package/src/plugins/builtin/plugin-module.test.ts +16 -2
- package/src/plugins/builtin/plugin-module.ts +5 -1
- package/src/plugins/builtin/polls/client.ts +57 -0
- package/src/plugins/builtin/polls/hooks.ts +20 -0
- package/src/plugins/builtin/polls/index.tsx +35 -0
- package/src/plugins/builtin/polls/normalize.test.ts +230 -0
- package/src/plugins/builtin/polls/normalize.ts +319 -0
- package/src/plugins/builtin/polls/pane.tsx +722 -0
- package/src/plugins/builtin/polls/types.ts +77 -0
- package/src/plugins/builtin/portfolio-list/header.tsx +15 -4
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
- package/src/plugins/builtin/portfolio-list/pane/supplemental.ts +1 -1
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +2 -0
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -1
- package/src/plugins/builtin/research/analyst-pane.tsx +40 -67
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +25 -19
- package/src/plugins/builtin/research/index.test.ts +6 -25
- package/src/plugins/builtin/research/index.tsx +11 -5
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +86 -26
- package/src/plugins/builtin/scanner/denied.tsx +31 -0
- package/src/plugins/builtin/scanner/feed.ts +94 -0
- package/src/plugins/builtin/scanner/flow-model.test.ts +85 -0
- package/src/plugins/builtin/scanner/flow-model.ts +133 -0
- package/src/plugins/builtin/scanner/flow-pane.tsx +197 -0
- package/src/plugins/builtin/scanner/hilo-bars.tsx +121 -0
- package/src/plugins/builtin/scanner/hilo-model.test.ts +44 -0
- package/src/plugins/builtin/scanner/hilo-model.ts +75 -0
- package/src/plugins/builtin/scanner/hilo-pane.tsx +165 -0
- package/src/plugins/builtin/scanner/index.ts +109 -0
- package/src/plugins/builtin/scanner/waiting.tsx +11 -0
- package/src/plugins/builtin/sec/index.tsx +11 -7
- package/src/plugins/builtin/sectors/index.tsx +105 -81
- package/src/plugins/builtin/sectors/move-bar.tsx +43 -0
- package/src/plugins/builtin/sectors/sector-data.ts +18 -0
- package/src/plugins/builtin/sectors/sector-model.ts +13 -15
- package/src/plugins/builtin/shared/auto-refresh.ts +51 -0
- package/src/plugins/builtin/shared/cloud-upgrade.ts +29 -5
- package/src/plugins/builtin/shared/pane-footer.ts +16 -3
- package/src/plugins/builtin/shared/screener-live-quotes.test.ts +91 -0
- package/src/plugins/builtin/shared/screener-live-quotes.ts +134 -0
- package/src/plugins/builtin/shared/table-pane.ts +1 -5
- package/src/plugins/builtin/shared/use-quote-board.test.tsx +211 -0
- package/src/plugins/builtin/shared/use-quote-board.ts +195 -0
- package/src/plugins/builtin/short-interest/client.ts +124 -0
- package/src/plugins/builtin/short-interest/index.tsx +62 -0
- package/src/plugins/builtin/short-interest/model.ts +113 -0
- package/src/plugins/builtin/short-interest/pane.tsx +252 -0
- package/src/plugins/builtin/short-interest/types.ts +9 -0
- package/src/plugins/builtin/substack/article-detail.tsx +15 -1
- package/src/plugins/builtin/substack/pane-footer.ts +3 -22
- package/src/plugins/builtin/substack/pane.tsx +1 -2
- package/src/plugins/builtin/thirteenf/api.ts +4 -1
- package/src/plugins/builtin/thirteenf/model.ts +2 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +6 -2
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +10 -4
- package/src/plugins/builtin/ticker-detail/data-panes/provider-search.tsx +67 -11
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +15 -8
- package/src/plugins/builtin/ticker-detail/index.tsx +5 -21
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +72 -32
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +0 -10
- package/src/plugins/builtin/ticker-detail/pane.tsx +4 -1
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.test.tsx +70 -0
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +34 -26
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +96 -49
- package/src/plugins/builtin/ticker-detail/research-tabs.ts +32 -0
- package/src/plugins/builtin/ticker-research-backend-plugin.ts +2 -9
- package/src/plugins/builtin/ticker-research-plugin.ts +6 -0
- package/src/plugins/builtin/treasury-auctions/cache.test.ts +173 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +104 -0
- package/src/plugins/builtin/treasury-auctions/client.test.ts +181 -0
- package/src/plugins/builtin/treasury-auctions/client.ts +151 -0
- package/src/plugins/builtin/treasury-auctions/index.tsx +90 -0
- package/src/plugins/builtin/treasury-auctions/model.test.ts +147 -0
- package/src/plugins/builtin/treasury-auctions/model.ts +188 -0
- package/src/plugins/builtin/treasury-auctions/pane.test.tsx +170 -0
- package/src/plugins/builtin/treasury-auctions/pane.tsx +417 -0
- package/src/plugins/builtin/treasury-auctions/types.ts +59 -0
- package/src/plugins/builtin/tv/pane.tsx +67 -7
- package/src/plugins/builtin/tv/youtube-embed.test.ts +84 -0
- package/src/plugins/builtin/tv/youtube-embed.ts +173 -0
- package/src/plugins/builtin/tv/youtube-stream.ts +27 -2
- package/src/plugins/builtin/volatility/client.ts +87 -0
- package/src/plugins/builtin/volatility/index.test.tsx +107 -0
- package/src/plugins/builtin/volatility/index.tsx +193 -0
- package/src/plugins/builtin/volatility/model.test.ts +66 -0
- package/src/plugins/builtin/volatility/model.ts +113 -0
- package/src/plugins/builtin/world-indices/footer.ts +43 -23
- package/src/plugins/builtin/world-indices/index.tsx +44 -93
- package/src/plugins/builtin/world-indices/indices.ts +11 -2
- package/src/plugins/builtin/world-indices/model.ts +17 -24
- package/src/plugins/builtin/world-indices/pane.test.tsx +116 -0
- package/src/plugins/builtin/world-indices/table.tsx +82 -37
- package/src/plugins/builtin/yield-curve/index.tsx +16 -7
- package/src/plugins/builtin/yield-curve/treasury-data.test.ts +25 -0
- package/src/plugins/builtin/yield-curve/treasury-data.ts +16 -0
- package/src/plugins/catalog-backend.ts +8 -0
- package/src/plugins/catalog-ui.ts +8 -0
- package/src/plugins/event-bus.ts +1 -0
- package/src/plugins/ibkr/gateway/account-loaders.ts +1 -1
- package/src/plugins/ibkr/trade/tab/footer.ts +9 -23
- package/src/plugins/ibkr/trade/tab/index.tsx +1 -5
- package/src/plugins/ibkr/trading/pane-view.tsx +149 -87
- package/src/plugins/ibkr/trading/pane.tsx +2 -2
- package/src/plugins/ownership.ts +3 -0
- package/src/plugins/pane-manager/floating.ts +8 -2
- package/src/plugins/pane-manager.test.ts +13 -0
- package/src/plugins/prediction-markets/backend-plugin.ts +2 -0
- package/src/plugins/prediction-markets/capability.test.ts +281 -0
- package/src/plugins/prediction-markets/capability.ts +171 -0
- package/src/plugins/prediction-markets/chart.tsx +18 -26
- package/src/plugins/prediction-markets/columns.ts +3 -2
- package/src/plugins/prediction-markets/controller/catalog.ts +15 -12
- package/src/plugins/prediction-markets/controller/detail.ts +4 -0
- package/src/plugins/prediction-markets/controller/index.ts +0 -15
- package/src/plugins/prediction-markets/detail/book.tsx +3 -23
- package/src/plugins/prediction-markets/detail/overview.tsx +0 -18
- package/src/plugins/prediction-markets/detail/pane.tsx +36 -12
- package/src/plugins/prediction-markets/detail.test.tsx +1 -1
- package/src/plugins/prediction-markets/index.tsx +2 -0
- package/src/plugins/prediction-markets/metrics.ts +28 -18
- package/src/plugins/prediction-markets/navigation.ts +1 -0
- package/src/plugins/prediction-markets/pane.test.tsx +1 -1
- package/src/plugins/prediction-markets/pane.tsx +0 -1
- package/src/plugins/prediction-markets/services/fetch.ts +3 -2
- package/src/plugins/prediction-markets/services/kalshi/adapter.ts +82 -23
- package/src/plugins/prediction-markets/services/kalshi/normalize.ts +3 -1
- package/src/plugins/prediction-markets/services/kalshi/types.ts +14 -0
- package/src/plugins/prediction-markets/services/polymarket/adapter.ts +26 -14
- package/src/plugins/prediction-markets/services/polymarket/detail.ts +67 -18
- package/src/plugins/prediction-markets/test-helpers.tsx +0 -1
- package/src/plugins/prediction-markets/types.ts +3 -9
- package/src/plugins/registry/context.ts +6 -1
- package/src/plugins/registry/index.test.ts +2 -0
- package/src/plugins/registry/index.ts +53 -3
- package/src/plugins/runtime/context.tsx +4 -2
- package/src/plugins/runtime/index.tsx +9 -0
- package/src/remote/controller.test.ts +17 -4
- package/src/renderers/electrobun/bun/application-menu/index.ts +1 -1
- package/src/renderers/electrobun/bun/core-capabilities.ts +2 -2
- package/src/renderers/electrobun/bun/desktop/capability-bridge.test.ts +64 -0
- package/src/renderers/electrobun/bun/desktop/capability-bridge.ts +41 -7
- package/src/renderers/electrobun/bun/desktop/host-requests.ts +5 -2
- package/src/renderers/electrobun/bun/desktop/http-fetch.test.ts +33 -0
- package/src/renderers/electrobun/bun/desktop/http-fetch.ts +53 -6
- package/src/renderers/electrobun/bun/desktop/initialization.test.ts +27 -0
- package/src/renderers/electrobun/bun/desktop/initialization.ts +6 -1
- package/src/renderers/electrobun/bun/index.ts +1 -0
- package/src/renderers/electrobun/shared/protocol.ts +2 -0
- package/src/renderers/electrobun/view/app-services.ts +25 -2
- package/src/renderers/electrobun/view/build-assets.ts +5 -0
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +186 -65
- package/src/renderers/electrobun/view/cli-pane-shot-health.test.ts +25 -0
- package/src/renderers/electrobun/view/cli-pane-shot-health.ts +31 -0
- package/src/renderers/electrobun/view/data-table/index.tsx +10 -11
- package/src/renderers/electrobun/view/data-table/row.tsx +2 -0
- package/src/renderers/electrobun/view/desktop/controls.test.tsx +68 -0
- package/src/renderers/electrobun/view/desktop/controls.tsx +25 -1
- package/src/renderers/electrobun/view/host/box.test.tsx +80 -0
- package/src/renderers/electrobun/view/host/media-surface.tsx +70 -3
- package/src/renderers/electrobun/view/host/tabs.tsx +97 -5
- package/src/renderers/electrobun/view/host/text.tsx +5 -2
- package/src/renderers/electrobun/view/input-host.test.tsx +140 -0
- package/src/renderers/electrobun/view/input-host.tsx +4 -2
- package/src/renderers/electrobun/view/native-stubs/backend-rpc.ts +19 -1
- package/src/renderers/electrobun/view/native-stubs/broker-sync-native-loader.ts +7 -0
- package/src/renderers/electrobun/view/native-stubs/chart/kitty-support.ts +10 -0
- package/src/renderers/electrobun/view/remote/capability-invoker.test.ts +46 -0
- package/src/renderers/electrobun/view/remote/capability-invoker.ts +34 -13
- package/src/renderers/electrobun/view/remote/connection-health-backend.ts +19 -0
- package/src/renderers/electrobun/view/remote/connection-health.test.ts +44 -0
- package/src/renderers/electrobun/view/remote/connection-health.ts +49 -0
- package/src/renderers/electrobun/view/styles.css +5 -0
- package/src/renderers/opentui/dialog-host.tsx +279 -80
- package/src/renderers/opentui/host.tsx +15 -1
- package/src/renderers/opentui/terminal-media.test.ts +102 -0
- package/src/renderers/opentui/terminal-media.ts +142 -0
- package/src/renderers/opentui/test-utils.tsx +9 -6
- package/src/renderers/opentui/toast-host.tsx +136 -7
- package/src/renderers/opentui/ui-host.tsx +19 -3
- package/src/sources/provider-router/connection-health.test.ts +28 -0
- package/src/sources/provider-router/connection-health.ts +47 -0
- package/src/sources/provider-router/history.test.ts +53 -4
- package/src/sources/provider-router/history.ts +119 -14
- package/src/sources/provider-router/index.ts +12 -1
- package/src/sources/yahoo-finance/history.ts +2 -9
- package/src/sources/yahoo-finance/http.ts +1 -1
- package/src/sources/yahoo-finance/symbols.ts +1 -1
- package/src/sources/yahoo-finance/types.ts +19 -0
- package/src/state/app/context/index.test.tsx +101 -0
- package/src/state/app/context/index.tsx +10 -0
- package/src/state/config-save-scheduler.ts +1 -6
- package/src/state/persist-scheduler.test.ts +31 -0
- package/src/state/persist-scheduler.ts +21 -8
- package/src/sync/auth-transition.test.ts +36 -0
- package/src/sync/auth-transition.ts +22 -0
- package/src/sync/core-contributors.test.ts +58 -1
- package/src/sync/core-contributors.ts +39 -2
- package/src/sync/react.ts +9 -0
- package/src/test-support/plugin-runtime.ts +3 -0
- package/src/theme/font-scale.test.ts +14 -0
- package/src/theme/font-scale.ts +69 -0
- package/src/tickers/search/index.test.ts +284 -2
- package/src/tickers/search/index.ts +55 -18
- package/src/tickers/search/ranking.ts +143 -18
- package/src/tickers/search/types.ts +1 -0
- package/src/time-series/alignment.ts +15 -11
- package/src/time-series/field-catalog.ts +10 -0
- package/src/time-series/fundamentals.ts +19 -11
- package/src/time-series/hooks.ts +8 -2
- package/src/time-series/parsed-history-cache.ts +35 -0
- package/src/time-series/resolution.ts +10 -0
- package/src/time-series/resolve.test.ts +332 -3
- package/src/time-series/resolve.ts +225 -25
- package/src/time-series/spec-studies.test.ts +23 -0
- package/src/time-series/spec.ts +21 -2
- package/src/time-series/transforms.test.ts +76 -1
- package/src/time-series/transforms.ts +39 -8
- package/src/time-series/types.ts +9 -2
- package/src/time-series/use-chart-resolution.test.tsx +105 -1
- package/src/time-series/use-chart-resolution.ts +67 -13
- package/src/types/config.ts +30 -27
- package/src/types/media.ts +2 -0
- package/src/types/plugin.ts +8 -1
- package/src/ui/host.tsx +4 -0
- package/src/ui/pointer-drag.ts +12 -0
- package/src/ui/qr.test.ts +79 -0
- package/src/ui/qr.ts +82 -0
- package/src/updater/github-releases.test.ts +3 -3
- package/src/updater/github-releases.ts +1 -1
- package/src/updater.test.ts +117 -16
- package/src/updater.ts +32 -5
- package/src/utils/exchanges.ts +1 -0
- package/src/utils/external-url.test.ts +32 -0
- package/src/utils/external-url.ts +23 -0
- package/src/utils/sort-values.ts +31 -0
- package/src/utils/zoned-date-time.ts +67 -0
- package/src/components/onboarding/wizard-keyboard.ts +0 -306
- package/src/plugins/builtin/chart-composer/date-window-dialog.tsx +0 -120
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AppNotificationDelivery,
|
|
3
|
+
AppNotificationRequest,
|
|
4
|
+
PluginPersistence,
|
|
5
|
+
PluginResumeState,
|
|
6
|
+
} from "../../../../types/plugin";
|
|
2
7
|
import {
|
|
3
8
|
apiClient,
|
|
4
9
|
type ChatChannel,
|
|
5
10
|
type ChatChannelState,
|
|
6
11
|
type ChatMessage,
|
|
12
|
+
type PersistedAuthUser,
|
|
7
13
|
} from "../../../../api-client";
|
|
14
|
+
import { normalizeSessionUser } from "./persistence";
|
|
8
15
|
import { debugLog } from "../../../../utils/debug-log";
|
|
9
16
|
import {
|
|
10
17
|
getUnreadMentionMessages,
|
|
@@ -65,7 +72,7 @@ export class ChatController {
|
|
|
65
72
|
private appActive = true;
|
|
66
73
|
private readonly session = createChatControllerSessionState();
|
|
67
74
|
private pendingMessageSeq = 0;
|
|
68
|
-
private notifyFn: (notification: AppNotificationRequest) => void = () => {};
|
|
75
|
+
private notifyFn: (notification: AppNotificationRequest) => AppNotificationDelivery | void = () => {};
|
|
69
76
|
private notifiedMessageIds = new Set<string>();
|
|
70
77
|
|
|
71
78
|
private readonly storage = new ChatControllerStorage({
|
|
@@ -119,7 +126,7 @@ export class ChatController {
|
|
|
119
126
|
this.hydrate();
|
|
120
127
|
}
|
|
121
128
|
|
|
122
|
-
setNotifier(notify: (notification: AppNotificationRequest) => void): void {
|
|
129
|
+
setNotifier(notify: (notification: AppNotificationRequest) => AppNotificationDelivery | void): void {
|
|
123
130
|
this.notifyFn = notify;
|
|
124
131
|
}
|
|
125
132
|
|
|
@@ -183,7 +190,19 @@ export class ChatController {
|
|
|
183
190
|
return this.storage.ensureChannelState(channelId);
|
|
184
191
|
}
|
|
185
192
|
|
|
193
|
+
/** Single-flight: every open chat pane calls this on mount. */
|
|
186
194
|
async refreshSession(): Promise<void> {
|
|
195
|
+
if (this.sessionRefreshPromise) return this.sessionRefreshPromise;
|
|
196
|
+
const request = this.runSessionRefresh().finally(() => {
|
|
197
|
+
this.sessionRefreshPromise = null;
|
|
198
|
+
});
|
|
199
|
+
this.sessionRefreshPromise = request;
|
|
200
|
+
return request;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
private sessionRefreshPromise: Promise<void> | null = null;
|
|
204
|
+
|
|
205
|
+
private async runSessionRefresh(): Promise<void> {
|
|
187
206
|
return refreshChatControllerSession({
|
|
188
207
|
applySignedOut: () => this.applySignedOutSession(),
|
|
189
208
|
channelStates: this.storage.channelStates,
|
|
@@ -258,11 +277,11 @@ export class ChatController {
|
|
|
258
277
|
});
|
|
259
278
|
}
|
|
260
279
|
|
|
261
|
-
attachView(): () => void {
|
|
262
|
-
return this.attachChannelView(DEFAULT_CHAT_CHANNEL_ID);
|
|
280
|
+
attachView(focused = true): () => void {
|
|
281
|
+
return this.attachChannelView(DEFAULT_CHAT_CHANNEL_ID, focused);
|
|
263
282
|
}
|
|
264
283
|
|
|
265
|
-
attachChannelView(channelId: string): () => void {
|
|
284
|
+
attachChannelView(channelId: string, focused = true): () => void {
|
|
266
285
|
const normalizedChannelId = normalizeChannelId(channelId);
|
|
267
286
|
const channel = this.ensureChannelState(normalizedChannelId);
|
|
268
287
|
return attachChatChannelView({
|
|
@@ -270,10 +289,31 @@ export class ChatController {
|
|
|
270
289
|
channelId: normalizedChannelId,
|
|
271
290
|
emit: (nextChannelId) => this.emit(nextChannelId),
|
|
272
291
|
flushDraftSync: (nextChannelId) => this.storage.flushDraftSync(nextChannelId),
|
|
292
|
+
focused,
|
|
293
|
+
appActive: this.appActive,
|
|
273
294
|
markViewedThroughLatestMessage: (nextChannelId) => this.markViewedThroughLatestMessage(nextChannelId),
|
|
274
295
|
});
|
|
275
296
|
}
|
|
276
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Installs a session obtained outside the cookie-capturing transport (device
|
|
300
|
+
* sign-in hands over a raw token in the response body) the same way boot
|
|
301
|
+
* restoration does, then persists it through the normal session persistence
|
|
302
|
+
* so a restart stays signed in even if a follow-up refresh cannot reach the
|
|
303
|
+
* server. Callers should still refreshSession() afterwards to validate and
|
|
304
|
+
* pick up the full profile.
|
|
305
|
+
*/
|
|
306
|
+
adoptSession(sessionToken: string, user: PersistedAuthUser): void {
|
|
307
|
+
apiClient.setSessionToken(sessionToken);
|
|
308
|
+
apiClient.setWebSocketToken(null);
|
|
309
|
+
apiClient.restoreCachedUser(user);
|
|
310
|
+
this.session.sessionToken = sessionToken;
|
|
311
|
+
this.session.user = normalizeSessionUser(user);
|
|
312
|
+
this.session.sessionChecked = true;
|
|
313
|
+
this.storage.persistSession(this.session.sessionToken, this.session.user);
|
|
314
|
+
this.emit();
|
|
315
|
+
}
|
|
316
|
+
|
|
277
317
|
clearSession(): void {
|
|
278
318
|
clearChatControllerSessionState({
|
|
279
319
|
channelStates: this.storage.channelStates.values(),
|
|
@@ -295,8 +335,11 @@ export class ChatController {
|
|
|
295
335
|
this.realtime.stopVerificationPolling();
|
|
296
336
|
return;
|
|
297
337
|
}
|
|
338
|
+
this.markFocusedViewsViewed();
|
|
298
339
|
this.realtime.syncVerificationPolling();
|
|
299
|
-
void this.refreshChatState()
|
|
340
|
+
void this.refreshChatState()
|
|
341
|
+
.then(() => this.markFocusedViewsViewed())
|
|
342
|
+
.catch(() => {});
|
|
300
343
|
}
|
|
301
344
|
|
|
302
345
|
reset(clearSession = false): void {
|
|
@@ -466,6 +509,7 @@ export class ChatController {
|
|
|
466
509
|
currentUserId: this.session.user?.id,
|
|
467
510
|
messages,
|
|
468
511
|
options,
|
|
512
|
+
viewActive: this.appActive && channel.focusedViewCount > 0,
|
|
469
513
|
markViewed: (persist) => this.markViewedThroughLatestMessage(channelId, persist),
|
|
470
514
|
});
|
|
471
515
|
this.storage.persistTranscript(channelId);
|
|
@@ -479,6 +523,7 @@ export class ChatController {
|
|
|
479
523
|
handleChatNotificationEvent({
|
|
480
524
|
notification,
|
|
481
525
|
options,
|
|
526
|
+
appActive: this.appActive,
|
|
482
527
|
ensureChannelState: (channelId) => this.ensureChannelState(channelId),
|
|
483
528
|
mergeMessages: (channelId, messages, mergeOptions) => this.mergeMessages(channelId, messages, mergeOptions),
|
|
484
529
|
getChannel: (channelId) => this.channelCatalog.getChannels().find((channel) => channel.id === channelId),
|
|
@@ -492,6 +537,15 @@ export class ChatController {
|
|
|
492
537
|
return getUnreadMentionMessages(channel, this.session.user).length;
|
|
493
538
|
}
|
|
494
539
|
|
|
540
|
+
private markFocusedViewsViewed(): void {
|
|
541
|
+
for (const [channelId, channel] of this.storage.channelStates) {
|
|
542
|
+
if (channel.focusedViewCount === 0) continue;
|
|
543
|
+
if (this.markViewedThroughLatestMessage(channelId)) {
|
|
544
|
+
this.emit(channelId);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
495
549
|
private markViewedThroughLatestMessage(channelId: string, persist = true): boolean {
|
|
496
550
|
const channel = this.ensureChannelState(channelId);
|
|
497
551
|
return markChatChannelViewedThroughLatestMessage({
|
|
@@ -27,14 +27,17 @@ function resetChannelRuntimeState(channel: ChannelRuntimeState): void {
|
|
|
27
27
|
channel.notificationsEnabled = false;
|
|
28
28
|
channel.reachedOldestMessage = false;
|
|
29
29
|
channel.openViewCount = 0;
|
|
30
|
+
channel.focusedViewCount = 0;
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
function disposeChannelRuntimeState(channel: ChannelRuntimeState): void {
|
|
33
34
|
channel.messagesLoading = false;
|
|
35
|
+
channel.messagesError = null;
|
|
34
36
|
channel.olderMessagesLoading = false;
|
|
35
37
|
channel.refreshMessagesPromise = null;
|
|
36
38
|
channel.loadOlderMessagesPromise = null;
|
|
37
39
|
channel.openViewCount = 0;
|
|
40
|
+
channel.focusedViewCount = 0;
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
interface ClearChatControllerSessionOptions {
|
|
@@ -32,6 +32,7 @@ export class ChatControllerMessageLoading {
|
|
|
32
32
|
const channel = this.options.ensureChannelState(channelId);
|
|
33
33
|
if (channel.refreshMessagesPromise) return channel.refreshMessagesPromise;
|
|
34
34
|
|
|
35
|
+
channel.messagesError = null;
|
|
35
36
|
if (options.showLoading) {
|
|
36
37
|
channel.messagesLoading = true;
|
|
37
38
|
this.options.emit(channelId);
|
|
@@ -45,7 +46,10 @@ export class ChatControllerMessageLoading {
|
|
|
45
46
|
this.options.persistChannelState(nextChannelId);
|
|
46
47
|
},
|
|
47
48
|
})
|
|
48
|
-
.catch(() => {
|
|
49
|
+
.catch((error: unknown) => {
|
|
50
|
+
channel.messagesError = error instanceof Error && error.message.trim()
|
|
51
|
+
? error.message
|
|
52
|
+
: "Could not load messages.";
|
|
49
53
|
this.options.persistChannelState(channelId);
|
|
50
54
|
})
|
|
51
55
|
.finally(() => {
|
|
@@ -139,6 +139,7 @@ interface MergeChatMessagesOptions {
|
|
|
139
139
|
currentUserId?: string | null;
|
|
140
140
|
messages: ChatMessage[];
|
|
141
141
|
options?: MergeMessagesOptions;
|
|
142
|
+
viewActive: boolean;
|
|
142
143
|
markViewed: (persist?: boolean) => void;
|
|
143
144
|
}
|
|
144
145
|
|
|
@@ -147,12 +148,13 @@ export function mergeChatMessages({
|
|
|
147
148
|
currentUserId,
|
|
148
149
|
messages,
|
|
149
150
|
options,
|
|
151
|
+
viewActive,
|
|
150
152
|
markViewed,
|
|
151
153
|
}: MergeChatMessagesOptions): void {
|
|
152
154
|
reconcilePendingMessages(channel, messages);
|
|
153
155
|
const freshIncoming = mergeStoredMessages(channel, messages)
|
|
154
156
|
.filter((message) => message.user.id !== currentUserId);
|
|
155
|
-
if (
|
|
157
|
+
if (viewActive) {
|
|
156
158
|
markViewed(false);
|
|
157
159
|
} else if (freshIncoming.length > 0 && options?.countUnread !== false) {
|
|
158
160
|
channel.unreadCount += freshIncoming.length;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AppNotificationDelivery,
|
|
3
|
+
AppNotificationRequest,
|
|
4
|
+
} from "../../../../types/plugin";
|
|
2
5
|
import { apiClient, type ChatChannel, type ChatMessage, type ChatNotification } from "../../../../api-client";
|
|
3
6
|
import type { ChannelRuntimeState, MergeMessagesOptions } from "./state";
|
|
4
7
|
import { formatChatPaneTitle } from "../channel-labels";
|
|
@@ -8,6 +11,10 @@ import {
|
|
|
8
11
|
formatReplyToast,
|
|
9
12
|
} from "./utils";
|
|
10
13
|
|
|
14
|
+
function wasNotificationDelivered(delivery: AppNotificationDelivery | void): boolean {
|
|
15
|
+
return !!delivery && (delivery.toastVisible || delivery.desktopRequested);
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
function notifyChatServerMessage({
|
|
12
19
|
notification,
|
|
13
20
|
channel,
|
|
@@ -17,23 +24,26 @@ function notifyChatServerMessage({
|
|
|
17
24
|
notification: ChatNotification;
|
|
18
25
|
channel: ChatChannel | undefined;
|
|
19
26
|
notifiedMessageIds: Set<string>;
|
|
20
|
-
notify: (notification: AppNotificationRequest) => void;
|
|
21
|
-
}):
|
|
22
|
-
if (notifiedMessageIds.has(notification.messageId)) return;
|
|
23
|
-
notifiedMessageIds.add(notification.messageId);
|
|
27
|
+
notify: (notification: AppNotificationRequest) => AppNotificationDelivery | void;
|
|
28
|
+
}): boolean {
|
|
29
|
+
if (notifiedMessageIds.has(notification.messageId)) return true;
|
|
24
30
|
const channelTitle = formatChatPaneTitle(channel, notification.channelId);
|
|
25
31
|
const body = notification.type === "reply"
|
|
26
32
|
? formatReplyToast(notification.message)
|
|
27
33
|
: notification.type === "mention"
|
|
28
34
|
? formatMentionToast(notification.message)
|
|
29
35
|
: formatChannelToast(channelTitle, notification.message, channel?.kind);
|
|
30
|
-
notify({
|
|
36
|
+
const delivered = wasNotificationDelivered(notify({
|
|
31
37
|
title: "Gloomberb chat",
|
|
32
38
|
subtitle: channelTitle,
|
|
33
39
|
body,
|
|
34
40
|
type: "info",
|
|
35
41
|
desktop: "when-inactive",
|
|
36
|
-
});
|
|
42
|
+
}));
|
|
43
|
+
if (delivered) {
|
|
44
|
+
notifiedMessageIds.add(notification.messageId);
|
|
45
|
+
}
|
|
46
|
+
return delivered;
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
export function handleChatNotification({
|
|
@@ -41,6 +51,7 @@ export function handleChatNotification({
|
|
|
41
51
|
options = {},
|
|
42
52
|
ensureChannelState,
|
|
43
53
|
mergeMessages,
|
|
54
|
+
appActive,
|
|
44
55
|
getChannel,
|
|
45
56
|
notifiedMessageIds,
|
|
46
57
|
notify,
|
|
@@ -49,14 +60,24 @@ export function handleChatNotification({
|
|
|
49
60
|
options?: { countUnread?: boolean };
|
|
50
61
|
ensureChannelState: (channelId: string) => ChannelRuntimeState;
|
|
51
62
|
mergeMessages: (channelId: string, messages: ChatMessage[], options?: MergeMessagesOptions) => void;
|
|
63
|
+
appActive: boolean;
|
|
52
64
|
getChannel: (channelId: string) => ChatChannel | undefined;
|
|
53
65
|
notifiedMessageIds: Set<string>;
|
|
54
|
-
notify: (notification: AppNotificationRequest) => void;
|
|
66
|
+
notify: (notification: AppNotificationRequest) => AppNotificationDelivery | void;
|
|
55
67
|
}): void {
|
|
56
68
|
mergeMessages(notification.channelId, [notification.message], { countUnread: options.countUnread });
|
|
57
69
|
const channel = ensureChannelState(notification.channelId);
|
|
58
|
-
|
|
59
|
-
|
|
70
|
+
const activelyViewed = appActive && channel.focusedViewCount > 0;
|
|
71
|
+
const delivered = activelyViewed || notifyChatServerMessage({
|
|
72
|
+
notification,
|
|
73
|
+
channel: getChannel(notification.channelId),
|
|
74
|
+
notifiedMessageIds,
|
|
75
|
+
notify,
|
|
76
|
+
});
|
|
77
|
+
if (activelyViewed) {
|
|
78
|
+
notifiedMessageIds.add(notification.messageId);
|
|
79
|
+
}
|
|
80
|
+
if (delivered) {
|
|
81
|
+
void apiClient.markChatNotificationsDelivered([notification.id]).catch(() => {});
|
|
60
82
|
}
|
|
61
|
-
void apiClient.markChatNotificationsDelivered([notification.id]).catch(() => {});
|
|
62
83
|
}
|
|
@@ -48,6 +48,8 @@ export interface ChatControllerSnapshot {
|
|
|
48
48
|
channelStates: ChatChannelState[];
|
|
49
49
|
channelsLoading: boolean;
|
|
50
50
|
loading: boolean;
|
|
51
|
+
/** Last message-load failure for this channel, or null. */
|
|
52
|
+
messagesError: string | null;
|
|
51
53
|
loadingOlderMessages: boolean;
|
|
52
54
|
hasOlderMessages: boolean;
|
|
53
55
|
hasSavedSession: boolean;
|
|
@@ -69,6 +71,8 @@ export type MergeMessagesOptions = { countUnread?: boolean };
|
|
|
69
71
|
export interface ChannelRuntimeState {
|
|
70
72
|
hydrated: boolean;
|
|
71
73
|
messagesLoading: boolean;
|
|
74
|
+
/** Last message-load failure, so an empty transcript is never mistaken for "no messages". */
|
|
75
|
+
messagesError: string | null;
|
|
72
76
|
olderMessagesLoading: boolean;
|
|
73
77
|
refreshMessagesPromise: Promise<void> | null;
|
|
74
78
|
loadOlderMessagesPromise: Promise<void> | null;
|
|
@@ -92,6 +96,7 @@ export interface ChannelRuntimeState {
|
|
|
92
96
|
wsConnected: boolean;
|
|
93
97
|
draftSyncTimer: ReturnType<typeof setTimeout> | null;
|
|
94
98
|
openViewCount: number;
|
|
99
|
+
focusedViewCount: number;
|
|
95
100
|
}
|
|
96
101
|
|
|
97
102
|
export function channelStateKey(channelId: string): string {
|
|
@@ -107,6 +112,7 @@ export function createEmptyChannelState(): ChannelRuntimeState {
|
|
|
107
112
|
return {
|
|
108
113
|
hydrated: false,
|
|
109
114
|
messagesLoading: false,
|
|
115
|
+
messagesError: null,
|
|
110
116
|
olderMessagesLoading: false,
|
|
111
117
|
refreshMessagesPromise: null,
|
|
112
118
|
loadOlderMessagesPromise: null,
|
|
@@ -125,6 +131,7 @@ export function createEmptyChannelState(): ChannelRuntimeState {
|
|
|
125
131
|
wsConnected: false,
|
|
126
132
|
draftSyncTimer: null,
|
|
127
133
|
openViewCount: 0,
|
|
134
|
+
focusedViewCount: 0,
|
|
128
135
|
};
|
|
129
136
|
}
|
|
130
137
|
|
|
@@ -66,6 +66,7 @@ export class ChatControllerView {
|
|
|
66
66
|
channelStates: this.options.getChannelStateSnapshots(),
|
|
67
67
|
channelsLoading: this.options.isChannelsLoading(),
|
|
68
68
|
loading: !this.options.isSessionChecked() || channel.messagesLoading,
|
|
69
|
+
messagesError: channel.messagesError,
|
|
69
70
|
loadingOlderMessages: channel.olderMessagesLoading,
|
|
70
71
|
hasOlderMessages: channel.messages.length > 0 && !channel.reachedOldestMessage,
|
|
71
72
|
hasSavedSession: this.options.hasSessionToken(),
|
|
@@ -36,6 +36,27 @@ function recentChatTimestamp(offsetMs = 60_000) {
|
|
|
36
36
|
return new Date(Date.now() - offsetMs).toISOString();
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
function mentionNotification(overrides: Partial<ChatNotification> = {}): ChatNotification {
|
|
40
|
+
const channelId = overrides.channelId ?? "everyone";
|
|
41
|
+
const messageId = overrides.messageId ?? "m1";
|
|
42
|
+
const createdAt = overrides.createdAt ?? "2026-03-28T00:00:00.000Z";
|
|
43
|
+
return {
|
|
44
|
+
id: overrides.id ?? "n1",
|
|
45
|
+
type: overrides.type ?? "mention",
|
|
46
|
+
channelId,
|
|
47
|
+
messageId,
|
|
48
|
+
createdAt,
|
|
49
|
+
message: overrides.message ?? {
|
|
50
|
+
id: messageId,
|
|
51
|
+
channelId,
|
|
52
|
+
content: "hey @vince",
|
|
53
|
+
replyToId: null,
|
|
54
|
+
createdAt,
|
|
55
|
+
user: { id: "u2", username: "bob", displayName: "Bob" },
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
39
60
|
class TrackingPersistence extends MemoryPersistence {
|
|
40
61
|
stateWrites = 0;
|
|
41
62
|
|
|
@@ -974,18 +995,11 @@ describe("ChatController", () => {
|
|
|
974
995
|
});
|
|
975
996
|
});
|
|
976
997
|
|
|
977
|
-
test("
|
|
998
|
+
test("delivers background notifications while the focused chat stays unread", async () => {
|
|
978
999
|
const persistence = new MemoryPersistence();
|
|
979
1000
|
const controller = new ChatController();
|
|
980
1001
|
const notifications: AppNotificationRequest[] = [];
|
|
981
|
-
const
|
|
982
|
-
id: "m1",
|
|
983
|
-
channelId: "everyone",
|
|
984
|
-
content: "hey @vince",
|
|
985
|
-
replyToId: null,
|
|
986
|
-
createdAt: "2026-03-28T00:00:00.000Z",
|
|
987
|
-
user: { id: "u2", username: "bob", displayName: "Bob" },
|
|
988
|
-
};
|
|
1002
|
+
const deliveredIds: string[][] = [];
|
|
989
1003
|
|
|
990
1004
|
persistence.setState("session", {
|
|
991
1005
|
sessionToken: "token-123",
|
|
@@ -994,18 +1008,17 @@ describe("ChatController", () => {
|
|
|
994
1008
|
|
|
995
1009
|
controller.setNotifier((notification) => {
|
|
996
1010
|
notifications.push(notification);
|
|
1011
|
+
return { toastVisible: false, desktopRequested: true };
|
|
997
1012
|
});
|
|
1013
|
+
apiClient.markChatNotificationsDelivered = async (ids) => {
|
|
1014
|
+
deliveredIds.push(ids);
|
|
1015
|
+
return { delivered: ids.length };
|
|
1016
|
+
};
|
|
998
1017
|
controller.attachPersistence(persistence);
|
|
1018
|
+
const detachView = controller.attachView(true);
|
|
999
1019
|
controller.setAppActive(false);
|
|
1000
1020
|
|
|
1001
|
-
(controller as any).handleChatNotification(
|
|
1002
|
-
id: "n1",
|
|
1003
|
-
type: "mention",
|
|
1004
|
-
channelId: "everyone",
|
|
1005
|
-
messageId: "m1",
|
|
1006
|
-
createdAt: "2026-03-28T00:00:00.000Z",
|
|
1007
|
-
message,
|
|
1008
|
-
} satisfies ChatNotification);
|
|
1021
|
+
(controller as any).handleChatNotification(mentionNotification());
|
|
1009
1022
|
|
|
1010
1023
|
expect(notifications).toEqual([{
|
|
1011
1024
|
title: "Gloomberb chat",
|
|
@@ -1014,6 +1027,49 @@ describe("ChatController", () => {
|
|
|
1014
1027
|
type: "info",
|
|
1015
1028
|
desktop: "when-inactive",
|
|
1016
1029
|
}]);
|
|
1030
|
+
expect(controller.getSnapshot().unreadMentionCount).toBe(1);
|
|
1031
|
+
expect(deliveredIds).toEqual([["n1"]]);
|
|
1032
|
+
|
|
1033
|
+
controller.setAppActive(true);
|
|
1034
|
+
await flushMicrotasks();
|
|
1035
|
+
await flushMicrotasks();
|
|
1036
|
+
expect(controller.getSnapshot().unreadMentionCount).toBe(0);
|
|
1037
|
+
detachView();
|
|
1038
|
+
});
|
|
1039
|
+
|
|
1040
|
+
test("keeps undeliverable background notifications pending for email fallback", () => {
|
|
1041
|
+
const persistence = new MemoryPersistence();
|
|
1042
|
+
const controller = new ChatController();
|
|
1043
|
+
const deliveredIds: string[][] = [];
|
|
1044
|
+
let desktopAvailable = false;
|
|
1045
|
+
let presentationCount = 0;
|
|
1046
|
+
|
|
1047
|
+
persistence.setState("session", {
|
|
1048
|
+
sessionToken: "token-123",
|
|
1049
|
+
user: { id: "u1", username: "vince", emailVerified: true },
|
|
1050
|
+
}, { schemaVersion: 1 });
|
|
1051
|
+
controller.setNotifier(() => {
|
|
1052
|
+
presentationCount += 1;
|
|
1053
|
+
return { toastVisible: false, desktopRequested: desktopAvailable };
|
|
1054
|
+
});
|
|
1055
|
+
apiClient.markChatNotificationsDelivered = async (ids) => {
|
|
1056
|
+
deliveredIds.push(ids);
|
|
1057
|
+
return { delivered: ids.length };
|
|
1058
|
+
};
|
|
1059
|
+
controller.attachPersistence(persistence);
|
|
1060
|
+
controller.setAppActive(false);
|
|
1061
|
+
|
|
1062
|
+
const notification = mentionNotification({ type: "reply" });
|
|
1063
|
+
(controller as any).handleChatNotification(notification);
|
|
1064
|
+
|
|
1065
|
+
expect(presentationCount).toBe(1);
|
|
1066
|
+
expect(deliveredIds).toEqual([]);
|
|
1067
|
+
|
|
1068
|
+
desktopAvailable = true;
|
|
1069
|
+
(controller as any).handleChatNotification({ ...notification, id: "n2" });
|
|
1070
|
+
|
|
1071
|
+
expect(presentationCount).toBe(2);
|
|
1072
|
+
expect(deliveredIds).toEqual([["n2"]]);
|
|
1017
1073
|
});
|
|
1018
1074
|
|
|
1019
1075
|
test("marks mentions viewed when a chat view opens", () => {
|
|
@@ -1053,18 +1109,11 @@ describe("ChatController", () => {
|
|
|
1053
1109
|
detachView();
|
|
1054
1110
|
});
|
|
1055
1111
|
|
|
1056
|
-
test("
|
|
1112
|
+
test("keeps focused foreground notifications read without presenting an alert", () => {
|
|
1057
1113
|
const persistence = new MemoryPersistence();
|
|
1058
1114
|
const controller = new ChatController();
|
|
1059
1115
|
const notifications: AppNotificationRequest[] = [];
|
|
1060
|
-
const
|
|
1061
|
-
id: "m1",
|
|
1062
|
-
channelId: "everyone",
|
|
1063
|
-
content: "hey @vince",
|
|
1064
|
-
replyToId: null,
|
|
1065
|
-
createdAt: "2026-03-28T00:00:00.000Z",
|
|
1066
|
-
user: { id: "u2", username: "bob", displayName: "Bob" },
|
|
1067
|
-
};
|
|
1116
|
+
const deliveredIds: string[][] = [];
|
|
1068
1117
|
|
|
1069
1118
|
persistence.setState("session", {
|
|
1070
1119
|
sessionToken: "token-123",
|
|
@@ -1074,13 +1123,18 @@ describe("ChatController", () => {
|
|
|
1074
1123
|
controller.setNotifier((notification) => {
|
|
1075
1124
|
notifications.push(notification);
|
|
1076
1125
|
});
|
|
1126
|
+
apiClient.markChatNotificationsDelivered = async (ids) => {
|
|
1127
|
+
deliveredIds.push(ids);
|
|
1128
|
+
return { delivered: ids.length };
|
|
1129
|
+
};
|
|
1077
1130
|
controller.attachPersistence(persistence);
|
|
1078
|
-
const detachView = controller.attachView();
|
|
1131
|
+
const detachView = controller.attachView(true);
|
|
1079
1132
|
|
|
1080
|
-
(controller as any).
|
|
1133
|
+
(controller as any).handleChatNotification(mentionNotification());
|
|
1081
1134
|
|
|
1082
1135
|
expect(controller.getSnapshot().unreadMentionCount).toBe(0);
|
|
1083
1136
|
expect(notifications).toEqual([]);
|
|
1137
|
+
expect(deliveredIds).toEqual([["n1"]]);
|
|
1084
1138
|
expect(persistence.getState<{ lastViewedMessageId: string | null }>("channel:everyone", { schemaVersion: 1 })).toMatchObject({
|
|
1085
1139
|
lastViewedMessageId: "m1",
|
|
1086
1140
|
});
|
|
@@ -1088,6 +1142,39 @@ describe("ChatController", () => {
|
|
|
1088
1142
|
detachView();
|
|
1089
1143
|
});
|
|
1090
1144
|
|
|
1145
|
+
test("keeps an unfocused foreground chat unread while presenting an in-app alert", () => {
|
|
1146
|
+
const persistence = new MemoryPersistence();
|
|
1147
|
+
const controller = new ChatController();
|
|
1148
|
+
const notifications: AppNotificationRequest[] = [];
|
|
1149
|
+
const deliveredIds: string[][] = [];
|
|
1150
|
+
|
|
1151
|
+
persistence.setState("session", {
|
|
1152
|
+
sessionToken: "token-123",
|
|
1153
|
+
user: { id: "u1", username: "vince", emailVerified: true },
|
|
1154
|
+
}, { schemaVersion: 1 });
|
|
1155
|
+
controller.setNotifier((notification) => {
|
|
1156
|
+
notifications.push(notification);
|
|
1157
|
+
return { toastVisible: true, desktopRequested: false };
|
|
1158
|
+
});
|
|
1159
|
+
apiClient.markChatNotificationsDelivered = async (ids) => {
|
|
1160
|
+
deliveredIds.push(ids);
|
|
1161
|
+
return { delivered: ids.length };
|
|
1162
|
+
};
|
|
1163
|
+
controller.attachPersistence(persistence);
|
|
1164
|
+
const detachUnfocusedView = controller.attachView(false);
|
|
1165
|
+
|
|
1166
|
+
(controller as any).handleChatNotification(mentionNotification());
|
|
1167
|
+
|
|
1168
|
+
expect(notifications).toHaveLength(1);
|
|
1169
|
+
expect(controller.getSnapshot().unreadMentionCount).toBe(1);
|
|
1170
|
+
expect(deliveredIds).toEqual([["n1"]]);
|
|
1171
|
+
|
|
1172
|
+
detachUnfocusedView();
|
|
1173
|
+
const detachFocusedView = controller.attachView(true);
|
|
1174
|
+
expect(controller.getSnapshot().unreadMentionCount).toBe(0);
|
|
1175
|
+
detachFocusedView();
|
|
1176
|
+
});
|
|
1177
|
+
|
|
1091
1178
|
test("loads server chat state, pending reply notifications, and acks delivery", async () => {
|
|
1092
1179
|
const persistence = new MemoryPersistence();
|
|
1093
1180
|
const controller = new ChatController();
|
|
@@ -1147,6 +1234,7 @@ describe("ChatController", () => {
|
|
|
1147
1234
|
|
|
1148
1235
|
controller.setNotifier((notification) => {
|
|
1149
1236
|
notifications.push(notification);
|
|
1237
|
+
return { toastVisible: true, desktopRequested: false };
|
|
1150
1238
|
});
|
|
1151
1239
|
controller.attachPersistence(persistence);
|
|
1152
1240
|
|
|
@@ -1229,6 +1317,7 @@ describe("ChatController", () => {
|
|
|
1229
1317
|
}, { schemaVersion: 1 });
|
|
1230
1318
|
controller.setNotifier((entry) => {
|
|
1231
1319
|
notifications.push(entry);
|
|
1320
|
+
return { toastVisible: true, desktopRequested: false };
|
|
1232
1321
|
});
|
|
1233
1322
|
controller.attachPersistence(persistence);
|
|
1234
1323
|
|
|
@@ -1,8 +1,26 @@
|
|
|
1
1
|
import type { GloomPluginContext } from "../../../types/plugin";
|
|
2
2
|
import { apiClient } from "../../../api-client";
|
|
3
3
|
import { chatController } from "../chat/controller";
|
|
4
|
+
import { requestDeviceSignInDialog } from "./device-signin-dialog";
|
|
4
5
|
|
|
5
6
|
export function registerCloudAuthCommands(ctx: GloomPluginContext): void {
|
|
7
|
+
ctx.registerCommand({
|
|
8
|
+
id: "auth-login-qr",
|
|
9
|
+
label: "Log In with QR Code",
|
|
10
|
+
description: "Sign in by scanning a QR code with the Gloom app",
|
|
11
|
+
keywords: ["login", "sign in", "qr", "scan", "device", "mobile", "phone", "app", "code"],
|
|
12
|
+
category: "config",
|
|
13
|
+
hidden: () => !!apiClient.getSessionToken(),
|
|
14
|
+
execute: () => {
|
|
15
|
+
const opened = requestDeviceSignInDialog({
|
|
16
|
+
onSignedIn: () => ctx.showPane("chat"),
|
|
17
|
+
});
|
|
18
|
+
if (!opened) {
|
|
19
|
+
ctx.notify({ body: "QR sign-in is not available right now.", type: "error" });
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
|
|
6
24
|
ctx.registerCommand({
|
|
7
25
|
id: "auth-login",
|
|
8
26
|
label: "Log In",
|