@gloom-sh/terminal 0.20.20 → 0.20.21

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 (365) hide show
  1. package/package.json +3 -1
  2. package/src/api-client/data.ts +1 -1
  3. package/src/api-client/equity-screener.ts +17 -0
  4. package/src/api-client/futures-curve.ts +5 -0
  5. package/src/api-client/market-discovery.ts +8 -0
  6. package/src/api-client/members.ts +2 -0
  7. package/src/api-client/paths.ts +3 -0
  8. package/src/api-client/perps.ts +20 -0
  9. package/src/api-client/request.ts +53 -7
  10. package/src/api-client/types/filings-and-calls.ts +2 -0
  11. package/src/app/pane-runtime/plugin-bindings.ts +6 -4
  12. package/src/app/pro-welcome/model.ts +15 -11
  13. package/src/app/pro-welcome/row.tsx +3 -3
  14. package/src/app/pro-welcome/use-pro-welcome.ts +2 -2
  15. package/src/app/runtime/startup.ts +3 -2
  16. package/src/app.tsx +3 -2
  17. package/src/capabilities/asset-data-inputs.ts +5 -0
  18. package/src/capabilities/factories.ts +8 -3
  19. package/src/capabilities/registry.ts +1 -0
  20. package/src/capabilities/types.ts +1 -0
  21. package/src/cli/commands/market.ts +68 -35
  22. package/src/cli/commands/options-chain.ts +2 -2
  23. package/src/cli/commands/overview.ts +10 -9
  24. package/src/cli/commands/ticker.ts +19 -4
  25. package/src/cli/desktop-pane-shot.ts +11 -3
  26. package/src/cli/export-source.ts +35 -2
  27. package/src/cli/glossary.ts +3 -2
  28. package/src/cli/helpers.ts +2 -1
  29. package/src/cli/history-demergers.ts +41 -10
  30. package/src/cli/history-rows.ts +3 -1
  31. package/src/cli/known-gaps.ts +21 -7
  32. package/src/cli/listing-arg.ts +22 -11
  33. package/src/cli/pane-functions/capabilities.ts +4 -9
  34. package/src/cli/pane-functions/catalog-snapshot.json +29 -29
  35. package/src/cli/pane-functions/catalog.ts +1 -18
  36. package/src/cli/pane-functions/data.ts +8 -4
  37. package/src/cli/pane-functions/financial-ratio-shot.ts +20 -5
  38. package/src/cli/pane-functions/freshness.ts +57 -12
  39. package/src/cli/pane-functions/function-help.ts +2 -2
  40. package/src/cli/pane-functions/headless.ts +6 -0
  41. package/src/cli/pane-functions/index.ts +11 -4
  42. package/src/cli/pane-functions/market-session.ts +25 -0
  43. package/src/cli/pane-functions/report-notices.ts +10 -0
  44. package/src/cli/pane-functions/resolver.ts +75 -3
  45. package/src/cli/pane-functions/screenshot-bridge.ts +1 -0
  46. package/src/cli/pane-functions/screenshot-data-evidence.ts +1 -0
  47. package/src/cli/pane-functions/screenshot-payload.ts +38 -5
  48. package/src/cli/pane-functions/screenshot-render.ts +20 -7
  49. package/src/cli/perpetual-contract.ts +14 -1
  50. package/src/cli/report-tables.ts +11 -2
  51. package/src/cli/result.ts +6 -1
  52. package/src/components/chart-table/layout.ts +8 -4
  53. package/src/components/command-bar/list/model.ts +2 -0
  54. package/src/components/command-bar/pane-templates/items.ts +5 -25
  55. package/src/components/command-bar/panel/index.tsx +7 -4
  56. package/src/components/command-bar/routes/root/provider-search.ts +4 -4
  57. package/src/components/command-bar/routes/root/results.ts +6 -2
  58. package/src/components/command-bar/routes/ticker-search/results.ts +19 -0
  59. package/src/components/command-bar/routes/ticker-search/route.ts +3 -3
  60. package/src/components/command-bar/routes/ticker-search/title.ts +23 -0
  61. package/src/components/command-bar/routing/list-state.ts +17 -5
  62. package/src/components/command-bar/selection-runtime.ts +3 -2
  63. package/src/components/command-bar/surface/index.tsx +2 -0
  64. package/src/components/command-bar/workflow/alert.ts +6 -4
  65. package/src/components/command-bar/workflow/collection-actions.ts +2 -1
  66. package/src/components/layout/pane/footer/index.tsx +1 -0
  67. package/src/components/layout/pane/footer/model.ts +20 -7
  68. package/src/components/layout/pane/title.ts +11 -2
  69. package/src/components/price-selector-dialog.tsx +8 -4
  70. package/src/components/ticker/badge/list.tsx +4 -3
  71. package/src/components/ticker/list-table-view.tsx +12 -1
  72. package/src/components/ui/query-bar.tsx +20 -14
  73. package/src/data/cached-query.ts +20 -4
  74. package/src/data/news-pane-snapshots.ts +2 -1
  75. package/src/data/plugin-cache.ts +5 -1
  76. package/src/data/saved-copies.ts +68 -2
  77. package/src/docs/snapshot.json +65 -14
  78. package/src/docs/topics.ts +11 -9
  79. package/src/i18n/es.ts +1 -0
  80. package/src/i18n/ja.ts +1 -0
  81. package/src/i18n/ko.ts +1 -0
  82. package/src/i18n/zh-cn.ts +1 -0
  83. package/src/i18n/zh-tw.ts +1 -0
  84. package/src/market-data/coordinator/index.ts +25 -5
  85. package/src/market-data/depositary-pair.ts +27 -10
  86. package/src/market-data/futures-roll-returns.ts +54 -7
  87. package/src/market-data/fx-closes.ts +14 -0
  88. package/src/market-data/market/futures-product-hours.ts +113 -0
  89. package/src/market-data/market/futures-week.ts +2 -0
  90. package/src/market-data/market/globex-day.ts +9 -2
  91. package/src/market-data/market/status.ts +32 -25
  92. package/src/market-data/market/venue-session.ts +18 -0
  93. package/src/market-data/options-alternatives.ts +49 -7
  94. package/src/market-data/perpetual-open-interest.ts +41 -0
  95. package/src/market-data/quotes/contributions.ts +4 -2
  96. package/src/market-data/quotes/export-identity.ts +11 -3
  97. package/src/market-data/quotes/freshness.ts +3 -2
  98. package/src/market-data/quotes/resolution.ts +9 -2
  99. package/src/market-data/quotes/tick-range.ts +22 -1
  100. package/src/market-data/quotes/time.ts +34 -4
  101. package/src/market-data/split-terms.ts +3 -2
  102. package/src/news/aggregator.ts +1 -0
  103. package/src/news/news-model.ts +12 -2
  104. package/src/news/types.ts +15 -0
  105. package/src/plugins/builtin/alerts/alert-engine.ts +2 -0
  106. package/src/plugins/builtin/alerts/cli-forms.ts +3 -2
  107. package/src/plugins/builtin/alerts/cli-move.ts +5 -2
  108. package/src/plugins/builtin/alerts/cli.ts +50 -25
  109. package/src/plugins/builtin/alerts/command.ts +51 -3
  110. package/src/plugins/builtin/alerts/event-rows.ts +1 -1
  111. package/src/plugins/builtin/alerts/events-pane.tsx +1 -1
  112. package/src/plugins/builtin/alerts/format.ts +67 -8
  113. package/src/plugins/builtin/alerts/headless.ts +22 -6
  114. package/src/plugins/builtin/alerts/index.tsx +26 -25
  115. package/src/plugins/builtin/alerts/move-checks.ts +1 -0
  116. package/src/plugins/builtin/alerts/pane.tsx +15 -6
  117. package/src/plugins/builtin/alerts/pro-rules.ts +9 -4
  118. package/src/plugins/builtin/alerts/quotes.ts +10 -5
  119. package/src/plugins/builtin/alerts/session.ts +28 -0
  120. package/src/plugins/builtin/alerts/types.ts +1 -0
  121. package/src/plugins/builtin/analytics/pane-model.ts +2 -1
  122. package/src/plugins/builtin/analytics/risk-model.ts +2 -2
  123. package/src/plugins/builtin/attention/headless.ts +2 -2
  124. package/src/plugins/builtin/attention/model.ts +7 -2
  125. package/src/plugins/builtin/attention/pane.tsx +2 -1
  126. package/src/plugins/builtin/awards/headless.ts +1 -1
  127. package/src/plugins/builtin/broker-trading/ticket.tsx +13 -5
  128. package/src/plugins/builtin/buildout/detail/company.tsx +0 -1
  129. package/src/plugins/builtin/buildout/detail/ui.tsx +7 -5
  130. package/src/plugins/builtin/buildout/model/normalizers.ts +0 -1
  131. package/src/plugins/builtin/buildout/model/types.ts +0 -1
  132. package/src/plugins/builtin/buildout/pane/index.tsx +9 -0
  133. package/src/plugins/builtin/buildout/pane/status.tsx +11 -0
  134. package/src/plugins/builtin/catalysts/headless.ts +1 -1
  135. package/src/plugins/builtin/chart-composer/headless.ts +14 -6
  136. package/src/plugins/builtin/chart-composer/pane.tsx +2 -1
  137. package/src/plugins/builtin/chart-composer/session-history.ts +14 -2
  138. package/src/plugins/builtin/chat/controller/index.ts +5 -3
  139. package/src/plugins/builtin/chat/controller/session-runtime.ts +18 -8
  140. package/src/plugins/builtin/chat/index.tsx +1 -1
  141. package/src/plugins/builtin/cloud/auth-actions.tsx +4 -2
  142. package/src/plugins/builtin/cloud/mcp-connect/dialog.tsx +4 -1
  143. package/src/plugins/builtin/cloud/thesis/ticker-tab.tsx +2 -1
  144. package/src/plugins/builtin/company-attention/headless.ts +2 -1
  145. package/src/plugins/builtin/company-kpis/headless.ts +1 -1
  146. package/src/plugins/builtin/correlation/headless.ts +3 -3
  147. package/src/plugins/builtin/correlation/history.ts +1 -0
  148. package/src/plugins/builtin/correlation/index.tsx +7 -5
  149. package/src/plugins/builtin/correlation/matrix/selection.ts +21 -3
  150. package/src/plugins/builtin/correlation/relationship/model.ts +5 -0
  151. package/src/plugins/builtin/correlation/relationship/pane.tsx +3 -2
  152. package/src/plugins/builtin/correlation/relationship/view-model.ts +3 -2
  153. package/src/plugins/builtin/credit-documents/headless.ts +1 -1
  154. package/src/plugins/builtin/dividend-yield/client.ts +81 -10
  155. package/src/plugins/builtin/dividend-yield/headless.ts +21 -10
  156. package/src/plugins/builtin/dividend-yield/model.ts +1 -1
  157. package/src/plugins/builtin/dividend-yield/pane.tsx +9 -5
  158. package/src/plugins/builtin/dividend-yield/ranking.ts +15 -5
  159. package/src/plugins/builtin/dividend-yield/reference-price.ts +3 -0
  160. package/src/plugins/builtin/dividend-yield/types.ts +12 -0
  161. package/src/plugins/builtin/dividend-yield/view.ts +30 -7
  162. package/src/plugins/builtin/doe/headless.ts +1 -1
  163. package/src/plugins/builtin/doe/pane.tsx +16 -7
  164. package/src/plugins/builtin/earnings-calls/data.ts +8 -5
  165. package/src/plugins/builtin/earnings-ripple/headless.ts +1 -1
  166. package/src/plugins/builtin/econ/calendar-model.ts +1 -1
  167. package/src/plugins/builtin/econ/index.tsx +26 -18
  168. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  169. package/src/plugins/builtin/equity-screener/headless.ts +149 -31
  170. package/src/plugins/builtin/equity-screener/live.ts +23 -5
  171. package/src/plugins/builtin/equity-screener/model.ts +27 -12
  172. package/src/plugins/builtin/equity-screener/pane.tsx +5 -5
  173. package/src/plugins/builtin/exposure/headless.ts +1 -1
  174. package/src/plugins/builtin/exposure/holdings.ts +2 -2
  175. package/src/plugins/builtin/futures/index.tsx +29 -1
  176. package/src/plugins/builtin/futures/model.ts +93 -10
  177. package/src/plugins/builtin/futures/returns.ts +54 -1
  178. package/src/plugins/builtin/futures/table.tsx +14 -2
  179. package/src/plugins/builtin/futures/use-front-returns.ts +20 -3
  180. package/src/plugins/builtin/futures-curve/client.ts +1 -1
  181. package/src/plugins/builtin/futures-curve/headless.ts +9 -3
  182. package/src/plugins/builtin/futures-curve/model.ts +19 -5
  183. package/src/plugins/builtin/futures-curve/pane.tsx +12 -6
  184. package/src/plugins/builtin/gpu/headless.ts +1 -1
  185. package/src/plugins/builtin/gpu/model.ts +1 -1
  186. package/src/plugins/builtin/help/function-index.ts +16 -8
  187. package/src/plugins/builtin/help/functions-table.tsx +6 -4
  188. package/src/plugins/builtin/help/shortcut-model.ts +7 -2
  189. package/src/plugins/builtin/holders/headless.ts +16 -5
  190. package/src/plugins/builtin/holders/pane.tsx +43 -5
  191. package/src/plugins/builtin/insider/client.ts +118 -11
  192. package/src/plugins/builtin/insider/filing-stories.ts +36 -20
  193. package/src/plugins/builtin/insider/issuer.ts +5 -2
  194. package/src/plugins/builtin/iv-history/headless.ts +2 -0
  195. package/src/plugins/builtin/macro-day/client.ts +2 -3
  196. package/src/plugins/builtin/macro-day/comparison.ts +58 -0
  197. package/src/plugins/builtin/macro-day/headless.ts +47 -3
  198. package/src/plugins/builtin/macro-day/index.tsx +32 -9
  199. package/src/plugins/builtin/macro-day/model.ts +1 -1
  200. package/src/plugins/builtin/macro-day/pane.tsx +99 -12
  201. package/src/plugins/builtin/market-heatmap/index.tsx +2 -2
  202. package/src/plugins/builtin/market-movers/footer.ts +29 -3
  203. package/src/plugins/builtin/market-movers/headless.ts +12 -5
  204. package/src/plugins/builtin/market-movers/index.tsx +3 -3
  205. package/src/plugins/builtin/market-movers/session-body.tsx +6 -3
  206. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  207. package/src/plugins/builtin/market-valuation/headless.ts +6 -6
  208. package/src/plugins/builtin/market-valuation/pane.tsx +2 -3
  209. package/src/plugins/builtin/market-valuation/view.ts +6 -8
  210. package/src/plugins/builtin/members/client.ts +9 -2
  211. package/src/plugins/builtin/members/headless.ts +8 -10
  212. package/src/plugins/builtin/members/model.ts +29 -17
  213. package/src/plugins/builtin/members/pane.tsx +10 -12
  214. package/src/plugins/builtin/money-markets/headless.ts +1 -1
  215. package/src/plugins/builtin/news/headless.ts +4 -0
  216. package/src/plugins/builtin/news/index.tsx +3 -1
  217. package/src/plugins/builtin/news/wire/industry-pane.tsx +2 -1
  218. package/src/plugins/builtin/news/wire/news/preset-pane.tsx +1 -1
  219. package/src/plugins/builtin/news/wire/persisted-articles.ts +8 -4
  220. package/src/plugins/builtin/notes/headless.ts +7 -0
  221. package/src/plugins/builtin/notes/index.tsx +1 -1
  222. package/src/plugins/builtin/notes/quick-notes-pane.tsx +18 -2
  223. package/src/plugins/builtin/options/view.tsx +7 -6
  224. package/src/plugins/builtin/options-positioning/headless.ts +4 -4
  225. package/src/plugins/builtin/options-positioning/pane.tsx +7 -3
  226. package/src/plugins/builtin/options-scenario/client.ts +20 -4
  227. package/src/plugins/builtin/options-scenario/headless.ts +1 -1
  228. package/src/plugins/builtin/pe-band/client.ts +5 -9
  229. package/src/plugins/builtin/pe-band/headless.ts +11 -13
  230. package/src/plugins/builtin/pe-band/model.ts +39 -60
  231. package/src/plugins/builtin/pe-band/pane.tsx +14 -15
  232. package/src/plugins/builtin/perps/equity-row.tsx +3 -1
  233. package/src/plugins/builtin/perps/freshness.ts +16 -9
  234. package/src/plugins/builtin/perps/headless.ts +4 -1
  235. package/src/plugins/builtin/perps/markets-section.tsx +16 -10
  236. package/src/plugins/builtin/perps/model.ts +33 -2
  237. package/src/plugins/builtin/perps/pane.tsx +3 -2
  238. package/src/plugins/builtin/perps/status-line.ts +12 -3
  239. package/src/plugins/builtin/perps/venue-markets.ts +38 -0
  240. package/src/plugins/builtin/plugin-marketplace/pane.tsx +4 -3
  241. package/src/plugins/builtin/portfolio-list/cell-version.ts +1 -1
  242. package/src/plugins/builtin/portfolio-list/cli/render.ts +46 -7
  243. package/src/plugins/builtin/portfolio-list/headless.ts +31 -8
  244. package/src/plugins/builtin/portfolio-list/settings.ts +3 -0
  245. package/src/plugins/builtin/portfolio-list/table.tsx +7 -1
  246. package/src/plugins/builtin/power/headless.ts +1 -1
  247. package/src/plugins/builtin/realized-vol/headless.ts +1 -1
  248. package/src/plugins/builtin/research/corporate-actions-pane.tsx +27 -13
  249. package/src/plugins/builtin/scanner/feed.ts +7 -4
  250. package/src/plugins/builtin/scanner/flow-pane.tsx +8 -4
  251. package/src/plugins/builtin/scanner/headless.ts +57 -26
  252. package/src/plugins/builtin/scanner/hilo-pane.tsx +6 -3
  253. package/src/plugins/builtin/scanner/lock-note.ts +3 -2
  254. package/src/plugins/builtin/scanner/us-session.ts +9 -0
  255. package/src/plugins/builtin/seasonality/client.ts +46 -10
  256. package/src/plugins/builtin/seasonality/headless.ts +29 -11
  257. package/src/plugins/builtin/seasonality/model.ts +101 -24
  258. package/src/plugins/builtin/seasonality/pane.tsx +10 -6
  259. package/src/plugins/builtin/sec/filing-content.ts +13 -0
  260. package/src/plugins/builtin/sec/index.tsx +16 -11
  261. package/src/plugins/builtin/sectors/client.ts +27 -5
  262. package/src/plugins/builtin/sectors/headless.ts +2 -1
  263. package/src/plugins/builtin/sectors/index.tsx +22 -10
  264. package/src/plugins/builtin/shared/cloud-resource.ts +3 -3
  265. package/src/plugins/builtin/shared/extended-print.ts +38 -0
  266. package/src/plugins/builtin/shared/pro-feature-wall.tsx +1 -1
  267. package/src/plugins/builtin/shared/report-freshness.ts +7 -3
  268. package/src/plugins/builtin/shared/scanner-capture.ts +16 -3
  269. package/src/plugins/builtin/shared/ticker-company.ts +17 -8
  270. package/src/plugins/builtin/shared/use-quote-board.ts +11 -4
  271. package/src/plugins/builtin/social-mentions/client.ts +7 -3
  272. package/src/plugins/builtin/social-mentions/outliers.tsx +9 -2
  273. package/src/plugins/builtin/thirteenf/api.ts +24 -3
  274. package/src/plugins/builtin/thirteenf/data.ts +21 -8
  275. package/src/plugins/builtin/thirteenf/headless.ts +7 -3
  276. package/src/plugins/builtin/thirteenf/signals-pane.tsx +10 -3
  277. package/src/plugins/builtin/thirteenf/signals.ts +22 -1
  278. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +4 -2
  279. package/src/plugins/builtin/ticker-detail/financials/model.ts +7 -0
  280. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +15 -6
  281. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +5 -4
  282. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +14 -5
  283. package/src/plugins/builtin/ticker-detail/headless.ts +32 -26
  284. package/src/plugins/builtin/ticker-detail/index.tsx +1 -1
  285. package/src/plugins/builtin/ticker-detail/overview/components.tsx +8 -3
  286. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -5
  287. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +14 -1
  288. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -8
  289. package/src/plugins/builtin/ticker-detail/pane.tsx +16 -9
  290. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +41 -23
  291. package/src/plugins/builtin/ticker-detail/quote-monitor/rows.ts +30 -13
  292. package/src/plugins/builtin/ticker-detail/settings.ts +9 -2
  293. package/src/plugins/builtin/time-sales/headless.ts +49 -13
  294. package/src/plugins/builtin/time-sales/model.ts +2 -2
  295. package/src/plugins/builtin/time-sales/window.ts +84 -10
  296. package/src/plugins/builtin/vol-surface/charts.tsx +4 -2
  297. package/src/plugins/builtin/vol-surface/events.ts +12 -5
  298. package/src/plugins/builtin/vol-surface/headless.ts +1 -1
  299. package/src/plugins/builtin/vol-surface/pane.tsx +15 -7
  300. package/src/plugins/builtin/world-indices/footer.ts +1 -1
  301. package/src/plugins/builtin/world-venue-map/chokepoint-report.ts +3 -1
  302. package/src/plugins/builtin/world-venue-map/headless.ts +27 -13
  303. package/src/plugins/builtin/yield-curve/client.ts +3 -1
  304. package/src/plugins/duplicates.ts +60 -0
  305. package/src/plugins/loader.ts +12 -3
  306. package/src/plugins/marketplace/model.ts +10 -1
  307. package/src/portfolio/column-values.ts +52 -5
  308. package/src/react/async-resource.ts +8 -7
  309. package/src/renderers/browser/bundled-plugins.ts +2 -1
  310. package/src/renderers/dom/build-assets.ts +20 -0
  311. package/src/renderers/dom/data-table/index.tsx +36 -2
  312. package/src/renderers/dom/es2023-array-methods.ts +57 -0
  313. package/src/renderers/dom/host/surface-fit.ts +64 -13
  314. package/src/renderers/dom/styles.css +6 -1
  315. package/src/renderers/electrobun/bun/external-plugins.ts +16 -6
  316. package/src/renderers/electrobun/shared/protocol.ts +2 -0
  317. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +31 -7
  318. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +15 -8
  319. package/src/renderers/electrobun/view/external-plugins.ts +1 -0
  320. package/src/renderers/electrobun/view/remote/asset-data-client.ts +1 -0
  321. package/src/series/types.ts +1 -0
  322. package/src/sources/gloomberb-cloud/fred-attribution.ts +6 -5
  323. package/src/sources/gloomberb-cloud/index.ts +42 -5
  324. package/src/sources/gloomberb-cloud/news.ts +15 -2
  325. package/src/sources/gloomberb-cloud/normalizers.ts +9 -0
  326. package/src/sources/history-result.ts +2 -1
  327. package/src/sources/history-retention.ts +14 -2
  328. package/src/sources/listing-symbols.ts +1 -1
  329. package/src/sources/provider-router/cache.ts +32 -3
  330. package/src/sources/provider-router/cached-routes.ts +25 -0
  331. package/src/sources/provider-router/connection-health.ts +1 -0
  332. package/src/sources/provider-router/history.ts +2 -2
  333. package/src/sources/provider-router/index.ts +14 -0
  334. package/src/sources/provider-router/sec-filings-page.ts +25 -0
  335. package/src/sources/sec-edgar/content.ts +67 -36
  336. package/src/tickers/listing-fate.ts +28 -0
  337. package/src/tickers/search/home-listing.ts +3 -0
  338. package/src/tickers/search/index-root-lead.ts +40 -0
  339. package/src/tickers/terminal-codes.ts +7 -4
  340. package/src/time-series/base-series.ts +17 -8
  341. package/src/time-series/fundamentals/historical-valuation.ts +2 -2
  342. package/src/time-series/fundamentals/series.ts +15 -12
  343. package/src/time-series/history-acquisition.ts +2 -0
  344. package/src/time-series/market.ts +3 -1
  345. package/src/time-series/price-comparison.ts +3 -1
  346. package/src/time-series/resolve-context.ts +8 -0
  347. package/src/time-series/resolve.ts +50 -10
  348. package/src/time-series/types.ts +1 -0
  349. package/src/time-series/use-chart-resolution.ts +2 -2
  350. package/src/time-series/valuation-currency.ts +40 -12
  351. package/src/types/data-provider.ts +30 -1
  352. package/src/types/financials.ts +23 -0
  353. package/src/types/headless.ts +23 -0
  354. package/src/types/instrument.ts +1 -0
  355. package/src/utils/crypto-pair.ts +16 -0
  356. package/src/utils/exchange-announcements.ts +2 -1
  357. package/src/utils/exchange-notation.generated.ts +58 -1
  358. package/src/utils/exchanges.ts +43 -1
  359. package/src/utils/format.ts +37 -2
  360. package/src/utils/function-search.ts +38 -0
  361. package/src/utils/fuzzy-search.ts +10 -6
  362. package/src/utils/option-choice.ts +15 -0
  363. package/src/utils/price-history.ts +15 -1
  364. package/src/utils/reason-codes.ts +6 -3
  365. package/src/utils/trailing-dividend.ts +241 -28
