@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
@@ -2,7 +2,7 @@ import { logFailure } from "../../utils/log-failure";
2
2
  import { extname, isAbsolute, relative, resolve } from "path";
3
3
  import type { CliCommandContext, GloomPlugin, HeadlessArgumentExpansion } from "../../types/plugin";
4
4
  import type { MarketContext } from "../types";
5
- import { withMarketData } from "../context";
5
+ import { withConfigData, withMarketData } from "../context";
6
6
  import { buildForFile, cliStyles, renderForFile, renderStats, type CliStatEntry } from "../../utils/cli-output";
7
7
  import {
8
8
  correctCatalogQuery,
@@ -17,8 +17,9 @@ import {
17
17
  } from "./catalog";
18
18
  import { createPaneCatalog } from "./discovery";
19
19
  import { getHeadlessPaneDefinition } from "./capabilities";
20
- import { catalogFredSeriesIds, findCatalogSeries } from "../series-search";
20
+ import { catalogFredSeriesIds, findCatalogSeries, findSeriesFacts, type SeriesMatch } from "../series-search";
21
21
  import {
22
+ normalizeLookupToken,
22
23
  parsePaneCatalogArgs,
23
24
  parsePaneFunctionArgs,
24
25
  type ParsedPaneFunctionArgs,
@@ -27,7 +28,7 @@ import {
27
28
  applyListingArgument, findPaneFunction, parsePaneFunctionArgsFor, resolvePaneFunction, UnknownPaneFunctionError,
28
29
  type PluginCodeStopFinder, type ResolvedPaneFunction,
29
30
  } from "./resolver";
30
- import { idleCliPlugins } from "../registry";
31
+ import { idleCliPlugins, installedPluginCount } from "../registry";
31
32
  import { pluginSupportsTarget } from "../../plugins/plugin-export";
32
33
  import type { RegistryPlugin } from "../../plugins/marketplace/model";
33
34
  import type { AppResourceStorePort } from "../../core/app-service-ports";
@@ -36,9 +37,14 @@ import { expandResolvedArgument } from "./headless";
36
37
  import { defaultScreenshotPath, shotSizeWarnings } from "./screenshot-payload";
37
38
  import { renderDesktopShot } from "./screenshot-render";
38
39
  import { shotCutColumnsWarning, shotStatusIssues } from "./screenshot-assessment";
40
+ import { PANE_SWEEP_EVIDENCE_PATH } from "./screenshot-types";
39
41
  import {
40
42
  buildPaneCatalogEntries,
43
+ exampleListName,
44
+ type PaneCatalogEntry,
41
45
  } from "./catalog";
46
+ import { readCatalogSnapshot, snapshotEntries } from "./catalog-snapshot";
47
+ import { loadBuiltinPlugin } from "../../plugins/catalog-lazy";
42
48
  import { incompleteReportGateMessage } from "./access-gate";
43
49
  import { withPersistedCloudSession } from "./cloud-session";
44
50
  import {
@@ -46,9 +52,10 @@ import {
46
52
  } from "../listing-arg";
47
53
  import { notATickerStop } from "../company-name-hint";
48
54
  import { CLI_ERROR_CODE, failUnreachable, failWithError, isCliFailure, isSourceUnavailableAnswer, unreachableError } from "../errors";
55
+ import { dataServiceUnreachable, forgetDataServiceReach } from "../../api-client/request";
49
56
  import { DATA_SERVICE_UNREACHABLE_MESSAGE, isNetworkFailure } from "../../utils/network-failure";
50
57
  import { isTickerLinkPeer } from "../../layout/ticker-navigation";
51
- import { knownGapMessage, commandPointer, commandPointerLeads, topicPointer } from "../known-gaps";
58
+ import { appCommandPointer, knownGapMessage, commandPointer, commandPointerLeads, topicPointer } from "../known-gaps";
52
59
  import { selectReportTables, splitCsvFooter, withRefusedRows, type CliReportTables } from "../report-tables";
53
60
  import { portableCsv } from "../csv-export";
54
61
  import { cliOutputWritten, printCliResult, serializeCliResult, type CliErrorObject } from "../result";
@@ -81,11 +88,11 @@ async function withPaneRuntime<T>(
81
88
  return withMarketData(ctx, async (market) => {
82
89
  const context: MarketContext = ctx.cliOptions.refresh ? { ...market, refresh: true } : market;
83
90
  // `shot` draws a pane as the desktop app does, so it also opens the panes of plugins only the desktop app runs (Gloom Social).
84
- const plugins = settings.command === "shot" ? [...ctx.plugins, ...desktopOnlyPlugins(ctx)] : ctx.plugins;
91
+ const plugins = settings.command === "shot" ? [...ctx.plugins, ...desktopOnlyPlugins(ctx)] : await pluginsOfFunction(ctx, context, args);
85
92
  const registry = await createPaneCatalog(context, plugins);
86
93
  try {
87
94
  let parsed = await applyListingArgument(registry, context, parsePaneFunctionArgsFor(registry, args, ctx.cliOptions), settings.command);
88
- const resolution = { ...settings, seriesSources: ctx.plugins, pluginStop: pluginStopFor(ctx, context) };
95
+ const resolution = { ...settings, seriesSources: () => ctx.plugins, pluginStop: pluginStopFor(ctx, context) };
89
96
  let resolved = await resolvePaneFunction(registry, context, parsed, resolution);
90
97
  // A function that widens its argument (RV's --peers) runs, reports and captures the widened one.
91
98
  const expansion = await withPersistedCloudSession(context, () => expandResolvedArgument(resolved, context, parsed.arg));
@@ -100,6 +107,26 @@ async function withPaneRuntime<T>(
100
107
  });
101
108
  }
102
109
 
110
+ /**
111
+ * The plugins `fn` resolves a function among. A coded function that reports data, of a built-in plugin, is
112
+ * opened by that plugin and the one that holds its pane (`catalog-snapshot.json`, where a build wrote it, says
113
+ * which), so the other plugins' code is not loaded to run it. Any other word, a source checkout without that
114
+ * file, and any command line with an installed or switched-off plugin, asks them all.
115
+ */
116
+ async function pluginsOfFunction(ctx: CliCommandContext, context: MarketContext, args: string[]): Promise<GloomPlugin[]> {
117
+ if ((context.config.disabledPlugins ?? []).length > 0 || await installedPluginCount(ctx) > 0) return ctx.plugins;
118
+ let target: string;
119
+ try {
120
+ target = parsePaneFunctionArgs(args, ctx.cliOptions).target;
121
+ } catch {
122
+ // Intentional ignore: arguments that do not parse fail where they are parsed for the function.
123
+ return ctx.plugins;
124
+ }
125
+ const holders = target ? readCatalogSnapshot()?.functions[normalizeLookupToken(target)] : undefined;
126
+ const found = holders?.flatMap((id) => loadBuiltinPlugin(id) ?? []);
127
+ return found?.length ? found : ctx.plugins;
128
+ }
129
+
103
130
  /** Installed plugins the command line does not run but the desktop app does, which `shot` draws as it does. */
104
131
  function desktopOnlyPlugins(ctx: CliCommandContext): GloomPlugin[] {
105
132
  return idleCliPlugins(ctx)
@@ -321,6 +348,41 @@ function tablesHoldValues(tables: CliReportTables): boolean {
321
348
  });
322
349
  }
323
350
 
351
+ /** Whether a report's tables show a figure: a cell outside the label column with a digit in it (not a dash). */
352
+ function tablesHoldFigures(tables: CliReportTables): boolean {
353
+ return tables.tables.some((table) => {
354
+ const skipped = new Set(table.columns.flatMap((header, index) => index === 0 || header === "status" || header === "value_status" ? [index] : []));
355
+ return table.rows.some((row) => row.some((cell, index) => !skipped.has(index) && /\d/.test(String(cell ?? ""))));
356
+ });
357
+ }
358
+
359
+ /**
360
+ * Whether a report holds nothing because its reads failed: empty with a
361
+ * failure said, every row failing to reach the data service (WEI's twenty
362
+ * indices each "couldn't reach"), or every row's listing without data and no
363
+ * figure anywhere (BI's sectors, all dashes). Never one behind a wall, whose
364
+ * note is its answer, one with nothing asked yet ("Select a ticker."), or one
365
+ * with a figure from a read that did answer (VIX's term structure beside
366
+ * quotes it has none of).
367
+ */
368
+ export function reportHasNoData(data: {
369
+ empty: boolean; rowCount: number; unavailableSymbols: readonly string[]; errors?: readonly string[]; locked?: unknown;
370
+ }, tables?: CliReportTables): boolean {
371
+ if (data.locked) return false;
372
+ const errors = data.errors ?? [];
373
+ if (data.unavailableSymbols.length === 0 && errors.length === 0) return false;
374
+ if (data.empty) return true;
375
+ if (data.rowCount === 0) return false;
376
+ const unreached = errors.filter((error) => error.includes(DATA_SERVICE_UNREACHABLE_MESSAGE)).length;
377
+ if (unreached >= data.rowCount) return true;
378
+ return data.unavailableSymbols.length >= data.rowCount && !!tables && !tablesHoldFigures(tables);
379
+ }
380
+
381
+ /** A report with nothing in it because the data service went unanswered: no answer, not "no data" dated now. */
382
+ function reportFailedUnreached(data: Parameters<typeof reportHasNoData>[0], tables: CliReportTables): boolean {
383
+ return reportHasNoData(data, tables) && dataServiceUnreachable();
384
+ }
385
+
324
386
  /**
325
387
  * Why `fn` fails a report it printed, or null when the report has data. It
326
388
  * fails when it is empty (a pane behind a wall reads nothing), when it has no
@@ -424,6 +486,9 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
424
486
  if (listing) await failUnchosenListing(listing, context, ctx, { ...moved, noun: "data" }, error);
425
487
  throw error;
426
488
  }).finally(progress.stop);
489
+ // A report with nothing in it while the data service went unanswered is no answer, not "No data" dated now:
490
+ // it fails as `search` and `quote` do (G, CMP, WEI and CHOKE printed empty tables and "retrieved" at the run).
491
+ if (reportFailedUnreached(report.data, report.tables)) failUnreachable();
427
492
  // A company's name typed where its ticker goes (`fn RDCF Palantir`) found nothing: the answer is `quote`'s,
428
493
  // "Not a ticker: PALANTIR. Did you mean PLTR (Palantir Technologies Inc.)?", not an empty report. A source that
429
494
  // could not answer for the word (a timeout) says nothing of it, but when search finds the company it is that.
@@ -533,18 +598,37 @@ const SHOT_PROGRESS_AFTER_MS = 3_000;
533
598
  const FN_PROGRESS_AFTER_MS = 5_000;
534
599
 
535
600
  /**
536
- * One line on standard error when a capture or report is slow: "Still loading
537
- * the data for PORT izmir." while its data is read, "Still drawing PORT
538
- * izmir." once a capture's page draws it. Nothing for a quick one, or with --quiet.
601
+ * One line on a terminal's standard error while a capture or report is slow:
602
+ * "Still loading the data for PORT izmir." while its data is read, "Still
603
+ * drawing PORT izmir." once a capture's page draws it. It is progress, not
604
+ * part of the answer: the line is cleared once the work ends, so a finished
605
+ * report never starts with it, and standard error that is not a terminal (a
606
+ * file, a pipe, a script reading it) never gets it. Nothing for a quick one,
607
+ * or with --quiet.
539
608
  */
540
- function progressNotice(ctx: Pick<CliCommandContext, "cliOptions">, label: string, afterMs = SHOT_PROGRESS_AFTER_MS): { drawing(): void; stop(): void } {
541
- if (ctx.cliOptions.quiet) return { drawing: () => {}, stop: () => {} };
609
+ export function progressNotice(
610
+ ctx: Pick<CliCommandContext, "cliOptions">,
611
+ label: string,
612
+ afterMs = SHOT_PROGRESS_AFTER_MS,
613
+ stream: Pick<NodeJS.WriteStream, "isTTY" | "write"> = process.stderr,
614
+ ): { drawing(): void; stop(): void } {
615
+ if (ctx.cliOptions.quiet || !stream.isTTY) return { drawing: () => {}, stop: () => {} };
542
616
  let drawing = false;
617
+ let shown = false;
543
618
  const timer = setTimeout(() => {
544
- console.error(cliStyles.muted(drawing ? `Still drawing ${label}.` : `Still loading the data for ${label}.`));
619
+ // No newline: the line stays the cursor's until it is cleared.
620
+ stream.write(cliStyles.muted(drawing ? `Still drawing ${label}.` : `Still loading the data for ${label}.`));
621
+ shown = true;
545
622
  }, afterMs);
546
623
  (timer as { unref?: () => void }).unref?.();
547
- return { drawing: () => { drawing = true; }, stop: () => clearTimeout(timer) };
624
+ return {
625
+ drawing: () => { drawing = true; },
626
+ stop: () => {
627
+ clearTimeout(timer);
628
+ if (shown) stream.write("\r\x1b[2K");
629
+ shown = false;
630
+ },
631
+ };
548
632
  }
549
633
 
550
634
  export async function runPaneScreenshot(args: string[], ctx: CliCommandContext) {
@@ -583,6 +667,9 @@ async function capturePaneScreenshot(args: string[], ctx: CliCommandContext, onS
583
667
  ? resolve(process.cwd(), ensurePngExtension(parsed.outputPath))
584
668
  : defaultScreenshotPath(resolved, parsed.arg);
585
669
  const progress = progressNotice(ctx, [resolved.token, parsed.arg].filter(Boolean).join(" "));
670
+ const sweepEvidence = parsed.strict === true && ctx.cliOptions.format === "json" && !!parsed.outputPath
671
+ && process.env[PANE_SWEEP_EVIDENCE_PATH] === outputPath;
672
+ const onlyUsable = parsed.requireBotSafe === true || (parsed.strict === true && !sweepEvidence);
586
673
  const result = await renderDesktopShot({
587
674
  resolved,
588
675
  context,
@@ -596,6 +683,7 @@ async function capturePaneScreenshot(args: string[], ctx: CliCommandContext, onS
596
683
  statusLine: parsed.status !== false,
597
684
  fitRows: parsed.heightGiven !== true,
598
685
  options: parsed.options,
686
+ onlyUsable,
599
687
  onStalledReport,
600
688
  onDrawing: progress.drawing,
601
689
  }).finally(progress.stop).catch(async (error: unknown) => {
@@ -637,11 +725,12 @@ async function capturePaneScreenshot(args: string[], ctx: CliCommandContext, onS
637
725
  if (data.blankColumns?.length) stats.push(["Blank columns", cliStyles.warning(data.blankColumns.join(", "))]);
638
726
  if (data.render.emptyStateMarkers.length > 0) stats.push(["Empty states", data.render.emptyStateMarkers.join(", ")]);
639
727
  if (data.render.missingExpectedText.length > 0) stats.push(["Missing text", data.render.missingExpectedText.join(", ")]);
640
- return [`Saved ${displayPath(data.outputPath)}`, renderStats(stats)].join("\n");
728
+ return [data.saved ? `Saved ${displayPath(data.outputPath)}` : "No image saved.", renderStats(stats)].join("\n");
641
729
  },
642
730
  });
643
- // The image is saved and the reason printed; --strict tells a script it should not be used.
731
+ // A pane that drew nothing but its empty state ("No ticker selected.") fails either way, as `fn` does for an empty report.
644
732
  if (parsed.strict && !result.usable) process.exitCode = CLI_EXIT_CODES.unusableShot;
733
+ else if (!result.usable && result.render.emptyStateDetected && result.rowCount === 0) process.exitCode = CLI_EXIT_CODES.error;
645
734
  }, { command: "shot" });
646
735
  });
647
736
  }
@@ -718,46 +807,13 @@ export async function runPaneCatalog(args: string[], ctx: CliCommandContext) {
718
807
  ...parsed,
719
808
  limit: ctx.cliOptions.limit ?? parsed.limit,
720
809
  };
810
+ if (await listFromSnapshot(ctx, parsed, effectiveParsed)) return;
721
811
  await withMarketData(ctx, async (context) => {
722
812
  const registry = await createPaneCatalog(context, ctx.plugins);
723
813
  try {
724
814
  // The UI audits picture every pane the app opens, those the command line has nothing to show for too.
725
815
  const entries = await buildPaneCatalogEntries(registry, context, { appPanes: process.env[CATALOG_APP_PANES_ENV] === "1" });
726
- const botSafeEntries = effectiveParsed.botSafeOnly
727
- ? entries.filter((entry) => entry.capability.botSafe)
728
- : entries;
729
- // A topic no function covers is answered by its pointer, not by the loose matches its words find.
730
- const pointer = topicPointer(parsed.query);
731
- const typed = pointer ? [] : filterPaneCatalogEntries(botSafeEntries, parsed.query);
732
- // Data no source carries yet is said once: in the text, else as the envelope's warning.
733
- const gap = knownGapMessage(parsed.query);
734
- // A word one letter off every function's ("fundng") is read as the one it is near, and the report says so; a
735
- // word the catalog has its own answer for ("libor") is not a typo.
736
- const corrected = pointer || gap || typed.length ? null : correctCatalogQuery(botSafeEntries, parsed.query);
737
- const correctedMatches = corrected ? filterPaneCatalogEntries(botSafeEntries, corrected) : [];
738
- const readAs = corrected && correctedMatches.length ? corrected : null;
739
- const filtered = readAs ? correctedMatches : typed;
740
- const query = readAs ?? parsed.query;
741
- // A search also finds the terms it names; text only, the JSON stays a list of functions.
742
- const glossary = lookupGlossary(parsed.query);
743
- // A setting or a report can be a command, not a function: "light theme" names `config themes` beside THEM,
744
- // "drip" names `portfolio show --drip` beside DVD.
745
- const setting = commandPointer(parsed.query);
746
- const settingLeads = commandPointerLeads(parsed.query);
747
- // The data catalog series the query names, which `fn G` charts.
748
- const series = findCatalogSeries(ctx.plugins, parsed.query);
749
- const listed = pointer
750
- ? pointer.codes.flatMap((code) => entries.filter((entry) => entry.token === code))
751
- : selectPaneCatalogMatches(filtered, query, effectiveParsed.limit).shown;
752
- const readNote = readAs ? `No functions match "${parsed.query}"; showing "${readAs}".` : null;
753
- ctx.printResult({
754
- data: listed,
755
- ...series.length || readAs ? { metadata: { ...series.length ? { series } : {}, ...readAs ? { query: readAs } : {} } } : {},
756
- ...(gap || setting) && ctx.cliOptions.format !== "text" ? { warnings: [gap, setting].filter((note): note is string => !!note) } : {},
757
- }, {
758
- text: () => [readNote ? cliStyles.muted(readNote) : "", renderPaneCatalogReport(filtered, { ...effectiveParsed, query }, glossary, gap, series, setting, settingLeads)]
759
- .filter(Boolean).join("\n\n"),
760
- });
816
+ printCatalog(ctx, parsed, effectiveParsed, entries, findCatalogSeries(ctx.plugins, parsed.query));
761
817
  } finally {
762
818
  registry.destroy();
763
819
  }
@@ -765,7 +821,73 @@ export async function runPaneCatalog(args: string[], ctx: CliCommandContext) {
765
821
  });
766
822
  }
767
823
 
824
+ /**
825
+ * The catalog read from what the built-in plugins declare (`catalog-snapshot.json`, which a release build writes),
826
+ * where nothing else is installed, switched off or asked for: the plugins' code is not loaded to say what they
827
+ * are. False when it could not answer, with no snapshot among the reasons, and the plugins are asked instead.
828
+ */
829
+ async function listFromSnapshot(
830
+ ctx: CliCommandContext,
831
+ parsed: ReturnType<typeof parsePaneCatalogArgs>,
832
+ effectiveParsed: ReturnType<typeof parsePaneCatalogArgs>,
833
+ ): Promise<boolean> {
834
+ const snapshot = readCatalogSnapshot();
835
+ if (!snapshot || process.env[CATALOG_APP_PANES_ENV] === "1" || await installedPluginCount(ctx) > 0) return false;
836
+ return withConfigData(ctx, async (context) => {
837
+ if ((context.config.disabledPlugins ?? []).length > 0) return false;
838
+ printCatalog(ctx, parsed, effectiveParsed, snapshotEntries(snapshot, await exampleListName(context)), findSeriesFacts(snapshot.series, parsed.query));
839
+ return true;
840
+ });
841
+ }
842
+
843
+ /** The report of the functions and series a `catalog` query finds. */
844
+ function printCatalog(
845
+ ctx: CliCommandContext,
846
+ parsed: ReturnType<typeof parsePaneCatalogArgs>,
847
+ effectiveParsed: ReturnType<typeof parsePaneCatalogArgs>,
848
+ entries: PaneCatalogEntry[],
849
+ series: SeriesMatch[],
850
+ ): void {
851
+ const botSafeEntries = effectiveParsed.botSafeOnly
852
+ ? entries.filter((entry) => entry.capability.botSafe)
853
+ : entries;
854
+ // A topic no function covers is answered by its pointer, not by the loose matches its words find; so is a
855
+ // command of the app's own that no function is (FB, Send Feedback).
856
+ const pointer = topicPointer(parsed.query);
857
+ const appCommand = pointer || commandPointer(parsed.query) ? null : appCommandPointer(parsed.query);
858
+ const typed = pointer || appCommand ? [] : filterPaneCatalogEntries(botSafeEntries, parsed.query);
859
+ // Data no source carries yet is said once: in the text, else as the envelope's warning.
860
+ const gap = knownGapMessage(parsed.query);
861
+ // A word one letter off every function's ("fundng") is read as the one it is near, and the report says so; a
862
+ // word the catalog has its own answer for ("libor") is not a typo.
863
+ const corrected = pointer || gap || appCommand || typed.length ? null : correctCatalogQuery(botSafeEntries, parsed.query);
864
+ const correctedMatches = corrected ? filterPaneCatalogEntries(botSafeEntries, corrected) : [];
865
+ const readAs = corrected && correctedMatches.length ? corrected : null;
866
+ const filtered = readAs ? correctedMatches : typed;
867
+ const query = readAs ?? parsed.query;
868
+ // A search also finds the terms it names; text only, the JSON stays a list of functions.
869
+ const glossary = lookupGlossary(parsed.query);
870
+ // A setting or a report can be a command, not a function: "light theme" names `config themes` beside THEM,
871
+ // "drip" names `portfolio show --drip` beside DVD.
872
+ const setting = commandPointer(parsed.query) ?? appCommand;
873
+ const settingLeads = commandPointerLeads(parsed.query) || !!appCommand;
874
+ const listed = pointer
875
+ ? pointer.codes.flatMap((code) => entries.filter((entry) => entry.token === code))
876
+ : selectPaneCatalogMatches(filtered, query, effectiveParsed.limit).shown;
877
+ const readNote = readAs ? `No functions match "${parsed.query}"; showing "${readAs}".` : null;
878
+ ctx.printResult({
879
+ data: listed,
880
+ ...series.length || readAs ? { metadata: { ...series.length ? { series } : {}, ...readAs ? { query: readAs } : {} } } : {},
881
+ ...(gap || setting) && ctx.cliOptions.format !== "text" ? { warnings: [gap, setting].filter((note): note is string => !!note) } : {},
882
+ }, {
883
+ text: () => [readNote ? cliStyles.muted(readNote) : "", renderPaneCatalogReport(filtered, { ...effectiveParsed, query }, glossary, gap, series, setting, settingLeads)]
884
+ .filter(Boolean).join("\n\n"),
885
+ });
886
+ }
887
+
768
888
  async function runPaneCliCommand(ctx: CliCommandContext, run: () => Promise<void>) {
889
+ // Whether the data service answered is this command's to say, never a request made before it.
890
+ forgetDataServiceReach();
769
891
  try {
770
892
  await run();
771
893
  } catch (error) {
@@ -776,6 +898,9 @@ async function runPaneCliCommand(ctx: CliCommandContext, run: () => Promise<void
776
898
  if (isSourceUnavailableAnswer(error)) throw error;
777
899
  // A listing it cannot use says what to type instead; a name that opens nothing, what is close to it.
778
900
  if (error instanceof ListingArgError || error instanceof UnknownPaneFunctionError) ctx.fail(error.message, error.details || undefined);
901
+ // Whatever a pane made of a request that never reached the data service ("News sources unavailable.", "No ticker
902
+ // match found", a bare ECONNREFUSED), nothing answered since: said as every command says it, with what to check.
903
+ if (dataServiceUnreachable()) failUnreachable();
779
904
  const message = error instanceof Error ? error.message : String(error);
780
905
  // Nothing answered: said as every command says it, with what to check.
781
906
  if (message.includes(DATA_SERVICE_UNREACHABLE_MESSAGE)) failUnreachable(message);
@@ -54,6 +54,16 @@ export function renderedReportFailure(semanticUi: readonly RemoteUiNodeSnapshot[
54
54
  return details ? { message, details } : { message };
55
55
  }
56
56
 
57
+ /**
58
+ * The load a rendered pane says failed, from the `pane-load-error` node its
59
+ * status footer publishes (usePaneStatusFooter): the error the footer shows.
60
+ * Null when the pane loaded, or is loading.
61
+ */
62
+ export function renderedLoadError(semanticUi: readonly RemoteUiNodeSnapshot[]): string | null {
63
+ const message = semanticUi.find((node) => node.role === "pane-load-error")?.metadata?.message;
64
+ return typeof message === "string" && message.trim() ? message.trim() : null;
65
+ }
66
+
57
67
  const FRESHNESS_STATUSES: readonly HeadlessFreshnessStatus[] = ["live", "delayed", "stale", "not-a-feed"];
58
68
 
59
69
  /** The `sources` a pane publishes: each a name and a time. */
@@ -67,6 +67,9 @@ import {
67
67
  type PaneFunctionCapability,
68
68
  } from "./capabilities";
69
69
 
70
+ /** Plugins whose series a name that opens nothing is pointed at, or a function that gives them when that name is met. */
71
+ type SeriesSources = readonly SeriesSource[] | (() => readonly SeriesSource[]);
72
+
70
73
  export interface ResolvedPaneFunction {
71
74
  token: string;
72
75
  label: string;
@@ -207,7 +210,7 @@ function withKeywordNote(registry: PaneFunctionCatalog, parsed: ParsedPaneFuncti
207
210
  }
208
211
 
209
212
  /** Whether a word is the function's code, an alias or a name, rather than one of its keywords. */
210
- function namesFunction(template: PaneTemplateDef | undefined, pane: PaneDef, word: string): boolean {
213
+ export function namesFunction(template: PaneTemplateDef | undefined, pane: PaneDef, word: string): boolean {
211
214
  const wanted = normalizeLookupToken(word);
212
215
  const headless = getHeadlessPaneDefinition(template, pane);
213
216
  const names = [template?.shortcut?.prefix, ...template?.shortcut?.aliases ?? [], template?.id, template?.label, pane.id, pane.name,
@@ -270,10 +273,11 @@ export async function applyListingArgument(
270
273
  const aliases = exchange ? [] : entered.map((raw) => headless?.symbolAlias?.(raw) ?? null);
271
274
  const typed = entered.map((raw, index) => aliases[index]?.symbol ?? raw);
272
275
  // RY.TO is the listing its quote names, RY:TSX, as `quote` reads it: a function's data is read by venue.
273
- // A long list is a batch of tickers: its words cost no quote each to be read as companies' names.
276
+ // A long list is a batch of tickers: its words cost no quote each to be read as companies' names, nor its codes
277
+ // no source quotes to be read on their listings abroad.
274
278
  const companyWord = typed.length <= MAX_CHOICE_LOOKUPS;
275
279
  let listings = named ? [named] : await Promise.all(typed.map((raw) => resolveCliListing(raw, exchange, context, {
276
- ownExchangeWins: typed.length > 1, venueSuffix: true, companyWord,
280
+ ownExchangeWins: typed.length > 1, venueSuffix: true, companyWord, listingAbroad: companyWord,
277
281
  })));
278
282
  // A separator stuck to the end of a pasted list (`UPST;`) is not part of a symbol; it is named.
279
283
  const notes: string[] = takesOneTicker ? [] : stripStrayEdges(args.arg).notes;
@@ -468,7 +472,7 @@ async function unknownPaneFunctionError(
468
472
  name: string,
469
473
  arg: string,
470
474
  command: "fn" | "shot",
471
- seriesSources: readonly SeriesSource[] = [],
475
+ seriesSources: SeriesSources = [],
472
476
  pluginStop?: PluginCodeStopFinder,
473
477
  ): Promise<UnknownPaneFunctionError> {
474
478
  // NIM is one slip from NI, but a bank figure is in `fundamentals`, not in a function's statement lines.
@@ -494,7 +498,7 @@ async function unknownPaneFunctionError(
494
498
  // One code is run on the argument; the functions a word asks for are each.
495
499
  const runs = suggested.length > 0 ? suggested : near.length === 1 ? near : [];
496
500
  // A word no function is near that names data ("nikkei") points at the series `catalog` finds for it.
497
- const series = closest.length === 0 && near.length === 0 ? findCatalogSeries(seriesSources, name).slice(0, UNKNOWN_NAME_SERIES_LIMIT) : [];
501
+ const series = closest.length === 0 && near.length === 0 ? findCatalogSeries(typeof seriesSources === "function" ? seriesSources() : seriesSources, name).slice(0, UNKNOWN_NAME_SERIES_LIMIT) : [];
498
502
  const seriesWidth = Math.max(0, ...series.map((match) => match.expression.length));
499
503
  return new UnknownPaneFunctionError(name, [
500
504
  // A function a word asks for, typed with no argument, shows the one it takes (`<ticker>`).
@@ -519,8 +523,8 @@ export async function resolvePaneFunction(
519
523
  /** `fn`: a `--limit` or `--tail` the function takes no option for picks the report's rows (`rowWindow`). */
520
524
  rowWindow?: boolean;
521
525
  command?: "fn" | "shot";
522
- /** The plugins whose catalog series a name that opens nothing is pointed at. */
523
- seriesSources?: readonly SeriesSource[];
526
+ /** The plugins whose catalog series a name that opens nothing is pointed at; a function, to ask for them only then. */
527
+ seriesSources?: SeriesSources;
524
528
  /** Why a name that opens nothing is a plugin's code (`pluginCodeStop`). */
525
529
  pluginStop?: PluginCodeStopFinder;
526
530
  } = {},
@@ -61,7 +61,7 @@ export function shotShowsText(visibleText: string, value: string): boolean {
61
61
  export function isPaneScreenshotUsable(signals: PaneScreenshotReadinessSignals): boolean {
62
62
  return !signals.refused
63
63
  && !signals.blankColumns?.length
64
- && (signals.interactive || ((signals.rowCount > 0 || signals.contentShown === true) && !signals.emptyStateDetected))
64
+ && (signals.interactive || signals.confirmedEmpty || ((signals.rowCount > 0 || signals.contentShown === true) && !signals.emptyStateDetected))
65
65
  && !signals.loadingStateDetected
66
66
  && !signals.errorStateDetected
67
67
  && signals.complete
@@ -139,9 +139,13 @@ export function assessPaneScreenshot(
139
139
  const unavailableSymbols = usesLiveDomEvidence
140
140
  ? []
141
141
  : shotUnavailableSymbols(resolved, payload, render.semanticUi);
142
- const complete = unavailableSymbols.length === 0;
142
+ const figureGaps = essentialFigureMismatches(render);
143
+ const complete = unavailableSymbols.length === 0 && figureGaps.length === 0;
143
144
  const expectedText = shotExpectedText(resolved, symbols, payload);
144
- const normalizedVisibleText = render.visibleText.toLowerCase();
145
+ // A text field's value is on screen too (OVME's Underlying SPY), though not in the page's text. It is read
146
+ // for this check alone: what a reader typed in a field never reaches the result, its JSON or its print.
147
+ const { fieldValues, ...shownRender } = render;
148
+ const normalizedVisibleText = [render.visibleText, ...fieldValues ?? []].join(" ").toLowerCase();
145
149
  const missingExpectedText = expectedText.filter((value) => !shotShowsText(normalizedVisibleText, value));
146
150
  const expectedSelections = shotExpectedSelections(resolved);
147
151
  const missingExpectedSelections = missingActiveTabSelections(
@@ -156,6 +160,7 @@ export function assessPaneScreenshot(
156
160
  ...paneEvidenceMismatches(resolved, payload, render),
157
161
  ...financialRatioRenderMismatches(resolved, payload, render),
158
162
  ...surfaceNotDrawnMismatches(render),
163
+ ...figureGaps,
159
164
  ];
160
165
  const semanticMismatch = missingExpectedText.length > 0
161
166
  || missingExpectedSelections.length > 0
@@ -183,6 +188,8 @@ export function assessPaneScreenshot(
183
188
  interactive,
184
189
  rowCount,
185
190
  contentShown,
191
+ confirmedEmpty: rowCount === 0 && render.emptyStateDetected && !render.accessGate
192
+ && (render.semanticUi ?? []).some((node) => node.role === "pane-empty-result"),
186
193
  refused,
187
194
  loadingStateDetected: render.loadingStateDetected,
188
195
  errorStateDetected: render.errorStateDetected,
@@ -200,6 +207,7 @@ export function assessPaneScreenshot(
200
207
  const tableRows = shotTableRows(resolved, render);
201
208
  const notices = [
202
209
  ...renderedReportNotices(render.semanticUi ?? []).notices,
210
+ ...(render.statusLineClipped ? ["The as-of status line is clipped."] : []),
203
211
  ...unquotedHoldingsNotice(resolved, payload),
204
212
  ...(render.surfaces?.some((surface) => surface.renderer === "software")
205
213
  ? ["The 3D surface was drawn by the software renderer: this browser has no WebGL."] : []),
@@ -231,7 +239,7 @@ export function assessPaneScreenshot(
231
239
  ...(tableRows ? { tableRows } : {}),
232
240
  outputPath,
233
241
  render: {
234
- ...stripDesktopShotCredentials(render),
242
+ ...stripDesktopShotCredentials(shownRender),
235
243
  expectedText,
236
244
  missingExpectedText,
237
245
  expectedSelections,
@@ -309,7 +317,10 @@ const BLANK_COLUMN_MIN_ROWS = 3;
309
317
  * and V/AVG did before the open. A column some rows leave empty is a sparse
310
318
  * marker (an event column), not a blank one, and neither is a column the pane
311
319
  * says can be blank (`mayBeBlank`: a value that comes after an event, such as
312
- * an upcoming report's move); section headers and tables of fewer than
320
+ * an upcoming report's move). A row the pane says is still waiting on the
321
+ * value (a cell's `mayBeBlank`: ECO's ACTUAL before the release) is left out:
322
+ * the column is blank when every other row is, and there are at least
323
+ * BLANK_COLUMN_MIN_ROWS of them. Section headers and tables of fewer than
313
324
  * BLANK_COLUMN_MIN_ROWS rows are not read.
314
325
  */
315
326
  function shotBlankColumns(rows: readonly Pick<DesktopPaneShotRenderedRow, "tableIndex" | "cells" | "section">[]): string[] {
@@ -322,18 +333,22 @@ function shotBlankColumns(rows: readonly Pick<DesktopPaneShotRenderedRow, "table
322
333
  const blank: string[] = [];
323
334
  for (const tableRows of tables.values()) {
324
335
  if (tableRows.length < BLANK_COLUMN_MIN_ROWS) continue;
325
- const columns = new Map<string, { label: string; placeholders: number; filled: boolean }>();
336
+ const columns = new Map<string, { label: string; placeholders: number; waiting: number; filled: boolean }>();
326
337
  for (const row of tableRows) {
327
338
  for (const cell of row.cells) {
328
339
  const key = cell.columnId ?? cell.columnLabel;
329
- const column = columns.get(key) ?? { label: cell.columnLabel, placeholders: 0, filled: false };
330
- if (PLACEHOLDER_VALUE.test(cell.text.trim()) && !cell.mayBeBlank) column.placeholders += 1;
340
+ const column = columns.get(key) ?? { label: cell.columnLabel, placeholders: 0, waiting: 0, filled: false };
341
+ // A row still waiting on the value (an upcoming release's ACTUAL) is neither a gap nor a value.
342
+ if (cell.mayBeBlank && PLACEHOLDER_VALUE.test(cell.text.trim())) column.waiting += 1;
343
+ else if (PLACEHOLDER_VALUE.test(cell.text.trim())) column.placeholders += 1;
331
344
  else column.filled = true;
332
345
  columns.set(key, column);
333
346
  }
334
347
  }
335
- for (const { label, placeholders, filled } of columns.values()) {
336
- if (!filled && placeholders === tableRows.length && !blank.includes(label)) blank.push(label);
348
+ for (const { label, placeholders, waiting, filled } of columns.values()) {
349
+ // Blank in every row that should have the value, and in enough of them to be no short list's gaps.
350
+ const owed = tableRows.length - waiting;
351
+ if (!filled && owed >= BLANK_COLUMN_MIN_ROWS && placeholders === owed && !blank.includes(label)) blank.push(label);
337
352
  }
338
353
  }
339
354
  return blank;
@@ -434,6 +449,19 @@ function plotsData(node: RemoteUiNodeSnapshot): boolean {
434
449
  return lists.some((list) => list.some((series) => isRecord(series) && typeof series.pointCount === "number" && series.pointCount > 0));
435
450
  }
436
451
 
452
+ export function essentialFigureMismatches(render: Pick<DesktopPaneShotRenderResult, "semanticUi" | "visibleText">): string[] {
453
+ return render.semanticUi.filter((node) => node.role === "figure-layout").flatMap((node) => {
454
+ const metadata = node.metadata;
455
+ if (!isRecord(metadata) || !Array.isArray(metadata.figures) || !Array.isArray(metadata.omitted)) return ["Essential figure evidence is unavailable."];
456
+ const omitted = metadata.omitted;
457
+ return metadata.figures.flatMap((figure) => {
458
+ if (!isRecord(figure) || typeof figure.label !== "string" || typeof figure.value !== "string") return ["Essential figure evidence is invalid."];
459
+ return omitted.includes(figure.label) || !shotShowsText(render.visibleText, figure.label) || !shotShowsText(render.visibleText, figure.value)
460
+ ? [`Essential figure is missing or clipped: ${figure.label}.`] : [];
461
+ });
462
+ });
463
+ }
464
+
437
465
  /**
438
466
  * A 3D surface that is not the real drawing: the frame has no mesh, or the 2D
439
467
  * grid stands in for it. Both are fine for a person using the pane and wrong
@@ -7,10 +7,11 @@ import { graphRowsForFinancials, limitGraphRowsBySymbol, metricDef } from "../..
7
7
  import { getTimeSeriesField } from "../../time-series/field-catalog";
8
8
  import {
9
9
  buildFinancialTableModel,
10
- financialStatementCurrency,
11
- formatFinancialHeader,
10
+ financialColumnPeriod,
11
+ financialFiscalHeader,
12
12
  splitPeriodsNotInYet,
13
13
  } from "../../plugins/builtin/ticker-detail/financials/model";
14
+ import { fiscalYearEndMonth } from "../../utils/fiscal-period";
14
15
  import type { FundamentalPeriod, GraphKind, GraphMetricKey } from "../../time-series/reporting";
15
16
  import type { TimeRange } from "../../time-series/range";
16
17
  import { subtractTimeRange } from "../../time-series/date-window";
@@ -363,19 +364,10 @@ export function shotExpectedText(
363
364
  // A newest period with only some figures is left out of the pane's statement columns (splitPeriodsNotInYet).
364
365
  const latestStatement = table && !ratioTab ? splitPeriodsNotInYet(table.statements, table.subTab).shown[0] : table?.statements[0];
365
366
  const firstMetric = table?.rows[0];
366
- // The pane prints the compact header: date, currency and an S/P source marker.
367
- if (latestStatement) {
368
- const currency = latestStatement.currency ?? financialStatementCurrency(
369
- financials,
370
- [...(financials.annualStatements ?? []), ...(financials.quarterlyStatements ?? [])],
371
- );
372
- expected.push(formatFinancialHeader(
373
- latestStatement.date,
374
- currency,
375
- latestStatement.dateSource,
376
- true,
377
- latestStatement.aggregation?.periodEnd,
378
- ).trim());
367
+ if (table && latestStatement) {
368
+ const annual = financials.annualStatements ?? [];
369
+ const kind = financialColumnPeriod(latestStatement, table.period, new Set(annual.map(({ date }) => date)));
370
+ expected.push(financialFiscalHeader(latestStatement, kind, fiscalYearEndMonth(annual)));
379
371
  }
380
372
  const firstLabel = ratioTab ? ratioTab.ratios[0]?.label : firstMetric?.unitLabel;
381
373
  if (firstLabel) expected.push(firstLabel);