@gloom-sh/terminal 0.20.16 → 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.
Files changed (345) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/data.ts +16 -5
  7. package/src/api-client/heard-from.ts +72 -0
  8. package/src/api-client/index.ts +63 -6
  9. package/src/api-client/mna.ts +18 -0
  10. package/src/api-client/supply-chain.ts +9 -0
  11. package/src/api-client/types/billing.ts +35 -1
  12. package/src/api-client/types/econ.ts +3 -0
  13. package/src/app/global-shortcuts.ts +5 -3
  14. package/src/app/pro-welcome/keys.ts +27 -0
  15. package/src/app/pro-welcome/model.ts +158 -0
  16. package/src/app/pro-welcome/row.tsx +176 -0
  17. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  18. package/src/app/runtime/external-profile-changes.ts +135 -0
  19. package/src/app.tsx +33 -2
  20. package/src/architecture/core-builtin-allowlist.json +1 -1
  21. package/src/architecture/floating-promise-allowlist.json +0 -1
  22. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  23. package/src/cli/alert-listing.ts +98 -0
  24. package/src/cli/commands/fred-series.ts +3 -1
  25. package/src/cli/commands/market.ts +138 -22
  26. package/src/cli/commands/overview.ts +72 -14
  27. package/src/cli/commands/plugins.ts +3 -2
  28. package/src/cli/commands/search.ts +30 -6
  29. package/src/cli/context.ts +16 -5
  30. package/src/cli/csv-export.ts +74 -0
  31. package/src/cli/desktop-pane-shot.ts +75 -11
  32. package/src/cli/glossary.ts +64 -10
  33. package/src/cli/help.ts +4 -2
  34. package/src/cli/history-demergers.ts +117 -0
  35. package/src/cli/history-rows.ts +6 -2
  36. package/src/cli/index.ts +1 -0
  37. package/src/cli/known-gaps.ts +16 -0
  38. package/src/cli/known-us-stocks.ts +18 -0
  39. package/src/cli/listing-arg.ts +105 -15
  40. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  41. package/src/cli/pane-functions/catalog-snapshot.json +866 -0
  42. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  43. package/src/cli/pane-functions/catalog.ts +50 -16
  44. package/src/cli/pane-functions/data.ts +16 -4
  45. package/src/cli/pane-functions/dom.ts +24 -6
  46. package/src/cli/pane-functions/freshness.ts +17 -1
  47. package/src/cli/pane-functions/headless.ts +7 -2
  48. package/src/cli/pane-functions/index.ts +102 -44
  49. package/src/cli/pane-functions/resolver.ts +8 -5
  50. package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
  51. package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
  52. package/src/cli/pane-functions/screenshot-payload.ts +21 -0
  53. package/src/cli/pane-functions/screenshot-render.ts +3 -1
  54. package/src/cli/quote-answer.ts +32 -16
  55. package/src/cli/registry.ts +22 -2
  56. package/src/cli/report-tables.ts +17 -3
  57. package/src/cli/result.ts +8 -10
  58. package/src/cli/series-search.ts +45 -6
  59. package/src/cli/shot-temp-dir.ts +4 -9
  60. package/src/components/chart/composite/legend.tsx +80 -25
  61. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  62. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  63. package/src/components/chart-table/header.tsx +9 -0
  64. package/src/components/chart-table/layout.ts +11 -11
  65. package/src/components/command-bar/pane-templates/items.ts +17 -1
  66. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  67. package/src/components/command-bar/routes/root/results.ts +34 -2
  68. package/src/components/command-bar/routes/root/runtime.ts +8 -1
  69. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  70. package/src/components/command-bar/workflow/alert.ts +19 -8
  71. package/src/components/data-table/view.tsx +15 -2
  72. package/src/components/form-modal/content.tsx +9 -4
  73. package/src/components/index.ts +1 -1
  74. package/src/components/layout/header.tsx +9 -5
  75. package/src/components/layout/pane/capture-status.ts +6 -0
  76. package/src/components/layout/pane/footer/index.tsx +2 -0
  77. package/src/components/layout/pane/footer/model.ts +113 -15
  78. package/src/components/layout/pane/header.tsx +16 -2
  79. package/src/components/market-board/index.tsx +4 -2
  80. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  81. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  82. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  83. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  84. package/src/components/onboarding/setup-cards.ts +36 -0
  85. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  86. package/src/components/onboarding/wizard-account.ts +6 -1
  87. package/src/components/onboarding/wizard-model.ts +32 -6
  88. package/src/components/onboarding/wizard-positions.ts +1 -1
  89. package/src/components/sign-in-gate.tsx +3 -1
  90. package/src/components/toggle-list.tsx +6 -8
  91. package/src/components/ui/confirm-dialog.tsx +47 -7
  92. package/src/components/ui/data-table/display-columns.ts +4 -1
  93. package/src/components/ui/data-table/hooks.ts +2 -3
  94. package/src/components/ui/data-table/index.tsx +4 -1
  95. package/src/components/ui/data-table/types.ts +19 -4
  96. package/src/components/ui/data-table/visible-range.ts +11 -1
  97. package/src/components/ui/display.tsx +17 -2
  98. package/src/components/ui/index.ts +1 -1
  99. package/src/components/ui/stat-grid.tsx +4 -0
  100. package/src/components/ui/status.tsx +13 -1
  101. package/src/components/ui/table-layout.ts +2 -1
  102. package/src/components/use-pane-notice-footer.tsx +16 -3
  103. package/src/data/config/store/index.ts +31 -0
  104. package/src/data/config/store/node.ts +61 -11
  105. package/src/data/config/store/normalize.ts +4 -6
  106. package/src/data/config/store/shared-file.ts +309 -0
  107. package/src/data/profile-merge.ts +299 -0
  108. package/src/data/sqlite/checkpointer.ts +11 -1
  109. package/src/data/sqlite/database.ts +1 -1
  110. package/src/data/ticker-repository.ts +134 -10
  111. package/src/data/ticker-store.ts +67 -0
  112. package/src/data/ticker-writes.ts +5 -0
  113. package/src/i18n/es.ts +27 -0
  114. package/src/i18n/ja.ts +27 -0
  115. package/src/i18n/ko.ts +27 -0
  116. package/src/i18n/zh-cn.ts +27 -0
  117. package/src/i18n/zh-tw.ts +27 -0
  118. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  119. package/src/market-data/ah-pair.ts +103 -0
  120. package/src/market-data/depositary-pair.ts +6 -2
  121. package/src/market-data/hooks.tsx +33 -2
  122. package/src/market-data/market/change-basis.ts +2 -1
  123. package/src/market-data/market/header-market.ts +11 -0
  124. package/src/market-data/split-terms.ts +28 -0
  125. package/src/plugins/builtin/account-management/footer.ts +1 -1
  126. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  127. package/src/plugins/builtin/account-management/model.ts +1 -0
  128. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  129. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  130. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  131. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  132. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  133. package/src/plugins/builtin/alerts/cli.ts +36 -30
  134. package/src/plugins/builtin/alerts/constants.ts +10 -0
  135. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  136. package/src/plugins/builtin/alerts/format.ts +24 -8
  137. package/src/plugins/builtin/alerts/index.tsx +38 -9
  138. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  139. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  140. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  141. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  142. package/src/plugins/builtin/alerts/types.ts +7 -0
  143. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  144. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  145. package/src/plugins/builtin/analytics/risk-client.ts +26 -13
  146. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  147. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  148. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  149. package/src/plugins/builtin/awards/pane.tsx +7 -3
  150. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  151. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  152. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  153. package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
  154. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  155. package/src/plugins/builtin/chart-composer/pane.tsx +9 -3
  156. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  157. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  158. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  159. package/src/plugins/builtin/company-kpis/headless.ts +9 -4
  160. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  161. package/src/plugins/builtin/company-kpis/model.ts +38 -8
  162. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  163. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  164. package/src/plugins/builtin/composite/application.ts +14 -0
  165. package/src/plugins/builtin/composite/broker.ts +12 -0
  166. package/src/plugins/builtin/composite/credit.ts +33 -0
  167. package/src/plugins/builtin/composite/crypto.ts +10 -0
  168. package/src/plugins/builtin/composite/earnings.ts +12 -0
  169. package/src/plugins/builtin/composite/filings.ts +13 -0
  170. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  171. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  172. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  173. package/src/plugins/builtin/composite/ownership.ts +23 -0
  174. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  175. package/src/plugins/builtin/composite/quant.ts +15 -0
  176. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  177. package/src/plugins/builtin/composite/screeners.ts +11 -0
  178. package/src/plugins/builtin/composite/shared.ts +11 -0
  179. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  180. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  181. package/src/plugins/builtin/correlation/index.tsx +13 -17
  182. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  183. package/src/plugins/builtin/credit-conditions/series.ts +2 -2
  184. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  185. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  186. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  187. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  188. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  189. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  190. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  191. package/src/plugins/builtin/earnings/board-model.ts +12 -0
  192. package/src/plugins/builtin/earnings/board-table.ts +7 -4
  193. package/src/plugins/builtin/earnings/board.tsx +2 -2
  194. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  195. package/src/plugins/builtin/earnings/headless.ts +7 -4
  196. package/src/plugins/builtin/earnings/highlight.ts +1 -1
  197. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  198. package/src/plugins/builtin/earnings/history-table.ts +4 -3
  199. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  200. package/src/plugins/builtin/econ/calendar-model.ts +18 -0
  201. package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
  202. package/src/plugins/builtin/econ/index.tsx +3 -0
  203. package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
  204. package/src/plugins/builtin/econ-statistics/client.ts +11 -10
  205. package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
  206. package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
  207. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  208. package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
  209. package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
  210. package/src/plugins/builtin/econ-statistics/view.ts +9 -3
  211. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  212. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  213. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  214. package/src/plugins/builtin/exposure/model.ts +10 -0
  215. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  216. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  217. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  218. package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
  219. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  220. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  221. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  222. package/src/plugins/builtin/mna/detail.tsx +67 -6
  223. package/src/plugins/builtin/mna/headless.ts +128 -13
  224. package/src/plugins/builtin/mna/model.ts +219 -16
  225. package/src/plugins/builtin/mna/pane.tsx +34 -6
  226. package/src/plugins/builtin/money-markets/model.ts +14 -5
  227. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  228. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  229. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  230. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  231. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  232. package/src/plugins/builtin/pe-band/client.ts +13 -1
  233. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  234. package/src/plugins/builtin/pe-band/model.ts +63 -10
  235. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  236. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  237. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  238. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  239. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  240. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  241. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  242. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  243. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  244. package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
  245. package/src/plugins/builtin/research/event-model.ts +31 -13
  246. package/src/plugins/builtin/research/headless.ts +8 -1
  247. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  248. package/src/plugins/builtin/sectors/index.tsx +6 -9
  249. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  250. package/src/plugins/builtin/shared/earnings-report.ts +19 -4
  251. package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
  252. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  253. package/src/plugins/builtin/shared/series-cache.ts +3 -0
  254. package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
  255. package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
  256. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  257. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  258. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  259. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  260. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  261. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  262. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  263. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  264. package/src/plugins/builtin/supply-chain/pane.tsx +76 -16
  265. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  266. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  267. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +67 -1
  268. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +31 -16
  269. package/src/plugins/builtin/ticker-detail/overview/model.ts +17 -1
  270. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
  271. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
  272. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  273. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  274. package/src/plugins/builtin/time-sales/headless.ts +4 -1
  275. package/src/plugins/builtin/time-sales/pane.tsx +2 -0
  276. package/src/plugins/builtin/time-sales/window.ts +12 -0
  277. package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
  278. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
  279. package/src/plugins/builtin/treasury-daily/client.ts +23 -11
  280. package/src/plugins/builtin/volatility/model.ts +17 -0
  281. package/src/plugins/builtin/volatility/pane.tsx +13 -4
  282. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  283. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  284. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  285. package/src/plugins/builtin/world-venue-map/headless.ts +28 -16
  286. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  287. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  288. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  289. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  290. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  291. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  292. package/src/plugins/catalog-data.ts +20 -0
  293. package/src/plugins/catalog-lazy.ts +51 -0
  294. package/src/plugins/catalog-ui.ts +16 -18
  295. package/src/plugins/host-smoke.ts +5 -2
  296. package/src/portfolio/allocation.ts +79 -19
  297. package/src/portfolio/cash-balances.ts +76 -0
  298. package/src/portfolio/mutations.ts +43 -8
  299. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  300. package/src/renderers/desktop/window-layouts.ts +14 -0
  301. package/src/renderers/dom/data-table/row.tsx +2 -0
  302. package/src/renderers/dom/host/tabs.tsx +57 -8
  303. package/src/renderers/dom/styles.css +13 -5
  304. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  305. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  306. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  307. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  308. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
  309. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  310. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  311. package/src/series/standalone-catalog.ts +5 -4
  312. package/src/series/standalone.ts +13 -7
  313. package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
  314. package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
  315. package/src/sources/gloomberb-cloud/index.ts +14 -3
  316. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  317. package/src/sources/provider-router/financials.ts +20 -13
  318. package/src/sources/provider-router/index.ts +4 -0
  319. package/src/sources/provider-router/search.ts +1 -0
  320. package/src/sync/collections-contributor.ts +3 -1
  321. package/src/sync/config-merge.ts +10 -1
  322. package/src/sync/sanitize.ts +26 -2
  323. package/src/tickers/company-name-listing.ts +16 -2
  324. package/src/tickers/listing-fate.ts +12 -8
  325. package/src/tickers/renamed-listings.ts +43 -10
  326. package/src/tickers/search/home-listing.ts +28 -0
  327. package/src/tickers/search/index.ts +19 -7
  328. package/src/tickers/terminal-codes.ts +11 -1
  329. package/src/time-series/base-series.ts +3 -0
  330. package/src/time-series/ice-credit.ts +1 -0
  331. package/src/time-series/resolve.ts +3 -1
  332. package/src/time-series/spec.ts +2 -2
  333. package/src/time-series/types.ts +2 -1
  334. package/src/types/data-provider.ts +11 -0
  335. package/src/types/financials.ts +39 -3
  336. package/src/types/headless.ts +4 -2
  337. package/src/types/ticker.ts +10 -2
  338. package/src/utils/cli-output.ts +1 -1
  339. package/src/utils/declared-dividends.ts +13 -1
  340. package/src/utils/dividend-cash.ts +5 -1
  341. package/src/utils/forward-dividend.ts +4 -3
  342. package/src/utils/remove-folder.ts +37 -0
  343. package/src/utils/throttled-fetch.ts +15 -1
  344. package/src/utils/trailing-dividend.ts +1 -1
  345. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -67,6 +67,10 @@ export async function handleDesktopBackendRequest(
67
67
  return null;
68
68
  case "ticker.loadAll":
69
69
  return backend.requireServices().tickerRepository.loadAllTickers();
70
+ case "ticker.changesElsewhere":
71
+ return backend.requireServices().tickerRepository.changesElsewhere?.() ?? null;
72
+ case "ticker.takeDeletedElsewhere":
73
+ return backend.requireServices().tickerRepository.takeRowsDeletedElsewhere?.() ?? [];
70
74
  case "ticker.load":
71
75
  return backend.requireServices().tickerRepository.loadTicker(request.payload.symbol);
72
76
  case "ticker.save":
@@ -7,7 +7,7 @@ import {
7
7
  reconcileAppSessionSnapshot,
8
8
  type AppSessionSnapshot,
9
9
  } from "../../../../core/state/session-persistence";
10
- import { saveConfig } from "../../../../data/config/store";
10
+ import { saveConfig, watchExternalConfigChanges } from "../../../../data/config/store";
11
11
  import { pluginAutoUpdateEnabled } from "../../../../plugins/auto-update";
12
12
  import { startNodePluginAutoUpdates } from "../../../../plugins/auto-update-node";
13
13
  import { getPluginSeedProgress, subscribePluginSeed } from "../../../../plugins/seed-progress";
@@ -167,6 +167,7 @@ export class DesktopBackend {
167
167
  private pluginAutoUpdatesStarted = false;
168
168
  private commandLinksScheduled = false;
169
169
  private remoteControlServer: RemoteControlServer | null = null;
170
+ private stopWatchingConfig: (() => void) | null = null;
170
171
  private readonly pendingDeepLinks: string[] = [];
171
172
  private readonly contextMenuRequestRpcs = new Map<string, DesktopRpc>();
172
173
  /** Extra windows open once the main window has drawn, like popped-out panes. */
@@ -494,15 +495,33 @@ export class DesktopBackend {
494
495
  });
495
496
  this.workspace = createDesktopWorkspace(config, this.getSessionSnapshot(), this.windowController?.screenSetup.windows);
496
497
  this.reconcileWindows();
498
+ this.watchConfigWrittenElsewhere(config.dataDir);
497
499
  return { config, services };
498
500
  }