@@ -19,6 +19,7 @@ import { fuzzyFilter } from "../../../utils/fuzzy-search";
19
19
  import type { CommandBarRoute } from "../workflow/types";
20
20
  import { t, tc } from "../../../i18n";
21
21
  import { HEADER_MARKET_TITLE, isHeaderMarketRoute } from "../routes/header-market";
22
+ import { tickerSearchTitle } from "../routes/ticker-search/title";
22
23
 
23
24
  type ActiveCommandMatch = ReturnType<typeof matchPrefix>;
24
25
 
@@ -32,6 +33,8 @@ interface BuildRouteListStateOptions {
32
33
  adaptHeaderMarketResult: (item: ResultItem) => ResultItem;
33
34
  /** The header market picker's benchmark rows for a query. */
34
35
  headerMarketItems: (query: string) => ResultItem[];
36
+ /** A function's name by its pane template, which titles the ticker search it opens (Seasonality for SEAS). */
37
+ paneTemplateLabel: (templateId: string) => string | null;
35
38
  buildLayoutItems: (query: string) => ResultItem[];
36
39
  currentRoute: CommandBarRoute | null;
37
40
  orderedRootResults: ResultItem[];
@@ -55,6 +58,7 @@ function buildRouteListState(options: BuildRouteListStateOptions): ListScreenSta
55
58
  currentRoute,
56
59
  headerMarketItems,
57
60
  orderedRootResults,
61
+ paneTemplateLabel,
58
62
  rootHoveredIdx,
59
63
  rootModeKind,
60
64
  rootCategoryPriorities,
@@ -134,17 +138,22 @@ function buildRouteListState(options: BuildRouteListStateOptions): ListScreenSta
134
138
  footerLeft: getScreenFooterLeft(currentRoute),
135
139
  footerRight: getScreenFooterRight(currentRoute),
136
140
  sectionOrder: "ranked",
141
+ searchesTickers: true,
137
142
  };
