@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
@@ -43,6 +43,12 @@ export interface ChartResolveSources {
43
43
  loadFuturesPriceUnit?: (symbol: string) => Promise<string | null>;
44
44
  /** A currency's daily USD closes, for a chart converted into one currency (`viewport.currency`). */
45
45
  loadFxCloses?: LoadFxCloses;
46
+ loadStatementCurrency?: (target: string, currencies: readonly string[]) => Promise<{
47
+ rates: ReadonlyMap<string, number>;
48
+ note: string | null;
49
+ rateNotes?: readonly string[];
50
+ failures: readonly string[];
51
+ }>;
46
52
  /** Provider-neutral boundary for plugin-owned chart series. */
47
53
  resolveCapabilitySeries?: (
48
54
  source: Extract<ChartSeriesSpec["source"], { kind: "capability" }>,
@@ -11,6 +11,7 @@ import { subtractTimeRange } from "./date-window";
11
11
  import { hiddenOnLogScale, logScaleHiddenWarning } from "./log-scale";
12
12
  import {
13
13
  CHART_RESOLUTION_STEP_MS,
14
+ chartBarSizeName,
14
15
  chartBarSizeSource,
15
16
  clampTimeRangeToMaxRange,
16
17
  DEFAULT_CHART_RESOLUTION_SUPPORT,
@@ -134,6 +135,7 @@ import {
134
135
  latestQuote,
135
136
  mergeHistory,
136
137
  baseSecuritySeries,
138
+ withPriorClose,
137
139
  baseEconomicSeries,
138
140
  baseCapabilitySeries,
139
141
  staleFredWarning,
@@ -1090,7 +1092,32 @@ async function resolveChartSpecPass(
1090
1092
  }
1091
1093
  }));
1092
1094
 
1093
- const rawSeries = loaded.filter((entry): entry is ResolvedSeries => !!entry);
1095
+ let rawSeries = loaded.filter((entry): entry is ResolvedSeries => !!entry);
1096
+ const statementTarget = spec.viewport.currency;
1097
+ if (statementTarget && sources.loadStatementCurrency) {
1098
+ const statements = new Set(spec.series.filter(({ source }) => source.kind === "security" && source.fieldId.startsWith("fundamental.")).map(({ id }) => id));
1099
+ const group = (series: ResolvedSeries) => /^(currency-total|per-share)(?::|$)/.exec(series.unitGroup)?.[1];
1100
+ const nativeCurrency = (series: ResolvedSeries) => series.unitGroup.split(":")[1] ?? "";
1101
+ const monetary = rawSeries.filter((series) => statements.has(series.id) && group(series) && series.points.length);
1102
+ if (monetary.length) {
1103
+ const { rates, note, rateNotes, failures } = await sources.loadStatementCurrency(statementTarget, monetary.map(nativeCurrency).filter(Boolean));
1104
+ if (note) { coverageNotices.push(note); warnings.push(...rateNotes ?? [note]); }
1105
+ warnings.push(...failures);
1106
+ rawSeries = rawSeries.map((series) => {
1107
+ const currency = nativeCurrency(series);
1108
+ if (!monetary.includes(series) || currency === statementTarget) return series;
1109
+ const rate = rates.get(currency);
1110
+ return {
1111
+ ...series, unit: group(series) === "per-share" ? `${statementTarget}/share` : statementTarget, unitGroup: `${group(series)}:${statementTarget}`,
1112
+ ...(rate == null ? { warning: `No ${currency || "reporting currency"}/${statementTarget} rate` } : {}),
1113
+ points: rate == null ? [] : series.points.map((point) => ({ ...point,
1114
+ ...(point.value == null ? {} : { nativeAmount: { value: point.value, currency: series.unit } }),
1115
+ value: point.value == null ? null : point.value * rate,
1116
+ })),
1117
+ };
1118
+ });
1119
+ }
1120
+ }
1094
1121
  const marketTimelineSeries = primaryMarketSeries?.visible === false
1095
1122
  ? rawSeries.filter((entry) => entry.id === primaryMarketSeries.id)
1096
1123
  : [];
@@ -1130,11 +1157,21 @@ async function resolveChartSpecPass(
1130
1157
  if (sessionView?.priorClose != null && primaryRaw?.transform === "raw"
1131
1158
  && primaryRaw.unitGroup.startsWith("price") && primaryRaw.unitGroup !== "price:unknown") {
1132
1159
  const index = rawSeries.indexOf(primaryRaw);
1133
- rawSeries[index] = { ...primaryRaw, priorClose: sessionView.priorClose };
1160
+ rawSeries[index] = withPriorClose(primaryRaw, sessionView.priorClose);
1134
1161
  }
1135
1162
  const servedCadences = new Set(rawSeries.filter((entry) => entry.observationKind === "market" && entry.points.length > 0)
1136
1163
  .map((entry) => entry.historyResolution));
1137
1164
  const commonCadence = servedCadences.size === 1 ? [...servedCadences][0] : undefined;
1165
+ // A series served in other bars than the chart's (a source that did not answer for 5-minute bars, then
1166
+ // answered daily ones) says so, so its line is not read in the bars the others are in.
1167
+ if (servedCadences.size > 1) {
1168
+ const chartBars = builtBarSize ?? initialResolution;
1169
+ for (const entry of rawSeries) {
1170
+ const served = entry.barSize ?? entry.historyResolution;
1171
+ if (!visibleSeriesIds.has(entry.id) || entry.observationKind !== "market" || !entry.points.length || !served || served === chartBars) continue;
1172
+ warnings.push(`${entry.label}: ${chartBarSizeName(served)} bars, not the chart's ${chartBarSizeName(chartBars)} bars.`);
1173
+ }
1174
+ }
1138
1175
  const resolution = commonCadence ?? undefined;
1139
1176
  const comparisonResolution = resolution ?? "auto";
1140
1177
  const comparisonOptions = { preset: hasExplicitWindow ? null : spec.viewport.range, now: referenceNow.getTime() + Math.max(0, Date.now() - resolutionStartedAt) };
@@ -1148,7 +1185,9 @@ async function resolveChartSpecPass(
1148
1185
  { ...comparisonOptions, atSessionClose: timed.timing.atSessionClose, closedEnds: timed.timing.closedEnds });
1149
1186
  }
1150
1187
  const splitNotice = priceComparison?.legs ? await comparedSplitNotice(spec, priceComparison, rawSeries, loadDistributions, comparisonOptions.now) : null;
1151
- const displayBounds = comparisonDisplayBounds(bounds, priceComparison);
1188
+ const comparedBounds = comparisonDisplayBounds(bounds, priceComparison);
1189
+ const displayBounds = spec.viewport.dateWindow?.endAtLatestObservation && !requestBounds
1190
+ ? endAtNewestObservation(comparedBounds, rawSeries) : comparedBounds;
1152
1191
  const comparisonBounds = priceComparison && priceComparison.start !== null
1153
1192
  ? priceComparison : bounds;
1154
1193
  const baseSeries = rawSeries
@@ -191,7 +191,7 @@ function normalizeSource(value: unknown): ChartSeriesSource | null {
191
191
  };
192
192
  }
