@gloom-sh/terminal 0.20.17 → 0.20.18
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/data.ts +3 -2
- package/src/api-client/heard-from.ts +72 -0
- package/src/api-client/index.ts +63 -6
- package/src/api-client/mna.ts +18 -0
- package/src/api-client/supply-chain.ts +9 -0
- package/src/api-client/types/billing.ts +35 -1
- 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 +33 -2
- package/src/architecture/core-builtin-allowlist.json +1 -1
- package/src/architecture/floating-promise-allowlist.json +0 -1
- package/src/architecture/shortcut-labels-allowlist.json +1 -0
- package/src/cli/alert-listing.ts +98 -0
- package/src/cli/commands/market.ts +138 -22
- 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/context.ts +16 -5
- package/src/cli/csv-export.ts +2 -1
- package/src/cli/desktop-pane-shot.ts +72 -9
- package/src/cli/glossary.ts +64 -10
- package/src/cli/history-demergers.ts +117 -0
- package/src/cli/history-rows.ts +6 -2
- package/src/cli/index.ts +1 -0
- package/src/cli/known-gaps.ts +16 -0
- package/src/cli/known-us-stocks.ts +18 -0
- package/src/cli/listing-arg.ts +105 -15
- package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
- package/src/cli/pane-functions/catalog-snapshot.json +866 -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 +24 -6
- package/src/cli/pane-functions/freshness.ts +17 -1
- package/src/cli/pane-functions/index.ts +100 -42
- package/src/cli/pane-functions/resolver.ts +8 -5
- package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
- package/src/cli/pane-functions/screenshot-payload.ts +21 -0
- package/src/cli/pane-functions/screenshot-render.ts +3 -1
- package/src/cli/quote-answer.ts +32 -16
- package/src/cli/registry.ts +22 -2
- package/src/cli/result.ts +5 -4
- package/src/cli/series-search.ts +45 -6
- package/src/cli/shot-temp-dir.ts +4 -9
- package/src/components/chart/composite/legend.tsx +43 -18
- package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
- package/src/components/chart/composite/price-axis-labels.tsx +7 -5
- package/src/components/chart-table/header.tsx +9 -0
- package/src/components/chart-table/layout.ts +11 -11
- 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 +8 -1
- package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
- package/src/components/command-bar/workflow/alert.ts +19 -8
- 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 +113 -15
- package/src/components/layout/pane/header.tsx +16 -2
- 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/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/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 +2 -1
- 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 +103 -0
- package/src/market-data/depositary-pair.ts +6 -2
- package/src/market-data/hooks.tsx +33 -2
- package/src/market-data/market/change-basis.ts +2 -1
- package/src/market-data/market/header-market.ts +11 -0
- package/src/market-data/split-terms.ts +28 -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 +36 -30
- package/src/plugins/builtin/alerts/constants.ts +10 -0
- package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
- package/src/plugins/builtin/alerts/format.ts +24 -8
- package/src/plugins/builtin/alerts/index.tsx +38 -9
- package/src/plugins/builtin/alerts/move-checks.ts +7 -0
- package/src/plugins/builtin/alerts/pane.tsx +1 -1
- package/src/plugins/builtin/alerts/quotes.ts +26 -2
- package/src/plugins/builtin/alerts/scheduled.ts +6 -1
- package/src/plugins/builtin/alerts/types.ts +7 -0
- package/src/plugins/builtin/analytics/manual-value.ts +61 -0
- package/src/plugins/builtin/analytics/risk-book.ts +7 -7
- package/src/plugins/builtin/analytics/risk-client.ts +26 -13
- 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/central-bank-rates/model.ts +8 -2
- package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
- package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
- package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
- package/src/plugins/builtin/chart-composer/pane.tsx +5 -2
- 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/company-kpis/headless.ts +9 -4
- package/src/plugins/builtin/company-kpis/latest.ts +45 -0
- package/src/plugins/builtin/company-kpis/model.ts +38 -8
- 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/correlation/index.tsx +13 -17
- package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
- 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/earnings/fiscal-quarter.ts +39 -0
- package/src/plugins/builtin/earnings/headless.ts +7 -4
- package/src/plugins/builtin/earnings/history-model.ts +6 -4
- package/src/plugins/builtin/earnings/history-table.ts +4 -3
- package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
- package/src/plugins/builtin/econ/calendar-model.ts +16 -0
- package/src/plugins/builtin/econ/index.tsx +3 -0
- 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/fx-matrix/amount.ts +15 -1
- package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
- package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
- package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
- 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/footer.ts +3 -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/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/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/relative-rotation/pane.tsx +2 -3
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
- package/src/plugins/builtin/research/event-model.ts +31 -13
- package/src/plugins/builtin/research/headless.ts +8 -1
- package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
- package/src/plugins/builtin/sectors/index.tsx +6 -9
- package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +19 -4
- package/src/plugins/builtin/shared/report-freshness.ts +2 -3
- 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 +76 -16
- 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/overview/model.ts +17 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
- 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 +13 -4
- 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 +28 -16
- 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/pane.tsx +35 -6
- package/src/plugins/builtin/world-venue-map/place.ts +119 -0
- 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/desktop/window-layouts.ts +14 -0
- 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/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 +14 -3
- package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
- package/src/sources/provider-router/financials.ts +20 -13
- 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/resolve.ts +3 -1
- package/src/time-series/spec.ts +2 -2
- package/src/time-series/types.ts +1 -1
- package/src/types/data-provider.ts +11 -0
- package/src/types/financials.ts +39 -3
- package/src/types/ticker.ts +10 -2
- 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/forward-dividend.ts +4 -3
- 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
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { useEffect, type Dispatch } from "react";
|
|
2
|
+
import { watchExternalConfigChanges } from "../../data/config/store";
|
|
3
|
+
import { serializeJson } from "../../data/sqlite/json";
|
|
4
|
+
import { hasPendingTickerWrite, hasPendingTickerWrites } from "../../data/ticker-writes";
|
|
5
|
+
import type { AppTickerRepositoryPort } from "../../core/app-service-ports";
|
|
6
|
+
import type { PluginRegistry } from "../../plugins/registry";
|
|
7
|
+
import type { AppAction, AppState } from "../../state/app/context";
|
|
8
|
+
import type { TickerRecord } from "../../types/ticker";
|
|
9
|
+
import { logFailure } from "../../utils/log-failure";
|
|
10
|
+
|
|
11
|
+
/** How often the ticker rows are looked at for another program's write: a cheap question to SQLite. */
|
|
12
|
+
const TICKER_ROWS_LOOK_MS = 2_000;
|
|
13
|
+
|
|
14
|
+
type TickerRowsPort = AppTickerRepositoryPort & {
|
|
15
|
+
/**
|
|
16
|
+
* Changes when another program commits to the database; absent where no
|
|
17
|
+
* one can say. The desktop app's windows ask the process that holds it.
|
|
18
|
+
*/
|
|
19
|
+
changesElsewhere?(): number | null | Promise<number | null>;
|
|
20
|
+
/**
|
|
21
|
+
* The rows the repository held a copy of that a read found deleted by
|
|
22
|
+
* another program (`TickerRepository.takeRowsDeletedElsewhere`), whoever
|
|
23
|
+
* wrote them last: rows the app added itself since its last look included.
|
|
24
|
+
*/
|
|
25
|
+
takeRowsDeletedElsewhere?(): string[] | Promise<string[]>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Takes in what a `gloom` command run beside the app writes to the profile:
|
|
30
|
+
* config.json (alerts, settings, watchlists and portfolios, layouts) as soon
|
|
31
|
+
* as the file changes, and ticker rows (watchlist members, positions) within
|
|
32
|
+
* a couple of seconds. The app shows them, an alert added from the terminal
|
|
33
|
+
* is checked, and no later save of the app's own copy writes over them.
|
|
34
|
+
*/
|
|
35
|
+
export function useExternalProfileChanges({
|
|
36
|
+
enabled,
|
|
37
|
+
dataDir,
|
|
38
|
+
dispatch,
|
|
39
|
+
stateRef,
|
|
40
|
+
pluginRegistry,
|
|
41
|
+
tickerRepository,
|
|
42
|
+
lookEveryMs = TICKER_ROWS_LOOK_MS,
|
|
43
|
+
}: {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
dataDir: string;
|
|
46
|
+
dispatch: Dispatch<AppAction>;
|
|
47
|
+
stateRef: { current: AppState };
|
|
48
|
+
pluginRegistry: Pick<PluginRegistry, "events">;
|
|
49
|
+
tickerRepository: TickerRowsPort;
|
|
50
|
+
/** How often the ticker rows are looked at; tests look sooner. */
|
|
51
|
+
lookEveryMs?: number;
|
|
52
|
+
}): void {
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (!enabled) return;
|
|
55
|
+
return watchExternalConfigChanges(dataDir, (change) => {
|
|
56
|
+
const current = stateRef.current.config;
|
|
57
|
+
const next = change.apply(current);
|
|
58
|
+
if (next === current) return;
|
|
59
|
+
dispatch({ type: "SET_CONFIG", config: next });
|
|
60
|
+
pluginRegistry.events.emit("config:changed", { config: next });
|
|
61
|
+
});
|
|
62
|
+
}, [dataDir, dispatch, enabled, pluginRegistry, stateRef]);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const changesElsewhere = tickerRepository.changesElsewhere?.bind(tickerRepository);
|
|
66
|
+
const takeDeleted = tickerRepository.takeRowsDeletedElsewhere?.bind(tickerRepository);
|
|
67
|
+
if (!enabled || !changesElsewhere) return;
|
|
68
|
+
let stopped = false;
|
|
69
|
+
// The database's version and its rows as last read. Without the repository's own account of the rows deleted
|
|
70
|
+
// elsewhere, a row gone from the last read's is one; the app's own commits move no version, so that misses a
|
|
71
|
+
// row the app added since.
|
|
72
|
+
let taken: number | null = null;
|
|
73
|
+
let stored: Set<string> | null = null;
|
|
74
|
+
let reading = false;
|
|
75
|
+
const look = async () => {
|
|
76
|
+
reading = true;
|
|
77
|
+
try {
|
|
78
|
+
const version = await changesElsewhere();
|
|
79
|
+
// The app's own writes still on their way would read as someone else's: wait for them.
|
|
80
|
+
if (stopped || version === null || (stored && version === taken) || hasPendingTickerWrites(tickerRepository)) return;
|
|
81
|
+
const rows = await tickerRepository.loadAllTickers();
|
|
82
|
+
const present = new Set(rows.map((row) => row.metadata.ticker));
|
|
83
|
+
const deleted = takeDeleted ? await takeDeleted() : [...stored ?? []].filter((symbol) => !present.has(symbol));
|
|
84
|
+
if (stopped) return;
|
|
85
|
+
// The first look is the rows as the app starts with them; only rows deleted since are taken in then.
|
|
86
|
+
takeStoredTickerRows(stored ? rows : [], deleted, tickerRepository, stateRef, dispatch);
|
|
87
|
+
stored = present;
|
|
88
|
+
taken = version;
|
|
89
|
+
} finally {
|
|
90
|
+
reading = false;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const lookNow = () => {
|
|
94
|
+
if (!reading) look().catch(logFailure("app.external-profile-changes", "Reading ticker rows another program wrote failed"));
|
|
95
|
+
};
|
|
96
|
+
lookNow();
|
|
97
|
+
const timer = setInterval(lookNow, lookEveryMs);
|
|
98
|
+
(timer as { unref?: () => void }).unref?.();
|
|
99
|
+
return () => {
|
|
100
|
+
stopped = true;
|
|
101
|
+
clearInterval(timer);
|
|
102
|
+
};
|
|
103
|
+
}, [dispatch, enabled, lookEveryMs, stateRef, tickerRepository]);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Replaces the app's copy of each row the database holds differently, and
|
|
108
|
+
* drops each row another program deleted (`deleted`), so no later save of
|
|
109
|
+
* the app's copy brings it back. Rows only the app holds stay, and so does
|
|
110
|
+
* one the app is saving: its save folds the other program's change in.
|
|
111
|
+
*/
|
|
112
|
+
function takeStoredTickerRows(
|
|
113
|
+
rows: readonly TickerRecord[],
|
|
114
|
+
deleted: readonly string[],
|
|
115
|
+
tickerRepository: AppTickerRepositoryPort,
|
|
116
|
+
stateRef: { current: AppState },
|
|
117
|
+
dispatch: Dispatch<AppAction>,
|
|
118
|
+
): void {
|
|
119
|
+
const current = stateRef.current.tickers;
|
|
120
|
+
let next: Map<string, TickerRecord> | null = null;
|
|
121
|
+
for (const row of rows) {
|
|
122
|
+
const symbol = row.metadata.ticker;
|
|
123
|
+
if (hasPendingTickerWrite(tickerRepository, symbol)) continue;
|
|
124
|
+
const held = current.get(symbol);
|
|
125
|
+
if (held && serializeJson(held.metadata) === serializeJson(row.metadata)) continue;
|
|
126
|
+
next ??= new Map(current);
|
|
127
|
+
next.set(symbol, row);
|
|
128
|
+
}
|
|
129
|
+
for (const symbol of deleted) {
|
|
130
|
+
if (!current.has(symbol)) continue;
|
|
131
|
+
next ??= new Map(current);
|
|
132
|
+
next.delete(symbol);
|
|
133
|
+
}
|
|
134
|
+
if (next) dispatch({ type: "SET_TICKERS", tickers: next });
|
|
135
|
+
}
|
package/src/app.tsx
CHANGED
|
@@ -20,6 +20,8 @@ import { DetachedPaneShell } from "./components/layout/detached-pane-shell";
|
|
|
20
20
|
import { TransientLayoutProvider } from "./components/layout/transient-layout";
|
|
21
21
|
import { CommandBar } from "./components/command-bar/surface";
|
|
22
22
|
import { OnboardingWizard } from "./components/onboarding/onboarding-wizard";
|
|
23
|
+
import { getOnboardingProgress } from "./components/onboarding/wizard-model";
|
|
24
|
+
import { HeardFromQuestionHost } from "./account/heard-from-question";
|
|
23
25
|
import { useRunSetupAgain } from "./components/onboarding/run-setup-again";
|
|
24
26
|
import { CompanyPickerHost } from "./plugins/builtin/cloud/company-picker";
|
|
25
27
|
import { TerminalRelayHost } from "./plugins/builtin/cloud/terminal-relay/host";
|
|
@@ -50,6 +52,7 @@ import { AppDialogBridge } from "./app/dialog-bridge";
|
|
|
50
52
|
import { KeybindingsProvider, useResolvedKeybindings } from "./app/keybindings";
|
|
51
53
|
import { useAppPaneRuntime } from "./app/pane-runtime";
|
|
52
54
|
import { bindPluginRegistryRuntimeAccess } from "./app/runtime/plugin-bindings";
|
|
55
|
+
import { useExternalProfileChanges } from "./app/runtime/external-profile-changes";
|
|
53
56
|
import { useAppStartupRuntime } from "./app/runtime/startup";
|
|
54
57
|
import { useTickerRefreshRuntime } from "./app/runtime/ticker-refresh";
|
|
55
58
|
import { useAppUpdateRuntime } from "./app/runtime/update";
|
|
@@ -79,6 +82,8 @@ import { reportTelemetryConfig } from "./telemetry/live-config";
|
|
|
79
82
|
import { AttentionCountsNotice } from "./app/attention-notice";
|
|
80
83
|
import { useSinceLastVisit } from "./app/since-last-visit/use-since-last-visit";
|
|
81
84
|
import { SinceLastVisitStrip } from "./app/since-last-visit/strip";
|
|
85
|
+
import { useProWelcome } from "./app/pro-welcome/use-pro-welcome";
|
|
86
|
+
import { ProWelcomeRow } from "./app/pro-welcome/row";
|
|
82
87
|
import { recordFunctionOpen } from "./telemetry/usage-counts";
|
|
83
88
|
import { logFailure } from "./utils/log-failure";
|
|
84
89
|
|
|
@@ -228,6 +233,10 @@ function AppInner({
|
|
|
228
233
|
const appWideWorkElsewhere = isDetachedWindow || desktopWindowBridge?.primary === false;
|
|
229
234
|
// Not while setup is already showing.
|
|
230
235
|
const runSetupAgain = useRunSetupAgain(onboardingActive ? undefined : onRunSetupAgain);
|
|
236
|
+
// A setup card holds the keyboard over the whole window; the workspace coach
|
|
237
|
+
// after the cards floats over a live workspace, whose "Ctrl+P adds more"
|
|
238
|
+
// needs the command bar's prompt (and Help) where they always are.
|
|
239
|
+
const setupCardShown = onboardingActive && getOnboardingProgress(config).stage !== "research";
|
|
231
240
|
const detachedPaneId = isDetachedWindow ? desktopWindowBridge.paneId ?? null : null;
|
|
232
241
|
const focusDetachedPane = useMemo(() => {
|
|
233
242
|
const focus = desktopWindowBridge?.kind === "main" ? desktopWindowBridge.focusDetachedPane : undefined;
|
|
@@ -423,6 +432,16 @@ function AppInner({
|
|
|
423
432
|
scheduleConfigSave(nextConfig);
|
|
424
433
|
}, []);
|
|
425
434
|
useTeamCollectionsSync({ persistConfig, tickerRepository });
|
|
435
|
+
// A `gloom` command run beside the app writes the same profile: take its
|
|
436
|
+
// changes in, so none is written over. A popped-out window leaves that to the main one.
|
|
437
|
+
useExternalProfileChanges({
|
|
438
|
+
enabled: !appWideWorkElsewhere,
|
|
439
|
+
dataDir: config.dataDir,
|
|
440
|
+
dispatch,
|
|
441
|
+
stateRef,
|
|
442
|
+
pluginRegistry,
|
|
443
|
+
tickerRepository,
|
|
444
|
+
});
|
|
426
445
|
|
|
427
446
|
useAppPaneRuntime({
|
|
428
447
|
dataProvider,
|
|
@@ -498,6 +517,15 @@ function AppInner({
|
|
|
498
517
|
notify: notifyRequest,
|
|
499
518
|
});
|
|
500
519
|
const showSinceLastVisit = !!sinceLastVisit.recap && state.config.presentationMode !== true;
|
|
520
|
+
// A new Pro payer's first two weeks: Pro functions they have not opened, on
|
|
521
|
+
// their own tickers. Its own row under the strip, never part of it.
|
|
522
|
+
const proWelcome = useProWelcome({
|
|
523
|
+
active: !appWideWorkElsewhere && !onboardingActive && !signInGateActive,
|
|
524
|
+
pluginState: pluginRegistry.persistence.pluginState,
|
|
525
|
+
pluginRegistry,
|
|
526
|
+
pluginsReady,
|
|
527
|
+
});
|
|
528
|
+
const showProWelcome = !!proWelcome.chips && state.config.presentationMode !== true;
|
|
501
529
|
|
|
502
530
|
const chrome = useAppChromeShown();
|
|
503
531
|
const keybindingHost = useUiHost().kind === "opentui" ? "terminal" : "desktop";
|
|
@@ -553,7 +581,8 @@ function AppInner({
|
|
|
553
581
|
<ThemedAppRoot>
|
|
554
582
|
{chrome.header && (
|
|
555
583
|
<Header
|
|
556
|
-
|
|
584
|
+
commandInputAvailable={!setupCardShown}
|
|
585
|
+
onOpenHelp={setupCardShown ? undefined : () => {
|
|
557
586
|
recordFunctionOpen({ shortcut: "HELP", externalPluginId: null });
|
|
558
587
|
pluginRegistry.showPane("help");
|
|
559
588
|
}}
|
|
@@ -561,6 +590,7 @@ function AppInner({
|
|
|
561
590
|
/>
|
|
562
591
|
)}
|
|
563
592
|
{showSinceLastVisit ? <SinceLastVisitStrip strip={sinceLastVisit} /> : null}
|
|
593
|
+
{showProWelcome ? <ProWelcomeRow welcome={proWelcome} /> : null}
|
|
564
594
|
<TransientLayoutProvider>
|
|
565
595
|
<Shell
|
|
566
596
|
pluginRegistry={pluginRegistry}
|
|
@@ -569,12 +599,13 @@ function AppInner({
|
|
|
569
599
|
desktopWindowBridge={desktopWindowBridge}
|
|
570
600
|
desktopDockPreview={desktopDockPreview}
|
|
571
601
|
commandBarNativeOccluder={commandBarNativeOccluder}
|
|
572
|
-
topBandRows={showSinceLastVisit ? 1 : 0}
|
|
602
|
+
topBandRows={(showSinceLastVisit ? 1 : 0) + (showProWelcome ? 1 : 0)}
|
|
573
603
|
/>
|
|
574
604
|
<StatusBar />
|
|
575
605
|
</TransientLayoutProvider>
|
|
576
606
|
{!onboardingActive ? <CompanyPickerHost pluginRegistry={pluginRegistry} /> : null}
|
|
577
607
|
{initialized && !onboardingActive && !signInGateActive ? <AttentionCountsNotice notify={notifyRequest} /> : null}
|
|
608
|
+
{initialized && !onboardingActive && !signInGateActive ? <HeardFromQuestionHost /> : null}
|
|
578
609
|
<TerminalRelayHost device={remoteControlAdapter?.terminalDevice} />
|
|
579
610
|
{onboardingActive && onOnboardingComplete ? (
|
|
580
611
|
<OnboardingWizard
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"src/layout/desks.ts": ["chart-composer"],
|
|
30
30
|
"src/plugins/catalog-browser.ts": ["alerts","analytics","attention","awards","backtest","bond-calculator","catalysts","cds","central-bank-rates","changelog","chart-composer","clinical-trials","cloud","comment-letters","commodities-energy","commodity-balances","company-attention","company-kpis","connections","correlation","cot","cpi","credit-boards","credit-conditions","credit-documents","crypto-board","crypto-etf-flows","debt-maturities","dividend-yield","docs","doe","earnings","earnings-calls","earnings-ripple","econ","econ-statistics","equity-screener","estimate-revisions","executives","exposure","fear-greed","filing-events","fixed-income","futures","futures-curve","fx-matrix","gpu","help","holders","insider","ipo-calendar","iv-history","jobs","jodi","kelly-sizer","layout-manager","macro-day","market-halts","market-heatmap","market-valuation","members","mna","money-markets","news","openfda","options","options-calculator","options-positioning","options-scenario","pe-band","perps","portfolio-list","power","primary-dealers","rate-path","realized-vol","relative-rotation","research","research-search","revenue-breakdown","reverse-dcf","risk-factors","roadmap","scanner","seasonality","sec","sectors","short-interest","short-volume","social-mentions","supply-chain","thirteenf","ticker-detail","time-sales","trace-bonds","treasury-auctions","treasury-daily","vol-surface","volatility","world-indices","world-venue-map","yield-curve"],
|
|
31
31
|
"src/plugins/catalog-cli.ts": ["alerts","fear-greed","news","notes","portfolio-list"],
|
|
32
|
-
"src/plugins/catalog-ui.ts": ["alerts","clinical-trials","cloud","comment-letters","custom-view","fear-greed","ipo-calendar","market-halts","market-heatmap","members","news","notes","openfda","research-search"],
|
|
32
|
+
"src/plugins/catalog-ui.ts": ["alerts","clinical-trials","cloud","comment-letters","composite","custom-view","fear-greed","ipo-calendar","market-halts","market-heatmap","members","news","notes","openfda","research-search"],
|
|
33
33
|
"src/plugins/catalog.ts": ["debug"],
|
|
34
34
|
"src/remote/controller.ts": ["custom-view"],
|
|
35
35
|
"src/renderers/electrobun/bun/core-capabilities.ts": ["notes"],
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"src/components/ui/multi-select/dialog.tsx": ["void:toggleOption()"],
|
|
65
65
|
"src/components/ui/query-bar-keys.tsx": ["void:choose()","void:choose()","void:dialog.alert()"],
|
|
66
66
|
"src/components/use-external-link-footer.ts": ["void:rendererHost.openExternal()"],
|
|
67
|
-
"src/data/config/store/node.ts": ["void:settled.then()"],
|
|
68
67
|
"src/data/ticker-writes.ts": ["void:Promise.allSettled().then()"],
|
|
69
68
|
"src/layout-marketplace/linked-sync.ts": ["void:check()","void:check()","void:check()"],
|
|
70
69
|
"src/market-data/coordinator/index.ts": ["void:this.reloadTogether()","void:this.reloadTogether()"],
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"src/cli/commands/keybindings.ts": "CLI errors for `config set keybindings`: example chords in the config grammar the user types.",
|
|
3
3
|
"src/cli/commands/system.ts": "CLI help: example `config set keybindings` commands, written in the config grammar.",
|
|
4
|
+
"src/cli/known-gaps.ts": "What `gloom catalog FB` prints for the app's Send Feedback: it sends the reader to the terminal app (`gloom`), where Ctrl+P opens the command bar.",
|
|
4
5
|
"src/cli/pane-functions/dom.ts": "What `gloom fn` prints for a pane behind the sign-in wall: it sends the reader to the terminal app (`gloom`), where Ctrl+P opens the command bar.",
|
|
5
6
|
"src/plugins/builtin/alerts/cli.ts": "`gloom alerts` output, which sends the reader to the terminal app (`gloom`), where Ctrl+P opens the command bar.",
|
|
6
7
|
"src/plugins/builtin/alerts/event-rows.ts": "needsSignInNote is printed by `gloom alerts` and the headless read only: it names the terminal app's Ctrl+P.",
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { liveCompanyQuestion } from "./company-name-hint";
|
|
2
|
+
import { movedSymbolLine, parseListingArg, type ListingDeps } from "./listing-arg";
|
|
3
|
+
import { requireQuotedListing, type QuotedListing } from "./quote-answer";
|
|
4
|
+
import {
|
|
5
|
+
bareListingNote,
|
|
6
|
+
describeListingFate,
|
|
7
|
+
listingChangeLine,
|
|
8
|
+
loadListingFate,
|
|
9
|
+
noLongerTradingNote,
|
|
10
|
+
SUCCESSOR_CHANGE_WAIT_MS,
|
|
11
|
+
} from "../tickers/listing-fate";
|
|
12
|
+
import { startTickerChangeLookup } from "../tickers/ticker-changes";
|
|
13
|
+
import { logFailure } from "../utils/log-failure";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Why an alert was refused for what was typed, with what to type instead as
|
|
17
|
+
* `details`. `reason` says it without the refusal, for a form that checks
|
|
18
|
+
* the symbol before anything is added.
|
|
19
|
+
*/
|
|
20
|
+
export class AlertListingRefusal extends Error {
|
|
21
|
+
readonly reason: string;
|
|
22
|
+
|
|
23
|
+
constructor(message: string, readonly details?: string, reason?: string) {
|
|
24
|
+
super(message);
|
|
25
|
+
this.name = "AlertListingRefusal";
|
|
26
|
+
this.reason = reason ?? message;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface AlertListingOptions {
|
|
31
|
+
/** The command that adds the alert on another symbol (`gloom alerts add XYZ above 80`); none in the app. */
|
|
32
|
+
retry?: (symbol: string) => string | null;
|
|
33
|
+
now?: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The listing an alert follows, read as `quote` reads the symbol: the same
|
|
38
|
+
* resolver (a company's name such as "Singtel" is Z74:SGX), and what `quote`
|
|
39
|
+
* says of what became of it. Every place an alert is added goes through here:
|
|
40
|
+
* `gloom alerts add`, ALRT's Add Alert and SA.
|
|
41
|
+
*
|
|
42
|
+
* - A listing that no longer trades is refused, since nothing would ever
|
|
43
|
+
* check it: DBS, the silver fund delisted in 2023, asks after D05:SGX (DBS
|
|
44
|
+
* Group Holdings); SQ, which last traded before Block became XYZ, names XYZ.
|
|
45
|
+
* - A symbol its company left for another that something new trades under is
|
|
46
|
+
* kept, saying so: FB is a fund now, and Meta trades as META.
|
|
47
|
+
*
|
|
48
|
+
* Throws `AlertListingRefusal` with why.
|
|
49
|
+
*/
|
|
50
|
+
export interface AlertListing extends QuotedListing {
|
|
51
|
+
/** What became of the symbol, also among `notes`: FB's line, saying Meta trades as META. */
|
|
52
|
+
fate: string[];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export async function resolveAlertListing(
|
|
56
|
+
typed: string,
|
|
57
|
+
exchange: string | null | undefined,
|
|
58
|
+
deps: ListingDeps,
|
|
59
|
+
options: AlertListingOptions = {},
|
|
60
|
+
): Promise<AlertListing> {
|
|
61
|
+
const fail = (message: string, details?: string): never => {
|
|
62
|
+
throw new AlertListingRefusal(message, details);
|
|
63
|
+
};
|
|
64
|
+
const quoted = await requireQuotedListing(typed, exchange, deps, { fail }, "alerts add");
|
|
65
|
+
// What became of the symbol is a note beside the alert; a lookup that fails leaves the alert as `quote` reads it.
|
|
66
|
+
const fate = await alertListingNotes(quoted, typed, exchange, deps, options).catch((error: unknown) => {
|
|
67
|
+
if (error instanceof AlertListingRefusal) throw error;
|
|
68
|
+
return logFailure("cli.alert-listing", "Read what became of an alert's symbol failed", [] as string[])(error);
|
|
69
|
+
});
|
|
70
|
+
return { ...quoted, notes: [...quoted.notes, ...fate], fate };
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async function alertListingNotes(
|
|
74
|
+
{ listing, quote }: QuotedListing,
|
|
75
|
+
typed: string,
|
|
76
|
+
exchange: string | null | undefined,
|
|
77
|
+
deps: ListingDeps,
|
|
78
|
+
{ retry, now = Date.now() }: AlertListingOptions,
|
|
79
|
+
): Promise<string[]> {
|
|
80
|
+
// A bare symbol read on a listing abroad (Z74 -> SGX) is not the US symbol the changes are of.
|
|
81
|
+
const fate = bareListingNote(listing, quote)
|
|
82
|
+
? describeListingFate(listing, quote, null, now)
|
|
83
|
+
: await loadListingFate(listing, deps.dataProvider, {
|
|
84
|
+
quote,
|
|
85
|
+
changes: startTickerChangeLookup(deps.dataProvider, listing.symbol, listing.exchange),
|
|
86
|
+
graceMs: SUCCESSOR_CHANGE_WAIT_MS,
|
|
87
|
+
});
|
|
88
|
+
const stopped = noLongerTradingNote(`${listing.symbol}${quote.name ? ` (${quote.name})` : ""}`, quote, now);
|
|
89
|
+
if (stopped) {
|
|
90
|
+
const named = !!parseListingArg(typed, exchange).exchange;
|
|
91
|
+
const pointer = fate.moved
|
|
92
|
+
? movedSymbolLine(fate.moved, retry?.(fate.moved.tradesAs) ?? null)
|
|
93
|
+
: named ? null : await liveCompanyQuestion(typed, deps, now);
|
|
94
|
+
throw new AlertListingRefusal(`${stopped}, so no alert was added.`, pointer ?? undefined, `${stopped}.`);
|
|
95
|
+
}
|
|
96
|
+
const changed = listingChangeLine(fate);
|
|
97
|
+
return changed ? [changed] : [];
|
|
98
|
+
}
|