@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
@@ -94,12 +94,29 @@ export function matchesInsiderTypeFilter(entry: ParsedInsiderFiling, filter: Ins
94
94
  return true;
95
95
  }
96
96
 
97
- export function buildInsiderDisclosureText(entry: ParsedInsiderFiling): string {
97
+ /** Heads the footnotes a transaction's own line does not cite, under the ones it does. */
98
+ export const OTHER_FILING_NOTES_LABEL = "Other notes on this filing";
99
+
100
+ /**
101
+ * A row's remarks and footnotes: the notes its own line cites first, in the
102
+ * order it cites them (a sale's weighted-average range and its 10b5-1 plan),
103
+ * then the filing's remarks, then the notes on its other lines under their own
104
+ * heading, so a sale never reads the tax withholding's note above its own.
105
+ */
106
+ export function buildInsiderDisclosureText(entry: ParsedInsiderFiling, { byLine = true }: { byLine?: boolean } = {}): string {
98
107
  const disclosure = entry.disclosure;
99
108
  if (!disclosure) return "";
109
+ const byId = new Map(disclosure.footnotes.map((note) => [note.id, note]));
110
+ // `byLine: false` reads the filing as a whole (a 4/A's note under its rows): its remarks, then every note in order.
111
+ const own = byLine ? (entry.transaction?.footnoteIds ?? []).flatMap((id) => byId.get(id) ?? []) : [];
112
+ const ownIds = new Set(own.map((note) => note.id));
113
+ const others = disclosure.footnotes.filter((note) => !ownIds.has(note.id));
114
+ const line = (note: { id: string; text: string }) => `${note.id}: ${note.text}`;
100
115
  return [
116
+ ...own.map(line),
101
117
  disclosure.remarks ? `Remarks: ${disclosure.remarks}` : "",
102
- ...disclosure.footnotes.map((note) => `${note.id}: ${note.text}`),
118
+ ...(own.length > 0 && others.length > 0 ? [OTHER_FILING_NOTES_LABEL] : []),
119
+ ...others.map(line),
103
120
  ].filter(Boolean).join("\n\n");
104
121
  }
105
122
 
@@ -116,6 +133,13 @@ export interface InsiderSummaryFigures {
116
133
  totals: InsiderSideTotal[];
117
134
  /** Some loaded filings could not be read into complete transactions. */
118
135
  incomplete: boolean;
136
+ /**
137
+ * The trade dates the totals count, as UTC days (YYYY-MM-DD): from the first
138
+ * day inside the 90 days to today. A total is by trade date, not filing date.
139
+ */
140
+ window: { from: string; to: string };
141
+ /** The loaded filings the totals were read from, each counted once. */
142
+ filings: number;
119
143
  }
120
144
 
121
145
  /** Words a filer adds or leaves out without naming another class: "Common Stock" and "Common" are one. */
@@ -146,7 +170,7 @@ export function buildInsiderSummaryFigures(parsed: readonly ParsedInsiderFiling[
146
170
  if (isInsiderDisclosureOnly(entry)) return false;
147
171
  return !transaction?.filingDate || transaction.shares == null || !transaction.transactionType || !transaction.securityTitle;
148
172
  });
149
- const cutoff = now - NINETY_DAYS_MS;
173
+ const cutoff = insiderSummaryCutoff(now);
150
174
  const totals = new Map<string, InsiderSideTotal>();
151
175
  // Shares under each spelling of a class, so a total is named the way most of its shares were filed.
152
176
  const spellings = new Map<string, Map<string, number>>();
@@ -172,7 +196,8 @@ export function buildInsiderSummaryFigures(parsed: readonly ParsedInsiderFiling[
172
196
  const filed = [...spellings.get(key)!];
173
197
  total.security = filed.reduce((best, entry) => (entry[1] > best[1] ? entry : best), filed[0]!)[0];
174
198
  }
175
- return { totals: [...totals.values()], incomplete };
199
+ const filings = new Set(parsed.map(({ filing }) => filing.accessionNumber)).size;
200
+ return { totals: [...totals.values()], incomplete, window: insiderSummaryWindow(now), filings };
176
201
  }
177
202
 
178
203
  /** The oldest filing date that the 90-day totals need loaded before they cover the whole window. */
@@ -180,11 +205,24 @@ export function insiderSummaryCutoff(now = Date.now()): number {
180
205
  return now - NINETY_DAYS_MS;
181
206
  }
182
207
 
208
+ const DAY_MS = 24 * 60 * 60 * 1000;
209
+
210
+ /**
211
+ * The trade dates the 90-day totals count, as UTC days: a trade is dated to
212
+ * its day's midnight, so the first day counted is the first whose midnight is
213
+ * inside the window, and the last is today.
214
+ */
215
+ function insiderSummaryWindow(now = Date.now()): { from: string; to: string } {
216
+ const first = Math.ceil(insiderSummaryCutoff(now) / DAY_MS) * DAY_MS;
217
+ return { from: new Date(first).toISOString().slice(0, 10), to: new Date(now).toISOString().slice(0, 10) };
218
+ }
219
+
183
220
  /** Summarize only loaded non-derivative buys/sales, grouped by security. */
184
221
  export function buildInsiderSummary(parsed: ParsedInsiderFiling[], now = Date.now(), context: readonly ParsedInsiderFiling[] = parsed): string | null {
185
222
  const figures = buildInsiderSummaryFigures(parsed, now, context);
186
223
  if (!figures) return null;
187
- const prefix = "Loaded filings, last 90 days: ";
224
+ // What the totals count, said before them: the filings read, and the trade dates, not the filing dates.
225
+ const prefix = `${figures.filings} loaded ${figures.filings === 1 ? "filing" : "filings"}, trades dated ${figures.window.from} to ${figures.window.to}: `;
188
226
  const coverage = figures.incomplete ? " | Some transactions unavailable or incomplete." : "";
189
227
  if (figures.totals.length === 0) return `${prefix}no parsed non-derivative buys/sales.${coverage}`;
190
228
  return prefix + figures.totals.map((total) => total.unreconciled
@@ -1,7 +1,9 @@
1
1
  import { apiClient } from "../../../api-client";
2
+ import { ApiRequestError, isTransientFailure } from "../../../api-client/errors";
2
3
  import type { IpoCalendarParams, IpoCalendarPayload, IpoDeal, IpoLockup, IpoSourceHealth } from "../../../api-client/ipo";
3
4
  import type { HeadlessPaneApiClient } from "../../../types/plugin";
4
5
  import { createPluginCache } from "../../../data/plugin-cache";
6
+ import { signalWithTimeout } from "../../../utils/async-deadline";
5
7
  import { cachedCloudResource, loadCloudResource, unavailableOnServer, type CloudResource } from "../shared/cloud-resource";
6
8
 
7
9
  /**
@@ -88,8 +90,16 @@ export async function fetchIpoCalendar(
88
90
  signal?: AbortSignal,
89
91
  params: IpoCalendarParams = {},
90
92
  ): Promise<IpoCalendarPayload> {
93
+ const requestSignal = signalWithTimeout(signal, 30_000);
94
+ const read = () => client.getCloudIpoCalendar(params, { signal: requestSignal });
91
95
  try {
92
- return validateIpoCalendar(await client.getCloudIpoCalendar(params, { signal }));
96
+ requestSignal.throwIfAborted();
97
+ const data = await read().catch((error: unknown) => {
98
+ if (requestSignal.aborted || !isTransientFailure(error)
99
+ || (error instanceof ApiRequestError && (error.retryAfterMs ?? 0) > 0)) throw error;
100
+ return read();
101
+ });
102
+ return validateIpoCalendar(data);
93
103
  } catch (error) {
94
104
  // The route answers 503 until its first pass has run.
95
105
  throw unavailableOnServer(error, UNAVAILABLE, [404, 503]);
@@ -1,6 +1,6 @@
1
1
  import type { IpoDeal, IpoRegion, IpoSourceHealth, IpoStatus } from "../../../api-client/ipo";
2
2
  import type { DataTableColumn } from "../../../components";
3
- import { getTableWidth } from "../../../components/ui/table-layout";
3
+ import { dropColumnsToFit, getTableWidth } from "../../../components/ui/table-layout";
4
4
  import { publicTickerKey } from "../../../utils/exchanges";
5
5
  import { MISSING_VALUE, displayWidth, formatCompact } from "../../../utils/format";
6
6
  import { compareSortValues, type SortPreference } from "../../../utils/sort-values";
@@ -358,12 +358,8 @@ export function marketColumnWidth(deals: readonly IpoDeal[]): number {
358
358
  }
359
359
 
360
360
  export function buildIpoColumns(width: number, marketWidth = 10): IpoColumn[] {
361
- let columns = IPO_COLUMNS.map((column) => (column.id === "market" ? { ...column, width: marketWidth } : column));
362
- for (const id of NARROW_DROP_ORDER) {
363
- if (ipoTableWidth(columns) <= width) break;
364
- columns = columns.filter((column) => column.id !== id);
365
- }
366
- return columns;
361
+ const columns = IPO_COLUMNS.map((column) => (column.id === "market" ? { ...column, width: marketWidth } : column));
362
+ return dropColumnsToFit(columns, width - 1, NARROW_DROP_ORDER);
367
363
  }
368
364
 
369
365
  /**
@@ -14,12 +14,13 @@ import {
14
14
  formatSalaryRange,
15
15
  formatShare,
16
16
  functionLabel,
17
+ pendingJobsTitle,
17
18
  } from "./model";
18
19
 
19
20
  function companyBundle(symbol: string, state: Exclude<JobsCompanyState, { kind: "denied" }>, roleLimit: number): HeadlessBundleResult {
20
21
  if (state.kind === "pending") {
21
22
  return {
22
- sections: [{ title: "Hiring", entries: [{ label: "Status", value: "pending", formatted: state.message }] }],
23
+ sections: [{ title: "Hiring", entries: [{ label: "Status", value: "pending", formatted: `${pendingJobsTitle(symbol)} A first read usually lands within a few minutes; ask again then.` }] }],
23
24
  metadata: { symbol, status: "pending" },
24
25
  };
25
26
  }
@@ -51,6 +51,12 @@ const SENIORITY_SHORT: Record<string, string> = {
51
51
  executive: "Exec",
52
52
  };
53
53
 
54
+ /** What JOBS says while the server looks for a company's careers system: a first read takes minutes, not a load. */
55
+ export function pendingJobsTitle(symbol: string): string {
56
+ return `Looking for ${symbol}'s careers system.`;
57
+ }
58
+ export const PENDING_JOBS_MESSAGE = "Roles show here once it is read, usually within a few minutes. This pane checks again on its own.";
59
+
54
60
  export function functionLabel(id: string | null | undefined): string {
55
61
  if (!id) return "Unclassified";
56
62
  return FUNCTION_LABELS[id] ?? id;
@@ -47,6 +47,8 @@ import {
47
47
  buildMoverColumns,
48
48
  buildMoverRows,
49
49
  buildPostingColumns,
50
+ PENDING_JOBS_MESSAGE,
51
+ pendingJobsTitle,
50
52
  buildPostingRows,
51
53
  buildShareBars,
52
54
  changeTone,
@@ -562,11 +564,14 @@ function CompanyPanel({
562
564
  }
563
565
  if (!data) return null;
564
566
  if (data.kind === "pending") {
567
+ // An answer, not a load: the server is looking, which takes minutes, so the pane says so at once and fills in
568
+ // when the poll above brings the roles. A spinner here stood for minutes and read as a pane that never loaded.
565
569
  return (
566
570
  <PaneStatusBody
567
- loading
568
- align="center"
569
- loadingLabel={`Looking for ${symbol}'s careers system. First read lands within a few minutes.`}
571
+ empty
572
+ emptyTitle={pendingJobsTitle(symbol)}
573
+ emptyMessage={PENDING_JOBS_MESSAGE}
574
+ retry={{ onRetry: reloadAndWait, pending: loading, label: "Check now", pendingLabel: "Checking...", unchanged: "Still looking." }}
570
575
  />
571
576
  );
572
577
  }
@@ -239,13 +239,15 @@ export function KellySizerPane({ focused, width, height }: PaneProps) {
239
239
  ? portfolioFinancials.get(requestedSymbol!) ?? null
240
240
  : financials;
241
241
  const { accountState } = usePortfolioAccountState(activePortfolio, { brokerAccounts, config });
242
- // Cash entered by hand counts toward a manual portfolio's bankroll; a broker's is in its Net Liq.
242
+ // Cash entered by hand, in every currency it is held in, counts toward a manual portfolio's bankroll; a broker's is in its Net Liq.
243
243
  const manualCash = accountState ? null : resolvePortfolioCash(activePortfolio, null);
244
+ const manualCashKey = manualCash?.balances.map((balance) => balance.currency).join(",") ?? "";
245
+ const manualCashCurrencies = useMemo(() => (manualCashKey ? manualCashKey.split(",") : []), [manualCashKey]);
244
246
  // The sized ticker's own currency too: its units are counted at the base currency's rate to it.
245
247
  const sizedCurrency = financials?.quote?.currency || ticker?.metadata.currency || null;
246
248
  const trackedCurrencies = useMemo(
247
- () => [...buildTrackedCurrencies(portfolioTickers, portfolioFinancials, accountState, config.baseCurrency, manualCash?.currency), sizedCurrency],
248
- [accountState, config.baseCurrency, manualCash?.currency, portfolioFinancials, portfolioTickers, sizedCurrency],
249
+ () => [...buildTrackedCurrencies(portfolioTickers, portfolioFinancials, accountState, config.baseCurrency, manualCashCurrencies), sizedCurrency],
250
+ [accountState, config.baseCurrency, manualCashCurrencies, portfolioFinancials, portfolioTickers, sizedCurrency],
249
251
  );
250
252
  const exchangeRates = useFxRatesMap(trackedCurrencies);
251
253
  const portfolioSummary = useMemo(
@@ -270,7 +272,10 @@ export function KellySizerPane({ focused, width, height }: PaneProps) {
270
272
  netLiquidation,
271
273
  brokerPortfolio: !!activePortfolio?.brokerInstanceId,
272
274
  holdings: portfolioSummary.allocationHoldings ?? [],
273
- cashValue: manualCash ? convertCurrency(manualCash.amount, manualCash.currency, config.baseCurrency, exchangeRates) : null,
275
+ // Each balance converted once; one without a rate leaves the sum, and so the bankroll, unknown.
276
+ cashValue: manualCash
277
+ ? manualCash.balances.reduce((sum, balance) => sum + convertCurrency(balance.amount, balance.currency, config.baseCurrency, exchangeRates), 0)
278
+ : null,
274
279
  });
275
280
  const sourceCurrentValue = getPortfolioPositionValue({
276
281
  ticker,
@@ -1,11 +1,13 @@
1
1
  import { useMemo } from "react";
2
2
  import {
3
3
  DELAYED_SEGMENT,
4
- PaneStatusBody, type DataTableCell,
4
+ PaneStatusBody, RowNote, type DataTableCell,
5
5
  type DataTableColumn,
6
6
  type PaneFooterSegment
7
7
  } from "../../../components";
8
8
  import { useAsyncResource } from "../../../react/async-resource";
9
+ import { Box } from "../../../ui";
10
+ import { wrapTextLines } from "../../../utils/text-wrap";
9
11
  import { usePaneSettingValue } from "../../../state/app/context";
10
12
  import { colors } from "../../../theme/colors";
11
13
  import type { PaneProps } from "../../../types/plugin";
@@ -102,6 +104,17 @@ function cellsFor(row: IndicatorRow): Record<ColumnId, DataTableCell> {
102
104
  };
103
105
  }
104
106
 
107
+ /** The selected indicator, its own limitation (a stale or missing latest reading) said above its chart. */
108
+ function SelectedIndicatorDetail({ view, note, width, height, focused }: {
109
+ view: IndicatorViewModel; note: string | null; width: number; height: number; focused?: boolean;
110
+ }) {
111
+ const noteRows = note ? wrapTextLines(note, Math.max(1, width - 2)).length : 0;
112
+ return <Box flexDirection="column" width={width} height={height}>
113
+ <RowNote>{note}</RowNote>
114
+ <IndicatorDetail view={view} width={width} height={Math.max(1, height - noteRows)} focused={focused} />
115
+ </Box>;
116
+ }
117
+
105
118
  export function MarketValuationPane({ focused, width, height }: PaneProps) {
106
119
  const [indicatorId, setIndicatorId] = usePaneSettingValue<string>(
107
120
  "indicator",
@@ -137,15 +150,14 @@ export function MarketValuationPane({ focused, width, height }: PaneProps) {
137
150
  const { selected } = list;
138
151
  const selectedView = selected?.view;
139
152
 
140
- const basisErrors = new Set(INDICATORS.flatMap((indicator) => {
141
- const reason = indicatorUnavailableReason(indicator);
142
- return reason ? [`${indicator.label}: ${reason}`] : [];
143
- }));
144
- const sourceError = bundle?.errors.find((entry) => !basisErrors.has(entry));
145
- const unavailableCount = bundle?.errors.filter((entry) => basisErrors.has(entry)).length ?? 0;
153
+ // The footer says what concerns the whole board: a failure no indicator owns, else how many cannot be read. An
154
+ // indicator's own reason is its row's ("Unavailable") and its detail's.
155
+ const ownedByRow = (entry: string) => rows.some(({ indicator }) => [indicator.label, ...indicatorSeries(indicator).map((def) => def.key)]
156
+ .some((prefix) => entry.startsWith(`${prefix}:`)));
157
+ const sourceError = bundle?.errors.find((entry) => !ownedByRow(entry));
158
+ const unavailableCount = rows.filter((row) => row.error && !row.view).length;
146
159
  const bodyError = resource.error ?? sourceError ?? null;
147
- const error = bodyError ?? selected?.error
148
- ?? (unavailableCount ? `${unavailableCount} unavailable` : null);
160
+ const error = bodyError ?? (unavailableCount ? `${unavailableCount} unavailable` : null);
149
161
  const footerInfo = useMemo<PaneFooterSegment[]>(() => {
150
162
  if (!selectedView) return [];
151
163
  const info: PaneFooterSegment[] = [
@@ -196,7 +208,7 @@ export function MarketValuationPane({ focused, width, height }: PaneProps) {
196
208
  getRowId={indicatorKey}
197
209
  renderCell={renderIndicatorCell}
198
210
  emptyStateTitle={list.normalizedQuery ? "No indicator matches." : error ?? "No indicators."}
199
- renderDetail={(size) => selectedView ? <IndicatorDetail view={selectedView} {...size} /> : (
211
+ renderDetail={(size) => selectedView ? <SelectedIndicatorDetail view={selectedView} note={selected.error} {...size} /> : (
200
212
  <PaneStatusBody
201
213
  error={selected.error ?? "No data."}
202
214
  errorTitle={`${selected.indicator.label} unavailable`}
@@ -34,11 +34,18 @@ import {
34
34
  formatPrice,
35
35
  inQuoteCurrency,
36
36
  isElection,
37
+ legsApart,
37
38
  MISSING,
38
39
  offerSeries,
40
+ outsideDateParts,
41
+ printWhen,
42
+ spreadBasisLabel,
39
43
  stageLabel,
40
44
  termsLabel,
45
+ type SpreadLeg,
41
46
  } from "./model";
47
+ import { formatFeedTime } from "../../../utils/datetime-format";
48
+ import { quoteAgeText } from "../../../market-data/quotes/freshness";
42
49
 
43
50
  /** "ACV Auctions Inc. ← Copart, Inc.": the target, then who is buying it. */
44
51
  export function mnaDealTitle(deal: MnaDeal): string {
@@ -102,6 +109,29 @@ function useDealHistory(deal: MnaDeal | null, leg: "cash" | "stock" | null) {
102
109
  return history?.key === key ? history : null;
103
110
  }
104
111
 
112
+ /** A print's time on the reader's clock: `04:24` today, `Mon 19:47` this week. */
113
+ const printClock = (at: number) => formatFeedTime(at);
114
+
115
+ /**
116
+ * A leg's latest print as its figure says it: when it traded, after its
117
+ * session when that is not the regular one, and how old it is
118
+ * (`pre-market 04:24 · 2h 50m old`); in a narrow cell the session and time,
119
+ * which are never dropped.
120
+ */
121
+ function legFigure(entry: SpreadLeg, now: number): StatItem {
122
+ if (entry.at == null) return { id: `leg:${entry.symbol}`, label: entry.symbol, value: formatPrice(entry.price) };
123
+ const when = printWhen(entry.at, entry.session, printClock);
124
+ return {
125
+ id: `leg:${entry.symbol}`,
126
+ label: entry.symbol,
127
+ value: formatPrice(entry.price),
128
+ detail: `${when} · ${quoteAgeText(entry.at, now)}`,
129
+ detailVariants: [when],
130
+ // A row of its own, so its age is never what a narrow cell drops.
131
+ wide: true,
132
+ };
133
+ }
134
+
105
135
  export function MnaDealDetail({ id, seed, focused, width, height }: {
106
136
  id: string;
107
137
  /** The list's copy, drawn while the full deal loads. */
@@ -153,13 +183,26 @@ export function MnaDealDetail({ id, seed, focused, width, height }: {
153
183
  const stock = deal.terms.exchangeRatio != null;
154
184
  const currency = targetQuote?.currency ?? null;
155
185
  items.push({ id: "offer", label: "Offer", value: formatPerShare(spread.offer, currency, 2), detail: stock ? terms : undefined });
186
+ // The spread says what its prices are: a session's closes, or two trades and when (or how far apart).
187
+ const basis = spreadBasisLabel(spread.basis, printClock);
156
188
  items.push({
157
189
  id: "spread",
158
190
  label: "Spread",
159
191
  value: formatPercentShort(spread.spread),
160
- detail: formatPerShare(Math.abs(spread.offer - spread.price), currency, 2),
161
- tone: spread.spread < 0 ? "warning" : undefined,
192
+ detail: `${formatPerShare(Math.abs(spread.offer - spread.price), currency, 2)} · ${basis}`,
193
+ detailVariants: [basis],
194
+ tone: spread.spread < 0 || legsApart(spread.basis) ? "warning" : undefined,
162
195
  });
196
+ // Beside a close, the spread at the trades since it (pre-market, after hours), with when or how far apart.
197
+ if (spread.latest) {
198
+ items.push({
199
+ id: "latest",
200
+ label: "Latest",
201
+ value: formatPercentShort(spread.latest.spread),
202
+ detail: spreadBasisLabel(spread.latest.basis, printClock),
203
+ tone: legsApart(spread.latest.basis) ? "warning" : undefined,
204
+ });
205
+ }
163
206
  if (spread.annualized != null) items.push({ id: "ann", label: "Ann.", value: formatPercentShort(spread.annualized) });
164
207
  if (unaffected && unaffected.close > 0 && (deal.terms.exchangeRatio == null || leg === "cash")) {
165
208
  items.push({
@@ -182,8 +225,23 @@ export function MnaDealDetail({ id, seed, focused, width, height }: {
182
225
  items.push({ id: "closed", label: deal.status === "completed" ? "Closed" : "Ended", value: deal.closed ? formatListDate(deal.closed) : MISSING });
183
226
  } else {
184
227
  items.push({ id: "close", label: "Close", value: formatExpectedClose(deal.expectedClose) });
228
+ // The agreement's deadline, with the later one it moves to and on what, and the filing it is read from.
229
+ if (deal.outsideDate) {
230
+ const outside = outsideDateParts(deal.outsideDate);
231
+ items.push({
232
+ id: "outside",
233
+ label: "Outside",
234
+ value: outside.date,
235
+ detail: [outside.extension, outside.source].filter(Boolean).join(" · "),
236
+ detailVariants: [outside.extension ?? outside.source, ""],
237
+ wide: true,
238
+ });
239
+ }
185
240
  if (spread) items.push({ id: "stage", label: "Stage", value: stageLabel(deal) });
186
241
  }
242
+ // Each leg's latest print: price, session and age.
243
+ const now = Date.now();
244
+ for (const entry of spread?.legs ?? []) items.push(legFigure(entry, now));
187
245
  return items;
188
246
  }, [deal, leg, spread, targetQuote?.currency, unaffected]);
189
247
 
@@ -193,20 +251,23 @@ export function MnaDealDetail({ id, seed, focused, width, height }: {
193
251
  const offer = leg === "stock"
194
252
  ? offerSeries(deal, history.ratio, days, leg, (close) => inQuoteCurrency(close, ratioQuote?.currency ?? null, targetQuote?.currency))
195
253
  : offerSeries(deal, history.ratio, days, leg);
254
+ // Daily closes, so the legend leads with the day its values are (`16 Nov`): the
255
+ // spread beside it says its own basis, and the two are read on the same day's terms.
256
+ const daily = (series: ReturnType<typeof staticSeries>) => ({ ...series, observationKind: "dataset" as const });
196
257
  const priced = [
197
- staticSeries(
258
+ daily(staticSeries(
198
259
  history.target.map((point) => ({ date: point.date, observedAt: point.date, value: point.close })),
199
260
  { id: "target", label: deal.target.symbol, color: colors.text, calendarSpaced: true },
200
- ),
261
+ )),
201
262
  ];
202
263
  if (offer.length >= 2) {
203
- priced.push(staticSeries(
264
+ priced.push(daily(staticSeries(
204
265
  offer.map((row) => {
205
266
  const date = new Date(`${row.day}T00:00:00Z`);
206
267
  return { date, observedAt: date, value: row.value };
207
268
  }),
208
269
  { id: "offer", label: "Offer", color: colors.positive, calendarSpaced: true },
209
- ));
270
+ )));
210
271
  }
211
272
  return priced;
212
273
  }, [colors.positive, colors.text, deal, history, leg, ratioQuote?.currency, targetQuote?.currency]);
@@ -1,24 +1,128 @@
1
- import type { MnaDealsParams, MnaRegionFilter, MnaStatusFilter, MnaTargetFilter } from "../../../api-client/mna";
2
- import type { HeadlessPaneColumn, HeadlessPaneDefinition } from "../../../types/plugin";
1
+ import type { MnaDeal, MnaDealsParams, MnaOutsideDate, MnaRegionFilter, MnaStatusFilter, MnaTargetFilter } from "../../../api-client/mna";
2
+ import type { HeadlessPaneColumn, HeadlessPaneContext, HeadlessPaneDefinition } from "../../../types/plugin";
3
+ import type { Quote } from "../../../types/financials";
3
4
  import { fetchMnaDeals } from "./client";
4
5
  import { companyDataNotes } from "../../../types/company-from";
5
- import { dealsSymbol, formatDealValue, formatExpectedClose, stageLabel, termsLabel } from "./model";
6
+ import {
7
+ apartText,
8
+ closeBasisLabel,
9
+ dealSpread,
10
+ dealsSymbol,
11
+ formatDealValue,
12
+ formatExpectedClose,
13
+ formatPercentShort,
14
+ legsApart,
15
+ outsideDateParts,
16
+ printWhen,
17
+ stageLabel,
18
+ termsLabel,
19
+ type DealSpread,
20
+ type SpreadBasis,
21
+ } from "./model";
6
22
  import { REPORT_ROWS } from "../shared/headless-options";
23
+ import { formatUtcTime } from "../../../utils/utc-time";
24
+ import { MISSING_VALUE } from "../../../utils/format";
7
25
 
8
26
  const text = (value: unknown) => (typeof value === "string" ? value : "");
9
27
 
28
+ const percent = (value: unknown) => (typeof value === "number" ? formatPercentShort(value) : MISSING_VALUE);
29
+
30
+ /**
31
+ * What a spread's prices are, as the report says it: a session's closes
32
+ * dated in full (`Mon 16 Nov close`), or the older trade's time in UTC after
33
+ * its session when that is not the regular one, or how far apart two trades
34
+ * are too far apart to be one moment's (`trades 8h apart`).
35
+ */
36
+ function reportBasisText(basis: SpreadBasis): string {
37
+ if (basis.kind === "close") return closeBasisLabel(basis.session, Date.now(), { dated: true });
38
+ if (legsApart(basis)) return `trades ${apartText(basis.apartMs!)} apart`;
39
+ return basis.at == null ? MISSING_VALUE : printWhen(basis.at, basis.session, formatUtcTime);
40
+ }
41
+
42
+ const ANNOUNCED: HeadlessPaneColumn = { key: "announced", header: "Announced" };
43
+ const TARGET: HeadlessPaneColumn = { key: "target", header: "Target" };
44
+ const SYMBOL: HeadlessPaneColumn = { key: "targetSymbol", header: "Symbol" };
45
+ const ACQUIRER: HeadlessPaneColumn = { key: "acquirer", header: "Acquirer" };
46
+ const TERMS: HeadlessPaneColumn = { key: "terms", header: "Terms" };
47
+ const VALUE: HeadlessPaneColumn = { key: "value", header: "Value", align: "right" };
48
+ const STAGE: HeadlessPaneColumn = { key: "stage", header: "Stage" };
49
+ const CLOSE: HeadlessPaneColumn = { key: "expectedClose", header: "Close", format: (value) => formatExpectedClose(text(value) || null) };
50
+ const CLOSED: HeadlessPaneColumn = { key: "closed", header: "Closed" };
51
+ // A pending listed deal's spread, at the prices `spreadAsOf` names; the latest trades' beside a close.
52
+ const SPREAD: HeadlessPaneColumn = { key: "spread", header: "Spread", align: "right", format: percent, exportLast: true };
53
+ const SPREAD_AS_OF: HeadlessPaneColumn = { key: "spreadAsOf", header: "As of", exportLast: true };
54
+ const LATEST: HeadlessPaneColumn = {
55
+ key: "latestSpread", header: "Latest", align: "right", format: percent, exportLast: true,
56
+ textFormat: (value, row) => typeof value === "number" ? `${percent(value)} (${text(row.latestAsOf)})` : MISSING_VALUE,
57
+ };
58
+ const LATEST_AS_OF: HeadlessPaneColumn = { key: "latestAsOf", header: "Latest as of", exportLast: true };
59
+ // The agreement's deadline as a filing states it, with the later one it moves to.
60
+ const OUTSIDE: HeadlessPaneColumn = {
61
+ key: "outsideDate", header: "Outside", exportLast: true,
62
+ format: (value) => {
63
+ if (!value || typeof value !== "object") return MISSING_VALUE;
64
+ const outside = outsideDateParts(value as MnaOutsideDate);
65
+ return outside.extension ? `${outside.date}, ${outside.extension}` : outside.date;
66
+ },
67
+ };
68
+
69
+ /**
70
+ * CSV and NDJSON keep the columns an earlier export had where they were; the
71
+ * spread's and the outside date's come after them (`exportLast`).
72
+ */
10
73
  const COLUMNS: HeadlessPaneColumn[] = [
11
- { key: "announced", header: "Announced" },
12
- { key: "target", header: "Target" },
13
- { key: "targetSymbol", header: "Symbol" },
14
- { key: "acquirer", header: "Acquirer" },
15
- { key: "terms", header: "Terms" },
16
- { key: "value", header: "Value", align: "right" },
17
- { key: "stage", header: "Stage" },
18
- { key: "expectedClose", header: "Close", format: (value) => formatExpectedClose(text(value) || null) },
19
- { key: "closed", header: "Closed" },
74
+ ANNOUNCED, TARGET, SYMBOL, ACQUIRER, TERMS, VALUE, STAGE, CLOSE, CLOSED,
75
+ SPREAD, SPREAD_AS_OF, LATEST, LATEST_AS_OF, OUTSIDE,
76
+ ];
77
+ /** The text report reads the spread beside the terms it prices, its latest trades' basis in its cell. */
78
+ const TEXT_COLUMNS: HeadlessPaneColumn[] = [
79
+ ANNOUNCED, TARGET, SYMBOL, ACQUIRER, TERMS, VALUE, SPREAD, SPREAD_AS_OF, LATEST, STAGE, CLOSE, OUTSIDE, CLOSED,
20
80
  ];
21
81
 
82
+ /** The quotes of the listings pending deals' spreads are priced at, by symbol; none when the batch fails or is not offered. */
83
+ async function legQuotes(deals: readonly MnaDeal[], ctx: HeadlessPaneContext): Promise<Map<string, Quote>> {
84
+ const symbols = new Set<string>();
85
+ for (const deal of deals) {
86
+ if (deal.status !== "pending" || !deal.target.symbol) continue;
87
+ symbols.add(deal.target.symbol);
88
+ if (deal.terms.exchangeRatio != null && deal.terms.ratioSymbol) symbols.add(deal.terms.ratioSymbol);
89
+ }
90
+ const provider = ctx.marketData;
91
+ if (!provider?.getQuotesBatch || symbols.size === 0) return new Map();
92
+ try {
93
+ const results = await provider.getQuotesBatch([...symbols].map((symbol) => ({ symbol, exchange: "" })), { forceRefresh: ctx.refresh, signal: ctx.signal });
94
+ return new Map(results.flatMap((result) => result.quote ? [[result.target.symbol, result.quote] as const] : []));
95
+ } catch {
96
+ // Intentional ignore: the deals still list without spreads when the quotes do not come.
97
+ return new Map();
98
+ }
99
+ }
100
+
101
+ /** A row's spread fields: the spread and its basis, the latest trades' beside a close, and each leg's print. */
102
+ function spreadFields(spread: DealSpread | null): Record<string, unknown> {
103
+ if (!spread) return { spread: null, spreadAsOf: null, latestSpread: null, latestAsOf: null, legs: [] };
104
+ return {
105
+ spread: spread.spread,
106
+ spreadAsOf: reportBasisText(spread.basis),
107
+ spreadBasis: spread.basis,
108
+ offerValue: spread.offer,
109
+ latestSpread: spread.latest?.spread ?? null,
110
+ latestAsOf: spread.latest ? reportBasisText(spread.latest.basis) : null,
111
+ legs: spread.legs.map((entry) => ({ symbol: entry.symbol, price: entry.price, at: entry.at == null ? null : new Date(entry.at).toISOString(), session: entry.session })),
112
+ };
113
+ }
114
+
115
+ /**
116
+ * What a company's empty deal list says: the pane's "No deals involving X.",
117
+ * with the status and search asked for. Newer deals a free account waits for
118
+ * are the report's Pro line.
119
+ */
120
+ function emptyDealsText(symbol: string, params: MnaDealsParams): string {
121
+ const status = params.status && params.status !== "all" ? `${params.status} ` : "";
122
+ const query = params.query ? ` matching "${params.query}"` : "";
123
+ return `No ${status}deals involving ${symbol}${query}.`;
124
+ }
125
+
22
126
  export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
23
127
  shape: "rows",
24
128
  freshness: { status: "not-a-feed", basis: "reported deals" },
@@ -32,7 +136,7 @@ export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
32
136
  dataRequirements: ["Gloom Cloud M&A deals read from news stories, press releases and SEC filings"],
33
137
  limitations: [
34
138
  "Free accounts see deals 7 days after they were first reported.",
35
- "Spreads need live quotes and are drawn by the pane, not listed here.",
139
+ "A spread is at the legs' closes of one session while a venue is out of its regular session, at their last trades in it; As of says which, and Latest gives the trades since a close.",
36
140
  "A private or non-US deal completes only when a story reports it.",
37
141
  ],
38
142
  },
@@ -68,8 +172,17 @@ export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
68
172
  limit: Number(args.options.limit ?? 50),
69
173
  };
70
174
  const payload = await fetchMnaDeals(params, ctx.apiClient);
175
+ const quotes = await legQuotes(payload.deals, ctx);
176
+ const spreadOf = (deal: MnaDeal) => quotes.size === 0 || !deal.target.symbol ? null
177
+ : dealSpread(deal, quotes.get(deal.target.symbol) ?? null, deal.terms.ratioSymbol ? quotes.get(deal.terms.ratioSymbol) ?? null : null);
178
+ // No deal involving a company is the list's answer for it, as the pane says, never a company MA does not cover.
179
+ const none = payload.deals.length === 0 && symbol
180
+ ? { empty: emptyDealsText(filed || symbol, params), unavailableSymbols: [] }
181
+ : {};
71
182
  return {
183
+ ...none,
72
184
  columns: COLUMNS,
185
+ textColumns: TEXT_COLUMNS,
73
186
  rows: payload.deals.map((deal) => ({
74
187
  id: deal.id,
75
188
  announced: deal.announced,
@@ -89,8 +202,10 @@ export const mnaHeadless: HeadlessPaneDefinition<"rows"> = {
89
202
  value: formatDealValue(deal.value, deal.valueCurrency),
90
203
  valueUsd: deal.valueUsd,
91
204
  expectedClose: deal.expectedClose,
205
+ outsideDate: deal.outsideDate ?? null,
92
206
  closed: deal.closed,
93
207
  headline: deal.headline,
208
+ ...spreadFields(spreadOf(deal)),
94
209
  })),
95
210
  errors: payload.lockedDeals > 0 ? [`${payload.lockedDeals} deals from the last ${payload.delayDays} days need Gloom Pro`] : [],
96
211
  ...(payload.companyFrom ? { notes: companyDataNotes(payload.companyFrom) } : {}),