499
501
 
502
+ /**
503
+ * A `gloom` command run beside the app writes the same config.json (an
504
+ * alert, a setting, a watchlist): the change is taken in and shown in every
505
+ * window, so no save of the app's copy writes over it.
506
+ */
507
+ private watchConfigWrittenElsewhere(dataDir: string): void {
508
+ this.stopWatchingConfig?.();
509
+ this.stopWatchingConfig = watchExternalConfigChanges(dataDir, (change) => {
510
+ if (!this.config || !this.workspace) return;
511
+ const next = change.apply(this.config);
512
+ if (next === this.config) return;
513
+ this.commitDesktopSnapshotInBackground(this.workspace.replaceConfig(next, { layoutChanged: false }), { persistConfig: false });
514
+ });
515
+ }
516
+
500
517
  /** Compiles the view's plugins ahead of its first `plugins.listExternal`. */
501
518
  prefetchExternalPluginBundles(): void {
502
519
  prefetchExternalPluginBundles();
503
520
  }
504
521
 
505
522
  teardownServices(): void {
523
+ this.stopWatchingConfig?.();
524
+ this.stopWatchingConfig = null;
506
525
  this.stopRemoteControlServer();
507
526
  this.capabilityBridge.disposeAll();
508
527
  this.httpStreamBridge.disposeAll();
@@ -908,6 +927,8 @@ export class DesktopBackend {
908
927
  case "update.start":
909
928
  case "update.apply":
910
929
  case "ticker.loadAll":
930
+ case "ticker.changesElsewhere":
931
+ case "ticker.takeDeletedElsewhere":
911
932
  case "ticker.load":
912
933
  case "ticker.save":
913
934
  case "ticker.delete":
@@ -187,7 +187,12 @@ function fromPrivateSource<T>(source: string, compile: (path: string) => T): T {
187
187
  writeFileSync(path, source, { flag: "wx", mode: 0o600 });
188
188
  return compile(path);
189
189
  } finally {
190
- rmSync(folder, { recursive: true, force: true });
190
+ // Windows can still hold the file for a moment; a folder left behind must not cost the window its minimum size.
191
+ try {
192
+ rmSync(folder, { recursive: true, force: true });
193
+ } catch (error) {
194
+ logFailure("window", "Could not remove the minimum size helper's temporary folder")(error);
195
+ }
191
196
  }
192
197
  }
193
198
 
@@ -272,6 +272,10 @@ interface DesktopBackendRequestMap {
272
272
  /** Installs the staged update and relaunches. Sent only when the user presses Restart. */
273
273
  "update.apply": { request: null; response: null };
274
274
  "ticker.loadAll": { request: null; response: TickerRecord[] };
275
+ /** Changes when another program commits to the database (`TickerStore.changesElsewhere`). */
276
+ "ticker.changesElsewhere": { request: null; response: number | null };
277
+ /** The rows another program deleted that the backend held (`TickerRepository.takeRowsDeletedElsewhere`). */
278
+ "ticker.takeDeletedElsewhere": { request: null; response: string[] };
275
279
  "ticker.load": { request: { symbol: string }; response: TickerRecord | null };
276
280
  "ticker.save": { request: { ticker: TickerRecord }; response: null };
277
281
  "ticker.delete": { request: { symbol: string }; response: null };
@@ -201,6 +201,8 @@ function installShotHttpFetchTransport(): void {
201
201
  method: "POST",
202
202
  headers: { "Content-Type": "application/json" },
203
203
  body: JSON.stringify(await toRequestEnvelope(url, init)),
204
+ // A pane's own deadline ends the read here as in the app, not when the Bun side gives up.
205
+ signal: init?.signal ?? null,
204
206
  });
205
207
  const result = await response.json() as { ok: boolean; error?: string; data?: HttpProxyResponseEnvelope };
206
208
  if (!result.ok || !result.data) throw new Error(result.error ?? `Request failed: ${url}`);
@@ -1,8 +1,9 @@
1
1
  /** @jsxImportSource react */
2
2
  import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
3
3
  import { FloatingPaneWrapper } from "../../../components/layout/floating-pane";
4
- import { CaptureDatesDataContext } from "../../../components/layout/pane/capture-status";
4
+ import { CaptureDatesDataContext, PaneCaptureContext } from "../../../components/layout/pane/capture-status";
5
5
  import { PaneFooterProvider, datesPaneData, hasPaneFooterContent, type PaneFooterSegment } from "../../../components/layout/pane/footer";
6
+ import { noteLineParts } from "../../../components/layout/pane/footer/model";
6
7
  import { resolvePaneBodyFrame } from "../../../components/layout/pane/sizing";
7
8
 
8
9
  /** What a capture's status line dates (`CaptureStatusLine`): the pane's own data, the quotes on screen, or neither. */
@@ -35,19 +36,45 @@ function nextFrames(count: number): Promise<void> {
35
36
  });
