@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
@@ -0,0 +1,62 @@
1
+ import { shellWord } from "../../utils/shell-word";
2
+ import type { CatalogSeriesFact } from "../series-search";
3
+ import type { PaneCatalogEntry } from "./catalog";
4
+
5
+ /**
6
+ * What `catalog` lists for the built-in plugins, written down by `bun run catalog:snapshot`, so that a command which
7
+ * only lists functions reads one file instead of loading every plugin's code to ask each what it is. It holds
8
+ * the catalog as it reads on a fresh profile, and what a reader's own lists change in it is put back by
9
+ * `snapshotEntries`. The file is not in git: the release builds write it (`scripts/build.ts` for a binary, the
10
+ * build workflow for the npm package), and where it is absent the plugins are asked. `catalog-snapshot.test.ts`
11
+ * fails when what the generator writes no longer matches the plugins.
12
+ */
13
+ export interface CatalogSnapshotEntry extends Omit<PaneCatalogEntry, "argExamples"> {
14
+ /** The built-in plugin that holds the function. */
15
+ pluginId: string;
16
+ /** The examples the function's own definition gives, past its placeholder. */
17
+ examples?: string[];
18
+ /** The function takes a list of symbols, so the reader's first list is one more example. */
19
+ listArgument?: true;
20
+ }
21
+
22
+ export interface CatalogSnapshot {
23
+ entries: CatalogSnapshotEntry[];
24
+ series: CatalogSeriesFact[];
25
+ /**
26
+ * The built-in plugins a function that reports data (`fn`) is among, in catalog order (its template's, and its
27
+ * pane's when another plugin holds that), by every word that names it (its code, an alias, its id), as the whole
28
+ * catalog settles them. A word that only matches a keyword is not here.
29
+ */
30
+ functions: Record<string, string[]>;
31
+ }
32
+
33
+ /** The catalog entries as the app builds them for a reader whose first list is `listName`. */
34
+ export function snapshotEntries(snapshot: CatalogSnapshot, listName: string | null): PaneCatalogEntry[] {
35
+ return snapshot.entries.map(({ pluginId: _pluginId, examples, listArgument, ...entry }) => {
36
+ const shown = listArgument && listName ? [...examples ?? [], shellWord(listName)] : examples ?? [];
37
+ if (shown.length === 0) return entry;
38
+ // The examples sit before the keywords and the shot argument in the entry, as the app builds it.
39
+ const ordered: Record<string, unknown> = {};
40
+ for (const [key, value] of Object.entries(entry)) {
41
+ if (key === "shotArgument" || key === "keywords") ordered.argExamples ??= shown;
42
+ ordered[key] = value;
43
+ }
44
+ return ordered as unknown as PaneCatalogEntry;
45
+ });
46
+ }
47
+
48
+ let read: CatalogSnapshot | null | undefined;
49
+
50
+ /** The snapshot file, read when first asked for; null where the build did not write one, and the plugins are asked. */
51
+ export function readCatalogSnapshot(): CatalogSnapshot | null {
52
+ if (read !== undefined) return read;
53
+ try {
54
+ read = require("./catalog-snapshot.json") as CatalogSnapshot;
55
+ } catch (error) {
56
+ // Bun says "Cannot find module" from source and "Cannot require module" from a compiled binary; a file that is
57
+ // there and fails to read is not an absent one.
58
+ if (!/Cannot (find|require) module/.test(String((error as { message?: unknown } | null)?.message ?? error))) throw error;
59
+ read = null;
60
+ }
61
+ return read;
62
+ }
@@ -32,7 +32,7 @@ import {
32
32
  wrapText,
33
33
  type CliStatEntry,
34
34
  } from "../../utils/cli-output";
35
- import { renderGlossaryEntries, type GlossaryLookup } from "../glossary";
35
+ import { glossaryFunctionsNamed, glossaryNamesFunction, renderGlossaryEntries, type GlossaryLookup } from "../glossary";
36
36
  import { renderSeriesMatches, type SeriesMatch } from "../series-search";
37
37
  import { typoDistance } from "../../utils/typo-distance";
38
38
  import { FUNCTION_HELP } from "./function-help";