138
143
  }
139
144
  const results = tickerSearchResults.map((item) => adaptTickerSearchRouteResult(item, currentRoute.payload));
140
145
  const emptyState = getEmptyState("search", currentRoute.query, currentRoute.query);
146
+ const title = tickerSearchTitle(currentRoute.payload, paneTemplateLabel);
141
147
  return {
142
148
  kind: "mode",
143
- title: "Security Description",
144
- // DES opens a research pane; the backtick's search changes the focused pane's ticker.
145
- subtitle: currentRoute.payload?.action
146
- ? "Resolve a ticker, then open its Ticker Research pane."
147
- : "Resolve a ticker for the focused pane, or open it in a new pane.",
149
+ // Titled by the function its rows open: SEAS's search is Seasonality, not DES.
150
+ title,
151
+ // DES opens a research pane, a function's own search that function; the backtick's search changes the focused pane's ticker.
152
+ subtitle: currentRoute.payload?.action === "pane-template" || currentRoute.payload?.action === "collection-command"
153
+ ? `Resolve a ticker for ${title}.`
154
+ : currentRoute.payload?.action
155
+ ? "Resolve a ticker, then open its Ticker Research pane."
156
+ : "Resolve a ticker for the focused pane, or open it in a new pane.",
148
157
  query: currentRoute.query,
149
158
  selectedIdx: currentRoute.selectedIdx,
150
159
  hoveredIdx: currentRoute.hoveredIdx,
@@ -155,6 +164,7 @@ function buildRouteListState(options: BuildRouteListStateOptions): ListScreenSta
155
164
  footerLeft: getScreenFooterLeft(currentRoute),
156
165
  footerRight: getScreenFooterRight(currentRoute),
157
166
  sectionOrder: "ranked",
167
+ searchesTickers: true,
158
168
  };
