gloomberb 0.20.3 → 0.20.5
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 +2 -0
- package/bin/gloom +9 -0
- package/bin/without-bun.cjs +98 -0
- package/package.json +3 -1
- package/src/account/auth-dialog.tsx +17 -0
- package/src/api-client/data.ts +144 -35
- package/src/api-client/fx-interventions.ts +64 -0
- package/src/api-client/index.ts +1 -0
- package/src/api-client/release-summaries.ts +21 -0
- package/src/api-client/types/econ.ts +12 -0
- package/src/api-client/yield-curves.ts +1 -1
- package/src/app/global-shortcuts.ts +4 -1
- package/src/app/keybindings/actions.ts +8 -2
- package/src/app/keybindings/config.ts +2 -1
- package/src/app/keybindings/index.ts +1 -0
- package/src/app/keybindings/labels.ts +6 -1
- package/src/app/keybindings/resolve.ts +23 -4
- package/src/app/keybindings/terminal-keys.ts +35 -0
- package/src/app/pane-runtime/index.tsx +2 -2
- package/src/app/pane-runtime/ticker-open-runtime.ts +274 -67
- package/src/architecture/ui-literals-allowlist.json +1 -1
- package/src/capabilities/chart-series.ts +27 -1
- package/src/cli/commands/keybindings.ts +5 -5
- package/src/cli/commands/market.ts +154 -21
- package/src/cli/commands/news-search.ts +60 -10
- package/src/cli/commands/overview.ts +16 -1
- package/src/cli/commands/plugins.ts +27 -5
- package/src/cli/commands/remote.ts +16 -17
- package/src/cli/commands/system.ts +20 -4
- package/src/cli/commands/ticker.ts +60 -19
- package/src/cli/fx-forward.ts +25 -7
- package/src/cli/glossary.ts +19 -5
- package/src/cli/history-rows.ts +5 -3
- package/src/cli/index.ts +8 -8
- package/src/cli/known-gaps.ts +27 -1
- package/src/cli/listing-arg.ts +11 -1
- package/src/cli/name-entries.ts +5 -1
- package/src/cli/not-a-ticker.ts +4 -0
- package/src/cli/pane-functions/function-help.ts +5 -5
- package/src/cli/report-tables.ts +18 -6
- package/src/cli/result.ts +15 -7
- package/src/cli/types.ts +2 -0
- package/src/components/chart/composite/axis-overlays.tsx +22 -0
- package/src/components/chart/composite/composite-chart.tsx +54 -13
- package/src/components/chart/composite/event-captions.ts +109 -0
- package/src/components/chart/composite/event-guides.ts +74 -0
- package/src/components/chart/composite/rasterizer.ts +2 -0
- package/src/components/chart/composite/text-renderer.ts +2 -0
- package/src/components/chart/composite/types.ts +31 -0
- package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
- package/src/components/command-bar/pane-settings.ts +2 -2
- package/src/components/command-bar/routes/root/provider-search.ts +5 -4
- package/src/components/command-bar/routes/root/results.ts +6 -2
- package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
- package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
- package/src/components/input-search-bar.tsx +9 -2
- package/src/components/layout/detached-pane-shell.tsx +1 -1
- package/src/components/layout/floating-pane.tsx +5 -1
- package/src/components/layout/pane/footer/index.tsx +21 -14
- package/src/components/layout/pane/footer/model.ts +6 -0
- package/src/components/layout/pane/header.tsx +2 -0
- package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
- package/src/components/layout/shell/active-drag.ts +149 -105
- package/src/components/layout/shell/drag/drop-zones.ts +162 -0
- package/src/components/layout/shell/drag/index.ts +47 -218
- package/src/components/layout/shell/drag/live.ts +10 -3
- package/src/components/layout/shell/drag/overlays.tsx +182 -5
- package/src/components/layout/shell/drag/runtime.ts +29 -6
- package/src/components/layout/shell/drag/shared-edges.ts +156 -0
- package/src/components/layout/shell/index.tsx +11 -6
- package/src/components/layout/shell/menu.ts +11 -2
- package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
- package/src/components/layout/shell/native/window-state.ts +2 -2
- package/src/components/layout/shell/pane/capture.ts +4 -1
- package/src/components/layout/shell/pane/layers.tsx +71 -7
- package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
- package/src/components/layout/shell/window-mode/index.ts +8 -10
- package/src/components/layout/status-bar.tsx +6 -1
- package/src/components/layout/window-edit/mode.ts +39 -7
- package/src/components/layout/window-edit/presentation.ts +1 -1
- package/src/components/onboarding/first-run-workspace.ts +44 -2
- package/src/components/onboarding/onboarding-frame.tsx +11 -2
- package/src/components/onboarding/onboarding-keyboard.ts +20 -0
- package/src/components/onboarding/onboarding-wizard.tsx +16 -11
- package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
- package/src/components/onboarding/use-onboarding-progress.ts +12 -4
- package/src/components/pane-settings-dialog/desktop.tsx +2 -2
- package/src/components/pane-settings-dialog/tui.tsx +2 -2
- package/src/components/pane-settings-dialog/value.ts +6 -0
- package/src/components/pane-settings-dialog.tsx +3 -3
- package/src/components/reader/detail-reader.tsx +4 -0
- package/src/components/ui/button.tsx +2 -0
- package/src/components/ui/choice-dialog.tsx +1 -0
- package/src/components/ui/data-table/index.tsx +4 -3
- package/src/components/ui/index.ts +1 -1
- package/src/components/ui/list-view.tsx +7 -12
- package/src/components/ui/loading.tsx +10 -3
- package/src/components/ui/menu.tsx +6 -2
- package/src/components/ui/page-stack-view.tsx +3 -0
- package/src/components/ui/pane-link-chip.tsx +269 -54
- package/src/components/ui/query-bar.tsx +2 -1
- package/src/components/ui/quote.ts +14 -1
- package/src/components/ui/tabs.tsx +97 -19
- package/src/core/state/app/layout-reducer.ts +7 -0
- package/src/core/state/app/layout.ts +44 -7
- package/src/core/state/app/state.ts +1 -1
- package/src/core/state/app/types.ts +22 -2
- package/src/data/config/layout.ts +5 -2
- package/src/docs/snapshot.json +54 -13
- package/src/i18n/es.ts +9 -8
- package/src/i18n/ja.ts +9 -8
- package/src/i18n/ko.ts +9 -8
- package/src/i18n/zh-cn.ts +9 -8
- package/src/i18n/zh-tw.ts +9 -8
- package/src/layout/pane-manager/floating-actions.ts +17 -0
- package/src/layout/pane-manager/floating-stack.ts +187 -0
- package/src/layout/pane-manager/floating.ts +4 -2
- package/src/layout/pane-manager/gridlock.ts +5 -1
- package/src/layout/pane-manager/index.ts +11 -0
- package/src/layout/pane-manager/layout-state.ts +10 -3
- package/src/market-data/depositary-pair.ts +5 -3
- package/src/market-data/futures-board.ts +46 -1
- package/src/market-data/futures-contract.ts +12 -3
- package/src/market-data/fx-interventions.ts +270 -0
- package/src/market-data/market/dated-previous-close.ts +94 -15
- package/src/market-data/market/status.ts +17 -1
- package/src/news/news-model.ts +44 -2
- package/src/plugins/builtin/alerts/cli.ts +4 -4
- package/src/plugins/builtin/alerts/format.ts +1 -2
- package/src/plugins/builtin/alerts/headless.ts +1 -2
- package/src/plugins/builtin/alerts/move-checks.ts +12 -6
- package/src/plugins/builtin/alerts/move.ts +30 -9
- package/src/plugins/builtin/alerts/pane.tsx +0 -2
- package/src/plugins/builtin/alerts/storage.ts +4 -2
- package/src/plugins/builtin/alerts/types.ts +12 -0
- package/src/plugins/builtin/analytics/risk-client.ts +10 -4
- package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
- package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
- package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
- package/src/plugins/builtin/awards/index.tsx +1 -1
- package/src/plugins/builtin/buildout/index.tsx +1 -0
- package/src/plugins/builtin/catalysts/index.tsx +2 -2
- package/src/plugins/builtin/cds/headless.ts +4 -0
- package/src/plugins/builtin/changelog/index.tsx +292 -101
- package/src/plugins/builtin/changelog/versions.ts +293 -0
- package/src/plugins/builtin/chart-composer/headless.ts +2 -1
- package/src/plugins/builtin/chart-composer/index.tsx +1 -0
- package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
- package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
- package/src/plugins/builtin/chat/content/composer.tsx +5 -4
- package/src/plugins/builtin/chat/content/index.tsx +12 -2
- package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
- package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
- package/src/plugins/builtin/chat/layout.ts +5 -2
- package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
- package/src/plugins/builtin/chat/message/render-state.ts +2 -5
- package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
- package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
- package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
- package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
- package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
- package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
- package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
- package/src/plugins/builtin/cloud/askg/model.ts +14 -4
- package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
- package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
- package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
- package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
- package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
- package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
- package/src/plugins/builtin/cloud/terminal-relay/redact.ts +52 -9
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
- package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
- package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
- package/src/plugins/builtin/company-attention/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +3 -1
- package/src/plugins/builtin/company-kpis/index.tsx +2 -2
- package/src/plugins/builtin/cot/headless.ts +14 -2
- package/src/plugins/builtin/cot/index.tsx +1 -1
- package/src/plugins/builtin/cpi/index.tsx +1 -1
- package/src/plugins/builtin/crypto-board/index.tsx +1 -0
- package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
- package/src/plugins/builtin/doe/index.tsx +1 -1
- package/src/plugins/builtin/earnings/index.tsx +2 -2
- package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
- package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
- package/src/plugins/builtin/econ/calendar-model.ts +74 -1
- package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
- package/src/plugins/builtin/econ/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
- package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
- package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
- package/src/plugins/builtin/executives/index.tsx +1 -0
- package/src/plugins/builtin/filing-events/index.tsx +1 -0
- package/src/plugins/builtin/fixed-income/index.tsx +1 -0
- package/src/plugins/builtin/futures/index.tsx +25 -4
- package/src/plugins/builtin/futures/model.ts +28 -32
- package/src/plugins/builtin/futures/series.ts +4 -3
- package/src/plugins/builtin/futures/table.tsx +16 -9
- package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
- package/src/plugins/builtin/futures-curve/headless.ts +3 -3
- package/src/plugins/builtin/futures-curve/index.tsx +1 -1
- package/src/plugins/builtin/futures-curve/model.ts +18 -0
- package/src/plugins/builtin/gpu/index.tsx +1 -1
- package/src/plugins/builtin/help/functions-table.tsx +1 -1
- package/src/plugins/builtin/help/index.tsx +14 -4
- package/src/plugins/builtin/help/keybindings-editor.tsx +19 -5
- package/src/plugins/builtin/holders/index.tsx +1 -0
- package/src/plugins/builtin/holders/report-header.ts +2 -2
- package/src/plugins/builtin/insider/index.tsx +1 -0
- package/src/plugins/builtin/iv-history/index.tsx +1 -1
- package/src/plugins/builtin/jobs/index.tsx +1 -0
- package/src/plugins/builtin/layout-manager/index.tsx +8 -8
- package/src/plugins/builtin/macro-day/headless.ts +27 -8
- package/src/plugins/builtin/macro-day/index.tsx +1 -1
- package/src/plugins/builtin/macro-day/model.ts +19 -3
- package/src/plugins/builtin/macro-day/pane.tsx +14 -9
- package/src/plugins/builtin/macro-day/releases.ts +25 -7
- package/src/plugins/builtin/market-valuation/index.tsx +1 -0
- package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
- package/src/plugins/builtin/members/index.tsx +1 -1
- package/src/plugins/builtin/mna/index.tsx +1 -0
- package/src/plugins/builtin/news/headless.ts +2 -2
- package/src/plugins/builtin/news/index.tsx +4 -3
- package/src/plugins/builtin/news/wire/index.tsx +5 -1
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
- package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
- package/src/plugins/builtin/options/index.tsx +1 -0
- package/src/plugins/builtin/options-positioning/index.tsx +1 -0
- package/src/plugins/builtin/pe-band/index.tsx +1 -1
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
- package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
- package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
- package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
- package/src/plugins/builtin/power/index.tsx +1 -1
- package/src/plugins/builtin/realized-vol/index.tsx +1 -1
- package/src/plugins/builtin/research/event-model.ts +9 -1
- package/src/plugins/builtin/research/event-sources.ts +22 -0
- package/src/plugins/builtin/research/headless.ts +11 -5
- package/src/plugins/builtin/research/index.tsx +4 -0
- package/src/plugins/builtin/research-search/index.tsx +1 -0
- package/src/plugins/builtin/research-search/pane.tsx +8 -0
- package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
- package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
- package/src/plugins/builtin/risk-factors/index.tsx +1 -0
- package/src/plugins/builtin/scanner/headless.ts +52 -13
- package/src/plugins/builtin/seasonality/index.tsx +1 -1
- package/src/plugins/builtin/sec/index.tsx +1 -0
- package/src/plugins/builtin/series-inventory.ts +1 -1
- package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
- package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
- package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
- package/src/plugins/builtin/short-interest/index.tsx +1 -0
- package/src/plugins/builtin/social-mentions/index.tsx +1 -1
- package/src/plugins/builtin/supply-chain/index.tsx +1 -0
- package/src/plugins/builtin/thirteenf/data.ts +43 -10
- package/src/plugins/builtin/thirteenf/headless.ts +55 -11
- package/src/plugins/builtin/thirteenf/model.ts +25 -9
- package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
- package/src/plugins/builtin/thirteenf/types.ts +2 -0
- package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
- package/src/plugins/builtin/ticker-detail/financials/model.ts +12 -0
- package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
- package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
- package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
- package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +34 -17
- package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
- package/src/plugins/builtin/time-sales/client.ts +9 -11
- package/src/plugins/builtin/time-sales/index.tsx +1 -1
- package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
- package/src/plugins/builtin/treasury-auctions/cache.ts +18 -3
- package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
- package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
- package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
- package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
- package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
- package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
- package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
- package/src/plugins/builtin/vol-surface/index.tsx +1 -1
- package/src/plugins/builtin/world-venue-map/index.ts +1 -0
- package/src/plugins/builtin/yield-curve/curves.ts +10 -4
- package/src/plugins/builtin/yield-curve/headless.ts +6 -2
- package/src/plugins/builtin/yield-curve/index.tsx +3 -3
- package/src/plugins/builtin/yield-curve/series.ts +10 -0
- package/src/plugins/builtin/yield-curve/world.ts +3 -1
- package/src/plugins/installer.ts +45 -0
- package/src/portfolio/column-values.ts +2 -1
- package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
- package/src/public/remote.ts +7 -1
- package/src/remote/client.ts +191 -11
- package/src/remote/controller-utils.ts +13 -1
- package/src/remote/controller.ts +88 -26
- package/src/remote/endpoint.ts +24 -0
- package/src/remote/form.ts +59 -4
- package/src/remote/resources.ts +56 -19
- package/src/remote/schema.ts +22 -9
- package/src/remote/secrets.ts +12 -0
- package/src/remote/semantic-helpers.ts +29 -1
- package/src/remote/semantic-tree.tsx +44 -15
- package/src/remote/server.ts +2 -1
- package/src/remote/surface.tsx +192 -0
- package/src/remote/types.ts +5 -0
- package/src/renderers/cloudflare/worker.ts +16 -1
- package/src/renderers/dom/styles.css +40 -6
- package/src/renderers/opentui/host.tsx +6 -0
- package/src/renderers/share/layout-view.tsx +1 -1
- package/src/series/standalone.ts +2 -2
- package/src/shares/api.ts +21 -4
- package/src/shares/item.ts +73 -0
- package/src/shares/pane-item.ts +205 -0
- package/src/shares/pane.ts +4 -0
- package/src/shares/payload.ts +9 -5
- package/src/sources/gloomberb-cloud/news.ts +37 -12
- package/src/state/opening-ticker-panes.ts +47 -0
- package/src/test-support/cli-context.ts +2 -0
- package/src/test-support/preload.ts +4 -1
- package/src/tickers/instrument-kind.ts +23 -3
- package/src/tickers/renamed-listings.ts +105 -0
- package/src/tickers/search/index.ts +103 -16
- package/src/time-series/resolve.ts +2 -2
- package/src/types/config.ts +5 -0
- package/src/types/context-menu.ts +2 -0
- package/src/types/financials.ts +1 -0
- package/src/types/plugin-commands.ts +140 -0
- package/src/types/plugin-context.ts +125 -0
- package/src/types/plugin-contributions.ts +55 -0
- package/src/types/plugin-definition.ts +234 -0
- package/src/types/plugin-notifications.ts +38 -0
- package/src/types/plugin-pane-settings.ts +116 -0
- package/src/types/plugin-pane-templates.ts +160 -0
- package/src/types/plugin-panes.ts +243 -0
- package/src/types/plugin-reports.ts +35 -0
- package/src/types/plugin-shared.ts +14 -0
- package/src/types/plugin-state.ts +71 -0
- package/src/types/plugin.ts +14 -1169
- package/src/ui/index.tsx +14 -3
- package/src/updater/github-releases.ts +23 -0
- package/src/utils/central-banks.ts +86 -1
- package/src/utils/cli-output.ts +22 -9
- package/src/utils/datetime-format.ts +12 -3
- package/src/utils/depositary-receipt.ts +28 -3
- package/src/utils/fundamentals.ts +14 -0
- package/src/utils/max-drawdown.ts +97 -16
- package/src/utils/untrusted-text.ts +29 -0
package/README.md
CHANGED
|
@@ -47,6 +47,8 @@ Or with [Bun](https://bun.sh), on any of them:
|
|
|
47
47
|
bun install -g @gloom-sh/terminal
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
+
`npm install -g @gloom-sh/terminal` works too, but the command runs on Bun, so install [Bun](https://bun.sh) first.
|
|
51
|
+
|
|
50
52
|
Then run `gloom` (`gloomberb`, its old name, still works). On Apple Silicon the script also installs the desktop app, Gloom.app. Homebrew, the Windows desktop installer and manual downloads are in the [installation guide](docs/installation.md).
|
|
51
53
|
|
|
52
54
|
Charts draw as images in Kitty-compatible terminals such as Ghostty, Kitty and WezTerm, and as text elsewhere.
|
package/bin/gloom
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
// The package installs this as both `gloom` and `gloomberb`.
|
|
4
4
|
//
|
|
5
|
+
// npm on a machine without Bun points this file at Node instead
|
|
6
|
+
// (without-bun.cjs, its preinstall): Node hands over to Bun once there is
|
|
7
|
+
// one, or says in one line how to get it.
|
|
8
|
+
if (!process.versions.bun) {
|
|
9
|
+
const { runWithoutBun } = await import("./without-bun.cjs");
|
|
10
|
+
const { fileURLToPath } = await import("node:url");
|
|
11
|
+
process.exit(await runWithoutBun(fileURLToPath(import.meta.url), process.argv.slice(2)));
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
// Bun applies patchedDependencies only to the root project, so a global
|
|
6
15
|
// `bun install -g` runs react-reconciler without
|
|
7
16
|
// patches/react-reconciler@0.33.0.patch. Its dev build then records a
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// Gloom runs on Bun, and `bin/gloom` starts with `#!/usr/bin/env bun`. npm and
|
|
4
|
+
// npx install it on machines without Bun too, where that line failed with
|
|
5
|
+
// "env: bun: No such file or directory" before any of Gloom ran.
|
|
6
|
+
//
|
|
7
|
+
// Run as npm's preinstall (before npm links the command, so Windows' shims
|
|
8
|
+
// follow it too), this points the command at Node when no Bun is found.
|
|
9
|
+
// Under Node, `bin/gloom` then hands over to Bun once one is installed, or
|
|
10
|
+
// says in one line how to get it (runWithoutBun). A machine with Bun, and
|
|
11
|
+
// every Bun install, keeps the Bun line untouched. Never fails an install.
|
|
12
|
+
|
|
13
|
+
const { existsSync, readFileSync, writeFileSync } = require("node:fs");
|
|
14
|
+
const { homedir } = require("node:os");
|
|
15
|
+
const { delimiter, join } = require("node:path");
|
|
16
|
+
|
|
17
|
+
const BUN_LINE = "#!/usr/bin/env bun";
|
|
18
|
+
const NODE_LINE = "#!/usr/bin/env node";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A Bun on PATH, or where Bun's installer puts it; null when there is none.
|
|
22
|
+
* On Windows only bun.exe counts, as Node cannot start a .cmd shim without a
|
|
23
|
+
* shell: an npm-installed Bun is found by the bun.exe beside its shims.
|
|
24
|
+
*/
|
|
25
|
+
function findBun(env = process.env, platform = process.platform) {
|
|
26
|
+
const dirs = [
|
|
27
|
+
...(env.PATH ?? env.Path ?? "").split(platform === "win32" ? ";" : delimiter),
|
|
28
|
+
join(env.BUN_INSTALL || join(homedir(), ".bun"), "bin"),
|
|
29
|
+
].filter(Boolean);
|
|
30
|
+
for (const dir of dirs) {
|
|
31
|
+
const candidates = platform === "win32"
|
|
32
|
+
? [join(dir, "bun.exe"), join(dir, "node_modules", "bun", "bin", "bun.exe")]
|
|
33
|
+
: [join(dir, "bun")];
|
|
34
|
+
const found = candidates.find((candidate) => existsSync(candidate));
|
|
35
|
+
if (found) return found;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** The one line a machine without Bun gets, naming both ways out. */
|
|
41
|
+
function missingBunMessage(platform = process.platform) {
|
|
42
|
+
return platform === "win32"
|
|
43
|
+
? "gloom runs on Bun, which is not installed. Install Bun (powershell -c \"irm bun.sh/install.ps1 | iex\") and run gloom again, or install Gloom with: irm https://gloom.sh/install.ps1 | iex"
|
|
44
|
+
: "gloom runs on Bun, which is not installed. Install Bun (curl -fsSL https://bun.sh/install | bash) and run gloom again, or install Gloom with: curl -fsSL https://gloom.sh/install | bash";
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Points `launcher` at Node when npm installs it on a machine with no Bun.
|
|
49
|
+
* True when it changed it. A Bun install, and a source checkout (not under
|
|
50
|
+
* node_modules), keep the Bun line.
|
|
51
|
+
*/
|
|
52
|
+
function useNodeWithoutBun(launcher, env = process.env, platform = process.platform) {
|
|
53
|
+
if ((env.npm_config_user_agent ?? "").startsWith("bun/")) return false;
|
|
54
|
+
if (!launcher.split(/[\\/]/).includes("node_modules")) return false;
|
|
55
|
+
if (findBun(env, platform)) return false;
|
|
56
|
+
const text = readFileSync(launcher, "utf8");
|
|
57
|
+
if (!text.startsWith(`${BUN_LINE}\n`)) return false;
|
|
58
|
+
writeFileSync(launcher, `${NODE_LINE}\n${text.slice(BUN_LINE.length + 1)}`);
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* `bin/gloom` under Node: runs `script` with the Bun found now, passing the
|
|
64
|
+
* arguments, stdio and exit status through, or prints missingBunMessage.
|
|
65
|
+
* Resolves to the exit code.
|
|
66
|
+
*/
|
|
67
|
+
function runWithoutBun(script, args) {
|
|
68
|
+
const bun = findBun();
|
|
69
|
+
if (!bun) {
|
|
70
|
+
process.stderr.write(`${missingBunMessage()}\n`);
|
|
71
|
+
return Promise.resolve(1);
|
|
72
|
+
}
|
|
73
|
+
const { spawn } = require("node:child_process");
|
|
74
|
+
const { constants } = require("node:os");
|
|
75
|
+
return new Promise((resolve) => {
|
|
76
|
+
const child = spawn(bun, [script, ...args], { stdio: "inherit" });
|
|
77
|
+
// The terminal sends Ctrl+C to Bun as well; Node waits for it to finish.
|
|
78
|
+
const ignore = () => {};
|
|
79
|
+
for (const signal of ["SIGINT", "SIGTERM", "SIGHUP"]) process.on(signal, ignore);
|
|
80
|
+
child.on("error", (error) => {
|
|
81
|
+
process.stderr.write(`gloom: could not start Bun at ${bun}: ${error.message}\n`);
|
|
82
|
+
resolve(1);
|
|
83
|
+
});
|
|
84
|
+
child.on("exit", (code, signal) => {
|
|
85
|
+
resolve(code ?? 128 + (signal ? constants.signals[signal] ?? 0 : 0));
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = { findBun, missingBunMessage, runWithoutBun, useNodeWithoutBun };
|
|
91
|
+
|
|
92
|
+
if (require.main === module && !process.versions.bun) {
|
|
93
|
+
try {
|
|
94
|
+
useNodeWithoutBun(join(__dirname, "gloom"));
|
|
95
|
+
} catch {
|
|
96
|
+
// Intentional ignore: a launcher that cannot be rewritten keeps the Bun line, as before.
|
|
97
|
+
}
|
|
98
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gloomberb",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.5",
|
|
4
4
|
"packageManager": "bun@1.3.14",
|
|
5
5
|
"description": "Market research and portfolio tracker for the terminal",
|
|
6
6
|
"module": "src/public/index.ts",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"patches"
|
|
52
52
|
],
|
|
53
53
|
"scripts": {
|
|
54
|
+
"preinstall": "node bin/without-bun.cjs || exit 0",
|
|
54
55
|
"dev": "bun run --watch src/cli/entry.ts",
|
|
55
56
|
"start": "bun src/cli/entry.ts",
|
|
56
57
|
"build": "bun run scripts/build.ts",
|
|
@@ -94,6 +95,7 @@
|
|
|
94
95
|
"check:pane-layout": "bun run scripts/pane-chrome/layout-sweep.ts",
|
|
95
96
|
"check:ui-tokens": "bun run scripts/pane-chrome/ui-tokens.ts",
|
|
96
97
|
"ui:benchmark": "bun run scripts/pane-chrome/ui-benchmark.ts",
|
|
98
|
+
"askg:tool-sweep": "bun run scripts/askg-tool-sweep.ts",
|
|
97
99
|
"ui:badge-ink": "bun run scripts/pane-chrome/badge-ink.ts",
|
|
98
100
|
"audit:ui": "bun run scripts/pane-chrome/ui-audit.ts",
|
|
99
101
|
"check:call-player": "bun run scripts/pane-chrome/call-player.ts",
|
|
@@ -45,6 +45,8 @@ export interface AuthDialogRequest {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
const authDialogListeners = new Set<(request: AuthDialogRequest) => void>();
|
|
48
|
+
/** How many hosts show the dialog now; a request while one does is ignored. */
|
|
49
|
+
let openAuthDialogs = 0;
|
|
48
50
|
|
|
49
51
|
/** Returns false when no dialog host is mounted, so callers can fall back. */
|
|
50
52
|
export function requestAuthDialog(request: AuthDialogRequest = {}): boolean {
|
|
@@ -53,6 +55,19 @@ export function requestAuthDialog(request: AuthDialogRequest = {}): boolean {
|
|
|
53
55
|
return true;
|
|
54
56
|
}
|
|
55
57
|
|
|
58
|
+
/** Whether the dialog is on screen, so a press that would only ask for it again can do nothing. */
|
|
59
|
+
export function isAuthDialogOpen(): boolean {
|
|
60
|
+
return openAuthDialogs > 0;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** Takes the requests a host would, for a test that signs in without the form. */
|
|
64
|
+
export function interceptAuthDialogForTests(listener: (request: AuthDialogRequest) => void): () => void {
|
|
65
|
+
authDialogListeners.add(listener);
|
|
66
|
+
return () => {
|
|
67
|
+
authDialogListeners.delete(listener);
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
56
71
|
export function AuthDialogHost() {
|
|
57
72
|
const dialog = useDialog();
|
|
58
73
|
const openRef = useRef(false);
|
|
@@ -61,6 +76,7 @@ export function AuthDialogHost() {
|
|
|
61
76
|
const listener = (request: AuthDialogRequest) => {
|
|
62
77
|
if (openRef.current) return;
|
|
63
78
|
openRef.current = true;
|
|
79
|
+
openAuthDialogs += 1;
|
|
64
80
|
void dialog
|
|
65
81
|
.prompt<AuthUser | undefined>({
|
|
66
82
|
closeOnClickOutside: false,
|
|
@@ -76,6 +92,7 @@ export function AuthDialogHost() {
|
|
|
76
92
|
})
|
|
77
93
|
.finally(() => {
|
|
78
94
|
openRef.current = false;
|
|
95
|
+
openAuthDialogs -= 1;
|
|
79
96
|
});
|
|
80
97
|
};
|
|
81
98
|
authDialogListeners.add(listener);
|
package/src/api-client/data.ts
CHANGED
|
@@ -35,6 +35,7 @@ import type { OrganizationTickersResponse } from "./organization-tickers";
|
|
|
35
35
|
import type { BitcoinNetworkPayload, CryptoMarketsPayload, DefiTvlPayload, StablecoinSupplyHistoryPayload, StablecoinSupplyPayload } from "./crypto-markets";
|
|
36
36
|
import type { CryptoEtfFlowAsset, CryptoEtfFlowsPayload } from "./crypto-etf-flows";
|
|
37
37
|
import type { CentralBankRatesPayload } from "./central-bank-rates";
|
|
38
|
+
import type { FxInterventionsPayload } from "./fx-interventions";
|
|
38
39
|
import type { EstimateRevisionsPayload } from "./estimate-revisions";
|
|
39
40
|
import type { MoneyMarketsPayload } from "./money-markets";
|
|
40
41
|
import type { CloudCurveHistory, CloudCurveId, CloudCurveView, CloudWorldCurves } from "./yield-curves";
|
|
@@ -54,7 +55,7 @@ import type { GpuBoardPayload, GpuEventsPayload, GpuHistoryPayload, GpuHistoryQu
|
|
|
54
55
|
import type { CpiBoardPayload } from "./cpi";
|
|
55
56
|
import type { TapeRange, TapeSnapshot } from "./tape";
|
|
56
57
|
import { LIVE_SCAN_PATH, type LiveScanPayload, type LiveScanWireDefinition } from "./live-scan";
|
|
57
|
-
import { signalWithTimeout } from "../utils/async-deadline";
|
|
58
|
+
import { abortable, signalWithTimeout } from "../utils/async-deadline";
|
|
58
59
|
import { ApiRequestError, isRetryableApiError, markAskedTwice } from "./errors";
|
|
59
60
|
import type { ExchangeRateSnapshot } from "../types/exchange-rate";
|
|
60
61
|
import type { RatePathPayload } from "./rates";
|
|
@@ -234,6 +235,33 @@ export interface BatchableRead {
|
|
|
234
235
|
batch?: boolean;
|
|
235
236
|
}
|
|
236
237
|
|
|
238
|
+
const DAY_MS = 86_400_000;
|
|
239
|
+
|
|
240
|
+
/** A YYYY-MM-DD date `days` away as a UTC time, or null for any other form, which bounds nothing. */
|
|
241
|
+
function dayTime(date: string | undefined, days: number): number | null {
|
|
242
|
+
if (!date || !/^\d{4}-\d{2}-\d{2}$/.test(date)) return null;
|
|
243
|
+
const time = Date.parse(`${date}T00:00:00Z`);
|
|
244
|
+
return Number.isFinite(time) ? time + days * DAY_MS : null;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Whether every bar falls in the window asked, give or take the day a daily
|
|
249
|
+
* bar's UTC time may stand from its session's date. A server from before
|
|
250
|
+
* windowed batches answers its latest bars instead, which this tells apart.
|
|
251
|
+
*/
|
|
252
|
+
function withinWindow(points: readonly CloudPricePointPayload[] | null | undefined, startDate?: string, endDate?: string): boolean {
|
|
253
|
+
if (!Array.isArray(points)) return true;
|
|
254
|
+
const from = dayTime(startDate, -2);
|
|
255
|
+
const before = dayTime(endDate, 2);
|
|
256
|
+
return points.every((point) => {
|
|
257
|
+
const time = Date.parse(point.date);
|
|
258
|
+
return !Number.isFinite(time) || ((from == null || time >= from) && (before == null || time < before));
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** What a service without windowed batches is taken to have answered: the route missing, so the reads go out alone until it is asked again. */
|
|
263
|
+
const WINDOWLESS_BATCH = "The history batch route does not read a window of dates";
|
|
264
|
+
|
|
237
265
|
export class CloudDataApi {
|
|
238
266
|
constructor(
|
|
239
267
|
private readonly request: CloudApiRequest,
|
|
@@ -249,36 +277,97 @@ export class CloudDataApi {
|
|
|
249
277
|
* board's seventy-two rows are five requests, and the first rows land as
|
|
250
278
|
* soon as sixteen reads have.
|
|
251
279
|
*/
|
|
252
|
-
private readonly histories =
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
}
|
|
280
|
+
private readonly histories = this.historyCoalescer(false);
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* The same over one window of dates (a portfolio's holdings over the risk
|
|
284
|
+
* model's months or the stress episodes' years). A service from before
|
|
285
|
+
* windowed batches answers its latest bars instead, or refuses the window:
|
|
286
|
+
* that reads as the route missing, so the reads are asked on their own,
|
|
287
|
+
* four at a time, until it is asked again. Until a windowed batch has been
|
|
288
|
+
* answered, one read is asked as a batch of its own first (`windowProbe`),
|
|
289
|
+
* so finding that out costs one listing's bars, not every batch's.
|
|
290
|
+
*/
|
|
291
|
+
private readonly datedHistories = this.historyCoalescer(true);
|
|
292
|
+
/** The first windowed batch, of one read, that the others wait on; null until asked, and again after it found no windows. */
|
|
293
|
+
private windowProbe: Promise<CloudMarketResponse<CloudPricePointPayload[]> | undefined> | null = null;
|
|
294
|
+
/** Whether a windowed batch has come back over its window: the probe is not asked again. */
|
|
295
|
+
private windowsAnswered = false;
|
|
296
|
+
|
|
297
|
+
private historyCoalescer(dated: boolean) {
|
|
298
|
+
return createReadCoalescer<
|
|
299
|
+
{ symbol: string; exchange: string; params: Pick<CloudHistoryParams, "interval" | "outputsize" | "rangeKey" | "startDate" | "endDate"> },
|
|
300
|
+
CloudMarketResponse<CloudPricePointPayload[]>
|
|
301
|
+
>({
|
|
302
|
+
max: 16,
|
|
303
|
+
// Reads asked alone after a refused batch stay within what the panes kept in flight before: SOVR four, the board twelve with its terms.
|
|
304
|
+
fallbackConcurrency: 4,
|
|
305
|
+
group: ({ params }) => [params.interval, params.outputsize, params.rangeKey, params.startDate, params.endDate].map((value) => value ?? "").join("|"),
|
|
306
|
+
single: ({ symbol, exchange, params }) => this.request(cloudHistoryPath(symbol, exchange, params)),
|
|
307
|
+
batch: (keys) => (dated ? this.windowedBatch(keys) : this.historyBatch(keys, false)),
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
private async historyBatch(
|
|
312
|
+
keys: Array<{ symbol: string; exchange: string; params: Pick<CloudHistoryParams, "interval" | "outputsize" | "rangeKey" | "startDate" | "endDate"> }>,
|
|
313
|
+
dated: boolean,
|
|
314
|
+
): Promise<Array<CloudMarketResponse<CloudPricePointPayload[]> | undefined>> {
|
|
315
|
+
const { interval, outputsize, rangeKey, startDate, endDate } = keys[0]!.params;
|
|
316
|
+
// The server answers each target in the order asked, so a listing asked twice is asked once.
|
|
317
|
+
const targetKey = ({ symbol, exchange }: { symbol: string; exchange: string }) => `${symbol}\u001f${exchange}`;
|
|
318
|
+
const targets = [...new Map(keys.map((key) => [targetKey(key), { symbol: key.symbol, exchange: key.exchange }])).values()];
|
|
319
|
+
const response = await this.request<CloudMarketResponse<{ items: Array<CloudMarketResponse<CloudPricePointPayload[]>> }>>("/market/history/batch", {
|
|
320
|
+
method: "POST",
|
|
321
|
+
body: JSON.stringify({
|
|
322
|
+
targets,
|
|
323
|
+
interval: interval ?? "1day",
|
|
324
|
+
...(outputsize != null ? { outputsize: String(outputsize) } : {}),
|
|
325
|
+
...(rangeKey ? { rangeKey } : {}),
|
|
326
|
+
...(dated && startDate ? { startDate } : {}),
|
|
327
|
+
...(dated && endDate ? { endDate } : {}),
|
|
328
|
+
}),
|
|
329
|
+
}).catch((error: unknown) => {
|
|
330
|
+
// A service that does not take a window in a batch may refuse it as asked rather than answer its latest bars.
|
|
331
|
+
if (dated && error instanceof ApiRequestError && (error.status === 400 || error.status === 422)) throw new ApiRequestError(WINDOWLESS_BATCH, 404);
|
|
332
|
+
throw error;
|
|
333
|
+
});
|
|
334
|
+
const items = response.data?.items;
|
|
335
|
+
// An answer that does not line up with the targets asked is not matched by place: each read is asked on its own.
|
|
336
|
+
if (!Array.isArray(items) || items.length !== targets.length) return keys.map(() => undefined);
|
|
337
|
+
if (dated && items.some((item) => !withinWindow(item.data, startDate, endDate))) throw new ApiRequestError(WINDOWLESS_BATCH, 404);
|
|
338
|
+
const byTarget = new Map(targets.map((target, index) => [targetKey(target), items[index]]));
|
|
339
|
+
return keys.map((key) => byTarget.get(targetKey(key)));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* A batch over a window, once a windowed batch has been answered; before
|
|
344
|
+
* that, the first batch's first read goes out alone as the probe and every
|
|
345
|
+
* batch waits on it. A probe answered with bars outside its window, or
|
|
346
|
+
* refused, fails them all as the missing route; one answered with bars in it
|
|
347
|
+
* lets them go, and its own read is not asked again.
|
|
348
|
+
*/
|
|
349
|
+
private async windowedBatch(
|
|
350
|
+
keys: Array<{ symbol: string; exchange: string; params: Pick<CloudHistoryParams, "interval" | "outputsize" | "rangeKey" | "startDate" | "endDate"> }>,
|
|
351
|
+
): Promise<Array<CloudMarketResponse<CloudPricePointPayload[]> | undefined>> {
|
|
352
|
+
if (this.windowsAnswered) return this.historyBatch(keys, true);
|
|
353
|
+
const probing = !this.windowProbe;
|
|
354
|
+
const probe = this.windowProbe ??= this.historyBatch(keys.slice(0, 1), true).then(([item]) => {
|
|
355
|
+
// An empty answer shows no window either way: the batches that follow are checked as they come.
|
|
356
|
+
if (Array.isArray(item?.data) && item.data.length > 0) this.windowsAnswered = true;
|
|
357
|
+
return item;
|
|
358
|
+
});
|
|
359
|
+
let probed: CloudMarketResponse<CloudPricePointPayload[]> | undefined;
|
|
360
|
+
try {
|
|
361
|
+
probed = await probe;
|
|
362
|
+
} catch (error) {
|
|
363
|
+
// Asked again once the route is, after the missing route's wait.
|
|
364
|
+
if (this.windowProbe === probe) this.windowProbe = null;
|
|
365
|
+
throw error;
|
|
366
|
+
}
|
|
367
|
+
if (!probing) return this.historyBatch(keys, true);
|
|
368
|
+
const rest = keys.length > 1 ? await this.historyBatch(keys.slice(1), true) : [];
|
|
369
|
+
return [probed, ...rest];
|
|
370
|
+
}
|
|
282
371
|
|
|
283
372
|
/**
|
|
284
373
|
* Futures terms asked with others in the same moment (a futures board's rows) go out as
|
|
@@ -676,12 +765,27 @@ export class CloudDataApi {
|
|
|
676
765
|
symbol: string,
|
|
677
766
|
exchange: string,
|
|
678
767
|
params: CloudHistoryParams = {},
|
|
679
|
-
options: {
|
|
768
|
+
options: {
|
|
769
|
+
signal?: AbortSignal;
|
|
770
|
+
/**
|
|
771
|
+
* With `batch`, the dates are the window every read asked with this one
|
|
772
|
+
* shares (a portfolio's holdings over the risk model's months), so they
|
|
773
|
+
* go out together over it.
|
|
774
|
+
*/
|
|
775
|
+
sharedWindow?: boolean;
|
|
776
|
+
} & BatchableRead = {},
|
|
680
777
|
): Promise<CloudMarketResponse<CloudPricePointPayload[]>> {
|
|
681
|
-
|
|
682
|
-
|
|
778
|
+
const dated = Boolean(params.startDate || params.endDate);
|
|
779
|
+
// Trailing bars asked with others, or bars over a window shared with them, not a session or recovery of their own,
|
|
780
|
+
// may go out with the others asked in the same moment. A read over a shared window keeps its signal: the batch it
|
|
781
|
+
// went out in is others' too and runs on, but the read stops waiting for it.
|
|
782
|
+
const shared = options.batch && !params.historyRecovery && !params.session && (dated ? options.sharedWindow : !options.signal);
|
|
683
783
|
return this.readListing(() => shared
|
|
684
|
-
?
|
|
784
|
+
? abortable((dated ? this.datedHistories : this.histories).read({
|
|
785
|
+
symbol,
|
|
786
|
+
exchange,
|
|
787
|
+
params: { interval: params.interval, outputsize: params.outputsize, rangeKey: params.rangeKey, startDate: params.startDate, endDate: params.endDate },
|
|
788
|
+
}), options.signal, "History read aborted")
|
|
685
789
|
: this.request<CloudMarketResponse<CloudPricePointPayload[]>>(
|
|
686
790
|
cloudHistoryPath(symbol, exchange, params),
|
|
687
791
|
options.signal ? { signal: options.signal } : undefined,
|
|
@@ -1089,6 +1193,11 @@ export class CloudDataApi {
|
|
|
1089
1193
|
return this.request<CentralBankRatesPayload>("/cloud/econ/central-bank-rates", { signal: AbortSignal.timeout(45_000) });
|
|
1090
1194
|
}
|
|
1091
1195
|
|
|
1196
|
+
/** Japan's foreign exchange interventions as its Ministry of Finance publishes them. */
|
|
1197
|
+
async getCloudFxInterventions(signal?: AbortSignal): Promise<FxInterventionsPayload> {
|
|
1198
|
+
return this.request<FxInterventionsPayload>("/cloud/econ/fx-interventions", { signal: signalWithTimeout(signal, 20_000) });
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1092
1201
|
/** A live scan's matches against Gloom Cloud's newest market-wide snapshot for this account's tier. */
|
|
1093
1202
|
getLiveScan(definition: LiveScanWireDefinition, signal?: AbortSignal) {
|
|
1094
1203
|
return this.request<LiveScanPayload>(LIVE_SCAN_PATH, {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** One day Japan's Ministry of Finance intervened, in one pair, as its quarterly release lists it. */
|
|
2
|
+
export interface FxInterventionDay {
|
|
3
|
+
/** The day, in Tokyo. */
|
|
4
|
+
date: string;
|
|
5
|
+
/** The day's total in yen; an operation in a pair without the yen is converted at the Bank of Japan's central rate. */
|
|
6
|
+
amountJpy: number;
|
|
7
|
+
/** The currency sold and the one bought (ISO codes); null for one the server does not list. */
|
|
8
|
+
sold: string | null;
|
|
9
|
+
bought: string | null;
|
|
10
|
+
/** The pair as the ministry writes it: "the US dollar (sold) the Japanese yen (bought)". */
|
|
11
|
+
pair: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Operations in one pair and direction, each at most four calendar days after the last, summed: one intervention, counted once. */
|
|
15
|
+
export interface FxInterventionRun {
|
|
16
|
+
from: string;
|
|
17
|
+
to: string;
|
|
18
|
+
/** Days with an operation. */
|
|
19
|
+
days: number;
|
|
20
|
+
amountJpy: number;
|
|
21
|
+
sold: string | null;
|
|
22
|
+
bought: string | null;
|
|
23
|
+
pair: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** One monthly release: the total for its period, which names no day and no pair until its quarter is released. */
|
|
27
|
+
export interface FxInterventionMonth {
|
|
28
|
+
from: string;
|
|
29
|
+
to: string;
|
|
30
|
+
amountJpy: number;
|
|
31
|
+
/** The day the ministry published it. */
|
|
32
|
+
releasedOn: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
/** How far the daily record reaches into the period. */
|
|
35
|
+
daysKnown: "all" | "partial" | "none";
|
|
36
|
+
/** The part of its total no served day accounts for yet: what is not dated, counted once. */
|
|
37
|
+
undatedAmountJpy: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** One quarter's total. */
|
|
41
|
+
interface FxInterventionQuarter {
|
|
42
|
+
from: string;
|
|
43
|
+
to: string;
|
|
44
|
+
amountJpy: number;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** `GET /cloud/econ/fx-interventions`: Japan's interventions as the Ministry of Finance publishes them. */
|
|
48
|
+
export interface FxInterventionsPayload {
|
|
49
|
+
authority: string;
|
|
50
|
+
status: "available" | "unavailable";
|
|
51
|
+
/** Each operation, oldest first. */
|
|
52
|
+
days: FxInterventionDay[];
|
|
53
|
+
/** The operations as interventions, oldest first. */
|
|
54
|
+
interventions: FxInterventionRun[];
|
|
55
|
+
/** The last day `days` covers; a monthly total after it names no day yet. */
|
|
56
|
+
dailyThrough: string | null;
|
|
57
|
+
/** Every monthly release read, oldest first. */
|
|
58
|
+
months: FxInterventionMonth[];
|
|
59
|
+
/** Quarterly totals, oldest first. */
|
|
60
|
+
quarters: FxInterventionQuarter[];
|
|
61
|
+
fetchedAt: string | null;
|
|
62
|
+
sourceUrl: string;
|
|
63
|
+
notes: string[];
|
|
64
|
+
}
|
package/src/api-client/index.ts
CHANGED
|
@@ -976,6 +976,7 @@ class GloomApiClient {
|
|
|
976
976
|
getCloudDefiTvl = this.data.getCloudDefiTvl.bind(this.data);
|
|
977
977
|
getCloudBitcoinNetwork = this.data.getCloudBitcoinNetwork.bind(this.data);
|
|
978
978
|
getCloudCentralBankRates = this.data.getCloudCentralBankRates.bind(this.data);
|
|
979
|
+
getCloudFxInterventions = this.data.getCloudFxInterventions.bind(this.data);
|
|
979
980
|
getMobileAlertHistory = this.data.getMobileAlertHistory.bind(this.data);
|
|
980
981
|
getScannerFlowHistory = this.data.getScannerFlowHistory.bind(this.data);
|
|
981
982
|
getScannerFlowSession = this.data.getScannerFlowSession.bind(this.data);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CloudApiRequestTransport } from "./request";
|
|
2
|
+
|
|
3
|
+
// A public file needs no session credential. A separate transport, as the
|
|
4
|
+
// public wall summary has, still follows the installed desktop/web bridge.
|
|
5
|
+
const publicTransport = new CloudApiRequestTransport();
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The repository's CHANGELOG.md as Gloom Cloud serves it (GET
|
|
9
|
+
* /public/releases/summaries): read there with the service's own GitHub
|
|
10
|
+
* credentials and cached, so the Changelog does not spend the anonymous
|
|
11
|
+
* GitHub limit of the address the app runs on. Null when the repository has
|
|
12
|
+
* no such file. Throws when the service cannot say (a service without the
|
|
13
|
+
* route, or GitHub down with nothing kept), so the caller asks GitHub itself.
|
|
14
|
+
*/
|
|
15
|
+
export async function getReleaseSummaries(signal?: AbortSignal): Promise<string | null> {
|
|
16
|
+
const body = await publicTransport.request<unknown>("/public/releases/summaries", { signal });
|
|
17
|
+
const markdown = typeof body === "object" && body !== null ? (body as { markdown?: unknown }).markdown : undefined;
|
|
18
|
+
if (markdown === null) return null;
|
|
19
|
+
if (typeof markdown !== "string") throw new Error("Gloom Cloud returned no release summaries");
|
|
20
|
+
return markdown;
|
|
21
|
+
}
|
|
@@ -47,6 +47,12 @@ export interface CloudShortRate {
|
|
|
47
47
|
tenorDays: number;
|
|
48
48
|
/** Days in the year the rate is quoted over. */
|
|
49
49
|
dayCountBasis: 360 | 365;
|
|
50
|
+
/**
|
|
51
|
+
* "business-252": compounded over 252 business days a year (Brazil's CDI),
|
|
52
|
+
* grown as (1 + r)^(days / 365), business days taken as 252/365 of the
|
|
53
|
+
* calendar days. Absent: simple interest on `dayCountBasis`.
|
|
54
|
+
*/
|
|
55
|
+
compounding?: "business-252" | null;
|
|
50
56
|
publisher: string;
|
|
51
57
|
sourceUrl: string;
|
|
52
58
|
/** Percent a year; null when it could not be read. */
|
|
@@ -82,7 +88,13 @@ export interface CloudMacroReleaseDaysPayload {
|
|
|
82
88
|
prior: string | null;
|
|
83
89
|
/** Above the consensus (hot), below it (cool), at it (in-line); null without both. */
|
|
84
90
|
surprise: "hot" | "cool" | "in-line" | null;
|
|
91
|
+
/** An FOMC day's move in the target range: "held", "cut 25bp", "raised 50bp". */
|
|
92
|
+
decision?: string;
|
|
85
93
|
}>>>;
|
|
94
|
+
/** The first New York day the kept economic calendar covers: US days before it have no figures. */
|
|
95
|
+
figuresFrom?: string;
|
|
96
|
+
/** Why a US release day from `figuresFrom` on has no figures, by kind and day. */
|
|
97
|
+
figureGaps?: Partial<Record<"cpi" | "jobs" | "fomc", Record<string, string>>>;
|
|
86
98
|
}
|
|
87
99
|
|
|
88
100
|
export interface CloudFredObservationPayload {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Government bond curves stored from their official publishers, in percent. */
|
|
2
|
-
export type CloudCurveId = "us" | "us-real" | "us-breakeven" | "eu-aaa" | "de" | "gb" | "jp" | "ca";
|
|
2
|
+
export type CloudCurveId = "us" | "us-real" | "us-breakeven" | "eu-aaa" | "de" | "gb" | "jp" | "ca" | "mx" | "br";
|
|
3
3
|
|
|
4
4
|
export interface CloudCurvePoint {
|
|
5
5
|
tenor: string;
|
|
@@ -284,7 +284,10 @@ export function useAppGlobalShortcuts({
|
|
|
284
284
|
if (ranAlready(action)) return;
|
|
285
285
|
event.preventDefault();
|
|
286
286
|
event.stopPropagation();
|
|
287
|
-
|
|
287
|
+
// The key that opened Help closes it again while it has focus.
|
|
288
|
+
const focused = state.focusedPaneId ? findPaneInstance(state.config.layout, state.focusedPaneId) : undefined;
|
|
289
|
+
if (focused?.paneId === "help") pluginRegistry.hidePane("help");
|
|
290
|
+
else pluginRegistry.showPane("help");
|
|
288
291
|
return;
|
|
289
292
|
}
|
|
290
293
|
|
|
@@ -44,6 +44,8 @@ export interface KeybindingActionDef {
|
|
|
44
44
|
/** Help text. Kept in English here; the help pane translates it. */
|
|
45
45
|
description: string;
|
|
46
46
|
defaults: readonly string[];
|
|
47
|
+
/** Default chords the terminal adds after `defaults`, for keys only a terminal needs. */
|
|
48
|
+
terminalDefaults?: readonly string[];
|
|
47
49
|
/** Only the desktop app has this action; the terminal hides the row. */
|
|
48
50
|
desktopOnly?: boolean;
|
|
49
51
|
/** Only the terminal has this action; the desktop app hides the row. */
|
|
@@ -109,6 +111,10 @@ export const KEYBINDING_ACTIONS: readonly KeybindingActionDef[] = [
|
|
|
109
111
|
category: "Global Keys",
|
|
110
112
|
description: "Switch saved layouts by number.",
|
|
111
113
|
defaults: ["CmdOrCtrl+Digit"],
|
|
114
|
+
// A terminal without the kitty protocol never sends Control with a digit
|
|
115
|
+
// (Ctrl+1 arrives as 1, Ctrl+3 as Esc), but it sends Alt+1. A browser
|
|
116
|
+
// keeps Alt+1 for its own tabs, and a Mac types ¡ with it.
|
|
117
|
+
terminalDefaults: ["Alt+Digit"],
|
|
112
118
|
},
|
|
113
119
|
{
|
|
114
120
|
id: "focus-next-pane",
|
|
@@ -173,7 +179,7 @@ export const KEYBINDING_ACTIONS: readonly KeybindingActionDef[] = [
|
|
|
173
179
|
{
|
|
174
180
|
id: "pane-close",
|
|
175
181
|
category: "Pane Management",
|
|
176
|
-
description: "Close the focused pane,
|
|
182
|
+
description: "Close the focused pane, in the layout or floating. Locked panes stay open.",
|
|
177
183
|
defaults: ["CmdOrCtrl+W"],
|
|
178
184
|
},
|
|
179
185
|
{
|
|
@@ -205,7 +211,7 @@ export const KEYBINDING_ACTIONS: readonly KeybindingActionDef[] = [
|
|
|
205
211
|
{
|
|
206
212
|
id: "pane-float",
|
|
207
213
|
category: "Pane Management",
|
|
208
|
-
description: "
|
|
214
|
+
description: "Float the focused pane, or return it to the layout.",
|
|
209
215
|
defaults: ["CmdOrCtrl+Shift+D"],
|
|
210
216
|
},
|
|
211
217
|
{
|
|
@@ -19,7 +19,8 @@ export function updateKeybindingsConfig(config: AppConfig, keybindings: Keybindi
|
|
|
19
19
|
function defaultChordsFor(actionId: string, defaults?: readonly KeyChord[]): readonly KeyChord[] {
|
|
20
20
|
if (defaults) return defaults;
|
|
21
21
|
const def = getKeybindingAction(actionId);
|
|
22
|
-
|
|
22
|
+
// Every host's defaults, as the table with no host has them.
|
|
23
|
+
return def ? [...def.defaults, ...def.terminalDefaults ?? []].map((text) => parseKeyChord(text)!).filter(Boolean) : [];
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
function sameChords(left: readonly KeyChord[], right: readonly KeyChord[]): boolean {
|
|
@@ -37,6 +37,7 @@ export {
|
|
|
37
37
|
takenChordMessage,
|
|
38
38
|
} from "./labels";
|
|
39
39
|
export { KeybindingsProvider, getDefaultKeybindings, useKeybindings, useResolvedKeybindings } from "./react";
|
|
40
|
+
export { useTerminalReportsControlKeys } from "./terminal-keys";
|
|
40
41
|
export {
|
|
41
42
|
applyActionBinding,
|
|
42
43
|
removeCommandBinding,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type PrimaryModifier,
|
|
15
15
|
} from "./chord";
|
|
16
16
|
import type { ResolvedKeybindingAction, ResolvedKeybindings } from "./resolve";
|
|
17
|
+
import { legacyTerminalSends } from "./terminal-keys";
|
|
17
18
|
|
|
18
19
|
/** What `CmdOrCtrl` is on this host: Control in a terminal, Command on a Mac desktop. */
|
|
19
20
|
export function primaryModifierFor(
|
|
@@ -103,10 +104,14 @@ export function advertisedChord(
|
|
|
103
104
|
resolved: ResolvedKeybindings,
|
|
104
105
|
actionId: string,
|
|
105
106
|
mode: ShortcutDisplayMode,
|
|
107
|
+
{ legacyTerminal = false }: {
|
|
108
|
+
/** The terminal answered without the kitty protocol: a chord it can send goes first (Alt+1 over Ctrl+1). */
|
|
109
|
+
legacyTerminal?: boolean;
|
|
110
|
+
} = {},
|
|
106
111
|
): KeyChord | null {
|
|
107
112
|
const chords = chordsForHost(resolved.actionsById.get(actionId)?.chords ?? [], mode);
|
|
108
113
|
if (chords.length === 0) return null;
|
|
109
|
-
if (mode === "terminal") return chords[0]!;
|
|
114
|
+
if (mode === "terminal") return (legacyTerminal ? chords.find(legacyTerminalSends) : undefined) ?? chords[0]!;
|
|
110
115
|
return chords.find((chord) => chord.primary || chord.cmd) ?? chords[0]!;
|
|
111
116
|
}
|
|
112
117
|
|