@@ -263,17 +263,23 @@ export function nearFunctionCodes(
263
263
 
264
264
  /**
265
265
  * The functions a word that is no code asks for (`IVOL`, `IV`: HIVG and
266
- * OVDV), as their `discovery.suggestFor` lists it, each by its code.
266
+ * OVDV), as their `discovery.suggestFor` lists it, or the glossary term it
267
+ * names is shown by (`VAR`, `drawdown`: MARS and PORT), each by its code.
267
268
  */
268
269
  export function suggestedFunctionCodes(registry: PaneFunctionCatalog, name: string): NearFunctionCode[] {
269
270
  const wanted = normalizeLookupToken(name);
270
271
  if (!wanted) return [];
272
+ // A term many functions show (a percentile) names none of them in particular: the catalog search lists those.
273
+ const named = glossaryFunctionsNamed(name);
274
+ const showing = new Set(named.length <= NEAR_CODE_LIMIT ? named : []);
271
275
  return [...registry.paneTemplates.values()].flatMap((template) => {
272
276
  if (template.listed === false) return [];
273
277
  const pane = registry.panes.get(template.paneId);
274
278
  const words = pane ? getHeadlessPaneDefinition(template, pane)?.discovery?.suggestFor ?? [] : [];
275
279
  const code = template.shortcut?.prefix;
276
- return code && words.some((word) => normalizeLookupToken(word) === wanted) ? [{ code: code.toUpperCase(), label: template.label }] : [];
280
+ const shows = [code, ...template.shortcut?.aliases ?? []].some((candidate) => !!candidate && showing.has(candidate.toUpperCase()));
281
+ return code && (shows || words.some((word) => normalizeLookupToken(word) === wanted))
282
+ ? [{ code: code.toUpperCase(), label: template.label }] : [];
277
283
  }).sort((left, right) => left.code.localeCompare(right.code));
278
284
  }
279
285
 
@@ -360,7 +366,7 @@ function argExamples(
360
366
  }
361
367
 
362
368
  /** The first watchlist, else portfolio, that holds a symbol: the list a function's example names. Null when none does. */
363
- async function exampleListName(context: MarketContext): Promise<string | null> {
369
+ export async function exampleListName(context: Pick<MarketContext, "config" | "store">): Promise<string | null> {
364
370
  const tickers = await Promise.resolve().then(() => context.store.loadAllTickers())
365
371
  .catch(logFailure("cli-catalog", "Read the lists for an example failed", [] as TickerRecord[]));
366
372
  const watchlist = context.config.watchlists.find((list) => tickers.some((ticker) => ticker.metadata.watchlists.includes(list.id)));
@@ -426,6 +432,11 @@ export async function buildPaneCatalogEntries(
426
432
  return entries.sort((left, right) => left.token.localeCompare(right.token));
427
433
  }
428
434
 
435
+ /** Whether the whole query names a glossary term the function shows (`VaR` for MARS), by its code or an alias (DES for T). */
436
+ function namesShownTerm(entry: Pick<PaneCatalogEntry, "token" | "shortcut" | "aliases">, query: string): boolean {
437
+ return [entry.token, entry.shortcut, ...entry.aliases].some((code) => !!code && glossaryNamesFunction(code, query));
438
+ }
439
+
429
440
  /** The phrase starting a word of the text, so "funding rate" finds "funding rates" but "rate" is not found in "separate". */
430
441
  function containsPhrase(text: string, phrase: string): boolean {
431
442
  for (let at = text.indexOf(phrase); at >= 0; at = text.indexOf(phrase, at + 1)) {
@@ -524,7 +535,15 @@ interface CatalogMatchScore {
524
535
  called: number;
525
536
  }
526
537
 
527
- function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string): CatalogMatchScore {
538
+ /** How catalog matches are scored; `glossary: false` leaves out the glossary terms a function shows, as search did before them. */
539
+ interface CatalogScoring {
540
+ glossary?: boolean;
541
+ }
542
+
543
+ /** A query that is, whole, a term a function shows (`VaR`) outweighs it starting a word of a description (`variance`). */
544
+ const SHOWN_TERM_SCORE = 20;
545
+
546
+ function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string, { glossary = true }: CatalogScoring = {}): CatalogMatchScore {
528
547
  const terms = queryTerms(query);
529
548
  if (terms.length === 0) return { score: 1, terms: 0, named: 0, called: 0 };
530
549
  const none = { score: 0, terms: terms.length, named: 0, called: 0 };
@@ -590,6 +609,14 @@ function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string): CatalogM
590
609
  matchedTerms += 1;
591
610
  }
592
611
 
612
+ // The whole query naming a term the function shows (`VaR`, `value at risk`, `expected shortfall` for MARS and PORT)
613
+ // names the function, every word of it found, where its own words do not already (`beta` is in PORT's keywords,
614
+ // `trade` in PF's description: those rank as they did). A word of a longer query, or a loose alias, names nothing.
615
+ if (glossary && matchedNamed < terms.length && namesShownTerm(entry, query)) {
616
+ score += SHOWN_TERM_SCORE;
617
+ matchedTerms = terms.length;
618
+ matchedNamed = terms.length;
619
+ }
593
620
  if (matchedTerms === 0) return none;
594
621
  // The whole query a value an option takes (GF's `operating margin` metric) is a name the function answers to.
595
622
  const valueNamed = terms.length > 1 && flagValues.has(normalizeLookupToken(wholeQuery));
@@ -624,9 +651,9 @@ function isClosestCatalogMatch(entry: PaneCatalogEntry, query: string): boolean
624
651
  return scorePaneCatalogEntry(entry, query).called === 0;
625
652
  }
626
653
 
627
- function rankPaneCatalogEntries(entries: PaneCatalogEntry[], query: string): PaneCatalogEntry[] {
654
+ function rankPaneCatalogEntries(entries: PaneCatalogEntry[], query: string, scoring: CatalogScoring = {}): PaneCatalogEntry[] {
628
655
  return entries
629
- .map((entry) => ({ entry, score: scorePaneCatalogEntry(entry, query).score }))
656
+ .map((entry) => ({ entry, score: scorePaneCatalogEntry(entry, query, scoring).score }))
630
657
  .filter(({ score }) => score > 0)
631
658
  .sort((left, right) => right.score - left.score || left.entry.token.localeCompare(right.entry.token))
632
659
  .map(({ entry }) => entry);
@@ -651,23 +678,23 @@ function hasConsecutiveWordStarts(entry: PaneCatalogEntry, head: string, tail: s
651
678
  * Two words typed as one ("volsurf" for Volatility Surface) match the functions that carry both
652
679
  * words in a row, found by cutting the query into two word starts.
653
680
  */
654
- function fusedQueryMatches(entries: PaneCatalogEntry[], query: string): PaneCatalogEntry[] {
681
+ function fusedQueryMatches(entries: PaneCatalogEntry[], query: string, scoring: CatalogScoring): PaneCatalogEntry[] {
655
682
  const word = query.trim().toLowerCase();
656
683
  if (/\s/.test(word)) return [];
657
684
  for (let cut = FUSED_PART_MIN; cut <= word.length - FUSED_PART_MIN; cut += 1) {
658
685
  const [head, tail] = [word.slice(0, cut), word.slice(cut)];
659
686
  const split = `${head} ${tail}`;
660
- const ranked = rankPaneCatalogEntries(entries, split);
661
- const { shown, loose } = selectPaneCatalogMatches(ranked, split, ranked.length);
687
+ const ranked = rankPaneCatalogEntries(entries, split, scoring);
688
+ const { shown, loose } = selectPaneCatalogMatches(ranked, split, ranked.length, scoring);
662
689
  const written = loose ? [] : shown.filter((entry) => hasConsecutiveWordStarts(entry, head, tail));
663
690
  if (written.length > 0) return written;
664
691
  }
665
692
  return [];
666
693
  }
667
694
 
668
- export function filterPaneCatalogEntries(entries: PaneCatalogEntry[], query: string): PaneCatalogEntry[] {
669
- const ranked = rankPaneCatalogEntries(entries, query);
670
- return ranked.length > 0 ? ranked : fusedQueryMatches(entries, query);
695
+ export function filterPaneCatalogEntries(entries: PaneCatalogEntry[], query: string, scoring: CatalogScoring = {}): PaneCatalogEntry[] {
696
+ const ranked = rankPaneCatalogEntries(entries, query, scoring);
697
+ return ranked.length > 0 ? ranked : fusedQueryMatches(entries, query, scoring);
671
698
  }
672
699
 
673
700
  /** Whether two words differ by one letter: one added, dropped, changed, or two neighbours swapped. */
@@ -721,8 +748,13 @@ interface PaneCatalogSelection {
721
748
  * name or description; when none does, the few closest, so "year to date" does not list a hundred functions
722
749
  * that each have a date somewhere. `--all` (an infinite limit) lists every match.
723
750
  */
724
- export function selectPaneCatalogMatches(ranked: PaneCatalogEntry[], query: string, limit: number): PaneCatalogSelection {
725
- const scored = ranked.map((entry) => ({ entry, ...scorePaneCatalogEntry(entry, query) }));
751
+ export function selectPaneCatalogMatches(
752
+ ranked: PaneCatalogEntry[],
753
+ query: string,
754
+ limit: number,
755
+ scoring: CatalogScoring = {},
756
+ ): PaneCatalogSelection {
757
+ const scored = ranked.map((entry) => ({ entry, ...scorePaneCatalogEntry(entry, query, scoring) }));
726
758
  const every = (items: typeof scored) => items.map(({ entry }) => entry);
727
759
  const widened = !Number.isFinite(limit);
728
760
  const multiWord = (scored[0]?.terms ?? 0) > 1;
@@ -824,7 +856,9 @@ function readinessCell(readiness: PaneFunctionReadiness): string {
824
856
  */
825
857
  function reportCell(entry: PaneCatalogEntry): string {
826
858
  const readiness = readinessCell(entry.capability.reportReadiness);
827
- return FUNCTION_HELP[entry.token]?.access === "pro" ? `${readiness} · ${cliStyles.warning("Pro")}` : readiness;
859
+ if (FUNCTION_HELP[entry.token]?.access === "pro") return `${readiness} · ${cliStyles.warning("Pro")}`;
860
+ return entry.capability.dataRequirements.some((requirement) => /\bsign-in\b/i.test(requirement))
861
+ ? `${readiness} · ${cliStyles.warning("Sign-in")}` : readiness;
828
862
  }
829
863
 
830
864
  function optionDescription(option: PaneFunctionOptionDef): string {
@@ -7,7 +7,7 @@ import { parseChartSpec } from "../../plugins/builtin/chart-composer/chart-spec"
7
7
  import { normalizeTickerInput } from "../../tickers/search";
8
8
  import type { MarketContext } from "../types";
9
9
  import { argumentNamesTicker, cleanTickerInput } from "./options";
10
- import { parsePublicTickerKey, publicTickerKey } from "../../utils/exchanges";
10
+ import { canonicalExchange, parsePublicTickerKey, publicTickerKey } from "../../utils/exchanges";
11
11
  import type { ResolvedPaneFunction } from "./resolver";
12
12
  import { toMarketDataContext } from "../../market-data/selectors";
13
13
  import { quoteMetadataFromQuote } from "../../market-data/quotes/metadata";
@@ -27,11 +27,23 @@ const SHOT_PRICE_HISTORY_RANGE = "5Y" as const;
27
27
  const FINANCIAL_ANALYSIS_PANE_ID = "financial-analysis";
28
28
  const FINANCIAL_ANALYSIS_TEMPLATE_ID = "financial-analysis-pane";
29
29
 
30
+ /**
31
+ * The saved row of the listing a pane function was given. A listing named by
32
+ * its venue (0700:HKEX, or Z74 with --exchange SGX) that was saved under its
33
+ * bare symbol on that venue is that row, keyed as named: the pane looks its
34
+ * ticker up by the key it is bound to, and a row keyed 0700 would leave it
35
+ * with no ticker at all. A bare row saved on another venue is another listing.
36
+ */
30
37
  export async function loadStoredShotTicker(context: MarketContext, symbol: string): Promise<TickerRecord | null> {
31
38
  const normalized = cleanTickerInput(symbol);
32
- const { symbol: bare } = parsePublicTickerKey(normalized);
33
- return await context.store.loadTicker(normalized)
34
- ?? (bare !== normalized ? await context.store.loadTicker(bare) : null);
39
+ const { symbol: bare, exchange } = parsePublicTickerKey(normalized);
40
+ const named = await context.store.loadTicker(normalized);
41
+ if (named || bare === normalized) return named;
42
+ const saved = await context.store.loadTicker(bare);
43
+ if (!saved) return null;
44
+ if (!exchange) return saved;
45
+ if (canonicalExchange(saved.metadata.exchange) !== canonicalExchange(exchange)) return null;
46
+ return { ...saved, metadata: { ...saved.metadata, ticker: normalized } };
35
47
  }
36
48
 
37
49
  /**
@@ -15,7 +15,8 @@ import { resolvePersistedCloudSessionToken } from "./cloud-session";
15
15
  import type { PaneScreenshotResult } from "./screenshot-types";
16
16
  import { deriveRenderedFreshness, formatFreshnessLine, type ReportFreshness } from "./freshness";
17
17
  import { exportTextTable, reportFooterLines, type CliReportTables } from "../report-tables";
18
- import { declaredReportFreshness, renderedReportFailure, renderedReportFreshness, renderedReportNotices, renderedReportObservations } from "./report-notices";
18
+ import { declaredReportFreshness, renderedLoadError, renderedReportFailure, renderedReportFreshness, renderedReportNotices, renderedReportObservations } from "./report-notices";
19
+ import { DATA_SERVICE_UNREACHABLE_MESSAGE, DataServiceUnreachableError } from "../../utils/network-failure";
19
20
 
20
21
  const DOM_REPORT_WIDTH = 1280;
21
22
  const DOM_REPORT_HEIGHT = 720;
@@ -28,7 +29,7 @@ const DOM_EVERY_ROW =
28
29
  const DOM_WHOLE_PANE =
29
30
  "The pane was grown to fit the page it has open, so all of its text is returned.";
30
31
 
31
- /** The sign-in wall's buttons, which a rendered view reads as words, with the key that presses one: `Log in ↩ Sign up free`. */
32
+ /** The sign-in wall's buttons, which a rendered view reads as words, with the key that presses one: `Sign up free ↩ Log in`. */
32
33
  const SIGN_IN_WALL_BUTTONS = /\s*\b(?:Log in|Sign up free|Resend Verification Email)(?:\s*[\u21A9\u21B5])?(?=\s|$)/g;
33
34
 
34
35
  /** Whether the wall asks for the account's email to be verified, not for a sign-in. */
@@ -103,6 +104,23 @@ function cellText(cell: DesktopPaneShotRenderedRow["cells"][number]): string {
103
104
  return formatUtcTime(cell.instant) || cell.text;
104
105
  }
105
106
 
107
+ /** A zone named at the end of a column header: `TIME HKT`, `TIME GMT+8`, `DATE ET`, `TIME UTC`. */
108
+ const HEADER_ZONE = /^(.*\S)\s+(?:UTC|GMT(?:[+-]\d{1,2}(?::?\d{2})?)?|[A-Z]{1,4}T)$/;
109
+
110
+ /**
111
+ * A column the report prints from the instants behind its cells (cellText:
112
+ * UTC, the reader's zone beside it when set; the CSV and JSON the instant
113
+ * itself) is headed in UTC. The pane's header names the clock it drew the
114
+ * times on, the host's (`TIME HKT` over Top News); over the report's UTC
115
+ * times it named the wrong zone. Any other header stays as the pane drew it.
116
+ */
117
+ function reportedHeader(header: string, cells: ReadonlyArray<DesktopPaneShotRenderedRow["cells"][number] | undefined>): string {
118
+ const filled = cells.filter((cell) => cell !== undefined);
119
+ if (filled.length === 0 || !filled.every((cell) => cell.instant)) return header;
120
+ const zoned = HEADER_ZONE.exec(header);
121
+ return zoned ? `${zoned[1]} UTC` : header;
122
+ }
123
+
106
124
  interface DomTable {
107
125
  tableIndex: number;
108
126
  columns: Array<{ key: string; header: string }>;
@@ -133,13 +151,14 @@ function domTables(rows: DesktopPaneShotRenderedRow[]): DomTable[] {
133
151
  previous = position;
134
152
  }
135
153
  }
154
+ const cellRows = tableRows.map((row) => {
155
+ const keys = domCellKeys(row);
156
+ return new Map(row.cells.map((cell, cellIndex) => [keys[cellIndex]!, cell]));
157
+ });
136
158
  return {
137
159
  tableIndex,
138
- columns,
139
- rows: tableRows.map((row) => {
140
- const keys = domCellKeys(row);
141
- return new Map(row.cells.map((cell, cellIndex) => [keys[cellIndex]!, cell]));
142
- }),
160
+ columns: columns.map((column) => ({ ...column, header: reportedHeader(column.header, cellRows.map((cells) => cells.get(column.key))) })),
161
+ rows: cellRows,
143
162
  };
144
163
  });
145
164
  }
@@ -220,6 +239,9 @@ function renderedFailureReason(
220
239
  result: PaneScreenshotResult,
221
240
  rows: DesktopPaneShotRenderedRow[],
222
241
  ): string | null {
242
+ // Rows the pane kept from an earlier load, which it could not refresh (renderedLoadFailure has the bare pane's).
243
+ const loadError = renderedLoadError(result.render.semanticUi ?? []);
244
+ if (loadError) return `The rendered pane could not refresh: ${loadError}`;
223
245
  if (result.render.loadingStateDetected) return "The rendered pane was still loading.";
224
246
  if (result.render.errorStateDetected) {
225
247
  const marker = result.render.errorStateMarkers[0];
@@ -304,11 +326,15 @@ export async function buildDomPaneReportFromRender(
304
326
  if (failureReason && rows.length > 0) textLines.push("", failureReason);
305
327
  // A pane that knows its feed dates the report; the footer and cell times fill in the rest.
306
328
  const declared = { ...declaredReportFreshness(resolved), ...renderedReportFreshness(result.render.semanticUi ?? []) };
307
- const freshness = deriveRenderedFreshness(declared, {
329
+ const derived = deriveRenderedFreshness(declared, {
308
330
  footerText: result.render.footerText ?? "",
309
331
  cellTimes: rows.flatMap((row) => row.cells.flatMap((cell) => cell.instant ?? [])),
310
332
  observed: renderedReportObservations(result.render.semanticUi ?? []),
311
333
  });
334
+ // Drawn from copies saved earlier, its refresh having failed: dated as saved, never as delayed at the copy's time.
335
+ const freshness = derived && result.savedCopyAt != null && !derived.savedAt
336
+ ? { ...derived, savedAt: new Date(result.savedCopyAt).toISOString() }
337
+ : derived;
312
338
 
313
339
  const complete = failureReason === null && !truncated;
314
340
  // Each table published its rows and nothing else was cut: the report is the whole view.
@@ -428,6 +454,24 @@ class RenderedReportFailure extends Error {
428
454
  }
429
455
  }
430
456
 
457
+ /**
458
+ * The failure a rendered pane with nothing to show stands for: the load its
459
+ * status footer says failed (`pane-load-error`), else the error state its
460
+ * body draws. Such a report has no data, so it is no report: it fails as the
461
+ * plain commands do, a request that never reached the data service in their
462
+ * words ("Gloom couldn't reach its data service", and what to check), never
463
+ * the empty body ("No events") dated as if it had been read. ECO printed "No
464
+ * events" and "retrieved" at the time of the run through a proxy that refused
465
+ * every connection. Null for a pane that drew rows, a wall, or no failure.
466
+ */
467
+ function renderedLoadFailure(render: PaneScreenshotResult["render"]): Error | null {
468
+ if ((render.reportRows ?? render.rows).length > 0 || render.accessGate) return null;
469
+ const message = renderedLoadError(render.semanticUi ?? []) ?? render.stateText?.error?.[0] ?? null;
470
+ if (!message) return null;
471
+ if (message.includes(DATA_SERVICE_UNREACHABLE_MESSAGE)) return new DataServiceUnreachableError(new Error(message));
472
+ return new RenderedReportFailure(message);
473
+ }
474
+
431
475
  /**
432
476
  * The report of a pane the sign-in wall covers whole (`PaneDef.signInWall`)
433
477
  * when there is no session: its lock note, as the rendered wall reports it,
@@ -506,6 +550,8 @@ export async function buildDomFunctionReport(
506
550
  // No header and no partial view: the error alone, and a failed exit, as the plain command gives.
507
551
  const failure = renderedReportFailure(result.render.semanticUi ?? []);
508
552
  if (failure) throw new RenderedReportFailure(failure.message, failure.details);
553
+ const loadFailure = renderedLoadFailure(result.render);
554
+ if (loadFailure) throw loadFailure;
509
555
  // The capture's refusal drawn in the pane's place (chat, a team's) is not its content: say why there is none.
510
556
  if (result.refused && result.unusableReason) throw new RenderedReportFailure(result.unusableReason);
511
557
  try {
@@ -8,7 +8,7 @@ import type {
8
8
  HeadlessSeriesResult,
9
9
  HeadlessSnapshotResult,
10
10
  } from "../../types/plugin";
11
- import { localTimeSuffix, parseReportTime, type ReportTime } from "../../utils/utc-time";
11
+ import { formatUtcTime, localTimeSuffix, parseReportTime, type ReportTime } from "../../utils/utc-time";
12
12
  import { timeZoneLabel, zonedDateTimeParts } from "../../utils/zoned-date-time";
13
13
  import { isRecord } from "../../utils/guards";
14
14
  import { latestRegularSessionClose, readIndexSession } from "../../market-data/market/freshness";
@@ -881,7 +881,7 @@ function feedStatusText(freshness: ReportFreshness, short: boolean): string {
881
881
  return `${rest ? `${rest}, ` : ""}${stale}`;
882
882
  }
883
883
  // A line that says how old its oldest observation is does not say it twice.
884
- return freshness.ageMinutes != null && freshness.oldestAgeMinutes == null ? `stale (${ageText(freshness.ageMinutes)} old)` : "stale";
884
+ return freshness.ageMinutes != null && freshness.ageMinutes > 0 && freshness.oldestAgeMinutes == null ? `stale (${ageText(freshness.ageMinutes)} old)` : "stale";
885
885
  }
886
886
  case "not-a-feed":
887
887
  return freshness.basis ? `not a live feed (${freshness.basis})` : "not a live feed";
@@ -1147,6 +1147,8 @@ interface StatusLineDetail {
1147
1147
  basis?: "none";
1148
1148
  /** Leave out how current a feed is (`15 min delayed`, `live`, `not a live feed`), which the pane shows another way; stale stays. */
1149
1149
  feed?: "none";
1150
+ /** Leave out when a list dated by its newest entry was read (`retrieved Wed 18 Nov 2026 00:22 UTC`). */
1151
+ retrieved?: "none";
1150
1152
  }
1151
1153
 
1152
1154
  /**
@@ -1165,7 +1167,7 @@ function statusLineParts(freshness: ReportFreshness, detail: StatusLineDetail =
1165
1167
  : (freshness.unreached || freshness.savedAt) && !freshness.asOf ? []
1166
1168
  : [asOfText(freshness, detail.asOf === "short", local, undated)]),
1167
1169
  // A list dated by its newest filing says when it was read as well.
1168
- ...(freshness.retrievedToo && freshness.asOf && !freshness.savedAt ? [`retrieved ${timeText(freshness.retrievedAt, local)}`] : []),
1170
+ ...(freshness.retrievedToo && freshness.asOf && !freshness.savedAt && detail.retrieved !== "none" ? [`retrieved ${timeText(freshness.retrievedAt, local)}`] : []),
1169
1171
  ...(freshness.schedule && detail.schedule !== "none"
1170
1172
  ? [typeof detail.schedule === "number" ? freshness.scheduleVariants?.[detail.schedule] ?? freshness.schedule : freshness.schedule] : []),
1171
1173
  ...(freshness.oldestAgeMinutes != null ? [`oldest ${ageText(freshness.oldestAgeMinutes)}`] : []),
@@ -1357,10 +1359,18 @@ export function statusLineVariants(freshness: ReportFreshness, { source = false
1357
1359
  ...(freshness.note ? [{ ...shortest, note: "none" as const }] : []),
1358
1360
  ...(freshness.schedule ? [...shorterSchedules(freshness, { ...shortest, note: "none" }), { ...shortest, note: "none" as const, schedule: "none" as const }] : []),
1359
1361
  ];
1362
+ // A list dated by its newest entry and by when it was read gives up the reading first, then what its data is,
1363
+ // and keeps its label to the last: `Newest filing Fri 6 Nov 2026`, never a bare date that reads as now.
1364
+ const unread: StatusLineDetail[] = freshness.retrievedToo
1365
+ ? [{ ...shortest, basis: "none" }, { ...shortest, basis: "none", retrieved: "none" }, { ...shortest, feed: "none", retrieved: "none" }]
1366
+ : [];
1360
1367
  const variants: StatusLineDetail[] = freshness.sources?.length
1361
1368
  ? [{}, ...details.map((detail) => ({ ...detail, date: "none" as const })), { ...shortest, date: "none", note: "none" }]
1362
- : [...details, ...trailing];
1369
+ : [...details, ...trailing, ...unread];
1363
1370
  const lines = [...new Set(variants.map((detail) => capitalize(statusLineParts(freshness, detail).join(" · "))))];
1371
+ if (freshness.status === "not-a-feed" && freshness.asOf?.includes("T") && !freshness.sources?.length && !freshness.oldest && !freshness.staleCount) {
1372
+ lines.push(narrowestAsOf(freshness, freshness.asOf));
1373
+ }
1364
1374
  // A line that dates each source names them already.
1365
1375
  if (!source || freshness.sources?.length) return lines;
1366
1376
  const sourced = [...new Set(variants.map((detail) => [`Source: ${freshness.source}`, ...statusLineParts(freshness, detail)].join(" · ")))];
@@ -1368,6 +1378,31 @@ export function statusLineVariants(freshness: ReportFreshness, { source = false
1368
1378
  return [...sourced, ...lines.filter((line) => line.length < floor)];
1369
1379
  }
1370
1380
 
1381
+ export function statusDateEvidence(freshness: ReportFreshness): string[][] {
1382
+ if (!freshness.asOf) return [];
1383
+ if (freshness.sources?.length) return [
1384
+ sourcesAsOfParts(freshness, freshness.sources, false),
1385
+ sourcesAsOfParts(freshness, freshness.sources, true),
1386
+ ];
1387
+ return [
1388
+ [asOfText(freshness, true, false)],
1389
+ [asOfText(freshness, true, false, true)],
1390
+ [formatUtcTime(freshness.asOf)],
1391
+ [narrowestAsOf(freshness, freshness.asOf)],
1392
+ ];
1393
+ }
1394
+
1395
+ /**
1396
+ * The narrowest status line of data that is no feed: its as-of in UTC, a day
1397
+ * alone where `asOfAsDay` reads it as one (a filing's date, not its midnight),
1398
+ * named by its label when it has one (`Newest filing 2026-11-06`).
1399
+ */
1400
+ function narrowestAsOf(freshness: ReportFreshness, asOf: string): string {
1401
+ const time = asOfAsDay(freshness, parseReportTime(asOf));
1402
+ const text = formatUtcTime(time ?? asOf);
1403
+ return freshness.asOfLabel ? capitalize(`${freshness.asOfLabel} ${text}`) : text;
1404
+ }
1405
+
1371
1406
  /** A capture's status line: the facts it states (its `freshness` in JSON) and its text, longest first. */
1372
1407
  export interface CaptureStatusLine {
1373
1408
  freshness: ReportFreshness;
@@ -520,11 +520,11 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
520
520
  bloomberg: [],
521
521
  },
522
522
  SRCH: {
523
- summary: "Full-text search across earnings call transcripts, news wires and SEC filings, with the matching passage inline. Save a search to get alerted on new hits.",
523
+ // Searching and reading hits need only a free account; alerts on a saved search are the part the service keeps for Pro.
524
+ summary: "Full-text search across earnings call transcripts, news wires and SEC filings, with the matching passage inline. Free with a Gloom account; alerts on a saved search's new hits are Pro.",
524
525
  usage: ["SRCH data center capex"],
525
526
  keys: [SEARCH, key("Ctrl+S", " save search"), key("a", "lerts")],
526
- data: pro("As calls, stories and filings arrive"),
527
- access: "pro",
527
+ data: same("As calls, stories and filings arrive"),
528
528
  bloomberg: ["NSE"],
529
529
  },
530
530
  COVN: {
@@ -38,6 +38,7 @@ import {
38
38
  } from "../report-tables";
39
39
  import type { ExportIdentity } from "../export-source";
40
40
  import { observationDate } from "../../time-series/price-comparison";
41
+ import { chartBarSizeParts } from "../../time-series/resolution";
41
42
  import type { ResolvedSeries } from "../../time-series/types";
42
43
  import { barLastSession } from "../../market-data/market/bar-period";
43
44
  import type { PaneFunctionReport } from "./report";
@@ -634,7 +635,10 @@ function trailingCells(trailing: HeadlessSeries["trailing"]): Record<string, str
634
635
  }
635
636
 
636
637
  function renderSeries(result: HeadlessSeriesResult): string[] {
637
- const rows = result.series.map((series) => {
638
+ // Series served in different bars (a chart's 5-minute bars beside a series a source answered in daily ones) name theirs.
639
+ const barSizes = result.series.map((series) => (chartBarSizeParts(series.interval?.trim()) ? series.interval!.trim() : null));
640
+ const mixedBars = new Set(barSizes.filter(Boolean)).size > 1;
641
+ const rows = result.series.map((series, index) => {
638
642
  const latest = [...series.points].reverse().find((point) => (
639
643
  point.value != null || point.close != null
640
644
  ));
@@ -645,7 +649,9 @@ function renderSeries(result: HeadlessSeriesResult): string[] {
645
649
  latest: series.notMeaningful ? series.notMeaningful.asOf : latest ? seriesLatestDate(series, latest.date) : MISSING_VALUE,
646
650
  value: series.notMeaningful ? "N/M" : seriesValue(series, latest?.value ?? latest?.close ?? null),
647
651
  unit: series.unit?.trim() ? currencyRateUnitText(series.unit.trim()) : null,
652
+ native: latest?.nativeAmount ? `${seriesValue(series, latest.nativeAmount.value)} ${latest.nativeAmount.currency}` : null,
648
653
  ...trailingCells(series.trailing),
654
+ ...(mixedBars ? { bars: barSizes[index] ?? MISSING_VALUE } : {}),
649
655
  points: observationCount(series),
650
656
  };
651
657
  });
@@ -658,6 +664,8 @@ function renderSeries(result: HeadlessSeriesResult): string[] {
658
664
  { key: "value", header: "Value", align: "right" },
659
665
  ...(trailing ? TRAILING_COLUMNS : []),
660
666
  ...(rows.some((row) => row.unit) ? [{ key: "unit", header: "Unit" }] : []),
667
+ ...(mixedBars ? [{ key: "bars", header: "Bars" }] : []),
668
+ ...(rows.some((row) => row.native) ? [{ key: "native", header: "Native", align: "right" as const }] : []),
661
669
  // Beside the averages, the count of points is the first thing a narrow table drops.
662
670
  { key: "points", header: "Points", align: "right", ...(trailing ? { optional: true } : {}) },
663
671
  ];