@gloom-sh/terminal 0.20.17 → 0.20.19
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/package.json +3 -1
- package/src/account/auth-dialog.tsx +19 -1
- package/src/account/billing.ts +2 -1
- package/src/account/heard-from-question.tsx +235 -0
- package/src/account/heard-from.ts +97 -0
- package/src/api-client/cot.ts +5 -6
- package/src/api-client/data.ts +14 -3
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +64 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app/global-shortcuts.ts +5 -3
- package/src/app/pro-welcome/keys.ts +27 -0
- package/src/app/pro-welcome/model.ts +158 -0
- package/src/app/pro-welcome/row.tsx +176 -0
- package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
- package/src/app/runtime/external-profile-changes.ts +135 -0
- package/src/app.tsx +37 -4
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +1 -2
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +191 -39
- package/src/cli/commands/overview.ts +7 -1
- package/src/cli/commands/plugins.ts +3 -2
- package/src/cli/commands/search.ts +30 -6
- package/src/cli/commands/ticker.ts +13 -6
- package/src/cli/context.ts +24 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +276 -52
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +65 -11
- package/src/cli/help.ts +1 -1
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +8 -4
- package/src/cli/index.ts +2 -1
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +192 -38
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +877 -0
- package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
- package/src/cli/pane-functions/catalog.ts +50 -16
- package/src/cli/pane-functions/data.ts +16 -4
- package/src/cli/pane-functions/dom.ts +54 -8
- package/src/cli/pane-functions/freshness.ts +39 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +175 -50
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +11 -7
- package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +36 -1
- package/src/cli/pane-functions/screenshot-render.ts +24 -9
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +33 -17
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +22 -4
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +48 -20
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +11 -2
- package/src/components/chart-table/layout.ts +16 -17
- package/src/components/command-bar/pane-templates/items.ts +17 -1
- package/src/components/command-bar/routes/root/provider-search.ts +10 -1
- package/src/components/command-bar/routes/root/results.ts +34 -2
- package/src/components/command-bar/routes/root/runtime.ts +19 -4
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +32 -13
- package/src/components/data-table/view.tsx +15 -2
- package/src/components/form-modal/content.tsx +9 -4
- package/src/components/index.ts +1 -1
- package/src/components/layout/header.tsx +9 -5
- package/src/components/layout/pane/capture-status.ts +6 -0
- package/src/components/layout/pane/footer/index.tsx +2 -0
- package/src/components/layout/pane/footer/model.ts +123 -17
- package/src/components/layout/pane/header.tsx +16 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- package/src/components/market-board/index.tsx +4 -2
- package/src/components/onboarding/onboarding-frame.tsx +6 -2
- package/src/components/onboarding/onboarding-keyboard.ts +7 -1
- package/src/components/onboarding/onboarding-wizard.tsx +3 -1
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
- package/src/components/onboarding/setup-cards.ts +36 -0
- package/src/components/onboarding/use-onboarding-progress.ts +22 -1
- package/src/components/onboarding/wizard-account.ts +6 -1
- package/src/components/onboarding/wizard-model.ts +32 -6
- package/src/components/onboarding/wizard-positions.ts +1 -1
- package/src/components/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- package/src/components/sign-in-gate.tsx +3 -1
- package/src/components/toggle-list.tsx +6 -8
- package/src/components/ui/confirm-dialog.tsx +47 -7
- package/src/components/ui/data-table/opentui/index.tsx +7 -0
- package/src/components/ui/data-table/types.ts +8 -0
- package/src/components/ui/display.tsx +17 -2
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/stat-grid.tsx +4 -0
- package/src/components/ui/status.tsx +13 -1
- package/src/components/ui/table-layout.ts +34 -2
- package/src/components/use-pane-notice-footer.tsx +16 -3
- package/src/data/config/store/index.ts +31 -0
- package/src/data/config/store/node.ts +61 -11
- package/src/data/config/store/normalize.ts +4 -6
- package/src/data/config/store/shared-file.ts +309 -0
- package/src/data/profile-merge.ts +299 -0
- package/src/data/sqlite/checkpointer.ts +11 -1
- package/src/data/sqlite/database.ts +1 -1
- package/src/data/ticker-repository.ts +134 -10
- package/src/data/ticker-store.ts +67 -0
- package/src/data/ticker-writes.ts +5 -0
- package/src/i18n/es.ts +27 -0
- package/src/i18n/ja.ts +27 -0
- package/src/i18n/ko.ts +27 -0
- package/src/i18n/zh-cn.ts +27 -0
- package/src/i18n/zh-tw.ts +27 -0
- package/src/layout-marketplace/gallery-desktop.tsx +2 -2
- package/src/market-data/ah-pair.ts +122 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +11 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/market-data/split-terms.ts +28 -0
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -0
- package/src/plugins/builtin/account-management/footer.ts +1 -1
- package/src/plugins/builtin/account-management/keyboard.ts +4 -0
- package/src/plugins/builtin/account-management/model.ts +1 -0
- package/src/plugins/builtin/account-management/pane.tsx +75 -7
- package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
- package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
- package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
- package/src/plugins/builtin/alerts/cli-move.ts +2 -2
- package/src/plugins/builtin/alerts/cli.ts +101 -48
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +97 -16
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +27 -14
- package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
- package/src/plugins/builtin/analytics/risk-model.ts +92 -4
- package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
- package/src/plugins/builtin/awards/pane.tsx +1 -1
- package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
- package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
- package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +10 -5
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +57 -15
- package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
- package/src/plugins/builtin/composite/alt-data.ts +20 -0
- package/src/plugins/builtin/composite/application.ts +14 -0
- package/src/plugins/builtin/composite/broker.ts +12 -0
- package/src/plugins/builtin/composite/credit.ts +33 -0
- package/src/plugins/builtin/composite/crypto.ts +10 -0
- package/src/plugins/builtin/composite/earnings.ts +12 -0
- package/src/plugins/builtin/composite/filings.ts +13 -0
- package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
- package/src/plugins/builtin/composite/global-markets.ts +12 -0
- package/src/plugins/builtin/composite/options-volatility.ts +23 -0
- package/src/plugins/builtin/composite/ownership.ts +23 -0
- package/src/plugins/builtin/composite/portfolio.ts +10 -0
- package/src/plugins/builtin/composite/quant.ts +15 -0
- package/src/plugins/builtin/composite/rates-macro.ts +30 -0
- package/src/plugins/builtin/composite/screeners.ts +11 -0
- package/src/plugins/builtin/composite/shared.ts +11 -0
- package/src/plugins/builtin/composite/ticker-core.ts +36 -0
- package/src/plugins/builtin/congress-trades/headless.ts +31 -3
- package/src/plugins/builtin/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- package/src/plugins/builtin/dividend-yield/client.ts +57 -16
- package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
- package/src/plugins/builtin/dividend-yield/model.ts +4 -3
- package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
- package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
- package/src/plugins/builtin/dividend-yield/types.ts +4 -0
- package/src/plugins/builtin/dividend-yield/view.ts +23 -12
- package/src/plugins/builtin/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +16 -6
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +7 -4
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +7 -2
- package/src/plugins/builtin/equity-screener/headless.ts +4 -1
- package/src/plugins/builtin/equity-screener/model.ts +7 -6
- package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
- package/src/plugins/builtin/exposure/model.ts +10 -0
- package/src/plugins/builtin/exposure/pane.tsx +10 -3
- package/src/plugins/builtin/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
- package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
- package/src/plugins/builtin/mna/detail.tsx +67 -6
- package/src/plugins/builtin/mna/headless.ts +128 -13
- package/src/plugins/builtin/mna/model.ts +219 -16
- package/src/plugins/builtin/mna/pane.tsx +34 -6
- package/src/plugins/builtin/money-markets/model.ts +14 -5
- package/src/plugins/builtin/money-markets/pane.tsx +4 -3
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -8
- package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
- package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
- package/src/plugins/builtin/options-scenario/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
- package/src/plugins/builtin/pe-band/client.ts +13 -1
- package/src/plugins/builtin/pe-band/headless.ts +2 -2
- package/src/plugins/builtin/pe-band/model.ts +63 -10
- package/src/plugins/builtin/pe-band/pane.tsx +5 -5
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
- package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
- package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
- package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
- package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
- package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
- package/src/plugins/builtin/research/event-model.ts +43 -19
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +49 -5
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- package/src/plugins/builtin/supply-chain/client.ts +34 -9
- package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
- package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
- package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
- package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
- package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
- package/src/plugins/builtin/supply-chain/headless.ts +19 -4
- package/src/plugins/builtin/supply-chain/model.ts +50 -6
- package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
- package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
- package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
- package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
- package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
- package/src/plugins/builtin/volatility/model.ts +17 -0
- package/src/plugins/builtin/volatility/pane.tsx +16 -7
- package/src/plugins/builtin/world-indices/index.tsx +2 -0
- package/src/plugins/builtin/world-indices/table.tsx +15 -0
- package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
- package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
- package/src/plugins/builtin/world-venue-map/index.ts +19 -6
- package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
- package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
- package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
- package/src/plugins/builtin/world-venue-map/model.ts +6 -1
- package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- package/src/plugins/catalog-data.ts +20 -0
- package/src/plugins/catalog-lazy.ts +51 -0
- package/src/plugins/catalog-ui.ts +16 -18
- package/src/plugins/host-smoke.ts +5 -2
- package/src/portfolio/allocation.ts +79 -19
- package/src/portfolio/cash-balances.ts +76 -0
- package/src/portfolio/mutations.ts +43 -8
- package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
- package/src/renderers/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/desktop/window-layouts.ts +14 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- package/src/renderers/dom/data-table/row.tsx +2 -0
- package/src/renderers/dom/host/tabs.tsx +57 -8
- package/src/renderers/dom/styles.css +13 -5
- package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
- package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
- package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
- package/src/renderers/electrobun/shared/protocol.ts +4 -0
- package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
- package/src/renderers/electrobun/view/http-fetch.ts +3 -2
- package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
- package/src/series/standalone-catalog.ts +5 -4
- package/src/series/standalone.ts +13 -7
- package/src/sources/gloomberb-cloud/index.ts +22 -9
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/financials.ts +20 -13
- package/src/sources/provider-router/history.ts +32 -6
- package/src/sources/provider-router/index.ts +4 -0
- package/src/sources/provider-router/search.ts +1 -0
- package/src/sync/collections-contributor.ts +3 -1
- package/src/sync/config-merge.ts +10 -1
- package/src/sync/sanitize.ts +26 -2
- package/src/tickers/company-name-listing.ts +16 -2
- package/src/tickers/listing-fate.ts +12 -8
- package/src/tickers/renamed-listings.ts +43 -10
- package/src/tickers/search/home-listing.ts +28 -0
- package/src/tickers/search/index.ts +19 -7
- package/src/tickers/terminal-codes.ts +11 -1
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +42 -3
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +3 -2
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +48 -4
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/types/ticker.ts +10 -2
- package/src/ui/host.tsx +2 -0
- package/src/utils/cli-output.ts +1 -1
- package/src/utils/declared-dividends.ts +13 -1
- package/src/utils/dividend-cash.ts +5 -1
- package/src/utils/exchange-announcements.ts +7 -2
- package/src/utils/forward-dividend.ts +4 -3
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
- package/src/utils/remove-folder.ts +37 -0
- package/src/utils/trailing-dividend.ts +1 -1
- package/src/plugins/builtin/composite-plugins.ts +0 -285
|
@@ -2,7 +2,6 @@ import type { ScannerCapture } from "../plugins/builtin/shared/scanner-capture";
|
|
|
2
2
|
import type { TapeCapture } from "../plugins/builtin/time-sales/snapshot-client";
|
|
3
3
|
import { randomBytes, timingSafeEqual } from "crypto";
|
|
4
4
|
import { join } from "path";
|
|
5
|
-
import { writeOutputFile } from "./output-file";
|
|
6
5
|
import { withShotTempDir } from "./shot-temp-dir";
|
|
7
6
|
import { encodeRpcValue } from "../renderers/electrobun/shared/rpc-codec";
|
|
8
7
|
import type { AppConfig } from "../types/config";
|
|
@@ -21,7 +20,7 @@ import type { HttpProxyRequestEnvelope, HttpProxyResponseEnvelope } from "../uti
|
|
|
21
20
|
import type { PaneAccessGate } from "./pane-functions/access-gate";
|
|
22
21
|
import { countContentFigures } from "./content-figures";
|
|
23
22
|
import { readVisibleKeyValues } from "./visible-key-values";
|
|
24
|
-
import { scrollTruncationReasons } from "./scroll-truncation";
|
|
23
|
+
import { rowViewportVisibility, scrollTruncationReasons } from "./scroll-truncation";
|
|
25
24
|
import {
|
|
26
25
|
SHOT_API_PROXY_PREFIX,
|
|
27
26
|
SHOT_API_SOCKET_PATH,
|
|
@@ -32,6 +31,13 @@ import {
|
|
|
32
31
|
type ShotMarketSocketCall,
|
|
33
32
|
} from "./desktop-pane-shot-routes";
|
|
34
33
|
import { SHOT_REQUEST_REFUSED } from "../api-client/errors";
|
|
34
|
+
import {
|
|
35
|
+
dataServiceAnswerCount, dataServiceReachEpoch, dataServiceUnreachable, isProxyRefusal, MARKET_REQUEST_TIMEOUT_MS, noteDataServiceReach,
|
|
36
|
+
SHOT_SERVICE_UNREACHABLE_HEADER, UNREACHABLE_REQUEST_TIMEOUT_MS,
|
|
37
|
+
} from "../api-client/request";
|
|
38
|
+
import type { FuturesContractTermsPayload } from "../api-client/futures-curve";
|
|
39
|
+
import { rememberFuturesContractTerms, savedFuturesContractTerms } from "../market-data/futures-contract";
|
|
40
|
+
import { DATA_SERVICE_UNREACHABLE_MESSAGE, isNetworkFailure } from "../utils/network-failure";
|
|
35
41
|
import { SESSION_COOKIE_NAMES } from "../api-client/session-cookie";
|
|
36
42
|
import { isShotApiRequestAllowed, isShotSessionPath } from "./desktop-pane-shot-api-policy";
|
|
37
43
|
import { renderElectrobunViewHtml } from "../renderers/dom/build-assets";
|
|
@@ -111,6 +117,47 @@ export interface DesktopPaneShotPayload {
|
|
|
111
117
|
export interface DesktopPaneShotApiProxy {
|
|
112
118
|
baseUrl: string;
|
|
113
119
|
sessionToken: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Called with when a copy was saved (ms) each time the proxy answers a
|
|
122
|
+
* read the data service did not answer from a copy saved earlier, so the
|
|
123
|
+
* report dates what it shows as saved (`SHOT_SAVED_COPY_READS`).
|
|
124
|
+
*/
|
|
125
|
+
onSavedCopy?: (savedAt: number) => void;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The reads the proxy keeps a copy of and answers from it when the data
|
|
130
|
+
* service does not answer: a futures symbol's contract terms, which a pane's
|
|
131
|
+
* settle line and Contract block are drawn from beside the bridged quote's
|
|
132
|
+
* saved copy. Offline, DES GC=F kept the saved price and lost both.
|
|
133
|
+
*/
|
|
134
|
+
const SHOT_SAVED_COPY_READS: ReadonlyArray<{
|
|
135
|
+
path: RegExp;
|
|
136
|
+
save(key: string, body: unknown): void;
|
|
137
|
+
read(key: string): { value: unknown; savedAt: number } | null;
|
|
138
|
+
}> = [{
|
|
139
|
+
path: /^\/cloud\/futures\/contract\/([^/?#]+)$/,
|
|
140
|
+
save: (symbol, body) => rememberFuturesContractTerms(symbol, body as FuturesContractTermsPayload),
|
|
141
|
+
read: (symbol) => {
|
|
142
|
+
const saved = savedFuturesContractTerms(symbol);
|
|
143
|
+
return saved && { value: saved.terms, savedAt: saved.savedAt };
|
|
144
|
+
},
|
|
145
|
+
}];
|
|
146
|
+
|
|
147
|
+
/** The kept read a GET path is, with its key (the symbol), or null. */
|
|
148
|
+
function savedCopyRead(method: string, path: string): { read: typeof SHOT_SAVED_COPY_READS[number]; key: string } | null {
|
|
149
|
+
if (method !== "GET") return null;
|
|
150
|
+
for (const read of SHOT_SAVED_COPY_READS) {
|
|
151
|
+
const match = read.path.exec(path);
|
|
152
|
+
if (!match?.[1]) continue;
|
|
153
|
+
try {
|
|
154
|
+
return { read, key: decodeURIComponent(match[1]) };
|
|
155
|
+
} catch {
|
|
156
|
+
// Intentional ignore: a symbol whose percent-encoding is malformed names no kept copy, so the read goes out as sent.
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
114
161
|
}
|
|
115
162
|
|
|
116
163
|
/**
|
|
@@ -127,7 +174,11 @@ export interface DesktopPaneShotBridge {
|
|
|
127
174
|
}
|
|
128
175
|
|
|
129
176
|
interface DesktopPaneShotRenderedCell {
|
|
130
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* The cell can be blank with nothing missing: its whole column can
|
|
179
|
+
* (DataTableColumn.mayBeBlank), or its row is still waiting on the value
|
|
180
|
+
* (DataTableCell.mayBeBlank).
|
|
181
|
+
*/
|
|
131
182
|
mayBeBlank?: true;
|
|
132
183
|
columnId?: string;
|
|
133
184
|
columnLabel: string;
|
|
@@ -157,6 +208,12 @@ interface DesktopPaneShotSurface {
|
|
|
157
208
|
|
|
158
209
|
export interface DesktopPaneShotRenderResult {
|
|
159
210
|
visibleText: string;
|
|
211
|
+
/**
|
|
212
|
+
* What the visible text fields hold (OVME's Underlying, a search box), which
|
|
213
|
+
* `visibleText` leaves out: an input's value is not its text. A password
|
|
214
|
+
* field is never read. Absent when no field holds anything.
|
|
215
|
+
*/
|
|
216
|
+
fieldValues?: string[];
|
|
160
217
|
/**
|
|
161
218
|
* The visible text a line per block of the page, as the browser lays it out,
|
|
162
219
|
* where `visibleText` has run them together: the words of a pane that is prose
|
|
@@ -221,6 +278,7 @@ export interface DesktopPaneShotRenderResult {
|
|
|
221
278
|
semanticUi: RemoteUiNodeSnapshot[];
|
|
222
279
|
/** The status line drawn in the capture's footer, as it fit the width. */
|
|
223
280
|
statusLine?: string | null;
|
|
281
|
+
statusLineClipped?: boolean;
|
|
224
282
|
}
|
|
225
283
|
|
|
226
284
|
/**
|
|
@@ -233,9 +291,17 @@ export interface DesktopPaneShotRenderResult {
|
|
|
233
291
|
interface ShotStatusLineVariants {
|
|
234
292
|
variants: readonly string[];
|
|
235
293
|
dates?: "data" | "quotes" | null;
|
|
294
|
+
dateEvidence?: readonly (readonly string[])[];
|
|
236
295
|
}
|
|
237
296
|
type ShotStatusLine = (rendered: DesktopPaneShotRenderResult) => ShotStatusLineVariants | null | Promise<ShotStatusLineVariants | null>;
|
|
238
297
|
|
|
298
|
+
export function shotStatusDateClipped(line: ShotStatusLineVariants | null, statusText: string | null): boolean {
|
|
299
|
+
if (line?.dates == null || line.variants.includes(statusText ?? "")) return false;
|
|
300
|
+
const normalize = (text: string) => text.toLowerCase().replace(/\s+/g, " ").trim();
|
|
301
|
+
const shown = normalize(statusText ?? "");
|
|
302
|
+
return !line.dateEvidence?.some((parts) => parts.length > 0 && parts.every((part) => shown.includes(normalize(part))));
|
|
303
|
+
}
|
|
304
|
+
|
|
239
305
|
const SHOT_MODE_CSS = [
|
|
240
306
|
"[data-gloom-role='composite-chart-toolbar']",
|
|
241
307
|
"[data-gloom-role='chart-series-quick-add']",
|
|
@@ -266,10 +332,9 @@ export function prepareDesktopPaneShotView(): void {
|
|
|
266
332
|
|
|
267
333
|
export async function renderDesktopPaneScreenshot(
|
|
268
334
|
payload: DesktopPaneShotPayload,
|
|
269
|
-
outputPath: string,
|
|
270
335
|
apiProxy: DesktopPaneShotApiProxy,
|
|
271
336
|
options: { captureImage?: boolean; bridge?: DesktopPaneShotBridge; statusLine?: ShotStatusLine } = {},
|
|
272
|
-
): Promise<DesktopPaneShotRenderResult> {
|
|
337
|
+
): Promise<DesktopPaneShotRenderResult & { image?: Uint8Array }> {
|
|
273
338
|
const chrome = await findChromeExecutable();
|
|
274
339
|
const view = await loadShotView();
|
|
275
340
|
return withShotTempDir("gloom-pane-shot-", async (tempDir) => {
|
|
@@ -278,7 +343,6 @@ export async function renderDesktopPaneScreenshot(
|
|
|
278
343
|
return await capturePageScreenshot({
|
|
279
344
|
chrome,
|
|
280
345
|
url: server.url,
|
|
281
|
-
outputPath,
|
|
282
346
|
widthPx: payload.widthPx,
|
|
283
347
|
heightPx: payload.heightPx,
|
|
284
348
|
deviceScaleFactor: payload.deviceScaleFactor ?? DEFAULT_DEVICE_SCALE_FACTOR,
|
|
@@ -379,6 +443,9 @@ export function serveShotPage(
|
|
|
379
443
|
bridge: DesktopPaneShotBridge | null,
|
|
380
444
|
): ShotServer {
|
|
381
445
|
const secret = randomBytes(32).toString("hex");
|
|
446
|
+
// Every read the page has the proxy make ends when the capture does, answered or not: a read through a proxy that
|
|
447
|
+
// never answers must not hold the command's process open after its report is printed.
|
|
448
|
+
const upstream = new AbortController();
|
|
382
449
|
const server = Bun.serve({
|
|
383
450
|
hostname: "127.0.0.1",
|
|
384
451
|
port: 0,
|
|
@@ -392,7 +459,8 @@ export function serveShotPage(
|
|
|
392
459
|
return server.upgrade(request, { data: undefined }) ? undefined : new Response("Expected a WebSocket upgrade", { status: 426 });
|
|
393
460
|
}
|
|
394
461
|
if (url.pathname.startsWith(`${SHOT_API_PROXY_PREFIX}/`)) {
|
|
395
|
-
|
|
462
|
+
// Also given up when the page stops waiting for it.
|
|
463
|
+
return proxyShotApiRequest(request, url, apiProxy, AbortSignal.any([request.signal, upstream.signal]));
|
|
396
464
|
}
|
|
397
465
|
if (url.pathname === SHOT_MARKET_BRIDGE_PATH || url.pathname === SHOT_HTTP_BRIDGE_PATH) {
|
|
398
466
|
if (request.method !== "POST") return new Response("Method not allowed", { status: 405 });
|
|
@@ -403,13 +471,16 @@ export function serveShotPage(
|
|
|
403
471
|
},
|
|
404
472
|
websocket: {
|
|
405
473
|
message(socket, message) {
|
|
406
|
-
void answerShotApiCall(String(message), apiProxy, bridge).then((reply) => replyOverShotSocket(socket, reply));
|
|
474
|
+
void answerShotApiCall(String(message), apiProxy, bridge, upstream.signal).then((reply) => replyOverShotSocket(socket, reply));
|
|
407
475
|
},
|
|
408
476
|
},
|
|
409
477
|
});
|
|
410
478
|
return {
|
|
411
479
|
url: `http://127.0.0.1:${server.port}/${secret}/`,
|
|
412
|
-
stop: () =>
|
|
480
|
+
stop: () => {
|
|
481
|
+
upstream.abort();
|
|
482
|
+
return server.stop(true);
|
|
483
|
+
},
|
|
413
484
|
};
|
|
414
485
|
}
|
|
415
486
|
|
|
@@ -433,6 +504,7 @@ export async function answerShotApiCall(
|
|
|
433
504
|
message: string,
|
|
434
505
|
apiProxy: DesktopPaneShotApiProxy,
|
|
435
506
|
bridge: DesktopPaneShotBridge | null = null,
|
|
507
|
+
signal?: AbortSignal,
|
|
436
508
|
): Promise<string> {
|
|
437
509
|
let id = 0;
|
|
438
510
|
try {
|
|
@@ -445,7 +517,7 @@ export async function answerShotApiCall(
|
|
|
445
517
|
if (typeof call.path !== "string" || !call.path.startsWith("/") || call.path.startsWith("//")) throw new Error("Not an API path.");
|
|
446
518
|
const url = new URL(`${SHOT_API_PROXY_PREFIX}${call.path}`, "http://127.0.0.1");
|
|
447
519
|
const sent = new Headers(Array.isArray(call.headers) ? call.headers : []);
|
|
448
|
-
response = await proxyShotApiRequest(new Request(url, { headers: sent }), url, apiProxy);
|
|
520
|
+
response = await proxyShotApiRequest(new Request(url, { headers: sent }), url, apiProxy, signal);
|
|
449
521
|
}
|
|
450
522
|
const body = Buffer.from(await response.arrayBuffer()).toString("base64");
|
|
451
523
|
const headers: Array<[string, string]> = [];
|
|
@@ -552,7 +624,10 @@ async function proxyShotApiRequest(
|
|
|
552
624
|
request: Request,
|
|
553
625
|
requestUrl: URL,
|
|
554
626
|
apiProxy: DesktopPaneShotApiProxy,
|
|
627
|
+
signal?: AbortSignal,
|
|
555
628
|
): Promise<Response> {
|
|
629
|
+
// The command this read is for, which records what it came to.
|
|
630
|
+
const epoch = dataServiceReachEpoch();
|
|
556
631
|
const baseUrl = new URL(apiProxy.baseUrl);
|
|
557
632
|
const basePath = baseUrl.pathname.replace(/\/+$/, "");
|
|
558
633
|
let path = requestUrl.pathname.slice(SHOT_API_PROXY_PREFIX.length) || "/";
|
|
@@ -574,13 +649,51 @@ async function proxyShotApiRequest(
|
|
|
574
649
|
target.pathname = `${basePath}${path}`;
|
|
575
650
|
target.search = requestUrl.search;
|
|
576
651
|
target.hash = "";
|
|
652
|
+
const kept = requestUrl.search ? null : savedCopyRead(method, path);
|
|
653
|
+
// Not reached: a kept read answers from its saved copy, dated as saved; any other is told the service was not reached.
|
|
654
|
+
const savedAnswer = () => {
|
|
655
|
+
const saved = kept?.read.read(kept.key);
|
|
656
|
+
if (!saved) return null;
|
|
657
|
+
noteDataServiceReach(false, epoch);
|
|
658
|
+
apiProxy.onSavedCopy?.(saved.savedAt);
|
|
659
|
+
return Response.json(saved.value, { headers: { "Cache-Control": "no-store" } });
|
|
660
|
+
};
|
|
661
|
+
const unreachable = () => savedAnswer() ?? shotApiUnreachable(epoch);
|
|
662
|
+
// Once a read of this command went unanswered, a kept read is its saved copy at once: the page, which knows the
|
|
663
|
+
// service is down too, waits no longer for it than the proxy would for the network.
|
|
664
|
+
if (kept && dataServiceUnreachable()) {
|
|
665
|
+
const saved = savedAnswer();
|
|
666
|
+
if (saved) return saved;
|
|
667
|
+
}
|
|
668
|
+
// As the client's own requests wait (`deadlineFor`): ten seconds for the service to answer anything, three once a
|
|
669
|
+
// read of this command went unanswered. A hung connection was otherwise held until the page gave up, or to the end.
|
|
670
|
+
const answerMs = dataServiceUnreachable() ? UNREACHABLE_REQUEST_TIMEOUT_MS : MARKET_REQUEST_TIMEOUT_MS;
|
|
671
|
+
const answersAtStart = dataServiceAnswerCount();
|
|
672
|
+
const cut = new AbortController();
|
|
673
|
+
const abortFromPage = () => cut.abort(signal?.reason);
|
|
674
|
+
if (signal?.aborted) abortFromPage();
|
|
675
|
+
else signal?.addEventListener("abort", abortFromPage, { once: true });
|
|
676
|
+
let cutOff = false;
|
|
677
|
+
const deadline = setTimeout(function giveUp() {
|
|
678
|
+
// Another read answered meanwhile: the service is up and this one is slow, not cut off.
|
|
679
|
+
if (dataServiceAnswerCount() > answersAtStart) return;
|
|
680
|
+
cutOff = true;
|
|
681
|
+
cut.abort(new Error("The data service sent nothing back"));
|
|
682
|
+
}, answerMs);
|
|
577
683
|
|
|
578
684
|
try {
|
|
579
685
|
let body = method === "GET" || method === "HEAD" ? undefined : new Uint8Array(await request.arrayBuffer());
|
|
580
686
|
for (let followed = 0; ; followed += 1) {
|
|
581
|
-
const response = await fetch(target, { method, headers, body, redirect: "manual" });
|
|
687
|
+
const response = await fetch(target, { method, headers, body, redirect: "manual", signal: cut.signal });
|
|
688
|
+
clearTimeout(deadline);
|
|
689
|
+
// The proxy in HTTPS_PROXY refusing to reach the service answers for it: the page is told the service was not reached.
|
|
690
|
+
if (isProxyRefusal(target.href, response)) {
|
|
691
|
+
await response.body?.cancel().catch(() => { /* Intentional ignore: the refusal's own body is never read. */ });
|
|
692
|
+
return unreachable();
|
|
693
|
+
}
|
|
694
|
+
noteDataServiceReach(true, epoch);
|
|
582
695
|
const location = SHOT_API_REDIRECT_STATUSES.has(response.status) ? response.headers.get("location") : null;
|
|
583
|
-
if (location === null) return await shotApiResponse(response, path);
|
|
696
|
+
if (location === null) return kept && response.ok ? await keptResponse(response, kept) : await shotApiResponse(response, path);
|
|
584
697
|
await response.body?.cancel().catch(() => { /* Intentional ignore: a redirect's own body is never read, only dropped. */ });
|
|
585
698
|
if (followed >= SHOT_API_MAX_REDIRECTS) return shotApiError("Cloud API redirected too many times.", 502);
|
|
586
699
|
const next = new URL(location, target);
|
|
@@ -597,10 +710,42 @@ async function proxyShotApiRequest(
|
|
|
597
710
|
if (!inApi || !isShotApiRequestAllowed(method, path)) return shotApiError("Cloud API redirected the request elsewhere.", 502);
|
|
598
711
|
target = next;
|
|
599
712
|
}
|
|
600
|
-
} catch {
|
|
601
|
-
//
|
|
713
|
+
} catch (error) {
|
|
714
|
+
// A read that never reached the service (no connection, a refused proxy, nothing back by its deadline) is said
|
|
715
|
+
// as one, in the words every command uses; any other failure is told as a dropped connection tells fetch.
|
|
716
|
+
if (cutOff || isNetworkFailure(error)) return unreachable();
|
|
602
717
|
return shotApiError("Cloud API request failed.", 502);
|
|
718
|
+
} finally {
|
|
719
|
+
clearTimeout(deadline);
|
|
720
|
+
signal?.removeEventListener("abort", abortFromPage);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/** A kept read's answer as the page gets it, its copy saved for a later run the service does not answer. */
|
|
725
|
+
async function keptResponse(response: Response, kept: NonNullable<ReturnType<typeof savedCopyRead>>): Promise<Response> {
|
|
726
|
+
const text = await response.text();
|
|
727
|
+
try {
|
|
728
|
+
kept.read.save(kept.key, JSON.parse(text));
|
|
729
|
+
} catch {
|
|
730
|
+
// Intentional ignore: an answer that is not the terms' JSON is passed on as it came, and kept nowhere.
|
|
603
731
|
}
|
|
732
|
+
const headers = new Headers(response.headers);
|
|
733
|
+
for (const name of SHOT_API_DROPPED_RESPONSE_HEADERS) headers.delete(name);
|
|
734
|
+
headers.set("Cache-Control", "no-store");
|
|
735
|
+
return new Response(text, { status: response.status, statusText: response.statusText, headers });
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* The page's answer for a read the proxy could not get to the data service:
|
|
740
|
+
* the page's request reads it as the service being unreachable
|
|
741
|
+
* (SHOT_SERVICE_UNREACHABLE_HEADER), as it would a refused connection of its own.
|
|
742
|
+
*/
|
|
743
|
+
function shotApiUnreachable(epoch: number): Response {
|
|
744
|
+
noteDataServiceReach(false, epoch);
|
|
745
|
+
return Response.json({ error: DATA_SERVICE_UNREACHABLE_MESSAGE }, {
|
|
746
|
+
status: 502,
|
|
747
|
+
headers: { "Cache-Control": "no-store", [SHOT_SERVICE_UNREACHABLE_HEADER]: "1" },
|
|
748
|
+
});
|
|
604
749
|
}
|
|
605
750
|
|
|
606
751
|
/**
|
|
@@ -629,7 +774,6 @@ async function shotApiResponse(response: Response, path: string): Promise<Respon
|
|
|
629
774
|
async function capturePageScreenshot({
|
|
630
775
|
chrome,
|
|
631
776
|
url,
|
|
632
|
-
outputPath,
|
|
633
777
|
widthPx,
|
|
634
778
|
heightPx,
|
|
635
779
|
deviceScaleFactor,
|
|
@@ -640,7 +784,6 @@ async function capturePageScreenshot({
|
|
|
640
784
|
}: {
|
|
641
785
|
chrome: string;
|
|
642
786
|
url: string;
|
|
643
|
-
outputPath: string;
|
|
644
787
|
widthPx: number;
|
|
645
788
|
heightPx: number;
|
|
646
789
|
deviceScaleFactor: number;
|
|
@@ -648,7 +791,7 @@ async function capturePageScreenshot({
|
|
|
648
791
|
captureImage: boolean;
|
|
649
792
|
statusLine?: ShotStatusLine;
|
|
650
793
|
fitRows?: { heightCells: number; maxHeightCells: number; roles: readonly string[] };
|
|
651
|
-
}): Promise<DesktopPaneShotRenderResult> {
|
|
794
|
+
}): Promise<DesktopPaneShotRenderResult & { image?: Uint8Array }> {
|
|
652
795
|
const browser = await launchShotBrowser(chrome, { widthPx, heightPx, userDataDir });
|
|
653
796
|
const session = browser.page;
|
|
654
797
|
try {
|
|
@@ -666,10 +809,14 @@ async function capturePageScreenshot({
|
|
|
666
809
|
await waitForShotReady(session);
|
|
667
810
|
if (fitRows) await growToFitRows(session, { widthPx, heightPx, deviceScaleFactor, ...fitRows });
|
|
668
811
|
if (captureImage) await hideCutRows(session);
|
|
669
|
-
|
|
812
|
+
let rendered = await readRenderedPaneState(session);
|
|
670
813
|
if (captureImage && statusLine) {
|
|
671
814
|
const line = await statusLine(rendered);
|
|
672
|
-
|
|
815
|
+
const statusText = (await fitShotStatusLine(session, line ?? { variants: [] })) || null;
|
|
816
|
+
await hideCutRows(session);
|
|
817
|
+
rendered = await readRenderedPaneState(session);
|
|
818
|
+
rendered.statusLine = statusText;
|
|
819
|
+
rendered.statusLineClipped = shotStatusDateClipped(line, statusText);
|
|
673
820
|
}
|
|
674
821
|
if (captureImage) {
|
|
675
822
|
const screenshot = await session.send("Page.captureScreenshot", {
|
|
@@ -678,7 +825,7 @@ async function capturePageScreenshot({
|
|
|
678
825
|
captureBeyondViewport: false,
|
|
679
826
|
}) as { data?: string };
|
|
680
827
|
if (!screenshot.data) throw new Error("Chrome did not return screenshot data.");
|
|
681
|
-
|
|
828
|
+
return { ...rendered, image: Buffer.from(screenshot.data, "base64") };
|
|
682
829
|
}
|
|
683
830
|
return rendered;
|
|
684
831
|
} catch (error) {
|
|
@@ -729,16 +876,27 @@ async function growToFitRows(session: CdpPage, size: {
|
|
|
729
876
|
}
|
|
730
877
|
|
|
731
878
|
/**
|
|
732
|
-
*
|
|
733
|
-
*
|
|
734
|
-
*
|
|
735
|
-
* above it stays, cut, rather than leave the list blank. The live pane keeps
|
|
736
|
-
* its partly visible last row, as every scrolling list reads.
|
|
879
|
+
* A capture draws whole rows beneath the sticky header and above the bottom
|
|
880
|
+
* edge. It also draws the table's vertical scrollbar when rows scroll past
|
|
881
|
+
* those edges. The live table keeps smooth scrolling and its partial rows.
|
|
737
882
|
*/
|
|
738
883
|
async function hideCutRows(session: CdpPage): Promise<void> {
|
|
739
884
|
await session.send("Runtime.evaluate", {
|
|
740
885
|
expression: `(() => {
|
|
741
886
|
const root = document.getElementById("root") || document.body;
|
|
887
|
+
const visibilityOf = (${rowViewportVisibility.toString()});
|
|
888
|
+
const bodyRole = 'data-table-body-scroll';
|
|
889
|
+
for (const body of root.querySelectorAll('[data-gloom-role="' + bodyRole + '"]')) {
|
|
890
|
+
const showsOverflow = body.clientHeight > 0 && body.scrollHeight > body.clientHeight + 1
|
|
891
|
+
&& body.getAttribute('data-gloom-scrollbar-y') === 'visible'
|
|
892
|
+
&& /auto|scroll/.test(getComputedStyle(body).overflowY);
|
|
893
|
+
if (showsOverflow) {
|
|
894
|
+
body.style.scrollbarWidth = 'auto';
|
|
895
|
+
body.style.scrollbarColor = 'auto';
|
|
896
|
+
body.setAttribute('data-gloom-scrollbar-active', 'true');
|
|
897
|
+
}
|
|
898
|
+
body.toggleAttribute('data-gloom-shot-table-overflow', showsOverflow);
|
|
899
|
+
}
|
|
742
900
|
const rows = [...root.querySelectorAll(
|
|
743
901
|
'[data-gloom-role="data-table-row"], [data-gloom-role="data-table-section-header"], [data-gloom-role="desktop-list-row"], [data-gloom-row="true"]',
|
|
744
902
|
)];
|
|
@@ -746,28 +904,36 @@ async function hideCutRows(session: CdpPage): Promise<void> {
|
|
|
746
904
|
const style = getComputedStyle(element);
|
|
747
905
|
return /(auto|scroll|hidden|clip)/.test(style.overflowY) && element.clientHeight > 0;
|
|
748
906
|
};
|
|
749
|
-
const
|
|
907
|
+
const viewports = new Map();
|
|
908
|
+
const wholeRows = new Set();
|
|
750
909
|
const cut = [];
|
|
751
910
|
for (const row of rows) {
|
|
911
|
+
if (row.hasAttribute('data-gloom-shot-cut-row')) {
|
|
912
|
+
row.style.removeProperty('visibility');
|
|
913
|
+
row.removeAttribute('data-gloom-shot-cut-row');
|
|
914
|
+
}
|
|
752
915
|
let box = row.parentElement;
|
|
753
916
|
while (box && box !== root && !clips(box)) box = box.parentElement;
|
|
754
917
|
if (!box || box === root) continue;
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
918
|
+
if (!viewports.has(box)) {
|
|
919
|
+
const area = box.getBoundingClientRect();
|
|
920
|
+
const top = area.top + box.clientTop;
|
|
921
|
+
const header = box.getAttribute('data-gloom-role') === bodyRole
|
|
922
|
+
? box.querySelector('[data-gloom-role="data-table-header-row"]') : null;
|
|
923
|
+
viewports.set(box, { top: Math.max(top, header?.getBoundingClientRect().bottom ?? top), bottom: top + box.clientHeight });
|
|
924
|
+
}
|
|
925
|
+
const viewport = viewports.get(box);
|
|
758
926
|
const rect = row.getBoundingClientRect();
|
|
759
927
|
if (rect.height <= 0) continue;
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
wholeAbove.set(box, true);
|
|
764
|
-
} else if (rect.bottom > bottom + 1) {
|
|
765
|
-
cut.push({ row, box });
|
|
766
|
-
}
|
|
928
|
+
const visibility = visibilityOf(rect.top, rect.bottom, viewport.top, viewport.bottom);
|
|
929
|
+
if (visibility === 'whole') wholeRows.add(box);
|
|
930
|
+
else cut.push({ row, box, visibility });
|
|
767
931
|
}
|
|
768
|
-
for (const
|
|
769
|
-
if (
|
|
770
|
-
|
|
932
|
+
for (const { row, box, visibility } of cut) {
|
|
933
|
+
if (visibility === 'outside' || wholeRows.has(box)) {
|
|
934
|
+
row.style.visibility = 'hidden';
|
|
935
|
+
row.setAttribute('data-gloom-shot-cut-row', '');
|
|
936
|
+
}
|
|
771
937
|
}
|
|
772
938
|
})()`,
|
|
773
939
|
returnByValue: true,
|
|
@@ -816,6 +982,32 @@ const EMPTY_STATE_PATTERNS = [
|
|
|
816
982
|
/\bNo (?:option contracts returned for )?expiry \d{4}-\d{2}-\d{2}(?:; (?:available|nearest others): \d{4}-\d{2}-\d{2}(?:, \d{4}-\d{2}-\d{2})*(?: \(\+\d+ more\))?|; the chain lists no expiries)?/gi,
|
|
817
983
|
];
|
|
818
984
|
|
|
985
|
+
/**
|
|
986
|
+
* The text a capture reads the pane's state from: what it shows, less its
|
|
987
|
+
* footer's note line. A note says what the data shown leaves out ("Grossing
|
|
988
|
+
* and genre ranks are unavailable."), never that the pane failed: a full
|
|
989
|
+
* table under it is a usable pane, and an empty state under it is that state.
|
|
990
|
+
* Both texts come whitespace-collapsed, as the page reads them.
|
|
991
|
+
*/
|
|
992
|
+
function paneStateText(visibleText: string, footerNotes: readonly string[]): string {
|
|
993
|
+
return footerNotes.reduce((text, note) => {
|
|
994
|
+
const at = note ? text.lastIndexOf(note) : -1;
|
|
995
|
+
return at < 0 ? text : `${text.slice(0, at)} ${text.slice(at + note.length)}`;
|
|
996
|
+
}, visibleText).replace(/\s+/g, " ").trim();
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/** The words that mark a capture's loading, error, empty and gated states, read from its text less its note line (paneStateText). */
|
|
1000
|
+
export function paneStateMarkers(visibleText: string, footerNotes: readonly string[] = []) {
|
|
1001
|
+
const text = paneStateText(visibleText, footerNotes);
|
|
1002
|
+
return {
|
|
1003
|
+
loading: stateMarkers(text, LOADING_STATE_PATTERNS),
|
|
1004
|
+
error: stateMarkers(text, ERROR_STATE_PATTERNS),
|
|
1005
|
+
empty: stateMarkers(text, EMPTY_STATE_PATTERNS),
|
|
1006
|
+
signIn: stateMarkers(text, SIGN_IN_WALL_PATTERNS).length > 0,
|
|
1007
|
+
pro: stateMarkers(text, PRO_WALL_PATTERNS).length > 0,
|
|
1008
|
+
};
|
|
1009
|
+
}
|
|
1010
|
+
|
|
819
1011
|
function stateMarkers(text: string, patterns: RegExp[]): string[] {
|
|
820
1012
|
return [...new Set(patterns.flatMap((pattern) => (
|
|
821
1013
|
[...text.matchAll(pattern)].map((match) => match[0])
|
|
@@ -838,6 +1030,20 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
838
1030
|
&& rect.left < window.innerWidth && rect.top < window.innerHeight;
|
|
839
1031
|
};
|
|
840
1032
|
const semanticTables = semanticUi.filter((node) => node && node.role === "table");
|
|
1033
|
+
const clippedFigures = [...root.querySelectorAll('[data-gloom-essential="true"]')].flatMap((cell) => {
|
|
1034
|
+
const bounds = cell.getBoundingClientRect();
|
|
1035
|
+
const parts = [...cell.querySelectorAll('[data-gloom-role="stat-grid-label"], [data-gloom-role="stat-grid-value"]')];
|
|
1036
|
+
const clipped = !isVisible(cell) || parts.some((part) => {
|
|
1037
|
+
const rect = part.getBoundingClientRect();
|
|
1038
|
+
return !isVisible(part) || part.scrollWidth > part.clientWidth + 1
|
|
1039
|
+
|| rect.left < bounds.left - 1 || rect.right > bounds.right + 1
|
|
1040
|
+
|| rect.top < bounds.top - 1 || rect.bottom > bounds.bottom + 1;
|
|
1041
|
+
});
|
|
1042
|
+
return clipped ? [cell.querySelector('[data-gloom-role="stat-grid-label"]')?.textContent?.trim()].filter(Boolean) : [];
|
|
1043
|
+
});
|
|
1044
|
+
for (const node of semanticUi.filter((node) => node.role === "figure-layout" && node.metadata)) {
|
|
1045
|
+
node.metadata.omitted = [...(node.metadata.omitted ?? []), ...clippedFigures];
|
|
1046
|
+
}
|
|
841
1047
|
const rows = [];
|
|
842
1048
|
const truncationReasons = new Set();
|
|
843
1049
|
const scrollReasons = (${scrollTruncationReasons.toString()});
|
|
@@ -857,20 +1063,24 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
857
1063
|
const managesRows = (element) => element.getAttribute("data-gloom-role") === "data-table-body-scroll";
|
|
858
1064
|
const markScrollTruncation = (element) => {
|
|
859
1065
|
if (!(element instanceof HTMLElement) || !isVisible(element)) return;
|
|
860
|
-
const
|
|
1066
|
+
const metrics = {
|
|
861
1067
|
scrollTop: element.scrollTop,
|
|
862
1068
|
scrollHeight: element.scrollHeight,
|
|
863
1069
|
clientHeight: element.clientHeight,
|
|
864
1070
|
scrollLeft: element.scrollLeft,
|
|
865
1071
|
scrollWidth: element.scrollWidth,
|
|
866
1072
|
clientWidth: element.clientWidth,
|
|
867
|
-
// A
|
|
868
|
-
//
|
|
869
|
-
scrollbarY:
|
|
1073
|
+
// A table's vertical spacer includes virtual rows. Its scrollbar
|
|
1074
|
+
// attribute allows a bar, but does not prove that a bar is drawn.
|
|
1075
|
+
scrollbarY: false,
|
|
870
1076
|
scrollbarX: managesRows(element) && element.getAttribute("data-gloom-scrollbar-x") === "visible",
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
|
|
1077
|
+
};
|
|
1078
|
+
const table = element.closest('[data-gloom-role="data-table"]');
|
|
1079
|
+
const total = semanticTables[visibleTables.indexOf(table)]?.metadata?.rowCount;
|
|
1080
|
+
const rowCountAnnouncesCut = typeof total === 'number' && total > [...element.querySelectorAll('[data-gloom-role="data-table-row"]')].filter(isVisible).length;
|
|
1081
|
+
const rowsAnnounced = managesRows(element) && (element.hasAttribute('data-gloom-shot-table-overflow') || rowCountAnnouncesCut);
|
|
1082
|
+
scrollReasons(metrics, rowsAnnounced).forEach((reason) => truncationReasons.add(reason));
|
|
1083
|
+
if (!inReportedTable(element)) scrollReasons(metrics).forEach((reason) => reportTruncationReasons.add(reason));
|
|
874
1084
|
};
|
|
875
1085
|
[...root.querySelectorAll(
|
|
876
1086
|
'[data-gloom-scrollbar-x="visible"], [data-gloom-scrollbar-y="visible"], [data-gloom-role="data-table-body-scroll"]',
|
|
@@ -922,7 +1132,7 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
922
1132
|
const exact = Number(cell.getAttribute("data-gloom-cell-value") || "NaN");
|
|
923
1133
|
return {
|
|
924
1134
|
...(typeof semanticColumn.id === "string" ? { columnId: semanticColumn.id } : {}),
|
|
925
|
-
...(semanticColumn.mayBeBlank === true ? { mayBeBlank: true } : {}),
|
|
1135
|
+
...(semanticColumn.mayBeBlank === true || cell.getAttribute("data-gloom-cell-may-be-blank") === "true" ? { mayBeBlank: true } : {}),
|
|
926
1136
|
columnLabel: typeof semanticColumn.label === "string"
|
|
927
1137
|
? semanticColumn.label
|
|
928
1138
|
: headers[cellIndex] || (values.length === 1 ? "Row" : String(cellIndex + 1)),
|
|
@@ -975,10 +1185,18 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
975
1185
|
}
|
|
976
1186
|
return {
|
|
977
1187
|
visibleText: root.innerText || root.textContent || "",
|
|
1188
|
+
// What the visible text fields hold, which innerText leaves out: OVME's Underlying is one.
|
|
1189
|
+
fieldValues: [...root.querySelectorAll("input, textarea")]
|
|
1190
|
+
.filter((field) => isVisible(field) && field.type !== "password" && field.type !== "hidden")
|
|
1191
|
+
.map((field) => normalize(field.value))
|
|
1192
|
+
.filter(Boolean),
|
|
978
1193
|
footerText: [...root.querySelectorAll('[data-gloom-role="pane-footer"]')]
|
|
979
1194
|
.map((footer) => normalize(footer.innerText || footer.textContent))
|
|
980
1195
|
.filter(Boolean)
|
|
981
1196
|
.join(" "),
|
|
1197
|
+
footerNotes: [...root.querySelectorAll('[data-gloom-role="pane-footer-notes"]')]
|
|
1198
|
+
.map((note) => normalize(note.innerText || note.textContent))
|
|
1199
|
+
.filter(Boolean),
|
|
982
1200
|
visibleKeyValues: (${readVisibleKeyValues.toString()})(root),
|
|
983
1201
|
surfaces: [...root.querySelectorAll('[data-gloom-surface-renderer]')].filter(isVisible).map((element) => ({
|
|
984
1202
|
renderer: element.getAttribute("data-gloom-surface-renderer") || "",
|
|
@@ -1048,7 +1266,9 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
1048
1266
|
result?: {
|
|
1049
1267
|
value?: {
|
|
1050
1268
|
visibleText?: string;
|
|
1269
|
+
fieldValues?: unknown;
|
|
1051
1270
|
footerText?: string;
|
|
1271
|
+
footerNotes?: unknown;
|
|
1052
1272
|
visibleKeyValues?: Array<{ label: string; text: string }>;
|
|
1053
1273
|
surfaces?: DesktopPaneShotSurface[];
|
|
1054
1274
|
error?: string;
|
|
@@ -1073,11 +1293,13 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
1073
1293
|
const value = result.result?.value;
|
|
1074
1294
|
if (value?.error) throw new Error(value.error);
|
|
1075
1295
|
const visibleText = (value?.visibleText ?? "").replace(/\s+/g, " ").trim();
|
|
1076
|
-
const
|
|
1077
|
-
const
|
|
1078
|
-
const
|
|
1079
|
-
const
|
|
1080
|
-
|
|
1296
|
+
const footerNotes = Array.isArray(value?.footerNotes) ? value.footerNotes.filter((note): note is string => typeof note === "string") : [];
|
|
1297
|
+
const markers = paneStateMarkers(visibleText, footerNotes);
|
|
1298
|
+
const loadingStateMarkers = markers.loading;
|
|
1299
|
+
const errorStateMarkers = markers.error;
|
|
1300
|
+
const emptyStateMarkers = markers.empty;
|
|
1301
|
+
const accessGate: PaneAccessGate | null = value?.accessGate === "sign-in" || markers.signIn ? "sign-in"
|
|
1302
|
+
: value?.accessGate === "pro" || markers.pro ? "pro" : null;
|
|
1081
1303
|
const rows = Array.isArray(value?.rows) ? value.rows : [];
|
|
1082
1304
|
const textShowsEllipsis = rows.some((row) => row.cells.some((cell) => /\u2026|\.\.\./.test(cell.text)));
|
|
1083
1305
|
const truncationReasons = Array.isArray(value?.truncationReasons)
|
|
@@ -1089,8 +1311,10 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
1089
1311
|
const visibleLines = (value?.visibleText ?? "").split("\n")
|
|
1090
1312
|
.map((line) => line.replace(/\u00a0/g, " ").trimEnd())
|
|
1091
1313
|
.filter((line) => line.trim().length > 0);
|
|
1314
|
+
const fieldValues = Array.isArray(value?.fieldValues) ? value.fieldValues.filter((field): field is string => typeof field === "string") : [];
|
|
1092
1315
|
return {
|
|
1093
1316
|
visibleText,
|
|
1317
|
+
...(fieldValues.length > 0 ? { fieldValues } : {}),
|
|
1094
1318
|
visibleLines,
|
|
1095
1319
|
footerText: typeof value?.footerText === "string" ? value.footerText : "",
|
|
1096
1320
|
visibleKeyValues: Array.isArray(value?.visibleKeyValues) ? value.visibleKeyValues : [],
|
package/src/cli/errors.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AppPersistence } from "../data/app-persistence";
|
|
|
2
2
|
import { ApiRequestError, wasAskedTwice } from "../api-client/errors";
|
|
3
3
|
import { DEFAULT_CLI_OPTIONS, type CliGlobalOptions } from "./options";
|
|
4
4
|
import { serializeCliError, type CliErrorObject } from "./result";
|
|
5
|
+
import { unreachableHint } from "./unreachable";
|
|
5
6
|
import { cliStyles, cliTerminalWidth, wrapText } from "../utils/cli-output";
|
|
6
7
|
import { withSearchHints, type FredSeriesCheck } from "./not-a-ticker";
|
|
7
8
|
import { isProviderBusy, isSourceFailure, SEARCH_BUSY_CODE, SEARCH_BUSY_MESSAGE, serviceDidNotAnswerMessage } from "../sources/provider-errors";
|
|
@@ -18,14 +19,7 @@ const SERVICE_UNREACHABLE_CODE = "service_unreachable";
|
|
|
18
19
|
/** The code of a command whose data no source could serve just now, one having failed rather than had none. */
|
|
19
20
|
const SOURCE_UNAVAILABLE_CODE = "source_unavailable";
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
function unreachableHint(): string {
|
|
23
|
-
const env = typeof process === "undefined" ? {} : process.env;
|
|
24
|
-
const proxy = ["HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"].find((name) => env[name]?.trim());
|
|
25
|
-
return proxy
|
|
26
|
-
? `Check the internet connection and the proxy in ${proxy}, then try again.`
|
|
27
|
-
: "Check the internet connection, then try again.";
|
|
28
|
-
}
|
|
22
|
+
|
|
29
23
|
|
|
30
24
|
/**
|
|
31
25
|
* An answer of the data service that a source it reads failed and nothing it
|
|
@@ -141,7 +135,7 @@ function cliErrorObject(error: unknown): CliErrorObject {
|
|
|
141
135
|
}
|
|
142
136
|
// A listing read the data service failed to answer twice: said in Gloom's words. Any other 5xx keeps the server's.
|
|
143
137
|
if (wasAskedTwice(error)) {
|
|
144
|
-
return { code: SOURCE_UNAVAILABLE_CODE, message: serviceDidNotAnswerMessage(), retryable: true };
|
|
138
|
+
return { code: SOURCE_UNAVAILABLE_CODE, message: serviceDidNotAnswerMessage(undefined, error), retryable: true };
|
|
145
139
|
}
|
|
146
140
|
// Gloom Cloud refused what was asked (an unknown series, a bad date): the input was wrong, not the program.
|
|
147
141
|
if (error instanceof ApiRequestError && error.status === 400) {
|
package/src/cli/exit-codes.ts
CHANGED
|
@@ -3,6 +3,6 @@ export const CLI_EXIT_CODES = {
|
|
|
3
3
|
ok: 0,
|
|
4
4
|
/** Bad input, nothing found, a failed check, or an unexpected error. */
|
|
5
5
|
error: 1,
|
|
6
|
-
/** `shot --strict`
|
|
6
|
+
/** `shot --strict` did not save an image because the pane had no usable data to show. */
|
|
7
7
|
unusableShot: 2,
|
|
8
8
|
} as const;
|