@gloom-sh/terminal 0.20.17 → 0.20.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) 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/cot.ts +5 -6
  7. package/src/api-client/data.ts +14 -3
  8. package/src/api-client/heard-from.ts +72 -0
  9. package/src/api-client/index.ts +64 -6
  10. package/src/api-client/mna.ts +18 -0
  11. package/src/api-client/request.ts +162 -40
  12. package/src/api-client/supply-chain.ts +9 -0
  13. package/src/api-client/types/billing.ts +35 -1
  14. package/src/api-client/types/news.ts +45 -0
  15. package/src/api-client/types/world-venues.ts +9 -0
  16. package/src/app/global-shortcuts.ts +5 -3
  17. package/src/app/pro-welcome/keys.ts +27 -0
  18. package/src/app/pro-welcome/model.ts +158 -0
  19. package/src/app/pro-welcome/row.tsx +176 -0
  20. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  21. package/src/app/runtime/external-profile-changes.ts +135 -0
  22. package/src/app.tsx +37 -4
  23. package/src/architecture/core-builtin-allowlist.json +1 -1
  24. package/src/architecture/floating-promise-allowlist.json +1 -2
  25. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  26. package/src/cli/alert-listing.ts +98 -0
  27. package/src/cli/commands/market.ts +191 -39
  28. package/src/cli/commands/overview.ts +7 -1
  29. package/src/cli/commands/plugins.ts +3 -2
  30. package/src/cli/commands/search.ts +30 -6
  31. package/src/cli/commands/ticker.ts +13 -6
  32. package/src/cli/context.ts +24 -5
  33. package/src/cli/csv-export.ts +2 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +3 -1
  35. package/src/cli/desktop-pane-shot-view.ts +0 -1
  36. package/src/cli/desktop-pane-shot.ts +276 -52
  37. package/src/cli/errors.ts +3 -9
  38. package/src/cli/exit-codes.ts +1 -1
  39. package/src/cli/glossary.ts +65 -11
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/history-demergers.ts +117 -0
  42. package/src/cli/history-rows.ts +8 -4
  43. package/src/cli/index.ts +2 -1
  44. package/src/cli/known-gaps.ts +16 -0
  45. package/src/cli/known-us-stocks.ts +18 -0
  46. package/src/cli/listing-arg.ts +192 -38
  47. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  48. package/src/cli/pane-functions/catalog-snapshot.json +877 -0
  49. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  50. package/src/cli/pane-functions/catalog.ts +50 -16
  51. package/src/cli/pane-functions/data.ts +16 -4
  52. package/src/cli/pane-functions/dom.ts +54 -8
  53. package/src/cli/pane-functions/freshness.ts +39 -4
  54. package/src/cli/pane-functions/function-help.ts +3 -3
  55. package/src/cli/pane-functions/headless.ts +9 -1
  56. package/src/cli/pane-functions/index.ts +175 -50
  57. package/src/cli/pane-functions/report-notices.ts +10 -0
  58. package/src/cli/pane-functions/resolver.ts +11 -7
  59. package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
  60. package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
  61. package/src/cli/pane-functions/screenshot-payload.ts +36 -1
  62. package/src/cli/pane-functions/screenshot-render.ts +24 -9
  63. package/src/cli/pane-functions/screenshot-types.ts +9 -0
  64. package/src/cli/quote-answer.ts +33 -17
  65. package/src/cli/registry.ts +22 -2
  66. package/src/cli/result.ts +22 -4
  67. package/src/cli/scroll-truncation.ts +7 -2
  68. package/src/cli/series-search.ts +45 -6
  69. package/src/cli/shot-temp-dir.ts +4 -9
  70. package/src/cli/ticker-resolution.ts +1 -1
  71. package/src/cli/unreachable.ts +21 -0
  72. package/src/components/chart/composite/drawing-store.ts +11 -7
  73. package/src/components/chart/composite/format.ts +1 -0
  74. package/src/components/chart/composite/legend.tsx +48 -20
  75. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  76. package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
  77. package/src/components/chart/composite/panel-surface.tsx +1 -1
  78. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  79. package/src/components/chart/composite/tools.ts +164 -39
  80. package/src/components/chart-table/header.tsx +11 -2
  81. package/src/components/chart-table/layout.ts +16 -17
  82. package/src/components/command-bar/pane-templates/items.ts +17 -1
  83. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  84. package/src/components/command-bar/routes/root/results.ts +34 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +19 -4
  86. package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
  87. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  88. package/src/components/command-bar/selection-runtime.ts +29 -5
  89. package/src/components/command-bar/surface/index.tsx +4 -1
  90. package/src/components/command-bar/workflow/alert.ts +32 -13
  91. package/src/components/data-table/view.tsx +15 -2
  92. package/src/components/form-modal/content.tsx +9 -4
  93. package/src/components/index.ts +1 -1
  94. package/src/components/layout/header.tsx +9 -5
  95. package/src/components/layout/pane/capture-status.ts +6 -0
  96. package/src/components/layout/pane/footer/index.tsx +2 -0
  97. package/src/components/layout/pane/footer/model.ts +123 -17
  98. package/src/components/layout/pane/header.tsx +16 -2
  99. package/src/components/layout/pane/status-footer.ts +24 -0
  100. package/src/components/market-board/index.tsx +4 -2
  101. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  102. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  103. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  104. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  105. package/src/components/onboarding/setup-cards.ts +36 -0
  106. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  107. package/src/components/onboarding/wizard-account.ts +6 -1
  108. package/src/components/onboarding/wizard-model.ts +32 -6
  109. package/src/components/onboarding/wizard-positions.ts +1 -1
  110. package/src/components/price-performance.tsx +26 -8
  111. package/src/components/reader/article-reader.tsx +12 -5
  112. package/src/components/sign-in-gate.tsx +3 -1
  113. package/src/components/toggle-list.tsx +6 -8
  114. package/src/components/ui/confirm-dialog.tsx +47 -7
  115. package/src/components/ui/data-table/opentui/index.tsx +7 -0
  116. package/src/components/ui/data-table/types.ts +8 -0
  117. package/src/components/ui/display.tsx +17 -2
  118. package/src/components/ui/index.ts +1 -1
  119. package/src/components/ui/stat-grid.tsx +4 -0
  120. package/src/components/ui/status.tsx +13 -1
  121. package/src/components/ui/table-layout.ts +34 -2
  122. package/src/components/use-pane-notice-footer.tsx +16 -3
  123. package/src/data/config/store/index.ts +31 -0
  124. package/src/data/config/store/node.ts +61 -11
  125. package/src/data/config/store/normalize.ts +4 -6
  126. package/src/data/config/store/shared-file.ts +309 -0
  127. package/src/data/profile-merge.ts +299 -0
  128. package/src/data/sqlite/checkpointer.ts +11 -1
  129. package/src/data/sqlite/database.ts +1 -1
  130. package/src/data/ticker-repository.ts +134 -10
  131. package/src/data/ticker-store.ts +67 -0
  132. package/src/data/ticker-writes.ts +5 -0
  133. package/src/i18n/es.ts +27 -0
  134. package/src/i18n/ja.ts +27 -0
  135. package/src/i18n/ko.ts +27 -0
  136. package/src/i18n/zh-cn.ts +27 -0
  137. package/src/i18n/zh-tw.ts +27 -0
  138. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  139. package/src/market-data/ah-pair.ts +122 -0
  140. package/src/market-data/coordinator/entries.ts +6 -4
  141. package/src/market-data/coordinator/index.ts +14 -3
  142. package/src/market-data/depositary-pair.ts +6 -2
  143. package/src/market-data/futures-board.ts +36 -29
  144. package/src/market-data/futures-contract.ts +37 -1
  145. package/src/market-data/hooks.tsx +33 -2
  146. package/src/market-data/market/change-basis.ts +11 -1
  147. package/src/market-data/market/header-market.ts +11 -0
  148. package/src/market-data/market/status.ts +40 -4
  149. package/src/market-data/performance.ts +127 -32
  150. package/src/market-data/quotes/time.ts +5 -2
  151. package/src/market-data/split-terms.ts +28 -0
  152. package/src/news/types.ts +28 -0
  153. package/src/notifications/app-badge.ts +2 -3
  154. package/src/notifications/app-notifier.ts +5 -0
  155. package/src/plugins/builtin/account-management/footer.ts +1 -1
  156. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  157. package/src/plugins/builtin/account-management/model.ts +1 -0
  158. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  159. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  160. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  161. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  162. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  163. package/src/plugins/builtin/alerts/cli.ts +101 -48
  164. package/src/plugins/builtin/alerts/command.ts +39 -9
  165. package/src/plugins/builtin/alerts/constants.ts +10 -0
  166. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  167. package/src/plugins/builtin/alerts/event-rows.ts +9 -3
  168. package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
  169. package/src/plugins/builtin/alerts/format.ts +24 -8
  170. package/src/plugins/builtin/alerts/headless.ts +12 -6
  171. package/src/plugins/builtin/alerts/index.tsx +97 -16
  172. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  173. package/src/plugins/builtin/alerts/option-contract.ts +197 -0
  174. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  175. package/src/plugins/builtin/alerts/price.ts +30 -5
  176. package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
  177. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  178. package/src/plugins/builtin/alerts/research-builder.ts +5 -10
  179. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  180. package/src/plugins/builtin/alerts/types.ts +7 -0
  181. package/src/plugins/builtin/analytics/account-returns.ts +1 -1
  182. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  183. package/src/plugins/builtin/analytics/pane-model.ts +2 -2
  184. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  185. package/src/plugins/builtin/analytics/risk-client.ts +27 -14
  186. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  187. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  188. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  189. package/src/plugins/builtin/awards/pane.tsx +1 -1
  190. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  191. package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
  192. package/src/plugins/builtin/catalysts/model.ts +2 -1
  193. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  194. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  195. package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
  196. package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
  197. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  198. package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
  199. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  200. package/src/plugins/builtin/chart-composer/index.tsx +17 -5
  201. package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
  202. package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
  203. package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
  204. package/src/plugins/builtin/chat/index.tsx +0 -1
  205. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  206. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  207. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  208. package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
  209. package/src/plugins/builtin/company-kpis/headless.ts +10 -5
  210. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  211. package/src/plugins/builtin/company-kpis/model.ts +57 -15
  212. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  213. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  214. package/src/plugins/builtin/composite/application.ts +14 -0
  215. package/src/plugins/builtin/composite/broker.ts +12 -0
  216. package/src/plugins/builtin/composite/credit.ts +33 -0
  217. package/src/plugins/builtin/composite/crypto.ts +10 -0
  218. package/src/plugins/builtin/composite/earnings.ts +12 -0
  219. package/src/plugins/builtin/composite/filings.ts +13 -0
  220. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  221. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  222. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  223. package/src/plugins/builtin/composite/ownership.ts +23 -0
  224. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  225. package/src/plugins/builtin/composite/quant.ts +15 -0
  226. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  227. package/src/plugins/builtin/composite/screeners.ts +11 -0
  228. package/src/plugins/builtin/composite/shared.ts +11 -0
  229. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  230. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  231. package/src/plugins/builtin/congress-trades/model.ts +9 -5
  232. package/src/plugins/builtin/correlation/index.tsx +13 -17
  233. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  234. package/src/plugins/builtin/cot/client.ts +2 -3
  235. package/src/plugins/builtin/cot/headless.ts +16 -16
  236. package/src/plugins/builtin/cot/index.tsx +6 -6
  237. package/src/plugins/builtin/cot/model.ts +25 -5
  238. package/src/plugins/builtin/cot/pane.tsx +11 -6
  239. package/src/plugins/builtin/cot/series.ts +11 -8
  240. package/src/plugins/builtin/cpi/model.ts +15 -4
  241. package/src/plugins/builtin/cpi/pane.tsx +29 -7
  242. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  243. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  244. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  245. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  246. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  247. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  248. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  249. package/src/plugins/builtin/doe/model.ts +30 -0
  250. package/src/plugins/builtin/doe/pane.tsx +8 -2
  251. package/src/plugins/builtin/earnings/board-table.ts +9 -4
  252. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  253. package/src/plugins/builtin/earnings/headless.ts +16 -6
  254. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  255. package/src/plugins/builtin/earnings/history-table.ts +7 -4
  256. package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
  257. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  258. package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
  259. package/src/plugins/builtin/econ/calendar-model.ts +16 -0
  260. package/src/plugins/builtin/econ/index.tsx +7 -2
  261. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  262. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  263. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  264. package/src/plugins/builtin/exposure/model.ts +10 -0
  265. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  266. package/src/plugins/builtin/futures/model.ts +14 -1
  267. package/src/plugins/builtin/futures/series.ts +1 -8
  268. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  269. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  270. package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
  271. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  272. package/src/plugins/builtin/insider/detail.tsx +36 -7
  273. package/src/plugins/builtin/insider/filing-stories.ts +110 -0
  274. package/src/plugins/builtin/insider/headless.ts +37 -2
  275. package/src/plugins/builtin/insider/index.tsx +79 -10
  276. package/src/plugins/builtin/insider/model.ts +43 -5
  277. package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
  278. package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
  279. package/src/plugins/builtin/jobs/headless.ts +2 -1
  280. package/src/plugins/builtin/jobs/model.ts +6 -0
  281. package/src/plugins/builtin/jobs/pane.tsx +8 -3
  282. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  283. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  284. package/src/plugins/builtin/mna/detail.tsx +67 -6
  285. package/src/plugins/builtin/mna/headless.ts +128 -13
  286. package/src/plugins/builtin/mna/model.ts +219 -16
  287. package/src/plugins/builtin/mna/pane.tsx +34 -6
  288. package/src/plugins/builtin/money-markets/model.ts +14 -5
  289. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  290. package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
  291. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  292. package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
  293. package/src/plugins/builtin/options/analytics.ts +1 -1
  294. package/src/plugins/builtin/options/view.tsx +18 -11
  295. package/src/plugins/builtin/options-positioning/model.ts +11 -0
  296. package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
  297. package/src/plugins/builtin/options-scenario/client.ts +49 -8
  298. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  299. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  300. package/src/plugins/builtin/options-scenario/headless.ts +7 -3
  301. package/src/plugins/builtin/options-scenario/model.ts +33 -2
  302. package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
  303. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  304. package/src/plugins/builtin/pe-band/client.ts +13 -1
  305. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  306. package/src/plugins/builtin/pe-band/model.ts +63 -10
  307. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  308. package/src/plugins/builtin/perps/cascade.ts +4 -3
  309. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  310. package/src/plugins/builtin/perps/model.ts +4 -3
  311. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  312. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  313. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  314. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  315. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  316. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  317. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  318. package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
  319. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  320. package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
  321. package/src/plugins/builtin/research/event-model.ts +43 -19
  322. package/src/plugins/builtin/research/headless.ts +8 -1
  323. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  324. package/src/plugins/builtin/research-search/index.tsx +3 -1
  325. package/src/plugins/builtin/scanner/denied.tsx +16 -4
  326. package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
  327. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  328. package/src/plugins/builtin/sec/filing-display.tsx +14 -2
  329. package/src/plugins/builtin/sec/headless.ts +42 -4
  330. package/src/plugins/builtin/sec/index.tsx +21 -1
  331. package/src/plugins/builtin/sectors/index.tsx +6 -9
  332. package/src/plugins/builtin/sectors/sector-model.ts +1 -1
  333. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  334. package/src/plugins/builtin/shared/earnings-report.ts +49 -5
  335. package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
  336. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  337. package/src/plugins/builtin/shared/statement-currency.ts +23 -0
  338. package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
  339. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  340. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  341. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  342. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  343. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  344. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  345. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  346. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  347. package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
  348. package/src/plugins/builtin/themes/headless.ts +4 -4
  349. package/src/plugins/builtin/themes/model.ts +11 -8
  350. package/src/plugins/builtin/themes/pane.tsx +2 -2
  351. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  352. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  353. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
  354. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
  355. package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
  356. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
  357. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
  358. package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
  359. package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
  360. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
  361. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
  362. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
  363. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  364. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  365. package/src/plugins/builtin/volatility/model.ts +17 -0
  366. package/src/plugins/builtin/volatility/pane.tsx +16 -7
  367. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  368. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  369. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  370. package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
  371. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  372. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  373. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  374. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  375. package/src/plugins/builtin/world-venue-map/model.ts +6 -1
  376. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  377. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  378. package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
  379. package/src/plugins/catalog-browser.ts +10 -1
  380. package/src/plugins/catalog-data.ts +20 -0
  381. package/src/plugins/catalog-lazy.ts +51 -0
  382. package/src/plugins/catalog-ui.ts +16 -18
  383. package/src/plugins/host-smoke.ts +5 -2
  384. package/src/portfolio/allocation.ts +79 -19
  385. package/src/portfolio/cash-balances.ts +76 -0
  386. package/src/portfolio/mutations.ts +43 -8
  387. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  388. package/src/renderers/browser/activity.ts +16 -0
  389. package/src/renderers/browser/app-badge-host.ts +14 -0
  390. package/src/renderers/browser/main.tsx +5 -0
  391. package/src/renderers/browser/notifications.ts +103 -0
  392. package/src/renderers/browser/ui-host.tsx +4 -0
  393. package/src/renderers/desktop/window-layouts.ts +14 -0
  394. package/src/renderers/dom/data-table/index.tsx +27 -4
  395. package/src/renderers/dom/data-table/row.tsx +2 -0
  396. package/src/renderers/dom/host/tabs.tsx +57 -8
  397. package/src/renderers/dom/styles.css +13 -5
  398. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  399. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  400. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  401. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  402. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  403. package/src/renderers/electrobun/view/http-fetch.ts +3 -2
  404. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  405. package/src/series/standalone-catalog.ts +5 -4
  406. package/src/series/standalone.ts +13 -7
  407. package/src/sources/gloomberb-cloud/index.ts +22 -9
  408. package/src/sources/gloomberb-cloud/news.ts +35 -0
  409. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  410. package/src/sources/provider-errors.ts +34 -7
  411. package/src/sources/provider-router/financials.ts +20 -13
  412. package/src/sources/provider-router/history.ts +32 -6
  413. package/src/sources/provider-router/index.ts +4 -0
  414. package/src/sources/provider-router/search.ts +1 -0
  415. package/src/sync/collections-contributor.ts +3 -1
  416. package/src/sync/config-merge.ts +10 -1
  417. package/src/sync/sanitize.ts +26 -2
  418. package/src/tickers/company-name-listing.ts +16 -2
  419. package/src/tickers/listing-fate.ts +12 -8
  420. package/src/tickers/renamed-listings.ts +43 -10
  421. package/src/tickers/search/home-listing.ts +28 -0
  422. package/src/tickers/search/index.ts +19 -7
  423. package/src/tickers/terminal-codes.ts +11 -1
  424. package/src/time-series/base-series.ts +39 -6
  425. package/src/time-series/chart-seed.ts +2 -2
  426. package/src/time-series/history-quality.ts +4 -1
  427. package/src/time-series/hooks.ts +2 -0
  428. package/src/time-series/price-comparison.ts +17 -23
  429. package/src/time-series/reporting.ts +1 -1
  430. package/src/time-series/resolution.ts +13 -0
  431. package/src/time-series/resolve-context.ts +6 -0
  432. package/src/time-series/resolve.ts +42 -3
  433. package/src/time-series/spec.ts +2 -2
  434. package/src/time-series/types.ts +3 -2
  435. package/src/types/data-provider.ts +11 -0
  436. package/src/types/financials.ts +48 -4
  437. package/src/types/headless.ts +1 -0
  438. package/src/types/issuer-listings.ts +2 -0
  439. package/src/types/plugin-notifications.ts +3 -0
  440. package/src/types/price-history.ts +6 -4
  441. package/src/types/ticker.ts +10 -2
  442. package/src/ui/host.tsx +2 -0
  443. package/src/utils/cli-output.ts +1 -1
  444. package/src/utils/declared-dividends.ts +13 -1
  445. package/src/utils/dividend-cash.ts +5 -1
  446. package/src/utils/exchange-announcements.ts +7 -2
  447. package/src/utils/forward-dividend.ts +4 -3
  448. package/src/utils/fundamentals.ts +40 -0
  449. package/src/utils/network-failure.ts +2 -0
  450. package/src/utils/price-history-integrity.ts +9 -1
  451. package/src/utils/remove-folder.ts +37 -0
  452. package/src/utils/trailing-dividend.ts +1 -1
  453. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -1,5 +1,5 @@