36
37
  }
37
38
 
38
- /** Keeps the start and the end of a line that does not fit, `keep` characters in all. */
39
- function middleEllipsis(text: string, keep: number): string {
39
+ /** What a cut line's ends do not start or end on beside the ellipsis: a separator or a space. */
40
+ const LOOSE_END = /^[\s·,;:]+|[\s·,;:]+$/gu;
41
+
42
+ /**
43
+ * Keeps the start and the end of a line that does not fit, `keep` characters
44
+ * in all, in whole words ("US trading day Mon … 15 min delayed"), never a
45
+ * word cut ("Mon 1…ose"); by characters only where not a word fits either end.
46
+ */
47
+ export function middleEllipsis(text: string, keep: number): string {
40
48
  if (keep >= text.length) return text;
41
- const head = Math.ceil(keep / 2);
42
- const tail = Math.max(0, keep - head);
43
- return `${text.slice(0, head).trimEnd()}…${tail > 0 ? text.slice(text.length - tail).trimStart() : ""}`;
49
+ const headRoom = Math.ceil(keep / 2);
50
+ const tailRoom = Math.max(0, keep - headRoom);
51
+ const words = text.split(" ");
52
+ let head = "";
53
+ for (const word of words) {
54
+ const next = head ? `${head} ${word}` : word;
55
+ if (next.length > headRoom) break;
56
+ head = next;
57
+ }
58
+ let tail = "";
59
+ for (const word of [...words].reverse()) {
60
+ const next = tail ? `${word} ${tail}` : word;
61
+ if (next.length > tailRoom) break;
62
+ tail = next;
63
+ }
64
+ head = head.replace(LOOSE_END, "");
65
+ tail = tail.replace(LOOSE_END, "");
66
+ if (head && tail) return `${head} … ${tail}`;
67
+ if (head) return `${head}…`;
68
+ return `${text.slice(0, headRoom).trimEnd()}…${tailRoom > 0 ? text.slice(text.length - tailRoom).trimStart() : ""}`;
44
69
  }
45
70
 
46
71
  /**
47
72
  * The first variant that fits; else, when the footer can make room (the
48
73
  * pane's own `as of` gives way), the first that fits then; else the last one
49
- * cut in the middle as little as it must be. `show` puts a text on screen and
50
- * resolves once it is drawn.
74
+ * cut in the middle, between words, as little as it must be. A note line
75
+ * keeps its share of the row (fitPaneFooterInfo): its first words say more
76
+ * than the rest of a status line. `show` puts a text on screen and resolves
77
+ * once it is drawn.
51
78
  */
52
79
  async function fitStatusLine(
53
80
  variants: readonly string[],
@@ -133,7 +160,8 @@ function useShotStatusLine(enabled: boolean, hasAsOf: () => boolean): ShotStatus
133
160
  }
134
161
 
135
162
  /**
136
- * Static captures retain warnings, what a filter leaves out (`capture`) and
163
+ * Static captures retain warnings, as one note line (the first note, cut
164
+ * after a whole word, and how many more there are), what a filter leaves out (`capture`) and
137
165
  * optional source status without action shortcuts. With `statusLine` the footer also carries the capture's dated
138
166
  * status line (`Fri 9 Oct close · 15 min delayed · markets closed · regular session opens Mon 13:30 UTC, 09:30 ET`),
139
167
  * inside the requested size: the body gives up the footer row for it. The
@@ -157,9 +185,17 @@ export function PaneShotFrame({ paneId, title, width, height, preserveStatus = f
157
185
  const datesData = statusLine && dates === "data";
158
186
  return <PaneFooterProvider>{(registeredFooter) => {
159
187
  const status: PaneFooterSegment[] = statusLine && statusText !== null ? [{ id: "shot-status", parts: [{ text: statusText, tone: "label" }] }] : [];
160
- const info = registeredFooter.info.filter((segment) => (preserveStatus || segment.icon === "warning" || segment.capture)
188
+ // A warning whose pane gives a picture no notes to print (`captureNotes` empty) leaves no segment.
189
+ const info = registeredFooter.info.filter((segment) => !(segment.icon === "warning" && segment.notes?.length === 0)
190
+ && (preserveStatus || segment.icon === "warning" || segment.capture)
161
191
  && !(datesPaneData(segment) && (datesData || crowded))
162
- && !(segment.quoteStatus && statusLine && dates !== null));
192
+ && !(segment.quoteStatus && statusLine && dates !== null))
193
+ // Nothing opens a picture's ⚠: its notes are the footer's one note line (noteLineParts).
194
+ .map((segment): PaneFooterSegment => {
195
+ if (segment.icon !== "warning") return segment;
196
+ const notes = segment.notes?.length ? segment.notes : [segment.label ?? segment.title ?? segment.parts.map((part) => part.text).join(" ")];
197
+ return { ...segment, icon: undefined, onPress: undefined, notes, parts: noteLineParts(notes, Number.POSITIVE_INFINITY) };
198
+ });
163
199
  shownAsOf.current = info.some(datesPaneData);
164
200
  const footer = { info: [...info, ...status], hints: [], menu: [], keys: [] };
165
201
  const bodyFrame = resolvePaneBodyFrame({
@@ -181,7 +217,9 @@ export function PaneShotFrame({ paneId, title, width, height, preserveStatus = f
181
217
  showActions={false}
182
218
  footer={footer}
183
219
  >
184
- <CaptureDatesDataContext.Provider value={datesData}>{children(bodyFrame)}</CaptureDatesDataContext.Provider>
220
+ <PaneCaptureContext.Provider value>
221
+ <CaptureDatesDataContext.Provider value={datesData}>{children(bodyFrame)}</CaptureDatesDataContext.Provider>
222
+ </PaneCaptureContext.Provider>
185
223
  </FloatingPaneWrapper>;
186
224
  }}</PaneFooterProvider>;
187
225
  }
@@ -7,6 +7,16 @@ export class RemoteTickerRepository {
7
7
  return backendRequest("ticker.loadAll");
8
8
  }
9
9
 
10
+ /** Changes when another program (a `gloom` command, the terminal app) commits to the profile's database. */
11
+ changesElsewhere(): Promise<number | null> {
12
+ return backendRequest("ticker.changesElsewhere");
13
+ }
14
+
15
+ /** The rows another program deleted that the backend held, for this window to drop from what it shows. */
16
+ takeRowsDeletedElsewhere(): Promise<string[]> {
17
+ return backendRequest("ticker.takeDeletedElsewhere");
18
+ }
19
+
10
20
  async loadTicker(symbol: string): Promise<TickerRecord | null> {
11
21
  return backendRequest("ticker.load", { symbol });
12
22
  }
@@ -1,6 +1,6 @@
1
- import type { GloomPlugin } from "../types/plugin";
2
1
  import { logFailure } from "../utils/log-failure";
3
2
  import { SeriesRegistry } from "./registry";
3
+ import { type SeriesPlugins, pluginsOf } from "./standalone";
4
4
  import type { SeriesCatalogEntry } from "./types";
5
5
 
6
6
  let standaloneEntries: (() => readonly SeriesCatalogEntry[]) | null = null;
@@ -10,7 +10,7 @@ let standaloneEntries: (() => readonly SeriesCatalogEntry[]) | null = null;
10
10
  * where no plugin runtime runs: the series the plugins declare, registered
11
11
  * once on first read. Null forgets it.
12
12
  */
13
- export function setStandaloneSeriesCatalog(plugins: readonly GloomPlugin[] | null, disabledPlugins: readonly string[] = []): void {
13
+ export function setStandaloneSeriesCatalog(plugins: SeriesPlugins | null, disabledPlugins: readonly string[] = []): void {
14
14
  if (!plugins) {
15
15
  standaloneEntries = null;
16
16
  return;
@@ -18,8 +18,9 @@ export function setStandaloneSeriesCatalog(plugins: readonly GloomPlugin[] | nul
18
18
  let entries: readonly SeriesCatalogEntry[] | null = null;
19
19
  standaloneEntries = () => {
20
20
  if (entries) return entries;
21
- const registry = new SeriesRegistry({ pluginHosts: (pluginId) => plugins.find((plugin) => plugin.id === pluginId)?.hosts });
22
- for (const plugin of plugins) {
21
+ const all = pluginsOf(plugins);
22
+ const registry = new SeriesRegistry({ pluginHosts: (pluginId) => all.find((plugin) => plugin.id === pluginId)?.hosts });
23
+ for (const plugin of all) {
23
24
  if (disabledPlugins.includes(plugin.id)) continue;
24
25
  for (const definition of plugin.series ?? []) {
25
26
  try {
@@ -7,6 +7,11 @@ import { readSeriesFolder } from "./files";
7
7
  import { SeriesRegistry, seriesExpression, seriesNamedBy } from "./registry";
8
8
  import type { SeriesDefinition } from "./types";
9
9
 
10
+ /** The plugins a series lookup reads: a list, or a function that gives it once a series is first asked for. */
11
+ export type SeriesPlugins = readonly GloomPlugin[] | (() => readonly GloomPlugin[]);
12
+
13
+ export const pluginsOf = (plugins: SeriesPlugins): readonly GloomPlugin[] => typeof plugins === "function" ? plugins() : plugins;
14
+
10
15
  /**
11
16
  * Charts the catalog's loaded series where no plugin runtime runs, such as a
12
17
  * `gloom fn G` report: the series plugins declare, and the files in the
@@ -14,13 +19,14 @@ import type { SeriesDefinition } from "./types";
14
19
  * need the app.
15
20
  */
16
21
  export function standaloneSeriesInvoker(
17
- plugins: readonly GloomPlugin[],
22
+ plugins: SeriesPlugins,
18
23
  dataDir: string,
19
24
  disabledPlugins: readonly string[] = [],
20
25
  ): CapabilityInvoker {
21
26
  let registry: Promise<SeriesRegistry> | null = null;
22
27
  const build = async () => {
23
- const built = new SeriesRegistry({ pluginHosts: (pluginId) => plugins.find((plugin) => plugin.id === pluginId)?.hosts });
28
+ const all = pluginsOf(plugins);
29
+ const built = new SeriesRegistry({ pluginHosts: (pluginId) => all.find((plugin) => plugin.id === pluginId)?.hosts });
24
30
  const register = (pluginId: string, definitions: readonly Parameters<SeriesRegistry["register"]>[1][]) => {
25
31
  for (const definition of definitions) {
26
32
  try {
@@ -30,7 +36,7 @@ export function standaloneSeriesInvoker(
30
36
  }
31
37
  }
32
38
  };
33
- for (const plugin of plugins) {
39
+ for (const plugin of all) {
34
40
  if (!disabledPlugins.includes(plugin.id)) register(plugin.id, plugin.series ?? []);
35
41
  }
36
42
  register("user", await readSeriesFolder(dataDir));
@@ -56,14 +62,14 @@ export function standaloneSeriesInvoker(
56
62
  * the registry's `findByExpression` does.
57
63
  */
58
64
  export function standaloneSeriesCatalog(
59
- plugins: readonly GloomPlugin[],
65
+ plugins: SeriesPlugins,
60
66
  disabledPlugins: readonly string[] = [],
61
67
  ): (expression: string) => SeriesDefinition | undefined {
62
68
  let byExpression: Map<string, SeriesDefinition> | null = null;
63
69
  return (expression) => {
64
70
  if (!byExpression) {
65
71
  byExpression = new Map();
66
- for (const plugin of plugins) {
72
+ for (const plugin of pluginsOf(plugins)) {
67
73
  if (disabledPlugins.includes(plugin.id)) continue;
68
74
  for (const definition of plugin.series ?? []) {
69
75
  if (definition.input) continue;
@@ -78,9 +84,9 @@ export function standaloneSeriesCatalog(
78
84
 
79
85
  /** The catalog series a bare word is an alias of (`hashrate`), where no plugin runtime runs; see `seriesNamedBy`. */
80
86
  export function standaloneSeriesNamed(
81
- plugins: readonly GloomPlugin[],
87
+ plugins: SeriesPlugins,
82
88
  disabledPlugins: readonly string[] = [],
83
89
  ): (word: string) => SeriesDefinition | undefined {
84
- const definitions = () => plugins.filter((plugin) => !disabledPlugins.includes(plugin.id)).flatMap((plugin) => plugin.series ?? []);
90
+ const definitions = () => pluginsOf(plugins).filter((plugin) => !disabledPlugins.includes(plugin.id)).flatMap((plugin) => plugin.series ?? []);
85
91
  return (word) => seriesNamedBy(definitions(), word);
86
92
  }
@@ -0,0 +1,25 @@
1
+ import { FRED_CATALOG_SERIES } from "../../plugins/builtin/shared/fred-catalog";
2
+ import { ICE_CREDIT_PUBLISHER, ICE_CREDIT_SERIES } from "../../time-series/ice-credit";
3
+ import { seriesNotOnFred } from "./fred-series";
4
+
5
+ const publishers = new Map([
6
+ ...FRED_CATALOG_SERIES.map((series): [string, string] => [series.id.slice(5), series.publisher!]),
7
+ ...ICE_CREDIT_SERIES.map((series): [string, string] => [series.seriesId, ICE_CREDIT_PUBLISHER]),
8
+ ]);
9
+ const additional: Readonly<Record<string, string>> = {
10
+ GDPNOW: "Federal Reserve Bank of Atlanta",
11
+ NFCI: "Federal Reserve Bank of Chicago",
12
+ STLFSI4: "Federal Reserve Bank of St. Louis",
13
+ MEDCPIM158SFRBCLE: "Federal Reserve Bank of Cleveland",
14
+ };
15
+
16
+ export function fredPublisher(seriesId: string, source?: string | null): string | null {
17
+ const normalized = seriesId.trim().toUpperCase();
18
+ return publishers.get(normalized) ?? additional[normalized]
19
+ ?? (/^DGS\d|^DFII\d/.test(normalized) ? "Federal Reserve Board" : source?.trim() || null);
20
+ }
21
+
22
+ export function fredCitation(seriesId: string, source?: string | null): string {
23
+ const publisher = fredPublisher(seriesId, source);
24
+ return seriesNotOnFred(seriesId) ? publisher ?? "Gloom Cloud" : publisher ? `${publisher} via FRED` : "Publisher not stated via FRED";
25
+ }
@@ -9,7 +9,7 @@ import type {
9
9
  const CACHE_KIND = "fred-series";
10
10
  const CACHE_SOURCE = "gloomberb-cloud";
11
11
  // Refresh persisted metadata that predates FRED's source coverage dates.
12
- const CACHE_SCHEMA_VERSION = 2;
12
+ const CACHE_SCHEMA_VERSION = 3;
13
13
  const CACHE_POLICY = {
14
14
  staleMs: 24 * 60 * 60 * 1000,
15
15
  expireMs: 30 * 24 * 60 * 60 * 1000,
@@ -88,6 +88,7 @@ import {
88
88
  perpetualTarget,
89
89
  searchPerpetualMarkets,
90
90
  boardSearchesFrom,
91
+ PerpetualBoardCache,
91
92
  } from "./perpetuals";
92
93
  import { predictionMarketListing } from "../../tickers/prediction-listing";
93
94
  import { cleanListingName } from "../../tickers/company-name";
@@ -105,6 +106,11 @@ const QUOTE_BATCHES_IN_FLIGHT = 3;
105
106
  const PERPETUAL_SEARCH_WAIT_MS = 2_000;
106
107
  /** How long a batched search waits for the board it answers every query's perpetual markets from. */
107
108
  const PERPETUAL_BOARD_WAIT_MS = 5_000;
109
+ /** A bare symbol a command looks up (AAPL, MCO), not a search the person typed to browse: `search` and the command bar keep the contracts. */
110
+ function isSymbolLookup(query: string, context?: SearchRequestContext): boolean {
111
+ return !context?.interactive && context?.perpetuals !== "always" && /^[A-Za-z][A-Za-z0-9]{1,5}$/.test(query.trim());
112
+ }
113
+
108
114
  const CLOUD_RESOLUTION_SUPPORT = normalizeChartResolutionSupport([
109
115
  { resolution: "1m", maxRange: "1W" },
110
116
  { resolution: "5m", maxRange: "1M" },
@@ -524,6 +530,10 @@ function perpetualFinancials(quote: Quote): TickerFinancials {
524
530
  }
525
531
 
526
532
  export class GloomberbCloudProvider implements AssetDataProvider {
533
+ /** See `AssetDataProvider.knownUsStock`; this provider asks for no perpetual contracts of such a symbol either. */
534
+ knownUsStock?: (symbol: string) => boolean;
535
+ private readonly perpetualBoards = new PerpetualBoardCache();
536
+
527
537
  readonly id = providerId;
528
538
  readonly name = "Gloom Cloud";
529
539
  readonly priority = 100;
@@ -733,7 +743,8 @@ export class GloomberbCloudProvider implements AssetDataProvider {
733
743
  async search(query: string, context?: SearchRequestContext): Promise<InstrumentSearchResult[]> {
734
744
  // Perpetual markets are listings too, asked for beside the others. They are optional: a failed lookup leaves the
735
745
  // other results, and a keystroke waits for them only briefly once the listings are in, unless the query names one.
736
- const pending = searchPerpetualMarkets(query).catch(logFailure("sources.gloomberb-cloud.index", "Searching perpetual markets failed", [] as InstrumentSearchResult[]));
746
+ const pending = isSymbolLookup(query, context) && this.knownUsStock?.(query) === true ? null
747
+ : searchPerpetualMarkets(query, apiClient, this.perpetualBoards).catch(logFailure("sources.gloomberb-cloud.index", "Searching perpetual markets failed", [] as InstrumentSearchResult[]));
737
748
  // A crypto exchange's line of a coin pair, which no source quotes, is offered as the crypto venue's listing.
738
749
  const listings = await withCloudFallback(
739
750
  async () => withExchangeLinesAsCoinListings(withCleanNames(
@@ -743,7 +754,7 @@ export class GloomberbCloudProvider implements AssetDataProvider {
743
754
  // Rate limited or overloaded: the search was not run, which is not a search that found nothing.
744
755
  throw isRetryableApiError(error) ? new ProviderBusyError("Cloud search is busy", { cause: error }) : error;
745
756
  });
746
- const perpetuals = await settleWithin(pending, namesPerpetualMarket(query) || !context?.interactive ? PERPETUAL_SEARCH_WAIT_MS : 250) ?? [];
757
+ const perpetuals = pending ? await settleWithin(pending, namesPerpetualMarket(query) || !context?.interactive ? PERPETUAL_SEARCH_WAIT_MS : 250) ?? [] : [];
747
758
  // Ahead of the listings, so a contract found by its plain name ("brent" for BZUSDT:BINANCE) is not cut
748
759
  // behind every warrant that names it; an exact symbol still leads.
749
760
  return perpetuals.length ? [...perpetuals, ...listings] : listings;
@@ -860,7 +871,7 @@ export class GloomberbCloudProvider implements AssetDataProvider {
860
871
  // on its own, which finds them then; a board that does not answer leaves them out, as a search does.
861
872
  const found = queries.filter((query) => answers.get(query)?.length);
862
873
  const board = found.length
863
- ? await settleWithin(apiClient.getCloudPerpsBoard().catch(logFailure("sources.gloomberb-cloud.index", "Reading the perpetual board failed", null)), PERPETUAL_BOARD_WAIT_MS)
874
+ ? await settleWithin(this.perpetualBoards.read(apiClient).catch(logFailure("sources.gloomberb-cloud.index", "Reading the perpetual board failed", null)), PERPETUAL_BOARD_WAIT_MS)
864
875
  : null;
865
876
  if (!board) return answers;
866
877
  const client = boardSearchesFrom(board);
@@ -1,4 +1,5 @@
1
1
  import { apiClient } from "../../api-client";
2
+ import { logFailure } from "../../utils/log-failure";
2
3
  import type { PerpBoardPayload, PerpBoardRow, PerpMarketPayload } from "../../api-client/perps";
3
4
  import type { InstrumentSearchResult } from "../../types/instrument";
4
5
  import type { PricePoint, Quote } from "../../types/financials";
@@ -23,7 +24,7 @@ import { GLOOMBERB_CLOUD_PROVIDER_ID } from "./normalizers";
23
24
  * its history is Pro, as in PERP.
24
25
  */
25
26
 
26
- type PerpsClient = Pick<typeof apiClient, "getCloudPerpsMarket" | "getCloudPerpsBoard" | "getCloudPerpsHistory">;
27
+ type PerpsClient = Pick<typeof apiClient, "getCloudPerpsMarket" | "getCloudPerpsBoard" | "getCloudPerpsHistory"> & Partial<Pick<typeof apiClient, "hasSessionCredential" | "getSessionToken">>;
27
28
 
28
29
  /** What the history of a perpetual says to a free account, as PERP's History tab does. */
29
30
  export const PERPETUAL_HISTORY_LOCKED = "Full history requires Gloom Pro.";
@@ -207,6 +208,57 @@ export function boardSearchesFrom(board: PerpBoardPayload, client: PerpsClient =
207
208
  };
208
209
  }
209
210
 
211
+ /** How long the board a signed-out search reads stays in memory: a command lives for seconds, an open app for much longer. */
212
+ const SEARCH_BOARD_TTL_MS = 5 * 60_000;
213
+
214
+ /** Who a client is asking for: no one, the session it holds, or the browser's own cookie. The board differs between them. */
215
+ function boardAudience(client: PerpsClient): string {
216
+ if (!client.hasSessionCredential?.()) return "signed-out";
217
+ return client.getSessionToken?.() ?? "cookie";
218
+ }
219
+
220
+ /**
221
+ * The board without a search, read once while it is fresh and for whom it was read. A signed-out account's search is
222
+ * the preview rows that hold its word (`boardSearchesFrom`), so every search of a command costs this one request. A
223
+ * signed-in account's board is the whole of it, which only a list's searches (`searchBatch`) read. A provider holds
224
+ * one, so a process reads the board once however many symbols it looks up; signing in, out or into another account
225
+ * reads it again, since the rows a signed-out preview leaves out are the ones a Pro account is shown.
226
+ */
227
+ export class PerpetualBoardCache {
228
+ private kept: { readAt: number; audience: string; board: Promise<PerpBoardPayload> } | null = null;
229
+
230
+ read(client: PerpsClient = apiClient): Promise<PerpBoardPayload> {
231
+ const audience = boardAudience(client);
232
+ const kept = this.kept;
233
+ if (kept && kept.audience === audience && Date.now() - kept.readAt < SEARCH_BOARD_TTL_MS) return kept.board;
234
+ const entry = { readAt: Date.now(), audience, board: client.getCloudPerpsBoard({}) };
235
+ this.kept = entry;
236
+ void entry.board.catch(() => {
237
+ if (this.kept === entry) this.kept = null;
238
+ });
239
+ return entry.board;
240
+ }
241
+ }
242
+
243
+ /**
244
+ * The client a search asks the board with: a signed-out account's one-word search is answered from the board read
245
+ * once, with the rows the service would have sent; any other search goes to the service.
246
+ */
247
+ function searchBoardClient(client: PerpsClient, boards: PerpetualBoardCache): PerpsClient {
248
+ if (client.hasSessionCredential?.()) return client;
249
+ return {
250
+ getCloudPerpsMarket: client.getCloudPerpsMarket,
251
+ getCloudPerpsHistory: client.getCloudPerpsHistory,
252
+ getCloudPerpsBoard: async (query = {}) => {
253
+ const { search, ...rest } = query;
254
+ const word = search?.trim();
255
+ if (!word || /\s/.test(word) || Object.values(rest).some((value) => value !== undefined)) return client.getCloudPerpsBoard(query);
256
+ const board = await boards.read(client).catch(logFailure("sources.gloomberb-cloud.perpetuals", "Reading the perpetual board for a search failed", null));
257
+ return board ? boardSearchesFrom(board, client).getCloudPerpsBoard({ search: word }) : client.getCloudPerpsBoard(query);
258
+ },
259
+ };
260
+ }
261
+
210
262
  /** The one market a query names by its market id or listing key; null for a search. */
211
263
  const namedListing = (query: string) => typedPerpetualListing(query) ?? (query.includes(":") ? perpetualListing(query) : null);
212
264
 
@@ -224,7 +276,11 @@ const MAX_ALIAS_SEARCHES = 3;
224
276
  * Hyperliquid's BRENTOIL). A free account searches the board's preview, as
225
277
  * PERP's own search does, but can still name any one market.
226
278
  */
227
- export async function searchPerpetualMarkets(query: string, client: PerpsClient = apiClient): Promise<InstrumentSearchResult[]> {
279
+ export async function searchPerpetualMarkets(
280
+ query: string,
281
+ client: PerpsClient = apiClient,
282
+ cache: PerpetualBoardCache = new PerpetualBoardCache(),
283
+ ): Promise<InstrumentSearchResult[]> {
228
284
  const trimmed = query.trim();
229
285
  const named = namedListing(trimmed);
230
286
  if (named) {
@@ -252,8 +308,9 @@ export async function searchPerpetualMarkets(query: string, client: PerpsClient
252
308
  keep: (row: PerpBoardRow) => row.assetClass === assetClass && row.baseAsset.toUpperCase() === symbol,
253
309
  })),
254
310
  ];
311
+ const boardClient = searchBoardClient(client, cache);
255
312
  const boards = await Promise.all(searches.map(async ({ search, keep }) => {
256
- const board = await client.getCloudPerpsBoard({ search });
313
+ const board = await boardClient.getCloudPerpsBoard({ search });
257
314
  return (Array.isArray(board?.rows) ? board.rows : []).filter((row) => !row.delisted && keep(row));
258
315
  }));
259
316
  const seen = new Set<string>();
@@ -148,35 +148,42 @@ function isQuoteInActiveSession(quote: Quote, now: number): boolean {
148
148
  const OPENING_AUCTION_MS = 15 * 60_000;
149
149
 
150
150
  /**
151
- * Whether Gloom Cloud vouches that a delayed quote is current, however long
152
- * ago its last trade was. The service judges more than that trade's age: it
153
- * knows when it asked for the quote and how often the listing trades, so a
154
- * thinly traded listing's hour-old trade can be the current price while its
155
- * venue trades. Its verdict stands in for the age bound when:
151
+ * Whether Gloom Cloud vouches that a quote is current, however long ago its
152
+ * last trade was. The service judges more than that trade's age: it knows
153
+ * when it asked for the quote and how often the listing trades, so a thinly
154
+ * traded listing's hour-old trade can be the current price while its venue
155
+ * trades. Its verdict stands in for the age bound when:
156
156
  * - the service answered on this request, or a cache entry still inside its
157
157
  * TTL holds that answer (`recentAnswer`); a copy past the TTL is not vouched for;
158
158
  * - the answer says `stale: false`. One without the flag vouches for nothing,
159
159
  * and one flagged stale never gets this far;
160
- * - the quote is delayed. The service bounds a delayed quote's feed age itself
161
- * but not a real-time one's, so real-time quotes keep the age bound;
162
- * - it reports the regular session, the venue's session is in progress as
163
- * the delayed feed shows it, and the trade belongs to that session; a
164
- * currency pair's session is the service's to judge; or
165
160
  * - it reports a US extended-hours session and the trade is no older than
166
161
  * the regular session that session extends: after the close, today's
167
162
  * regular session or its after-hours; before the open, the previous
168
163
  * regular session or anything since. Whether the quote carries the
169
- * session's price is the freshness rule's call, made before this one.
164
+ * session's price is the freshness rule's call, made before this one. The
165
+ * service bounds an extended-hours print's age itself, real-time or
166
+ * delayed: past half an hour it asks the source again and keeps the print
167
+ * only when the source shows nothing has traded since. GS after hours on
168
+ * 16 Nov 2026 went more than ten minutes between trades, and its real-time
169
+ * quote was dropped as stuck, so the put screen had no price for it; or
170
+ * - the quote is delayed, it reports the regular session, the venue's
171
+ * session is in progress as the delayed feed shows it, and the trade
172
+ * belongs to that session; a currency pair's session is the service's to
173
+ * judge. The service bounds a delayed quote's feed age in the regular
174
+ * session but not a real-time one's, so there real-time quotes keep the
175
+ * age bound.
170
176
  * The answer says nothing about how often a listing trades, so a liquid
171
177
  * listing the service wrongly vouches for is accepted too. The service's own
172
178
  * bound for liquid listings, about twenty minutes, is tighter than this one.
173
179
  */
174
180
  function isVouchedCurrentByService(quote: Quote, exchange: string | undefined, now: number): boolean {
175
- if (quote.providerId !== "gloomberb-cloud" || quote.stale !== false || quote.dataSource !== "delayed") return false;
181
+ if (quote.providerId !== "gloomberb-cloud" || quote.stale !== false) return false;
182
+ if (quote.dataSource !== "live" && quote.dataSource !== "delayed") return false;
176
183
  if (quote.marketState === "PRE" || quote.marketState === "POST") {
177
184
  return isUsExtendedHoursSessionPrint(quote.lastUpdated, exchange, quote.marketState, now);
178
185
  }
179
- if (quote.marketState !== "REGULAR") return false;
186
+ if (quote.dataSource !== "delayed" || quote.marketState !== "REGULAR") return false;
180
187
  // A currency pair trades around the clock through the week, and the service
181
188
  // measures its silence against how often that pair prints: a pegged or
182
189
  // exotic pair such as SAR=X goes hours without a print while its feed is fine.
@@ -409,6 +409,10 @@ export class AssetDataRouter implements DataProvider {
409
409
  return this.searchRoutes.searchBatch(queries, options);
410
410
  }
411
411
 
412
+ knownUsStock(symbol: string): boolean {
413
+ return this.providersInPriorityOrder().some((provider) => provider.knownUsStock?.(symbol) === true);
414
+ }
415
+
412
416
  /** The first source that answers a batch of symbol changes; null when none can or it fails. */
413
417
  async getTickerChangesBatch(symbols: string[], options?: { signal?: AbortSignal }): Promise<Map<string, TickerChanges | null> | null> {
414
418
  const provider = this.providersInPriorityOrder().find((candidate) => candidate.getTickerChangesBatch);
@@ -36,6 +36,7 @@ function buildSearchCacheKey(query: string, context?: SearchRequestContext): str
36
36
  context?.brokerInstanceId ?? "",
37
37
  context?.brokerId ?? "",
38
38
  context?.limit ?? null,
39
+ context?.perpetuals ?? "",
39
40
  ]);
40
41
  }
41
42
 
@@ -24,7 +24,7 @@ import {
24
24
  } from "./analytics-payload";
25
25
  import { idEntries } from "./broker-instances";
26
26
  import { CORE_CONFIG_CONTRIBUTOR_ID, log } from "./config-contributor";
27
- import { sanitizePortfolio, sanitizeWatchlist, WATCHLISTS_CARRY_GROUPS } from "./sanitize";
27
+ import { PORTFOLIOS_CARRY_OTHER_CASH, sanitizePortfolio, sanitizeWatchlist, WATCHLISTS_CARRY_GROUPS } from "./sanitize";
28
28
  import {
29
29
  lastSyncedTickersById,
30
30
  latestBrokerPortfolioSyncs,
@@ -55,6 +55,8 @@ export function collectCoreCollectionsPayload(
55
55
  baseCurrency: config.baseCurrency,
56
56
  exchangeRates: { USD: 1 },
57
57
  portfolios: config.portfolios.map(sanitizePortfolio),
58
+ // The portfolios carry their cash in other currencies, as the config payload's do.
59
+ [PORTFOLIOS_CARRY_OTHER_CASH]: true,
58
60
  watchlists: config.watchlists.map(sanitizeWatchlist),
59
61
  // The lists carry their groups, as the config payload's do: a reader can tell a list without them from an older build's.
60
62
  [WATCHLISTS_CARRY_GROUPS]: true,