gloomberb 0.15.7 → 0.16.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 +11 -2
- package/package.json +1 -1
- package/src/api-client/app-attention.ts +147 -0
- package/src/api-client/attention.ts +26 -0
- package/src/api-client/awards.ts +215 -0
- package/src/api-client/catalysts.ts +160 -0
- package/src/api-client/chat.ts +137 -14
- package/src/api-client/company-kpis.ts +153 -0
- package/src/api-client/cpi.ts +52 -0
- package/src/api-client/credit-documents.ts +107 -0
- package/src/api-client/data.ts +192 -3
- package/src/api-client/distress.ts +164 -0
- package/src/api-client/doe.ts +75 -0
- package/src/api-client/equity-screener.ts +11 -0
- package/src/api-client/exposure.ts +202 -0
- package/src/api-client/gpu.ts +93 -0
- package/src/api-client/hiring.ts +110 -0
- package/src/api-client/index.ts +78 -3
- package/src/api-client/normalizers.ts +31 -1
- package/src/api-client/paths.ts +3 -0
- package/src/api-client/perps.ts +127 -0
- package/src/api-client/power.ts +148 -0
- package/src/api-client/request.ts +58 -1
- package/src/api-client/research-activity.ts +172 -13
- package/src/api-client/socket.ts +75 -27
- package/src/api-client/supply-chain-graph.ts +40 -0
- package/src/api-client/supply-chain.ts +98 -0
- package/src/api-client/telemetry.ts +29 -0
- package/src/api-client/themes.ts +28 -0
- package/src/api-client/types.ts +33 -1
- package/src/api-client/wall-experiments.ts +100 -0
- package/src/api-client/wall-summary.ts +49 -0
- package/src/api-client/web-experiments.ts +136 -0
- package/src/app/pane-runtime/plugin-bindings.ts +5 -0
- package/src/app/pane-runtime/ticker-open-runtime.ts +8 -2
- package/src/app/runtime/update.ts +13 -1
- package/src/cli/commands/system.ts +2 -0
- package/src/cli/desktop-pane-shot.ts +3 -4
- package/src/cli/pane-functions/data.ts +78 -0
- package/src/cli/pane-functions/financial-ratio-shot.ts +160 -0
- package/src/cli/pane-functions/function-help.ts +220 -8
- package/src/cli/pane-functions/headless.ts +4 -0
- package/src/cli/pane-functions/screenshot-evidence.ts +21 -0
- package/src/cli/pane-functions/screenshot.ts +49 -5
- package/src/components/chart/composite/composite-chart.tsx +15 -2
- package/src/components/chart/composite/format.ts +24 -11
- package/src/components/chart/composite/rasterizer.ts +67 -16
- package/src/components/chart/composite/scene.ts +53 -2
- package/src/components/chart/composite/session-shading.ts +3 -2
- package/src/components/chart/composite/text-renderer.ts +52 -1
- package/src/components/chart/composite/time-axis.ts +100 -30
- package/src/components/chart/composite/tools.ts +2 -1
- package/src/components/chart/composite/types.ts +4 -0
- package/src/components/chart-table/index.ts +1 -0
- package/src/components/chart-table/layout.ts +15 -0
- package/src/components/command-bar/action-runtime.ts +1 -0
- package/src/components/command-bar/commands/direct/index.ts +32 -0
- package/src/components/command-bar/commands/registry.ts +7 -0
- package/src/components/command-bar/pane-templates/items.ts +11 -0
- package/src/components/command-bar/pane-templates/workflow.ts +19 -4
- package/src/components/command-bar/routes/root/command-items.ts +6 -0
- package/src/components/command-bar/routes/root/provider-search.ts +2 -0
- package/src/components/command-bar/routes/root/results.ts +64 -0
- package/src/components/command-bar/routes/root/runtime.ts +8 -0
- package/src/components/command-bar/routes/ticker-search/results.ts +89 -24
- package/src/components/command-bar/routes/ticker-search/route.ts +2 -0
- package/src/components/command-bar/surface/index.tsx +15 -0
- package/src/components/command-bar/view-model.ts +3 -0
- package/src/components/command-bar/workflow/collection-actions.ts +9 -7
- package/src/components/command-bar/workflow/ops.ts +19 -0
- package/src/components/command-bar/workflow/tickers.ts +5 -0
- package/src/components/company-logo.tsx +15 -2
- package/src/components/data-table/table-pane.ts +2 -1
- package/src/components/index.ts +1 -0
- package/src/components/layout/detached-pane-shell.tsx +12 -1
- package/src/components/layout/missing-pane.tsx +87 -23
- package/src/components/layout/pane/footer/index.tsx +64 -18
- package/src/components/layout/pane/footer/model.ts +85 -0
- package/src/components/layout/pane/sidebar.tsx +19 -1
- package/src/components/layout/shell/index.tsx +38 -28
- package/src/components/layout/shell/pane/management-shortcuts.ts +13 -1
- package/src/components/layout/status-bar.tsx +93 -28
- package/src/components/layout/status-widget-space.ts +72 -0
- package/src/components/onboarding/first-run-workspace.ts +8 -2
- package/src/components/onboarding/onboarding-wizard.tsx +35 -16
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +14 -5
- package/src/components/onboarding/wizard-model.ts +13 -5
- package/src/components/onboarding/wizard-positions.ts +56 -7
- package/src/components/price-performance.tsx +31 -34
- package/src/components/ui/data-table/index.tsx +11 -8
- package/src/components/ui/display.tsx +15 -6
- package/src/components/ui/fields.tsx +5 -0
- package/src/components/ui/figure.tsx +94 -0
- package/src/components/ui/header-case.ts +25 -3
- package/src/components/ui/icon.tsx +3 -1
- package/src/components/ui/message-composer.tsx +8 -1
- package/src/components/ui/query-bar.tsx +8 -1
- package/src/components/ui/ratio-bar.tsx +84 -0
- package/src/components/ui/toggle.tsx +3 -1
- package/src/components/use-scrollbox-layout.ts +17 -0
- package/src/core/state/app/layout.ts +35 -1
- package/src/core/state/app/state.ts +15 -0
- package/src/core/state/app/types.ts +1 -0
- package/src/data/config/store/normalize.ts +24 -0
- package/src/i18n/es.ts +2 -0
- package/src/i18n/ja.ts +2 -0
- package/src/i18n/ko.ts +2 -0
- package/src/i18n/zh-cn.ts +2 -0
- package/src/i18n/zh-tw.ts +2 -0
- package/src/layout-marketplace/pane-imagery.ts +1 -0
- package/src/market-data/coordinator/entries.ts +13 -0
- package/src/market-data/coordinator/financials.ts +33 -8
- package/src/market-data/market/freshness.ts +16 -5
- package/src/market-data/market/trading-sessions.ts +65 -1
- package/src/market-data/published-cn-sessions.ts +25 -0
- package/src/market-data/published-nse-sessions.ts +20 -0
- package/src/news/aggregator.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +6 -1
- package/src/plugins/builtin/account-management/pane.tsx +36 -25
- package/src/plugins/builtin/alerts/catalysts.ts +77 -0
- package/src/plugins/builtin/alerts/events-pane.tsx +3 -0
- package/src/plugins/builtin/alerts/events.ts +10 -4
- package/src/plugins/builtin/alerts/history-pane.tsx +1 -1
- package/src/plugins/builtin/alerts/history.ts +1 -0
- package/src/plugins/builtin/alerts/index.tsx +6 -0
- package/src/plugins/builtin/alerts/research-builder.ts +10 -3
- package/src/plugins/builtin/alerts/research-rules.ts +15 -1
- package/src/plugins/builtin/analytics/risk-client.ts +15 -3
- package/src/plugins/builtin/analytics/risk-headless.ts +123 -18
- package/src/plugins/builtin/attention/client.ts +80 -0
- package/src/plugins/builtin/attention/evidence.ts +30 -0
- package/src/plugins/builtin/attention/headless.ts +33 -0
- package/src/plugins/builtin/attention/index.tsx +18 -0
- package/src/plugins/builtin/attention/model.ts +59 -0
- package/src/plugins/builtin/attention/pane.tsx +211 -0
- package/src/plugins/builtin/attention/trending.tsx +59 -0
- package/src/plugins/builtin/awards/alerts.ts +32 -0
- package/src/plugins/builtin/awards/client.ts +82 -0
- package/src/plugins/builtin/awards/detail.tsx +107 -0
- package/src/plugins/builtin/awards/evidence.ts +36 -0
- package/src/plugins/builtin/awards/headless.ts +55 -0
- package/src/plugins/builtin/awards/index.tsx +20 -0
- package/src/plugins/builtin/awards/model.ts +42 -0
- package/src/plugins/builtin/awards/pane.tsx +263 -0
- package/src/plugins/builtin/catalysts/client.ts +28 -0
- package/src/plugins/builtin/catalysts/detail.tsx +88 -0
- package/src/plugins/builtin/catalysts/evidence.ts +47 -0
- package/src/plugins/builtin/catalysts/headless.ts +42 -0
- package/src/plugins/builtin/catalysts/history.ts +26 -0
- package/src/plugins/builtin/catalysts/index.tsx +29 -0
- package/src/plugins/builtin/catalysts/model.ts +135 -0
- package/src/plugins/builtin/catalysts/pane.tsx +159 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -0
- package/src/plugins/builtin/chart-composer/headless-schema.ts +6 -0
- package/src/plugins/builtin/chart-composer/index.tsx +8 -1
- package/src/plugins/builtin/chart-composer/pane.tsx +28 -1
- package/src/plugins/builtin/chat/attachments/desktop.tsx +610 -0
- package/src/plugins/builtin/chat/attachments/files.ts +45 -0
- package/src/plugins/builtin/chat/attachments/model.ts +164 -0
- package/src/plugins/builtin/chat/attachments/terminal.tsx +72 -0
- package/src/plugins/builtin/chat/attachments/transfer.ts +165 -0
- package/src/plugins/builtin/chat/content/channel-navigation.ts +13 -12
- package/src/plugins/builtin/chat/content/composer-runtime.ts +25 -4
- package/src/plugins/builtin/chat/content/composer.tsx +46 -4
- package/src/plugins/builtin/chat/content/footer.tsx +46 -8
- package/src/plugins/builtin/chat/content/index.tsx +263 -62
- package/src/plugins/builtin/chat/content/layout-metrics.ts +10 -2
- package/src/plugins/builtin/chat/content/open-targets.ts +17 -3
- package/src/plugins/builtin/chat/content/scroll.ts +7 -1
- package/src/plugins/builtin/chat/content/shortcuts.ts +36 -11
- package/src/plugins/builtin/chat/content/snapshot.ts +3 -0
- package/src/plugins/builtin/chat/content/transcript.tsx +17 -1
- package/src/plugins/builtin/chat/content/types.ts +7 -0
- package/src/plugins/builtin/chat/controller/attachments.ts +213 -0
- package/src/plugins/builtin/chat/controller/connections.ts +3 -1
- package/src/plugins/builtin/chat/controller/index.ts +114 -2
- package/src/plugins/builtin/chat/controller/lifecycle.ts +9 -0
- package/src/plugins/builtin/chat/controller/messages.ts +35 -2
- package/src/plugins/builtin/chat/controller/send.ts +128 -25
- package/src/plugins/builtin/chat/controller/state.ts +12 -1
- package/src/plugins/builtin/chat/controller/utils.ts +7 -5
- package/src/plugins/builtin/chat/controller/view.ts +2 -0
- package/src/plugins/builtin/chat/index.tsx +21 -0
- package/src/plugins/builtin/chat/layout.ts +9 -4
- package/src/plugins/builtin/chat/message/desktop.tsx +55 -20
- package/src/plugins/builtin/chat/message/header.tsx +30 -5
- package/src/plugins/builtin/chat/message/inline-tokens.tsx +9 -0
- package/src/plugins/builtin/chat/message/pending-send.ts +35 -0
- package/src/plugins/builtin/chat/message/profile-popover.tsx +5 -1
- package/src/plugins/builtin/chat/message/render-state.ts +12 -2
- package/src/plugins/builtin/chat/message/terminal.tsx +51 -4
- package/src/plugins/builtin/chat/message/types.ts +6 -1
- package/src/plugins/builtin/chat/pane-state.ts +59 -1
- package/src/plugins/builtin/chat/profile-popover.ts +50 -1
- package/src/plugins/builtin/chat/sidebar.tsx +8 -3
- package/src/plugins/builtin/chat/status-widget.tsx +29 -12
- package/src/plugins/builtin/chat/unread-inbox-pane.tsx +143 -0
- package/src/plugins/builtin/chat/unread-inbox.ts +91 -0
- package/src/plugins/builtin/clinical-trials/client.ts +237 -0
- package/src/plugins/builtin/clinical-trials/index.tsx +74 -0
- package/src/plugins/builtin/clinical-trials/pane.tsx +225 -0
- package/src/plugins/builtin/clinical-trials/types.ts +2 -0
- package/src/plugins/builtin/cloud/askg/controller.ts +37 -6
- package/src/plugins/builtin/cloud/askg/executor.ts +59 -44
- package/src/plugins/builtin/cloud/askg/host.ts +8 -1
- package/src/plugins/builtin/cloud/askg/manifest.ts +29 -2
- package/src/plugins/builtin/cloud/askg/model.ts +47 -13
- package/src/plugins/builtin/cloud/askg/notes.ts +100 -0
- package/src/plugins/builtin/cloud/askg/pane.tsx +50 -14
- package/src/plugins/builtin/cloud/askg/protocol.ts +39 -1
- package/src/plugins/builtin/cloud/askg/result-budget.ts +156 -0
- package/src/plugins/builtin/cloud/askg/user-data.ts +89 -0
- package/src/plugins/builtin/cloud/auth-actions.tsx +55 -31
- package/src/plugins/builtin/cloud/plugin.tsx +4 -1
- package/src/plugins/builtin/cloud/team/pane-sections.tsx +10 -1
- package/src/plugins/builtin/cloud/team/pane.tsx +3 -2
- package/src/plugins/builtin/cloud/thesis/board-pane.tsx +2 -2
- package/src/plugins/builtin/cloud/thesis/detail.tsx +1 -1
- package/src/plugins/builtin/cloud/thesis/ticker-tab.tsx +2 -2
- package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +202 -0
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/cloud/upgrade-dialog.tsx +29 -3
- package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +1 -1
- package/src/plugins/builtin/cloud-tweets/table.tsx +1 -1
- package/src/plugins/builtin/comment-letters/client.ts +342 -0
- package/src/plugins/builtin/comment-letters/index.tsx +74 -0
- package/src/plugins/builtin/comment-letters/pane.tsx +295 -0
- package/src/plugins/builtin/comment-letters/types.ts +43 -0
- package/src/plugins/builtin/company-attention/app-rank.tsx +79 -0
- package/src/plugins/builtin/company-attention/client.ts +69 -0
- package/src/plugins/builtin/company-attention/evidence.ts +45 -0
- package/src/plugins/builtin/company-attention/headless.ts +47 -0
- package/src/plugins/builtin/company-attention/index.tsx +30 -0
- package/src/plugins/builtin/company-attention/model.ts +129 -0
- package/src/plugins/builtin/company-attention/pane.tsx +183 -0
- package/src/plugins/builtin/company-kpis/client.ts +92 -0
- package/src/plugins/builtin/company-kpis/headless.ts +32 -0
- package/src/plugins/builtin/company-kpis/index.tsx +26 -0
- package/src/plugins/builtin/company-kpis/model.ts +124 -0
- package/src/plugins/builtin/company-kpis/pane.tsx +226 -0
- package/src/plugins/builtin/company-kpis/related.ts +11 -0
- package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +44 -0
- package/src/plugins/builtin/composite-plugins.ts +34 -0
- package/src/plugins/builtin/correlation/history.ts +4 -1
- package/src/plugins/builtin/correlation/index.tsx +139 -80
- package/src/plugins/builtin/correlation/matrix/pair-chart.tsx +48 -0
- package/src/plugins/builtin/correlation/matrix/selection.ts +77 -0
- package/src/plugins/builtin/correlation/relationship/model.ts +2 -2
- package/src/plugins/builtin/cpi/client.ts +66 -0
- package/src/plugins/builtin/cpi/headless.ts +78 -0
- package/src/plugins/builtin/cpi/index.tsx +31 -0
- package/src/plugins/builtin/cpi/model.ts +198 -0
- package/src/plugins/builtin/cpi/pane.tsx +157 -0
- package/src/plugins/builtin/credit-documents/client.ts +99 -0
- package/src/plugins/builtin/credit-documents/detail.tsx +109 -0
- package/src/plugins/builtin/credit-documents/evidence.ts +64 -0
- package/src/plugins/builtin/credit-documents/gauge.tsx +55 -0
- package/src/plugins/builtin/credit-documents/headless.ts +40 -0
- package/src/plugins/builtin/credit-documents/index.tsx +19 -0
- package/src/plugins/builtin/credit-documents/model.ts +336 -0
- package/src/plugins/builtin/credit-documents/pane.tsx +185 -0
- package/src/plugins/builtin/custom-view/view-spec.ts +14 -2
- package/src/plugins/builtin/debt-maturities/pane.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/pane.tsx +1 -1
- package/src/plugins/builtin/doe/client.ts +73 -0
- package/src/plugins/builtin/doe/headless.ts +93 -0
- package/src/plugins/builtin/doe/index.tsx +41 -0
- package/src/plugins/builtin/doe/model.ts +215 -0
- package/src/plugins/builtin/doe/pane.tsx +148 -0
- package/src/plugins/builtin/doe/range-bar.tsx +45 -0
- package/src/plugins/builtin/earnings/board.tsx +3 -0
- package/src/plugins/builtin/earnings/index.tsx +2 -0
- package/src/plugins/builtin/earnings-calls/pane.tsx +7 -1
- package/src/plugins/builtin/earnings-calls/transcript-view.tsx +7 -7
- package/src/plugins/builtin/earnings-ripple/client.ts +60 -0
- package/src/plugins/builtin/earnings-ripple/headless.ts +35 -0
- package/src/plugins/builtin/earnings-ripple/index.tsx +35 -0
- package/src/plugins/builtin/earnings-ripple/model.ts +98 -0
- package/src/plugins/builtin/earnings-ripple/pane.tsx +103 -0
- package/src/plugins/builtin/equity-screener/client.ts +1 -1
- package/src/plugins/builtin/equity-screener/criterion-editor.tsx +1 -1
- package/src/plugins/builtin/equity-screener/model.ts +74 -9
- package/src/plugins/builtin/equity-screener/pane.tsx +2 -0
- package/src/plugins/builtin/estimate-revisions/pane.tsx +3 -0
- package/src/plugins/builtin/executives/pane.tsx +7 -5
- package/src/plugins/builtin/exposure/charts.tsx +66 -0
- package/src/plugins/builtin/exposure/client.ts +53 -0
- package/src/plugins/builtin/exposure/drivers.ts +29 -0
- package/src/plugins/builtin/exposure/editor.tsx +61 -0
- package/src/plugins/builtin/exposure/evidence.ts +39 -0
- package/src/plugins/builtin/exposure/headless.ts +51 -0
- package/src/plugins/builtin/exposure/holdings.ts +56 -0
- package/src/plugins/builtin/exposure/index.tsx +13 -0
- package/src/plugins/builtin/exposure/model.ts +104 -0
- package/src/plugins/builtin/exposure/pane.tsx +247 -0
- package/src/plugins/builtin/fear-greed/charts.tsx +1 -1
- package/src/plugins/builtin/fear-greed/pane.tsx +2 -9
- package/src/plugins/builtin/filing-events/pane.tsx +2 -1
- package/src/plugins/builtin/gpu/board.tsx +163 -0
- package/src/plugins/builtin/gpu/changes.tsx +94 -0
- package/src/plugins/builtin/gpu/client.ts +130 -0
- package/src/plugins/builtin/gpu/equities.tsx +112 -0
- package/src/plugins/builtin/gpu/headless.ts +67 -0
- package/src/plugins/builtin/gpu/history.tsx +140 -0
- package/src/plugins/builtin/gpu/index.tsx +18 -0
- package/src/plugins/builtin/gpu/ladder.tsx +127 -0
- package/src/plugins/builtin/gpu/model.ts +317 -0
- package/src/plugins/builtin/gpu/pane.tsx +63 -0
- package/src/plugins/builtin/help/index.tsx +19 -2
- package/src/plugins/builtin/holders/pane.tsx +5 -9
- package/src/plugins/builtin/insider/detail.tsx +119 -0
- package/src/plugins/builtin/insider/display.ts +221 -0
- package/src/plugins/builtin/insider/headless.ts +24 -3
- package/src/plugins/builtin/insider/index.tsx +206 -108
- package/src/plugins/builtin/insider/insider-data.ts +31 -3
- package/src/plugins/builtin/insider/model.ts +53 -4
- package/src/plugins/builtin/insider/table-model.ts +226 -0
- package/src/plugins/builtin/insider/table.tsx +79 -0
- package/src/plugins/builtin/iv-history/screen-pane.tsx +1 -1
- package/src/plugins/builtin/jobs/pane.tsx +14 -7
- package/src/plugins/builtin/kelly-sizer/pane.tsx +1 -1
- package/src/plugins/builtin/macro-day/client.ts +50 -0
- package/src/plugins/builtin/macro-day/headless.ts +51 -0
- package/src/plugins/builtin/macro-day/index.tsx +21 -0
- package/src/plugins/builtin/macro-day/model.ts +137 -0
- package/src/plugins/builtin/macro-day/pane.tsx +118 -0
- package/src/plugins/builtin/macro-day/releases.ts +58 -0
- package/src/plugins/builtin/market-halts/model.ts +30 -17
- package/src/plugins/builtin/market-halts/pane.tsx +15 -21
- package/src/plugins/builtin/market-heatmap/data.ts +1 -1
- package/src/plugins/builtin/market-heatmap/index.tsx +198 -50
- package/src/plugins/builtin/market-heatmap/portfolio.ts +220 -0
- package/src/plugins/builtin/market-movers/index.tsx +1 -0
- package/src/plugins/builtin/market-movers/session-body.tsx +5 -2
- package/src/plugins/builtin/mna/distress/client.ts +326 -0
- package/src/plugins/builtin/mna/distress/detail.tsx +247 -0
- package/src/plugins/builtin/mna/distress/headless.ts +257 -0
- package/src/plugins/builtin/mna/distress/model.ts +427 -0
- package/src/plugins/builtin/mna/distress/pane.tsx +606 -0
- package/src/plugins/builtin/mna/index.tsx +15 -0
- package/src/plugins/builtin/mna/pane.tsx +42 -1
- package/src/plugins/builtin/news/index.tsx +62 -16
- package/src/plugins/builtin/news/wire/filter-articles.ts +54 -0
- package/src/plugins/builtin/news/wire/index.tsx +37 -3
- package/src/plugins/builtin/news/wire/industry-pane.tsx +29 -13
- package/src/plugins/builtin/news/wire/mutes.ts +253 -0
- package/src/plugins/builtin/news/wire/news/command-bar-search.ts +117 -0
- package/src/plugins/builtin/news/wire/news/footer.ts +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +34 -0
- package/src/plugins/builtin/news/wire/news/pop-out.tsx +158 -0
- package/src/plugins/builtin/news/wire/news/preset-pane.tsx +64 -19
- package/src/plugins/builtin/openfda/client.ts +300 -0
- package/src/plugins/builtin/openfda/index.tsx +71 -0
- package/src/plugins/builtin/openfda/pane.tsx +382 -0
- package/src/plugins/builtin/openfda/types.ts +76 -0
- package/src/plugins/builtin/options/footer.ts +1 -0
- package/src/plugins/builtin/options/view.tsx +1 -1
- package/src/plugins/builtin/options-calculator/pane.tsx +0 -1
- package/src/plugins/builtin/options-positioning/index.tsx +4 -2
- package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
- package/src/plugins/builtin/pe-band/client.ts +61 -0
- package/src/plugins/builtin/pe-band/headless.ts +51 -0
- package/src/plugins/builtin/pe-band/index.tsx +20 -0
- package/src/plugins/builtin/pe-band/model.ts +267 -0
- package/src/plugins/builtin/pe-band/pane.tsx +159 -0
- package/src/plugins/builtin/perps/client.ts +66 -0
- package/src/plugins/builtin/perps/equity-row.tsx +28 -0
- package/src/plugins/builtin/perps/headless.ts +34 -0
- package/src/plugins/builtin/perps/index.tsx +14 -0
- package/src/plugins/builtin/perps/model.ts +58 -0
- package/src/plugins/builtin/perps/pane.tsx +185 -0
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +0 -1
- package/src/plugins/builtin/portfolio-list/cli/render.ts +177 -87
- package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +6 -20
- package/src/plugins/builtin/portfolio-list/command-bar.ts +6 -2
- package/src/plugins/builtin/portfolio-list/headless.ts +237 -0
- package/src/plugins/builtin/portfolio-list/index.tsx +2 -0
- package/src/plugins/builtin/portfolio-list/mutations.ts +70 -1
- package/src/plugins/builtin/portfolio-list/pane/data.ts +17 -0
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +88 -5
- package/src/plugins/builtin/portfolio-list/pane/remove-ticker.ts +85 -0
- package/src/plugins/builtin/portfolio-list/pane/streaming.ts +18 -12
- package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +6 -0
- package/src/plugins/builtin/power/client.ts +100 -0
- package/src/plugins/builtin/power/detail.tsx +82 -0
- package/src/plugins/builtin/power/evidence.ts +56 -0
- package/src/plugins/builtin/power/generation.tsx +37 -0
- package/src/plugins/builtin/power/headless.ts +43 -0
- package/src/plugins/builtin/power/index.tsx +16 -0
- package/src/plugins/builtin/power/model.ts +89 -0
- package/src/plugins/builtin/power/pane.tsx +209 -0
- package/src/plugins/builtin/power/query.ts +25 -0
- package/src/plugins/builtin/relative-rotation/pane.tsx +3 -3
- package/src/plugins/builtin/research/analyst-pane.tsx +1 -1
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +13 -4
- package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +11 -9
- package/src/plugins/builtin/research-search/pane.tsx +21 -7
- package/src/plugins/builtin/revenue-breakdown/pane.tsx +1 -1
- package/src/plugins/builtin/reverse-dcf/client.ts +35 -0
- package/src/plugins/builtin/reverse-dcf/headless.ts +44 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +20 -0
- package/src/plugins/builtin/reverse-dcf/model.ts +87 -0
- package/src/plugins/builtin/reverse-dcf/pane.tsx +107 -0
- package/src/plugins/builtin/risk-factors/pane.tsx +6 -5
- package/src/plugins/builtin/scanner/denied.tsx +4 -2
- package/src/plugins/builtin/scanner/feed.ts +1 -0
- package/src/plugins/builtin/scanner/flow-pane.tsx +3 -2
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/seasonality/client.ts +4 -1
- package/src/plugins/builtin/sec/command-bar-search.ts +217 -0
- package/src/plugins/builtin/sec/forms.ts +54 -0
- package/src/plugins/builtin/sec/headless.ts +31 -5
- package/src/plugins/builtin/sec/index.tsx +67 -11
- package/src/plugins/builtin/sec/model.ts +35 -5
- package/src/plugins/builtin/sectors/headless.ts +1 -0
- package/src/plugins/builtin/sectors/index.tsx +72 -26
- package/src/plugins/builtin/shared/cloud-upgrade.ts +143 -39
- package/src/plugins/builtin/shared/pro-feature-wall.tsx +8 -4
- package/src/plugins/builtin/shared/research-cells.tsx +107 -0
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -1
- package/src/plugins/builtin/shared/ticker-request.ts +1 -1
- package/src/plugins/builtin/shared/wall-teaser-catalog.ts +80 -0
- package/src/plugins/builtin/shared/wall-teaser.tsx +192 -0
- package/src/plugins/builtin/shared/wall-view-lifecycle.ts +43 -0
- package/src/plugins/builtin/short-interest/index.tsx +31 -0
- package/src/plugins/builtin/short-interest/watch-client.ts +70 -0
- package/src/plugins/builtin/short-interest/watch-headless.ts +49 -0
- package/src/plugins/builtin/short-interest/watch-model.ts +185 -0
- package/src/plugins/builtin/short-interest/watch-pane.tsx +169 -0
- package/src/plugins/builtin/short-volume/pane.tsx +1 -1
- package/src/plugins/builtin/social-mentions/pane.tsx +1 -1
- package/src/plugins/builtin/supply-chain/client.ts +104 -0
- package/src/plugins/builtin/supply-chain/disclosure-quote.tsx +17 -0
- package/src/plugins/builtin/supply-chain/evidence.ts +88 -0
- package/src/plugins/builtin/supply-chain/flow-layout.ts +133 -0
- package/src/plugins/builtin/supply-chain/flow.tsx +323 -0
- package/src/plugins/builtin/supply-chain/graph-client.ts +83 -0
- package/src/plugins/builtin/supply-chain/graph-evidence.ts +25 -0
- package/src/plugins/builtin/supply-chain/graph-model.ts +45 -0
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +218 -0
- package/src/plugins/builtin/supply-chain/graph.tsx +163 -0
- package/src/plugins/builtin/supply-chain/headless.ts +105 -0
- package/src/plugins/builtin/supply-chain/index.tsx +17 -0
- package/src/plugins/builtin/supply-chain/model.ts +145 -0
- package/src/plugins/builtin/supply-chain/pane.tsx +276 -0
- package/src/plugins/builtin/supply-chain/row-evidence.tsx +96 -0
- package/src/plugins/builtin/supply-chain/trust.ts +34 -0
- package/src/plugins/builtin/themes/client.ts +39 -0
- package/src/plugins/builtin/themes/headless.ts +38 -0
- package/src/plugins/builtin/themes/model.ts +92 -0
- package/src/plugins/builtin/themes/pane.tsx +125 -0
- package/src/plugins/builtin/thirteenf/pane.tsx +6 -15
- package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +5 -6
- package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +201 -0
- package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +327 -0
- package/src/plugins/builtin/ticker-detail/financials/period-end-history.ts +5 -2
- package/src/plugins/builtin/ticker-detail/financials/ratios.ts +60 -12
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +2 -1
- package/src/plugins/builtin/ticker-detail/headless.ts +7 -2
- package/src/plugins/builtin/ticker-detail/index.tsx +22 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +53 -30
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +2 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +112 -47
- package/src/plugins/builtin/ticker-detail/pane.tsx +50 -6
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +21 -42
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +3 -0
- package/src/plugins/builtin/time-sales/pane.tsx +1 -1
- package/src/plugins/builtin/world-indices/indices.ts +1 -0
- package/src/plugins/catalog-browser.ts +40 -0
- package/src/plugins/catalog-manifest.ts +3 -0
- package/src/plugins/catalog-ui.ts +6 -0
- package/src/plugins/current-target.ts +0 -9
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/cloud-transport.ts +66 -1
- package/src/renderers/browser/main.tsx +2 -0
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/desktop/controls.tsx +38 -25
- package/src/renderers/dom/desktop/icons.tsx +8 -0
- package/src/renderers/dom/host/chart-surface.tsx +36 -2
- package/src/renderers/dom/host/focus-scope.ts +11 -1
- package/src/renderers/dom/styles.css +28 -0
- package/src/renderers/electrobun/view/backend-rpc.ts +3 -2
- package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +1 -1
- package/src/renderers/electrobun/view/http-fetch.ts +2 -0
- package/src/renderers/electrobun/view/main.tsx +3 -1
- package/src/renderers/electrobun/view/rpc-timeout.ts +59 -0
- package/src/renderers/opentui/start.tsx +3 -0
- package/src/shares/api.ts +3 -1
- package/src/sources/gloomberb-cloud/index.ts +47 -13
- package/src/sources/history-result.ts +1 -0
- package/src/sources/history-retention.ts +16 -0
- package/src/sources/provider-router/history.ts +4 -2
- package/src/sources/sec-edgar/identity.ts +36 -0
- package/src/sources/sec-edgar.ts +1 -34
- package/src/state/app/context/index.tsx +8 -0
- package/src/sync/core-contributors.ts +20 -2
- package/src/telemetry/attention-counts.ts +164 -0
- package/src/telemetry/live-config.ts +7 -0
- package/src/test-support/rpc-loopback.ts +7 -3
- package/src/test-support/shell-pane-keys.tsx +34 -0
- package/src/tickers/instrument-kind.ts +12 -6
- package/src/tickers/open-target.ts +1 -1
- package/src/tickers/search/asset-classes.ts +91 -0
- package/src/tickers/search/index.ts +62 -15
- package/src/tickers/search/ranking.ts +22 -3
- package/src/tickers/search/upsert.ts +4 -1
- package/src/time-series/live-bars.ts +8 -3
- package/src/time-series/resolve.ts +224 -17
- package/src/time-series/spec.ts +1 -0
- package/src/time-series/types.ts +9 -1
- package/src/types/config.ts +23 -1
- package/src/types/data-provider.ts +2 -0
- package/src/types/headless.ts +17 -0
- package/src/types/price-history.ts +2 -0
- package/src/ui/host.tsx +6 -0
- package/src/utils/double-escape-close.ts +20 -0
- package/src/utils/exchanges.ts +1 -0
- package/src/utils/html-entities.ts +15 -0
- package/src/utils/http-proxy-response.ts +44 -7
- package/src/utils/plugin-proxy-hosts.json +3 -0
- package/src/utils/price-history.ts +35 -1
- package/src/utils/sec.ts +21 -2
- package/src/utils/text-wrap.ts +13 -8
- package/src/utils/zoned-date-time.ts +67 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { useCallback, useMemo, useRef } from "react";
|
|
2
|
+
import { isAccessDenied } from "../../../api-client/errors";
|
|
3
|
+
import { usePlanAccess } from "../../../api-client/plan-access";
|
|
4
|
+
import type { ExposureEvidence, ExposurePayload } from "../../../api-client/exposure";
|
|
5
|
+
import { ActionRow, ChartTableHeader, DataTableView, EmptyState, KeyValueRow, PageStackView, PaneStatusBody, QueryBar, SectionHeading, usePaneNoticeFooter, usePaneStatusFooter, usePaneTabs, type DataTableCell, type DataTableColumn, type PaneHint, type StatItem } from "../../../components";
|
|
6
|
+
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
7
|
+
import { useAppSelector, useAsyncResource, useAutoRefresh, useMarketData, usePaneInstance, usePaneSettingValue, usePluginAppActions, usePluginPaneState } from "../../../public/react";
|
|
8
|
+
import { useThemeColors } from "../../../theme/theme-context";
|
|
9
|
+
import type { PaneProps } from "../../../types/plugin";
|
|
10
|
+
import { Box, ScrollBox, Text, useRendererHost, useUiCapabilities } from "../../../ui";
|
|
11
|
+
import { SignInWall } from "../cloud/auth-actions";
|
|
12
|
+
import { CLOUD_PLAN_KEY, useCloudUpgradeAction } from "../shared/cloud-upgrade";
|
|
13
|
+
import { Blurred, LockedOverlay, UpgradeLabel } from "../shared/locked-rows";
|
|
14
|
+
import { humanLabel, listingCell, missingCell } from "../shared/research-cells";
|
|
15
|
+
import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
|
|
16
|
+
import { ExposurePathDiagram, ExposureRanges } from "./charts";
|
|
17
|
+
import { fetchExposure, fetchScenarios, validateExposure } from "./client";
|
|
18
|
+
import { ExposureEditor, type ExposureInputs } from "./editor";
|
|
19
|
+
import { portfolioHoldings, watchlistHoldings } from "./holdings";
|
|
20
|
+
import { basisLabel, DEFAULT_SCENARIO, fraction, parseCustomScenario, parseHoldings, pathRows, portfolioRows, rangeText, tableRows, TABS, type ExposureRow } from "./model";
|
|
21
|
+
import { useExposureEvidence } from "./evidence";
|
|
22
|
+
import { driverRows, driverUnits, driverValue } from "./drivers";
|
|
23
|
+
|
|
24
|
+
function EvidenceItem({ item }: { item: ExposureEvidence }) {
|
|
25
|
+
const colors = useThemeColors();
|
|
26
|
+
const host = useRendererHost();
|
|
27
|
+
return <Box flexDirection="column" paddingY={1}>
|
|
28
|
+
<KeyValueRow labelWidth={20} label="Evidence" value={`${item.tier} · ${item.asOf ?? "undated"}`} detail={item.confidence === null ? undefined : `${Math.round(item.confidence * 100)}% confidence`} />
|
|
29
|
+
<KeyValueRow labelWidth={20} label="Period / units" value={`${item.period ?? "unknown"} · ${item.units}${item.currency ? ` ${item.currency}` : ""}`} />
|
|
30
|
+
{item.revision ? <KeyValueRow labelWidth={20} label="Revision" value={item.revision} /> : null}
|
|
31
|
+
{item.quote ? <Text fg={colors.textBright}>{item.quote}</Text> : <Text fg={colors.textDim}>{item.tier === "user" ? "User-supplied assumption" : "Structured observation; no verbatim quote"}</Text>}
|
|
32
|
+
{item.url ? <ActionRow label="Open primary evidence" onPress={() => void host.openExternal(item.url!)} /> : null}
|
|
33
|
+
</Box>;
|
|
34
|
+
}
|
|
35
|
+
function ExposureDetail({ row, data, width }: { row: ExposureRow | null; data: ExposurePayload; width: number }) {
|
|
36
|
+
const colors = useThemeColors();
|
|
37
|
+
const unknowns = row ? row.unknowns : [...data.unknowns, ...data.holdings.flatMap(h => h.unknowns.map(u => `${h.symbol}: ${u}`))];
|
|
38
|
+
return <ScrollBox flexGrow={1} flexBasis={0} minHeight={0} scrollY contentOptions={{ paddingX: 1 }}>
|
|
39
|
+
{row?.driver ? <>
|
|
40
|
+
<KeyValueRow labelWidth={20} label="Value / units" value={`${driverValue(row.driver)} ${driverUnits(row.driver)}`} />
|
|
41
|
+
<KeyValueRow labelWidth={20} label="Period" value={row.driver.period ?? "Unknown"} />
|
|
42
|
+
<KeyValueRow labelWidth={20} label="As of" value={row.driver.asOf?.slice(0, 10) ?? "Unknown"} />
|
|
43
|
+
{row.driver.valueText ? <KeyValueRow labelWidth={20} label="Reported wording" value={row.driver.valueText} /> : null}
|
|
44
|
+
{row.driver.status ? <KeyValueRow labelWidth={20} label="Status" value={humanLabel(row.driver.status)} /> : null}
|
|
45
|
+
{row.driver.basis ? <KeyValueRow labelWidth={20} label="Basis" value={humanLabel(row.driver.basis)} /> : null}
|
|
46
|
+
{Object.entries(row.driver.dimensions ?? {}).map(([key, value]) => <KeyValueRow key={key} labelWidth={20} label={humanLabel(key)} value={value} />)}
|
|
47
|
+
{row.driver.evidence.map(item => <EvidenceItem key={item.id} item={item} />)}
|
|
48
|
+
</> : row ? <>
|
|
49
|
+
<KeyValueRow labelWidth={20} label="Basis / period" value={`${basisLabel(row.basis)} · ${row.period ?? "unknown"}`} />
|
|
50
|
+
<KeyValueRow labelWidth={20} label={row.concentration ? "Gross exposure" : "Exposure"} value={rangeText(row.exposure)} detail={`${row.classification}${row.incomplete ? " · incomplete bound" : ""}`} />
|
|
51
|
+
<KeyValueRow labelWidth={20} label={row.concentration ? "Signed exposure" : "Operating stress"} value={rangeText(row.impact)} detail={row.concentration ? "NAV-weighted operating exposure; not a scenario change" : "Estimated change in the stated denominator"} />
|
|
52
|
+
{row.components.map(component => <Box key={component.id} flexDirection="column" paddingY={1}>
|
|
53
|
+
<SectionHeading title={component.label} />
|
|
54
|
+
<KeyValueRow labelWidth={20} label="Channel" value={`${component.channel} · order ${component.order} · ${component.classification}`} />
|
|
55
|
+
{component.proportionalEstimatePct != null ? <KeyValueRow labelWidth={20} label="Proportional chain" value={`${component.proportionalEstimatePct.toFixed(2)}%`} detail="Estimate; assumes proportional transmission" /> : null}
|
|
56
|
+
{component.path.length ? <ExposurePathDiagram component={component} width={width - 2} height={4} /> : null}
|
|
57
|
+
{component.path.map((hop, i) => <Box key={i} flexDirection="column" paddingY={1}>
|
|
58
|
+
<SectionHeading title={`Hop ${i + 1}: ${hop.from.symbol ?? hop.from.name} to ${hop.to.symbol ?? hop.to.name}`} />
|
|
59
|
+
<KeyValueRow labelWidth={20} label="Disclosed share" value={hop.pct === null ? "Unknown" : `${hop.pct}% ${basisLabel(hop.basis)}`} detail={`Denominator: ${hop.denominatorEntityId ?? "unknown"}`} />
|
|
60
|
+
{hop.evidence.map(e => <EvidenceItem key={e.id} item={e} />)}
|
|
61
|
+
</Box>)}
|
|
62
|
+
{component.evidence.filter(e => !component.path.some(h => h.evidence.some(p => p.id === e.id))).map(e => <EvidenceItem key={e.id} item={e} />)}
|
|
63
|
+
</Box>)}
|
|
64
|
+
</> : null}
|
|
65
|
+
{unknowns.length ? <><SectionHeading title="What we could not see" />{[...new Set(unknowns)].map((u, i) => <Box paddingY={1} key={i}><Text fg={colors.warning}>{u}</Text></Box>)}</> : <Text fg={colors.textDim}>No additional missing fields reported.</Text>}
|
|
66
|
+
</ScrollBox>;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function ExposurePane({ width, height, focused }: PaneProps) {
|
|
70
|
+
const colors = useThemeColors();
|
|
71
|
+
const desktop = !!useUiCapabilities().nativePaneChrome;
|
|
72
|
+
const host = useRendererHost();
|
|
73
|
+
const instance = usePaneInstance();
|
|
74
|
+
const market = useMarketData();
|
|
75
|
+
const config = useAppSelector(s => s.config);
|
|
76
|
+
const tickers = useAppSelector(s => s.tickers);
|
|
77
|
+
const session = useResearchCloudSession();
|
|
78
|
+
const access = usePlanAccess();
|
|
79
|
+
const accessKey = `${session.requestKey}:${access.hasProAccess ? "full" : "preview"}`;
|
|
80
|
+
const upgrade = useCloudUpgradeAction("expo");
|
|
81
|
+
const { createPaneFromTemplate } = usePluginAppActions();
|
|
82
|
+
const [openingScenario] = usePaneSettingValue("scenario", "taiwan-disruption");
|
|
83
|
+
const [customSetting] = usePaneSettingValue("customScenario", "");
|
|
84
|
+
const [openingDepth] = usePaneSettingValue("depth", 2);
|
|
85
|
+
const [openingNav] = usePaneSettingValue("nav", "");
|
|
86
|
+
const [openingCash] = usePaneSettingValue("cash", "");
|
|
87
|
+
const [snapshotSetting] = usePaneSettingValue<ExposurePayload | null>("exposureSnapshot", null);
|
|
88
|
+
const snapshot = useMemo(() => { try { return snapshotSetting ? validateExposure(snapshotSetting) : null; } catch { return null; } }, [snapshotSetting]);
|
|
89
|
+
const initialInput = snapshot ? snapshot.holdings.map(h => `${h.symbol}=${h.weight}`).join(" ") : instance?.params?.input ?? instance?.params?.arg ?? "";
|
|
90
|
+
const initialScenario = useMemo(() => { if (snapshot) return snapshot.scenario; try { return customSetting ? parseCustomScenario(customSetting) : DEFAULT_SCENARIO; } catch { return DEFAULT_SCENARIO; } }, [snapshot, customSetting]);
|
|
91
|
+
const [inputs, setInputs] = usePluginPaneState<ExposureInputs>("exposure:inputs", { input: initialInput, source: /^(PORT|WATCH):/.test(initialInput) ? initialInput : "typed", nav: String(openingNav), cash: String(openingCash), depth: snapshot?.depth ?? Number(openingDepth), scenario: initialScenario });
|
|
92
|
+
const [scenarioId, setScenarioId] = usePluginPaneState("exposure:scenario", snapshot ? snapshot.scenario.id ?? "captured" : customSetting ? "custom" : openingScenario);
|
|
93
|
+
const [openingTab] = usePaneSettingValue("tab", "table");
|
|
94
|
+
const [tab, setTab] = usePluginPaneState("exposure:tab", openingTab);
|
|
95
|
+
const [openingView] = usePaneSettingValue("view", "stress");
|
|
96
|
+
const [view, setView] = usePluginPaneState("exposure:view", openingView);
|
|
97
|
+
const [selectedId, setSelected] = usePluginPaneState<string | null>("exposure:selected", null);
|
|
98
|
+
const [detailId, setDetail] = usePluginPaneState<string | null>("exposure:detail", null);
|
|
99
|
+
const [editing, setEditing] = usePluginPaneState("exposure:editing", !initialInput && !snapshot);
|
|
100
|
+
const [sort, setSort] = usePluginPaneState("exposure:sort", { column: "exposure", direction: "desc" as "asc" | "desc" });
|
|
101
|
+
const libraryLoader = useCallback(() => snapshot ? Promise.resolve([snapshot.scenario]) : fetchScenarios(), [snapshot, accessKey]);
|
|
102
|
+
const library = useAsyncResource(libraryLoader, { clearOnError: isAccessDenied });
|
|
103
|
+
const scenario = snapshot?.scenario ?? (scenarioId === "custom" ? inputs.scenario : library.data?.find(s => s.id === scenarioId) ?? (scenarioId === DEFAULT_SCENARIO.id ? DEFAULT_SCENARIO : null));
|
|
104
|
+
const portfolio = config.portfolios.find(p => inputs.source === `PORT:${p.id}`);
|
|
105
|
+
const localTickers = useMemo(() => [...tickers.values()], [tickers]);
|
|
106
|
+
// Freeze a local selection until the user explicitly refreshes. Tick-by-tick marks must not rerun scenarios.
|
|
107
|
+
const sourceKey = JSON.stringify({ inputs, scenario, accessKey });
|
|
108
|
+
const valuation = useRef({ portfolio, localTickers, market });
|
|
109
|
+
valuation.current = { portfolio, localTickers, market };
|
|
110
|
+
const loader = useCallback(async () => {
|
|
111
|
+
if (snapshot) return snapshot;
|
|
112
|
+
if (!scenario) throw new Error("Select an available scenario.");
|
|
113
|
+
let holdings;
|
|
114
|
+
const { portfolio, localTickers, market } = valuation.current;
|
|
115
|
+
if (portfolio) {
|
|
116
|
+
if (!market) throw new Error("Market data connection unavailable for portfolio weights.");
|
|
117
|
+
holdings = await portfolioHoldings(portfolio, localTickers, Number(inputs.nav), market);
|
|
118
|
+
}
|
|
119
|
+
else if (inputs.source.startsWith("WATCH:")) holdings = watchlistHoldings(localTickers, inputs.source.slice(6));
|
|
120
|
+
else if (inputs.source !== "typed") throw new Error("The saved holdings source is no longer available.");
|
|
121
|
+
else holdings = parseHoldings(inputs.input);
|
|
122
|
+
const cash = inputs.cash.trim() ? Number(inputs.cash) : undefined;
|
|
123
|
+
if (cash !== undefined && (!Number.isFinite(cash) || Math.abs(cash) > 10)) throw new Error("Cash must be a NAV fraction between -10 and 10.");
|
|
124
|
+
return fetchExposure({ holdings, scenario, depth: inputs.depth, ...(cash === undefined ? {} : { cashWeight: cash }) });
|
|
125
|
+
// Explicit request state, including the account, owns recalculation. Quote changes do not.
|
|
126
|
+
}, [sourceKey, snapshot]);
|
|
127
|
+
const resource = useAsyncResource(inputs.input || inputs.source !== "typed" || snapshot ? loader : null, { clearOnError: isAccessDenied });
|
|
128
|
+
const data = resource.data;
|
|
129
|
+
useAutoRefresh(resource.updatedAt, resource.load);
|
|
130
|
+
usePaneRefreshKey(() => void resource.reload(), { focused: focused && !editing });
|
|
131
|
+
const rawRows = useMemo(() => !data ? [] : tab === "drivers" ? driverRows(data) : tab === "paths" ? pathRows(data) : tab === "portfolio" ? portfolioRows(data, view) : tableRows(data), [data, tab, view]);
|
|
132
|
+
const rows = useMemo(() => [...rawRows].sort((a, b) => {
|
|
133
|
+
const get = (r: ExposureRow) => sort.column === "value" ? r.driver?.value ?? r.driver?.range?.high ?? -Infinity : sort.column === "units" ? r.driver ? driverUnits(r.driver) : "" : sort.column === "scope" ? Object.values(r.driver?.dimensions ?? {}).join(" · ") : sort.column === "classification" ? r.classification : sort.column === "label" ? r.label : sort.column === "period" ? r.period ?? "" : sort.column === "exposure" ? r.exposure?.high ?? -Infinity : sort.column === "impact" ? r.impact?.low ?? -Infinity : sort.column === "weight" ? r.weight ?? -Infinity : sort.column === "basis" ? r.basis ?? "" : r.symbol;
|
|
134
|
+
const av = get(a), bv = get(b); const delta = typeof av === "number" && typeof bv === "number" ? av - bv : String(av).localeCompare(String(bv));
|
|
135
|
+
return (sort.direction === "asc" ? delta : -delta) || a.id.localeCompare(b.id);
|
|
136
|
+
}), [rawRows, sort]);
|
|
137
|
+
const selected = rows.find(r => r.id === selectedId) ?? rows[0] ?? null;
|
|
138
|
+
const detail = rows.find(r => r.id === detailId) ?? null;
|
|
139
|
+
const activeRow = detail ?? selected;
|
|
140
|
+
const source = activeRow?.components.flatMap(c => [...c.evidence, ...c.path.flatMap(h => h.evidence)]).find(e => e.url)?.url;
|
|
141
|
+
const symbol = activeRow?.symbol.split(",")[0]?.trim();
|
|
142
|
+
const detailOpen = editing || !!detail || detailId === "unknowns";
|
|
143
|
+
const { strip, rows: tabRows } = usePaneTabs({ tabs: TABS, activeValue: tab, onSelect: value => { setTab(value); setDetail(null); }, focused: focused && !editing, dense: true });
|
|
144
|
+
useExposureEvidence(data, tab, view, rows.map(r => r.id));
|
|
145
|
+
const hints: PaneHint[] = editing ? [] : [
|
|
146
|
+
{ id: "edit", key: "s", label: "cenario", title: "Edit scenario and holdings", onPress: () => setEditing(true) },
|
|
147
|
+
{ id: "unknowns", key: "v", label: "isibility", title: "What we could not see", onPress: () => setDetail("unknowns") },
|
|
148
|
+
...(selected ? [{ id: "evidence", key: "e", label: "vidence", onPress: () => setDetail(selected.id) }] : []),
|
|
149
|
+
...(source ? [{ id: "source", key: "o", label: "pen source", onPress: () => void host.openExternal(source) }] : []),
|
|
150
|
+
...(symbol ? [
|
|
151
|
+
...(activeRow?.driver ? [{ id: "dataset", key: "a", label: "ll disclosures", title: "Open company disclosures", onPress: () => createPaneFromTemplate(activeRow.driver!.kind === "kpi" ? "company-kpis-pane" : activeRow.driver!.kind === "guidance" ? "company-guidance-pane" : "credit-documents-pane", { symbol }) }] : []),
|
|
152
|
+
{ id: "supply", key: "c", label: "hain", title: "Supply chain", onPress: () => createPaneFromTemplate("supply-chain-pane", { symbol }) },
|
|
153
|
+
{ id: "des", key: "d", label: "es", onPress: () => createPaneFromTemplate("new-ticker-detail-pane", { symbol }) },
|
|
154
|
+
{ id: "fa", key: "f", label: "a", onPress: () => createPaneFromTemplate("financial-analysis-pane", { symbol }) },
|
|
155
|
+
{ id: "chart", key: "g", label: "raph", onPress: () => createPaneFromTemplate("chart-composer-pane", { arg: symbol }) },
|
|
156
|
+
] : []),
|
|
157
|
+
...(data?.access === "preview" ? [{ id: "upgrade", key: CLOUD_PLAN_KEY, label: "upgrade", title: "Upgrade to Pro", onPress: upgrade }] : []),
|
|
158
|
+
];
|
|
159
|
+
usePaneStatusFooter({ registrationId: "exposure", loading: resource.loading, error: data ? resource.error : null, hints,
|
|
160
|
+
info: data ? [{ id: "asof", parts: [{ text: `analyzed ${data.evaluatedAt.slice(0, 10)}`, tone: "muted" as const }] }] : [] });
|
|
161
|
+
usePaneNoticeFooter({ registrationId: "exposure:notices", focused, notices: [...(library.error ? [library.error] : []), ...(data?.unknowns ?? []), ...(data?.holdings.flatMap(h => h.unknowns.map(u => `${h.symbol}: ${u}`)) ?? [])] });
|
|
162
|
+
const sources = [{ value: "typed", label: "Typed holdings" }, ...config.portfolios.map(p => ({ value: `PORT:${p.id}`, label: `PORT · ${p.name}` })), ...config.watchlists.map(w => ({ value: `WATCH:${w.id}`, label: `Watchlist · ${w.name}` }))];
|
|
163
|
+
const bodyHeight = Math.max(3, height - tabRows);
|
|
164
|
+
const concentration = tab === "portfolio" && view !== "stress";
|
|
165
|
+
const columns: DataTableColumn[] = tab === "drivers" ? [
|
|
166
|
+
{ id: "symbol", label: "Holding", width: 10, align: "left" },
|
|
167
|
+
{ id: "label", label: "Company driver", width: width < 115 ? 24 : 32, flexGrow: 1, align: "left" },
|
|
168
|
+
{ id: "value", label: "Value", width: width < 115 ? 18 : 22, align: "right" },
|
|
169
|
+
{ id: "units", label: "Units", width: 12, align: "left" },
|
|
170
|
+
{ id: "period", label: "Period", width: width < 115 ? 14 : 24, align: "left" },
|
|
171
|
+
{ id: "scope", label: "Scope", width: 24, align: "left" },
|
|
172
|
+
] : [
|
|
173
|
+
{ id: "symbol", label: tab === "portfolio" ? "Holdings" : "Holding", width: tab === "portfolio" ? 18 : width < 115 ? 9 : 12, align: "left" },
|
|
174
|
+
{ id: "label", label: tab === "paths" ? "Evidence path" : tab === "table" ? "Shock" : "Target", width: tab === "paths" ? 32 : width < 115 ? 12 : 20, align: "left" },
|
|
175
|
+
{ id: "basis", label: "Basis", width: width < 115 ? 12 : 15, align: "left" },
|
|
176
|
+
{ id: "exposure", label: concentration ? "Gross exp. %" : "Exposure %", width: 16, align: "right" },
|
|
177
|
+
// What the number rests on, in words: disclosed by the company, estimated by a chain, or not visible.
|
|
178
|
+
{ id: "classification", label: "Evidence", width: 20, align: "left" },
|
|
179
|
+
{ id: "impact", label: concentration ? "Signed exp. %" : "Stress est. %", width: 16, align: "right" },
|
|
180
|
+
{ id: "period", label: "Period", width: 12, align: "left" },
|
|
181
|
+
{ id: "weight", label: tab === "portfolio" ? concentration ? "Gross wt. %" : "Covered wt. %" : "NAV wt. %", width: 13, align: "right" },
|
|
182
|
+
];
|
|
183
|
+
const renderCell = (row: ExposureRow, col: DataTableColumn, _index: number, state: { selected: boolean }): DataTableCell => {
|
|
184
|
+
if (row.id.startsWith("locked:")) {
|
|
185
|
+
if (!desktop && col.id === "symbol" && row.id === "locked:0") return { text: "Pro: full holdings", content: <UpgradeLabel text="Pro: full holdings and deeper paths" onPress={upgrade} role="exposure-upgrade" />, onMouseDown: upgrade };
|
|
186
|
+
return desktop ? { text: "", content: <Blurred><Text fg={colors.textDim}>{col.id === "symbol" ? "Holding" : "Hidden"}</Text></Blurred> } : { text: "░░░░", color: colors.textDim };
|
|
187
|
+
}
|
|
188
|
+
const unknown = row.classification === "unknown";
|
|
189
|
+
switch (col.id) {
|
|
190
|
+
case "symbol": return row.symbol.includes(",") ? { text: row.symbol, color: colors.textBright } : listingCell(row.symbol, colors, state.selected);
|
|
191
|
+
case "value": return { text: row.driver ? driverValue(row.driver) : "--", value: row.driver?.value ?? null, color: colors.textBright };
|
|
192
|
+
case "units": return { text: row.driver ? driverUnits(row.driver) : "", color: colors.textDim };
|
|
193
|
+
case "scope": return { text: Object.values(row.driver?.dimensions ?? {}).join(" · "), color: colors.textDim };
|
|
194
|
+
case "label": return { text: row.label, color: unknown ? colors.textDim : colors.text };
|
|
195
|
+
case "basis": return row.basis ? { text: humanLabel(basisLabel(row.basis)), color: colors.textDim } : missingCell(colors);
|
|
196
|
+
case "exposure": return row.exposure ? { text: rangeText(row.exposure), value: row.exposure.high, color: colors.textBright } : { text: "Unknown", value: null, color: colors.textMuted };
|
|
197
|
+
// Disclosed figures stand out; estimates read plainly, and the word says which is which.
|
|
198
|
+
case "classification": return { text: `${humanLabel(row.classification)}${row.incomplete && !unknown ? " · partial" : ""}`,
|
|
199
|
+
color: row.classification === "disclosed" ? colors.borderFocused : unknown ? colors.textMuted : colors.textDim, keepColorWhenSelected: row.classification === "disclosed" };
|
|
200
|
+
case "impact": return !row.impact ? missingCell(colors) : { text: rangeText(row.impact), value: row.impact.low,
|
|
201
|
+
color: row.concentration ? colors.text : row.impact.high < 0 ? colors.negative : row.impact.low > 0 ? colors.positive : colors.text };
|
|
202
|
+
case "period": return row.period ? { text: row.period, color: colors.textDim } : missingCell(colors);
|
|
203
|
+
default: return { text: fraction(row.weight ?? 0), value: row.weight === null ? null : row.weight * 100, color: colors.text };
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const lockedRows = data?.access === "preview" ? Math.min(3, data.lockedHoldings) : 0;
|
|
207
|
+
const items = useMemo(() => [...rows, ...Array.from({ length: lockedRows }, (_, index): ExposureRow => ({ id: `locked:${index}`, symbol: "", shockId: "", label: "", basis: null, period: null,
|
|
208
|
+
exposure: null, impact: null, weight: null, classification: "unknown", incomplete: false, components: [], unknowns: [] }))], [rows, lockedRows]);
|
|
209
|
+
const figures: StatItem[] = data ? tab === "drivers" ? [
|
|
210
|
+
{ label: "Dataset", value: selected?.driver ? selected.driver.kind === "kpi" ? "KPI" : humanLabel(selected.driver.kind) : "--" },
|
|
211
|
+
{ label: "As of", value: selected?.driver?.asOf?.slice(0, 10) ?? "--" },
|
|
212
|
+
{ label: "Basis", value: selected?.driver?.basis ? humanLabel(selected.driver.basis) : "--" },
|
|
213
|
+
] : tab === "portfolio" ? [
|
|
214
|
+
{ label: "Gross holdings", value: fraction(data.portfolio.grossWeight) }, { label: "Net holdings", value: fraction(data.portfolio.netWeight) },
|
|
215
|
+
{ label: "Unknown gross", value: fraction(data.portfolio.unknownGrossWeight), tone: "warning" },
|
|
216
|
+
{ label: "Cash / residual", value: `${data.portfolio.cashWeight === null ? "?" : fraction(data.portfolio.cashWeight)} / ${fraction(data.portfolio.residualWeight)}` },
|
|
217
|
+
] : [
|
|
218
|
+
{ label: "Holding weight", value: selected?.weight == null ? "--" : fraction(selected.weight) },
|
|
219
|
+
{ label: "Exposure", value: rangeText(selected?.exposure ?? null), detail: selected?.exposure ? selected.classification : undefined, tone: selected?.classification === "disclosed" ? "accent" : "warning" },
|
|
220
|
+
{ label: "Operating stress", value: rangeText(selected?.impact ?? null), detail: "estimate" },
|
|
221
|
+
{ label: "Bound", value: selected?.incomplete ? "Incomplete" : "Available", tone: selected?.incomplete ? "warning" : "muted" },
|
|
222
|
+
] : [];
|
|
223
|
+
const query = <QueryBar width={width} filters={[
|
|
224
|
+
{ id: "scenario", label: "Scenario", value: scenarioId, options: [...(library.data ?? [DEFAULT_SCENARIO]).map(s => ({ value: s.id ?? (snapshot ? "captured" : "custom"), label: s.label })), { value: "custom", label: "Custom" }].filter((s, i, all) => all.findIndex(v => v.value === s.value) === i), onChange: (value: string) => { if (value === "custom") setEditing(true); else setScenarioId(value); } },
|
|
225
|
+
...(tab === "portfolio" ? [{ id: "group", label: "View", value: view, options: [{ value: "stress", label: "Stress" }, { value: "country", label: "Country" }, { value: "supplier", label: "Supplier" }, { value: "customer", label: "Customer" }], onChange: setView }] : []),
|
|
226
|
+
]} meta={tab === "drivers" ? "Company disclosures" : tab === "portfolio" ? "NAV-weighted operating exposure" : `${data?.depth ?? inputs.depth} hops`} />;
|
|
227
|
+
if (!data && isCloudSessionRequired(resource.error) && !editing) return <SignInWall placement="exposure-signin" action="analyze exposures" needsVerification={session.needsVerification} />;
|
|
228
|
+
return <Box width={width} height={height} flexDirection="column">
|
|
229
|
+
{strip}
|
|
230
|
+
<PageStackView focused={focused && !editing} detailOpen={detailOpen} onBack={() => { setDetail(null); setEditing(false); }}
|
|
231
|
+
detailTitle={editing ? "Scenario and holdings" : detail ? `${detail.symbol} · ${detail.label}` : "What we could not see"}
|
|
232
|
+
detailContent={editing ? <ExposureEditor initial={{ ...inputs, scenario: scenario ?? inputs.scenario }} sources={sources} focused={focused} width={width} onCancel={() => setEditing(false)} onSave={value => { setInputs(value); setScenarioId("custom"); setEditing(false); setDetail(null); }} /> : data ? <ExposureDetail row={detail} data={data} width={width} /> : null}
|
|
233
|
+
rootContent={<PaneStatusBody loading={!data && resource.loading} error={!data ? resource.error : null} subject="exposure analysis">
|
|
234
|
+
{data ? <DataTableView<ExposureRow> columns={columns} items={items} getItemKey={r => r.id} rootWidth={width} rootHeight={bodyHeight} focused={focused && !detailOpen}
|
|
235
|
+
selection={{ kind: "id", selectedId: selected?.id ?? null, getId: r => r.id, onChange: (id) => { if (!id.startsWith("locked:")) setSelected(id); } }}
|
|
236
|
+
onActivate={row => row.id.startsWith("locked:") ? upgrade() : setDetail(row.id)} selectedTextOverridesCellColor showHorizontalScrollbar
|
|
237
|
+
sortColumnId={sort.column} sortDirection={sort.direction} onHeaderClick={column => setSort(old => ({ column, direction: old.column === column && old.direction === "desc" ? "asc" : "desc" }))}
|
|
238
|
+
rootBefore={<ChartTableHeader width={width} height={bodyHeight} tableRows={items.length} tableColumns={columns} query={query} figures={figures}
|
|
239
|
+
chart={tab === "paths" ? !selected?.components[0]?.path.length ? null : { render: size => <ExposurePathDiagram component={selected?.components[0] ?? null} {...size} />, minRows: 5, maxRows: 5, strip: null }
|
|
240
|
+
: rows.some(r => r.exposure) ? { render: size => <ExposureRanges rows={rows} showTargets={tab === "portfolio" || data.scenario.shocks.length > 1} selectedId={selected?.id ?? null} onSelect={setSelected} onOpen={setDetail} {...size} />, minRows: 1, maxRows: Math.max(1, Math.min(7, rows.filter(r => r.exposure && r.shockId === selected?.shockId && r.basis === selected?.basis && r.period === selected?.period).length)), strip: null } : null} />}
|
|
241
|
+
renderCell={renderCell}
|
|
242
|
+
emptyStateTitle={tab === "drivers" ? "No supported company drivers are available for these holdings." : tab === "paths" ? "No supported exposure paths for this scenario." : "No quantified exposure in this view."}
|
|
243
|
+
bodyAfter={lockedRows && desktop ? <LockedOverlay rows={lockedRows} text="Pro: full holdings and deeper exposure paths" onPress={upgrade} role="exposure-upgrade" /> : undefined} />
|
|
244
|
+
: !resource.loading && !resource.error ? <EmptyState title="Choose holdings and a scenario." actions={<ActionRow label="Configure exposure" onPress={() => setEditing(true)} />} /> : null}
|
|
245
|
+
</PaneStatusBody>} />
|
|
246
|
+
</Box>;
|
|
247
|
+
}
|
|
@@ -58,7 +58,7 @@ function SentimentChart({
|
|
|
58
58
|
return (
|
|
59
59
|
<Box flexDirection="column" marginTop={isDesktopWeb ? 1 : 2} paddingX={1}>
|
|
60
60
|
<Box flexDirection="row" height={1}>
|
|
61
|
-
<Text fg={colors.textBright} attributes={TextAttributes.BOLD}>{title
|
|
61
|
+
<Text fg={colors.textBright} attributes={TextAttributes.BOLD}>{title}</Text>
|
|
62
62
|
<Box flexGrow={1} />
|
|
63
63
|
<Badge label={ratingLabel(rating)} color={ratingColor(rating)} />
|
|
64
64
|
</Box>
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
usePaneStatusFooter,
|
|
9
9
|
type StatItem,
|
|
10
10
|
} from "../../../components";
|
|
11
|
+
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
11
12
|
import { useAsyncResource } from "../../../react/async-resource";
|
|
12
|
-
import { useShortcut } from "../../../react/input";
|
|
13
13
|
import type { PaneProps } from "../../../types/plugin";
|
|
14
14
|
import { Box, ScrollBox, useUiHost } from "../../../ui";
|
|
15
15
|
import { useAutoRefresh, useUpdatedAgo } from "../../../react/auto-refresh";
|
|
@@ -51,14 +51,7 @@ export function FearGreedPane({ paneId, focused, width, height }: PaneProps) {
|
|
|
51
51
|
const updatedAgo = useUpdatedAgo(lastRefreshed);
|
|
52
52
|
useAutoRefresh(stale ? null : lastRefreshed, refresh);
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
if (!focused) return;
|
|
56
|
-
if (event.name === "r") {
|
|
57
|
-
event.preventDefault?.();
|
|
58
|
-
event.stopPropagation?.();
|
|
59
|
-
refresh();
|
|
60
|
-
}
|
|
61
|
-
});
|
|
54
|
+
usePaneRefreshKey(refresh, { focused });
|
|
62
55
|
|
|
63
56
|
const footerInfo = useMemo(() => [
|
|
64
57
|
...(data ? [{
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
export const FILING_EVENTS_PANE_ID = "filing-events";
|
|
35
35
|
|
|
36
36
|
const EK_WALL: ProFeatureWallCopy = {
|
|
37
|
+
placement: "ek-wall",
|
|
37
38
|
action: "read 8-K filings",
|
|
38
39
|
title: "8-K filings are part of Gloom Cloud Pro.",
|
|
39
40
|
message: "Every 8-K classified by item and read: agreements, executive changes, auditor changes, restructurings, and what each one said.",
|
|
@@ -106,7 +107,7 @@ interface FilingEventsPaneProps {
|
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
export function FilingEventsPane(props: FilingEventsPaneProps) {
|
|
109
|
-
const { wall, guard } = useProFeatureWall(EK_WALL);
|
|
110
|
+
const { wall, guard } = useProFeatureWall(EK_WALL, props);
|
|
110
111
|
return wall ?? <FilingEventsReader {...props} guard={guard} />;
|
|
111
112
|
}
|
|
112
113
|
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import type { GpuBoardRow } from "../../../api-client/gpu";
|
|
3
|
+
import {
|
|
4
|
+
Badge, buildSectionedRows, ChartTableHeader, DataTableView, EMPTY_TABLE_CELL, isSectionedItemRow, QueryBar,
|
|
5
|
+
renderSectionedRowHeader, type DataTableCell, type DataTableColumn, type SectionedRow,
|
|
6
|
+
} from "../../../components";
|
|
7
|
+
import { PriceSparkline } from "../../../components/price-sparkline/view";
|
|
8
|
+
import { useAsyncResource } from "../../../public/react";
|
|
9
|
+
import { useThemeColors } from "../../../theme/theme-context";
|
|
10
|
+
import type { PricePoint } from "../../../types/financials";
|
|
11
|
+
import { Box, Text, TextAttributes, useUiCapabilities } from "../../../ui";
|
|
12
|
+
import { loadGpuHistory } from "./client";
|
|
13
|
+
import { GpuPriceLadder } from "./ladder";
|
|
14
|
+
import {
|
|
15
|
+
gpuAvailability, gpuBoardSections, gpuChange, gpuChangeColor, gpuChangeWindows, gpuHeadline, gpuPrice, gpuPriceLadder, gpuShortSource, gpuSparklineSeries, gpuTime, gpuVariant,
|
|
16
|
+
type GpuChangeKey,
|
|
17
|
+
} from "./model";
|
|
18
|
+
|
|
19
|
+
type BoardRow = SectionedRow<GpuBoardRow>;
|
|
20
|
+
const rowKey = (row: BoardRow) => row.key;
|
|
21
|
+
const EMPTY_HISTORY = new Map<string, PricePoint[]>();
|
|
22
|
+
const CHANGE_LABELS: Record<GpuChangeKey, string> = { change1d: "1D", change7d: "7D", change30d: "30D" };
|
|
23
|
+
/** A line needs three observations; two are a step, not a trend. */
|
|
24
|
+
const MIN_TREND_POINTS = 3;
|
|
25
|
+
|
|
26
|
+
export function GpuModelQuery({ rows, model, setModel, width, allowAll = true }: {
|
|
27
|
+
rows: readonly GpuBoardRow[]; model: string; setModel: (value: string) => void; width: number; allowAll?: boolean;
|
|
28
|
+
}) {
|
|
29
|
+
const models = useMemo(() => [...new Set(rows.map((row) => row.gpuModel))].sort(), [rows]);
|
|
30
|
+
return <QueryBar width={width} filters={[{ id: "gpu", label: "GPU", value: model, ...(allowAll ? { defaultValue: "" } : {}),
|
|
31
|
+
options: [...(allowAll ? [{ value: "", label: "All GPUs" }] : []), ...models.map((value) => ({ value, label: value }))], onChange: setModel }]} />;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Variant chips, the same in every GPU table: form factor and memory in two
|
|
36
|
+
* aligned slots. The terminal prints them as quiet text, where a block of
|
|
37
|
+
* colour on every row would outweigh the price.
|
|
38
|
+
*/
|
|
39
|
+
export function GpuVariantChips({ row, width, selected = false }: { row: Pick<GpuBoardRow, "formFactor" | "memoryGb">; width: number; selected?: boolean }) {
|
|
40
|
+
const colors = useThemeColors();
|
|
41
|
+
const desktop = useUiCapabilities().nativePaneChrome === true;
|
|
42
|
+
const [form, memory] = [row.formFactor ?? "", row.memoryGb ? `${row.memoryGb}GB` : ""];
|
|
43
|
+
if (!desktop) return <Text fg={selected ? colors.selectedText : colors.textDim}>{`${form.padEnd(5)} ${memory}`.trimEnd()}</Text>;
|
|
44
|
+
return <Box flexDirection="row" gap={1} width={width} height={1} overflow="hidden">
|
|
45
|
+
<Box width={6} flexShrink={0}>{form ? <Badge label={form} /> : null}</Box>
|
|
46
|
+
{memory ? <Badge label={memory} /> : null}
|
|
47
|
+
</Box>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Sparklines for the series `gpuSparklineSeries` picks, one bounded request each. */
|
|
51
|
+
function useHeadlineHistory(rows: readonly GpuBoardRow[], model: string): Map<string, PricePoint[]> {
|
|
52
|
+
const ids = useMemo(() => gpuSparklineSeries(rows, model).join("\n"), [rows, model]);
|
|
53
|
+
const loader = useCallback(async (force: boolean) => new Map(await Promise.all(ids.split("\n").map(async (id) => {
|
|
54
|
+
const points = (await loadGpuHistory(id, force)).payload.points
|
|
55
|
+
.filter((point) => `${point.source}:${point.skuKey}` === id)
|
|
56
|
+
.sort((a, b) => a.observedAt.localeCompare(b.observedAt))
|
|
57
|
+
.map((point) => ({ date: new Date(point.observedAt), close: point.pricePerGpuHr }));
|
|
58
|
+
return [id, points] as const;
|
|
59
|
+
}))), [ids]);
|
|
60
|
+
const resource = useAsyncResource(ids ? loader : null, { keepPreviousData: true });
|
|
61
|
+
return resource.data ?? EMPTY_HISTORY;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function boardColumns(width: number, options: { windows: GpuChangeKey[]; trend: boolean; range: boolean; availability: boolean }): DataTableColumn[] {
|
|
65
|
+
const wide = width >= 140, medium = width >= 100;
|
|
66
|
+
const changes: DataTableColumn[] = options.windows.length
|
|
67
|
+
? options.windows.map((key) => ({ id: key, label: CHANGE_LABELS[key], width: medium ? 7 : 6, align: "right" }))
|
|
68
|
+
: [{ id: "unavailableChange", label: "Change", width: medium ? 7 : 6, align: "right" }];
|
|
69
|
+
return [
|
|
70
|
+
{ id: "source", label: "Provider", width: wide ? 32 : medium ? 24 : 16, flexGrow: medium ? 0 : 1, align: "left" },
|
|
71
|
+
{ id: "variant", label: "Variant", width: medium ? 13 : 12, align: "left" },
|
|
72
|
+
{ id: "price", label: "$/GPU-hr", width: medium ? 9 : 7, align: "right" },
|
|
73
|
+
...(options.range && medium ? [{ id: "range", label: "Range", width: 12, align: "right" as const }] : []),
|
|
74
|
+
...changes,
|
|
75
|
+
...(options.trend && medium ? [{ id: "trend", label: "Trend", width: wide ? 14 : 10, align: "left" as const }] : []),
|
|
76
|
+
// On a wide pane the spare width opens before the time, not between the name and its price.
|
|
77
|
+
...(options.availability ? [{ id: "availability", label: medium ? "Availability" : "Avail", width: medium ? 14 : 9, flexGrow: medium ? 1 : 0, align: "left" as const }] : []),
|
|
78
|
+
...(medium ? [{ id: "asof", label: "Updated (UTC)", width: 13, flexGrow: options.availability ? 0 : 1, align: "right" as const }] : []),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function GpuBoard({ rows, asOf, model, setModel, selectedId, select, width, height, focused }: {
|
|
83
|
+
rows: GpuBoardRow[]; asOf: string | null; model: string; setModel: (value: string) => void; selectedId: string; select: (row: GpuBoardRow, open?: boolean) => void;
|
|
84
|
+
width: number; height: number; focused: boolean;
|
|
85
|
+
}) {
|
|
86
|
+
const colors = useThemeColors();
|
|
87
|
+
const sections = useMemo(() => gpuBoardSections(rows, model), [rows, model]);
|
|
88
|
+
const items = useMemo(() => buildSectionedRows(sections.map((section) => ({ label: section.label, items: section.rows })), (row) => row.id), [sections]);
|
|
89
|
+
const visible = useMemo(() => sections.flatMap((section) => section.rows), [sections]);
|
|
90
|
+
const windows = useMemo(() => gpuChangeWindows(visible), [visible]);
|
|
91
|
+
const history = useHeadlineHistory(rows, model);
|
|
92
|
+
const trend = [...history.values()].some((points) => points.length >= MIN_TREND_POINTS);
|
|
93
|
+
const ladder = useMemo(() => model ? gpuPriceLadder(rows, model) : [], [rows, model]);
|
|
94
|
+
const selected = visible.find((row) => row.id === selectedId) ?? visible[0] ?? null;
|
|
95
|
+
const medium = width >= 100;
|
|
96
|
+
const asOfDay = asOf?.slice(0, 10) ?? null;
|
|
97
|
+
const columns = boardColumns(width, { windows, trend, range: visible.some((row) => row.stats), availability: visible.some((row) => row.availability) });
|
|
98
|
+
|
|
99
|
+
const renderCell = (item: BoardRow, column: DataTableColumn, _index: number, state: { selected: boolean }): DataTableCell => {
|
|
100
|
+
if (!isSectionedItemRow(item)) return EMPTY_TABLE_CELL;
|
|
101
|
+
const row = item.item;
|
|
102
|
+
const headline = gpuHeadline(row);
|
|
103
|
+
const ink = state.selected ? colors.selectedText : undefined;
|
|
104
|
+
switch (column.id) {
|
|
105
|
+
case "source": {
|
|
106
|
+
const name = gpuShortSource(row);
|
|
107
|
+
const unit = row.providerClass === "aggregate" ? "provider" : "offer";
|
|
108
|
+
const sample = headline && row.stats && medium ? `${row.stats.n} ${unit}${row.stats.n === 1 ? "" : "s"}` : "";
|
|
109
|
+
return { text: name, content: <Box flexDirection="row" height={1} overflow="hidden">
|
|
110
|
+
<Text fg={ink ?? (headline ? colors.textBright : colors.text)} attributes={headline ? TextAttributes.BOLD : 0}>{name}</Text>
|
|
111
|
+
{sample ? <Text fg={colors.textDim}>{` ${sample}`}</Text> : null}
|
|
112
|
+
</Box> };
|
|
113
|
+
}
|
|
114
|
+
case "variant": return { text: gpuVariant(row).join(" "), content: <GpuVariantChips row={row} width={column.width} selected={state.selected} /> };
|
|
115
|
+
case "price": return { text: gpuPrice(row.pricePerGpuHr), value: row.pricePerGpuHr, color: headline ? colors.textBright : colors.text,
|
|
116
|
+
attributes: headline ? TextAttributes.BOLD : 0 };
|
|
117
|
+
case "range": {
|
|
118
|
+
const stats = row.stats;
|
|
119
|
+
if (!stats) return { text: "" };
|
|
120
|
+
const quartiles = stats.p25 !== undefined && stats.p75 !== undefined;
|
|
121
|
+
if (!quartiles && stats.min === stats.max) return { text: "" };
|
|
122
|
+
return { text: quartiles ? `${gpuPrice(stats.p25)}–${gpuPrice(stats.p75)}` : `${gpuPrice(stats.min)}–${gpuPrice(stats.max)}`, color: colors.textDim };
|
|
123
|
+
}
|
|
124
|
+
case "unavailableChange": return { text: "-", value: null, color: colors.textMuted };
|
|
125
|
+
case "change1d": case "change7d": case "change30d": {
|
|
126
|
+
const value = row[column.id];
|
|
127
|
+
return value == null ? { text: "-", value: null, color: colors.textMuted } : { text: gpuChange(value), value, color: gpuChangeColor(value, colors) };
|
|
128
|
+
}
|
|
129
|
+
case "trend": {
|
|
130
|
+
const points = history.get(row.id);
|
|
131
|
+
return points && points.length >= MIN_TREND_POINTS
|
|
132
|
+
? { text: "", content: <PriceSparkline priceHistory={points} width={column.width} period="1M" /> }
|
|
133
|
+
: { text: "" };
|
|
134
|
+
}
|
|
135
|
+
case "availability": {
|
|
136
|
+
const availability = gpuAvailability(row.availability);
|
|
137
|
+
if (!availability) return { text: "" };
|
|
138
|
+
const tone = availability.tone === "positive" ? colors.positive : availability.tone === "warning" ? colors.warning : colors.textMuted;
|
|
139
|
+
return { text: availability.label, content: <Box flexDirection="row" height={1} overflow="hidden">
|
|
140
|
+
<Text fg={tone}>●</Text>
|
|
141
|
+
{medium ? <Text fg={ink ?? (availability.tone === "muted" ? colors.textDim : colors.text)}>{` ${availability.label}`}</Text> : null}
|
|
142
|
+
</Box> };
|
|
143
|
+
}
|
|
144
|
+
// The board's own day goes without saying; an older observation names its day.
|
|
145
|
+
case "asof": return { text: row.stale ? "stale" : asOfDay && row.observedAt.startsWith(asOfDay) ? row.observedAt.slice(11, 16) : gpuTime(row.observedAt, true), value: row.observedAt,
|
|
146
|
+
color: row.stale ? colors.warning : colors.textDim, keepColorWhenSelected: row.stale };
|
|
147
|
+
default: return EMPTY_TABLE_CELL;
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
const query = <GpuModelQuery rows={rows} model={model} setModel={setModel} width={width} />;
|
|
152
|
+
return <DataTableView<BoardRow> columns={columns} items={items} rootWidth={width} rootHeight={height} focused={focused}
|
|
153
|
+
rootBefore={ladder.length ? <ChartTableHeader width={width} height={height} tableRows={items.length} tableColumns={columns} query={query}
|
|
154
|
+
chart={{ maxRows: ladder.length + 1, minRows: Math.min(3, ladder.length + 1), strip: null,
|
|
155
|
+
render: (size) => <GpuPriceLadder rows={ladder} width={size.width} height={size.height}
|
|
156
|
+
selected={selected && selected.gpuModel === model && selected.providerClass !== "aggregate" ? { basis: selected.basis, price: selected.pricePerGpuHr } : null} /> }} />
|
|
157
|
+
: query}
|
|
158
|
+
selection={{ kind: "id", selectedId: selected?.id ?? null, getId: rowKey,
|
|
159
|
+
onChange: (_id, row) => { if (row && isSectionedItemRow(row)) select(row.item); } }}
|
|
160
|
+
isNavigable={isSectionedItemRow} renderSectionHeader={renderSectionedRowHeader}
|
|
161
|
+
getItemKey={rowKey} onActivate={(row) => { if (isSectionedItemRow(row)) select(row.item, true); }} sortColumnId={null} sortDirection="asc"
|
|
162
|
+
selectedTextOverridesCellColor renderCell={renderCell} emptyStateTitle="No GPU rental prices match." />;
|
|
163
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import type { GpuBoardRow, GpuEvent } from "../../../api-client/gpu";
|
|
3
|
+
import {
|
|
4
|
+
Badge, buildSectionedRows, DataTableView, EMPTY_TABLE_CELL, isSectionedItemRow, PaneStatusBody, renderSectionedRowHeader,
|
|
5
|
+
usePaneNoticeFooter, usePaneStatusFooter, type DataTableCell, type DataTableColumn, type SectionedRow,
|
|
6
|
+
} from "../../../components";
|
|
7
|
+
import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
|
|
8
|
+
import { useAsyncResource, useAutoRefresh, usePluginPaneState } from "../../../public/react";
|
|
9
|
+
import { useThemeColors } from "../../../theme/theme-context";
|
|
10
|
+
import { Box, Text, TextAttributes } from "../../../ui";
|
|
11
|
+
import { GpuModelQuery, GpuVariantChips } from "./board";
|
|
12
|
+
import { loadGpuEvents } from "./client";
|
|
13
|
+
import { gpuBasisLabel, gpuChange, gpuEventDate, gpuEventSections, gpuPrice, gpuShortSource, gpuVariant } from "./model";
|
|
14
|
+
|
|
15
|
+
type ChangeRow = SectionedRow<GpuEvent>;
|
|
16
|
+
const rowKey = (row: ChangeRow) => row.key;
|
|
17
|
+
const availabilityMove = (event: GpuEvent) => `${event.oldAvailability ?? "-"} → ${event.newAvailability ?? "-"}`;
|
|
18
|
+
|
|
19
|
+
function changeColumns(width: number, allModels: boolean, availabilityWidth: number): DataTableColumn[] {
|
|
20
|
+
const wide = width >= 140, medium = width >= 100;
|
|
21
|
+
return [
|
|
22
|
+
...(allModels ? [{ id: "gpu", label: "GPU", width: 8, align: "left" as const }] : []),
|
|
23
|
+
{ id: "source", label: "Provider", width: wide ? 24 : 16, flexGrow: medium ? 0 : 1, align: "left" },
|
|
24
|
+
...(medium ? [{ id: "variant", label: "Variant", width: 13, align: "left" as const }] : []),
|
|
25
|
+
{ id: "basis", label: "Basis", width: wide ? 22 : 5, align: "left" },
|
|
26
|
+
{ id: "move", label: availabilityWidth ? "Old → new" : medium ? "$/GPU-hr" : "$/h", width: Math.max(availabilityWidth, medium ? 15 : 13), align: "right" },
|
|
27
|
+
{ id: "change", label: "Change", width: 9, align: "right" },
|
|
28
|
+
{ id: "kind", label: "Event", width: wide ? 18 : medium ? 15 : 10, flexGrow: medium ? 1 : 0, align: "left" },
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Dated price moves, newest day first: provider, old to new, and the move as a chip coloured by its sign. */
|
|
33
|
+
export function GpuChanges({ board, model, setModel, reloadBoard, width, height, focused }: {
|
|
34
|
+
board: GpuBoardRow[]; model: string; setModel: (value: string) => void; reloadBoard: () => void; width: number; height: number; focused: boolean;
|
|
35
|
+
}) {
|
|
36
|
+
const colors = useThemeColors();
|
|
37
|
+
const loader = useCallback((force: boolean) => loadGpuEvents(model || undefined, force), [model]);
|
|
38
|
+
const resource = useAsyncResource(loader);
|
|
39
|
+
const [selected, setSelected] = usePluginPaneState<string | null>("eventSelected", null);
|
|
40
|
+
useAutoRefresh(resource.updatedAt, resource.load);
|
|
41
|
+
usePaneRefreshKey(() => { reloadBoard(); void resource.reload(); }, { focused });
|
|
42
|
+
usePaneStatusFooter({ registrationId: "gpu:changes", loading: resource.loading, error: resource.error, stale: resource.data?.stale });
|
|
43
|
+
usePaneNoticeFooter({ registrationId: "gpu:change-notices", focused, notices: resource.data?.refreshError ? [resource.data.refreshError] : [] });
|
|
44
|
+
const events = resource.data?.payload.events;
|
|
45
|
+
const items = useMemo(() => buildSectionedRows(gpuEventSections(events ?? []), (event) => event.id), [events]);
|
|
46
|
+
const firstId = items.find(isSectionedItemRow)?.key ?? null;
|
|
47
|
+
const wide = width >= 140, medium = width >= 100;
|
|
48
|
+
const availabilityWidth = (events ?? []).reduce((size, event) => event.kind === "availability" ? Math.max(size, availabilityMove(event).length) : size, 0);
|
|
49
|
+
const columns = changeColumns(width, !model, availabilityWidth);
|
|
50
|
+
|
|
51
|
+
const renderCell = (row: ChangeRow, column: DataTableColumn, _index: number, state: { selected: boolean }): DataTableCell => {
|
|
52
|
+
if (!isSectionedItemRow(row)) return EMPTY_TABLE_CELL;
|
|
53
|
+
const event = row.item;
|
|
54
|
+
const membership = event.kind === "membership";
|
|
55
|
+
const availability = event.kind === "availability";
|
|
56
|
+
switch (column.id) {
|
|
57
|
+
case "gpu": return { text: event.gpuModel, color: colors.textBright };
|
|
58
|
+
case "source": return { text: gpuShortSource(event), color: colors.text };
|
|
59
|
+
case "variant": return { text: gpuVariant(event).join(" "), content: <GpuVariantChips row={event} width={column.width} selected={state.selected} /> };
|
|
60
|
+
case "basis": return { text: gpuBasisLabel(event.basis, !wide), color: colors.textDim };
|
|
61
|
+
case "move": if (availability) return { text: availabilityMove(event), color: colors.text };
|
|
62
|
+
return { text: `${gpuPrice(event.oldPrice)} → ${gpuPrice(event.newPrice)}`, value: event.newPrice,
|
|
63
|
+
content: <Box flexDirection="row" justifyContent="flex-end" width={column.width} height={1} overflow="hidden">
|
|
64
|
+
<Text fg={state.selected ? colors.selectedText : colors.textDim}>{`${gpuPrice(event.oldPrice)} → `}</Text>
|
|
65
|
+
<Text fg={state.selected ? colors.selectedText : colors.textBright} attributes={TextAttributes.BOLD}>{gpuPrice(event.newPrice)}</Text>
|
|
66
|
+
</Box> };
|
|
67
|
+
case "change": {
|
|
68
|
+
if (availability) return EMPTY_TABLE_CELL;
|
|
69
|
+
const text = gpuChange(event.changePct);
|
|
70
|
+
const tone = event.changePct > 0 ? "positive" : event.changePct < 0 ? "negative" : "neutral";
|
|
71
|
+
return { text, value: event.changePct, content: <Box flexDirection="row" justifyContent="flex-end" width={column.width} height={1}>
|
|
72
|
+
<Badge label={text} tone={tone} />
|
|
73
|
+
</Box> };
|
|
74
|
+
}
|
|
75
|
+
case "kind": {
|
|
76
|
+
const at = gpuEventDate(event);
|
|
77
|
+
const text = membership ? `Basket ${event.oldMembers?.length ?? 0} → ${event.newMembers?.length ?? 0}`
|
|
78
|
+
: availability ? "Availability" : event.provenance === "archive" ? "Archived" : event.provenance === "official-history" ? "Published history" : event.origin === "published" ? medium ? "Published rate" : "Published" : `Observed ${event.observedAt.slice(11, 16)}`;
|
|
79
|
+
return { text, value: at, color: colors.textDim };
|
|
80
|
+
}
|
|
81
|
+
default: return EMPTY_TABLE_CELL;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return <PaneStatusBody loading={resource.loading && !resource.data} error={!resource.data ? resource.error : null} subject="GPU price changes">
|
|
86
|
+
<DataTableView<ChangeRow> columns={columns} items={items} rootWidth={width} rootHeight={height} focused={focused}
|
|
87
|
+
rootBefore={<GpuModelQuery rows={board} model={model} setModel={setModel} width={width} />}
|
|
88
|
+
selection={{ kind: "id", selectedId: selected && items.some((item) => item.key === selected) ? selected : firstId, getId: rowKey,
|
|
89
|
+
onChange: (id) => setSelected(String(id)) }}
|
|
90
|
+
isNavigable={isSectionedItemRow} renderSectionHeader={renderSectionedRowHeader}
|
|
91
|
+
getItemKey={rowKey} onActivate={(row) => setSelected(row.key)} sortColumnId={null} sortDirection="desc"
|
|
92
|
+
selectedTextOverridesCellColor renderCell={renderCell} emptyStateTitle={resource.data?.payload.access?.locked ? "Full change history is available with Pro." : "No price or availability changes recorded yet."} />
|
|
93
|
+
</PaneStatusBody>;
|
|
94
|
+
}
|