159
169
  }
160
170
  default:
@@ -205,6 +215,7 @@ export function useRouteListState(options: BuildRouteListStateOptions): ListScre
205
215
  currentRoute,
206
216
  headerMarketItems,
207
217
  orderedRootResults,
218
+ paneTemplateLabel,
208
219
  rootCategoryPriorities,
209
220
  rootHoveredIdx,
210
221
  rootModeKind,
@@ -224,6 +235,7 @@ export function useRouteListState(options: BuildRouteListStateOptions): ListScre
224
235
  currentRoute,
225
236
  headerMarketItems,
226
237
  orderedRootResults,
238
+ paneTemplateLabel,
227
239
  rootCategoryPriorities,
228
240
  rootHoveredIdx,
229
241
  rootModeKind,
@@ -3,7 +3,7 @@ import type { AppState } from "../../state/app/context";
3
3
  import type { TickerRecord } from "../../types/ticker";
4
4
  import { t } from "../../i18n";
5
5
  import { listingChoiceQuery, normalizeTickerInput } from "../../tickers/search";
6
- import { isKnownExchangeCode } from "../../utils/exchanges";
6
+ import { isKnownExchangeCode, typedExchangeVenue } from "../../utils/exchanges";
7
7
  import type { PluginRegistry } from "../../plugins/registry";
8
8
  import type { Command } from "./commands/registry";
