@gloom-sh/terminal 0.20.17 → 0.20.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/cot.ts +5 -6
  7. package/src/api-client/data.ts +14 -3
  8. package/src/api-client/heard-from.ts +72 -0
  9. package/src/api-client/index.ts +64 -6
  10. package/src/api-client/mna.ts +18 -0
  11. package/src/api-client/request.ts +162 -40
  12. package/src/api-client/supply-chain.ts +9 -0
  13. package/src/api-client/types/billing.ts +35 -1
  14. package/src/api-client/types/news.ts +45 -0
  15. package/src/api-client/types/world-venues.ts +9 -0
  16. package/src/app/global-shortcuts.ts +5 -3
  17. package/src/app/pro-welcome/keys.ts +27 -0
  18. package/src/app/pro-welcome/model.ts +158 -0
  19. package/src/app/pro-welcome/row.tsx +176 -0
  20. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  21. package/src/app/runtime/external-profile-changes.ts +135 -0
  22. package/src/app.tsx +37 -4
  23. package/src/architecture/core-builtin-allowlist.json +1 -1
  24. package/src/architecture/floating-promise-allowlist.json +1 -2
  25. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  26. package/src/cli/alert-listing.ts +98 -0
  27. package/src/cli/commands/market.ts +191 -39
  28. package/src/cli/commands/overview.ts +7 -1
  29. package/src/cli/commands/plugins.ts +3 -2
  30. package/src/cli/commands/search.ts +30 -6
  31. package/src/cli/commands/ticker.ts +13 -6
  32. package/src/cli/context.ts +24 -5
  33. package/src/cli/csv-export.ts +2 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +3 -1
  35. package/src/cli/desktop-pane-shot-view.ts +0 -1
  36. package/src/cli/desktop-pane-shot.ts +276 -52
  37. package/src/cli/errors.ts +3 -9
  38. package/src/cli/exit-codes.ts +1 -1
  39. package/src/cli/glossary.ts +65 -11
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/history-demergers.ts +117 -0
  42. package/src/cli/history-rows.ts +8 -4
  43. package/src/cli/index.ts +2 -1
  44. package/src/cli/known-gaps.ts +16 -0
  45. package/src/cli/known-us-stocks.ts +18 -0
  46. package/src/cli/listing-arg.ts +192 -38
  47. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  48. package/src/cli/pane-functions/catalog-snapshot.json +877 -0
  49. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  50. package/src/cli/pane-functions/catalog.ts +50 -16
  51. package/src/cli/pane-functions/data.ts +16 -4
  52. package/src/cli/pane-functions/dom.ts +54 -8
  53. package/src/cli/pane-functions/freshness.ts +39 -4
  54. package/src/cli/pane-functions/function-help.ts +3 -3
  55. package/src/cli/pane-functions/headless.ts +9 -1
  56. package/src/cli/pane-functions/index.ts +175 -50
  57. package/src/cli/pane-functions/report-notices.ts +10 -0
  58. package/src/cli/pane-functions/resolver.ts +11 -7
  59. package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
  60. package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
  61. package/src/cli/pane-functions/screenshot-payload.ts +36 -1
  62. package/src/cli/pane-functions/screenshot-render.ts +24 -9
  63. package/src/cli/pane-functions/screenshot-types.ts +9 -0
  64. package/src/cli/quote-answer.ts +33 -17
  65. package/src/cli/registry.ts +22 -2
  66. package/src/cli/result.ts +22 -4
  67. package/src/cli/scroll-truncation.ts +7 -2
  68. package/src/cli/series-search.ts +45 -6
  69. package/src/cli/shot-temp-dir.ts +4 -9
  70. package/src/cli/ticker-resolution.ts +1 -1
  71. package/src/cli/unreachable.ts +21 -0
  72. package/src/components/chart/composite/drawing-store.ts +11 -7
  73. package/src/components/chart/composite/format.ts +1 -0
  74. package/src/components/chart/composite/legend.tsx +48 -20
  75. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  76. package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
  77. package/src/components/chart/composite/panel-surface.tsx +1 -1
  78. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  79. package/src/components/chart/composite/tools.ts +164 -39
  80. package/src/components/chart-table/header.tsx +11 -2
  81. package/src/components/chart-table/layout.ts +16 -17
  82. package/src/components/command-bar/pane-templates/items.ts +17 -1
  83. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  84. package/src/components/command-bar/routes/root/results.ts +34 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +19 -4
  86. package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
  87. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  88. package/src/components/command-bar/selection-runtime.ts +29 -5
  89. package/src/components/command-bar/surface/index.tsx +4 -1
  90. package/src/components/command-bar/workflow/alert.ts +32 -13
  91. package/src/components/data-table/view.tsx +15 -2
  92. package/src/components/form-modal/content.tsx +9 -4
  93. package/src/components/index.ts +1 -1
  94. package/src/components/layout/header.tsx +9 -5
  95. package/src/components/layout/pane/capture-status.ts +6 -0
  96. package/src/components/layout/pane/footer/index.tsx +2 -0
  97. package/src/components/layout/pane/footer/model.ts +123 -17
  98. package/src/components/layout/pane/header.tsx +16 -2
  99. package/src/components/layout/pane/status-footer.ts +24 -0
  100. package/src/components/market-board/index.tsx +4 -2
  101. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  102. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  103. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  104. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  105. package/src/components/onboarding/setup-cards.ts +36 -0
  106. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  107. package/src/components/onboarding/wizard-account.ts +6 -1
  108. package/src/components/onboarding/wizard-model.ts +32 -6
  109. package/src/components/onboarding/wizard-positions.ts +1 -1
  110. package/src/components/price-performance.tsx +26 -8
  111. package/src/components/reader/article-reader.tsx +12 -5
  112. package/src/components/sign-in-gate.tsx +3 -1
  113. package/src/components/toggle-list.tsx +6 -8
  114. package/src/components/ui/confirm-dialog.tsx +47 -7
  115. package/src/components/ui/data-table/opentui/index.tsx +7 -0
  116. package/src/components/ui/data-table/types.ts +8 -0
  117. package/src/components/ui/display.tsx +17 -2
  118. package/src/components/ui/index.ts +1 -1
  119. package/src/components/ui/stat-grid.tsx +4 -0
  120. package/src/components/ui/status.tsx +13 -1
  121. package/src/components/ui/table-layout.ts +34 -2
  122. package/src/components/use-pane-notice-footer.tsx +16 -3
  123. package/src/data/config/store/index.ts +31 -0
  124. package/src/data/config/store/node.ts +61 -11
  125. package/src/data/config/store/normalize.ts +4 -6
  126. package/src/data/config/store/shared-file.ts +309 -0
  127. package/src/data/profile-merge.ts +299 -0
  128. package/src/data/sqlite/checkpointer.ts +11 -1
  129. package/src/data/sqlite/database.ts +1 -1
  130. package/src/data/ticker-repository.ts +134 -10
  131. package/src/data/ticker-store.ts +67 -0
  132. package/src/data/ticker-writes.ts +5 -0
  133. package/src/i18n/es.ts +27 -0
  134. package/src/i18n/ja.ts +27 -0
  135. package/src/i18n/ko.ts +27 -0
  136. package/src/i18n/zh-cn.ts +27 -0
  137. package/src/i18n/zh-tw.ts +27 -0
  138. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  139. package/src/market-data/ah-pair.ts +122 -0
  140. package/src/market-data/coordinator/entries.ts +6 -4
  141. package/src/market-data/coordinator/index.ts +14 -3
  142. package/src/market-data/depositary-pair.ts +6 -2
  143. package/src/market-data/futures-board.ts +36 -29
  144. package/src/market-data/futures-contract.ts +37 -1
  145. package/src/market-data/hooks.tsx +33 -2
  146. package/src/market-data/market/change-basis.ts +11 -1
  147. package/src/market-data/market/header-market.ts +11 -0
  148. package/src/market-data/market/status.ts +40 -4
  149. package/src/market-data/performance.ts +127 -32
  150. package/src/market-data/quotes/time.ts +5 -2
  151. package/src/market-data/split-terms.ts +28 -0
  152. package/src/news/types.ts +28 -0
  153. package/src/notifications/app-badge.ts +2 -3
  154. package/src/notifications/app-notifier.ts +5 -0
  155. package/src/plugins/builtin/account-management/footer.ts +1 -1
  156. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  157. package/src/plugins/builtin/account-management/model.ts +1 -0
  158. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  159. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  160. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  161. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  162. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  163. package/src/plugins/builtin/alerts/cli.ts +101 -48
  164. package/src/plugins/builtin/alerts/command.ts +39 -9
  165. package/src/plugins/builtin/alerts/constants.ts +10 -0
  166. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  167. package/src/plugins/builtin/alerts/event-rows.ts +9 -3
  168. package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
  169. package/src/plugins/builtin/alerts/format.ts +24 -8
  170. package/src/plugins/builtin/alerts/headless.ts +12 -6
  171. package/src/plugins/builtin/alerts/index.tsx +97 -16
  172. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  173. package/src/plugins/builtin/alerts/option-contract.ts +197 -0
  174. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  175. package/src/plugins/builtin/alerts/price.ts +30 -5
  176. package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
  177. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  178. package/src/plugins/builtin/alerts/research-builder.ts +5 -10
  179. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  180. package/src/plugins/builtin/alerts/types.ts +7 -0
  181. package/src/plugins/builtin/analytics/account-returns.ts +1 -1
  182. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  183. package/src/plugins/builtin/analytics/pane-model.ts +2 -2
  184. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  185. package/src/plugins/builtin/analytics/risk-client.ts +27 -14
  186. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  187. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  188. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  189. package/src/plugins/builtin/awards/pane.tsx +1 -1
  190. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  191. package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
  192. package/src/plugins/builtin/catalysts/model.ts +2 -1
  193. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  194. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  195. package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
  196. package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
  197. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  198. package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
  199. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  200. package/src/plugins/builtin/chart-composer/index.tsx +17 -5
  201. package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
  202. package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
  203. package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
  204. package/src/plugins/builtin/chat/index.tsx +0 -1
  205. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  206. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  207. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  208. package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
  209. package/src/plugins/builtin/company-kpis/headless.ts +10 -5
  210. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  211. package/src/plugins/builtin/company-kpis/model.ts +57 -15
  212. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  213. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  214. package/src/plugins/builtin/composite/application.ts +14 -0
  215. package/src/plugins/builtin/composite/broker.ts +12 -0
  216. package/src/plugins/builtin/composite/credit.ts +33 -0
  217. package/src/plugins/builtin/composite/crypto.ts +10 -0
  218. package/src/plugins/builtin/composite/earnings.ts +12 -0
  219. package/src/plugins/builtin/composite/filings.ts +13 -0
  220. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  221. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  222. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  223. package/src/plugins/builtin/composite/ownership.ts +23 -0
  224. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  225. package/src/plugins/builtin/composite/quant.ts +15 -0
  226. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  227. package/src/plugins/builtin/composite/screeners.ts +11 -0
  228. package/src/plugins/builtin/composite/shared.ts +11 -0
  229. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  230. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  231. package/src/plugins/builtin/congress-trades/model.ts +9 -5
  232. package/src/plugins/builtin/correlation/index.tsx +13 -17
  233. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  234. package/src/plugins/builtin/cot/client.ts +2 -3
  235. package/src/plugins/builtin/cot/headless.ts +16 -16
  236. package/src/plugins/builtin/cot/index.tsx +6 -6
  237. package/src/plugins/builtin/cot/model.ts +25 -5
  238. package/src/plugins/builtin/cot/pane.tsx +11 -6
  239. package/src/plugins/builtin/cot/series.ts +11 -8
  240. package/src/plugins/builtin/cpi/model.ts +15 -4
  241. package/src/plugins/builtin/cpi/pane.tsx +29 -7
  242. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  243. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  244. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  245. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  246. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  247. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  248. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  249. package/src/plugins/builtin/doe/model.ts +30 -0
  250. package/src/plugins/builtin/doe/pane.tsx +8 -2
  251. package/src/plugins/builtin/earnings/board-table.ts +9 -4
  252. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  253. package/src/plugins/builtin/earnings/headless.ts +16 -6
  254. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  255. package/src/plugins/builtin/earnings/history-table.ts +7 -4
  256. package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
  257. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  258. package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
  259. package/src/plugins/builtin/econ/calendar-model.ts +16 -0
  260. package/src/plugins/builtin/econ/index.tsx +7 -2
  261. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  262. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  263. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  264. package/src/plugins/builtin/exposure/model.ts +10 -0
  265. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  266. package/src/plugins/builtin/futures/model.ts +14 -1
  267. package/src/plugins/builtin/futures/series.ts +1 -8
  268. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  269. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  270. package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
  271. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  272. package/src/plugins/builtin/insider/detail.tsx +36 -7
  273. package/src/plugins/builtin/insider/filing-stories.ts +110 -0
  274. package/src/plugins/builtin/insider/headless.ts +37 -2
  275. package/src/plugins/builtin/insider/index.tsx +79 -10
  276. package/src/plugins/builtin/insider/model.ts +43 -5
  277. package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
  278. package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
  279. package/src/plugins/builtin/jobs/headless.ts +2 -1
  280. package/src/plugins/builtin/jobs/model.ts +6 -0
  281. package/src/plugins/builtin/jobs/pane.tsx +8 -3
  282. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  283. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  284. package/src/plugins/builtin/mna/detail.tsx +67 -6
  285. package/src/plugins/builtin/mna/headless.ts +128 -13
  286. package/src/plugins/builtin/mna/model.ts +219 -16
  287. package/src/plugins/builtin/mna/pane.tsx +34 -6
  288. package/src/plugins/builtin/money-markets/model.ts +14 -5
  289. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  290. package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
  291. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  292. package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
  293. package/src/plugins/builtin/options/analytics.ts +1 -1
  294. package/src/plugins/builtin/options/view.tsx +18 -11
  295. package/src/plugins/builtin/options-positioning/model.ts +11 -0
  296. package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
  297. package/src/plugins/builtin/options-scenario/client.ts +49 -8
  298. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  299. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  300. package/src/plugins/builtin/options-scenario/headless.ts +7 -3
  301. package/src/plugins/builtin/options-scenario/model.ts +33 -2
  302. package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
  303. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  304. package/src/plugins/builtin/pe-band/client.ts +13 -1
  305. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  306. package/src/plugins/builtin/pe-band/model.ts +63 -10
  307. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  308. package/src/plugins/builtin/perps/cascade.ts +4 -3
  309. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  310. package/src/plugins/builtin/perps/model.ts +4 -3
  311. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  312. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  313. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  314. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  315. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  316. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  317. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  318. package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
  319. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  320. package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
  321. package/src/plugins/builtin/research/event-model.ts +43 -19
  322. package/src/plugins/builtin/research/headless.ts +8 -1
  323. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  324. package/src/plugins/builtin/research-search/index.tsx +3 -1
  325. package/src/plugins/builtin/scanner/denied.tsx +16 -4
  326. package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
  327. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  328. package/src/plugins/builtin/sec/filing-display.tsx +14 -2
  329. package/src/plugins/builtin/sec/headless.ts +42 -4
  330. package/src/plugins/builtin/sec/index.tsx +21 -1
  331. package/src/plugins/builtin/sectors/index.tsx +6 -9
  332. package/src/plugins/builtin/sectors/sector-model.ts +1 -1
  333. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  334. package/src/plugins/builtin/shared/earnings-report.ts +49 -5
  335. package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
  336. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  337. package/src/plugins/builtin/shared/statement-currency.ts +23 -0
  338. package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
  339. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  340. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  341. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  342. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  343. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  344. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  345. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  346. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  347. package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
  348. package/src/plugins/builtin/themes/headless.ts +4 -4
  349. package/src/plugins/builtin/themes/model.ts +11 -8
  350. package/src/plugins/builtin/themes/pane.tsx +2 -2
  351. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  352. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  353. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
  354. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
  355. package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
  356. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
  357. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
  358. package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
  359. package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
  360. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
  361. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
  362. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
  363. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  364. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  365. package/src/plugins/builtin/volatility/model.ts +17 -0
  366. package/src/plugins/builtin/volatility/pane.tsx +16 -7
  367. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  368. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  369. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  370. package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
  371. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  372. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  373. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  374. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  375. package/src/plugins/builtin/world-venue-map/model.ts +6 -1
  376. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  377. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  378. package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
  379. package/src/plugins/catalog-browser.ts +10 -1
  380. package/src/plugins/catalog-data.ts +20 -0
  381. package/src/plugins/catalog-lazy.ts +51 -0
  382. package/src/plugins/catalog-ui.ts +16 -18
  383. package/src/plugins/host-smoke.ts +5 -2
  384. package/src/portfolio/allocation.ts +79 -19
  385. package/src/portfolio/cash-balances.ts +76 -0
  386. package/src/portfolio/mutations.ts +43 -8
  387. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  388. package/src/renderers/browser/activity.ts +16 -0
  389. package/src/renderers/browser/app-badge-host.ts +14 -0
  390. package/src/renderers/browser/main.tsx +5 -0
  391. package/src/renderers/browser/notifications.ts +103 -0
  392. package/src/renderers/browser/ui-host.tsx +4 -0
  393. package/src/renderers/desktop/window-layouts.ts +14 -0
  394. package/src/renderers/dom/data-table/index.tsx +27 -4
  395. package/src/renderers/dom/data-table/row.tsx +2 -0
  396. package/src/renderers/dom/host/tabs.tsx +57 -8
  397. package/src/renderers/dom/styles.css +13 -5
  398. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  399. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  400. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  401. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  402. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  403. package/src/renderers/electrobun/view/http-fetch.ts +3 -2
  404. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  405. package/src/series/standalone-catalog.ts +5 -4
  406. package/src/series/standalone.ts +13 -7
  407. package/src/sources/gloomberb-cloud/index.ts +22 -9
  408. package/src/sources/gloomberb-cloud/news.ts +35 -0
  409. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  410. package/src/sources/provider-errors.ts +34 -7
  411. package/src/sources/provider-router/financials.ts +20 -13
  412. package/src/sources/provider-router/history.ts +32 -6
  413. package/src/sources/provider-router/index.ts +4 -0
  414. package/src/sources/provider-router/search.ts +1 -0
  415. package/src/sync/collections-contributor.ts +3 -1
  416. package/src/sync/config-merge.ts +10 -1
  417. package/src/sync/sanitize.ts +26 -2
  418. package/src/tickers/company-name-listing.ts +16 -2
  419. package/src/tickers/listing-fate.ts +12 -8
  420. package/src/tickers/renamed-listings.ts +43 -10
  421. package/src/tickers/search/home-listing.ts +28 -0
  422. package/src/tickers/search/index.ts +19 -7
  423. package/src/tickers/terminal-codes.ts +11 -1
  424. package/src/time-series/base-series.ts +39 -6
  425. package/src/time-series/chart-seed.ts +2 -2
  426. package/src/time-series/history-quality.ts +4 -1
  427. package/src/time-series/hooks.ts +2 -0
  428. package/src/time-series/price-comparison.ts +17 -23
  429. package/src/time-series/reporting.ts +1 -1
  430. package/src/time-series/resolution.ts +13 -0
  431. package/src/time-series/resolve-context.ts +6 -0
  432. package/src/time-series/resolve.ts +42 -3
  433. package/src/time-series/spec.ts +2 -2
  434. package/src/time-series/types.ts +3 -2
  435. package/src/types/data-provider.ts +11 -0
  436. package/src/types/financials.ts +48 -4
  437. package/src/types/headless.ts +1 -0
  438. package/src/types/issuer-listings.ts +2 -0
  439. package/src/types/plugin-notifications.ts +3 -0
  440. package/src/types/price-history.ts +6 -4
  441. package/src/types/ticker.ts +10 -2
  442. package/src/ui/host.tsx +2 -0
  443. package/src/utils/cli-output.ts +1 -1
  444. package/src/utils/declared-dividends.ts +13 -1
  445. package/src/utils/dividend-cash.ts +5 -1
  446. package/src/utils/exchange-announcements.ts +7 -2
  447. package/src/utils/forward-dividend.ts +4 -3
  448. package/src/utils/fundamentals.ts +40 -0
  449. package/src/utils/network-failure.ts +2 -0
  450. package/src/utils/price-history-integrity.ts +9 -1
  451. package/src/utils/remove-folder.ts +37 -0
  452. package/src/utils/trailing-dividend.ts +1 -1
  453. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -1,7 +1,7 @@
