@gloom-sh/terminal 0.20.10 → 0.20.12

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 (324) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
  3. package/src/api-client/awards.ts +16 -0
  4. package/src/api-client/central-bank-rates.ts +5 -0
  5. package/src/api-client/data.ts +55 -2
  6. package/src/api-client/index.ts +18 -1
  7. package/src/api-client/request.ts +86 -3
  8. package/src/api-client/socket-connection.ts +366 -0
  9. package/src/api-client/socket-features.ts +75 -0
  10. package/src/api-client/socket-frames.ts +161 -0
  11. package/src/api-client/socket-listeners.ts +207 -0
  12. package/src/api-client/socket-quotes.ts +332 -0
  13. package/src/api-client/socket.ts +168 -983
  14. package/src/api-client/supply-chain-graph.ts +4 -2
  15. package/src/api-client/supply-chain.ts +8 -0
  16. package/src/api-client/types/econ.ts +10 -7
  17. package/src/api-client/types/filings-and-calls.ts +8 -0
  18. package/src/app/global-shortcuts.ts +2 -1
  19. package/src/app/keybindings/actions.ts +19 -0
  20. package/src/app/pane-runtime/index.tsx +18 -3
  21. package/src/app/pane-runtime/layout-placement.ts +63 -0
  22. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  23. package/src/brokers/signed-in/adapter.ts +19 -5
  24. package/src/brokers/signed-in/client.ts +13 -1
  25. package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
  26. package/src/capabilities/chart-series.ts +4 -1
  27. package/src/cli/board-coins.ts +10 -1
  28. package/src/cli/commands/crypto-hints.ts +3 -2
  29. package/src/cli/commands/fred-series.ts +0 -54
  30. package/src/cli/commands/market.ts +209 -31
  31. package/src/cli/commands/overview.ts +47 -14
  32. package/src/cli/commands/search.ts +37 -8
  33. package/src/cli/commands/ticker.ts +15 -4
  34. package/src/cli/desktop-pane-shot.ts +27 -2
  35. package/src/cli/fx-quote-rate.ts +1 -1
  36. package/src/cli/glossary.ts +14 -5
  37. package/src/cli/history-catalog-series.ts +85 -0
  38. package/src/cli/index.ts +1 -1
  39. package/src/cli/list-progress.ts +45 -0
  40. package/src/cli/listing-arg.ts +71 -7
  41. package/src/cli/name-entries.ts +8 -4
  42. package/src/cli/not-a-ticker.ts +2 -2
  43. package/src/cli/pane-functions/freshness.ts +50 -3
  44. package/src/cli/pane-functions/index.ts +7 -4
  45. package/src/cli/pane-functions/market-session.ts +66 -14
  46. package/src/cli/pane-functions/options.ts +5 -0
  47. package/src/cli/pane-functions/resolver.ts +9 -2
  48. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  49. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  50. package/src/cli/quote-answer.ts +49 -10
  51. package/src/cli/quote-list-reads.ts +87 -0
  52. package/src/cli/report-tables.ts +70 -13
  53. package/src/cli/result.ts +24 -2
  54. package/src/cli/symbol-list.ts +31 -4
  55. package/src/cli/terminal-code-hints.ts +83 -0
  56. package/src/cli/ticker-resolution.ts +2 -1
  57. package/src/cli/treasury-yields.ts +5 -0
  58. package/src/components/chart/native/kitty/manager.ts +2 -0
  59. package/src/components/chart/native/surface/manager.ts +211 -11
  60. package/src/components/command-bar/action-runtime.ts +2 -0
  61. package/src/components/command-bar/panel/index.tsx +2 -13
  62. package/src/components/command-bar/panel/layout.ts +1 -7
  63. package/src/components/command-bar/panel/runtime.ts +0 -1
  64. package/src/components/command-bar/panel/types.ts +0 -2
  65. package/src/components/command-bar/routing/launch-request.ts +2 -1
  66. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  67. package/src/components/command-bar/workflow/types.ts +6 -0
  68. package/src/components/data-table/column-menu.tsx +89 -0
  69. package/src/components/data-table/sort-menu.tsx +9 -2
  70. package/src/components/data-table/view.tsx +33 -6
  71. package/src/components/form-modal/content.tsx +10 -0
  72. package/src/components/index.ts +1 -1
  73. package/src/components/layout/detached-pane-shell.tsx +3 -0
  74. package/src/components/layout/double-escape-close.ts +34 -3
  75. package/src/components/layout/floating-pane.tsx +10 -4
  76. package/src/components/layout/pane/cycle-order.ts +66 -2
  77. package/src/components/layout/pane/footer/index.tsx +25 -11
  78. package/src/components/layout/pane/footer/model.ts +62 -20
  79. package/src/components/layout/pane/header.tsx +140 -31
  80. package/src/components/layout/pane/sidebar.tsx +138 -20
  81. package/src/components/layout/pane/status-footer.ts +3 -1
  82. package/src/components/layout/shell/active-drag.ts +18 -13
  83. package/src/components/layout/shell/drag/magnets.ts +34 -18
  84. package/src/components/layout/shell/drag/runtime.ts +5 -0
  85. package/src/components/layout/shell/index.tsx +25 -0
  86. package/src/components/layout/shell/menu.ts +9 -0
  87. package/src/components/layout/shell/pane/actions.ts +36 -0
  88. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  89. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  90. package/src/components/layout/shell/shortcuts.ts +17 -1
  91. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  92. package/src/components/layout/shell/window-mode/index.ts +5 -16
  93. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  94. package/src/components/market-board/index.tsx +14 -5
  95. package/src/components/metric-treemap/index.tsx +3 -1
  96. package/src/components/ticker/list-table-view.tsx +5 -0
  97. package/src/components/ui/button.tsx +48 -4
  98. package/src/components/ui/data-table/column-order.ts +180 -0
  99. package/src/components/ui/data-table/index.tsx +12 -1
  100. package/src/components/ui/data-table/opentui/index.tsx +291 -32
  101. package/src/components/ui/data-table/opentui/model.ts +43 -4
  102. package/src/components/ui/data-table/types.ts +56 -0
  103. package/src/components/ui/data-table/use-column-order.ts +135 -0
  104. package/src/components/ui/index.ts +1 -1
  105. package/src/components/ui/inline-quick-add.tsx +19 -3
  106. package/src/components/ui/list-view.tsx +11 -5
  107. package/src/components/ui/query-bar.tsx +16 -1
  108. package/src/components/ui/selection-fill.ts +39 -0
  109. package/src/components/ui/table-layout.ts +120 -0
  110. package/src/core/state/app/layout-reducer.ts +2 -1
  111. package/src/core/state/app/pane-choices.ts +68 -0
  112. package/src/core/state/app/state.ts +14 -6
  113. package/src/core/state/app/types.ts +8 -0
  114. package/src/docs/snapshot.json +3 -2
  115. package/src/i18n/es.ts +2 -0
  116. package/src/i18n/ja.ts +2 -0
  117. package/src/i18n/ko.ts +2 -0
  118. package/src/i18n/zh-cn.ts +2 -0
  119. package/src/i18n/zh-tw.ts +2 -0
  120. package/src/layout/pane-manager/dock-tree.ts +19 -0
  121. package/src/layout/pane-manager/index.ts +3 -0
  122. package/src/market-data/coordinator/index.ts +4 -3
  123. package/src/market-data/coordinator/quotes.ts +12 -4
  124. package/src/market-data/market/freshness.ts +33 -0
  125. package/src/market-data/market/status.ts +5 -1
  126. package/src/market-data/quotes/contributions.ts +10 -0
  127. package/src/market-data/quotes/freshness.ts +31 -0
  128. package/src/market-data/quotes/live-valuation.ts +32 -5
  129. package/src/market-data/quotes/regular-session-valuation.ts +1 -1
  130. package/src/market-data/quotes/resolution.ts +4 -0
  131. package/src/market-data/quotes/time.ts +0 -14
  132. package/src/plugins/builtin/account-management/index.tsx +1 -0
  133. package/src/plugins/builtin/awards/detail.tsx +12 -4
  134. package/src/plugins/builtin/awards/headless.ts +29 -8
  135. package/src/plugins/builtin/awards/model.ts +36 -2
  136. package/src/plugins/builtin/awards/pane.tsx +7 -4
  137. package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
  138. package/src/plugins/builtin/broker-manager/index.tsx +7 -6
  139. package/src/plugins/builtin/broker-manager/model.ts +15 -6
  140. package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
  141. package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
  142. package/src/plugins/builtin/broker-manager/table.ts +10 -4
  143. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  144. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  145. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  146. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  147. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  148. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  149. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  150. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  151. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  152. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  153. package/src/plugins/builtin/chat/sidebar.tsx +35 -19
  154. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  155. package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
  156. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  157. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  158. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  159. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  160. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  161. package/src/plugins/builtin/connections/index.ts +1 -0
  162. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  163. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  164. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  165. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  166. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  167. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  168. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  169. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  170. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  171. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  173. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  174. package/src/plugins/builtin/earnings/board.tsx +15 -3
  175. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  176. package/src/plugins/builtin/earnings/client.ts +0 -9
  177. package/src/plugins/builtin/earnings/headless.ts +10 -7
  178. package/src/plugins/builtin/earnings/history.tsx +21 -14
  179. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  180. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  181. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  182. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  183. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  184. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  185. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  186. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  187. package/src/plugins/builtin/econ/index.tsx +9 -2
  188. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  189. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  190. package/src/plugins/builtin/equity-screener/live.ts +74 -18
  191. package/src/plugins/builtin/equity-screener/model.ts +19 -4
  192. package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
  193. package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
  194. package/src/plugins/builtin/equity-screener/results.ts +22 -2
  195. package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
  196. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  197. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  198. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  199. package/src/plugins/builtin/futures/index.tsx +15 -1
  200. package/src/plugins/builtin/futures/table.tsx +1 -1
  201. package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
  202. package/src/plugins/builtin/holders/pane.tsx +30 -20
  203. package/src/plugins/builtin/insider/table.tsx +10 -7
  204. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  205. package/src/plugins/builtin/iv-history/events.ts +5 -0
  206. package/src/plugins/builtin/iv-history/headless.ts +15 -9
  207. package/src/plugins/builtin/jobs/index.tsx +1 -0
  208. package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
  209. package/src/plugins/builtin/macro-day/headless.ts +15 -6
  210. package/src/plugins/builtin/macro-day/model.ts +1 -1
  211. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  212. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  213. package/src/plugins/builtin/market-movers/model.ts +5 -0
  214. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  215. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  216. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  217. package/src/plugins/builtin/options/view.tsx +3 -0
  218. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  219. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  220. package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
  221. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  222. package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -1
  223. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  224. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  225. package/src/plugins/builtin/portfolio-list/table.tsx +15 -1
  226. package/src/plugins/builtin/rate-path/pane.tsx +2 -0
  227. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  228. package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
  229. package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
  230. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  231. package/src/plugins/builtin/seasonality/pane.tsx +2 -1
  232. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  233. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  234. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  235. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  236. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  237. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  238. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  239. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  240. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  241. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  242. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  243. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  244. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  245. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  246. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  247. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  248. package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
  249. package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
  250. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
  251. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
  252. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  253. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  254. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  255. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  256. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  257. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  258. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  259. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  260. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  261. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  262. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  263. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  264. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  265. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  266. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  267. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  268. package/src/plugins/builtin/vol-surface/heat-grid.tsx +6 -3
  269. package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
  270. package/src/plugins/builtin/world-indices/index.tsx +5 -1
  271. package/src/plugins/builtin/yield-curve/index.tsx +2 -1
  272. package/src/plugins/runtime/index.tsx +1 -0
  273. package/src/plugins/runtime/state.ts +20 -0
  274. package/src/portfolio/column-values.ts +8 -2
  275. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  276. package/src/public/react.ts +7 -0
  277. package/src/react/auto-refresh.ts +29 -0
  278. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  279. package/src/renderers/dom/data-table/column-drag.ts +147 -0
  280. package/src/renderers/dom/data-table/index.tsx +22 -0
  281. package/src/renderers/dom/data-table/row.tsx +27 -5
  282. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  283. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  284. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  285. package/src/renderers/dom/styles.css +47 -5
  286. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  287. package/src/renderers/opentui/chart-surface.tsx +1 -0
  288. package/src/renderers/opentui/frame-hits.ts +33 -0
  289. package/src/renderers/opentui/host.tsx +2 -0
  290. package/src/renderers/opentui/native-surface.ts +14 -21
  291. package/src/renderers/opentui/test-utils.tsx +3 -0
  292. package/src/series/types.ts +2 -0
  293. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  294. package/src/sources/gloomberb-cloud/index.ts +25 -1
  295. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  296. package/src/sources/provider-errors.ts +64 -1
  297. package/src/sources/provider-router/batches.ts +19 -0
  298. package/src/sources/provider-router/index.ts +7 -1
  299. package/src/state/app/context/index.tsx +46 -1
  300. package/src/state/pane-unsent-work.ts +47 -0
  301. package/src/test-support/app-store.ts +24 -1
  302. package/src/test-support/shell-pane-keys.tsx +5 -0
  303. package/src/test-support/telemetry-guard.ts +83 -0
  304. package/src/test-support/test-env.ts +12 -0
  305. package/src/theme/colors.ts +17 -1
  306. package/src/theme/ui-tokens.ts +50 -1
  307. package/src/tickers/listing-venues.ts +11 -1
  308. package/src/tickers/search/japanese-names.json +1 -0
  309. package/src/tickers/search/japanese-names.ts +152 -0
  310. package/src/tickers/terminal-codes.ts +55 -6
  311. package/src/time-series/base-series.ts +3 -0
  312. package/src/time-series/live-quotes.ts +3 -9
  313. package/src/types/data-provider.ts +6 -0
  314. package/src/types/financials.ts +11 -0
  315. package/src/types/plugin-contributions.ts +7 -0
  316. package/src/types/plugin-panes.ts +7 -0
  317. package/src/ui/host.tsx +24 -0
  318. package/src/ui/pointer-drag.ts +11 -2
  319. package/src/utils/double-escape-close.ts +42 -0
  320. package/src/utils/fundamentals.ts +14 -3
  321. package/src/utils/fx-status.ts +30 -7
  322. package/src/utils/network-failure.ts +23 -0
  323. package/src/utils/share-multiples.cases.json +780 -2
  324. package/src/utils/share-multiples.ts +154 -24
