@gloom-sh/terminal 0.20.16 → 0.20.18

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 (345) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/data.ts +16 -5
  7. package/src/api-client/heard-from.ts +72 -0
  8. package/src/api-client/index.ts +63 -6
  9. package/src/api-client/mna.ts +18 -0
  10. package/src/api-client/supply-chain.ts +9 -0
  11. package/src/api-client/types/billing.ts +35 -1
  12. package/src/api-client/types/econ.ts +3 -0
  13. package/src/app/global-shortcuts.ts +5 -3
  14. package/src/app/pro-welcome/keys.ts +27 -0
  15. package/src/app/pro-welcome/model.ts +158 -0
  16. package/src/app/pro-welcome/row.tsx +176 -0
  17. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  18. package/src/app/runtime/external-profile-changes.ts +135 -0
  19. package/src/app.tsx +33 -2
  20. package/src/architecture/core-builtin-allowlist.json +1 -1
  21. package/src/architecture/floating-promise-allowlist.json +0 -1
  22. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  23. package/src/cli/alert-listing.ts +98 -0
  24. package/src/cli/commands/fred-series.ts +3 -1
  25. package/src/cli/commands/market.ts +138 -22
  26. package/src/cli/commands/overview.ts +72 -14
  27. package/src/cli/commands/plugins.ts +3 -2
  28. package/src/cli/commands/search.ts +30 -6
  29. package/src/cli/context.ts +16 -5
  30. package/src/cli/csv-export.ts +74 -0
  31. package/src/cli/desktop-pane-shot.ts +75 -11
  32. package/src/cli/glossary.ts +64 -10
  33. package/src/cli/help.ts +4 -2
  34. package/src/cli/history-demergers.ts +117 -0
  35. package/src/cli/history-rows.ts +6 -2
  36. package/src/cli/index.ts +1 -0
  37. package/src/cli/known-gaps.ts +16 -0
  38. package/src/cli/known-us-stocks.ts +18 -0
  39. package/src/cli/listing-arg.ts +105 -15
  40. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  41. package/src/cli/pane-functions/catalog-snapshot.json +866 -0
  42. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  43. package/src/cli/pane-functions/catalog.ts +50 -16
  44. package/src/cli/pane-functions/data.ts +16 -4
  45. package/src/cli/pane-functions/dom.ts +24 -6
  46. package/src/cli/pane-functions/freshness.ts +17 -1
  47. package/src/cli/pane-functions/headless.ts +7 -2
  48. package/src/cli/pane-functions/index.ts +102 -44
  49. package/src/cli/pane-functions/resolver.ts +8 -5
  50. package/src/cli/pane-functions/screenshot-assessment.ts +30 -7
  51. package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
  52. package/src/cli/pane-functions/screenshot-payload.ts +21 -0
  53. package/src/cli/pane-functions/screenshot-render.ts +3 -1
  54. package/src/cli/quote-answer.ts +32 -16
  55. package/src/cli/registry.ts +22 -2
  56. package/src/cli/report-tables.ts +17 -3
  57. package/src/cli/result.ts +8 -10
  58. package/src/cli/series-search.ts +45 -6
  59. package/src/cli/shot-temp-dir.ts +4 -9
  60. package/src/components/chart/composite/legend.tsx +80 -25
  61. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  62. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  63. package/src/components/chart-table/header.tsx +9 -0
  64. package/src/components/chart-table/layout.ts +11 -11
  65. package/src/components/command-bar/pane-templates/items.ts +17 -1
  66. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  67. package/src/components/command-bar/routes/root/results.ts +34 -2
  68. package/src/components/command-bar/routes/root/runtime.ts +8 -1
  69. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  70. package/src/components/command-bar/workflow/alert.ts +19 -8
  71. package/src/components/data-table/view.tsx +15 -2
  72. package/src/components/form-modal/content.tsx +9 -4
  73. package/src/components/index.ts +1 -1
  74. package/src/components/layout/header.tsx +9 -5
  75. package/src/components/layout/pane/capture-status.ts +6 -0
  76. package/src/components/layout/pane/footer/index.tsx +2 -0
  77. package/src/components/layout/pane/footer/model.ts +113 -15
  78. package/src/components/layout/pane/header.tsx +16 -2
  79. package/src/components/market-board/index.tsx +4 -2
  80. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  81. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  82. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  83. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  84. package/src/components/onboarding/setup-cards.ts +36 -0
  85. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  86. package/src/components/onboarding/wizard-account.ts +6 -1
  87. package/src/components/onboarding/wizard-model.ts +32 -6
  88. package/src/components/onboarding/wizard-positions.ts +1 -1
  89. package/src/components/sign-in-gate.tsx +3 -1
  90. package/src/components/toggle-list.tsx +6 -8
  91. package/src/components/ui/confirm-dialog.tsx +47 -7
  92. package/src/components/ui/data-table/display-columns.ts +4 -1
  93. package/src/components/ui/data-table/hooks.ts +2 -3
  94. package/src/components/ui/data-table/index.tsx +4 -1
  95. package/src/components/ui/data-table/types.ts +19 -4
  96. package/src/components/ui/data-table/visible-range.ts +11 -1
  97. package/src/components/ui/display.tsx +17 -2
  98. package/src/components/ui/index.ts +1 -1
  99. package/src/components/ui/stat-grid.tsx +4 -0
  100. package/src/components/ui/status.tsx +13 -1
  101. package/src/components/ui/table-layout.ts +2 -1
  102. package/src/components/use-pane-notice-footer.tsx +16 -3
  103. package/src/data/config/store/index.ts +31 -0
  104. package/src/data/config/store/node.ts +61 -11
  105. package/src/data/config/store/normalize.ts +4 -6
  106. package/src/data/config/store/shared-file.ts +309 -0
  107. package/src/data/profile-merge.ts +299 -0
  108. package/src/data/sqlite/checkpointer.ts +11 -1
  109. package/src/data/sqlite/database.ts +1 -1
  110. package/src/data/ticker-repository.ts +134 -10
  111. package/src/data/ticker-store.ts +67 -0
  112. package/src/data/ticker-writes.ts +5 -0
  113. package/src/i18n/es.ts +27 -0
  114. package/src/i18n/ja.ts +27 -0
  115. package/src/i18n/ko.ts +27 -0
  116. package/src/i18n/zh-cn.ts +27 -0
  117. package/src/i18n/zh-tw.ts +27 -0
  118. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  119. package/src/market-data/ah-pair.ts +103 -0
  120. package/src/market-data/depositary-pair.ts +6 -2
  121. package/src/market-data/hooks.tsx +33 -2
  122. package/src/market-data/market/change-basis.ts +2 -1
  123. package/src/market-data/market/header-market.ts +11 -0
  124. package/src/market-data/split-terms.ts +28 -0
  125. package/src/plugins/builtin/account-management/footer.ts +1 -1
  126. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  127. package/src/plugins/builtin/account-management/model.ts +1 -0
  128. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  129. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  130. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  131. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  132. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  133. package/src/plugins/builtin/alerts/cli.ts +36 -30
  134. package/src/plugins/builtin/alerts/constants.ts +10 -0
  135. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  136. package/src/plugins/builtin/alerts/format.ts +24 -8
  137. package/src/plugins/builtin/alerts/index.tsx +38 -9
  138. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  139. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  140. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  141. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  142. package/src/plugins/builtin/alerts/types.ts +7 -0
  143. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  144. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  145. package/src/plugins/builtin/analytics/risk-client.ts +26 -13
  146. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  147. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  148. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  149. package/src/plugins/builtin/awards/pane.tsx +7 -3
  150. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  151. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  152. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  153. package/src/plugins/builtin/chart-composer/cli-options.ts +4 -2
  154. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  155. package/src/plugins/builtin/chart-composer/pane.tsx +9 -3
  156. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  157. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  158. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  159. package/src/plugins/builtin/company-kpis/headless.ts +9 -4
  160. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  161. package/src/plugins/builtin/company-kpis/model.ts +38 -8
  162. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  163. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  164. package/src/plugins/builtin/composite/application.ts +14 -0
  165. package/src/plugins/builtin/composite/broker.ts +12 -0
  166. package/src/plugins/builtin/composite/credit.ts +33 -0
  167. package/src/plugins/builtin/composite/crypto.ts +10 -0
  168. package/src/plugins/builtin/composite/earnings.ts +12 -0
  169. package/src/plugins/builtin/composite/filings.ts +13 -0
  170. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  171. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  172. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  173. package/src/plugins/builtin/composite/ownership.ts +23 -0
  174. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  175. package/src/plugins/builtin/composite/quant.ts +15 -0
  176. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  177. package/src/plugins/builtin/composite/screeners.ts +11 -0
  178. package/src/plugins/builtin/composite/shared.ts +11 -0
  179. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  180. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  181. package/src/plugins/builtin/correlation/index.tsx +13 -17
  182. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  183. package/src/plugins/builtin/credit-conditions/series.ts +2 -2
  184. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  185. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  186. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  187. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  188. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  189. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  190. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  191. package/src/plugins/builtin/earnings/board-model.ts +12 -0
  192. package/src/plugins/builtin/earnings/board-table.ts +7 -4
  193. package/src/plugins/builtin/earnings/board.tsx +2 -2
  194. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  195. package/src/plugins/builtin/earnings/headless.ts +7 -4
  196. package/src/plugins/builtin/earnings/highlight.ts +1 -1
  197. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  198. package/src/plugins/builtin/earnings/history-table.ts +4 -3
  199. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  200. package/src/plugins/builtin/econ/calendar-model.ts +18 -0
  201. package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
  202. package/src/plugins/builtin/econ/index.tsx +3 -0
  203. package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
  204. package/src/plugins/builtin/econ-statistics/client.ts +11 -10
  205. package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
  206. package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
  207. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  208. package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
  209. package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
  210. package/src/plugins/builtin/econ-statistics/view.ts +9 -3
  211. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  212. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  213. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  214. package/src/plugins/builtin/exposure/model.ts +10 -0
  215. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  216. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  217. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  218. package/src/plugins/builtin/fx-matrix/index.tsx +23 -5
  219. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  220. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  221. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  222. package/src/plugins/builtin/mna/detail.tsx +67 -6
  223. package/src/plugins/builtin/mna/headless.ts +128 -13
  224. package/src/plugins/builtin/mna/model.ts +219 -16
  225. package/src/plugins/builtin/mna/pane.tsx +34 -6
  226. package/src/plugins/builtin/money-markets/model.ts +14 -5
  227. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  228. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  229. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  230. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  231. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  232. package/src/plugins/builtin/pe-band/client.ts +13 -1
  233. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  234. package/src/plugins/builtin/pe-band/model.ts +63 -10
  235. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  236. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  237. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  238. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  239. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  240. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  241. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  242. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  243. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  244. package/src/plugins/builtin/research/corporate-actions-pane.tsx +5 -1
  245. package/src/plugins/builtin/research/event-model.ts +31 -13
  246. package/src/plugins/builtin/research/headless.ts +8 -1
  247. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  248. package/src/plugins/builtin/sectors/index.tsx +6 -9
  249. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  250. package/src/plugins/builtin/shared/earnings-report.ts +19 -4
  251. package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
  252. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  253. package/src/plugins/builtin/shared/series-cache.ts +3 -0
  254. package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
  255. package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
  256. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  257. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  258. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  259. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  260. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  261. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  262. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  263. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  264. package/src/plugins/builtin/supply-chain/pane.tsx +76 -16
  265. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  266. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  267. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +67 -1
  268. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +31 -16
  269. package/src/plugins/builtin/ticker-detail/overview/model.ts +17 -1
  270. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
  271. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +9 -2
  272. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  273. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  274. package/src/plugins/builtin/time-sales/headless.ts +4 -1
  275. package/src/plugins/builtin/time-sales/pane.tsx +2 -0
  276. package/src/plugins/builtin/time-sales/window.ts +12 -0
  277. package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
  278. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
  279. package/src/plugins/builtin/treasury-daily/client.ts +23 -11
  280. package/src/plugins/builtin/volatility/model.ts +17 -0
  281. package/src/plugins/builtin/volatility/pane.tsx +13 -4
  282. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  283. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  284. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  285. package/src/plugins/builtin/world-venue-map/headless.ts +28 -16
  286. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  287. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  288. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  289. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  290. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  291. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  292. package/src/plugins/catalog-data.ts +20 -0
  293. package/src/plugins/catalog-lazy.ts +51 -0
  294. package/src/plugins/catalog-ui.ts +16 -18
  295. package/src/plugins/host-smoke.ts +5 -2
  296. package/src/portfolio/allocation.ts +79 -19
  297. package/src/portfolio/cash-balances.ts +76 -0
  298. package/src/portfolio/mutations.ts +43 -8
  299. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  300. package/src/renderers/desktop/window-layouts.ts +14 -0
  301. package/src/renderers/dom/data-table/row.tsx +2 -0
  302. package/src/renderers/dom/host/tabs.tsx +57 -8
  303. package/src/renderers/dom/styles.css +13 -5
  304. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  305. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  306. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  307. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  308. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
  309. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  310. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  311. package/src/series/standalone-catalog.ts +5 -4
  312. package/src/series/standalone.ts +13 -7
  313. package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
  314. package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
  315. package/src/sources/gloomberb-cloud/index.ts +14 -3
  316. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  317. package/src/sources/provider-router/financials.ts +20 -13
  318. package/src/sources/provider-router/index.ts +4 -0
  319. package/src/sources/provider-router/search.ts +1 -0
  320. package/src/sync/collections-contributor.ts +3 -1
  321. package/src/sync/config-merge.ts +10 -1
  322. package/src/sync/sanitize.ts +26 -2
  323. package/src/tickers/company-name-listing.ts +16 -2
  324. package/src/tickers/listing-fate.ts +12 -8
  325. package/src/tickers/renamed-listings.ts +43 -10
  326. package/src/tickers/search/home-listing.ts +28 -0
  327. package/src/tickers/search/index.ts +19 -7
  328. package/src/tickers/terminal-codes.ts +11 -1
  329. package/src/time-series/base-series.ts +3 -0
  330. package/src/time-series/ice-credit.ts +1 -0
  331. package/src/time-series/resolve.ts +3 -1
  332. package/src/time-series/spec.ts +2 -2
  333. package/src/time-series/types.ts +2 -1
  334. package/src/types/data-provider.ts +11 -0
  335. package/src/types/financials.ts +39 -3
  336. package/src/types/headless.ts +4 -2
  337. package/src/types/ticker.ts +10 -2
  338. package/src/utils/cli-output.ts +1 -1
  339. package/src/utils/declared-dividends.ts +13 -1
  340. package/src/utils/dividend-cash.ts +5 -1
  341. package/src/utils/forward-dividend.ts +4 -3
  342. package/src/utils/remove-folder.ts +37 -0
  343. package/src/utils/throttled-fetch.ts +15 -1
  344. package/src/utils/trailing-dividend.ts +1 -1
  345. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -8,7 +8,7 @@ import { indexLevelMarketState } from "../../../market-data/market/index-level";