1
1
  import { parseFxArgs, parseFxRequest } from "../../../cli/fx-pair";
2
2
  import { currencyMinorDigits } from "../../../market-data/market/format";
3
3
  import { parseTypedNumber } from "../../../utils/decimal-comma";
4
- import { isFxCurrency, type FxCurrency } from "./pairs";
4
+ import { CURRENCY_SETS, isFxCurrency, type FxCurrency } from "./pairs";
5
5
 
6
6
  /** An amount of one of the board's currencies, shown in every currency it lists. */
7
7
  export interface FxBoardAmount {
@@ -63,6 +63,20 @@ export function parseFxBoardAmount(text: string): FxBoardAmountRequest | { error
63
63
  return { amount, currency, to: target === currency ? null : target };
64
64
  }
65
65
 
66
+ /**
67
+ * Currencies typed for the board with no amount, to add to it: `TRY`,
68
+ * `USD,TRY`, `usd try`, a set's name (`emea`), separated by commas or spaces,
69
+ * in order without repeats. Null for anything else: an amount, a pair written
70
+ * as one (`EUR/USD`, `eur to usd`, one unit of it), a word that is neither.
71
+ */
72
+ export function parseFxBoardCurrencies(text: string): FxCurrency[] | null {
73
+ const tokens = text.trim().split(/[\s,;]+/).filter(Boolean);
74
+ if (tokens.length === 0 || /[\d/]/.test(text)) return null;
75
+ const codes = tokens.map((token) => CURRENCY_SETS.find((set) => set.id === token.toLowerCase())?.currencies
76
+ ?? (isFxCurrency(token.toUpperCase()) ? [token.toUpperCase() as FxCurrency] : null));
77
+ return codes.every((code) => code !== null) ? [...new Set(codes.flat())] : null;
78
+ }
79
+
66
80
  /** An amount as its currency writes it, grouped: 2,500,000 and 2,500,000.50 in EUR, 445,000,000 in JPY. */
67
81
  export function formatAmountFigure(amount: number, currency: string): string {
68
82
  const digits = currencyMinorDigits(currency);
@@ -7,7 +7,7 @@ import { servedFromSavedCopy } from "../../../data/saved-copies";
7
7
  import { fxPairObservation, fxRateObservations } from "../shared/fx-rate-freshness";
8
8
  import { loadFxBoard, type FxLegReading } from "./client";
9
9
  import { crossMovePercent } from "./direction";
10
- import { formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, withAmountCurrencies, type FxBoardAmount } from "./amount";
10
+ import { formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, parseFxBoardCurrencies, withAmountCurrencies, type FxBoardAmount } from "./amount";
11
11
  import { FX_CURRENCY_KEYWORDS, formatRate, resolveCurrencies, type FxCurrency } from "./pairs";
12
12
  import { FX_MATRIX_REPORT_OPTIONS, fxMatrixReportNotices } from "./settings";
13
13
 
@@ -42,16 +42,22 @@ function crossColumns(basis: string | null, amount: boolean): HeadlessPaneColumn
42
42
  }
43
43
 
44
44
  /** `fn FXC 2500000 EUR`: the amount typed after the function, as the pane's Amount field reads it; null for none. */
45
+ const typedArgument = (argument: string | string[] | null | undefined) => Array.isArray(argument) ? argument.join(" ") : argument ?? "";
46
+
45
47
  function reportAmount(argument: string | string[] | null | undefined): FxBoardAmount & { to: FxCurrency | null } | null {
46
- const typed = Array.isArray(argument) ? argument.join(" ") : argument ?? "";
48
+ const typed = typedArgument(argument);
49
+ // Currencies alone (`fn FXC TRY`) are added to the board, as `FXC TRY` adds them in the app: no amount.
50
+ if (parseFxBoardCurrencies(typed)) return null;
47
51
  const request = parseFxBoardAmount(typed);
48
52
  if (request && "error" in request) throw new Error(request.error);
49
53
  return request;
50
54
  }
51
55
 
52
- /** The board a report reads: its currencies, with the ones its amount names added at the end as the pane adds them. */
56
+ /** The board a report reads: its currencies, with the ones its argument names added at the end as the pane adds them. */
53
57
  function reportCurrencies(args: { argument?: string | string[] | null; options: Record<string, unknown> }): FxCurrency[] {
54
58
  const currencies = resolveCurrencies(args.options.currencies);
59
+ const added = parseFxBoardCurrencies(typedArgument(args.argument));
60
+ if (added) return [...currencies, ...added.filter((code) => !currencies.includes(code))];
55
61
  const amount = reportAmount(args.argument);
56
62
  return amount ? withAmountCurrencies(currencies, amount) : currencies;
57
63
  }
@@ -171,8 +177,8 @@ export function projectFxCrosses(
171
177
  export const fxMatrixHeadless: HeadlessPaneDefinition<"rows"> = {
172
178
  shape: "rows",
173
179
  argument: {
174
- kind: "free-text", optional: true, placeholder: "amount",
175
- description: "An amount to convert into each currency, as the pane's Amount field takes it: 2500000 EUR, 2,500,000 EUR/USD.",
180
+ kind: "free-text", optional: true, placeholder: "amount or currencies",
181
+ description: "An amount to convert into each currency, as the pane's Amount field takes it (2500000 EUR, 2,500,000 EUR/USD), or currencies to add to the board (TRY, USD,TRY).",
176
182
  },
177
183
  description: "Cross rates between currencies, one row per ordered pair, each with its move since the previous close, observation time and stale flag.",
178
184
  freshness: { source: "Gloom Cloud" },
@@ -212,6 +218,6 @@ export const fxMatrixHeadless: HeadlessPaneDefinition<"rows"> = {
212
218
  if (legs.length > 0 && legs.every((reading) => reading.entry == null)) {
213
219
  throw new Error(`Exchange rates unavailable for ${legs.map(({ leg }) => leg.currency).join(", ")}: ${legs[0]!.error}`);
214
220
  }
215
- return projectFxCrosses(currencies, readings, { notices: fxMatrixReportNotices(args.options), amount });
221
+ return projectFxCrosses(currencies, readings, { notices: fxMatrixReportNotices(args.options, currencies), amount });
216
222
  },
217
223
  };
@@ -11,7 +11,7 @@ import {
11
11
  type PaneFooterSegment,
12
12
  } from "../../../components";
13
13
  import { handleRefreshKey } from "../../../components/data-table/table-pane";
14
- import { getTableWidth } from "../../../components/ui/table-layout";
14
+ import { getTableWidth, markHiddenTableColumns } from "../../../components/ui/table-layout";
15
15
  import { createDataTableCsv } from "../../../components/data-table/export";
16
16
  import { ageFooterSegment, savedCopyFooterSegment } from "../../../components/layout/pane/footer";
17
17
  import { CountryFlag } from "../../../components/ui/country-flag";
@@ -43,7 +43,8 @@ import { fxMatrixSettings } from "./settings";
43
43
  import { createFxExportMetadata } from "./export";
44
44
  import { fxMatrixHeadless } from "./headless";
45
45
  import {
46
- formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, parseFxBoardAmountEdit, readFxBoardAmount, storedFxBoardAmount, withAmountCurrencies,
46
+ formatAmountFigure, formatFxBoardAmount, parseFxBoardAmount, parseFxBoardAmountEdit, parseFxBoardCurrencies, readFxBoardAmount, storedFxBoardAmount,
47
+ withAmountCurrencies,
47
48
  type FxBoardAmount,
48
49
  } from "./amount";
49
50
 
@@ -293,7 +294,7 @@ function FxMatrixPane({ focused, width, height }: PaneProps) {
293
294
  })),