9
9
  import type {
@@ -314,7 +314,8 @@ export function useCommandBarSelectionRuntime({
314
314
  ? rootShortcutIntent.argText : null;
315
315
  // `DES BA LN` names its listing as `DES BA:LSE` does.
316
316
  const listingQuery = listingChoiceQuery((tickerArgument === null ? null : normalizeTickerInput(null, tickerArgument)) ?? rootQueryRef.current);
317
- const choosingVenue = listingQuery && !isKnownExchangeCode(listingQuery.suffix);
317
+ // `DES INTP:IDX` names Jakarta's line as `DES INTP:JAKARTA` does (typedExchangeVenue).
318
+ const choosingVenue = listingQuery && !isKnownExchangeCode(listingQuery.suffix) && !typedExchangeVenue(listingQuery.suffix);
318
319
  const highlighted = listState.results[listState.selectedIdx];
319
320
  // A function given a listing with its venue opens that listing: a row the
320
321
  // user did not pick (a saved BRK.B the letters match, Boeing's BA on NYSE)
@@ -595,6 +595,7 @@ export function CommandBar({
595
595
  notify: notifyFromPicker,
596
596
  persistConfig,
597
597
  });
598
+ const paneTemplateLabel = useCallback((templateId: string) => pluginRegistry.paneTemplates.get(templateId)?.label ?? null, [pluginRegistry]);
598
599
  const routeListState = useRouteListState({
599
600
  activeMatch,
600
601
  adaptHeaderMarketResult,
@@ -603,6 +604,7 @@ export function CommandBar({
603
604
  buildLayoutItems,
604
605
  currentRoute,
605
606
  orderedRootResults,
607
+ paneTemplateLabel,
606
608
  rootCategoryPriorities,
607
609
  rootHoveredIdx,
608
610
  rootModeKind: rootModeInfo.kind,
@@ -6,6 +6,7 @@ import type { ListingDeps } from "../../../tickers/listing-venues";
6
6
  import type { Quote } from "../../../types/financials";
7
7
  import { isPenceQuotedLine, isSharePriceQuote } from "../../../market-data/market/format";
8
8
  import { formatUtcDayTime } from "../../../utils/utc-time";
9
+ import { isRegularSessionPrint } from "../../../market-data/quotes/tick-range";
9
10
  import { coerceFieldString } from "../helpers";
10
11
  import type {
11
12
  CommandBarFieldValue,
@@ -149,13 +150,11 @@ export function useAlertWorkflowQuoteSync({
149
150
  const read = () => void resolveAlertListing(alertWorkflowSymbol, null, listingDeps)
150
151
  .then(({ quote, fate }) => {
151
152
  if (quoteRequestRef.current !== requestId) return;
152
- // An alert is judged on the latest print, extended hours included: the target starts there.
153
153
  const print = getLatestPrintDisplay(quote);
154
154
  if (!quote || !print || !Number.isFinite(print.price)) {
155
155
  throw new Error(tf('No quote found for "{symbol}".', { symbol: alertWorkflowSymbol }));
156
156
  }
157
157
 
158
- const quotePrice = isPenceQuotedLine(quote) ? `${Number((print.price * 100).toPrecision(12))}p` : formatAlertWorkflowPrice(print.price);
159
158
  updateRoute((route) => {
160
159
  if (!isSetAlertWorkflow(route)) return route;
161
160
  if (normalizeAlertWorkflowSymbol(route.values.symbol) !== alertWorkflowSymbol) return route;
@@ -163,6 +162,8 @@ export function useAlertWorkflowQuoteSync({
163
162
  const currentPrice = coerceFieldString(route.values.price).trim();
164
163
  const previousAutoPrice = String(route.payloadMeta?.alertAutoPrice ?? "");
165
164
  const shouldPrefill = currentPrice.length === 0 || currentPrice === previousAutoPrice;
165
+ const waiting = route.values["price:session"] === "regular" && !isRegularSessionPrint(quote);
166
+ const quotePrice = waiting ? "" : isPenceQuotedLine(quote) ? `${Number((print.price * 100).toPrecision(12))}p` : formatAlertWorkflowPrice(print.price);
166
167
  const nextValues = shouldPrefill
167
168
  ? { ...route.values, price: quotePrice }
168
169
  : route.values;
@@ -173,7 +174,8 @@ export function useAlertWorkflowQuoteSync({
173
174
  fields: updateAlertWorkflowFieldDescriptions(route.fields, {
174
175
  // What became of the symbol goes under its quote, which names the listing: FB is a fund now, and Meta trades as META.
175
176
  symbol: [formatAlertWorkflowQuote(quote), ...fate].join("\n"),
176
- price: tf("Current price {price}; edit to set the target.", { price: formatAlertWorkflowCurrentPrice(print, quote) }),
177
+ price: waiting ? "Enter a target. The alert waits for a regular-hours quote."
178
+ : tf("Current price {price}; edit to set the target.", { price: formatAlertWorkflowCurrentPrice(print, quote) }),
177
179
  }, nextValues, quote),
178
180
  payloadMeta: {
179
181
  ...(route.payloadMeta ?? {}),
@@ -207,5 +209,5 @@ export function useAlertWorkflowQuoteSync({
207
209
  });
208
210
  const timer = setTimeout(read, ALERT_WORKFLOW_READ_DELAY_MS);
209
211
  return () => clearTimeout(timer);
210
- }, [alertWorkflowActive, alertWorkflowSymbol, listingDeps, updateRoute]);
212
+ }, [alertWorkflowActive, alertWorkflowSymbol, route.values["price:session"], listingDeps, updateRoute]);
211
213
  }
@@ -44,6 +44,7 @@ import { slugifyName } from "../../../utils/slugify";
44
44
  import { readTypedNumber } from "../../../utils/decimal-comma";
45
45
  import { resolveTickerInputOrThrow } from "./ops";
46
46
  import { resolveCollectionTicker } from "./collection-ticker";
47
+ import { displayTickerKey } from "../../../utils/exchanges";
47
48
 
48
49
  export type CommandBarNotifyFn = (
49
50
  body: string,
@@ -328,7 +329,7 @@ export function createCommandBarCollectionWorkflowActions(options: {
328
329
  symbol: result.ticker.metadata.ticker,
329
330
  portfolioId: portfolio.id,
330
331
  });
331
- notify(`Set position for ${result.ticker.metadata.ticker} in "${portfolio.name}".`, { type: "success" });
332
+ notify(`Set position for ${displayTickerKey(result.ticker.metadata.ticker)} in "${portfolio.name}".`, { type: "success" });
332
333
  },
333
334
 
334
335
  async addTickerMembershipFromWorkflow(values) {
@@ -35,6 +35,7 @@ export {
35
35
  datesPaneData,
36
36
  DELAYED_SEGMENT,
37
37
  delayedFooterSegment,
38
+ footerTimeText,
38
39
  hasPaneFooterContent,
39
40
  savedCopyFooterInfo,
40
41
  savedCopyFooterSegment,
@@ -133,6 +133,18 @@ export function delayedFooterSegment({
133
133
  };
134
134
  }
135
135
 
136
+ /**
137
+ * When a copy the footer speaks of was read or saved: `14:37` today, with its
138
+ * day (`Nov 20 14:37`) when on another, and its year when in another.
139
+ */
140
+ export function footerTimeText(at: number, now = Date.now()): string {
141
+ const saved = new Date(at);
142
+ const time = saved.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit", hour12: false });
143
+ const today = new Date(now);
144
+ const year = saved.getFullYear() !== today.getFullYear() ? "numeric" : false;
145
+ return saved.toDateString() === today.toDateString() ? time : `${formatShortDate(saved, { year })} ${time}`;
146
+ }
147
+
136
148
  /**
137
149
  * The footer's one form for data shown from a copy saved earlier because
138
150
  * refreshing it failed (offline, a hung or refused proxy): `saved copy from
@@ -140,12 +152,7 @@ export function delayedFooterSegment({
140
152
  * pane's quotes are, so it is a quote status.
141
153
  */
142
154
  export function savedCopyFooterSegment(id: string, savedAt: number, now = Date.now(), refreshing = false): PaneFooterSegment {
143
- const saved = new Date(savedAt);
144
- const time = saved.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit", hour12: false });
145
- const today = new Date(now);
146
- const year = saved.getFullYear() !== today.getFullYear() ? "numeric" : false;
147
- const when = saved.toDateString() === today.toDateString() ? time : `${formatShortDate(saved, { year })} ${time}`;
148
- const text = `${t("saved copy from")} ${when}`;
155
+ const text = `${t("saved copy from")} ${footerTimeText(savedAt, now)}`;
149
156
  return {
150
157
  id,
151
158
  quoteStatus: true,
@@ -527,6 +534,12 @@ export function fitPaneFooterInfo(
527
534
  return fitNoteLines(fitPaneFooterInfo(held, width, { besideHints, terminal })
528
535
  .map((segment) => notesOf.has(segment.id) ? { ...segment, notes: notesOf.get(segment.id) } : segment), width);
529
536
  }
537
+ const [first, ...rest] = info;
538
+ if (first?.savedCopyAt != null && rest.length && infoTextWidth(info) > width && infoTextWidth([first]) <= width) {
539
+ const room = width - infoTextWidth([first]) - PANE_FOOTER_SEPARATOR.length;
540
+ const remainder = room > 0 ? fitPaneFooterInfo(rest, room, { besideHints, terminal }) : [];
541
+ return infoTextWidth(remainder) <= room ? [first, ...remainder] : [first];
542
+ }
530
543
  if (!besideHints && !terminal) return stepDownTogether(info, width);
531
544
  const lastWithVariants = info.findLastIndex((segment) => (segment.variants?.length ?? 0) > 0);
532
545
  if (lastWithVariants >= 0 && lastWithVariants < info.length - 1 && infoTextWidth(info) > width) {
@@ -728,7 +741,7 @@ function savedCopyFirst(info: PaneFooterSegment[]): PaneFooterSegment[] {
728
741
  for (const segment of info) {
729
742
  if (segment.savedCopyAt != null && (oldest?.savedCopyAt == null || segment.savedCopyAt < oldest.savedCopyAt)) oldest = segment;
730
743
  }
731
- return oldest ? [oldest, ...info.filter((segment) => segment.savedCopyAt == null)] : info;
744
+ return oldest ? [oldest, ...info.filter((segment) => segment.savedCopyAt == null && !segment.age)] : info;
732
745
  }
733
746
 
734
747
  function sameFooterParts(left: PaneFooterPart[], right: PaneFooterPart[]): boolean {
@@ -9,19 +9,28 @@ import type { PaneDef } from "../../../types/plugin";
9
9
  import { isUnlinkedFollower, paneTitleMnemonic, TITLE_TICKER } from "../../../layout/pane-follow";
10
10
  import { canFollowTickerSource, isTickerLinkPeer } from "../../../layout/ticker-navigation";
11
11
  import { withoutCryptoVenueCode } from "../../../utils/crypto-pair";
12
- import { displayTickerKey } from "../../../utils/exchanges";
12
+ import { displayListingKeys, displayTickerKey } from "../../../utils/exchanges";
13
13
 
14
14
  /** A ticker as a title names it: by its venue's own code, and a coin by its pair alone (USDT-USD, never USDT-USD:CCC). */
15
15
  function titleTickerKey(key: string): string {
16
16
  return withoutCryptoVenueCode(displayTickerKey(key));
17
17
  }
18
18
 
19
+ /**
20
+ * A board's title as the app wrote it, its listing keys joined by " · " and
21
+ * the rest counted ("0700:XHKG · XYZ:XNYS", "AAPL · MSFT +3").
22
+ */
23
+ const KEY_LIST_TITLE = /^[^\s·]+(?: · [^\s·]+)*(?: \+\d+)?$/;
24
+
19
25
  /**
20
26
  * A title a template wrote, its command and the ticker keys it opened on
21
27
  * ("FA 9992:XHKG", "RV 9992:XHKG,PLTR"), with each key by its venue's code
22
- * ("FA 9992:HKEX"). Any other title is the user's or the pane's own and stays.
28
+ * ("FA 9992:HKEX"), and a board's list of keys the same way: a Quote Monitor
29
+ * saved as "0700:XHKG · XYZ:XNYS" reads "0700:HKEX · XYZ:NYSE", as its cards
30
+ * do. Any other title is the user's or the pane's own and stays as written.
23
31
  */
24
32
  function displayStoredTitle(title: string): string {
33
+ if (KEY_LIST_TITLE.test(title)) return displayListingKeys(title);
25
34
  const mnemonic = paneTitleMnemonic(title);
26
35
  if (!mnemonic) return title;
27
36
  // Keys and the separators between them as written ("AAPL, MSFT" keeps its space).
@@ -6,6 +6,8 @@ import { type PromptContext, useDialogKeyboard } from "../ui/dialog";
6
6
  import type { Quote } from "../types/financials";
7
7
  import { colors } from "../theme/colors";
8
8
  import { formatMarketPrice } from "../market-data/market/format";
9
+ import { formatTradeSize } from "../utils/format";
10
+ import { formatQuoteBookTime } from "../market-data/quotes/time";
9
11
  import { DialogFrame, ListView, NumberField } from "./ui";
10
12
  import { matchesNavigationKey, useKeybindings } from "../app/keybindings";
11
13
 
@@ -26,10 +28,10 @@ function buildPresets(quote: Quote | undefined): PricePreset[] {
26
28
  if (!quote) return [];
27
29
  const presets: PricePreset[] = [];
28
30
  if (quote.bid != null && quote.bid > 0) {
29
- presets.push({ label: "Bid", value: quote.bid, detail: quote.bidSize != null ? `× ${quote.bidSize}` : undefined });
31
+ presets.push({ label: "Bid", value: quote.bid, detail: quote.bidSize != null ? `× ${formatTradeSize(quote.bidSize)}` : undefined });
30
32
  }
31
33
  if (quote.ask != null && quote.ask > 0) {
32
- presets.push({ label: "Ask", value: quote.ask, detail: quote.askSize != null ? `× ${quote.askSize}` : undefined });
34
+ presets.push({ label: "Ask", value: quote.ask, detail: quote.askSize != null ? `× ${formatTradeSize(quote.askSize)}` : undefined });
33
35
  }
34
36
  if (quote.price > 0) {
35
37
  presets.push({ label: "Last", value: quote.price });
@@ -55,17 +57,19 @@ function formatMarketContext(quote: Quote | undefined, assetCategory?: string):
55
57
  parts.push(`Last ${formatMarketPrice(quote.price, { assetCategory })}`);
56
58
  if (quote.bid != null) {
57
59
  const bidValue = formatMarketPrice(quote.bid, { assetCategory });
58
- const bidStr = quote.bidSize != null ? `Bid ${bidValue} × ${quote.bidSize}` : `Bid ${bidValue}`;
60
+ const bidStr = quote.bidSize != null ? `Bid ${bidValue} × ${formatTradeSize(quote.bidSize)}` : `Bid ${bidValue}`;
59
61
  parts.push(bidStr);
60
62
  }
61
63
  if (quote.ask != null) {
62
64
  const askValue = formatMarketPrice(quote.ask, { assetCategory });
63
- const askStr = quote.askSize != null ? `Ask ${askValue} × ${quote.askSize}` : `Ask ${askValue}`;
65
+ const askStr = quote.askSize != null ? `Ask ${askValue} × ${formatTradeSize(quote.askSize)}` : `Ask ${askValue}`;
64
66
  parts.push(askStr);
65
67
  }
66
68
  if (quote.bid != null && quote.ask != null) {
67
69
  parts.push(`Spd ${formatMarketPrice(quote.ask - quote.bid, { assetCategory })}`);
68
70
  }
71
+ const bookTime = formatQuoteBookTime(quote);
72
+ if (bookTime) parts.push(`Book ${bookTime}`);
69
73
  return parts.join(" · ");
70
74
  }
71
75
 
@@ -24,8 +24,9 @@ export interface TickerBadgeListProps {
24
24
  /**
25
25
  * The source names these as listed tickers (an SEC filer's ticker, the
26
26
  * pane's own symbol): each is drawn as a badge as it is, with no lookup
27
- * and no quote. A lookup that fails prints a symbol as plain text, so a
28
- * column of looked-up symbols can mix chips and bare words.
27
+ * and no quote, so a column of them is one look. Without it, a lookup that
28
+ * fails prints a symbol as plain text, and a column of looked-up symbols
29
+ * can mix chips and bare words.
29
30
  */
30
31
  listed?: boolean;
31
32
  /**
@@ -130,7 +131,7 @@ export function TickerBadgeList({
130
131
  {named.map((symbol, index) => {
131
132
  const key = keyOf(symbol);
132
133
  const entry = catalog[key];
133
- if (entry?.status === "missing" || (!listed && listings?.[symbol] === null)) {
134
+ if (entry?.status === "missing" || listings?.[symbol] === null) {
134
135
  return (
135
136
  <Box key={symbol} paddingRight={1} flexShrink={0}>
136
137
  <Text fg={fallbackColor} attributes={TextAttributes.BOLD}>{symbol}</Text>
@@ -140,6 +140,12 @@ export interface TickerListVisibleRange {
140
140
  export interface TickerListTableViewProps {
141
141
  /** What the list is (a watchlist's name), which names its exported file. */
142
142
  exportName?: string;
143
+ /**
144
+ * When a row's LAST is from, as its exported `as_of` dates it (an ISO time
145
+ * or date; null for none), where the list knows better than the quote's
146
+ * headline: a book valued at an after-hours print.
147
+ */
148
+ exportAsOf?: (ticker: TickerRecord) => string | null;
143
149
  columns: ColumnConfig[];
144
150
  tickers: TickerRecord[];
145
151
  cursorSymbol: string | null;
@@ -348,6 +354,7 @@ export function TickerListTableView({
348
354
  virtualize = true,
349
355
  overscan = 4,
350
356
  exportName,
357
+ exportAsOf,
351
358
  columnReorder,
352
359
  }: TickerListTableViewProps) {
353
360
  const commandBarShortcut = useCommandBarShortcut();
@@ -367,6 +374,8 @@ export function TickerListTableView({
367
374
  // one row. A new `resolveCell` (another column context: FX, weights, the
368
375
  // AGE clock) still redraws every visible row through its epoch.
369
376
  const financialsRef = useRef(financialsMap);
377
+ const exportAsOfRef = useRef(exportAsOf);
378
+ exportAsOfRef.current = exportAsOf;
370
379
  financialsRef.current = financialsMap;
371
380
  const flashSymbolsRef = useRef(safeFlashSymbols);
372
381
  flashSymbolsRef.current = safeFlashSymbols;
@@ -440,7 +449,9 @@ export function TickerListTableView({
440
449
  const identity = (ticker: TickerRecord) => quoteExportIdentityCells(exportedListingKey(ticker), financialsRef.current.get(ticker.metadata.ticker)?.quote,
441
450
  Date.now(),
442
451
  // A broker's quote names the broker as its source.
443
- (providerId) => getSharedRegistry()?.getBrokerAdapter(providerId)?.name);
452
+ (providerId) => getSharedRegistry()?.getBrokerAdapter(providerId)?.name,
453
+ // Dated as the row's LAST is, where the list says (a book valued at the latest print).
454
+ exportAsOfRef.current?.(ticker));
444
455
  return groupLabels
445
456
  ? {
446
457
  headers: ["Group", ...QUOTE_EXPORT_IDENTITY_HEADERS],
@@ -186,27 +186,29 @@ function textFieldCells(filter: Pick<QueryBarTextFilter, "width" | "value">, ter
186
186
 
187
187
  /** An inline filter of a few short options, drawn as segments: what collapses to its menu when the row runs short. */
188
188
  function collapsibleInline(filter: QueryBarFilter): filter is QueryBarSelectFilter {
189
- return (filter.kind === undefined || filter.kind === "select") && filter.inline === true && filter.options.length <= TERMINAL_SEGMENT_LIMIT;
189
+ return (filter.kind === undefined || filter.kind === "select") && filter.inline === true;
190
190
  }
191
191
 
192
192
  /**
193
193
  * The cells a terminal query bar takes with every control drawn in full: what decides whether its inline filters
194
- * collapse to menus so the as-of keeps its place. `meta` gives way by itself and a long strip scrolls, so neither counts.
194
+ * collapse to menus so the controls and as-of can keep their places. `meta` gives way by itself.
195
195
  */
196
- function terminalRowCells(width: number, { search, filters = [], view, asOf }: Pick<QueryBarProps, "search" | "filters" | "view" | "asOf">): number {
197
- const segments = (options: readonly { label: string; short?: string; hint?: string }[]) => options.length > TERMINAL_SEGMENT_LIMIT ? 0
198
- : options.reduce((sum, option) => sum + (keyedStrip(options) && option.hint ? option.hint.length + 1 : 0) + (option.short ?? option.label).length + 2, 0);
196
+ function terminalRowCells(width: number, { search, filters = [], view, asOf }: Pick<QueryBarProps, "search" | "filters" | "view" | "asOf">, filterMenus = false, viewMenu = false): number {
197
+ const segments = (options: readonly { label: string; short?: string; hint?: string }[]) =>
198
+ options.reduce((sum, option) => sum + (keyedStrip(options) && option.hint ? option.hint.length + 1 : 0) + displayWidth(option.short ?? option.label) + 2, 0);
199
199
  const parts = [
200
200
  ...search ? [Math.max(16, Math.min(36, Math.floor(width * 0.3)))] : [],
201
201
  ...filters.map((filter) => {
202
202
  if (filter.kind === "text") return textFieldCells(filter) + filter.label.length + 1;
203
203
  if (filter.kind === "toggle") return (filter.short ?? filter.label).length + 4;
204
204
  if (filter.kind === "multi") return filter.label.length + 8;
205
- if (filter.inline) return filter.label.length + 1 + segments(filter.options);
205
+ if (filter.inline && !filterMenus) return filter.label.length + 1 + segments(filter.options);
206
206
  const current = filter.options.find((option) => option.value === filter.value);
207
- return filter.label.length + (current?.short ?? current?.label ?? "").length + 6;
207
+ return filter.label.length + displayWidth(current?.short ?? current?.label ?? "") + 1;
208
208
  }),
209
- ...view ? [segments(view.options)] : [],
209
+ ...view ? [viewMenu
210
+ ? displayWidth(view.options.find((option) => option.value === view.value)?.label ?? "")
211
+ : segments(view.options)] : [],
210
212
  ...asOf ? [asOf.length] : [],
211
213
  ];
212
214
  return 2 + parts.reduce((sum, part) => sum + part, 0) + 2 * Math.max(0, parts.length - 1);
@@ -552,7 +554,14 @@ export function QueryBar({ width, search, filters = [], view, meta, asOf: given,
552
554
  );
553
555
  }
554
556
 
555
- const viewStrip = view ? (
557
+ const collapseInline = (!!asOf || !!view && !view.start) && filters.some(collapsibleInline)
558
+ && terminalRowCells(width, { search, filters, view, asOf }) > width;
559
+ const collapseView = collapseInline && !!view && !view.start
560
+ && terminalRowCells(width, { search, filters, view, asOf }, true) > width;
561
+ const showAsOf = asOf && (!collapseInline || terminalRowCells(width, { search, filters, view, asOf }, true, collapseView) <= width);
562
+ const viewStrip = view ? collapseView ? (
563
+ <SelectButton label={view.label ?? "View"} showLabel={false} value={view.value} options={view.options} onChange={(value) => choose(view, value)} />
564
+ ) : (
556
565
  <Box flexShrink={view.options.length > TERMINAL_SEGMENT_LIMIT ? 1 : 0} minWidth={0}>
557
566
  <TerminalChoiceStrip
558
567
  options={view.options.map((option) => ({ value: option.value, label: option.label, hint: option.hint, disabled: option.disabled }))}
@@ -564,9 +573,6 @@ export function QueryBar({ width, search, filters = [], view, meta, asOf: given,
564
573
  </Box>
565
574
  ) : null;
566
575
  const viewAtEnd = !!view && !view.start;
567
- // Short of room, inline filters give up their segments for a menu, so the as-of and the controls after them stay.
568
- // Only a bar with an as-of: elsewhere the row keeps its segments, as it always has.
569
- const collapseInline = !!asOf && filters.some(collapsibleInline) && terminalRowCells(width, { search, filters, view, asOf }) > width;
570
576
  return (
571
577
  <Box height={1} width={width} flexDirection="row" gap={2} paddingX={1} overflow="hidden" flexShrink={0}>
572
578
  {view?.start ? viewStrip : null}
@@ -626,9 +632,9 @@ export function QueryBar({ width, search, filters = [], view, meta, asOf: given,
626
632
  {narrowingCount >= 2 && (
627
633
  <Box onMouseDown={resetAll} cursor="pointer"><Text fg={colors.textDim}>clear</Text></Box>
628
634
  )}
629
- {(viewAtEnd || meta || asOf) && <Box flexGrow={1} />}
635
+ {(viewAtEnd || meta || showAsOf) && <Box flexGrow={1} />}
630
636
  {/* The as-of keeps its width; the context after it gives way before the controls when the row runs short. */}
631
- {asOf ? <Box flexShrink={0}><Text fg={colors.textMuted} wrapMode="none">{asOf}</Text></Box> : null}
637
+ {showAsOf ? <Box flexShrink={0}><Text fg={colors.textMuted} wrapMode="none">{asOf}</Text></Box> : null}
632
638
  {meta && (
633
639
  <Box flexShrink={1} minWidth={0} height={1} overflow="hidden">
634
640
  <Text fg={colors.textMuted} wrapMode="none" truncate flexShrink={1} minWidth={0}>{meta}</Text>
@@ -1,6 +1,6 @@
1
1
  import type { QuoteIntradayBar } from "../types/financials";
2
2
  import { nextResponseSequence } from "./response-sequence";
3
- import { markSavedCopy, savedCopyAt, servedFromSavedCopy } from "./saved-copies";
3
+ import { markSavedCopy, noteServedCopy, savedCopyAt, servedFromSavedCopy, stampRetrievedAt } from "./saved-copies";
4
4
 
5
5
  /** A value's age belongs to its source, not to the consumer that last read it. */
6
6
  export interface CachedValue<T> {
@@ -66,6 +66,13 @@ export class CachedQuery<T> implements CachedQueryHandle<T> {
66
66
  acceptCached?: (value: T) => boolean;
67
67
  /** Optional source-age/identity limit that also applies to stale fallback. */
68
68
  acceptResult?: (result: CachedValue<T>) => boolean;
69
+ /**
70
+ * The value is a dataset dated by when it was read (a holder or filing
71
+ * list), not by an observation time of its own: a copy served without
72
+ * asking the source is stamped with when it was read, and a command notes
73
+ * it (data/saved-copies.ts `RETRIEVED_AT`).
74
+ */
75
+ datedByRetrieval?: boolean;
69
76
  }) {
70
77
  const result = options.read(true);
71
78
  this.fallbackOnly = result !== null && (result.fallbackOnly === true || result.expiresAt <= Date.now());
@@ -77,6 +84,15 @@ export class CachedQuery<T> implements CachedQueryHandle<T> {
77
84
  return this.state;
78
85
  };
79
86
 
87
+ /** A copy answered without a fetch in this load: dated by when it was read, where the query is (`datedByRetrieval`). */
88
+ private servedCopy(result: CachedValue<T>, refreshFailed: boolean): CachedValue<T> {
89
+ if (!this.options.datedByRetrieval) return result;
90
+ noteServedCopy(result.fetchedAt, refreshFailed);
91
+ if (refreshFailed) return result;
92
+ const value = stampRetrievedAt(result.value, result.fetchedAt);
93
+ return value === result.value ? result : { ...result, value };
94
+ }
95
+
80
96
  private usable(result: CachedValue<T> | null): CachedValue<T> | null {
81
97
  return result && (this.options.acceptResult?.(result) ?? true) ? result : null;
82
98
  }
@@ -111,7 +127,7 @@ export class CachedQuery<T> implements CachedQueryHandle<T> {
111
127
  const previous = this.usable(this.state.result);
112
128
  const cached = (this.fallbackOnly ? null : previous) ?? this.usable(this.options.read(false));
113
129
  const acceptable = cached && (this.options.acceptCached?.(cached.value) ?? true);
114
- if (!force && acceptable && Math.min(cached.staleAt, cached.expiresAt) > Date.now()) return Promise.resolve(cached);
130
+ if (!force && acceptable && Math.min(cached.staleAt, cached.expiresAt) > Date.now()) return Promise.resolve(this.servedCopy(cached, false));
115
131
  if (!this.active || replace) {
116
132
  if (!fetch) return Promise.reject(new Error("A cache miss requires a loader"));
117
133
  const generation = ++this.generation;
@@ -131,7 +147,7 @@ export class CachedQuery<T> implements CachedQueryHandle<T> {
131
147
  this.fallbackOnly = cached === null && retained !== null;
132
148
  this.publish({ result: retained, loading: false, error });
133
149
  }
134
- if (retained) return retained;
150
+ if (retained) return this.servedCopy(retained, true);
135
151
  throw error;
136
152
  }).finally(() => {
137
153
  if (this.active === request) this.active = null;
@@ -140,7 +156,7 @@ export class CachedQuery<T> implements CachedQueryHandle<T> {
140
156
  }
141
157
  if (!force && acceptable && cached.expiresAt > Date.now() && background) {
142
158
  void this.active.catch(() => { /* Intentional ignore: The request rejection already publishes CachedQuery.error to subscribers. */ });
143
- return Promise.resolve(cached);
159
+ return Promise.resolve(this.servedCopy(cached, false));
144
160
  }
145
161
  return this.active;
146
162
  }
@@ -5,6 +5,7 @@ import type { PaneInstanceConfig, SavedLayout } from "../types/config";
5
5
  import { isRecord } from "../utils/guards";
6
6
  import { logFailure } from "../utils/log-failure";
7
7
  import { packJson, unpackJson } from "./packed-json";
8
+ import { stampRetrievedAt } from "./saved-copies";
8
9
 
9
10
  const PUBLIC_LEGACY_SCOPE = "legacy-public";
10
11
  const MAX_ARTICLES = 200;
@@ -44,7 +45,7 @@ export function readNewsPaneSnapshot<T>(store: AppResourceStorePort, target: Sna
44
45
  const record = (scope == null ? null : store.get<string>({ ...resource, sourceKey: scope })) ?? store.get<string>(resource);
45
46
  if (!record) return null;
46
47
  const [key, articles] = JSON.parse(unpackJson(record.value));
47
- return key === target.key && Array.isArray(articles) ? articles : null;
48
+ return key === target.key && Array.isArray(articles) ? stampRetrievedAt(articles, record.fetchedAt) : null;
48
49
  } catch (error) {
49
50
  logFailure("data.news-pane-snapshots", "Reading saved headlines failed")(error);
50
51
  return null;
@@ -3,6 +3,7 @@ import type { CachePolicy } from "../types/persistence";
3
3
  import type { PluginPersistence } from "../types/plugin";
4
4
  import { CachedQuery, type CachedValue } from "./cached-query";
5
5
  import { isTransientFailure } from "../api-client/errors";
6
+ import { markSavedCopy, stampRetrievedAt } from "./saved-copies";
6
7
 
7
8
  export interface PluginCacheResult<T> {
8
9
  data: T;
@@ -134,11 +135,14 @@ export function createPluginCache<T, Stored = T>(options: {
134
135
  // A retained copy carries its refresh failure, whatever was thrown (an Error without a message included).
135
136
  const failed = "refreshError" in result;
136
137
  const error = result.refreshError;
137
- return {
138
+ const answer: PluginCacheResult<T> = {
138
139
  data: result.value, fetchedAt: result.fetchedAt, stale: failed || result.staleAt <= Date.now(),
139
140
  source: failed ? "stale-fallback" : result === before ? "cache" : "network",
140
141
  ...(failed ? { error, refreshError: error instanceof Error ? error.message : String(error) } : {}),
141
142
  };
143
+ return failed && isTransientFailure(error)
144
+ ? markSavedCopy(answer, answer.fetchedAt, true)
145
+ : stampRetrievedAt(answer, answer.fetchedAt);
142
146
  },
143
147
  };
144
148
  }