@@ -51,7 +51,9 @@ import {
51
51
  policyDecisionsNamed,
52
52
  matchesImpact,
53
53
  NO_CONSENSUS_NOTE,
54
+ countriesNotInCalendar,
54
55
  noScheduledReleasesMessage,
56
+ notInCalendarMessage,
55
57
  parseCountryFilter,
56
58
  listingEnd,
57
59
  pastListingRows,
@@ -93,8 +95,6 @@ import {
93
95
  fredInterval,
94
96
  fredObservesDays,
95
97
  fredObservationsFromStart,
96
- fredProvenance,
97
- fredPublicationTime,
98
98
  fredUnit,
99
99
  fredValueCell,
100
100
  fredValueHeader,
@@ -102,6 +102,7 @@ import {
102
102
  laggingSeriesNote,
103
103
  parseFredChange,
104
104
  } from "./fred-series";
105
+ import { fredProvenance, fredPublicationTime, notOnFredSource } from "../../sources/gloomberb-cloud/fred-attribution";
105
106
  import { followsUsBondMarket, usBondMarketClosedNote } from "../../market-data/us-bond-market";
106
107
 
107
108
  // Batch quotes often omit names for indices and ETFs; these baskets are fixed, so name them here.
@@ -404,6 +405,34 @@ function econHeadColumns(viewerZone: string | null): CliResultColumn[] {
404
405
  ];
405
406
  }
406
407
 
408
+ /**
409
+ * An export's columns up to the event: the UTC timestamp, its time and
410
+ * weekday, and with --tz the viewer's own date, weekday and time, each in a
411
+ * column of its own and filled on every row with a time, so no column mixes
412
+ * the UTC day with the viewer's weekday. The publisher's own clock (`Local`)
413
+ * stays where it was when a row has one (`publisherTimed`), and is left out
414
+ * when it would be empty on every row.
415
+ */
416
+ function econExportHeadColumns(viewerZone: string | null, publisherTimed: boolean): CliResultColumn[] {
417
+ return econExportZoneColumns(viewerZone).filter((column) => column.key !== "localTime" || publisherTimed);
418
+ }
419
+
420
+ function econExportZoneColumns(viewerZone: string | null): CliResultColumn[] {
421
+ const [date, , , viewerTime, local, ...rest] = viewerZone ? econHeadColumns(viewerZone) : [];
422
+ if (!viewerZone) return econHeadColumns(null);
423
+ const city = timeZoneCity(viewerZone);
424
+ return [
425
+ date!,
426
+ { key: "time", header: "Time", format: (value, row) => value === "All Day" ? "All day" : value === "" ? "" : utcDateTimePart(row.date, "time") },
427
+ { key: "utcDay", header: "Day" },
428
+ { key: "viewerDate", header: `${city} date` },
429
+ { key: "day", header: `${city} day`, format: (value, row) => typeof row.viewerDate === "string" ? String(value ?? "") : "" },
430
+ { ...viewerTime!, header: `${city} time`, format: (value) => typeof value === "string" ? value : "" },
431
+ local!,
432
+ ...rest,
433
+ ];
434
+ }
435
+
407
436
  /**
408
437
  * The text table's columns up to the event. Plain output keeps every column a
409
438
  * query has, so a column that is empty by construction has to be left out
@@ -598,9 +627,11 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
598
627
  ? `The calendar lists back ${Math.round((todayStart - Date.parse(`${past.listedFrom}T00:00:00Z`)) / DAY_MS)} days, to ${past.listedFrom}; nothing earlier is listed`
599
628
  : past?.storedFrom ? `The stored calendar starts ${past.storedFrom}; nothing earlier is listed`
600
629
  : `No events are stored before ${listedFrom ?? isoDate(new Date(todayStart))}`;
630
+ // Countries asked for that the calendar does not cover (EG, NG): not in it, which a longer window would not change.
631
+ const absent = countriesNotInCalendar(country, events);
601
632
  // Countries asked for that nothing in the window is for: a quiet week there, not an unknown country.
602
633
  const inWindow = events.filter((event) => event.date.getTime() >= fromTime);
603
- const unscheduled = countriesWithoutEvents(country, inWindow);
634
+ const unscheduled = countriesWithoutEvents(country, inWindow).filter((code) => !absent.includes(code));
604
635
  const listed = inWindow
605
636
  .filter((event) => matchesCountry(event, country) && matchesImpact(event, impact) && (search == null || matchesEventSearch(event, search)))
606
637
  .sort((left, right) => left.date.getTime() - right.date.getTime());
@@ -614,6 +645,8 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
614
645
  date: isoDate(event.date),
615
646
  // The weekday on the viewer's clock (--tz), else the UTC day's; a row with no time is its day's.
616
647
  day: weekdayOf(clock?.date ?? isoDate(event.date).slice(0, 10)),
648
+ // The UTC day's weekday, beside the UTC timestamp in an export with --tz.
649
+ ...(viewerZone ? { utcDay: weekdayOf(isoDate(event.date).slice(0, 10)) } : {}),
617
650
  time: hasNoStatedTime(event) ? "" : event.time,
618
651
  ...(viewerZone ? { viewerDate: clock?.date ?? null, viewerTime: clock?.time ?? null } : {}),
619
652
  country: eventCountry(event),
@@ -654,13 +687,17 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
654
687
  });
655
688
  // A filter of countries only, none of which has anything in the window, says so as its empty list, with where
656
689
  // the listing ends.
657
- const allUnscheduled = unscheduled.length > 0 && unscheduled.length === country.split(",").length;
690
+ const allUnscheduled = unscheduled.length + absent.length > 0 && unscheduled.length + absent.length === country.split(",").length;
691
+ const coverage = [
692
+ absent.length > 0 ? notInCalendarMessage(absent) : null,
693
+ unscheduled.length > 0 ? noScheduledReleasesMessage(unscheduled, allUnscheduled ? listedThrough : null) : null,
694
+ ].filter((note): note is string => !!note).join(" ");
658
695
  // Rows after the listing's end are each bank's next decision and each country's next CPI release, and say so
659
696
  // where the end is said.
660
697
  const pastRows = pastListingRows(listed);
661
698
  const listedPast = pastRows ? `No releases listed after ${listedThrough}; the rows after it are ${pastRows}` : null;
662
699
  const notes = [listedBefore, listedPast ?? listedAfter, ...(rows.length > 0 ? blankTimeNotes(rows) : []),
663
- rows.length > 0 && unscheduled.length > 0 ? noScheduledReleasesMessage(unscheduled) : null,
700
+ rows.length > 0 && coverage ? coverage : null,
664
701
  // A dash under Forecast on a release still to come is a consensus not in yet, not a missing figure.
665
702
  listed.some(awaitsConsensus) ? NO_CONSENSUS_NOTE : null]
666
703
  .filter((note): note is string => !!note);
@@ -669,6 +706,8 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
669
706
  // refreshed is the copy an earlier read saved, and says when that was.
670
707
  const read = rowsFreshness([], { status: "not-a-feed", basis: "calendar", asOf: fetchedAt }, { stale });
671
708
  const calendarFreshness = read && source === "stale-fallback" ? { ...read, savedAt: new Date(fetchedAt).toISOString() } : read;
709
+ // Only rows a bank or statistics office times itself have its own clock (`Local`).
710
+ const publisherTimed = rows.some((row) => !!publisherClock(row.localTime, row.timeZone));
672
711
  ctx.printResult({
673
712
  data: rows,
674
713
  ...(unread ? { warnings: [unread] } : {}),
@@ -677,7 +716,7 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
677
716
  }, {
678
717
  dateKey: "date",
679
718
  defaultLimit: 50,
680
- empty: allUnscheduled ? noScheduledReleasesMessage(unscheduled, listedThrough)
719
+ empty: allUnscheduled ? coverage
681
720
  : [econEmptyMessage(from, listedThrough, listedAfter != null), search == null ? null : policyDecisionHint(search, country)].filter(Boolean).join(" "),
682
721
  ...(footnote ? { footnote } : {}),
683
722
  // What the text says under the table, a script reads in the CSV's closing lines.
@@ -693,8 +732,8 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
693
732
  period: typeof row.referencePeriod === "string" ? row.referencePeriod : null,
694
733
  }),
695
734
  // The exports add what a script needs to read a row; the text table keeps the columns it had.
696
- columns: [...econHeadColumns(viewerZone), ...econFigureColumns(false), ...econExportColumns],
697
- textColumns: [...econTextHeadColumns(viewerZone, rows.some((row) => !!publisherClock(row.localTime, row.timeZone))), ...econFigureColumns(true), ECON_PUBLISHER_COLUMN],
735
+ columns: [...econExportHeadColumns(viewerZone, publisherTimed), ...econFigureColumns(false), ...econExportColumns],
736
+ textColumns: [...econTextHeadColumns(viewerZone, publisherTimed), ...econFigureColumns(true), ECON_PUBLISHER_COLUMN],
698
737
  });
699
738
  });
700
739
  }
@@ -907,12 +946,6 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
907
946
  });
908
947
  }
909
948
 
910
- /** Who a series FRED does not carry comes from, for a source line whose rows do not name it: `TurkStat via the CBRT`. */
911
- function notOnFredSource(seriesId: string): string | null {
912
- const elsewhere = seriesNotOnFred(seriesId);
913
- return elsewhere ? `${elsewhere.publisher} via ${elsewhere.via}` : null;
914
- }
915
-
916
949
  const YIELD_TENORS: Record<string, string> = { DGS3MO: "3M", DGS2: "2Y", DGS10: "10Y", DGS30: "30Y" };
917
950
 
918
951
  async function runYieldCurve(rawArgs: string[], ctx: Parameters<CliCommandDef["execute"]>[1]) {
@@ -44,6 +44,7 @@ import { createPaneCatalog } from "../pane-functions/discovery";
44
44
  import { buildPaneCatalogEntries, filterPaneCatalogEntries, selectPaneCatalogMatches } from "../pane-functions/catalog";
45
45
  import { normalizeSearchText } from "../../tickers/search/ranking";
46
46
  import { hasNonLatinLetters } from "../../utils/typed-text";
47
+ import { isKanjiOnlyName, japaneseNameReadAs, readExactJapaneseName, readJapaneseName, type JapaneseNameListing } from "../../tickers/search/japanese-names";
47
48
 
48
49
  interface SearchCommandDependencies {
49
50
  initMarketData?: () => Promise<MarketContext>;
@@ -149,6 +150,22 @@ export async function searchCandidatesForCli({
149
150
  }
150
151
  }
151
152
 
153
+ /** Each listing a name in Japanese was read as, searched for by its key, in that order and once each. */
154
+ async function japaneseNameCandidates(
155
+ listings: readonly JapaneseNameListing[],
156
+ tickers: TickerRecord[],
157
+ dataProvider: DataProvider,
158
+ ): Promise<TickerSearchCandidate[]> {
159
+ const found = await Promise.all(listings.map(({ key }) => searchCandidatesForCli({ query: key, tickers, dataProvider, totalLimit: 1, localLimit: 1 })));
160
+ const seen = new Set<string>();
161
+ return found.flat().filter((candidate) => {
162
+ const key = `${candidate.symbol}:${candidate.result?.exchange ?? candidate.ticker?.metadata.exchange ?? ""}`;
163
+ if (seen.has(key)) return false;
164
+ seen.add(key);
165
+ return true;
166
+ });
167
+ }
168
+
152
169
  /** A symbol search does not list whose quote stopped long ago: TWTR, last traded 2022-10-27. */
153
170
  interface StoppedListing {
154
171
  symbol: string;
@@ -763,12 +780,24 @@ export async function search(query: string, dependencies: SearchCommandDependenc
763
780
  const changes = bare ? startTickerChangeLookup(dataProvider, symbol) : null;
764
781
  // With no quote, its US line's last bars, to list a retired symbol (STPP) with its last day.
765
782
  const ending = quote?.then((quoted) => quoted ? null : loadNoQuoteEnding({ symbol }, dataProvider));
766
- const candidates = await searchCandidatesForCli({
767
- query: index?.symbol ?? trimmedQuery,
768
- tickers,
769
- dataProvider,
770
- ...quote ? { quote } : {},
771
- }).catch((error: unknown) => failTickerLookup(error, trimmedQuery, !dependencies.printResult));
783
+ // A name typed in Japanese (トヨタ, ドル円) searches for the listings it names, which are named in Latin letters.
784
+ const japanese = index ? null : await readJapaneseName(trimmedQuery);
785
+ const searched = japanese
786
+ ? await japaneseNameCandidates(japanese.listings, tickers, dataProvider).catch((error: unknown) => failTickerLookup(error, trimmedQuery, !dependencies.printResult))
787
+ : await searchCandidatesForCli({
788
+ query: index?.symbol ?? trimmedQuery,
789
+ tickers,
790
+ dataProvider,
791
+ ...quote ? { quote } : {},
792
+ }).catch((error: unknown) => failTickerLookup(error, trimmedQuery, !dependencies.printResult));
793
+ // A name in kanji alone is the service's to read first (中電 is CLP in Hong Kong); a Tokyo company's whole name it
794
+ // finds nothing for (中電工) is read from the Tokyo list.
795
+ const exact = searched.length === 0 && !japanese && !index && isKanjiOnlyName(trimmedQuery) ? await readExactJapaneseName(trimmedQuery) : null;
796
+ const candidates = exact
797
+ ? await japaneseNameCandidates(exact.listings, tickers, dataProvider).catch((error: unknown) => failTickerLookup(error, trimmedQuery, !dependencies.printResult))
798
+ : searched;
799
+ const reading = japanese ?? exact;
800
+ const readAs = index?.readAs ?? (reading ? japaneseNameReadAs(trimmedQuery, reading) : undefined);
772
801
  const fate = quote && changes ? await searchFate(symbol, candidates, await quote, dataProvider, changes, ending) : NO_SEARCH_FATE;
773
802
 
774
803
  const series = findCatalogSeries(dependencies.plugins ?? [], trimmedQuery, "names");
@@ -781,7 +810,7 @@ export async function search(query: string, dependencies: SearchCommandDependenc
781
810
  data: [...fate.stopped ? [stoppedListingRow(fate.stopped)] : [], ...searchCandidateRows(candidates)],
782
811
  metadata: { query: trimmedQuery, ...(index ? { searched: index.symbol } : {}), ...(series.length ? { series } : {}), ...(functions.length ? { functions } : {}),
783
812
  ...(bank ? { centralBank: { id: bank.id, name: bank.name, place: bank.place, function: "CBR" } } : {}) },
784
- warnings: index?.readAs || warnings.length ? [...index?.readAs ? [index.readAs] : [], ...warnings] : undefined,
813
+ warnings: readAs || warnings.length ? [...readAs ? [readAs] : [], ...warnings] : undefined,
785
814
  }, {
786
815
  columns: [
787
816
  { key: "category", header: "Category" },
@@ -802,7 +831,7 @@ export async function search(query: string, dependencies: SearchCommandDependenc
802
831
  series,
803
832
  functions,
804
833
  fate,
805
- readAs: index?.readAs,
834
+ readAs,
806
835
  }));
807
836
  });
808
837
  }
@@ -106,7 +106,7 @@ import type { ReportFreshness } from "../pane-functions/freshness";
106
106
  import { fundamentalsFreshness, quotesFreshness } from "../freshness";
107
107
  import { distributionHistory, forwardDividendBasis, forwardDividendMayHaveLapsed, lapsedDividend, noCurrentDividend, TRAILING_DIVIDEND_BASIS, type DistributionHistory, type DividendLapse } from "../../utils/forward-dividend";
108
108
  import { declaredDividends } from "../../utils/declared-dividends";
109
- import { atLivePriceEarnings, historyTrailingDividendYield, measuresTrailingYield } from "../../market-data/quotes/live-valuation";
109
+ import { atLivePriceEarnings, historyTrailingDividendYield, measuresTrailingYield, statedYearRange } from "../../market-data/quotes/live-valuation";
110
110
  import { loadOfferingFilings, loadStatementFilings, resultsReleaseText, statementPeriodText, type StatementFilingsReport } from "../statement-filings";
111
111
  import type { BankFiguresPayload } from "../../api-client/bank-figures";
112
112
  import { bankSection } from "../bank-section";
@@ -200,6 +200,18 @@ function yearRangeOptions(quote: Quote, options: MarketFormatOptions): MarketFor
200
200
  return { ...stable, fixedFractionDigits: Math.min(stable.fixedFractionDigits, digits) };
201
201
  }
202
202
 
203
+ /**
204
+ * The 52-week range, "—" when the quote states none that is one (an index's
205
+ * that repeats its day's range, a bound at 0), and "(daily bars)" after one
206
+ * the service read from the stored daily bars in place of its source's.
207
+ */
208
+ function yearRangeText(quote: Quote, options: MarketFormatOptions): string {
209
+ const range = statedYearRange(quote);
210
+ if (!range) return "—";
211
+ const text = formatPriceRange(range.low, range.high, quote.currency, yearRangeOptions(quote, options));
212
+ return quote.yearRangeBasis === "daily-bars" ? `${text} (daily bars)` : text;
213
+ }
214
+
203
215
  function bidAskText(quote: Quote, options: MarketFormatOptions): string {
204
216
  const text = formatBidAsk(quote.bid, quote.ask, quote.bidSize, quote.askSize, quote.currency, options);
205
217
  const label = text === "—" ? null : quoteBookSessionLabel(quote);
@@ -1479,9 +1491,8 @@ export async function buildTickerReport({
1479
1491
  : "—"],
1480
1492
  // The year's high and low come from bars (a continuous future's are float32, 54.97999954): they print at
1481
1493
  // the instrument's own decimals, as the Overview's ranges do, never at every digit the bars carry.
1482
- ["52W Range", quote.low52w != null || quote.high52w != null
1483
- ? formatPriceRange(quote.low52w, quote.high52w, quote.currency, yearRangeOptions(quote, quoteOptions))
1484
- : "—"],
1494
+ // Only a range that is one (statedYearRange); one read from the stored daily bars says so.
1495
+ ["52W Range", yearRangeText(quote, quoteOptions)],
1485
1496
  ["Bid / Ask", bidAskText(quote, quoteOptions)],
1486
1497
  // An index's and a perpetual's 0 means none is counted, not no trades: no Volume row.
1487
1498
  ["Volume", volume != null ? `${formatNumber(volume, 0)}${volumeCurrency}` : "—"],
@@ -203,6 +203,12 @@ export interface DesktopPaneShotRenderResult {
203
203
  * Absent when no state shows, or in a capture that did not read them.
204
204
  */
205
205
  stateText?: { error?: string[]; empty?: string[] };
206
+ /**
207
+ * The headers of the table columns the capture cut: drawn past the edge of
208
+ * their table's viewport (a table too wide for the pane scrolls sideways),
209
+ * whole or in part. Absent when none is, or in a capture that did not read them.
210
+ */
211
+ cutColumns?: string[];
206
212
  /** A wall that needs an account, or a Pro lock on part of the pane. */
207
213
  accessGate?: PaneAccessGate | null;
208
214
  /**
@@ -870,12 +876,27 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
870
876
  [...root.querySelectorAll(
871
877
  '[data-gloom-scrollbar-x="visible"], [data-gloom-scrollbar-y="visible"], [data-gloom-role="data-table-body-scroll"]',
872
878
  )].forEach(markScrollTruncation);
879
+ const cutColumns = [];
873
880
  visibleTables
874
881
  .forEach((table, tableIndex) => {
875
882
  const tableMetadata = semanticTables[tableIndex] && semanticTables[tableIndex].metadata || {};
876
883
  const semanticColumns = Array.isArray(tableMetadata.columns) ? tableMetadata.columns : [];
877
- const headers = [...table.querySelectorAll('[data-gloom-role="data-table-header-cell"]')]
878
- .map((cell) => normalize(cell.innerText || cell.textContent));
884
+ const headerCells = [...table.querySelectorAll('[data-gloom-role="data-table-header-cell"]')];
885
+ const headers = headerCells.map((cell) => normalize(cell.innerText || cell.textContent));
886
+ // A column drawn past the edge of the table's viewport, whole or in part, is one the picture cut.
887
+ const scroller = table.querySelector('[data-gloom-role="data-table-body-scroll"]');
888
+ if (scroller instanceof HTMLElement) {
889
+ const box = scroller.getBoundingClientRect();
890
+ const left = Math.max(0, box.left);
891
+ const right = Math.min(window.innerWidth, box.left + scroller.clientWidth);
892
+ headerCells.forEach((cell, cellIndex) => {
893
+ const rect = cell.getBoundingClientRect();
894
+ if (rect.width <= 0 || (rect.left >= left - 1 && rect.right <= right + 1)) return;
895
+ // A centred header is padded with spaces (FA's " FY2024 ").
896
+ const label = normalize((semanticColumns[cellIndex] || {}).label) || headers[cellIndex] || String(cellIndex + 1);
897
+ if (!cutColumns.includes(label)) cutColumns.push(label);
898
+ });
899
+ }
879
900
  const rowElements = [...table.querySelectorAll(
880
901
  '[data-gloom-role="data-table-row"], [data-gloom-role="data-table-section-header"]',
881
902
  )].filter(isVisible);
@@ -1008,6 +1029,7 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
1008
1029
  return { ...(error.length ? { error } : {}), ...(empty.length ? { empty } : {}) };
1009
1030
  })(),
1010
1031
  contentFigures: (${countContentFigures.toString()})(root, isVisible),
1032
+ cutColumns,
1011
1033
  // The shared sign-in wall and the Pro lock prompt every gated pane draws.
1012
1034
  accessGate: [...root.querySelectorAll('[data-gloom-ui="sign-in-wall"]')].some(isVisible) ? "sign-in"
1013
1035
  : [...root.querySelectorAll('[data-gloom-ui="pro-lock"]')].some(isVisible) ? "pro" : "",
@@ -1037,6 +1059,7 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
1037
1059
  emptyStateText?: string[];
1038
1060
  stateText?: { error?: unknown; empty?: unknown };
1039
1061
  contentFigures?: number;
1062
+ cutColumns?: unknown;
1040
1063
  accessGate?: string;
1041
1064
  rows?: DesktopPaneShotRenderedRow[];
1042
1065
  truncated?: boolean;
@@ -1093,6 +1116,8 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
1093
1116
  accessGate,
1094
1117
  ...shotStateText(value?.stateText),
1095
1118
  ...(typeof value?.contentFigures === "number" ? { contentFigures: value.contentFigures } : {}),
1119
+ ...(Array.isArray(value?.cutColumns) && value.cutColumns.length > 0
1120
+ ? { cutColumns: value.cutColumns.filter((label): label is string => typeof label === "string" && label.length > 0) } : {}),
1096
1121
  semanticUi: Array.isArray(value?.semanticUi) ? value.semanticUi : [],
1097
1122
  };
1098
1123
  }
@@ -43,7 +43,7 @@ export interface FxQuoteRate {
43
43
  * The front-month future a metal with no spot quote is priced from, in USD per
44
44
  * troy ounce: COMEX gold and silver, NYMEX platinum and palladium.
45
45
  */
46
- const METAL_FRONT_MONTH: Readonly<Record<string, string>> = { XAU: "GC=F", XAG: "SI=F", XPT: "PL=F", XPD: "PA=F" };
46
+ export const METAL_FRONT_MONTH: Readonly<Record<string, string>> = { XAU: "GC=F", XAG: "SI=F", XPT: "PL=F", XPD: "PA=F" };
47
47
 
48
48
  /** "Gold", for the line that says a metal's rate is derived from its future. */
49
49
  export const METAL_NAMES: Readonly<Record<string, string>> = { XAU: "Gold", XAG: "Silver", XPT: "Platinum", XPD: "Palladium" };
@@ -28,6 +28,11 @@ export interface GlossaryEntry {
28
28
  * print in other yields.
29
29
  */
30
30
  shownBy?: Readonly<Record<string, readonly string[]>>;
31
+ /**
32
+ * Terms a reader looking this one up wants beside it, by their `term`:
33
+ * looking up when-issued prints the tail it is measured against too.
34
+ */
35
+ related?: readonly string[];
31
36
  /** One or two plain sentences. */
32
37
  definition: string;
33
38
  }
@@ -80,7 +85,7 @@ export const GLOSSARY: readonly GlossaryEntry[] = [
80
85
  },
81
86
  {
82
87
  term: "When-issued", short: "WI", aliases: ["when issued", "wi yield", "when-issued yield"], functions: ["AUCT"],
83
- shown: ["when-issued", "When-issued"],
88
+ shown: ["when-issued", "When-issued"], related: ["Tail"],
84
89
  definition: "Trading in a Treasury security between its announcement and its issue. The when-issued yield at the auction deadline is what a tail is measured against.",
85
90
  },
86
91
  {
@@ -96,9 +101,10 @@ export const GLOSSARY: readonly GlossaryEntry[] = [
96
101
  + "The auction's high discount rate is the one its investment rate restates.",
97
102
  },
98
103
  {
99
- term: "Auction percentile", aliases: ["b/c percentile", "b/c pctl", "indirect percentile", "dealer percentile"], functions: ["AUCT"],
100
- shown: ["B/C pctl", "Indirect pctl", "Dealer pctl"],
101
- definition: "Where an auction's bid-to-cover, indirect or dealer share ranks among the previous 24 auctions of the same "
104
+ term: "Auction percentile", aliases: ["b/c percentile", "b/c pctl", "indirect percentile", "dealer percentile", "stop-out percentile", "stop-out pctl"],
105
+ functions: ["AUCT"],
106
+ shown: ["Stop-out pctl", "B/C pctl", "Indirect pctl", "Dealer pctl"],
107
+ definition: "Where an auction's stop-out vs median, bid-to-cover, indirect or dealer share ranks among the previous 24 auctions of the same "
102
108
  + "tenor and type, from 0 (the lowest) to 100 (the highest). Blank with fewer than 12 before it.",
103
109
  },
104
110
  {
@@ -1068,7 +1074,10 @@ const wholeWord = (have: string, word: string) => have === word || have === `${w
1068
1074
  export function lookupGlossary(query: string): GlossaryLookup {
1069
1075
  const key = lookupKey(query);
1070
1076
  if (!key) return { exact: [], partial: [] };
1071
- const exact = GLOSSARY.filter((entry) => names(entry).some((name) => lookupKey(name) === key));
1077
+ const named = GLOSSARY.filter((entry) => names(entry).some((name) => lookupKey(name) === key));
1078
+ // A term named comes with the ones it is read beside (when-issued with the tail).
1079
+ const exact = [...new Set([...named, ...named.flatMap((entry) => (entry.related ?? [])
1080
+ .flatMap((term) => GLOSSARY.find((other) => other.term === term) ?? []))])];
1072
1081
  const wanted = words(query).filter((word) => word.length >= MIN_PARTIAL_WORD);
1073
1082
  if (wanted.length === 0) return { exact, partial: [] };
1074
1083
  const others = GLOSSARY.filter((entry) => !exact.includes(entry));
@@ -0,0 +1,85 @@
1
+ import type { GloomPlugin } from "../types/plugin";
2
+ import type { HeadlessSeriesResult } from "../types/headless";
3
+ import type { PriceWindow } from "../utils/price-window";
4
+ import { createPaneCatalog } from "./pane-functions/discovery";
5
+ import { loadResolvedHeadlessPaneModel } from "./pane-functions/headless";
6
+ import { parsePaneFunctionArgsFor, resolvePaneFunction } from "./pane-functions/resolver";
7
+ import type { MarketContext } from "./types";
8
+ import { fredSeriesArgument } from "../series/fred-argument";
9
+
10
+ /**
11
+ * A capability's series as `history` takes it beside listings: its source
12
+ * and its series (`CAP:bond-yield:jp-10y`). `CAP:EPA`, with no series, is
13
+ * Capgemini on Euronext Paris.
14
+ */
15
+ const CAPABILITY_SERIES_ID = /^CAP:([A-Za-z0-9][A-Za-z0-9._~%/-]*):([A-Za-z0-9][A-Za-z0-9._~%:/-]*)$/i;
16
+
17
+ /**
18
+ * The id of a catalog series an entry of a list names, its prefix in
19
+ * capitals and the rest as typed; null for a listing. A FRED series is
20
+ * `FRED:<id>` where the id is no venue's code (`fredSeriesArgument`):
21
+ * `FRED:TSXV` is a listing.
22
+ */
23
+ export function catalogSeriesId(entry: string): string | null {
24
+ const typed = entry.trim();
25
+ const fred = fredSeriesArgument(typed);
26
+ if (fred) return `FRED:${fred}`;
27
+ const capability = CAPABILITY_SERIES_ID.exec(typed);
28
+ // A capability's ids are as their source names them.
29
+ return capability ? `CAP:${capability[1]}:${capability[2]}` : null;
30
+ }
31
+
32
+ /** A catalog series' observations as `history --wide` sets them beside listings' closes. */
33
+ export interface CatalogSeriesHistory {
34
+ id: string;
35
+ /** What the series is, as the catalog names it: `Japan 10Y JGB yield`. */
36
+ label: string | null;
37
+ /** The unit of its values: `%`, `index`, `USD bn`. */
38
+ unit: string | null;
39
+ /** One value a date, oldest first, as ISO dates. */
40
+ points: Array<{ date: string; value: number }>;
41
+ /** What its chart said of it: a gap, a revision, a series it stands in for. */
42
+ notes: string[];
43
+ }
44
+
45
+ /** The chart's range a history range reads: G has no YTD (the year so far is in its 1Y). */
46
+ type ChartRange = "1D" | "1W" | "1M" | "3M" | "6M" | "1Y" | "5Y" | "ALL";
47
+
48
+ /**
49
+ * A catalog series' daily values over a history's range or window, read as
50
+ * `gloom fn G <id>` charts it, so a series `history` takes is the one the
51
+ * catalog lists. A window reads the whole series and keeps its dates. Throws
52
+ * with the chart's own reason for one that has no values (an id nothing
53
+ * answers to, a source that failed).
54
+ */
55
+ export async function loadCatalogSeriesHistory(
56
+ id: string,
57
+ market: MarketContext,
58
+ plugins: GloomPlugin[],
59
+ ask: { range: string; window: PriceWindow | null },
60
+ signal?: AbortSignal,
61
+ ): Promise<CatalogSeriesHistory> {
62
+ const range: ChartRange = ask.window ? "ALL" : ask.range === "YTD" ? "1Y" : ask.range as ChartRange;
63
+ const registry = await createPaneCatalog(market, plugins);
64
+ try {
65
+ const parsed = parsePaneFunctionArgsFor(registry, ["G", id, "--range-preset", range]);
66
+ const resolved = await resolvePaneFunction(registry, market, parsed, { seriesSources: plugins });
67
+ const loaded = await loadResolvedHeadlessPaneModel(resolved, market, id, signal ?? new AbortController().signal);
68
+ const result = loaded.result as HeadlessSeriesResult;
69
+ const series = result.series?.[0];
70
+ const yearStart = `${new Date().getUTCFullYear()}-01-01`;
71
+ const inAsk = (date: string) => ask.window ? date >= ask.window.from && date <= ask.window.to : ask.range !== "YTD" || date >= yearStart;
72
+ const points = (series?.points ?? []).flatMap((point) => {
73
+ const value = typeof point.value === "number" ? point.value : null;
74
+ const date = new Date(point.date as string).toISOString().slice(0, 10);
75
+ return value != null && Number.isFinite(value) && inAsk(date) ? [{ date, value }] : [];
76
+ });
77
+ // The chart's reason names the series after its line's label ("zz-10y: CAP:bond-yield:zz-10y is not covered"): said from the id.
78
+ const reason = [...result.errors ?? [], ...result.notes ?? []][0];
79
+ const at = reason?.indexOf(id) ?? -1;
80
+ if (points.length === 0) throw new Error(reason ? at > 0 ? reason.slice(at) : reason : `No values for ${id} in this range.`);
81
+ return { id, label: series?.label ?? null, unit: series?.unit ?? null, points, notes: result.notes ?? [] };
82
+ } finally {
83
+ registry.destroy();
84
+ }
85
+ }
package/src/cli/index.ts CHANGED
@@ -226,7 +226,7 @@ export function createCoreCliCommands(
226
226
  { flags: "--scale <n>", description: "Text scale from 0.5 to 4 (default 1)" },
227
227
  { flags: "--watermark <label>", description: "Label drawn in the pane title bar" },
228
228
  { flags: "--no-status", description: "Leave out the dated status line (as-of, delay, market hours) drawn in the pane footer" },
229
- { flags: "--strict", description: `Exit ${CLI_EXIT_CODES.unusableShot} when the pane is empty, shows an error, is still loading, is access-gated or draws a column blank in every row; the PNG and the Reason line, which names what it saw, are still written` },
229
+ { flags: "--strict", description: `Exit ${CLI_EXIT_CODES.unusableShot} when the pane is empty, shows an error, is still loading, is access-gated, or draws a column blank in every row; the PNG and the Reason line, which names what it saw, are still written. A column cut at the table's edge is a warning` },
230
230
  { flags: "--<option> <value>", description: "A function setting; gloom catalog <function> lists them" },
231
231
  EXCHANGE_OPTION,
232
232
  ],
@@ -0,0 +1,45 @@
1
+ import type { CliCommandContext } from "../types/plugin";
2
+ import { cliStyles } from "../utils/cli-output";
3
+
4
+ /** A list this slow says how far it has got, so it never looks stuck: first after two seconds, then every five. */
5
+ const PROGRESS_AFTER_MS = 2_000;
6
+ const PROGRESS_EVERY_MS = 5_000;
7
+
8
+ /**
9
+ * Lines on standard error while a command works through a list of symbols
10
+ * slowly, worded by `line` from how many are settled, how many there are, and
11
+ * whether a line was printed already: two seconds in, then every five seconds
12
+ * until all are. Nothing for one symbol or a list that is quick, nor with
13
+ * `--quiet`. It is told (0, total) as the list starts and again as each
14
+ * symbol settles; the lines come from a timer, so a list waiting on one slow
15
+ * answer still says so.
16
+ */
17
+ export function listProgressNotice(
18
+ ctx: Pick<CliCommandContext, "cliOptions">,
19
+ line: (settled: number, total: number, told: boolean) => string,
20
+ { afterMs = PROGRESS_AFTER_MS, everyMs = PROGRESS_EVERY_MS }: { afterMs?: number; everyMs?: number } = {},
21
+ ): (settled: number, total: number) => void {
22
+ let timer: ReturnType<typeof setTimeout> | undefined;
23
+ let settled = 0, total = 0, told = false;
24
+ const tell = () => {
25
+ timer = undefined;
26
+ if (settled >= total) return;
27
+ console.error(cliStyles.muted(line(settled, total, told)));
28
+ told = true;
29
+ schedule(everyMs);
30
+ };
31
+ const schedule = (ms: number) => {
32
+ timer = setTimeout(tell, ms);
33
+ // The command's own end, not this line, decides when the process exits.
34
+ (timer as { unref?: () => void }).unref?.();
35
+ };
36
+ return (done, of) => {
37
+ if (ctx.cliOptions.quiet || of < 2) return;
38
+ settled = done;
39
+ total = of;
40
+ if (settled >= total) {
41
+ if (timer) clearTimeout(timer);
42
+ timer = undefined;
43
+ } else if (!timer) schedule(afterMs);
44
+ };
45
+ }