193
193
 
194
- function normalizedDateWindow(value: unknown): { start: string; end: string } | undefined {
194
+ function normalizedDateWindow(value: unknown): ChartSpec["viewport"]["dateWindow"] {
195
195
  const window = recordOrNull(value);
196
196
  const start = nonEmptyString(window?.start);
197
197
  const end = nonEmptyString(window?.end);
@@ -199,7 +199,7 @@ function normalizedDateWindow(value: unknown): { start: string; end: string } |
199
199
  const startTime = Date.parse(start);
200
200
  const endTime = Date.parse(end);
201
201
  if (!Number.isFinite(startTime) || !Number.isFinite(endTime) || startTime > endTime) return undefined;
202
- return { start, end };
202
+ return { start, end, ...(window?.endAtLatestObservation === true ? { endAtLatestObservation: true } : {}) };
203
203
  }
204
204
 
205
205
  function normalizePanel(value: unknown, index: number, seen: Set<string>): ChartPanelSpec | null {
@@ -105,7 +105,7 @@ export interface ChartPanelSpec {
105
105
  export interface ChartViewportSpec {
106
106
  range: TimeRange;
107
107
  resolution: ChartResolution;
108
- dateWindow?: { start: string; end: string };
108
+ dateWindow?: { start: string; end: string; endAtLatestObservation?: boolean };
109
109
  /** Optional latest-observation cap, useful for period-based financial views. */
110
110
  maxPoints?: number;
111
111
  /** Intraday market history includes pre-market and after-hours bars where the venue has them. */
@@ -147,6 +147,7 @@ export interface TimeSeriesPoint {
147
147
  value: number | null;
148
148
  /** Original primary scalar before any presentation transform, including missing values. */
149
149
  rawValue?: number | null;
150
+ nativeAmount?: { value: number; currency: string };
150
151
  open?: number | null;
151
152
  high?: number | null;
152
153
  low?: number | null;
@@ -318,7 +319,7 @@ export interface ResolvedSeries {
318
319
  * `dataset`: a capability's published observations (vessel transits),
319
320
  * whose values the legend dates because they arrive days late. */
320
321
  observationKind?: "market" | "dataset";
321
- /** Regular-session move supplied with the latest market quote. */
322
+ /** The move of the series's last bar from the close the latest market quote measures its change from, in percent. */
322
323
  latestChangePercent?: number;
323
324
  /** The previous session's close, set on a one-day chart's price series and drawn as its reference line. */
324
325
  priorClose?: number;
@@ -231,6 +231,11 @@ export interface SearchRequestContext {
231
231
  * still waited for: its answer is the search's.
232
232
  */
233
233
  interactive?: boolean;
234
+ /**
235
+ * `always` asks for perpetual markets beside the listings for every query. Without it, a command that looks up
236
+ * one bare symbol the listings show to be a US stock does not ask for them.
237
+ */
238
+ perpetuals?: "always";
234
239
  /**
235
240
  * Rows to ask a catalogue for. Every listing of a symbol several companies
236
241
  * use (CAR: Avis, Carrefour, CAR Group) takes more than a keystroke's ten.
@@ -373,6 +378,12 @@ export interface AssetDataProvider {
373
378
  * all, or when another source (a connected broker) adds rows of its own.
374
379
  */
375
380
  searchBatch?(queries: string[], options?: { limit?: number; signal?: AbortSignal }): Promise<Map<string, InstrumentSearchResult[]> | null>;
381
+ /**
382
+ * True of a symbol known, before any request, to be a stock on a US exchange. A lookup of one is not searched for
383
+ * its share-class spellings (NVDA as NVD-A) and asks for no perpetual contracts. Set by a command line that
384
+ * ships the listings; absent elsewhere, where every lookup asks.
385
+ */
386
+ knownUsStock?(symbol: string): boolean;
376
387
  getEarningsCalendar?(symbols: string[], context?: MarketDataRequestContext): Promise<EarningsEvent[]>;
377
388
  getSecFilingDocuments?(filing: SecFilingItem): Promise<SecFilingDocument[]>;
378
389
  getSecFilingContent?(filing: SecFilingItem): Promise<string | null>;
@@ -444,6 +444,14 @@ export interface Fundamentals extends DepositaryReceiptFacts {
444
444
  * home line, per receipt), `cpo` (a CPO line's company, per CPO).
445
445
  */
446
446
  trailingEpsBasis?: "statements" | "home" | "cpo";
447
+ /**
448
+ * `YYYY-MM-DD`, the last day of the twelve months `revenue`, `netIncome` and
449
+ * `profitMargin` are: the statements' trailing window (Financials' TTM)
450
+ * when they are its figures. Absent when Gloom Cloud cannot tie them to one.
451
+ */
452
+ trailingPeriodEnd?: string;
453
+ /** `statements`: the trailing revenue, net income and margin are the statements' window, in place of figures on no twelve months the EPS is on. */
454
+ trailingIncomeBasis?: "statements";
447
455
  /** Provider-reported issuer market cap; marketCapCurrency identifies its units when known. */
448
456
  marketCap?: number;
449
457
  marketCapCurrency?: string;
@@ -666,6 +674,8 @@ export interface AnalystResearchData {
666
674
  export interface DividendAction {
667
675
  exDate: string;
668
676
  amount: number;
677
+ payDate?: string;
678
+ recordDate?: string;
669
679
  /**
670
680
  * Who published the row when it is not the listing's own history: a fund's
671
681
  * sponsor, for a distribution the history lacks (iShares, SPDR, J.P. Morgan,
@@ -676,13 +686,14 @@ export interface DividendAction {
676
686
 
677
687
  /**
678
688
  * A distribution the issuer has declared and not yet paid, as the source
679
- * states it. Kept apart from the paid `dividends`: no history, yield or growth
680
- * figure takes it.
689
+ * states it. Kept apart from paid `dividends`; issuer-confirmed declarations
690
+ * enter ex-date-based cash figures once ex-dated, with any conversion estimate.
681
691
  */
682
692
  export interface DeclaredDividendAction {
683
693
  exDate: string;
684
694
  /** Per share, in the listing's dividend currency (`currency`). */
685
695
  amount: number;
696
+ cashEstimate?: DividendCashEstimate;
686
697
  declarationDate?: string;
687
698
  recordDate?: string;
688
699
  payDate?: string;
@@ -690,6 +701,14 @@ export interface DeclaredDividendAction {
690
701
  special?: true;
691
702
  }
692
703
 
704
+ /** declaredAmount is in declaredCurrency's major unit; the enclosing amount keeps the history's currency/unit. */
705
+ export interface DividendCashEstimate {
706
+ declaredCurrency: string;
707
+ declaredAmount?: number;
708
+ fixingDate?: string;
709
+ basis: string;
710
+ }
711
+
693
712
  export interface SplitAction {
694
713
  date: string;
695
714
  description?: string;
@@ -757,12 +776,37 @@ export interface CorporateActionsData {
757
776
  dividendsAsOf?: string;
758
777
  splits: SplitAction[];
759
778
  earnings: EarningsAction[];
779
+ /** Businesses demerged out of the listing into companies of their own; absent where none is on record and from older servers. */
780
+ demergers?: DemergerAction[];
760
781
  }
761
782
 
762
- /** Paid rows as their company declared them, in `currency` (its major unit). */
783
+ /**
784
+ * A business demerged out of a listing (Tata Motors' commercial vehicles into
785
+ * TMCV): the listing's price falls by that business's value on the ex-date,
786
+ * which is no market move.
787
+ */
788
+ export interface DemergerAction {
789
+ /** The first session the listing traded without the business, YYYY-MM-DD. */
790
+ exDate: string;
791
+ recordDate?: string;
792
+ /** The company the business went to, as it lists, and the day it first traded (null until it lists). */
793
+ successor: { symbol: string; exchange?: string; name?: string; listedOn?: string | null };
794
+ /** What the business does: "commercial vehicles". */
795
+ business?: string;
796
+ /** Shares of the demerged company per share of the listing. */
797
+ ratio?: number;
798
+ source?: string;
799
+ }
800
+
801
+ /** Declaration amounts (rows and announced.amount) are in the major unit of `currency`.
802
+ * announced.paidAmount uses the corporate-action history's currency/unit, like dividends. */
763
803
  export interface DeclaredCash {
764
804
  currency: string;
765
805
  rows: DividendAction[];
806
+ announced?: { exDate: string; payDate: string; amount: number; paidAmount?: number; fixingDate?: string };
807
+ fetchedAt?: string;
808
+ stale?: boolean;
809
+ verification?: "unavailable";
766
810
  }
767
811
 
768
812
  export interface CompanyProfile {
@@ -840,7 +884,7 @@ export type StatementFilingKind = "annual_results" | "interim_results" | "quarte
840
884
 
841
885
  /** A results announcement or report on HKEXnews or SGXNet, with when it was published and read. */
842
886
  export interface StatementFilingDocument {
843
- source: "hkex" | "sgx";
887
+ source: "hkex" | "sgx" | "lse" | "cninfo" | "ir";
844
888
  kind: StatementFilingKind;
845
889
  title: string;
846
890
  url: string;
@@ -704,6 +704,7 @@ export interface HeadlessBundleResult extends HeadlessPaneResultBase {
704
704
 
705
705
  export interface HeadlessSeriesPoint extends HeadlessPaneRow {
706
706
  date: string | number | Date;
707
+ nativeAmount?: { value: number; currency: string };
707
708
  value?: number | null;
708
709
  open?: number | null;
709
710
  high?: number | null;
@@ -12,6 +12,8 @@ interface IssuerListing {
12
12
  name: string;
13
13
  /** The company's primary line. */
14
14
  primary: boolean;
15
+ /** The shares one lot trades in, where the line's exchange states it (an HKEX or SGX line); absent elsewhere. */
16
+ boardLot?: number;
15
17
  }
16
18
 
17
19
  export interface IssuerListings {
@@ -3,6 +3,7 @@ type AppDesktopNotificationMode = "never" | "when-inactive" | "always";
3
3
 
4
4
  export interface AppNotificationDelivery {
5
5
  toastVisible: boolean;
6
+ /** Whether an out-of-app banner was requested by the native or browser host. */
6
7
  desktopRequested: boolean;
7
8
  }
8
9
 
@@ -16,6 +17,8 @@ export interface AppNotificationRequest {
16
17
  /** If true, in-app toast stays visible until user dismisses it */
17
18
  persistent?: boolean;
18
19
  desktop?: AppDesktopNotificationMode;
20
+ /** Also offer this banner in a background browser tab, if the user opted in. */
21
+ browser?: boolean;
19
22
  /** macOS sound name (e.g., "Glass", "Ping", "Hero"). Ignored on other platforms. */
20
23
  sound?: string;
21
24
  action?: {
@@ -44,10 +44,12 @@ export interface PriceHistoryResult {
44
44
  */
45
45
  nonPositiveCloseDates?: string[];
46
46
  /**
47
- * The router answered an intraday request from a saved copy that stops short
48
- * of the venue's latest session: a refetch failed, the app is offline or the
49
- * source answered bars still behind. Never stored with a copy. Absent for a
50
- * current copy, whatever its last bar, and for a source's own answer.
47
+ * The router answered from a saved copy that stops short of the venue's
48
+ * latest session (a refetch failed, the app is offline or the source
49
+ * answered bars still behind), or from a source's own answer that stops
50
+ * there because no source had the present (the service's stored series while
51
+ * its source refuses). Never stored with a copy. Absent for a current copy,
52
+ * whatever its last bar, and for a source's current answer.
51
53
  */
52
54
  savedCopyBehind?: true;
53
55
  /**
@@ -79,10 +79,18 @@ export interface Portfolio {
79
79
  /** Set on paper portfolios shared with a team; the server holds the items. */
80
80
  teamId?: string;
81
81
  /**
82
- * Cash held beside the positions, entered by hand. A broker account that
83
- * reports its own cash is shown instead of this.
82
+ * Cash held beside the positions, entered by hand: the first balance, in one
83
+ * currency. A broker account that reports its own cash is shown instead of
84
+ * this. Builds before several currencies read only this one.
84
85
  */
85
86
  cash?: PortfolioCash;
87
+ /**
88
+ * The cash entered by hand in other currencies than `cash`'s, one balance
89
+ * per currency, never `cash`'s own: read them with `portfolioCashBalances`
90
+ * (portfolio/cash-balances.ts), which counts each once. Absent while the
91
+ * portfolio holds cash in one currency at most.
92
+ */
93
+ otherCash?: PortfolioCash[];
86
94
  /**
87
95
  * Target weights in percent of the total value, cash included, or of the
88
96
  * gross exposure in a book that holds a short (allocation.ts WeightBasis),
package/src/ui/host.tsx CHANGED
@@ -779,6 +779,8 @@ export interface RendererHost {
779
779
  saveTextFile?(request: SaveTextFileRequest): Promise<string>;
780
780
  supportsNativeDesktopNotifications?: boolean;
781
781
  notify(notification: AppNotificationRequest): void;
782
+ notifyInBackground?(notification: AppNotificationRequest): boolean;
783
+ subscribeAppActivity?(listener: (active: boolean) => void): () => void;
782
784
  showContextMenu?(items: ContextMenuItem[]): Promise<boolean>;
783
785
  playTerminalMedia?(url: string, title?: string, options?: { muted?: boolean }): Promise<void>;
784
786
  /** Stop terminal playback started by `playTerminalMedia`. */
@@ -242,7 +242,7 @@ function stripAnsi(text: string): string {
242
242
  * break and the tab goes (withoutControlCharacters), so a name, a headline or
243
243
  * a note from a data source prints as the text it is.
244
244
  */
245
- function cliText(text: string): string {
245
+ export function cliText(text: string): string {
246
246
  if (!text.includes("\x1b")) return withoutControlCharacters(text);
247
247
  return text
248
248
  .split(ANSI_SPLIT)
@@ -1,10 +1,21 @@
1
1
  import type { CorporateActionsData, DeclaredDividendAction } from "../types/financials";
2
+ import { formatDistributionAmount } from "./format";
2
3
 
3
4
  const ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
4
5
  /** A paid row this close to a declared one is that distribution, dated a day apart. */
5
6
  const SAME_DISTRIBUTION_DAYS = 3;
6
7
  const DAY_MS = 86_400_000;
7
8
 
9
+ export function declaredDividendCash(row: DeclaredDividendAction, currency?: string | null): { amount: string; estimate?: string } {
10
+ const cash = currency ? formatDistributionAmount(row.amount, currency) : String(row.amount);
11
+ const estimate = row.cashEstimate;
12
+ if (!estimate || estimate.declaredAmount == null) return { amount: cash };
13
+ return {
14
+ amount: `${formatDistributionAmount(estimate.declaredAmount, estimate.declaredCurrency)} ${estimate.declaredCurrency}`,
15
+ estimate: `${currency || "Cash"} estimated ${cash}; FX ${estimate.fixingDate ? `fixing ${estimate.fixingDate}` : "fixing unavailable"}${estimate.basis ? `; ${estimate.basis}` : ""}`,
16
+ };
17
+ }
18
+
8
19
  function isoDate(value: unknown): string | undefined {
9
20
  return typeof value === "string" && ISO_DATE.test(value) && Number.isFinite(Date.parse(`${value}T00:00:00Z`)) ? value : undefined;
10
21
  }
@@ -34,6 +45,7 @@ export function declaredDividends(
34
45
  const at = Date.parse(`${exDate}T00:00:00Z`);
35
46
  if (paid.some((time) => Math.abs(time - at) <= SAME_DISTRIBUTION_DAYS * DAY_MS)) return [];
36
47
  return [{ exDate, amount: row.amount, ...declarationDate ? { declarationDate } : {},
37
- ...recordDate ? { recordDate } : {}, ...payDate ? { payDate } : {}, ...row.special === true ? { special: true as const } : {} }];
48
+ ...recordDate ? { recordDate } : {}, ...payDate ? { payDate } : {}, ...row.special === true ? { special: true as const } : {},
49
+ ...row.cashEstimate ? { cashEstimate: row.cashEstimate } : {} }];
38
50
  }).sort((left, right) => left.exDate.localeCompare(right.exDate));
39
51
  }
@@ -23,7 +23,7 @@ export function atSourcePrecision(value: number): number {
23
23
  return value;
24
24
  }
25
25
 
26
- type CashHistory = Pick<CorporateActionsData, "currency" | "dividends" | "declaredDividends">;
26
+ type CashHistory = Pick<CorporateActionsData, "currency" | "dividends" | "declaredDividends" | "declaredCash">;
27
27
 
28
28
  /**
29
29
  * A distribution history with its cash in the major currency unit, at its
@@ -44,5 +44,9 @@ export function cashInMajorUnits<T extends CashHistory>(actions: T): T {
44
44
  currency: unit.currency,
45
45
  dividends: Array.isArray(actions.dividends) ? actions.dividends.map(major) : actions.dividends,
46
46
  ...(Array.isArray(actions.declaredDividends) ? { declaredDividends: actions.declaredDividends.map(major) } : {}),
47
+ ...(actions.declaredCash?.announced?.paidAmount != null ? { declaredCash: {
48
+ ...actions.declaredCash,
49
+ announced: { ...actions.declaredCash.announced, paidAmount: atSourcePrecision(actions.declaredCash.announced.paidAmount / unit.divisor) },
50
+ } } : {}),
47
51
  };
48
52
  }
@@ -48,7 +48,7 @@ const PAGES: Readonly<Record<string, (code: string) => ExchangeAnnouncementsPage
48
48
  * ASX is ASX's announcements page for NST, a TSX listing SEDAR+. Null for a
49
49
  * US venue and for a venue Gloom knows no page for.
50
50
  */
51
- export function exchangeAnnouncementsPage(symbol: string, exchange: string | null | undefined): ExchangeAnnouncementsPage | null {
51
+ function exchangeAnnouncementsPage(symbol: string, exchange: string | null | undefined): ExchangeAnnouncementsPage | null {
52
52
  const page = PAGES[canonicalExchange(exchange ?? "")];
53
53
  const code = symbol.trim().toUpperCase();
54
54
  return page && code ? page(code) : null;
@@ -77,6 +77,10 @@ export function listsExchangeAnnouncements(exchange: string | null | undefined):
77
77
  */
78
78
  const ROUTINE_RETURNS = new Set(["Next Day Disclosure Returns", "Monthly Returns"]);
79
79
 
80
+ const ISSUER_RESULTS_PAGES: Readonly<Record<string, string>> = {
81
+ "RHM:XETRA": "https://www.rheinmetall.com/en/investor-relations/publications/financial-publications-and-presentations",
82
+ };
83
+
80
84
  export function isRoutineReturn(item: { category?: string | null }): boolean {
81
85
  return item.category != null && ROUTINE_RETURNS.has(item.category);
82
86
  }
@@ -90,5 +94,6 @@ export function listingAnnouncementsPage(key: string, exchange?: string | null):
90
94
  const suffixed = parsed.exchange ? null : listingSuffixExchange(parsed.symbol);
91
95
  const venue = parsed.exchange || suffixed || exchange;
92
96
  const symbol = suffixed ? parsed.symbol.replace(/\.[A-Z]+$/i, "") : parsed.symbol;
93
- return venue ? exchangeAnnouncementsPage(symbol, venue) : null;
97
+ const issuerPage = !listsExchangeAnnouncements(venue) && ISSUER_RESULTS_PAGES[`${symbol.toUpperCase()}:${canonicalExchange(venue ?? "")}`];
98
+ return issuerPage ? { name: "Company results", url: issuerPage } : venue ? exchangeAnnouncementsPage(symbol, venue) : null;
94
99
  }
@@ -1,6 +1,5 @@
1
1
  import type { CorporateActionsData, DeclaredDividendAction, Fundamentals } from "../types/financials";
2
- import { declaredDividends } from "./declared-dividends";
3
- import { formatDistributionAmount } from "./format";
2
+ import { declaredDividendCash, declaredDividends } from "./declared-dividends";
4
3
 
5
4
  /**
6
5
  * What a forward dividend yield is everywhere it shows (fundamentals, DVD,
@@ -47,7 +46,9 @@ interface DeclaredBasisOptions {
47
46
  /** The declared row on the rate's ex-date, as `$0.98`, with its pay date; null when none is stated. */
48
47
  function statedDeclaration(exDate: string, options: DeclaredBasisOptions): { amount: string; payDate: string | null } | null {
49
48
  const row = options.currency ? options.declared?.find((declared) => declared.exDate === exDate) : undefined;
50
- return row ? { amount: formatDistributionAmount(row.amount, options.currency!), payDate: isoDay(row.payDate) } : null;
49
+ if (!row) return null;
50
+ const cash = declaredDividendCash(row, options.currency);
51
+ return { amount: `${cash.amount}${cash.estimate ? ` (${cash.estimate})` : ""}`, payDate: isoDay(row.payDate) };
51
52
  }
52
53
 
53
54
  /**
@@ -522,6 +522,46 @@ export function ttmConversionNote(fundamentals: Pick<Fundamentals, "financialCur
522
522
  return `TTM converted from ${from}${rate}${when}${eps}.`;
523
523
  }
524
524
 
525
+ /**
526
+ * "TTM figures: the twelve months to 2026-06-30.": which twelve months the
527
+ * trailing revenue, net income and margin are, as Financials' TTM column
528
+ * names them. Undefined when Gloom Cloud does not say.
529
+ */
530
+ export function trailingPeriodNote(fundamentals: Pick<Fundamentals, "trailingPeriodEnd"> | null | undefined): string | undefined {
531
+ const end = fundamentals?.trailingPeriodEnd;
532
+ return end && ISO_DAY.test(end) ? `TTM figures: the twelve months to ${end}.` : undefined;
533
+ }
534
+
535
+ /** A rate as US dollars per unit of a currency, and when it was read (epoch ms), as the app's rates are held. */
536
+ interface UsdRateObservation {
537
+ rate: number;
538
+ asOf: number | null;
539
+ }
540
+
541
+ /**
542
+ * "USD figures at USD/ARS 1552.24, as of 2026-11-18 06:25 UTC.": the rate a
543
+ * figure shown in `baseCurrency` beside its own currency's (a market cap
544
+ * 7.80T ARS, 5.03B USD) was converted at, as markets quote the pair, and when
545
+ * it was read, as the TTM conversion note and `ticker` say theirs. Undefined
546
+ * for the same currency or without both rates.
547
+ */
548
+ export function baseCurrencyFiguresNote(
549
+ currency: string | null | undefined,
550
+ baseCurrency: string,
551
+ rates: ReadonlyMap<string, UsdRateObservation>,
552
+ ): string | undefined {
553
+ const from = currency?.trim().toUpperCase();
554
+ const into = baseCurrency.trim().toUpperCase();
555
+ if (!from || !into || from === into) return undefined;
556
+ const leg = (code: string): UsdRateObservation | undefined => code === "USD" ? { rate: 1, asOf: null } : rates.get(code);
557
+ const source = leg(from), target = leg(into);
558
+ if (!source || !target || !usableRate(source.rate) || !usableRate(target.rate)) return undefined;
559
+ const quoted = quotedFxPair(from, into, source.rate / target.rate);
560
+ const times = [source.asOf, target.asOf].filter((time): time is number => time != null && Number.isFinite(time));
561
+ const time = times.length > 0 ? formatUtcTime(new Date(Math.min(...times))) : "";
562
+ return `${into} figures at ${quoted.pair} ${formatFxRate(quoted.rate)}${time ? `, as of ${time}` : ""}.`;
563
+ }
564
+
525
565
  /**
526
566
  * "EPS (TTM) in USD, converted from CLP at report-date rates.": an EPS in another currency than the trailing amounts
527
567
  * beside it. Undefined when they share one.
@@ -27,6 +27,8 @@ export class DataServiceUnreachableError extends Error {
27
27
  const NO_CONNECTION_CODES = new Set([
28
28
  "ConnectionRefused",
29
29
  "FailedToOpenSocket",
30
+ // Bun 1.4's refusal of a proxy to open a tunnel to the server (Bun 1.3 hands back the proxy's 502 instead).
31
+ "ERR_PROXY_TUNNEL",
30
32
  "ECONNREFUSED",
31
33
  "ENOTFOUND",
32
34
  "EAI_AGAIN",
@@ -174,9 +174,17 @@ export function pricePointValues(point: PricePoint, integrity = pricePointIntegr
174
174
  };
175
175
  }
176
176
 
177
+ /** What every price view says of the bars it shows whose prices contradict each other. */
178
+ export const CONTRADICTORY_PRICES = "contradictory prices";
179
+
180
+ /**
181
+ * "2 bars have contradictory prices; left blank.", or undefined for none: the bars a view shows blank because their
182
+ * high, low, open and close contradict each other. Only views that show those bars say it; a figure read across them
183
+ * names itself instead (priceReturnIntegrityNotice).
184
+ */
177
185
  export function priceHistoryIntegrityNotice(count: number): string | undefined {
178
186
  return count > 0
179
- ? `${count} inconsistent OHLC ${count === 1 ? "bar is" : "bars are"} unavailable. Affected calculations contain gaps; original values and reasons are retained in JSON exports.`
187
+ ? `${count === 1 ? "1 bar has" : `${count} bars have`} ${CONTRADICTORY_PRICES}; left blank.`
180
188
  : undefined;
181
189
  }
182
190
 
@@ -0,0 +1,37 @@
1
+ import { rm } from "fs/promises";
2
+
3
+ type RemoveFolder = (path: string, options: { recursive: true; force: true }) => Promise<void>;
4
+
5
+ export interface RemoveFolderOptions {
6
+ /** How long to keep trying while the folder stays locked. */
7
+ budgetMs?: number;
8
+ /** The wait before the second try; it doubles each time, up to half a second. */
9
+ firstDelayMs?: number;
10
+ remove?: RemoveFolder;
11
+ }
12
+
13
+ /**
14
+ * Removes a folder, trying again while something still holds a file in it.
15
+ * Windows keeps a folder locked for a moment after the program that used it
16
+ * has gone: a browser's helper processes finishing, a virus scan of what was
17
+ * just written. Bun's `rm` takes `maxRetries` and `retryDelay` and ignores
18
+ * both (1.3.14), so the first EBUSY is final unless it is retried here.
19
+ *
20
+ * Never throws. Resolves null once the folder is gone, or the last error when
21
+ * it is still locked after `budgetMs`.
22
+ */
23
+ export async function removeFolder(path: string, options: RemoveFolderOptions = {}): Promise<unknown> {
24
+ const { budgetMs = 3_000, firstDelayMs = 50, remove = rm } = options;
25
+ const deadline = Date.now() + budgetMs;
26
+ let delayMs = firstDelayMs;
27
+ for (;;) {
28
+ try {
29
+ await remove(path, { recursive: true, force: true });
30
+ return null;
31
+ } catch (error) {
32
+ if (Date.now() + delayMs > deadline) return error;
33
+ }
34
+ await new Promise((resolve) => setTimeout(resolve, delayMs));
35
+ delayMs = Math.min(delayMs * 2, 500);
36
+ }
37
+ }
@@ -73,7 +73,7 @@ export function inferCadence(payments: readonly Pick<CashDistribution, "exDate">
73
73
  * the window holds fewer than one year of payments. Irregular cash uses the
74
74
  * plain window, so special distributions are neither dropped nor extended.
75
75
  */
76
- function trailingPayments<Payment extends CashDistribution>(payments: readonly Payment[], asOf: Date): { counted: Payment[]; perYear: number | null; cadence: DistributionCadence | null } {
76
+ export function trailingPayments<Payment extends CashDistribution>(payments: readonly Payment[], asOf: Date): { counted: Payment[]; perYear: number | null; cadence: DistributionCadence | null } {
77
77
  const known = payments.filter((payment) => payment.exDate <= asOf && Number.isFinite(payment.amount) && payment.amount > 0)
78
78
  .sort((a, b) => a.exDate.getTime() - b.exDate.getTime());
79
79
  const cutoff = calendarMonthsBefore(asOf, 12);