@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
@@ -22,10 +22,12 @@ import { isLiveResizing, onLiveResizeEnd, onLiveResizeStart } from "../../../ui/
22
22
  * A box that has a size of its own on the way (a fixed width, a share of the
23
23
  * pane, a whole-cell rounding) leaves the surface on its cells on that axis,
24
24
  * as it was, and to `useLiveStretch`'s prediction during a resize. So does a
25
- * box that scrolls content larger than itself (a column of charts and text),
26
- * and a sized box whose data table would be resized with it (the chart-table
27
- * kit's band over its table): following the frame through either would lay
28
- * all of that content out on every frame, a table's rows up to 4 ms a frame.
25
+ * box that scrolls content larger than itself (a column of charts and text):
26
+ * following the frame through it would lay all of that content out on every
27
+ * frame. So does a sized box whose data table would be resized with it (the
28
+ * chart-table kit's band over its table): a table keeps the cells its pane
29
+ * gives it at rest, and follows the frame on its own during a resize
30
+ * (`trackTable`).
29
31
  *
30
32
  * Nothing here changes a box's size at the moment it is marked: an exact box
31
33
  * is already the size CSS gives it, and a filled box only gains the fraction
@@ -43,6 +45,10 @@ const surfaces = new Map<HTMLElement, ResizeObserver | null>();
43
45
  /** The boxes above each surface that fill at rest along with it. */
44
46
  const boxFills = new Map<HTMLElement, Array<[HTMLElement, Axis, Mode]>>();
45
47
  const followed = new WeakMap<HTMLElement, { x: boolean; y: boolean }>();
48
+ /** Tracked data tables, each with what it is told when a resize starts and stops laying it out (`trackTable`). */
49
+ const tables = new Map<HTMLElement, (follows: boolean) => void>();
50
+ /** The tables the resize under way lays out on every frame. */
51
+ let followingTables: Array<(follows: boolean) => void> = [];
46
52
  let followMarks: Array<[HTMLElement, Axis]> = [];
47
53
  let installed = false;
48
54
 
@@ -55,6 +61,9 @@ const cellOn = (axis: Axis) => (axis === "x" ? WEB_CELL_WIDTH : WEB_CELL_HEIGHT)
55
61
  const SIZE = { x: "width", y: "height" } as const;
56
62
  const FILL_ATTRIBUTE = { x: "data-gloom-fill-x", y: "data-gloom-fill-y" } as const;
57
63
  const FOLLOW_ATTRIBUTE = { x: "data-gloom-follow-x", y: "data-gloom-follow-y" } as const;
64
+ /** A box above a table that follows short of its space, by what it was at rest (styles.css). */
65
+ const FOLLOW_SHORT = "data-gloom-follow-short-x";
66
+ const FOLLOW_SHORT_BY = "--gloom-follow-short-x";
58
67
 
59
68
  interface Pass {
60
69
  styles: Map<Element, CSSStyleDeclaration>;
@@ -341,7 +350,7 @@ function fitGrip(surface: HTMLElement): void {
341
350
 
342
351
  function startFollowing(): void {
343
352
  const pass: Pass = { styles: new Map() };
344
- const marks: Array<[HTMLElement, Axis, Mode]> = [];
353
+ const marks: Array<[HTMLElement, Axis, Mode, number]> = [];
345
354
  // A resize changes the parents' boxes on every frame; nothing refits until it ends.
346
355
  for (const observer of surfaces.values()) observer?.disconnect();
347
356
  for (const surface of surfaces.keys()) {
@@ -353,21 +362,46 @@ function startFollowing(): void {
353
362
  if (!trace(pass, surface.parentElement, axis, links).follows) continue;
354
363
  result[axis] = true;
355
364
  // A short box fills, and so follows, already.
356
- for (const [element, mode, kind] of links) if (kind === "exact") marks.push([element, axis, mode]);
365
+ for (const [element, mode, kind] of links) if (kind === "exact") marks.push([element, axis, mode, 0]);
357
366
  }
358
367
  followed.set(surface, result);
359
368
  }
369
+ // A table is never filled at rest, so a short box above it follows short
370
+ // by the fraction of a cell it is at rest: the press moves no column.
371
+ for (const [table, listener] of tables) {
372
+ if (!table.isConnected) continue;
373
+ const links: Link[] = [];
374
+ if (!trace(pass, table, "x", links).follows) continue;
375
+ for (const [element, mode, kind] of links) {
376
+ marks.push([element, "x", mode, kind === "short" ? placement(pass, element, "x").space - (ownSize(element, "x") ?? 0) : 0]);
377
+ }
378
+ followingTables.push(listener);
379
+ }
360
380
  // Marked after every surface is traced: a mark changes no size now, but the
361
381
  // trace reads the layout as the pane drew it.
362
- for (const [element, axis, mode] of marks) {
382
+ for (const [element, axis, mode, short] of marks) {
363
383
  element.setAttribute(FOLLOW_ATTRIBUTE[axis], mode);
384
+ if (Math.abs(short) > EXACT_PX) {
385
+ element.setAttribute(FOLLOW_SHORT, "");
386
+ element.style.setProperty(FOLLOW_SHORT_BY, `${short}px`);
387
+ }
364
388
  followMarks.push([element, axis]);
365
389
  }
390
+ for (const listener of followingTables) listener(true);
366
391
  }
367
392
 
368
393
  function stopFollowing(): void {
369
- for (const [element, axis] of followMarks) element.removeAttribute(FOLLOW_ATTRIBUTE[axis]);
394
+ for (const [element, axis] of followMarks) {
395
+ element.removeAttribute(FOLLOW_ATTRIBUTE[axis]);
396
+ if (element.hasAttribute(FOLLOW_SHORT)) {
397
+ element.removeAttribute(FOLLOW_SHORT);
398
+ element.style.removeProperty(FOLLOW_SHORT_BY);
399
+ }
400
+ }
370
401
  followMarks = [];
402
+ const stopped = followingTables;
403
+ followingTables = [];
404
+ for (const listener of stopped) listener(false);
371
405
  for (const surface of surfaces.keys()) followed.delete(surface);
372
406
  // After the release has laid the panes out: every surface fits its box again.
373
407
  const refit = () => {
@@ -380,16 +414,33 @@ function stopFollowing(): void {
380
414
  else setTimeout(refit, 0);
381
415
  }
382
416
 
417
+ function install(): void {
418
+ if (installed) return;
419
+ installed = true;
420
+ onLiveResizeStart(startFollowing);
421
+ onLiveResizeEnd(stopFollowing);
422
+ }
423
+
424
+ /**
425
+ * Tracks a data table's root: during every resize, the boxes above it follow
426
+ * the frame on x by CSS wherever they can (as a chart's do), so its columns
427
+ * are laid out at the frame's width on every frame rather than at each
428
+ * catch-up. At rest nothing changes: its boxes keep the cells the pane gave
429
+ * them. `listener` hears when a resize starts laying the table out so
430
+ * (true) and when it stops (false). Returns the untrack.
431
+ */
432
+ export function trackTable(table: HTMLElement, listener: (follows: boolean) => void): () => void {
433
+ install();
434
+ tables.set(table, listener);
435
+ return () => { tables.delete(table); };
436
+ }
437
+
383
438
  /**
384
439
  * Tracks a surface root: fits it now, again whenever its parent's box changes
385
440
  * size at rest, and takes it into every resize's pass. Returns the untrack.
386
441
  */
387
442
  export function trackSurface(surface: HTMLElement): () => void {
388
- if (!installed) {
389
- installed = true;
390
- onLiveResizeStart(startFollowing);
391
- onLiveResizeEnd(stopFollowing);
392
- }
443
+ install();
393
444
  const parent = surface.parentElement;
394
445
  const observer = typeof ResizeObserver !== "undefined" && parent
395
446
  ? new ResizeObserver(() => fitSurface(surface))
@@ -319,7 +319,7 @@ button, [data-gloom-interactive="true"] { cursor: pointer; }
319
319
  [data-gloom-role="status-bar"] span {
320
320
  line-height: var(--cell-h);
321
321
  }
322
- /* The returning-user strip and the new Pro payer's row under the header: one row of shell chrome each, ruled off from the layout. */
322
+ /* The returning-user strip and the new-to-Pro row under the header: one row of shell chrome each, ruled off from the layout. */
323
323
  [data-gloom-role="since-last-visit"],
324
324
  [data-gloom-role="pro-welcome"] {
325
325
  flex: none;
@@ -355,6 +355,11 @@ button, [data-gloom-interactive="true"] { cursor: pointer; }
355
355
  width: auto !important;
356
356
  min-width: 0 !important;
357
357
  }
358
+ /* A box above a table that sat a fraction of a cell short of its space keeps
359
+ that gap while it follows, so the press moves nothing. */
360
+ [data-gloom-follow-short-x] {
361
+ margin-right: var(--gloom-follow-short-x) !important;
362
+ }
358
363
  [data-gloom-fill-y="stretch"], [data-gloom-follow-y="stretch"] {
359
364
  height: auto !important;
360
365
  align-self: stretch !important;
@@ -10,8 +10,9 @@ import { bundleExternalPlugin, pluginBundleCacheDir } from "../../../plugins/bun
10
10
  import {
11
11
  getPluginCacheDir,
12
12
  getPluginsDir,
13
- listPluginDirectories,
14
13
  loadExternalPlugin,
14
+ loadExternalPlugins,
15
+ type LoadedExternalPlugin,
15
16
  } from "../../../plugins/loader";
16
17
  import { createNodePluginManager } from "../../../plugins/manager-node";
17
18
  import { deactivatePluginForRemoval } from "../../../plugins/marketplace/deactivation";
@@ -68,8 +69,14 @@ async function bundlePluginDirectory(
68
69
  // The same load the terminal does, so the metadata, the commit and whether
69
70
  // the plugin runs on the desktop at all are decided in one place.
70
71
  const loaded = await loadExternalPlugin(pluginDir, "desktop", options);
71
- if (!loaded) return null;
72
+ return loaded ? bundleLoadedPlugin(pluginDir, loaded, options) : null;
73
+ }
72
74
 
75
+ async function bundleLoadedPlugin(
76
+ pluginDir: string,
77
+ loaded: LoadedExternalPlugin,
78
+ options: { fresh?: boolean } = {},
79
+ ): Promise<DesktopExternalPluginBundle> {
73
80
  const { plugin } = loaded;
74
81
  const directory = basename(pluginDir);
75
82
  const icon = readPluginIcon(pluginDir);
@@ -83,6 +90,7 @@ async function bundlePluginDirectory(
83
90
  ...(loaded.commit ? { commit: loaded.commit } : {}),
84
91
  ...(loaded.repo ? { repo: loaded.repo } : {}),
85
92
  ...(loaded.linked ? { linked: true } : {}),
93
+ ...(loaded.duplicateOf ? { duplicateOf: loaded.duplicateOf } : {}),
86
94
  ...(icon ? { icon } : {}),
87
95
  ...(plugin.targets ? { targets: plugin.targets } : {}),
88
96
  };
@@ -153,10 +161,12 @@ export async function collectExternalPluginBundles(): Promise<DesktopExternalPlu
153
161
  const bundles: DesktopExternalPluginBundle[] = [];
154
162
 
155
163
  // Links every folder before reading any: a plugin that imports a sibling
156
- // needs the sibling linked too, whichever of them is read first.
157
- for (const pluginDir of await listPluginDirectories(pluginsDir)) {
158
- const bundle = await bundlePluginDirectory(pluginDir);
159
- if (bundle) bundles.push(bundle);
164
+ // needs the sibling linked too, whichever of them is read first. Compiled
165
+ // only once every folder is read, so a plugin id that two folders declare
166
+ // is settled the way the backend's registry settles it, and the copy that
167
+ // is not loaded is not compiled.
168
+ for (const loaded of await loadExternalPlugins("desktop", pluginsDir)) {
169
+ bundles.push(await bundleLoadedPlugin(loaded.path, loaded));
160
170
  }
161
171
 
162
172
  return bundles;
@@ -175,6 +175,8 @@ export interface DesktopExternalPluginBundle {
175
175
  unsupportedTarget?: "desktop";
176
176
  /** The files changed under modules the Bun process already imported; no code is sent. */
177
177
  needsRestart?: boolean;
178
+ /** The folder that loads in this one's place, which declares the same plugin id; `error` says so and no code is sent. */
179
+ duplicateOf?: string;
178
180
  }
179
181
 
180
182
  /**
@@ -48,6 +48,7 @@ import type {
48
48
  QuoteBatchResult,
49
49
  SecFilingDocument,
50
50
  SecFilingItem,
51
+ SecFilingsPage,
51
52
  } from "../../../types/data-provider";
52
53
  import type {
53
54
  AnalystResearchData,
@@ -72,6 +73,7 @@ import { statsCache } from "../../../plugins/builtin/econ-statistics/cache";
72
73
  import { apiClient, setCloudApiFetchTransport } from "../../../api-client";
73
74
  import { createGloomberbCloudCapabilities, createGloomberbCloudProvider } from "../../../sources/gloomberb-cloud";
74
75
  import { logFailure } from "../../../utils/log-failure";
76
+ import { markSavedCopy, stampRetrievedAt } from "../../../data/saved-copies";
75
77
 
76
78
  declare global {
77
79
  interface Window {
@@ -227,6 +229,24 @@ async function restoreShotCloudSession(): Promise<void> {
227
229
  * of the corporate action history come from providers the router merges in.
228
230
  */
229
231
  async function requestShotMarketData<T>(operation: string, args: unknown[], signal?: AbortSignal): Promise<T> {
232
+ return (await requestShotMarketReply<T>(operation, args, signal)).data as T;
233
+ }
234
+
235
+ /**
236
+ * A dataset read through the bridge (holders, filings, analyst research,
237
+ * corporate actions), marked as the Bun side served it: a copy saved earlier
238
+ * that a failed refresh fell back to, or one read earlier and served again,
239
+ * with the time it was saved or read. JSON keeps no marks, so the reply
240
+ * carries the times; `revive` restores what else JSON loses first.
241
+ */
242
+ async function requestShotDataset<T extends object>(operation: string, args: unknown[], revive: (value: T) => T = (value) => value): Promise<T> {
243
+ const reply = await requestShotMarketReply<T>(operation, args);
244
+ const data = revive(reply.data as T);
245
+ if (typeof reply.savedAt === "number") return markSavedCopy(data, reply.savedAt);
246
+ return typeof reply.retrievedAt === "number" ? stampRetrievedAt(data, reply.retrievedAt) : data;
247
+ }
248
+
249
+ async function requestShotMarketReply<T>(operation: string, args: unknown[], signal?: AbortSignal): Promise<{ data?: T; savedAt?: number; retrievedAt?: number }> {
230
250
  const viaFetch = () => window.fetch(shotRouteUrl(SHOT_MARKET_BRIDGE_PATH, SHOT_PAGE_URL), {
231
251
  method: "POST",
232
252
  headers: { "Content-Type": "application/json" },
@@ -239,9 +259,9 @@ async function requestShotMarketData<T>(operation: string, args: unknown[], sign
239
259
  const send = await shotSocket();
240
260
  return await send?.({ market: { operation, args } }, signal) ?? await viaFetch();
241
261
  })());
242
- const result = await response.json() as { ok: boolean; data?: T; error?: string };
262
+ const result = await response.json() as { ok: boolean; data?: T; error?: string; savedAt?: number; retrievedAt?: number };
243
263
  if (!result.ok) throw new Error(result.error ?? `Screenshot data request failed: ${operation}`);
244
- return result.data as T;
264
+ return result;
245
265
  }
246
266
 
247
267
  /** JSON has no Date, so every bridged date arrives as a string. */
@@ -368,10 +388,12 @@ function createShotDataProvider(payload: DesktopPaneShotPayload): DataProvider {
368
388
  }));
369
389
  },
370
390
  getArticleSummary: async () => null,
371
- getAnalystResearch: (symbol, exchange) => requestShotMarketData<AnalystResearchData>("getAnalystResearch", [symbol, exchange]),
372
- getCorporateActions: (symbol, exchange) => requestShotMarketData<CorporateActionsData>("getCorporateActions", [symbol, exchange]),
373
- getHolders: (symbol, exchange) => requestShotMarketData<HolderData>("getHolders", [symbol, exchange]),
374
- getSecFilings: (symbol, count, exchange) => requestShotMarketData<SecFilingItem[]>("getSecFilings", [symbol, count, exchange]).then(reviveSecFilings),
391
+ getAnalystResearch: (symbol, exchange) => requestShotDataset<AnalystResearchData>("getAnalystResearch", [symbol, exchange]),
392
+ getCorporateActions: (symbol, exchange) => requestShotDataset<CorporateActionsData>("getCorporateActions", [symbol, exchange]),
393
+ getHolders: (symbol, exchange) => requestShotDataset<HolderData>("getHolders", [symbol, exchange]),
394
+ getSecFilings: (symbol, count, exchange) => requestShotDataset<SecFilingItem[]>("getSecFilings", [symbol, count, exchange], reviveSecFilings),
395
+ getSecFilingsPage: (symbol, query, exchange) => requestShotDataset<SecFilingsPage>("getSecFilingsPage", [symbol, query, exchange],
396
+ (page) => ({ ...page, filings: reviveSecFilings(page.filings) })),
375
397
  // The page holds no session credential, so verified cloud reads such as
376
398
  // Form 4 content would fail as signed out if the page made them itself.
377
399
  getSecFilingDocuments: (filing) => requestShotMarketData<SecFilingDocument[]>("getSecFilingDocuments", [filing]),
@@ -419,11 +441,13 @@ function createShotDataProvider(payload: DesktopPaneShotPayload): DataProvider {
419
441
 
420
442
  function createShotAppServices(payload: DesktopPaneShotPayload, externalPlugins: LoadedExternalPlugin[]) {
421
443
  const dataProvider = createShotDataProvider(payload);
444
+ const persistence = new JsonPersistence();
445
+ for (const { pluginId, key, value } of payload.deviceState ?? []) persistence.pluginState.set(pluginId, key, value);
422
446
  return createAppRuntime({
423
447
  config: payload.config,
424
448
  plugins: getLoadablePlugins(externalPlugins),
425
449
  dataProvider,
426
- persistence: new JsonPersistence(),
450
+ persistence,
427
451
  tickerRepository: new JsonTickerRepository(undefined, payload.tickers),
428
452
  registryOptions: {
429
453
  enableCapabilityHandlers: false,
@@ -17,11 +17,12 @@ declare global {
17
17
  * Set by a capture that carries a status line: shows the first of the
18
18
  * variants (longest first) that fits the footer, cut in the middle when
19
19
  * none does, and resolves to the text shown. `dates` says what the line
20
- * dates, so the pane's own text that says the same goes. With no variants
21
- * the pane has nothing to date: the footer row is given back to the body
22
- * and the text shown is empty.
20
+ * dates, so the pane's own text that says the same goes. `ownStatus`: the
21
+ * view dates its data in its own footer (a DES research tab), which stays
22
+ * whole beside the line. With no variants the pane has nothing to date:
23
+ * the footer row is given back to the body and the text shown is empty.
23
24
  */
24
- __GLOOM_CLI_SHOT_FIT_STATUS__?: (variants: string[], options?: { dates?: ShotLineDates }) => Promise<string>;
25
+ __GLOOM_CLI_SHOT_FIT_STATUS__?: (variants: string[], options?: { dates?: ShotLineDates; ownStatus?: boolean }) => Promise<string>;
25
26
  }
26
27
  }
27
28
 
@@ -126,17 +127,21 @@ interface ShotStatusLineState {
126
127
  dates: ShotLineDates;
127
128
  /** No variant fit beside the pane's own `as of`, so it gave way. */
128
129
  crowded: boolean;
130
+ /** The view dates its data in its own footer, which the capture keeps. */
131
+ ownStatus: boolean;
129
132
  }
130
133
 
131
134
  function useShotStatusLine(enabled: boolean, hasAsOf: () => boolean): ShotStatusLineState {
132
135
  const [text, setText] = useState<string | null>(PENDING_STATUS);
133
136
  const [dates, setDates] = useState<ShotLineDates>(null);
134
137
  const [crowded, setCrowded] = useState(false);
138
+ const [ownStatus, setOwnStatus] = useState(false);
135
139
  useEffect(() => {
136
140
  if (!enabled) return;
137
141
  // What the line says goes before it is fitted, so the line gets its room.
138
142
  window.__GLOOM_CLI_SHOT_FIT_STATUS__ = async (variants, options) => {
139
143
  setDates(options?.dates ?? null);
144
+ setOwnStatus(options?.ownStatus === true);
140
145
  setCrowded(false);
141
146
  if (variants.length === 0) {
142
147
  setText(null);
@@ -158,7 +163,7 @@ function useShotStatusLine(enabled: boolean, hasAsOf: () => boolean): ShotStatus
158
163
  delete window.__GLOOM_CLI_SHOT_FIT_STATUS__;
159
164
  };
160
165
  }, [enabled, hasAsOf]);
161
- return { text, dates, crowded };
166
+ return { text, dates, crowded, ownStatus };
162
167
  }
163
168
 
164
169
  /**
@@ -170,7 +175,9 @@ function useShotStatusLine(enabled: boolean, hasAsOf: () => boolean): ShotStatus
170
175
  * pane's own text that says the same goes, so the date is said once: its `as
171
176
  * of` (a footer segment or a query bar's) when the line dates the pane's data,
172
177
  * and its quote date and delay when the line states them. A pane's `as of`
173
- * also gives way before the line would be cut.
178
+ * also gives way before the line would be cut. A view that dates its data in
179
+ * its own footer (the line's `ownStatus`) keeps that footer's status, as
180
+ * `preserveStatus` does for a whole pane.
174
181
  */
175
182
  export function PaneShotFrame({ paneId, title, width, height, preserveStatus = false, statusLine = false, children }: {
176
183
  paneId: string;
@@ -183,7 +190,7 @@ export function PaneShotFrame({ paneId, title, width, height, preserveStatus = f
183
190
  }) {
184
191
  const shownAsOf = useRef(false);
185
192
  const hasAsOf = useCallback(() => shownAsOf.current, []);
186
- const { text: statusText, dates, crowded } = useShotStatusLine(statusLine, hasAsOf);
193
+ const { text: statusText, dates, crowded, ownStatus } = useShotStatusLine(statusLine, hasAsOf);
187
194
  const datesData = statusLine && dates === "data";
188
195
  const palette = useThemeColors();
189
196
  const [noteHeight, setNoteHeight] = useState(0);
@@ -201,7 +208,7 @@ export function PaneShotFrame({ paneId, title, width, height, preserveStatus = f
201
208
  const status: PaneFooterSegment[] = statusLine && statusText !== null ? [{ id: "shot-status", parts: [{ text: statusText, tone: "label" }] }] : [];
202
209
  const warnings = registeredFooter.info.filter((segment) => segment.icon === "warning" && segment.notes?.length !== 0);
203
210
  const info = registeredFooter.info.filter((segment) => segment.icon !== "warning"
204
- && (preserveStatus || segment.capture)
211
+ && (preserveStatus || ownStatus || segment.capture)
205
212
  && !(datesPaneData(segment) && (datesData || crowded))
206
213
  && !(segment.quoteStatus && statusLine && dates !== null));
207
214
  shownAsOf.current = info.some(datesPaneData);
@@ -28,6 +28,7 @@ export async function loadDesktopExternalPlugin(bundle: DesktopExternalPluginBun
28
28
  ...(bundle.commit ? { commit: bundle.commit } : {}),
29
29
  ...(bundle.repo ? { repo: bundle.repo } : {}),
30
30
  ...(bundle.linked ? { linked: true } : {}),
31
+ ...(bundle.duplicateOf ? { duplicateOf: bundle.duplicateOf } : {}),
31
32
  ...(bundle.icon ? { icon: bundle.icon } : {}),
32
33
  };
33
34
  const fallback = {
@@ -45,6 +45,7 @@ const assetDataPayloads: Record<string, PayloadBuilder> = {
45
45
  getExchangeRate: (fromCurrency) => ({ fromCurrency }),
46
46
  search: (query, context) => ({ query, context }),
47
47
  getSecFilings: (ticker, count, exchange, context) => ({ ticker, count, exchange, context }),
48
+ getSecFilingsPage: (ticker, query, exchange, context) => ({ ticker, query, exchange, context }),
48
49
  getHolders: (ticker, exchange, context) => ({ ticker, exchange, context }),
49
50
  getAnalystResearch: (ticker, exchange, context) => ({ ticker, exchange, context }),
50
51
  getCorporateActions: (ticker, exchange, context) => ({ ticker, exchange, context }),
@@ -96,6 +96,7 @@ export interface SeriesAttribution {
96
96
  publisher?: string;
97
97
  /** When its newest observation was published, an ISO instant, when the source says. */
98
98
  publishedAt?: string;
99
+ fredUpdatedAt?: string;
99
100
  }
100
101
 
101
102
  export interface SeriesLoadResult {
@@ -3,12 +3,12 @@ import { seriesNotOnFred, type FredSeriesData } from "./fred-series";
3
3
 
4
4
  /**
5
5
  * When FRED last updated a series, its `last_updated` (`2026-10-09 08:08:04-05`),
6
- * as an ISO instant in UTC: the publication time an export cites. Only when
6
+ * as an ISO instant in UTC, distinct from the publisher's release. Only when
7
7
  * that update covers the newest observation shown (`observationEnd` reaches
8
- * it): metadata from before it says nothing about when it was published.
8
+ * it): metadata from before it does not date the observation shown.
9
9
  * Null when it does not, or when FRED's metadata does not say.
10
10
  */
11
- export function fredPublicationTime(
11
+ export function fredUpdateTime(
12
12
  info: { lastUpdated?: string | null; observationEnd?: string | null } | null | undefined,
13
13
  newestDate: string | null | undefined,
14
14
  ): string | null {
@@ -23,6 +23,7 @@ export interface FredProvenance {
23
23
  source: string;
24
24
  publisher?: string;
25
25
  publishedAt?: string;
26
+ fredUpdatedAt?: string;
26
27
  }
27
28
 
28
29
  /**
@@ -78,10 +79,10 @@ export function fredSeriesAttribution(
78
79
  const ahead = fredProvenance(data.observations.filter((observation) => observation.date === newestDate), seriesId);
79
80
  if (ahead) return ahead;
80
81
  const publisher = data.info?.source?.trim();
81
- const publishedAt = fredPublicationTime(data.info, newestDate);
82
+ const fredUpdatedAt = fredUpdateTime(data.info, newestDate);
82
83
  return {
83
84
  source: notOnFredSource(seriesId) ?? "FRED",
84
85
  ...(publisher ? { publisher } : {}),
85
- ...(publishedAt ? { publishedAt } : {}),
86
+ ...(fredUpdatedAt ? { fredUpdatedAt } : {}),
86
87
  };
87
88
  }
@@ -19,6 +19,8 @@ import type {
19
19
  EarningsEvent,
20
20
  SecFilingDocument,
21
21
  SecFilingItem,
22
+ SecFilingsPage,
23
+ SecFilingsPageQuery,
22
24
  SecForm4Trade,
23
25
  BatchedReadMethod,
24
26
  MarketDataRequestContext,
@@ -42,7 +44,9 @@ import {
42
44
  type CloudHoldersPayload,
43
45
  type CloudMarketResponse,
44
46
  type CloudPricePointPayload,
47
+ type CloudSecFilingsResponse,
45
48
  } from "../../api-client";
49
+ import type { CloudSecFilingsParams } from "../../api-client/paths";
46
50
  import type { NewsArticle, NewsQuery } from "../../types/news-source";
47
51
  import { normalizeNewsFeed } from "../../news/news-model";
48
52
  import { resolveCurrencyUnit } from "../../utils/currency-units";
@@ -170,6 +174,13 @@ function mapCloudSecFiling(item: {
170
174
  };
171
175
  }
172
176
 
177
+ /** Each form's newest filing day as the service sent it, or null when it sent none (an older server). */
178
+ function readNewestByForm(value: unknown): Record<string, string> | null {
179
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
180
+ return Object.fromEntries(Object.entries(value as Record<string, unknown>)
181
+ .filter((entry): entry is [string, string] => !!entry[0].trim() && typeof entry[1] === "string" && /^\d{4}-\d{2}-\d{2}$/.test(entry[1])));
182
+ }
183
+
173
184
  /** A Form 4's trade as the service summarized it, or null when it sent none or an unreadable one. */
174
185
  function readForm4Trade(value: unknown): SecForm4Trade | null {
175
186
  if (!value || typeof value !== "object") return null;
@@ -763,23 +774,49 @@ export class GloomberbCloudProvider implements AssetDataProvider {
763
774
  }
764
775
 
765
776
  async getSecFilings(ticker: string, count = 15, exchange?: string, context?: MarketDataRequestContext): Promise<SecFilingItem[]> {
777
+ return (await this.readSecFilings(ticker, exchange, context, { limit: count, offset: 0 })).filings;
778
+ }
779
+
780
+ async getSecFilingsPage(ticker: string, query: SecFilingsPageQuery, exchange?: string, context?: MarketDataRequestContext): Promise<SecFilingsPage> {
781
+ const { filings, response } = await this.readSecFilings(ticker, exchange, context, {
782
+ forms: query.forms, limit: query.limit, offset: query.offset ?? 0, newestByForm: true,
783
+ });
784
+ const newestByForm = readNewestByForm(response.newestByForm);
785
+ return {
786
+ filings,
787
+ hasMore: response.hasMore === true,
788
+ nextOffset: typeof response.nextOffset === "number" ? response.nextOffset : (query.offset ?? 0) + response.filings.length,
789
+ ...(newestByForm ? { newestByForm } : {}),
790
+ };
791
+ }
792
+
793
+ /** A listing's filings as the service lists them, checked to be its company's when it trades abroad. */
794
+ private async readSecFilings(
795
+ ticker: string,
796
+ exchange: string | undefined,
797
+ context: MarketDataRequestContext | undefined,
798
+ page: Pick<CloudSecFilingsParams, "forms" | "limit" | "offset" | "newestByForm">,
799
+ ): Promise<{ filings: SecFilingItem[]; response: CloudSecFilingsResponse }> {
766
800
  rejectPerpetual(ticker, exchange, "SEC filings");
767
801
  rejectPredictionMarket(ticker, exchange);
768
802
  const venue = nonUsSecListingVenue(ticker, exchange);
769
803
  const name = venue ? context?.listingName?.trim() || await this.listingName(ticker, venue) || undefined : undefined;
770
- const filings = await withCloudFallback(async () => {
771
- const response = await apiClient.getCloudSecFilings({ ticker, exchange, name, limit: count, offset: 0 });
804
+ const { filings, response } = await withCloudFallback(async () => {
805
+ const response = await apiClient.getCloudSecFilings({ ticker, exchange, name, ...page });
772
806
  // A foreign line's filings read from its company's home line say whose, each of them.
773
807
  const companyFrom = readCompanyFrom(response.companyFrom);
774
- return response.filings.map((filing) => companyFrom ? { ...mapCloudSecFiling(filing), companyFrom } : mapCloudSecFiling(filing));
808
+ return {
809
+ response,
810
+ filings: response.filings.map((filing) => companyFrom ? { ...mapCloudSecFiling(filing), companyFrom } : mapCloudSecFiling(filing)),
811
+ };
775
812
  }, `Cloud SEC filings are unavailable for ${ticker}`);
776
813
  // The service matched a line read from its company's home line to the company itself.
777
- if (!venue || filings.length === 0 || filings[0]!.companyFrom) return filings;
814
+ if (!venue || filings.length === 0 || filings[0]!.companyFrom) return { filings, response };
778
815
  const symbol = parsePublicTickerKey(ticker).symbol;
779
816
  // Without the listing's company the filings cannot be told apart from another company's.
780
817
  if (!name) throw createProviderMiss(`SEC filings for ${symbol} could not be matched to its ${venue} listing`);
781
818
  assertSecRegistrantMatches(filings, { symbol, exchange: venue, name });
782
- return filings;
819
+ return { filings, response };
783
820
  }
784
821
 
785
822
  /** The company a listing belongs to, from its own quote; null when the quote prices another venue. */
@@ -2,7 +2,7 @@ import { normalizeNewsFeed } from "../../news/news-model";
2
2
  import { readableNewsSource } from "../../news/source-label";
3
3
  import { collectNewsDisplayTickers } from "../../news/ticker-symbols";
4
4
  import type { NewsAccess, NewsArticle, NewsQuery, NewsStoryItem } from "../../types/news-source";
5
- import type { NewsInsiderFiling } from "../../news/types";
5
+ import type { NewsInsiderFiling, NewsStoryTimes } from "../../news/types";
6
6
  import { CLOUD_NEWS_DELAY_HOURS } from "../../api-client/plan-rules";
7
7
  import type {
8
8
  apiClient,
@@ -124,12 +124,24 @@ function routineNotices(payload: CloudNewsPayload["routine"]): NewsArticle["rout
124
124
  return { kind: payload.kind, notices: payload.notices, since, programme: payload.programme ?? null };
125
125
  }
126
126
 
127
+ /** The story's times as sent, each one that reads as an instant. */
128
+ function storyTimes(item: CloudNewsPayload): NewsStoryTimes {
129
+ const times: NewsStoryTimes = {};
130
+ for (const key of ["firstPublishedAt", "lastPublishedAt", "firstSeenAt", "lastSeenAt"] as const) {
131
+ const value = item[key];
132
+ if (typeof value === "string" && Number.isFinite(Date.parse(value))) times[key] = value;
133
+ }
134
+ return times;
135
+ }
136
+
127
137
  export function mapCloudNewsArticle(
128
138
  item: CloudNewsPayload,
129
139
  fallbackTicker?: string,
130
140
  ): NewsArticle {
141
+ // A story is dated by its first publication: a later report it gathers (a
142
+ // paper's copy hours on) is its latest, never when it broke.
131
143
  const publishedAt = new Date(
132
- item.lastPublishedAt || item.firstPublishedAt || item.lastSeenAt,
144
+ item.firstPublishedAt || item.lastPublishedAt || item.firstSeenAt || item.lastSeenAt,
133
145
  );
134
146
  const topic = item.topic ?? item.category ?? "general";
135
147
  const topics = uniqueStrings([topic, ...normalizeStringArray(item.topics)]);
@@ -153,6 +165,7 @@ export function mapCloudNewsArticle(
153
165
  || primaryItem?.sourceName
154
166
  || readableNewsSource(item.primarySource),
155
167
  publishedAt: Number.isNaN(publishedAt.getTime()) ? new Date(0) : publishedAt,
168
+ times: storyTimes(item),
156
169
  summary: item.summary,
157
170
  topic,
158
171
  topics,
@@ -128,6 +128,7 @@ export function mapQuote(
128
128
  priceVenue: typeof quote.priceVenue === "string" && /^[A-Za-z][A-Za-z0-9 .-]{0,23}$/.test(quote.priceVenue) ? quote.priceVenue : undefined,
129
129
  priceBasis,
130
130
  priceObservation,
131
+ futuresPriceKind: quote.futuresPriceKind === "settlement" || quote.futuresPriceKind === "last-trade" ? quote.futuresPriceKind : undefined,
131
132
  currency: currency || quote.currency,
132
133
  price: normalizePriceValueByDivisor(quote.price, divisor) ?? quote.price,
133
134
  change,
@@ -152,6 +153,9 @@ export function mapQuote(
152
153
  dailyClose: readDailyClose(quote.dailyClose),
153
154
  bid: normalizePriceValueByDivisor(quote.bid, divisor),
154
155
  ask: normalizePriceValueByDivisor(quote.ask, divisor),
156
+ // The book's own stamp, only beside a book: never borrowed from the trade.
157
+ bidAskTime: (quote.bid != null || quote.ask != null) && typeof quote.bidAskTime === "number"
158
+ && Number.isFinite(quote.bidAskTime) && quote.bidAskTime > 0 ? quote.bidAskTime : undefined,
155
159
  open: sessionPrice(quote.open),
156
160
  high: sessionPrice(quote.high),
157
161
  low: sessionPrice(quote.low),
@@ -336,6 +340,11 @@ function mapCloudFundamentals(fundamentals: Fundamentals | undefined): Fundament
336
340
  if (result === value) result = { ...value };
337
341
  delete result[field];
338
342
  }
343
+ // The rate's basis goes with the rate, and only the one basis is read.
344
+ if (result.dividendRateBasis !== undefined && (result.dividendRate === undefined || result.dividendRateBasis !== "uneven-regular-payments")) {
345
+ if (result === value) result = { ...value };
346
+ delete result.dividendRateBasis;
347
+ }
339
348
  return result;
340
349
  }
341
350
 
@@ -7,6 +7,7 @@ import { canonicalHistoryInterval } from "./history-retention";
7
7
  import { historyCoverageNoteText, isHistoryCoverageDate } from "./history-coverage";
8
8
  import { readNonPositiveCloseDates } from "./history-omitted";
9
9
  import { parseListingDelisting } from "../market-data/quotes/delisting";
10
+ import { savedCopyMark } from "../data/saved-copies";
10
11
 
11
12
  export type HistoryResultRequest =
12
13
  | { kind: "range"; range: TimeRange }
@@ -40,7 +41,7 @@ export function normalizeHistoryResult(
40
41
  if (result.session != null && (!session || result.resolution === null)) return null;
41
42
  const nonPositiveCloseDates = readNonPositiveCloseDates(result.nonPositiveCloseDates);
42
43
  const delisting = parseListingDelisting(result.delisting);
43
- return { points: result.points, resolution: result.resolution,
44
+ return { points: result.points, resolution: result.resolution, ...savedCopyMark(result),
44
45
  ...(session ? { session } : {}),
45
46
  ...(nonPositiveCloseDates ? { nonPositiveCloseDates } : {}),
46
47
  ...(typeof result.sourceKey === "string" && /^(provider|broker):[^\r\n\0]+$/.test(result.sourceKey) ? { sourceKey: result.sourceKey } : {}),