8
8
  import { barSizeFromGap, medianBarGap } from "../../../time-series/bar-spacing";
9
9
  import { apiClient } from "../../../api-client";
10
10
  import { isPerpetualExchange } from "../../../tickers/perpetual-listing";
11
- import { CLOUD_NEWS_DELAY_HOURS, hasProAccess } from "../../../api-client/plan-rules";
11
+ import { hasProAccess } from "../../../api-client/plan-rules";
12
12
  import { savedCopyMark } from "../../../data/saved-copies";
13
13
 
14
14
  /**
@@ -74,7 +74,7 @@ export const REFERENCE_DATA: HeadlessPaneFreshness = { status: "not-a-feed", bas
74
74
  export const REPORTED_DATA: HeadlessPaneFreshness = { status: "not-a-feed", basis: "reported data" };
75
75
 
76
76
  /** What a news list's as-of is: its newest story, not the time it was read. */
77
- export const NEWEST_STORY = "newest story";
77
+ const NEWEST_STORY = "newest story";
78
78
 
79
79
  /** Gloom Cloud's delayed quotes run behind each venue by a lag the app knows (`delayedFeedLagMs`). */
80
80
  const CLOUD_QUOTE_PROVIDER_ID = "gloomberb-cloud";
@@ -163,6 +163,5 @@ export async function cloudRealtimeAccess(): Promise<boolean | null> {
163
163
  export function cloudNewsFreshness(realtime: boolean | null): HeadlessPaneFreshness {
164
164
  const stories: HeadlessPaneFreshness = { observedKey: "publishedAt", oldest: null, asOfLabel: NEWEST_STORY };
165
165
  if (realtime === true) return { ...stories, status: "live" };
166
- if (realtime === false) return { ...stories, status: "delayed", delayMinutes: CLOUD_NEWS_DELAY_HOURS * 60 };
167
166
  return { ...stories, status: "not-a-feed", basis: "published stories" };
168
167
  }
@@ -6,6 +6,9 @@ export interface DatedObservation {
6
6
  value: number | null;
7
7
  /** The day the value was released, when the source says (FRED's newest monthly figure). */
8
8
  releasedOn?: string;
9
+ firstReleased?: string;
10
+ revisedOn?: string;
11
+ firstReleaseValue?: number;
9
12
  }
10
13
 
11
14
  export interface SeriesCacheMetadata {
@@ -80,6 +80,7 @@ export function SeriesDetailChart({
80
80
  reference,
81
81
  resetKey,
82
82
  formatValue,
83
+ formatAxisValue,
83
84
  aboveChartRows = 0,
84
85
  aboveChart,
85
86
  belowChartRows = 0,
@@ -102,6 +103,7 @@ export function SeriesDetailChart({
102
103
  /** A new key drops the user's zoom and pan. */
103
104
  resetKey: string;
104
105
  formatValue: (value: number) => string;
106
+ formatAxisValue?: (value: number) => string;
105
107
  /** Rows kept for `aboveChart`, drawn between the figures and a drawable chart. */
106
108
  aboveChartRows?: number;
107
109
  aboveChart?: (chartWidth: number) => ReactNode;
@@ -159,6 +161,7 @@ export function SeriesDetailChart({
159
161
  viewportResetKey={resetKey}
160
162
  onViewportChange={setUserViewport}
161
163
  formatValue={(value) => formatValue(value)}
164
+ formatAxisValue={formatAxisValue}
162
165
  emptyMessage="Not enough chart data"
163
166
  />
164
167
  </>
@@ -16,7 +16,7 @@ import { colors } from "../../../theme/colors";
16
16
  import type { PaneProps } from "../../../types/plugin";
17
17
  import { Box, TextAttributes } from "../../../ui";
18
18
  import { formatShortDate } from "../../../utils/datetime-format";
19
- import { MISSING_VALUE, formatCompact, formatNumber } from "../../../utils/format";
19
+ import { MISSING_VALUE, displayWidth, formatCompact, formatNumber } from "../../../utils/format";
20
20
  import { nextHeaderSort, type SortDirection } from "../../../utils/sort-values";
21
21
  import { shortInterestPublicationSegments } from "./schedule";
22
22
  import { loadShortWatch } from "./watch-client";
@@ -55,6 +55,7 @@ const COLUMNS: WatchColumn[] = [
55
55
  ];
56
56
  const DEFAULT_SORT = { columnId: "setup" as ShortWatchSortId, direction: "desc" as SortDirection };
57
57
  const rowKey = (row: ShortWatchRow) => row.symbol;
58
+ const rowSetup = (row: ShortWatchRow) => row.error ?? (row.return1M == null ? "No month of daily closes" : setupLabel(row.setup));
58
59
 
59
60
  const day = (iso: string | null) => iso ? formatShortDate(`${iso}T00:00:00Z`, { year: false, utc: true, fallback: MISSING_VALUE }) : MISSING_VALUE;
60
61
  const signed = (value: number | null, digits = 1) => value == null ? MISSING_VALUE : `${value > 0 ? "+" : ""}${formatNumber(value, digits)}%`;
@@ -87,21 +88,19 @@ export function ShortWatchPane({ width, height, focused }: Pick<PaneProps, "widt
87
88
  // A date every row shares moves to the query bar; a column no row fills is left out.
88
89
  const settled = useMemo(() => sharedDate(rows, "settlementDate"), [rows]);
89
90
  const closed = useMemo(() => sharedDate(rows, "closeDate"), [rows]);
90
- const columns = useMemo(() => COLUMNS.filter((column) => !(column.id === "settlementDate" && settled)
91
+ const columns = useMemo(() => COLUMNS.map((column) => column.id === "setup"
92
+ ? { ...column, width: Math.max(column.width, ...rows.map((row) => Math.min(32, displayWidth(rowSetup(row))))) } : column)
93
+ .filter((column) => !(column.id === "settlementDate" && settled)
91
94
  && !(column.id === "closeDate" && closed)
92
95
  && !(column.id === "percentFloat" && rows.length > 0 && rows.every((row) => row.percentFloat == null))), [rows, settled, closed]);
93
96
  const [selected, setSelected] = usePluginPaneState<string | null>("short-watch:selected", null);
94
97
 
95
- const unreported = rows.filter((row) => !row.settlementDate).map((row) => row.symbol);
96
- const unpriced = rows.filter((row) => row.settlementDate && row.return1M == null).map((row) => row.symbol);
97
98
  usePaneNoticeFooter({
98
99
  registrationId: "short-watch-notices",
99
100
  focused,
100
101
  notices: [
101
102
  universe.symbols.length ? universe.notice : null,
102
103
  resource.data ? resource.error : null,
103
- unreported.length ? `No short interest settlement for ${unreported.join(", ")}.` : null,
104
- unpriced.length ? `No month of daily closes for ${unpriced.join(", ")}.` : null,
105
104
  ].filter((value): value is string => !!value),
106
105
  });
107
106
  // When the newest settlement listed was published and the next is due, as `fn SIW` dates it.
@@ -119,7 +118,8 @@ export function ShortWatchPane({ width, height, focused }: Pick<PaneProps, "widt
119
118
  const renderCell = useCallback((row: ShortWatchRow, column: WatchColumn): DataTableCell => {
120
119
  switch (column.id) {
121
120
  case "symbol": return { text: row.symbol, color: colors.textBright, attributes: TextAttributes.BOLD };
122
- case "setup": return { text: setupLabel(row.setup), color: row.setup === "crowded-rising" ? colors.warning : colors.textDim };
121
+ case "setup": return { text: rowSetup(row),
122
+ color: row.error || row.return1M == null || row.setup === "crowded-rising" ? colors.warning : colors.textDim };
123
123
  case "percentFloat": return { text: row.percentFloat == null ? MISSING_VALUE : `${formatNumber(row.percentFloat, 1)}%`,
124
124
  color: row.setup ? colors.textBright : colors.text, value: row.percentFloat ?? undefined };
125
125
  case "daysToCover": return { text: row.daysToCover == null ? MISSING_VALUE : formatNumber(row.daysToCover, 1), value: row.daysToCover ?? undefined };
@@ -1,8 +1,8 @@
1
1
  import { apiClient } from "../../../api-client";
2
- import type { SupplyChainPayload, SupplyEntity, SupplyEvidenceItem, SupplyOptions, SupplyRow } from "../../../api-client/supply-chain";
2
+ import type { SupplyChainPayload, SupplyEntity, SupplyEvidenceItem, SupplyOptions, SupplyRead, SupplyRow } from "../../../api-client/supply-chain";
3
3
  import { createPluginCache } from "../../../data/plugin-cache";
4
4
  import { batchReplyItems, cachedCloudResource, createCloudBatchAhead, loadCloudResource, unavailableOnServer } from "../shared/cloud-resource";
5
- import { activeRelationship, canShowQuote, isUnconfirmed, publicEvidence, supplyOptions, TIER_OPTIONS, trustTier } from "./trust";
5
+ import { activeRelationship, canShowQuote, evidenceDate, isUnconfirmed, publicEvidence, supplyOptions, TIER_OPTIONS, trustTier } from "./trust";
6
6
 
7
7
  export const SUPPLY_UNAVAILABLE = "Supply chain disclosures are not available yet.";
8
8
  const SUPPLY_ROLES = ["customer", "supplier", "partner", "competitor", "investee"] as const;
@@ -45,7 +45,8 @@ export function validSupplyEntity(value: SupplyEntity): boolean {
45
45
  export function validSupplyRow(value: SupplyRow): boolean {
46
46
  return !!value && text(value.id) && validSupplyEntity(value.counterparty) && validSupplyEntity(value.reportingEntity)
47
47
  && SUPPLY_ROLES.includes(value.role) && ["in", "out", "mutual"].includes(value.direction)
48
- && nullableText(value.pctScope) && nullableNumber(value.pctOfRevenue) && (value.pctOfRevenue === null || value.pctOfRevenue <= 100)
48
+ && nullableText(value.pctScope) && [undefined, null, "total", "segment"].includes(value.pctScopeBasis)
49
+ && nullableNumber(value.pctOfRevenue) && (value.pctOfRevenue === null || value.pctOfRevenue <= 100)
49
50
  && [null, "revenue", "receivables", "cost", "purchases"].includes(value.pctBasis)
50
51
  && nullableNumber(value.usd) && [null, "disclosed", "derived"].includes(value.usdBasis)
51
52
  && (value.nativeAmount == null || nonnegative(value.nativeAmount))
@@ -70,7 +71,10 @@ export function validSupplyRow(value: SupplyRow): boolean {
70
71
  && (value.whyUnconfirmed === undefined || nullableText(value.whyUnconfirmed))
71
72
  && (value.evidence === undefined || Array.isArray(value.evidence) && value.evidence.every(evidence));
72
73
  }
73
- export function normalizeSupplyRow(value: SupplyRow): SupplyRow {
74
+ export function normalizeSupplyRow(input: SupplyRow): SupplyRow {
75
+ // A share basis a server sends as null is no basis read yet, as an absent one is.
76
+ const { pctScopeBasis, ...rest } = input;
77
+ const value: SupplyRow = pctScopeBasis == null ? rest : input;
74
78
  const items = value.evidence?.map(publicEvidence);
75
79
  const unconfirmed = isUnconfirmed(value) || !activeRelationship(value);
76
80
  // Restrict again before cache, exports or screenshot metadata, even if a server regresses.
@@ -105,14 +109,35 @@ export function validateSupplyChain(data: SupplyChainPayload): SupplyChainPayloa
105
109
  return { ...data, entity: data.entity ? normalizeEntity(data.entity) : null, says: data.says.map(normalizeSupplyRow), names: data.names.map(normalizeSupplyRow),
106
110
  ...(data.earlier ? { earlier: { says: data.earlier.says.map(normalizeSupplyRow), names: data.earlier.names.map(normalizeSupplyRow) } } : {}) };
107
111
  }
108
- export async function fetchSupplyChain(symbol: string, client: Pick<typeof apiClient, "getCloudSupplyChain"> = apiClient, options: SupplyOptions = {}) {
109
- try { return validateSupplyChain(await client.getCloudSupplyChain(symbol, options)); }
112
+ /** A server that answered a cutoff (`asOf`) with disclosures published after it, which it does not read. */
113
+ class AsOfUnsupportedError extends Error {
114
+ constructor(readonly asOf: string) {
115
+ super(`Gloom Cloud does not read --as-of ${asOf} yet: it answered with disclosures published after that day, so none are shown.`);
116
+ this.name = "AsOfUnsupportedError";
117
+ }
118
+ }
119
+
120
+ /**
121
+ * The disclosures known by `asOf` (YYYY-MM-DD): a server that reads the
122
+ * cutoff sends none published after it, and one that answers with any never
123
+ * has them shown as that day's (AsOfUnsupportedError).
124
+ */
125
+ function knownBy(data: SupplyChainPayload, asOf: string | undefined): SupplyChainPayload {
126
+ if (!asOf) return data;
127
+ const rows = [...data.says, ...data.names, ...data.earlier?.says ?? [], ...data.earlier?.names ?? []];
128
+ if (rows.some((row) => evidenceDate(row) > asOf)) throw new AsOfUnsupportedError(asOf);
129
+ return data;
130
+ }
131
+ export async function fetchSupplyChain(symbol: string, client: Pick<typeof apiClient, "getCloudSupplyChain"> = apiClient, options: SupplyRead = {}) {
132
+ let data: SupplyChainPayload;
133
+ try { data = validateSupplyChain(await client.getCloudSupplyChain(symbol, options)); }
110
134
  catch (error) { throw unavailableOnServer(error, SUPPLY_UNAVAILABLE, [404, 503]); }
135
+ return knownBy(data, options.asOf);
111
136
  }
112
137
  // Account and plan belong in the key: signing out must never reveal a paid cached response.
113
- const cacheKey = (symbol: string, access: string, options: SupplyOptions) => `${symbol.toUpperCase()}:${access}:${JSON.stringify(supplyOptions(options.tiers))}:${!!options.includeLeads}`;
114
- export const cachedSupplyChain = (symbol: string, access: string, options: SupplyOptions = {}) => cachedCloudResource(supplyChainCache, cacheKey(symbol, access, options), validateSupplyChain);
115
- export const loadSupplyChain = (symbol: string, access: string, force = false, options: SupplyOptions = {}) => loadCloudResource(supplyChainCache, cacheKey(symbol, access, options), () => fetchSupplyChain(symbol, apiClient, options), { force, validate: validateSupplyChain });
138
+ const cacheKey = (symbol: string, access: string, options: SupplyRead) => `${symbol.toUpperCase()}:${access}:${JSON.stringify(supplyOptions(options.tiers))}:${!!options.includeLeads}${options.asOf ? `:${options.asOf}` : ""}`;
139
+ export const cachedSupplyChain = (symbol: string, access: string, options: SupplyRead = {}) => cachedCloudResource(supplyChainCache, cacheKey(symbol, access, options), validateSupplyChain);
140
+ export const loadSupplyChain = (symbol: string, access: string, force = false, options: SupplyRead = {}) => loadCloudResource(supplyChainCache, cacheKey(symbol, access, options), () => fetchSupplyChain(symbol, apiClient, options), { force, validate: validateSupplyChain });
116
141
  /** Symbols per disclosures batch request: a ripple's sixty holdings are two, read sixteen at a time on the server. */
117
142
  const SUPPLY_BATCH_MAX = 30;
118
143
  const supplyChainsAheadByOptions = new Map<string, ReturnType<typeof createCloudBatchAhead<SupplyChainPayload>>>();
@@ -4,7 +4,7 @@ import type { PaneScreenshotEvidenceHook } from "../../../cli/pane-functions/scr
4
4
  import { useRemoteUiNode } from "../../../remote/semantic-tree";
5
5
  import { isRecord } from "../../../utils/guards";
6
6
  import { fetchSupplyChain, validateSupplyChain } from "./client";
7
- import { earlierRows } from "./model";
7
+ import { earlierRows, openingSupplyView } from "./model";
8
8
  import { isUnconfirmed, matchesSupplyOptions, supplyOptions } from "./trust";
9
9
  import { fetchSupplyGraph, graphOptions, validateGraph } from "./graph-client";
10
10
 
@@ -80,7 +80,8 @@ export const supplyScreenshotEvidence: PaneScreenshotEvidenceHook<SupplyEvidence
80
80
  if (resolved.options.evidence === true && (!evidence.evidenceOpen || !evidence.evidenceId)) mismatches.push("Supply chain evidence detail was not opened");
81
81
  if (evidence.tab !== (resolved.options.tab ?? "table")) mismatches.push("Supply chain tab does not match");
82
82
  if (!graphTab(evidence.tab)) {
83
- if (evidence.view !== (resolved.options.view ?? "says")) mismatches.push("Supply chain direction does not match");
83
+ const view = resolved.options.view ?? openingSupplyView(evidence.payload as SupplyChainPayload, supplyOptions(resolved.options.tiers));
84
+ if (evidence.view !== view) mismatches.push("Supply chain direction does not match");
84
85
  if (JSON.stringify(evidence.tiers) !== JSON.stringify(supplyOptions(resolved.options.tiers).tiers)) mismatches.push("Supply chain evidence tiers do not match");
85
86
  }
86
87
  return mismatches;
@@ -13,7 +13,7 @@ import { useThemeColors } from "../../../theme/theme-context";
13
13
  import { useSelectionFill } from "../../../components/ui/selection-fill";
14
14
  import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
15
15
  import { fillOpaque, fillRect, parseHex } from "../../../components/chart/native/raster/primitives";
16
- import { counterpartyKind, counterpartyKindLabel, counterpartyLabel, disclosedValue, dollars, isRelatedParty, nativeValue, periodText, relationshipLabel, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
16
+ import { counterpartyKind, counterpartyKindLabel, counterpartyLabel, counterpartyLabelEnd, disclosedValue, dollars, isRelatedParty, nativeValue, periodText, relationshipLabel, roleLabel, ROLE_COLORS, scopeWords, shareParts, fitShareBasis, type FlowBand, type ShareParts } from "./model";
17
17
  import { entityTicker } from "./graph-model";
18
18
  import { flowChipLabel, flowGeometry, RELATED_LABEL_CELLS, ribbonY, type FlowRibbon, type PositionedNode } from "./flow-layout";
19
19
  import { evidenceDate, evidenceLabel, trustTier } from "./trust";
@@ -333,7 +333,8 @@ function FlowCard({ node, focusId, desktop, active, onPress, onHover }: {
333
333
  {/* The ticker shows only beside the whole name. On the desktop that is CSS: the row wraps, one line shows, and a ticker that does not fit goes to the hidden line. */}
334
334
  <Box flexDirection="row" height={1} overflow="hidden" style={desktop ? { flexWrap: "wrap" } : undefined}>
335
335
  {!desktop ? <Text fg={node.more ? colors.textMuted : accent}>▍</Text> : null}
336
- <ClippedText fg={active && !desktop ? chosenText(titleColor) : titleColor} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
336
+ <ClippedText fg={active && !desktop ? chosenText(titleColor) : titleColor} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth}
337
+ keepEnd={node.row && !node.more ? counterpartyLabelEnd(node.row) : null} />
337
338
  {ticker && (desktop || displayWidth(name) + displayWidth(ticker) + 1 <= inner)
338
339
  ? <Text fg={active && !desktop ? selectionFill.ink(colors.textDim) : colors.textDim} style={desktop ? { flex: "0 0 auto" } : undefined}>{` ${ticker}`}</Text> : null}
339
340
  </Box>
@@ -377,7 +378,7 @@ function FlowTooltip({ node, focusId, width, desktop, anchor }: { node: Position
377
378
  flexDirection="column" paddingX={1} backgroundColor={desktop ? undefined : colors.panel} border={!desktop} borderColor={ROLE_COLORS[row.role]}
378
379
  style={desktop ? { ...TOOLTIP_SURFACE_STYLE, padding: "0 var(--gloom-space-sm)", zIndex: 20 } : undefined}
379
380
  data-gloom-role="supply-flow-tooltip">
380
- <ClippedText fg={colors.textBright} attributes={TextAttributes.BOLD} text={counterpartyLabel(row)} width={tooltipWidth - 2} />
381
+ <ClippedText fg={colors.textBright} attributes={TextAttributes.BOLD} text={counterpartyLabel(row)} width={tooltipWidth - 2} keepEnd={counterpartyLabelEnd(row)} />
381
382
  {lines.map((line, index) => <ClippedText key={index} fg={index === 0 ? colors.text : colors.textDim} text={line} width={tooltipWidth - 2} />)}
382
383
  </Box>;
383
384
  }
@@ -1,17 +1,24 @@
1
1
  import { MISSING_VALUE } from "../../../utils/format";
2
2
  import type { SupplyEntity } from "../../../api-client/supply-chain";
3
3
  import type { GraphPath, GraphPayload } from "../../../api-client/supply-chain-graph";
4
- import { getListingSymbol } from "../../../sources/listing-symbols";
5
- import { isUsListingExchange, publicTickerKey } from "../../../utils/exchanges";
4
+ import { hongKongListingCode, listingSuffixVenue } from "../../../sources/listing-symbols";
5
+ import { canonicalExchange, canonicalTickerKey, isUsListingExchange, publicTickerKey } from "../../../utils/exchanges";
6
6
 
7
7
  export const entityKey = (entity: SupplyEntity) => entity.ticker ? publicTickerKey(entity.ticker, entity.exchange ?? undefined) : `id:${entity.id}`;
8
8
  /**
9
- * The ticker as shown and typed to open it: a US listing bare, any other with
10
- * its venue's suffix, so Standard Chartered reads STAN.L and never a bare STAN
11
- * that a US company could hold.
9
+ * The ticker as shown and typed to open it, as every other function writes a
10
+ * listing: a US listing bare, any other with its venue (`STAN:LSE`,
11
+ * `0941:HKEX`), never a bare STAN that a US company could hold. A ticker served
12
+ * with a vendor's venue suffix (`600028.SS`, `000063.SZ`) is read as its venue's
13
+ * listing (`600028:SSE`, `000063:SZSE`).
12
14
  */
13
- export const entityTicker = (entity: Pick<SupplyEntity, "ticker" | "exchange">) =>
14
- entity.ticker && entity.exchange && !isUsListingExchange(entity.exchange) ? getListingSymbol(entity.ticker, entity.exchange) : entity.ticker;
15
+ export const entityTicker = (entity: Pick<SupplyEntity, "ticker" | "exchange">): string | null => {
16
+ if (!entity.ticker) return entity.ticker;
17
+ const suffixed = listingSuffixVenue(entity.ticker, entity.exchange ?? undefined);
18
+ const symbol = suffixed?.symbol ?? entity.ticker;
19
+ const exchange = suffixed?.exchange ?? entity.exchange;
20
+ return exchange && !isUsListingExchange(exchange) ? canonicalTickerKey(hongKongListingCode(symbol, canonicalExchange(exchange)), exchange) : symbol;
21
+ };
15
22
  export const entityLabel = (entity: SupplyEntity) => entityTicker(entity) ?? entity.name;
16
23
  /**
17
24
  * A trade link whose every disclosure is a related-party (connected) trade,
@@ -166,7 +166,9 @@ export function SupplyGraphPane({ symbol, tab, width, height, focused }: { symbo
166
166
  info: data?.asOf ? [{ id: "as-of", parts: [{ text: `as of ${data.asOf}`, tone: "muted" }] }] : [] });
167
167
  usePaneNoticeFooter({ registrationId: "supply-graph:notices", focused, notices: [...(resource.data?.refreshError ? [resource.data.refreshError] : []),
168
168
  ...(data && !data.search.complete ? [`Search limited: ${data.search.reasons.join(", ").replaceAll("_", " ")}. Narrow filters or reduce depth to inspect more routes.`] : []),
169
- ...(data?.access === "preview" ? [`Pro preview: depth ${data.options.depth}. Upgrade for four hops and the full graph.`] : [])] });
169
+ ...(data?.access === "preview" ? [`Pro preview: depth ${data.options.depth}. Upgrade for four hops and the full graph.`] : []),
170
+ // A cutoff the server did not read (the free preview always reads the latest snapshot) is said, never drawn as that day's.
171
+ ...(data && options.asOf && data.options.asOf !== options.asOf ? ["Filing cutoff needs Gloom Pro; showing the latest disclosures."] : [])] });
170
172
  useRemoteUiNode({ role: "chart-data", label: "Rendered supply chain graph", getMetadata: () => ({ kind: "supply-chain", version: 1, complete: !!data, ready: !!data, plottedValueCount: tab === "graph" ? visibleLinks.length : paths.length, payload: data, tab, evidenceOpen: !!openPath, evidenceId: openPath?.id ?? null, rowIds: tab === "graph" ? visibleLinks : paths.map(path => path.id) }) });
171
173
  const filters: QueryBarFilter[] = [
172
174
  { id: "target", kind: "text", label: "To", value: targetDraft, placeholder: "Ticker or id:123", onChange: setTargetDraft, onSubmit: applyTarget, focused, active: targetActive, onActiveChange: setTargetActive, width: 16 },
@@ -15,7 +15,7 @@ import { cardSurfaceStyle } from "../../../components/ui/card";
15
15
  import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
16
16
  import { drawLine, fillOpaque, parseHex } from "../../../components/chart/native/raster/primitives";
17
17
  import { entityLabel, entityTicker, graphNodes, relatedPartyLink } from "./graph-model";
18
- import { ROLE_COLORS } from "./model";
18
+ import { counterpartyLabel, counterpartyLabelEnd, ROLE_COLORS } from "./model";
19
19
  import { blendHex } from "../../../theme/colors";
20
20
 
21
21
  export function SupplyGraph({ data, width, height, focused, selectedId, selectedPath, collapsed, onSelect, onRecenter, onVisible }: {
@@ -144,7 +144,9 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
144
144
  const tickerWidth = ticker ? displayWidth(ticker) + 3 : 0;
145
145
  const showTicker = company && tickerWidth > 0 && inner >= tickerWidth + 5;
146
146
  const prefix = collapsed.includes(node.entity.id) ? "+ " : "";
147
- const name = prefix + (showTicker ? node.entity.name : entityLabel(node.entity));
147
+ // An undisclosed customer or a cohort reads as the table and the flow name it ("Customer 1"), its letter or number kept.
148
+ const label = company ? null : { counterparty: node.entity, pctBasis: null };
149
+ const name = prefix + (showTicker ? node.entity.name : label ? counterpartyLabel(label) : entityLabel(node.entity));
148
150
  const nameWidth = inner - (showTicker ? tickerWidth : 0);
149
151
  // A related-party trade with the company before it on the path reads as one, never as a plain supplier or customer.
150
152
  const link = node.path ? data.links.find(entry => entry.id === node.path!.linkIds.at(-1)) : undefined;
@@ -160,7 +162,8 @@ export function SupplyGraph({ data, width, height, focused, selectedId, selected
160
162
  <Box flexDirection="column" width="100%">
161
163
  <Box flexDirection="row" height={1} gap={desktop ? 1 : 0} overflow="hidden">
162
164
  {!desktop ? <Text fg={accent}>▍</Text> : null}
163
- <ClippedText fg={active && !desktop ? chosenText(company ? colors.textBright : colors.textDim) : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth} />
165
+ <ClippedText fg={active && !desktop ? chosenText(company ? colors.textBright : colors.textDim) : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0} text={name} width={nameWidth}
166
+ keepEnd={label ? counterpartyLabelEnd(label) : null} />
164
167
  {showTicker ? desktop ? <Badge label={ticker!} tone="accent" /> : <Text fg={active ? chosenText(colors.textDim) : colors.textDim}>{` ${ticker}`}</Text> : null}
165
168
  </Box>
166
169
  <Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden"><ClippedText fg={active && !desktop ? chosenText(colors.textDim) : colors.textDim} text={detail} width={inner} /></Box>
@@ -146,13 +146,21 @@ export const supplyChainHeadless: HeadlessPaneDefinition<"bundle"> = {
146
146
  ],
147
147
  describe: (args) => `Supply chain | ${args.symbols[0]}${args.options.to ? ` → ${args.options.to}` : ""}`,
148
148
  async load(args, ctx) {
149
+ const asOfOption = args.options.asOf ?? args.options["as-of"];
150
+ const asOf = typeof asOfOption === "string" && asOfOption ? asOfOption : undefined;
149
151
  if (args.options.tab === "graph" || args.options.tab === "path") {
150
152
  const target = String(args.options.to ?? "").trim();
151
153
  if (args.options.tab === "path" && !target) throw new Error("Path requires a target company: --to TICKER");
152
- return graphReport(await fetchSupplyGraph(args.symbols[0]!, graphOptions(args.options), target, ctx.apiClient), target);
154
+ const graph = await fetchSupplyGraph(args.symbols[0]!, graphOptions(args.options), target, ctx.apiClient);
155
+ // The free preview reads the graph's latest snapshot whatever the cutoff: said, never served as if it were that day's.
156
+ if (asOf && graph.options.asOf !== asOf) {
157
+ throw new Error(`--as-of ${asOf} on the ${args.options.tab === "path" ? "Path" : "Graph"} tab needs Gloom Pro; the free preview reads the latest disclosures. `
158
+ + `The Table tab reads it for everyone: gloom fn SPLC ${args.symbols[0]} --as-of ${asOf}`);
159
+ }
160
+ return graphReport(graph, target);
153
161
  }
154
162
  const options = supplyOptions(args.options.tiers);
155
- const data = await fetchSupplyChain(args.symbols[0]!, ctx.apiClient, options);
163
+ const data = await fetchSupplyChain(args.symbols[0]!, ctx.apiClient, { ...options, ...asOf ? { asOf } : {} });
156
164
  const sources = new Map<HeadlessPaneRow, SupplyRow>();
157
165
  const sourced = (source: SupplyRow, row: HeadlessPaneRow) => { sources.set(row, source); return row; };
158
166
  // The pane's figures, per tab: Table shows one direction, Flow both.
@@ -193,10 +201,17 @@ export const supplyChainHeadless: HeadlessPaneDefinition<"bundle"> = {
193
201
  const locked = lockedDisclosures(data, views);
194
202
  const truncated = data.truncated && (!requested || locked > 0);
195
203
  // A company with no relationship at all says what SPLC reads and where else to look, not that it is "not covered".
196
- const none = sections.every((section) => !section.rows?.length) ? supplyEmptyText(data, (symbol) => `fn SPLC ${symbol}`) : null;
204
+ const none = !sections.every((section) => !section.rows?.length) ? null
205
+ : asOf && data.status === "available" ? `No relationship of ${data.symbol}'s was disclosed by ${asOf}.`
206
+ : asOf ? `No relationship of ${data.symbol}'s was disclosed by ${asOf}; ${supplyEmptyText(data, (symbol) => `fn SPLC ${symbol}`)}`
207
+ : supplyEmptyText(data, (symbol) => `fn SPLC ${symbol}`);
208
+ // Dated by the newest disclosure shown, as each row's Published says, never by the latest period one covers: a
209
+ // filing published on 29 Oct about June is known from 29 Oct.
210
+ const published = [...sources.values()].map(evidenceDate).sort().at(-1) ?? null;
197
211
  return { complete: !truncated, errors: truncated ? [data.access === "preview" ? supplyPreviewNote(data, locked) : "Additional relationships need Gloom Pro"] : [],
198
212
  sections, ...(none && !requested ? { empty: none } : {}),
199
- metadata: { symbol: data.symbol, asOf: data.asOf, view: requested ?? "both", counterparties: figures("counterparties"), locked: figures("locked"),
213
+ metadata: { symbol: data.symbol, asOf: published, latestPeriod: data.asOf, ...asOf ? { knownBy: asOf } : {},
214
+ view: requested ?? "both", counterparties: figures("counterparties"), locked: figures("locked"),
200
215
  counts: data.counts, earlierCounts: data.earlierCounts ?? null, tierCounts: data.tierCounts, tiers: options.tiers, disclaimer: data.disclaimer } };
201
216
  },
202
217
  };
@@ -20,16 +20,23 @@ export const ROLE_COLORS: Readonly<Record<SupplyRole, string>> = currentThemeCol
20
20
 
21
21
  /** A company, a customer the filer does not name, or a geographic or channel cohort that is not one company. */
22
22
  export type CounterpartyKind = "company" | "undisclosed" | "group";
23
- export const counterpartyKind = (row: SupplyRow): CounterpartyKind =>
23
+ export const counterpartyKind = (row: Pick<SupplyRow, "counterparty">): CounterpartyKind =>
24
24
  row.counterparty.aggregate ? "group" : row.counterparty.anonymous ? "undisclosed" : "company";
25
25
 
26
26
  const GENERIC_WORDS = /\b(And|Of|The|Based|End|Customers?|Suppliers?|Vendors?|Channel|Partners?|Undisclosed|Other|Carriers?|Networks?|Cellular|Distributors?|Retailers?)\b/g;
27
27
 
28
+ /**
29
+ * The measure a filer spells into an undisclosed customer's member ("Revenue Customer 1", "A/R Customer A"), which
30
+ * the share beside it already names: the label keeps what tells the customers apart.
31
+ */
32
+ const MEASURE_PREFIX = /^(?:revenues?|net sales|sales|a\/r|ar|accounts receivables?|receivables?|trade receivables?)\s+(?=(?:customer|client|supplier|vendor)\b)/i;
33
+
28
34
  /** The counterparty's name without the kind spelled into it; the kind travels as its own label. */
29
- export function counterpartyLabel(row: SupplyRow): string {
35
+ export function counterpartyLabel(row: Pick<SupplyRow, "counterparty" | "pctBasis">): string {
30
36
  const kind = counterpartyKind(row);
31
37
  if (kind === "company") return row.counterparty.name;
32
- const name = counterpartyName(row).replace(/^Group: /, "").replace(/\s*\(undisclosed\)$/i, "");
38
+ const name = counterpartyName(row).replace(/^Group: /, "").replace(/\s*\(undisclosed\)$/i, "")
39
+ .replace(row.pctBasis ? MEASURE_PREFIX : /^$/, "");
33
40
  // Cohort labels arrive in title case from XBRL member names; generic words read lower case, names keep theirs.
34
41
  return name.replace(GENERIC_WORDS, (word) => word.toLowerCase()).replace(/^./, (first) => first.toUpperCase());
35
42
  }
@@ -54,8 +61,26 @@ export const counterpartyKindLabel = (row: SupplyRow, short = false) => {
54
61
  if (isRelatedParty(row)) return namedGroup(row) ? short ? "related group" : "related-party group" : "related party";
55
62
  return namedGroup(row) ? short ? "group" : "corporate group" : null;
56
63
  };
64
+ /**
65
+ * A row's role as the company it is read for sees it. An investee row runs
66
+ * from the holder to the company held, so read inbound its counterparty is
67
+ * the holder: Sinopec, whose interim report holds CATL shares, is CATL's
68
+ * investor, not its investee.
69
+ */
70
+ export const rowRoleLabel = (row: Pick<SupplyRow, "role"> & { direction?: SupplyRow["direction"] }) =>
71
+ row.role === "investee" && row.direction === "in" ? "Investor" : roleLabel(row.role);
57
72
  /** The relationship in words: "Related-party supplier" for a related-party trade, else the role. */
58
- export const relationshipLabel = (row: Pick<SupplyRow, "role" | "relatedParty">) => isRelatedParty(row) ? `Related-party ${row.role}` : roleLabel(row.role);
73
+ export const relationshipLabel = (row: Pick<SupplyRow, "role" | "relatedParty"> & { direction?: SupplyRow["direction"] }) =>
74
+ isRelatedParty(row) ? `Related-party ${rowRoleLabel(row).toLowerCase()}` : rowRoleLabel(row);
75
+
76
+ /**
77
+ * The end of a counterparty's label that tells it apart, which a narrow column keeps whole while it cuts what comes
78
+ * before: the letter or number of an undisclosed customer ("Customer 1", "Customer A"). Null for a company's name.
79
+ */
80
+ export function counterpartyLabelEnd(row: Pick<SupplyRow, "counterparty" | "pctBasis">): string | null {
81
+ if (counterpartyKind(row) !== "undisclosed") return null;
82
+ return / (?:\d{1,3}|[A-Z]|One|Two|Three|Four|Five|Six)$/i.exec(counterpartyLabel(row))?.[0] ?? null;
83
+ }
59
84
 
60
85
  /** A filer's segment or product scope in plain words: "Compute And Networking Segment" reads "Compute & Networking". */
61
86
  export function scopeWords(scope: string): string {
@@ -107,6 +132,15 @@ export function shareParts(row: SupplyRow, focusId?: string | null, { includeRep
107
132
  if (row.sourceKind === "xbrl" && scope) {
108
133
  if (taggedDimension(row, "ProductOrService"))
109
134
  return shareWords(value, [`of ${reporter}total ${basis} (${lowerFirst(scope)} sales)${owed}`, `of ${reporter}total ${basis}`, `${reporter}${basis}`]);
135
+ // A segment tag says where the revenue comes from or whose revenue it is a share of; the filing's sentence says
136
+ // which (`pctScopeBasis`): NVDA's 16% is of total revenue, from Compute & Networking; RPM's 24% of Consumer's own.
137
+ if (row.pctScopeBasis === "total")
138
+ return shareWords(value, [`of ${reporter}total ${basis}, from ${scope}${owed}`, `of ${reporter}total ${basis}`, `${reporter}${basis}`]);
139
+ if (row.pctScopeBasis === "segment")
140
+ return shareWords(value, [`of ${reporter}${scope} ${basis}${owed}`, `of ${reporter}segment ${basis}`, `${reporter}segment ${basis}`]);
141
+ // A segment tag not yet read is said as a tag, never as the share's base.
142
+ if (taggedDimension(row, "BusinessSegments") || /segment/i.test(row.pctScope ?? ""))
143
+ return shareWords(value, [`of ${reporter}${basis}, tagged ${scope}${owed}`, `of ${reporter}${basis}`, `${reporter}${basis}`]);
110
144
  return shareWords(value, [`of ${reporter}${basis} (${scope})${owed}`, `${reporter}${basis}`]);
111
145
  }
112
146
  const scoped = `${scope ? `${scope} ` : ""}${basis}`;
@@ -151,7 +185,7 @@ export function disclosureText(row: SupplyRow): string {
151
185
  .filter((part): part is string => !!part).join(", ") || "Tagged in the filing";
152
186
  }
153
187
 
154
- export function counterpartyName(row: SupplyRow): string {
188
+ export function counterpartyName(row: Pick<SupplyRow, "counterparty">): string {
155
189
  if (row.counterparty.aggregate) return `Group: ${row.counterparty.name.replace(/^Undisclosed customer \((.+)\)$/i, "$1")}`;
156
190
  if (!row.counterparty.anonymous) return row.counterparty.name;
157
191
  const name = row.counterparty.name;
@@ -220,6 +254,16 @@ export function supplyRoleCounts(data: Pick<SupplyChainPayload, "says" | "names"
220
254
  */
221
255
  export const earlierRows = (data: Pick<SupplyChainPayload, "earlier">, view: "says" | "names"): SupplyRow[] => data.earlier?.[view] ?? [];
222
256
 
257
+ /**
258
+ * The direction a table opens on before one is chosen: what the company says,
259
+ * unless its own reports name no one and others' name it (CATL: none of its
260
+ * own, ten from customers, competitors and a holder), not an empty table.
261
+ */
262
+ export function openingSupplyView(data: Pick<SupplyChainPayload, "says" | "names" | "earlier">, options: Required<SupplyOptions>): "says" | "names" {
263
+ const shown = (rows: SupplyRow[]) => rows.some((row) => matchesSupplyOptions(row, options));
264
+ return !shown(data.says) && !shown(earlierRows(data, "says")) && shown(data.names) ? "names" : "says";
265
+ }
266
+
223
267
  /** Disclosures a free preview withholds from these views: the server's counts less the rows it sent. */
224
268
  export function lockedDisclosures(data: Pick<SupplyChainPayload, "says" | "names" | "counts" | "earlier" | "earlierCounts">, views: readonly ("says" | "names")[]): number {
225
269
  const total = (counts: Record<SupplyRole, number> | undefined) => Object.values(counts ?? {}).reduce((a, b) => a + b, 0);
@@ -347,7 +391,7 @@ export const periodText = (row: Pick<SupplyRow, "period" | "periodMonths">) => {
347
391
  export const sourceLabel = (row: SupplyRow) => row.sourceKind === "xbrl" ? "XBRL" : row.sourceKind === "filing_text" ? row.form ?? "Filing" : row.sourceKind === "call" ? "Call" : row.sourceKind === "news" ? "News" : row.sourceKind === "press_release" ? "Release" : row.sourceKind === "web" ? "Web" : "Disclosure";
348
392
  export function cellText(row: SupplyRow, column: string): string {
349
393
  return column === "name" ? counterpartyName(row) : column === "ticker" ? entityTicker(row.counterparty) ?? MISSING_VALUE
350
- : column === "role" ? roleLabel(row.role) : column === "direction" ? row.direction === "in" ? "In" : row.direction === "out" ? "Out" : "Both"
394
+ : column === "role" ? rowRoleLabel(row) : column === "direction" ? row.direction === "in" ? "In" : row.direction === "out" ? "Out" : "Both"
351
395
  : column === "pct" ? percentage(row) : column === "usd" ? disclosedValue(row) : column === "fy" ? periodText(row)
352
396
  : column === "publisher" ? row.evidence?.find((item) => item.status === "active")?.publisher ?? row.reportingEntity.name
353
397
  : column === "corroboration" ? corroborationLabel(row)