294
295
  ];
295
296
  const throughEighth = columns.slice(0, columns.length - Math.max(0, currencies.length - MOVE_FITS_BESIDE));
296
- return getTableWidth(throughEighth) <= width - 1 ? columns : columns.filter((column) => column.id !== "move");
297
+ return getTableWidth(throughEighth) <= width - 1 ? columns : markHiddenTableColumns(columns, columns.filter((column) => column.id !== "move"));
297
298
  }, [amount != null, amountWidth, currencies, flagged, width]);
298
299
 
299
300
  const renderCell = useCallback((
@@ -454,9 +455,20 @@ function openFxBoard(context: PaneTemplateContext) {
454
455
  * `FXC 2,500,000 EUR`, `fx 2500000 EUR/USD`, `convert 100 eur to usd`: the
455
456
  * board open already takes the amount (one board, switched in place), with
456
457
  * the currencies it names added when it does not list them; with none open a
457
- * board opens on it. Without an amount the board opens as it is.
458
+ * board opens on it. `FXC TRY` and `FXC USD,TRY` add those currencies to the
459
+ * board the same way, its amount kept. Without either the board opens as it is.
458
460
  */
459
461
  function createFxBoardInstance(context: PaneTemplateContext, options?: PaneTemplateCreateOptions): PaneTemplateInstanceConfig {
462
+ const added = parseFxBoardCurrencies(options?.arg ?? "");
463
+ if (added) {
464
+ const open = openFxBoard(context);
465
+ const listed = resolveCurrencies(open?.settings?.currencies);
466
+ const amount = open?.settings?.amount;
467
+ return {
468
+ ...(open ? { instanceId: open.instanceId } : {}),
469
+ settings: { ...(typeof amount === "string" && amount ? { amount } : {}), currencies: [...listed, ...added.filter((code) => !listed.includes(code))] },
470
+ };
471
+ }
460
472
  const request = parseFxBoardAmount(options?.arg ?? "");
461
473
  if (!request || "error" in request) return {};
462
474
  const open = openFxBoard(context);
@@ -534,16 +546,22 @@ export const fxMatrixModule: PluginModule = {
534
546
  label: "FX Cross Rates",
535
547
  description: "Currency cross-rate matrix for major FX pairs, and an amount converted into each currency.",
536
548
  keywords: ["fx", "forex", "currency", "exchange", "rates", "cross", "matrix", "convert", "converter", "conversion", "calculator"],
537
- // `FXC 2,500,000 EUR` opens the board on the amount, as `fx 2500000 EUR/USD` converts it (fxConvertRows).
549
+ // `FXC 2,500,000 EUR` opens the board on the amount, as `fx 2500000 EUR/USD` converts it (fxConvertRows);
550
+ // `FXC TRY` and `FXC USD,TRY` add those currencies to it.
538
551
  shortcut: {
539
552
  prefix: "FXC",
540
553
  argKind: "text",
541
- argPlaceholder: "amount",
554
+ argPlaceholder: "amount or currencies",
542
555
  argOptional: true,
543
556
  openWithoutArg: true,
544
557
  argError: (arg) => {
558
+ if (parseFxBoardCurrencies(arg)) return null;
545
559
  const request = parseFxBoardAmount(arg);
546
- return request && "error" in request ? { message: `${arg.trim()} is no amount to convert`, detail: request.error.replace(/\.$/, "") } : null;
560
+ if (!request || !("error" in request)) return null;
561
+ // Words with no figure were currencies to add: say which is not on the board.
562
+ return /\d/.test(arg)
563
+ ? { message: `${arg.trim()} is no amount to convert`, detail: request.error.replace(/\.$/, "") }
564
+ : { message: `${arg.trim()} is no currency on the board`, detail: "Type codes such as USD,TRY, or an amount such as 2,500,000 EUR" };
547
565
  },
548
566
  },
549
567
  createInstance: createFxBoardInstance,
@@ -117,8 +117,13 @@ export const FX_MATRIX_REPORT_OPTIONS: readonly PaneReportOptionDef[] = [{
117
117
  normalize: parseCurrenciesOption,
118
118
  }];
119
119
 
120
- /** A report of the default board says it is only the majors, and how to choose others. */
121
- export function fxMatrixReportNotices(settings: Readonly<Record<string, unknown>>): string[] {
122
- if (settings.currencies != null) return [];
123
- return [`Showing the ${MAJOR_CURRENCIES.length} majors. Choose others with --currencies USD,ZAR,NGN; gloom catalog FXC lists all ${FX_CURRENCIES.length}.`];
120
+ /**
121
+ * A report of the default board says it is only the majors, and how to add
122
+ * others: by code after FXC, as the app's command bar takes them too, or a
123
+ * whole list with --currencies.
124
+ */
125
+ export function fxMatrixReportNotices(settings: Readonly<Record<string, unknown>>, currencies: readonly string[] = MAJOR_CURRENCIES): string[] {
126
+ if (settings.currencies != null || currencies.length !== MAJOR_CURRENCIES.length || currencies.some((code, index) => code !== MAJOR_CURRENCIES[index])) return [];
127
+ return [`Showing the ${MAJOR_CURRENCIES.length} majors. Add others with fn FXC TRY (FXC TRY in the app), or choose them with --currencies USD,ZAR,NGN; `
128
+ + `gloom catalog FXC lists all ${FX_CURRENCIES.length}.`];
124
129
  }
@@ -1,6 +1,6 @@
1
1
  import type { RefObject } from "react";
2
2
  import { Box, Text, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
3
- import { DetailScrollBody, KeyValueRow, Prose } from "../../../components";
3
+ import { ActionRow, DetailScrollBody, KeyValueRow, Prose } from "../../../components";
4
4
  import { colors } from "../../../theme/colors";
5
5
  import { wrapTextLines } from "../../../utils/text-wrap";
6
6
  import {
@@ -10,9 +10,13 @@ import {
10
10
  } from "../sec/filing-display";
11
11
  import { isAmendedInsiderFiling } from "./amendments";
12
12
  import type { InsiderReportingOwner } from "./insider-data";
13
- import { buildInsiderDisclosureText, insiderDisplayName, isInsiderDisclosureOnly } from "./model";
13
+ import { OTHER_FILING_NOTES_LABEL, buildInsiderDisclosureText, insiderDisplayName, isInsiderDisclosureOnly } from "./model";
14
14
  import type { InsiderTableRow } from "./table-model";
15
15
  import { insiderToneColor } from "./table";
16
+ import { filingStorySource, type FilingStory } from "./filing-stories";
17
+
18
+ /** Heads the stories that report the transaction's filing, under its notes. */
19
+ const STORIES_LABEL = "Stories reporting this filing";
16
20
 
17
21
  /** Every role an owner filed: the officer title, plus Director and 10% owner when the boxes add them. */
18
22
  function ownerRoles(owner: InsiderReportingOwner): string {
@@ -81,8 +85,20 @@ function detailText(row: InsiderTableRow): string {
81
85
 
82
86
  const FIELD_LABEL_WIDTH = 20;
83
87
 
84
- /** One Form 4 line read in full: who, the filing, every field, then remarks and footnotes. */
85
- export function InsiderDetail({ row, width, scrollRef }: { row: InsiderTableRow; width: number; scrollRef: RefObject<ScrollBoxRenderable | null> }) {
88
+ /** The heading over another line's notes reads muted, as the filing's own lines above the fields do. */
89
+ const textColor = (line: string) => (line === OTHER_FILING_NOTES_LABEL ? colors.textMuted : colors.text);
90
+
91
+ /**
92
+ * One Form 4 line read in full: who, the filing, every field, then remarks and
93
+ * footnotes, and the stories that report the filing, each opening in a pane.
94
+ */
95
+ export function InsiderDetail({ row, width, scrollRef, stories = [], onOpenStory }: {
96
+ row: InsiderTableRow;
97
+ width: number;
98
+ scrollRef: RefObject<ScrollBoxRenderable | null>;
99
+ stories?: readonly FilingStory[];
100
+ onOpenStory?: (story: FilingStory) => void;
101
+ }) {
86
102
  const textWidth = Math.max(width - 2, 12);
87
103
  const fields = detailFields(row);
88
104
  const text = detailText(row);
@@ -114,13 +130,26 @@ export function InsiderDetail({ row, width, scrollRef }: { row: InsiderTableRow;
114
130
  {text && <Box height={1} />}
115
131
  {nativePaneChrome
116
132
  ? text.split("\n").map((line, index) => (line.trim()
117
- ? <Prose key={`text-${index}`} text={line} width={textWidth} color={colors.text} figures={false} />
133
+ ? <Prose key={`text-${index}`} text={line} width={textWidth} color={textColor(line)} figures={false} />
118
134
  : <Text key={`text-${index}`}>{" "}</Text>))
119
- : text.split("\n").flatMap((line) => wrapTextLines(line, textWidth)).map((line, index) => (
135
+ : text.split("\n").flatMap((line) => wrapTextLines(line, textWidth).map((wrapped) => ({ wrapped, color: textColor(line) }))).map(({ wrapped, color }, index) => (
120
136
  <Box key={`text-${index}`} height={1}>
121
- <Text fg={colors.text}>{line}</Text>
137
+ <Text fg={color}>{wrapped}</Text>
122
138
  </Box>
123
139
  ))}
140
+ {stories.length > 0 && (
141
+ <>
142
+ <Box height={1} />
143
+ <Box height={nativePaneChrome ? undefined : 1}>
144
+ <Text fg={colors.textMuted}>{STORIES_LABEL}</Text>
145
+ </Box>
146
+ {stories.map((story) => (
147
+ <ActionRow key={story.id} label={story.headline} onPress={() => onOpenStory?.(story)}>
148
+ <Text fg={colors.textDim}>{filingStorySource(story)}</Text>
149
+ </ActionRow>
150
+ ))}
151
+ </>
152
+ )}
124
153
  </Box>
125
154
  </DetailScrollBody>
126
155
  );
@@ -0,0 +1,110 @@
1
+ import { useEffect, useState } from "react";
2
+ import { apiClient } from "../../../api-client";
3
+ import type { CloudInsiderFilingStoriesResponse } from "../../../api-client";
4
+ import { shortStoryId } from "../../../news/story-id";
5
+ import { formatShortDate } from "../../../utils/datetime-format";
6
+ import { logFailure } from "../../../utils/log-failure";
7
+ import { createTtlCache } from "../../../data/ttl-cache";
8
+
9
+ /*
10
+ * The stories that report a Form 4, as Gloom Cloud matches them: the filing's
11
+ * owner named in a story about its company's insiders trading, in the months
12
+ * after its trades, the filing among the ones the story's own page lists. What
13
+ * an INS or SEC row names to go from the filing to the news and back.
14
+ */
15
+
16
+ export interface FilingStory {
17
+ id: string;
18
+ headline: string;
19
+ /** When the story was first published, ISO. */
20
+ publishedAt: string;
21
+ publisher: string;
22
+ }
23
+
24
+ type StoriesClient = Pick<typeof apiClient, "getCloudInsiderFilingStories">;
25
+
26
+ const ACCESSION = /^\d{10}-\d{2}-\d{6}$/;
27
+ /** As many filings as Gloom Cloud reads in one request; a longer list is asked in several. */
28
+ const BATCH = 20;
29
+ /** A filing's stories, by accession, for a few minutes: an INS or SEC pane asks again as its rows redraw. */
30
+ const cache = createTtlCache<FilingStory[]>({ ttlMs: 5 * 60_000, maxEntries: 500 });
31
+
32
+ function storiesOf(item: CloudInsiderFilingStoriesResponse["items"][number]): FilingStory[] {
33
+ return (item.stories ?? []).flatMap((story) => (
34
+ story?.id && story.headline
35
+ ? [{ id: story.id, headline: story.headline, publishedAt: story.firstPublishedAt, publisher: story.primaryPublisher ?? "" }]
36
+ : []
37
+ ));
38
+ }
39
+
40
+ /**
41
+ * The stories reporting each filing, by accession number, from a short-lived
42
+ * cache where it has them. A filing Gloom Cloud could not be asked about is
43
+ * left out of the map: no stories said is not "none". A batch that fails (a
44
+ * server without the lookup, a session it refuses, a rate or capacity limit)
45
+ * ends the asking without an error: the batches answered before it are kept,
46
+ * and the rows that would have named stories name none.
47
+ */
48
+ export async function loadFilingStories(
49
+ accessions: readonly string[],
50
+ client: StoriesClient = apiClient,
51
+ ): Promise<Map<string, FilingStory[]>> {
52
+ const result = new Map<string, FilingStory[]>();
53
+ const wanted: string[] = [];
54
+ // Asked in batches, one request for a page of rows, so each accession is kept as its answer arrives.
55
+ for (const accession of new Set(accessions)) {
56
+ if (!ACCESSION.test(accession)) continue;
57
+ const hit = cache.peek(accession);
58
+ if (hit) result.set(accession, hit);
59
+ else wanted.push(accession);
60
+ }
61
+ for (let start = 0; start < wanted.length; start += BATCH) {
62
+ const batch = wanted.slice(start, start + BATCH);
63
+ let response: CloudInsiderFilingStoriesResponse;
64
+ try {
65
+ response = await client.getCloudInsiderFilingStories(batch);
66
+ } catch (error) {
67
+ // The next batch would meet the same refusal: stop, keeping what was answered.
68
+ logFailure("insider.filing-stories", "Read the stories reporting filings failed")(error);
69
+ break;
70
+ }
71
+ for (const item of response.items ?? []) {
72
+ if (!batch.includes(item.accession)) continue;
73
+ const stories = storiesOf(item);
74
+ cache.set(item.accession, stories);
75
+ result.set(item.accession, stories);
76
+ }
77
+ }
78
+ return result;
79
+ }
80
+
81
+ /** The stories reporting one filing, read once it is open; none while they load or when they cannot be read. */
82
+ export function useFilingStories(accession: string | null | undefined): FilingStory[] {
83
+ const [state, setState] = useState<{ accession: string; stories: FilingStory[] } | null>(null);
84
+ useEffect(() => {
85
+ if (!accession || !ACCESSION.test(accession)) return;
86
+ let active = true;
87
+ void loadFilingStories([accession])
88
+ .then((found) => {
89
+ if (active) setState({ accession, stories: found.get(accession) ?? [] });
90
+ })
91
+ .catch(logFailure("insider.filing-stories", "Read the stories reporting a filing failed"));
92
+ return () => { active = false; };
93
+ }, [accession]);
94
+ return state && state.accession === accession ? state.stories : [];
95
+ }
96
+
97
+ /** `7 Oct 2026 · Quartz`: when and where a story was first published. */
98
+ export function filingStorySource(story: FilingStory): string {
99
+ const day = story.publishedAt ? formatShortDate(story.publishedAt, { utc: true, fallback: "" }) : "";
100
+ return [day, story.publisher].filter(Boolean).join(" · ");
101
+ }
102
+
103
+ /**
104
+ * A story as a report's note names it, with the id `fn story` opens it by:
105
+ * `Story 3224efb6 (7 Oct 2026 · Quartz): Q3 2026 insider stock sales: ...`.
106
+ */
107
+ export function filingStoryNote(story: FilingStory): string {
108
+ const source = filingStorySource(story);
109
+ return `Story ${shortStoryId(story.id)}${source ? ` (${source})` : ""}: ${story.headline}`;
110
+ }
@@ -63,6 +63,8 @@ import { REPORT_ROWS } from "../shared/headless-options";
63
63
  import { mapWithConcurrency } from "../../../utils/concurrency";
64
64
  import { describeCollections, findNamedCollection, readWatchlistArgument, watchlistMemberSymbol } from "../../../portfolio/collection-name";
65
65
  import type { FxHistoryClient } from "../../../market-data/fx-closes";
66
+ import { logFailure } from "../../../utils/log-failure";
67
+ import { filingStoryNote, loadFilingStories, type FilingStory } from "./filing-stories";
66
68
 
67
69
  const INSIDER_COLUMNS: HeadlessPaneColumn[] = [
68
70
  { key: "form", header: "Form" },
@@ -319,7 +321,7 @@ function signalQuery(options: HeadlessPaneLoadArgs["options"]): InsiderSignalsQu
319
321
  /** What a Form 4/A says about itself, for its last row in the report. */
320
322
  function amendmentNote(entry: ParsedInsiderFiling): string {
321
323
  const original = entry.disclosure?.originalFilingDate;
322
- return [original ? `Original filed ${original}` : "", ...buildInsiderDisclosureText(entry).split("\n")].filter(Boolean).join("\n");
324
+ return [original ? `Original filed ${original}` : "", ...buildInsiderDisclosureText(entry, { byLine: false }).split("\n")].filter(Boolean).join("\n");
323
325
  }
324
326
 
325
327
  export interface InsiderHeadlessDependencies {
@@ -333,6 +335,8 @@ export interface InsiderHeadlessDependencies {
333
335
  args: HeadlessPaneLoadArgs,
334
336
  ctx: HeadlessPaneContext,
335
337
  ): Promise<InsiderFilingsLoad>;
338
+ /** The stories reporting each filing, by accession number (Gloom Cloud's match); the report's API client unless a test stands in. */
339
+ loadFilingStories?(accessions: readonly string[], ctx: HeadlessPaneContext): Promise<Map<string, FilingStory[]>>;
336
340
  }
337
341
 
338
342
  const defaultDependencies: InsiderHeadlessDependencies = {
@@ -351,8 +355,38 @@ const defaultDependencies: InsiderHeadlessDependencies = {
351
355
  limit,
352
356
  signal: ctx.signal,
353
357
  }),
358
+ loadFilingStories: (accessions, ctx) => loadFilingStories(accessions, ctx.apiClient),
354
359
  };
355
360
 
361
+ /**
362
+ * Each filing's rows with the stories that report it (`stories`, on every row
363
+ * of the filing), and their notes under the filing's last row after any
364
+ * amendment's: back from the Form 4 to the news, `fn story <id>` opening one.
365
+ * A filing Gloom Cloud could not be asked about keeps its rows as they were,
366
+ * and the report says nothing of it: the stories are a lead, not its data.
367
+ */
368
+ async function withFilingStories(
369
+ rows: HeadlessPaneRow[],
370
+ ctx: HeadlessPaneContext,
371
+ dependencies: InsiderHeadlessDependencies,
372
+ ): Promise<HeadlessPaneRow[]> {
373
+ const accessions = [...new Set(rows.map((row) => row.accessionNumber).filter((value): value is string => typeof value === "string"))];
374
+ const load = dependencies.loadFilingStories;
375
+ if (!load || accessions.length === 0) return rows;
376
+ const found = await load(accessions, ctx).catch(logFailure("insider.headless", "Read the stories reporting filings failed", new Map<string, FilingStory[]>()));
377
+ return rows.map((row, index) => {
378
+ const stories = typeof row.accessionNumber === "string" ? found.get(row.accessionNumber) : undefined;
379
+ if (!stories) return row;
380
+ const last = rows[index + 1]?.accessionNumber !== row.accessionNumber;
381
+ const notes = last ? [typeof row.note === "string" ? row.note : "", ...stories.map(filingStoryNote)].filter(Boolean) : [];
382
+ return {
383
+ ...row,
384
+ stories: stories.map((story) => ({ ...story })),
385
+ ...(last && notes.length ? { note: notes.join("\n") } : {}),
386
+ };
387
+ });
388
+ }
389
+
356
390
  /**
357
391
  * "CAR Group (ASX) files no SEC reports." for a listing abroad the SEC lists
358
392
  * nothing for, as `filings` says it; null for a US listing or a symbol with no
@@ -417,11 +451,12 @@ async function readTickerTrades(
417
451
  .filter((row) => row.status !== "parsed" && row.status !== "disclosure")
418
452
  .map((row) => row.accessionNumber))];
419
453
  // A filing's lines sit together, so its note goes once, under the last of them.
420
- const rows: HeadlessPaneRow[] = buildInsiderRows(filtered, parsed).map((row, index) => {
454
+ const built: HeadlessPaneRow[] = buildInsiderRows(filtered, parsed).map((row, index) => {
421
455
  const entry = filtered[index]!;
422
456
  const last = filtered[index + 1]?.filing.accessionNumber !== entry.filing.accessionNumber;
423
457
  return isAmendedInsiderFiling(entry) && last ? { ...row, note: amendmentNote(entry) || null } : row;
424
458
  });
459
+ const rows = await withFilingStories(built, ctx, dependencies);
425
460
  return {
426
461
  rows,
427
462
  empty,
@@ -14,6 +14,7 @@ import {
14
14
  import { instrumentFromTicker } from "../../../market-data/request-types";
15
15
  import { Box, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
16
16
  import {
17
+ ChoiceDialog,
17
18
  DataTableStackView,
18
19
  EmptyState,
19
20
  PaneLinkMenu,
@@ -29,7 +30,7 @@ import {
29
30
  type StackSortPreference,
30
31
  type StatItem,
31
32
  } from "../../../components";
32
- import { useDebouncedPluginPaneState, usePluginPaneState } from "../../runtime";
33
+ import { useDebouncedPluginPaneState, usePluginAppActions, usePluginPaneState } from "../../runtime";
33
34
  import { homeInsiderReportsNote, mayBeSecEquityListing, mayBeUsEquityTicker, noSecReportsNotice, nonUsSecListingVenue } from "../../../utils/sec";
34
35
  import { parsePublicTickerKey } from "../../../utils/exchanges";
35
36
  import { formatCompact } from "../../../utils/format";
@@ -71,6 +72,9 @@ import {
71
72
  } from "./table-model";
72
73
  import { renderInsiderCell } from "./table";
73
74
  import { InsiderDetail, insiderDetailTitle } from "./detail";
75
+ import { useFilingStories, type FilingStory } from "./filing-stories";
76
+ import { useOptionalDialog, type PromptContext } from "../../../ui/dialog";
77
+ import { logFailure } from "../../../utils/log-failure";
74
78
  import { InsiderActivityView, type InsiderViewControl } from "./insiders";
75
79
  import { InsiderSignalsView, type InsiderOpenedCompany } from "./signals";
76
80
  import { InsiderTickersView } from "./tickers";
@@ -114,17 +118,27 @@ const TYPE_FILTER_LABELS: Record<InsiderTypeFilter, string> = {
114
118
  other: "Other",
115
119
  };
116
120
 
121
+ /** `21 Aug`, with the year when it is not this one's. */
122
+ function windowDay(day: string, now = Date.now()): string {
123
+ const sameYear = day.slice(0, 4) === new Date(now).toISOString().slice(0, 4);
124
+ return formatShortDate(`${day}T00:00:00Z`, { utc: true, year: sameYear ? false : "numeric" });
125
+ }
126
+
117
127
  /**
118
128
  * The 90-day buy and sale totals as figures: one cell per side, and per
119
- * security when there are several. A side with no trades shows 0 shares,
120
- * muted. Buys read in the gain colour and sales in the loss colour, as in
121
- * the table; when the Type filter hides open-market trades the figures dim
122
- * and say so. With `currency` the dollars read with its code (1.2M USD), as
123
- * the table's CCY column names them.
129
+ * security when there are several. The last cell says once, for the band,
130
+ * what they count: trades dated since the window's first day (by trade date,
131
+ * not filing date) in the filings loaded, which a narrow pane gives up before
132
+ * the figures, the 90 days staying in the labels. A side with no trades shows
133
+ * 0 shares, muted. Buys read in the gain colour and sales in the loss colour,
134
+ * as in the table; when the Type filter hides open-market trades the figures
135
+ * dim and say so. With `currency` the dollars read with its code (1.2M USD),
136
+ * as the table's CCY column names them.
124
137
  */
125
138
  function summaryItems(figures: InsiderSummaryFigures, typeFilter: InsiderTypeFilter, currency?: string): StatItem[] {
126
139
  const securities = new Set(figures.totals.map((total) => total.security));
127
140
  const hidden = typeFilter === "other";
141
+ const since = windowDay(figures.window.from);
128
142
  const items: StatItem[] = [];
129
143
  for (const side of ["P", "S"] as const) {
130
144
  const label = side === "P" ? "90d buys" : "90d sales";
@@ -145,6 +159,16 @@ function summaryItems(figures: InsiderSummaryFigures, typeFilter: InsiderTypeFil
145
159
  });
146
160
  }
147
161
  }
162
+ // Once, after the last figure: the trade dates counted, and that they are the loaded filings' trades.
163
+ const last = items.at(-1);
164
+ if (last) {
165
+ const detail = last.detail ?? "";
166
+ const window = `trades since ${since}`;
167
+ const coverage = `${window}, ${figures.filings} ${figures.filings === 1 ? "filing" : "filings"} loaded`;
168
+ const join = (...parts: string[]) => parts.filter(Boolean).join(" \u00b7 ");
169
+ // Narrower, the window keeps its first day longest: what "90d" is from.
170
+ items[items.length - 1] = { ...last, detail: join(detail, coverage), detailVariants: [join(detail, window), join(detail, `since ${since}`), detail] };
171
+ }
148
172
  return items;
149
173
  }
150
174
 
@@ -183,7 +207,8 @@ const freshTradesState = (tickerKey: string, insider: string | null = null): Sta
183
207
  */
184
208
  function useInsiderTradesState(tickerKey: string, stacked: boolean, insider: string | null = null): InsiderTradesState {
185
209
  const [paneSelectedId, setPaneSelectedId] = usePluginPaneState<string | null>(`insider:selectedId:${tickerKey}`, null);
186
- const [paneNameFilter, setPaneNameFilter] = usePluginPaneState<string | null>(`insider:nameFilter:${tickerKey}`, null);
210
+ // A pane opened on an insider (a story's filings) starts filtered to them, as one opened from the ranking does.
211
+ const [paneNameFilter, setPaneNameFilter] = usePluginPaneState<string | null>(`insider:nameFilter:${tickerKey}`, insider);
187
212
  const [paneTypeFilter, setPaneTypeFilter] = usePluginPaneState<InsiderTypeFilter>("insider:typeFilter", DEFAULT_INSIDER_TYPE_FILTER);
188
213
  const [paneOpenItemId, setPaneOpenItemIdState] = useDebouncedPluginPaneState<string | null>(`insider:openItemId:${tickerKey}`, null);
189
214
  const setPaneOpenItemId = useCallback(
@@ -425,6 +450,34 @@ function InsiderTradesView({ ticker, viewBar, state, width, height, focused, sta
425
450
  };
426
451
  const handleFilterPress = useCallback(() => filterActionRef.current(), []);
427
452
 
453
+ // The stories that report the open transaction's filing: back from the Form 4 to the news about it.
454
+ const openStories = useFilingStories(openRow && !openRow.entry.isLoading ? openRow.entry.filing.accessionNumber : null);
455
+ const { createPaneFromTemplate } = usePluginAppActions();
456
+ const dialog = useOptionalDialog();
457
+ const openStory = useCallback((story: FilingStory) => {
458
+ createPaneFromTemplate("news-story-pane", { arg: story.id, values: { title: story.headline } });
459
+ }, [createPaneFromTemplate]);
460
+ const chooseStory = useCallback(() => {
461
+ if (openStories.length === 1) {
462
+ openStory(openStories[0]!);
463
+ return;
464
+ }
465
+ if (!dialog || openStories.length === 0) return;
466
+ void dialog.prompt<string>({
467
+ closeOnClickOutside: true,
468
+ content: (ctx: PromptContext<string>) => (
469
+ <ChoiceDialog
470
+ {...ctx}
471
+ title="Stories"
472
+ choices={openStories.map((story, index) => ({ id: String(index), label: story.headline, detail: story.publisher }))}
473
+ />
474
+ ),
475
+ }).then((choice) => {
476
+ const story = choice ? openStories[Number(choice)] : undefined;
477
+ if (story) openStory(story);
478
+ }).catch(logFailure("insider.detail", "Choose a story reporting the filing failed"));
479
+ }, [dialog, openStories, openStory]);
480
+
428
481
  // Reading on: the next or previous row opens in place, and the cursor
429
482
  // follows it so Back lands on the last one read.
430
483
  const openIndex = openRow ? sortedRows.findIndex((row) => row.id === openRow.id) : -1;
@@ -440,8 +493,9 @@ function InsiderTradesView({ ticker, viewBar, state, width, height, focused, sta
440
493
  hints: [
441
494
  { id: "insider-next", key: "n", label: "ext", title: "Next Transaction", disabled: openIndex >= sortedRows.length - 1, onPress: () => openAdjacent(1) },
442
495
  { id: "insider-previous", key: "p", label: "rev", title: "Previous Transaction", disabled: openIndex <= 0, onPress: () => openAdjacent(-1) },
496
+ ...(openStories.length > 0 ? [{ id: "insider-story", key: "s", label: "tory", title: "Open Story", onPress: chooseStory }] : []),
443
497
  ],
444
- } : null), [focused, openAdjacent, openIndex, sortedRows.length]);
498
+ } : null), [chooseStory, focused, openAdjacent, openIndex, openStories.length, sortedRows.length]);
445
499
 
446
500
  const pendingLabel = pendingCount > 0 ? `loading ${pendingCount}...` : "";
447
501
  const footerInfo = useMemo(() => [
@@ -519,7 +573,9 @@ function InsiderTradesView({ ticker, viewBar, state, width, height, focused, sta
519
573
  onBack={() => setOpenItemId(null)}
520
574
  detailTitle={openRow ? insiderDetailTitle(openRow) : undefined}
521
575
  detailScrollRef={detailScrollRef}
522
- detailContent={openRow ? <PaneLinkMenu><InsiderDetail row={openRow} width={width} scrollRef={detailScrollRef} /></PaneLinkMenu> : <Box flexGrow={1} />}
576
+ detailContent={openRow
577
+ ? <PaneLinkMenu><InsiderDetail row={openRow} width={width} scrollRef={detailScrollRef} stories={openStories} onOpenStory={openStory} /></PaneLinkMenu>
578
+ : <Box flexGrow={1} />}
523
579
  selection={{
524
580
  kind: "index",
525
581
  selectedIndex: sortedRows.length > 0 ? selectedRowIndex : null,
@@ -720,9 +776,16 @@ function insiderPaneSymbols(settings: Record<string, unknown> | undefined): stri
720
776
  * selling. A ranked company opens here as INS on its ticker, and Back
721
777
  * returns to the ranking.
722
778
  */
779
+ /** The insider a pane was opened on (`settings.insider`, as filed), whose trades it starts filtered to. */
780
+ function insiderPaneInsider(settings: Record<string, unknown> | undefined): string | undefined {
781
+ const insider = settings?.insider;
782
+ return typeof insider === "string" && insider.trim() ? insider.trim() : undefined;
783
+ }
784
+
723
785
  function InsiderPane({ width, height, focused }: PaneProps) {
724
786
  const { symbol: paneSymbol } = usePaneTickerIdentity();
725
787
  const instance = usePaneInstance();
788
+ const openedInsider = insiderPaneInsider(instance?.settings);
726
789
  // One list per set of tickers, so the views' loads do not start again on every render.
727
790
  const symbolsKey = insiderPaneSymbols(instance?.settings).join(",");
728
791
  const symbols = useMemo(() => (symbolsKey ? symbolsKey.split(",") : []), [symbolsKey]);
@@ -737,7 +800,7 @@ function InsiderPane({ width, height, focused }: PaneProps) {
737
800
  if (!paneSymbol && instance?.binding?.kind !== "follow") {
738
801
  return <InsiderSignalsView width={width} height={height} focused={focused} renderCompany={renderRankedCompany} />;
739
802
  }
740
- return <InsiderView width={width} height={height} focused={focused} />;
803
+ return <InsiderView width={width} height={height} focused={focused} {...(openedInsider ? { insider: openedInsider } : {})} />;
741
804
  }
742
805
 
743
806
  const tickerTemplate = createTickerSurfacePaneTemplate({
@@ -750,6 +813,12 @@ const tickerTemplate = createTickerSurfacePaneTemplate({
750
813
  canCreate: (_context, options) => !options?.ticker || mayBeSecEquityListing(options.ticker),
751
814
  // Typed alone with no active ticker it ranks the market's insider buying or selling.
752
815
  withoutTickerTitle: INSIDER_SIGNALS_TITLE,
816
+ // Opened on one insider (a story's filings, `values.insider` as filed): a window of its own, filtered to them.
817
+ settings: (_symbol, _context, options) => {
818
+ const insider = options?.values?.insider?.trim();
819
+ return insider ? { insider } : undefined;
820
+ },
821
+ viewKey: (_symbol, _context, options) => options?.values?.insider?.trim() || undefined,
753
822
  });
754
823
 
755
824
  /**