1
1
  import { statGridRows, type StatItem } from "../ui/stat-grid";
2
- import { getTableWidth, hasMeaningfulTableHorizontalOverflow, type TableWidthColumn } from "../ui/table-layout";
2
+ import { getTableWidth, hasMeaningfulTableHorizontalOverflow, hiddenTableColumnRows, type TableWidthColumn } from "../ui/table-layout";
3
3
 
4
4
  /** Drop optional columns in priority order, using the same widths as the table. */
5
5
  export function fitChartTableColumns<C extends TableWidthColumn & { id: string }>(
@@ -29,18 +29,16 @@ const TABLE_MIN_BODY_ROWS = 4;
29
29
  const CHART_SHARE = 0.4;
30
30
  /** Below this many body rows the figures keep a single row. */
31
31
  const SHORT_BODY_ROWS = 12;
32
- /** The figures never take more than this share of the body. */
33
32
  const FIGURE_SHARE = 0.25;
34
33
  /** The share of the body figures that wrap rather than cut a date may take, beyond FIGURE_SHARE. */
35
34
  const WRAPPED_FIGURE_SHARE = 1 / 3;
36
35
 
37
36
  /**
38
- * The rows a kit table spends outside its body: the header, plus a horizontal
39
- * scrollbar when its columns are wider than the pane (less the vertical
40
- * scrollbar's column).
37
+ * The rows a kit table spends outside its body: the header, a hidden-column
38
+ * disclosure, and a horizontal scrollbar when its columns are wider than the pane.
41
39
  */
42
- export function chartTableChromeRows(columns: readonly TableWidthColumn[], width: number): number {
43
- return hasMeaningfulTableHorizontalOverflow(getTableWidth(columns), width - 1) ? 2 : 1;
40
+ export function chartTableChromeRows(columns: readonly TableWidthColumn[], width: number, tableRows = 1): number {
41
+ return 1 + hiddenTableColumnRows(columns, tableRows) + Number(hasMeaningfulTableHorizontalOverflow(getTableWidth(columns), width - 1));
44
42
  }
45
43
 
46
44
  /**
@@ -96,7 +94,10 @@ function figureRows(figures: readonly StatItem[], width: number, maxLines: numbe
96
94
  */
97
95
  function fitFigures(figures: readonly StatItem[], width: number, maxRows: number, body: number): { figures: StatItem[]; maxLines: number } {
98
96
  const kept = [...figures];
99
- while (kept.length > 0 && figureRows(kept, width, maxRows) > maxRows) kept.pop();
97
+ while (kept.length > 0 && figureRows(kept, width, maxRows) > maxRows) {
98
+ const optional = kept.findLastIndex((item) => item.essential !== true);
99
+ kept.splice(optional >= 0 ? optional : kept.length - 1, 1);
100
+ }
100
101
  return { figures: kept, maxLines: maxRows > 1 ? Math.max(maxRows, Math.floor(body * WRAPPED_FIGURE_SHARE)) : maxRows };
101
102
  }
102
103
 
@@ -106,23 +107,19 @@ function fitFigures(figures: readonly StatItem[], width: number, maxRows: number
106
107
  *
107
108
  * - The table always keeps its header and a few rows (all of them when it has
108
109
  * fewer), so the rows the pane is about never vanish.
109
- * - The figures take at most a quarter of the body, one row when it is short
110
- * or when a second row would cost the chart its place, and lose items from
111
- * the end rather than spill; a whole-row figure wraps onto a second line
112
- * rather than cut its detail, in rows up to a third of the body, never
113
- * at the cost of a figure that fits a line.
114
110
  * - The chart takes 40% of what is left, or everything the table does not
115
111
  * need when all its rows fit, so no blank band opens under a short table.
116
112
  * - Below a readable chart the band becomes a one-row strip, then nothing.
117
113
  */
118
114
  export function chartTableLayout(input: ChartTableLayoutInput): ChartTableLayout {
119
115
  const body = Math.max(0, Math.floor(input.height) - (input.queryRows ?? 0));
120
- const figureCap = body < SHORT_BODY_ROWS ? 1 : Math.max(1, Math.floor(body * FIGURE_SHARE));
116
+ const essential = (input.figures ?? []).filter((item) => item.essential === true);
117
+ const essentialRows = figureRows(essential, input.width, body);
118
+ const figureCap = Math.max(essentialRows, body < SHORT_BODY_ROWS ? 1 : Math.max(1, Math.floor(body * FIGURE_SHARE)));
121
119
  const layout = layoutWithFigureRows(input, body, figureCap);
122
- // A readable chart is worth more than a second row of figures.
123
120
  if (layout.mode !== "full" && layout.figureRows > 1) {
124
121
  const tighter = layoutWithFigureRows(input, body, 1);
125
- if (tighter.mode === "full") return tighter;
122
+ if (tighter.mode === "full" && essential.every((item) => tighter.figures.includes(item))) return tighter;
126
123
  }
127
124
  // Without a full chart, rows a short table leaves go back to figures that
128
125
  // were dropped, rather than to a blank band under the table.
@@ -145,7 +142,9 @@ function layoutWithFigureRows(input: ChartTableLayoutInput, body: number, figure
145
142
  const tableFit = chrome + tableRows;
146
143
 
147
144
  // A table with no room for a single row after the figures gets the body back.
148
- const figureBudget = Math.min(figureCap, Math.max(0, body - chrome - Math.min(tableRows, 1)));
145
+ const essentialRows = figureRows((input.figures ?? []).filter((item) => item.essential === true), width, body);
146
+ const figureBudget = Math.min(figureCap, Math.max(0, body - tableMin,
147
+ Math.min(Math.max(1, essentialRows), body - chrome - Math.min(tableRows, 1))));
149
148
  const { figures, maxLines: figureMaxLines } = figureBudget > 0 ? fitFigures(input.figures ?? [], width, figureBudget, body) : { figures: [], maxLines: 0 };
150
149
  const shownRows = figures.length ? figureRows(figures, width, figureMaxLines) : 0;
151
150
 
@@ -5,6 +5,7 @@ import type {
5
5
  PaneTemplateDef,
6
6
  ShortcutArgError,
7
7
  } from "../../../types/plugin";
8
+ import { glossaryNamesFunction } from "../../../cli/glossary";
8
9
  import { fuzzyFilter } from "../../../utils/fuzzy-search";
9
10
  import { discoveryOpening } from "../../../utils/lookup-token";
10
11
  import { summarizeError } from "../helpers";
@@ -295,6 +296,20 @@ function paneTemplateDiscovery(template: PaneTemplateDef, registry: Pick<PluginR
295
296
  return (template.headless ?? registry.panes?.get(template.paneId)?.headless)?.discovery;
296
297
  }
297
298
 
299
+ /**
300
+ * A row found by a query that is, whole, a term its function shows (`var`,
301
+ * `value at risk` for MARS and PORT), as `catalog` finds it, where the row's
302
+ * own words do not carry the query already; those rank as they did. A word of
303
+ * a longer query, or a loose alias, finds nothing.
304
+ */
305
+ function withShownTerm(item: ResultItem, template: PaneTemplateDef, query: string): ResultItem {
306
+ const codes = [template.shortcut?.prefix, ...template.shortcut?.aliases ?? []];
307
+ if (!codes.some((code) => !!code && glossaryNamesFunction(code, query))) return item;
308
+ const own = `${item.label} ${item.searchText ?? ""} ${item.detail} ${item.right ?? ""}`.toLowerCase();
309
+ if (query.toLowerCase().split(/\s+/).every((word) => own.includes(word))) return item;
310
+ return { ...item, searchText: `${query} ${item.searchText ?? ""}` };
311
+ }
312
+
298
313
  export function buildPaneShortcutItems(options: {
299
314
  templates: readonly PaneTemplateDef[];
300
315
  filterQuery?: string;
@@ -328,7 +343,8 @@ export function buildPaneShortcutItems(options: {
328
343
  : options.createOptions,
329
344
  showShortcut: true,
330
345
  });
331
- return opening && opening.argument && !item.disabled ? { ...item, name: opening.argument } : item;
346
+ const named = opening && opening.argument && !item.disabled ? { ...item, name: opening.argument } : item;
347
+ return query ? withShownTerm(named, template, query) : named;
332
348
  });
333
349
 
334
350
  return options.filterQuery
@@ -77,8 +77,9 @@ function buildInstantAnswer(options: {
77
77
  savedSymbolKeys: ReadonlySet<string>;
78
78
  buildTickerSearchResultItems: (candidates: TickerSearchCandidate[], query: string) => ResultItem[];
79
79
  localTickerSearchResultItems: (query?: string, options?: { category?: string; limit?: number }) => ResultItem[];
80
+ homeVenue?: string | null;
80
81
  }): InstantAnswer | null {
81
- const { query, fromIndex, cached, tickers, savedSymbolKeys, buildTickerSearchResultItems, localTickerSearchResultItems } = options;
82
+ const { query, fromIndex, cached, tickers, savedSymbolKeys, buildTickerSearchResultItems, localTickerSearchResultItems, homeVenue } = options;
82
83
  const localItems = () => localTickerSearchResultItems(query, { limit: 6 });
83
84
  if (cached) {
84
85
  return { query, items: mergeTickerSearchResultItems(query, buildTickerSearchResultItems(withMajorCoinCandidate(query, cached, tickers), query), localItems()), fromIndex: false };
@@ -92,6 +93,7 @@ function buildInstantAnswer(options: {
92
93
  tickers,
93
94
  providerResults: known,
94
95
  totalLimit: LISTING_SEARCH_LIMIT,
96
+ homeVenue,
95
97
  ...QUICK_LOOK_TICKER_SEARCH_OPTIONS,
96
98
  }), tickers);
97
99
  if (candidates.length === 0) return null;
@@ -133,6 +135,8 @@ export function useRootProviderSearch(options: {
133
135
  categoryPriorities?: CommandBarCategoryPriorities;
134
136
  currentRoute: CommandBarRoute | null;
135
137
  dataProvider: DataProvider;
138
+ /** The venue of the user's own market, whose lines of the company a word names lead (`withHomeVenueLead`). */
139
+ homeVenue?: string | null;
136
140
  localTickerSearchResultItems: (query?: string, options?: { category?: string; limit?: number }) => ResultItem[];
137
141
  portfolios: AppState["config"]["portfolios"];
138
142
  readTickerSearchCache: (
@@ -177,6 +181,7 @@ export function useRootProviderSearch(options: {
177
181
  categoryPriorities,
178
182
  currentRoute,
179
183
  dataProvider,
184
+ homeVenue = null,
180
185
  localTickerSearchResultItems,
181
186
  portfolios,
182
187
  readTickerSearchCache,
@@ -218,11 +223,13 @@ export function useRootProviderSearch(options: {
218
223
  savedSymbolKeys,
219
224
  buildTickerSearchResultItems,
220
225
  localTickerSearchResultItems,
226
+ homeVenue,
221
227
  });
222
228
  // The index is read inside; its version says when what it knows changed.
223
229
  }, [
224
230
  buildTickerSearchResultItems,
225
231
  currentRoute,
232
+ homeVenue,
226
233
  listingIndexVersion,
227
234
  listingSuffix,
228
235
  localTickerSearchResultItems,
@@ -311,6 +318,7 @@ export function useRootProviderSearch(options: {
311
318
  },
312
319
  // The rows the CLI reads a symbol's listings from, so `CAR:` offers CAR Group on ASX (its eleventh).
313
320
  totalLimit: LISTING_SEARCH_LIMIT,
321
+ homeVenue,
314
322
  ...QUICK_LOOK_TICKER_SEARCH_OPTIONS,
315
323
  }));
316
324
  if (requestId !== rootSearchRequestIdRef.current) return;
@@ -339,6 +347,7 @@ export function useRootProviderSearch(options: {
339
347
  buildTickerSearchResultItems,
340
348
  currentRoute,
341
349
  dataProvider,
350
+ homeVenue,
342
351
  localTickerSearchResultItems,
343
352
  rootTickerSearchArg,
344
353
  searchBrokerId,
@@ -15,6 +15,9 @@ import {
15
15
  import { matchPrefix, type Command } from "../../commands/registry";
16
16
  import { pastedRootList } from "../../commands/collection-list";
17
17
  import { isCollectionCommand, SECURITY_DESCRIPTION_SEARCH } from "../../helpers";
18
+
19
+ /** A command's code that is a ticker's shape too: letters, as a US listing's symbol is written. */
20
+ const TICKER_SHAPED_CODE = /^[A-Z]{1,5}$/;
18
21
  import { recentPaneTemplateArg } from "../../pane-templates/items";
19
22
  import { dedupeById, PASTED_LIST_CATEGORY } from "../../view-model";
20
23
  import type { ResultItem } from "../../list/model";
@@ -109,6 +112,27 @@ export interface RootResultModelOptions {
109
112
  tickerActionItems: () => ResultItem[];
110
113
  }
111
114
 
115
+ /**
116
+ * The row that opens a function's code as a ticker instead (`FB as a ticker`,
117
+ * `CATL as a ticker`): the security search for the code. Null for a code no
118
+ * ticker is written like, or with no security search to open.
119
+ */
120
+ function tickerCodeItem(
121
+ code: string,
122
+ availableCommands: Command[],
123
+ openModeRoute: RootResultModelOptions["openModeRoute"],
124
+ ): ResultItem | null {
125
+ if (!TICKER_SHAPED_CODE.test(code) || !availableCommands.some((command) => command.id === "security-description")) return null;
126
+ return {
127
+ id: `ticker-code:${code}`,
128
+ label: `${code} as a ticker`,
129
+ detail: "Open security details after resolving a ticker",
130
+ category: "Search",
131
+ kind: "command",
132
+ action: () => openModeRoute("ticker-search", code, SECURITY_DESCRIPTION_SEARCH),
133
+ };
134
+ }
135
+
112
136
  /** An in-flight or answered request keeps its rows even if the heuristic lapses. */
113
137
  function isAssistSectionVisible(
114
138
  assist: AssistRowHandlers,
@@ -340,13 +364,17 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
340
364
  }))
341
365
  : [shortcutItem];
342
366
  shortcutRuns = templateItems.some((item) => !item.disabled);
343
- const relatedTemplateItems = rootQuery.trim().toUpperCase() === rootShortcutIntent.prefix
367
+ const codeAlone = rootQuery.trim().toUpperCase() === rootShortcutIntent.prefix;
368
+ const relatedTemplateItems = codeAlone
344
369
  ? paneShortcutItems({
345
370
  filterQuery: rootQuery,
346
371
  includePromptableTickerTemplates: true,
347
372
  })
348
373
  : [];
349
- items.push(...templateItems, ...relatedTemplateItems);
374
+ // CATL is Catalysts and CATL's own name for itself, as FB is Send Feedback and a ticker: the listing is the
375
+ // row under the function, which Enter still opens.
376
+ const tickerItem = codeAlone ? tickerCodeItem(rootShortcutIntent.prefix, availableCommands, openModeRoute) : null;
377
+ items.push(...templateItems, ...(tickerItem ? [tickerItem] : []), ...relatedTemplateItems);
350
378
  } else if (
351
379
  rootShortcutIntent.kind !== "none"
352
380
  && rootShortcutIntent.source === "plugin-command"
@@ -392,6 +420,10 @@ export function buildRootResultModel(options: RootResultModelOptions): RootResul
392
420
  } else if (match && !match.command.hasArg) {
393
421
  const item = commandToItem(match.command);
394
422
  if (item) items.push(item);
423
+ // FB is Send Feedback and a ticker too (VF, SB and CR are companies): the ticker is the row under the command,
424
+ // which Enter still runs, for someone who typed the code meaning the listing.
425
+ const tickerItem = match.arg ? null : tickerCodeItem(rootQuery.trim().toUpperCase(), availableCommands, openModeRoute);
426
+ if (tickerItem) items.push(tickerItem);
395
427
  } else if (!rootQuery) {
396
428
  // One row per function: a code a group above already runs as it is (a
397
429
  // recent CHAT, Start Here's PF) is not listed again in the groups below.
@@ -19,6 +19,7 @@ import { isProviderResultItem } from "./search-providers";
19
19
  import { buildRootShortcutFeedback } from "./shortcut-feedback";
20
20
  import { commandShortcutQuery, type ShortcutIntent } from "./shortcuts";
21
21
  import { clampIndex } from "../../../../utils/math";
22
+ import { homeMarketVenue, systemTimeZone } from "../../../../market-data/market/header-market";
22
23
 
23
24
  /** Written the way a symbol is: up to five letters and a share class (AAPL, nvda, BRK.B). */
24
25
  const SYMBOL_SHAPED_QUERY = /^[A-Za-z]{1,5}(?:[.\-/][A-Za-z]{1,2})?$/;
@@ -27,6 +28,12 @@ const LISTING_NUMBER_QUERY = /^\d{3,6}$/;
27
28
  /** Written the way Singapore codes them, letters and digits in capitals: D05, C6L, A17U. */
28
29
  const LISTING_CODE_QUERY = /^(?=[A-Z0-9]*\d)(?=[A-Z0-9]*[A-Z])[A-Z0-9]{3,4}$/;
29
30
 
31
+ /** A ticker written as one, in capitals (BA, BRK.B, 0700, D05, GC=F, ^GSPC): what the resolver reads as typed. */
32
+ export function writtenAsSymbol(text: string): boolean {
33
+ const trimmed = text.trim();
34
+ return trimmed === trimmed.toUpperCase() && /^\^?[A-Z0-9][A-Z0-9=.\-/]*$/.test(trimmed);
35
+ }
36
+
30
37
  /**
31
38
  * Text that asks for a symbol rather than a local row: symbol-shaped, and in
32
39
  * capitals or in no row's name, or a listing's number or code. `nvda` matches
@@ -190,6 +197,9 @@ export function useCommandBarRootRuntime({
190
197
  const tickerSearchRouteQuery = currentRoute?.kind === "mode" && currentRoute.screen === "ticker-search"
191
198
  ? currentRoute.query
192
199
  : null;
200
+ // The market the header shows is the desk's own: search leads with its lines of the company a word names.
201
+ const headerMarket = state.config.headerMarket;
202
+ const homeVenue = useMemo(() => homeMarketVenue(headerMarket, systemTimeZone()), [headerMarket]);
193
203
 
194
204
  const {
195
205
  tickerSearchPending,
@@ -200,6 +210,7 @@ export function useCommandBarRootRuntime({
200
210
  buildTickerSearchResultItems,
201
211
  dataProvider,
202
212
  getTickers,
213
+ homeVenue,
203
214
  localTickerSearchResultItems,
204
215
  readTickerSearchCache,
205
216
  routeQuery: tickerSearchRouteQuery,
@@ -300,7 +311,8 @@ export function useCommandBarRootRuntime({
300
311
  if (rootTickerReading) return rootTickerReading.search;
301
312
  const trimmed = rootQuery.trim();
302
313
  const symbolQuery = symbolSearchQuery(trimmed);
303
- if (symbolQuery.length < 2) return null;
314
+ // One letter is too little to be worth a search; one digit is a Hong Kong code as people type it (5 is HSBC's 0005).
315
+ if (symbolQuery.length < 2 && !/^\d$/.test(symbolQuery)) return null;
304
316
  const normalizedQuery = normalizeCommandTickerSearchText(symbolQuery);
305
317
  // The install row for "TV" is labelled TV, but it leads on purpose and
306
318
  // must not keep Grupo Televisa out of the list.
@@ -331,6 +343,7 @@ export function useCommandBarRootRuntime({
331
343
  categoryPriorities: providerCategoryPriorities,
332
344
  currentRoute,
333
345
  dataProvider,
346
+ homeVenue,
334
347
  localTickerSearchResultItems,
335
348
  portfolios: state.config.portfolios,
336
349
  readTickerSearchCache,
@@ -348,9 +361,11 @@ export function useCommandBarRootRuntime({
348
361
  // letters match locally (a pane whose example names AAPL), not the symbol,
349
362
  // so none of them is highlighted and Enter waits for the answer, as it would
350
363
  // get had the symbol been typed slowly. Lower case found in a row's name
351
- // (`upd`, `list`) is that row and runs at once.
352
- const rootSymbolAnswerPending = !rootResultsCurrent && rootPlainTickerSearchArg !== null
353
- && (rootTickerReading !== null || rootListingChoice !== null || readsAsSymbol(rootPlainTickerSearchArg, answeredRootResults));
364
+ // (`upd`, `list`) is that row and runs at once. DES's rows before its answer
365
+ // are saved tickers the letters match (`DES BA:LSE` finds Berkshire's BRK.B),
366
+ // never the listing typed: none is highlighted, and Enter runs the text.
367
+ const rootSymbolAnswerPending = !rootResultsCurrent && (rootSecurityDescriptionArg !== null || (rootPlainTickerSearchArg !== null
368
+ && (rootTickerReading !== null || rootListingChoice !== null || readsAsSymbol(rootPlainTickerSearchArg, answeredRootResults))));
354
369
  // Nor does the AI hold a place for itself meanwhile: its Thinking row would
355
370
  // lead the list until the symbol's rows came in above it.
356
371
  const orderedRootResults = useMemo(
@@ -436,6 +436,11 @@ function venueMatchesSuffix(item: ResultItem, suffix: string): boolean {
436
436
  return targets.some((value) => venues.includes(canonicalExchange(value)));
437
437
  }
438
438
 
439
+ /** Whether a row is the listing typed with its venue: BAE Systems' BA on LSE for `BA:LSE`, never Boeing's BA on NYSE. */
440
+ export function isNamedListingRow(item: ResultItem, listing: { symbol: string; suffix: string }): boolean {
441
+ return isExactTickerResultMatch(item, listing.symbol) && venueMatchesSuffix(item, listing.suffix);
442
+ }
443
+
439
444
  /** On the currency venue a pair's code is the pair: EURUSD's CCY row is EURUSD=X. */
440
445
  function isCurrencyVenuePair(item: ResultItem, symbol: string): boolean {
441
446
  const pair = currencyPairCode(symbol, "CCY");
@@ -17,6 +17,8 @@ export function useTickerSearchRouteResults(options: {
17
17
  buildTickerSearchResultItems: (candidates: TickerSearchCandidate[], query: string) => ResultItem[];
18
18
  dataProvider: DataProvider;
19
19
  getTickers: () => AppState["tickers"];
20
+ /** The venue of the user's own market, whose lines of the company a word names lead. */
21
+ homeVenue?: string | null;
20
22
  localTickerSearchResultItems: (query?: string, options?: { category?: string; limit?: number }) => ResultItem[];
21
23
  readTickerSearchCache: (
22
24
  query: string,
@@ -41,6 +43,7 @@ export function useTickerSearchRouteResults(options: {
41
43
  buildTickerSearchResultItems,
42
44
  dataProvider,
43
45
  getTickers,
46
+ homeVenue,
44
47
  localTickerSearchResultItems,
45
48
  readTickerSearchCache,
46
49
  routeQuery,
@@ -104,6 +107,7 @@ export function useTickerSearchRouteResults(options: {
104
107
  },
105
108
  // The rows the CLI's search reads, so CAR Group on ASX (CAR's eleventh row) is offered too.
106
109
  totalLimit: LISTING_SEARCH_LIMIT,
110
+ homeVenue,
107
111
  ...QUICK_LOOK_TICKER_SEARCH_OPTIONS,
108
112
  });
109
113
  if (requestId !== searchRequestIdRef.current) return;
@@ -137,6 +141,7 @@ export function useTickerSearchRouteResults(options: {
137
141
  buildTickerSearchResultItems,
138
142
  dataProvider,
139
143
  getTickers,
144
+ homeVenue,
140
145
  localTickerSearchResultItems,
141
146
  readTickerSearchCache,
142
147
  resetTickerSearchRoute,
@@ -1,8 +1,8 @@
1
- import { useCallback, useEffect, useRef, type MutableRefObject } from "react";
1
+ import { useCallback, useEffect, useMemo, useRef, type MutableRefObject } from "react";
2
2
  import type { AppState } from "../../state/app/context";
3
3
  import type { TickerRecord } from "../../types/ticker";
4
4
  import { t } from "../../i18n";
5
- import { listingChoiceQuery } from "../../tickers/search";
5
+ import { listingChoiceQuery, normalizeTickerInput } from "../../tickers/search";
6
6
  import { isKnownExchangeCode } from "../../utils/exchanges";
7
7
  import type { PluginRegistry } from "../../plugins/registry";
8
8
  import type { Command } from "./commands/registry";
@@ -24,6 +24,8 @@ import type { OpenInlineConfirm } from "./routing/confirm";
24
24
  import { activatePickerSelectionAction } from "./picker-activation";
25
25
  import type { RunRootRow } from "./routes/root/search-report";
26
26
  import type { ShortcutIntent } from "./routes/root/shortcuts";
27
+ import { isNamedListingRow } from "./routes/ticker-search/results";
28
+ import { writtenAsSymbol } from "./routes/root/runtime";
27
29
 
28
30
  type OpenModeRouteFn = (
29
31
  screen: "ticker-search" | "layout",
@@ -180,6 +182,15 @@ export function useCommandBarSelectionRuntime({
180
182
  startThemePicker,
181
183
  ]);
182
184
 
185
+ /**
186
+ * The typed ticker command Enter runs while no row is highlighted (DES
187
+ * before its search answers), so the prompt names its keys as a ticker row's.
188
+ */
189
+ const typedTickerRow = useMemo(() => (
190
+ !currentRoute && rootShortcutIntent.kind !== "none" && rootShortcutIntent.argKind === "ticker"
191
+ ? resolveImmediateRootSelection(rootQuery) : null
192
+ ), [currentRoute, resolveImmediateRootSelection, rootQuery, rootShortcutIntent]);
193
+
183
194
  /**
184
195
  * Tab on a typed shortcut: it completes the prefix, or opens what the
185
196
  * shortcut starts (a ticker search in the bar, a pane form in the form
@@ -301,13 +312,25 @@ export function useCommandBarSelectionRuntime({
301
312
  const queryChanged = rootQueryRef.current !== rootQuery;
302
313
  const tickerArgument = rootShortcutIntent.kind !== "none" && rootShortcutIntent.argKind === "ticker"
303
314
  ? rootShortcutIntent.argText : null;
304
- const listingQuery = listingChoiceQuery(tickerArgument ?? rootQueryRef.current);
315
+ // `DES BA LN` names its listing as `DES BA:LSE` does.
316
+ const listingQuery = listingChoiceQuery((tickerArgument === null ? null : normalizeTickerInput(null, tickerArgument)) ?? rootQueryRef.current);
305
317
  const choosingVenue = listingQuery && !isKnownExchangeCode(listingQuery.suffix);
306
318
  const highlighted = listState.results[listState.selectedIdx];
307
- const listingHighlighted = !queryChanged && (highlighted?.kind === "ticker" || highlighted?.kind === "search");
319
+ // A function given a listing with its venue opens that listing: a row the
320
+ // user did not pick (a saved BRK.B the letters match, Boeing's BA on NYSE)
321
+ // runs only when it is that listing, and the typed text runs otherwise.
322
+ const namedListing = tickerArgument !== null && listingQuery && !choosingVenue ? listingQuery : null;
323
+ const otherListingHighlighted = !!namedListing && !!highlighted && !rootSelectionNavigatedRef.current
324
+ && !isNamedListingRow(highlighted, namedListing);
325
+ const listingHighlighted = !queryChanged && !otherListingHighlighted
326
+ && (highlighted?.kind === "ticker" || highlighted?.kind === "search");
308
327
  const submitTyped = !options?.item && !currentRoute && !listingHighlighted
309
328
  && (queryChanged || (!rootSelectionNavigatedRef.current && !choosingVenue));
310
- const typed = submitTyped && (queryChanged || tickerArgument !== null)
329
+ // A name (`DES Microsoft`, `DES nvda`) is search's to read, not the
330
+ // resolver's: before the answer, Enter waits for it.
331
+ const nameAwaitingAnswer = searchPending && !queryChanged && tickerArgument !== null && !namedListing
332
+ && !writtenAsSymbol(tickerArgument);
333
+ const typed = submitTyped && !nameAwaitingAnswer && (queryChanged || tickerArgument !== null)
311
334
  ? resolveImmediateRootSelection(rootQueryRef.current) : null;
312
335
  const selected = options?.item ?? typed ?? listState.results[listState.selectedIdx];
313
336
  if (!selected) {
@@ -439,5 +462,6 @@ export function useCommandBarSelectionRuntime({
439
462
  activateListSelection,
440
463
  runRootQuery,
441
464
  setActiveListQuery,
465
+ typedTickerRow,
442
466
  };
443
467
  }
@@ -531,6 +531,7 @@ export function CommandBar({
531
531
  activateListSelection,
532
532
  runRootQuery,
533
533
  setActiveListQuery,
534
+ typedTickerRow,
534
535
  } = useCommandBarSelectionRuntime({
535
536
  activeTickerSymbol,
536
537
  promptTickerSymbol,
@@ -682,7 +683,9 @@ export function CommandBar({
682
683
  const addingListing = !currentRoute && state.commandBarLaunchRequest?.kind === "add-listing" && !!listingChoiceQuery(rootQuery);
683
684
  const plainTickerSearch = currentRoute?.kind === "mode" && currentRoute.screen === "ticker-search" && !currentRoute.payload?.action;
684
685
  const enterChangesFocusedPane = !!resolveTickerEnterTarget(state.config.layout, state.focusedPaneId, pluginRegistry.panes, "des");
685
- const selectedRow = visibleListState?.results[visibleListState.selectedIdx];
686
+ // Nothing is highlighted while DES's search is out, and Enter runs the ticker typed.
687
+ const selectedRow = visibleListState?.results[visibleListState.selectedIdx]
688
+ ?? (visibleListState?.kind === "root" ? typedTickerRow : null);
686
689
  const selectionKeyHints = themePickerActive || addingListing || plainTickerSearch
687
690
  ? null
688
691
  : resolveSelectionKeyHints(selectedRow, enterChangesFocusedPane);
@@ -1,7 +1,8 @@
1
1
  import { useEffect, useRef } from "react";
2
2
  import { t, tf } from "../../../i18n";
3
+ import { AlertListingRefusal, resolveAlertListing } from "../../../cli/alert-listing";
3
4
  import { extendedSessionLineLabel, getLatestPrintDisplay, type SessionPriceDisplay } from "../../../market-data/market/status";
4
- import type { DataProvider } from "../../../types/data-provider";
5
+ import type { ListingDeps } from "../../../tickers/listing-venues";
5
6
  import type { Quote } from "../../../types/financials";
6
7
  import { coerceFieldString } from "../helpers";
7
8
  import type {
@@ -45,17 +46,29 @@ function formatAlertWorkflowQuote(quote: Quote, print: SessionPriceDisplay): str
45
46
  }
46
47
 
47
48
  function summarizeAlertWorkflowQuoteError(symbol: string, error: unknown): string {
49
+ if (error instanceof AlertListingRefusal) return error.details ? `${error.reason} ${error.details}` : error.reason;
48
50
  if (error instanceof Error && error.message.trim()) return error.message;
49
51
  return tf('No quote found for "{symbol}".', { symbol });
50
52
  }
51
53
 
54
+ /** How long typing rests before the symbol is read: a company's name is a search, not one quote. */
55
+ const ALERT_WORKFLOW_READ_DELAY_MS = 250;
56
+
57
+ /**
58
+ * The fields with their lines under Symbol and Target Price. A pane that fills
59
+ * the form in can add its own line under Target Price (`priceNote` in its
60
+ * values: GEX's flip alert says the level is fixed), kept below the price's.
61
+ */
52
62
  function updateAlertWorkflowFieldDescriptions(
53
63
  fields: CommandBarWorkflowField[],
54
64
  descriptions: Partial<Record<"symbol" | "price", string | undefined>>,
65
+ values: Record<string, CommandBarFieldValue>,
55
66
  ): CommandBarWorkflowField[] {
67
+ const priceNote = coerceFieldString(values.priceNote).trim();
56
68
  return fields.map((field) => {
57
69
  if (field.id !== "symbol" && field.id !== "price") return field;
58
- const description = descriptions[field.id];
70
+ const own = descriptions[field.id];
71
+ const description = field.id === "price" && priceNote ? [own, priceNote].filter(Boolean).join("\n") : own;
59
72
  return field.description === description ? field : { ...field, description };
60
73
  });
61
74
  }
@@ -63,14 +76,17 @@ function updateAlertWorkflowFieldDescriptions(
63
76
  /**
64
77
  * Add Alert checks the symbol as it is typed, shows the quote under it and
65
78
  * fills the target from the current price until the user types their own. Run
66
- * by every form, which owns the values; it acts only in Add Alert's.
79
+ * by every form, which owns the values; it acts only in Add Alert's. The
80
+ * symbol is read as Add Alert and `alerts add` read it (`resolveAlertListing`):
81
+ * a company's name finds its listing, a listing that stopped trading says
82
+ * why it is refused, and a symbol its company left says where it went.
67
83
  */
68
84
  export function useAlertWorkflowQuoteSync({
69
- dataProvider,
85
+ listingDeps,
70
86
  route,
71
87
  updateRoute,
72
88
  }: {
73
- dataProvider: DataProvider;
89
+ listingDeps: ListingDeps;
74
90
  route: CommandBarWorkflowRoute;
75
91
  updateRoute: (updater: (route: CommandBarWorkflowRoute) => CommandBarWorkflowRoute) => void;
76
92
  }): void {
@@ -94,7 +110,7 @@ export function useAlertWorkflowQuoteSync({
94
110
  fields: updateAlertWorkflowFieldDescriptions(route.fields, {
95
111
  symbol: "Enter a symbol to validate it.",
96
112
  price: "Target fills from the current price after the symbol resolves.",
97
- }),
113
+ }, route.values),
98
114
  payloadMeta: {
99
115
  ...(route.payloadMeta ?? {}),
100
116
  alertQuoteSymbol: "",
@@ -113,7 +129,7 @@ export function useAlertWorkflowQuoteSync({
113
129
  fields: updateAlertWorkflowFieldDescriptions(route.fields, {
114
130
  symbol: tf("Checking {symbol}...", { symbol: alertWorkflowSymbol }),
115
131
  price: "Target fills from the current price after the symbol resolves.",
116
- }),
132
+ }, route.values),
117
133
  payloadMeta: {
118
134
  ...(route.payloadMeta ?? {}),
119
135
  alertQuoteSymbol: alertWorkflowSymbol,
@@ -122,8 +138,8 @@ export function useAlertWorkflowQuoteSync({
122
138
  };
123
139
  });
124
140
 
125
- void dataProvider.getQuote(alertWorkflowSymbol, "")
126
- .then((quote) => {
141
+ const read = () => void resolveAlertListing(alertWorkflowSymbol, null, listingDeps)
142
+ .then(({ quote, fate }) => {
127
143
  if (quoteRequestRef.current !== requestId) return;
128
144
  // An alert is judged on the latest print, extended hours included: the target starts there.
129
145
  const print = getLatestPrintDisplay(quote);
@@ -147,9 +163,10 @@ export function useAlertWorkflowQuoteSync({
147
163
  ...route,
148
164
  values: nextValues,
149
165
  fields: updateAlertWorkflowFieldDescriptions(route.fields, {
150
- symbol: formatAlertWorkflowQuote(quote, print),
166
+ // What became of the symbol goes under its quote, which names the listing: FB is a fund now, and Meta trades as META.
167
+ symbol: [formatAlertWorkflowQuote(quote, print), ...fate].join("\n"),
151
168
  price: tf("Current price {price}; edit to set the target.", { price: formatAlertWorkflowCurrentPrice(print) }),
152
- }),
169
+ }, nextValues),
153
170
  payloadMeta: {
154
171
  ...(route.payloadMeta ?? {}),
155
172
  alertQuoteSymbol: alertWorkflowSymbol,
@@ -170,7 +187,7 @@ export function useAlertWorkflowQuoteSync({
170
187
  fields: updateAlertWorkflowFieldDescriptions(route.fields, {
171
188
  symbol: message,
172
189
  price: undefined,
173
- }),
190
+ }, route.values),
174
191
  payloadMeta: {
175
192
  ...(route.payloadMeta ?? {}),
176
193
  alertQuoteSymbol: alertWorkflowSymbol,
@@ -180,5 +197,7 @@ export function useAlertWorkflowQuoteSync({
180
197
  };
181
198
  });
182
199
  });
183
- }, [alertWorkflowActive, alertWorkflowSymbol, dataProvider, updateRoute]);
200
+ const timer = setTimeout(read, ALERT_WORKFLOW_READ_DELAY_MS);
201
+ return () => clearTimeout(timer);
202
+ }, [alertWorkflowActive, alertWorkflowSymbol, listingDeps, updateRoute]);
184
203
  }
@@ -11,7 +11,7 @@ import {
11
11
  import type { ScrollBoxRenderable } from "../../ui";
12
12
  import { useBeforeShortcut, useShortcut } from "../../react/input";
13
13
  import { isPlainKey, isPlainKeyboardEvent } from "../../utils/keyboard";
14
- import { DataTable, PaneStatusBody, type DataTableColumn, type DataTableProps, type PaneStatusBodyProps } from "../ui";
14
+ import { DataTable, PaneStatusBody, RowNote, type DataTableColumn, type DataTableProps, type NoticeProps, type PaneStatusBodyProps } from "../ui";
15
15
  import { useDataTableSortMenu } from "./sort-menu";
16
16
  import { useDataTableColumnMenuItems } from "./column-menu";
17
17
  import { drawnTableColumns, tableFreezesFirstColumn, tableRevealLeft, tableScrollStep } from "../ui/table-layout";
@@ -146,6 +146,14 @@ export interface DataTableViewProps<
146
146
  continuesRowAbove?: (item: T, index: number) => boolean;
147
147
  rootBefore?: ReactNode;
148
148
  rootAfter?: ReactNode;
149
+ /**
150
+ * What concerns one row, said under the table while that row is selected
151
+ * (`RowNote`): the whole reason behind the few words the row shows, such as
152
+ * a name a screen could not price or a peer whose figures are stale. Null
153
+ * for a row with nothing to say. A note about one row never goes in the
154
+ * footer, whose notes are the pane's (docs/pane-conventions.md, Row messages).
155
+ */
156
+ rowNote?: (item: T, index: number) => string | { text: string; tone: NonNullable<NoticeProps["tone"]> } | null | undefined;
149
157
  /**
150
158
  * Replaces the table (header and rows) with a loading, error or empty
151
159
  * state while `rootBefore` stays. Precedence is the caller's, as with
@@ -200,6 +208,7 @@ export function DataTableView<
200
208
  continuesRowAbove,
201
209
  rootBefore,
202
210
  rootAfter,
211
+ rowNote,
203
212
  status,
204
213
  rootWidth,
205
214
  rootHeight,
@@ -846,6 +855,10 @@ export function DataTableView<
846
855
  }
847
856
  });
848
857
 
858
+ // The selected row's note follows the cursor, as the row's highlight does.
859
+ const selectedItem = rowNote && effectiveSelectedIndex >= 0 && !bodyStatusShown(status) ? tableProps.items[effectiveSelectedIndex] : undefined;
860
+ const note = selectedItem !== undefined ? rowNote!(selectedItem, effectiveSelectedIndex) : null;
861
+ const noteView = note ? typeof note === "string" ? <RowNote>{note}</RowNote> : <RowNote tone={note.tone}>{note.text}</RowNote> : null;
849
862
  return (
850
863
  <TableViewFrame
851
864
  width={rootWidth}
@@ -853,7 +866,7 @@ export function DataTableView<
853
866
  fit={tableProps.fitRows}
854
867
  backgroundColor={rootBackgroundColor}
855
868
  before={rootBefore}
856
- after={rootAfter}
869
+ after={noteView ? <>{rootAfter}{noteView}</> : rootAfter}
857
870
  >
858
871
  {bodyStatusShown(status) ? <PaneStatusBody {...status} /> : <DataTable<T, C>
859
872
  {...tableProps}