gloomberb 0.15.7 → 0.16.0

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 (524) hide show
  1. package/README.md +11 -2
  2. package/package.json +1 -1
  3. package/src/api-client/app-attention.ts +147 -0
  4. package/src/api-client/attention.ts +26 -0
  5. package/src/api-client/awards.ts +215 -0
  6. package/src/api-client/catalysts.ts +160 -0
  7. package/src/api-client/chat.ts +137 -14
  8. package/src/api-client/company-kpis.ts +153 -0
  9. package/src/api-client/cpi.ts +52 -0
  10. package/src/api-client/credit-documents.ts +107 -0
  11. package/src/api-client/data.ts +192 -3
  12. package/src/api-client/distress.ts +164 -0
  13. package/src/api-client/doe.ts +75 -0
  14. package/src/api-client/equity-screener.ts +11 -0
  15. package/src/api-client/exposure.ts +202 -0
  16. package/src/api-client/gpu.ts +93 -0
  17. package/src/api-client/hiring.ts +110 -0
  18. package/src/api-client/index.ts +78 -3
  19. package/src/api-client/normalizers.ts +31 -1
  20. package/src/api-client/paths.ts +3 -0
  21. package/src/api-client/perps.ts +127 -0
  22. package/src/api-client/power.ts +148 -0
  23. package/src/api-client/request.ts +58 -1
  24. package/src/api-client/research-activity.ts +172 -13
  25. package/src/api-client/socket.ts +75 -27
  26. package/src/api-client/supply-chain-graph.ts +40 -0
  27. package/src/api-client/supply-chain.ts +98 -0
  28. package/src/api-client/telemetry.ts +29 -0
  29. package/src/api-client/themes.ts +28 -0
  30. package/src/api-client/types.ts +33 -1
  31. package/src/api-client/wall-experiments.ts +100 -0
  32. package/src/api-client/wall-summary.ts +49 -0
  33. package/src/api-client/web-experiments.ts +136 -0
  34. package/src/app/pane-runtime/plugin-bindings.ts +5 -0
  35. package/src/app/pane-runtime/ticker-open-runtime.ts +8 -2
  36. package/src/app/runtime/update.ts +13 -1
  37. package/src/cli/commands/system.ts +2 -0
  38. package/src/cli/desktop-pane-shot.ts +3 -4
  39. package/src/cli/pane-functions/data.ts +78 -0
  40. package/src/cli/pane-functions/financial-ratio-shot.ts +160 -0
  41. package/src/cli/pane-functions/function-help.ts +220 -8
  42. package/src/cli/pane-functions/headless.ts +4 -0
  43. package/src/cli/pane-functions/screenshot-evidence.ts +21 -0
  44. package/src/cli/pane-functions/screenshot.ts +49 -5
  45. package/src/components/chart/composite/composite-chart.tsx +15 -2
  46. package/src/components/chart/composite/format.ts +24 -11
  47. package/src/components/chart/composite/rasterizer.ts +67 -16
  48. package/src/components/chart/composite/scene.ts +53 -2
  49. package/src/components/chart/composite/session-shading.ts +3 -2
  50. package/src/components/chart/composite/text-renderer.ts +52 -1
  51. package/src/components/chart/composite/time-axis.ts +100 -30
  52. package/src/components/chart/composite/tools.ts +2 -1
  53. package/src/components/chart/composite/types.ts +4 -0
  54. package/src/components/chart-table/index.ts +1 -0
  55. package/src/components/chart-table/layout.ts +15 -0
  56. package/src/components/command-bar/action-runtime.ts +1 -0
  57. package/src/components/command-bar/commands/direct/index.ts +32 -0
  58. package/src/components/command-bar/commands/registry.ts +7 -0
  59. package/src/components/command-bar/pane-templates/items.ts +11 -0
  60. package/src/components/command-bar/pane-templates/workflow.ts +19 -4
  61. package/src/components/command-bar/routes/root/command-items.ts +6 -0
  62. package/src/components/command-bar/routes/root/provider-search.ts +2 -0
  63. package/src/components/command-bar/routes/root/results.ts +64 -0
  64. package/src/components/command-bar/routes/root/runtime.ts +8 -0
  65. package/src/components/command-bar/routes/ticker-search/results.ts +89 -24
  66. package/src/components/command-bar/routes/ticker-search/route.ts +2 -0
  67. package/src/components/command-bar/surface/index.tsx +15 -0
  68. package/src/components/command-bar/view-model.ts +3 -0
  69. package/src/components/command-bar/workflow/collection-actions.ts +9 -7
  70. package/src/components/command-bar/workflow/ops.ts +19 -0
  71. package/src/components/command-bar/workflow/tickers.ts +5 -0
  72. package/src/components/company-logo.tsx +15 -2
  73. package/src/components/data-table/table-pane.ts +2 -1
  74. package/src/components/index.ts +1 -0
  75. package/src/components/layout/detached-pane-shell.tsx +12 -1
  76. package/src/components/layout/missing-pane.tsx +87 -23
  77. package/src/components/layout/pane/footer/index.tsx +64 -18
  78. package/src/components/layout/pane/footer/model.ts +85 -0
  79. package/src/components/layout/pane/sidebar.tsx +19 -1
  80. package/src/components/layout/shell/index.tsx +38 -28
  81. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -1
  82. package/src/components/layout/status-bar.tsx +93 -28
  83. package/src/components/layout/status-widget-space.ts +72 -0
  84. package/src/components/onboarding/first-run-workspace.ts +8 -2
  85. package/src/components/onboarding/onboarding-wizard.tsx +35 -16
  86. package/src/components/onboarding/portfolio-step/positions-panel.tsx +14 -5
  87. package/src/components/onboarding/wizard-model.ts +13 -5
  88. package/src/components/onboarding/wizard-positions.ts +56 -7
  89. package/src/components/price-performance.tsx +31 -34
  90. package/src/components/ui/data-table/index.tsx +11 -8
  91. package/src/components/ui/display.tsx +15 -6
  92. package/src/components/ui/fields.tsx +5 -0
  93. package/src/components/ui/figure.tsx +94 -0
  94. package/src/components/ui/header-case.ts +25 -3
  95. package/src/components/ui/icon.tsx +3 -1
  96. package/src/components/ui/message-composer.tsx +8 -1
  97. package/src/components/ui/query-bar.tsx +8 -1
  98. package/src/components/ui/ratio-bar.tsx +84 -0
  99. package/src/components/ui/toggle.tsx +3 -1
  100. package/src/components/use-scrollbox-layout.ts +17 -0
  101. package/src/core/state/app/layout.ts +35 -1
  102. package/src/core/state/app/state.ts +15 -0
  103. package/src/core/state/app/types.ts +1 -0
  104. package/src/data/config/store/normalize.ts +24 -0
  105. package/src/i18n/es.ts +2 -0
  106. package/src/i18n/ja.ts +2 -0
  107. package/src/i18n/ko.ts +2 -0
  108. package/src/i18n/zh-cn.ts +2 -0
  109. package/src/i18n/zh-tw.ts +2 -0
  110. package/src/layout-marketplace/pane-imagery.ts +1 -0
  111. package/src/market-data/coordinator/entries.ts +13 -0
  112. package/src/market-data/coordinator/financials.ts +33 -8
  113. package/src/market-data/market/freshness.ts +16 -5
  114. package/src/market-data/market/trading-sessions.ts +65 -1
  115. package/src/market-data/published-cn-sessions.ts +25 -0
  116. package/src/market-data/published-nse-sessions.ts +20 -0
  117. package/src/news/aggregator.ts +4 -0
  118. package/src/plugins/builtin/account-management/model.ts +6 -1
  119. package/src/plugins/builtin/account-management/pane.tsx +36 -25
  120. package/src/plugins/builtin/alerts/catalysts.ts +77 -0
  121. package/src/plugins/builtin/alerts/events-pane.tsx +3 -0
  122. package/src/plugins/builtin/alerts/events.ts +10 -4
  123. package/src/plugins/builtin/alerts/history-pane.tsx +1 -1
  124. package/src/plugins/builtin/alerts/history.ts +1 -0
  125. package/src/plugins/builtin/alerts/index.tsx +6 -0
  126. package/src/plugins/builtin/alerts/research-builder.ts +10 -3
  127. package/src/plugins/builtin/alerts/research-rules.ts +15 -1
  128. package/src/plugins/builtin/analytics/risk-client.ts +15 -3
  129. package/src/plugins/builtin/analytics/risk-headless.ts +123 -18
  130. package/src/plugins/builtin/attention/client.ts +80 -0
  131. package/src/plugins/builtin/attention/evidence.ts +30 -0
  132. package/src/plugins/builtin/attention/headless.ts +33 -0
  133. package/src/plugins/builtin/attention/index.tsx +18 -0
  134. package/src/plugins/builtin/attention/model.ts +59 -0
  135. package/src/plugins/builtin/attention/pane.tsx +211 -0
  136. package/src/plugins/builtin/attention/trending.tsx +59 -0
  137. package/src/plugins/builtin/awards/alerts.ts +32 -0
  138. package/src/plugins/builtin/awards/client.ts +82 -0
  139. package/src/plugins/builtin/awards/detail.tsx +107 -0
  140. package/src/plugins/builtin/awards/evidence.ts +36 -0
  141. package/src/plugins/builtin/awards/headless.ts +55 -0
  142. package/src/plugins/builtin/awards/index.tsx +20 -0
  143. package/src/plugins/builtin/awards/model.ts +42 -0
  144. package/src/plugins/builtin/awards/pane.tsx +263 -0
  145. package/src/plugins/builtin/catalysts/client.ts +28 -0
  146. package/src/plugins/builtin/catalysts/detail.tsx +88 -0
  147. package/src/plugins/builtin/catalysts/evidence.ts +47 -0
  148. package/src/plugins/builtin/catalysts/headless.ts +42 -0
  149. package/src/plugins/builtin/catalysts/history.ts +26 -0
  150. package/src/plugins/builtin/catalysts/index.tsx +29 -0
  151. package/src/plugins/builtin/catalysts/model.ts +135 -0
  152. package/src/plugins/builtin/catalysts/pane.tsx +159 -0
  153. package/src/plugins/builtin/chart-composer/cli-options.ts +4 -0
  154. package/src/plugins/builtin/chart-composer/headless-schema.ts +6 -0
  155. package/src/plugins/builtin/chart-composer/index.tsx +8 -1
  156. package/src/plugins/builtin/chart-composer/pane.tsx +28 -1
  157. package/src/plugins/builtin/chat/attachments/desktop.tsx +610 -0
  158. package/src/plugins/builtin/chat/attachments/files.ts +45 -0
  159. package/src/plugins/builtin/chat/attachments/model.ts +164 -0
  160. package/src/plugins/builtin/chat/attachments/terminal.tsx +72 -0
  161. package/src/plugins/builtin/chat/attachments/transfer.ts +165 -0
  162. package/src/plugins/builtin/chat/content/channel-navigation.ts +13 -12
  163. package/src/plugins/builtin/chat/content/composer-runtime.ts +25 -4
  164. package/src/plugins/builtin/chat/content/composer.tsx +46 -4
  165. package/src/plugins/builtin/chat/content/footer.tsx +46 -8
  166. package/src/plugins/builtin/chat/content/index.tsx +263 -62
  167. package/src/plugins/builtin/chat/content/layout-metrics.ts +10 -2
  168. package/src/plugins/builtin/chat/content/open-targets.ts +17 -3
  169. package/src/plugins/builtin/chat/content/scroll.ts +7 -1
  170. package/src/plugins/builtin/chat/content/shortcuts.ts +36 -11
  171. package/src/plugins/builtin/chat/content/snapshot.ts +3 -0
  172. package/src/plugins/builtin/chat/content/transcript.tsx +17 -1
  173. package/src/plugins/builtin/chat/content/types.ts +7 -0
  174. package/src/plugins/builtin/chat/controller/attachments.ts +213 -0
  175. package/src/plugins/builtin/chat/controller/connections.ts +3 -1
  176. package/src/plugins/builtin/chat/controller/index.ts +114 -2
  177. package/src/plugins/builtin/chat/controller/lifecycle.ts +9 -0
  178. package/src/plugins/builtin/chat/controller/messages.ts +35 -2
  179. package/src/plugins/builtin/chat/controller/send.ts +128 -25
  180. package/src/plugins/builtin/chat/controller/state.ts +12 -1
  181. package/src/plugins/builtin/chat/controller/utils.ts +7 -5
  182. package/src/plugins/builtin/chat/controller/view.ts +2 -0
  183. package/src/plugins/builtin/chat/index.tsx +21 -0
  184. package/src/plugins/builtin/chat/layout.ts +9 -4
  185. package/src/plugins/builtin/chat/message/desktop.tsx +55 -20
  186. package/src/plugins/builtin/chat/message/header.tsx +30 -5
  187. package/src/plugins/builtin/chat/message/inline-tokens.tsx +9 -0
  188. package/src/plugins/builtin/chat/message/pending-send.ts +35 -0
  189. package/src/plugins/builtin/chat/message/profile-popover.tsx +5 -1
  190. package/src/plugins/builtin/chat/message/render-state.ts +12 -2
  191. package/src/plugins/builtin/chat/message/terminal.tsx +51 -4
  192. package/src/plugins/builtin/chat/message/types.ts +6 -1
  193. package/src/plugins/builtin/chat/pane-state.ts +59 -1
  194. package/src/plugins/builtin/chat/profile-popover.ts +50 -1
  195. package/src/plugins/builtin/chat/sidebar.tsx +8 -3
  196. package/src/plugins/builtin/chat/status-widget.tsx +29 -12
  197. package/src/plugins/builtin/chat/unread-inbox-pane.tsx +143 -0
  198. package/src/plugins/builtin/chat/unread-inbox.ts +91 -0
  199. package/src/plugins/builtin/clinical-trials/client.ts +237 -0
  200. package/src/plugins/builtin/clinical-trials/index.tsx +74 -0
  201. package/src/plugins/builtin/clinical-trials/pane.tsx +225 -0
  202. package/src/plugins/builtin/clinical-trials/types.ts +2 -0
  203. package/src/plugins/builtin/cloud/askg/controller.ts +37 -6
  204. package/src/plugins/builtin/cloud/askg/executor.ts +59 -44
  205. package/src/plugins/builtin/cloud/askg/host.ts +8 -1
  206. package/src/plugins/builtin/cloud/askg/manifest.ts +29 -2
  207. package/src/plugins/builtin/cloud/askg/model.ts +47 -13
  208. package/src/plugins/builtin/cloud/askg/notes.ts +100 -0
  209. package/src/plugins/builtin/cloud/askg/pane.tsx +50 -14
  210. package/src/plugins/builtin/cloud/askg/protocol.ts +39 -1
  211. package/src/plugins/builtin/cloud/askg/result-budget.ts +156 -0
  212. package/src/plugins/builtin/cloud/askg/user-data.ts +89 -0
  213. package/src/plugins/builtin/cloud/auth-actions.tsx +55 -31
  214. package/src/plugins/builtin/cloud/plugin.tsx +4 -1
  215. package/src/plugins/builtin/cloud/team/pane-sections.tsx +10 -1
  216. package/src/plugins/builtin/cloud/team/pane.tsx +3 -2
  217. package/src/plugins/builtin/cloud/thesis/board-pane.tsx +2 -2
  218. package/src/plugins/builtin/cloud/thesis/detail.tsx +1 -1
  219. package/src/plugins/builtin/cloud/thesis/ticker-tab.tsx +2 -2
  220. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +202 -0
  221. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  222. package/src/plugins/builtin/cloud/upgrade-dialog.tsx +29 -3
  223. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +1 -1
  224. package/src/plugins/builtin/cloud-tweets/table.tsx +1 -1
  225. package/src/plugins/builtin/comment-letters/client.ts +342 -0
  226. package/src/plugins/builtin/comment-letters/index.tsx +74 -0
  227. package/src/plugins/builtin/comment-letters/pane.tsx +295 -0
  228. package/src/plugins/builtin/comment-letters/types.ts +43 -0
  229. package/src/plugins/builtin/company-attention/app-rank.tsx +79 -0
  230. package/src/plugins/builtin/company-attention/client.ts +69 -0
  231. package/src/plugins/builtin/company-attention/evidence.ts +45 -0
  232. package/src/plugins/builtin/company-attention/headless.ts +47 -0
  233. package/src/plugins/builtin/company-attention/index.tsx +30 -0
  234. package/src/plugins/builtin/company-attention/model.ts +129 -0
  235. package/src/plugins/builtin/company-attention/pane.tsx +183 -0
  236. package/src/plugins/builtin/company-kpis/client.ts +92 -0
  237. package/src/plugins/builtin/company-kpis/headless.ts +32 -0
  238. package/src/plugins/builtin/company-kpis/index.tsx +26 -0
  239. package/src/plugins/builtin/company-kpis/model.ts +124 -0
  240. package/src/plugins/builtin/company-kpis/pane.tsx +226 -0
  241. package/src/plugins/builtin/company-kpis/related.ts +11 -0
  242. package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +44 -0
  243. package/src/plugins/builtin/composite-plugins.ts +34 -0
  244. package/src/plugins/builtin/correlation/history.ts +4 -1
  245. package/src/plugins/builtin/correlation/index.tsx +139 -80
  246. package/src/plugins/builtin/correlation/matrix/pair-chart.tsx +48 -0
  247. package/src/plugins/builtin/correlation/matrix/selection.ts +77 -0
  248. package/src/plugins/builtin/correlation/relationship/model.ts +2 -2
  249. package/src/plugins/builtin/cpi/client.ts +66 -0
  250. package/src/plugins/builtin/cpi/headless.ts +78 -0
  251. package/src/plugins/builtin/cpi/index.tsx +31 -0
  252. package/src/plugins/builtin/cpi/model.ts +198 -0
  253. package/src/plugins/builtin/cpi/pane.tsx +157 -0
  254. package/src/plugins/builtin/credit-documents/client.ts +99 -0
  255. package/src/plugins/builtin/credit-documents/detail.tsx +109 -0
  256. package/src/plugins/builtin/credit-documents/evidence.ts +64 -0
  257. package/src/plugins/builtin/credit-documents/gauge.tsx +55 -0
  258. package/src/plugins/builtin/credit-documents/headless.ts +40 -0
  259. package/src/plugins/builtin/credit-documents/index.tsx +19 -0
  260. package/src/plugins/builtin/credit-documents/model.ts +336 -0
  261. package/src/plugins/builtin/credit-documents/pane.tsx +185 -0
  262. package/src/plugins/builtin/custom-view/view-spec.ts +14 -2
  263. package/src/plugins/builtin/debt-maturities/pane.tsx +1 -0
  264. package/src/plugins/builtin/dividend-yield/pane.tsx +1 -1
  265. package/src/plugins/builtin/doe/client.ts +73 -0
  266. package/src/plugins/builtin/doe/headless.ts +93 -0
  267. package/src/plugins/builtin/doe/index.tsx +41 -0
  268. package/src/plugins/builtin/doe/model.ts +215 -0
  269. package/src/plugins/builtin/doe/pane.tsx +148 -0
  270. package/src/plugins/builtin/doe/range-bar.tsx +45 -0
  271. package/src/plugins/builtin/earnings/board.tsx +3 -0
  272. package/src/plugins/builtin/earnings/index.tsx +2 -0
  273. package/src/plugins/builtin/earnings-calls/pane.tsx +7 -1
  274. package/src/plugins/builtin/earnings-calls/transcript-view.tsx +7 -7
  275. package/src/plugins/builtin/earnings-ripple/client.ts +60 -0
  276. package/src/plugins/builtin/earnings-ripple/headless.ts +35 -0
  277. package/src/plugins/builtin/earnings-ripple/index.tsx +35 -0
  278. package/src/plugins/builtin/earnings-ripple/model.ts +98 -0
  279. package/src/plugins/builtin/earnings-ripple/pane.tsx +103 -0
  280. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  281. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +1 -1
  282. package/src/plugins/builtin/equity-screener/model.ts +74 -9
  283. package/src/plugins/builtin/equity-screener/pane.tsx +2 -0
  284. package/src/plugins/builtin/estimate-revisions/pane.tsx +3 -0
  285. package/src/plugins/builtin/executives/pane.tsx +7 -5
  286. package/src/plugins/builtin/exposure/charts.tsx +66 -0
  287. package/src/plugins/builtin/exposure/client.ts +53 -0
  288. package/src/plugins/builtin/exposure/drivers.ts +29 -0
  289. package/src/plugins/builtin/exposure/editor.tsx +61 -0
  290. package/src/plugins/builtin/exposure/evidence.ts +39 -0
  291. package/src/plugins/builtin/exposure/headless.ts +51 -0
  292. package/src/plugins/builtin/exposure/holdings.ts +56 -0
  293. package/src/plugins/builtin/exposure/index.tsx +13 -0
  294. package/src/plugins/builtin/exposure/model.ts +104 -0
  295. package/src/plugins/builtin/exposure/pane.tsx +247 -0
  296. package/src/plugins/builtin/fear-greed/charts.tsx +1 -1
  297. package/src/plugins/builtin/fear-greed/pane.tsx +2 -9
  298. package/src/plugins/builtin/filing-events/pane.tsx +2 -1
  299. package/src/plugins/builtin/gpu/board.tsx +163 -0
  300. package/src/plugins/builtin/gpu/changes.tsx +94 -0
  301. package/src/plugins/builtin/gpu/client.ts +130 -0
  302. package/src/plugins/builtin/gpu/equities.tsx +112 -0
  303. package/src/plugins/builtin/gpu/headless.ts +67 -0
  304. package/src/plugins/builtin/gpu/history.tsx +140 -0
  305. package/src/plugins/builtin/gpu/index.tsx +18 -0
  306. package/src/plugins/builtin/gpu/ladder.tsx +127 -0
  307. package/src/plugins/builtin/gpu/model.ts +317 -0
  308. package/src/plugins/builtin/gpu/pane.tsx +63 -0
  309. package/src/plugins/builtin/help/index.tsx +19 -2
  310. package/src/plugins/builtin/holders/pane.tsx +5 -9
  311. package/src/plugins/builtin/insider/detail.tsx +119 -0
  312. package/src/plugins/builtin/insider/display.ts +221 -0
  313. package/src/plugins/builtin/insider/headless.ts +24 -3
  314. package/src/plugins/builtin/insider/index.tsx +206 -108
  315. package/src/plugins/builtin/insider/insider-data.ts +31 -3
  316. package/src/plugins/builtin/insider/model.ts +53 -4
  317. package/src/plugins/builtin/insider/table-model.ts +226 -0
  318. package/src/plugins/builtin/insider/table.tsx +79 -0
  319. package/src/plugins/builtin/iv-history/screen-pane.tsx +1 -1
  320. package/src/plugins/builtin/jobs/pane.tsx +14 -7
  321. package/src/plugins/builtin/kelly-sizer/pane.tsx +1 -1
  322. package/src/plugins/builtin/macro-day/client.ts +50 -0
  323. package/src/plugins/builtin/macro-day/headless.ts +51 -0
  324. package/src/plugins/builtin/macro-day/index.tsx +21 -0
  325. package/src/plugins/builtin/macro-day/model.ts +137 -0
  326. package/src/plugins/builtin/macro-day/pane.tsx +118 -0
  327. package/src/plugins/builtin/macro-day/releases.ts +58 -0
  328. package/src/plugins/builtin/market-halts/model.ts +30 -17
  329. package/src/plugins/builtin/market-halts/pane.tsx +15 -21
  330. package/src/plugins/builtin/market-heatmap/data.ts +1 -1
  331. package/src/plugins/builtin/market-heatmap/index.tsx +198 -50
  332. package/src/plugins/builtin/market-heatmap/portfolio.ts +220 -0
  333. package/src/plugins/builtin/market-movers/index.tsx +1 -0
  334. package/src/plugins/builtin/market-movers/session-body.tsx +5 -2
  335. package/src/plugins/builtin/mna/distress/client.ts +326 -0
  336. package/src/plugins/builtin/mna/distress/detail.tsx +247 -0
  337. package/src/plugins/builtin/mna/distress/headless.ts +257 -0
  338. package/src/plugins/builtin/mna/distress/model.ts +427 -0
  339. package/src/plugins/builtin/mna/distress/pane.tsx +606 -0
  340. package/src/plugins/builtin/mna/index.tsx +15 -0
  341. package/src/plugins/builtin/mna/pane.tsx +42 -1
  342. package/src/plugins/builtin/news/index.tsx +62 -16
  343. package/src/plugins/builtin/news/wire/filter-articles.ts +54 -0
  344. package/src/plugins/builtin/news/wire/index.tsx +37 -3
  345. package/src/plugins/builtin/news/wire/industry-pane.tsx +29 -13
  346. package/src/plugins/builtin/news/wire/mutes.ts +253 -0
  347. package/src/plugins/builtin/news/wire/news/command-bar-search.ts +117 -0
  348. package/src/plugins/builtin/news/wire/news/footer.ts +4 -0
  349. package/src/plugins/builtin/news/wire/news/list-search.ts +34 -0
  350. package/src/plugins/builtin/news/wire/news/pop-out.tsx +158 -0
  351. package/src/plugins/builtin/news/wire/news/preset-pane.tsx +64 -19
  352. package/src/plugins/builtin/openfda/client.ts +300 -0
  353. package/src/plugins/builtin/openfda/index.tsx +71 -0
  354. package/src/plugins/builtin/openfda/pane.tsx +382 -0
  355. package/src/plugins/builtin/openfda/types.ts +76 -0
  356. package/src/plugins/builtin/options/footer.ts +1 -0
  357. package/src/plugins/builtin/options/view.tsx +1 -1
  358. package/src/plugins/builtin/options-calculator/pane.tsx +0 -1
  359. package/src/plugins/builtin/options-positioning/index.tsx +4 -2
  360. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  361. package/src/plugins/builtin/pe-band/client.ts +61 -0
  362. package/src/plugins/builtin/pe-band/headless.ts +51 -0
  363. package/src/plugins/builtin/pe-band/index.tsx +20 -0
  364. package/src/plugins/builtin/pe-band/model.ts +267 -0
  365. package/src/plugins/builtin/pe-band/pane.tsx +159 -0
  366. package/src/plugins/builtin/perps/client.ts +66 -0
  367. package/src/plugins/builtin/perps/equity-row.tsx +28 -0
  368. package/src/plugins/builtin/perps/headless.ts +34 -0
  369. package/src/plugins/builtin/perps/index.tsx +14 -0
  370. package/src/plugins/builtin/perps/model.ts +58 -0
  371. package/src/plugins/builtin/perps/pane.tsx +185 -0
  372. package/src/plugins/builtin/plugin-marketplace/pane.tsx +0 -1
  373. package/src/plugins/builtin/portfolio-list/cli/render.ts +177 -87
  374. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +6 -20
  375. package/src/plugins/builtin/portfolio-list/command-bar.ts +6 -2
  376. package/src/plugins/builtin/portfolio-list/headless.ts +237 -0
  377. package/src/plugins/builtin/portfolio-list/index.tsx +2 -0
  378. package/src/plugins/builtin/portfolio-list/mutations.ts +70 -1
  379. package/src/plugins/builtin/portfolio-list/pane/data.ts +17 -0
  380. package/src/plugins/builtin/portfolio-list/pane/index.tsx +88 -5
  381. package/src/plugins/builtin/portfolio-list/pane/remove-ticker.ts +85 -0
  382. package/src/plugins/builtin/portfolio-list/pane/streaming.ts +18 -12
  383. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +6 -0
  384. package/src/plugins/builtin/power/client.ts +100 -0
  385. package/src/plugins/builtin/power/detail.tsx +82 -0
  386. package/src/plugins/builtin/power/evidence.ts +56 -0
  387. package/src/plugins/builtin/power/generation.tsx +37 -0
  388. package/src/plugins/builtin/power/headless.ts +43 -0
  389. package/src/plugins/builtin/power/index.tsx +16 -0
  390. package/src/plugins/builtin/power/model.ts +89 -0
  391. package/src/plugins/builtin/power/pane.tsx +209 -0
  392. package/src/plugins/builtin/power/query.ts +25 -0
  393. package/src/plugins/builtin/relative-rotation/pane.tsx +3 -3
  394. package/src/plugins/builtin/research/analyst-pane.tsx +1 -1
  395. package/src/plugins/builtin/research/corporate-actions-pane.tsx +13 -4
  396. package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +11 -9
  397. package/src/plugins/builtin/research-search/pane.tsx +21 -7
  398. package/src/plugins/builtin/revenue-breakdown/pane.tsx +1 -1
  399. package/src/plugins/builtin/reverse-dcf/client.ts +35 -0
  400. package/src/plugins/builtin/reverse-dcf/headless.ts +44 -0
  401. package/src/plugins/builtin/reverse-dcf/index.tsx +20 -0
  402. package/src/plugins/builtin/reverse-dcf/model.ts +87 -0
  403. package/src/plugins/builtin/reverse-dcf/pane.tsx +107 -0
  404. package/src/plugins/builtin/risk-factors/pane.tsx +6 -5
  405. package/src/plugins/builtin/scanner/denied.tsx +4 -2
  406. package/src/plugins/builtin/scanner/feed.ts +1 -0
  407. package/src/plugins/builtin/scanner/flow-pane.tsx +3 -2
  408. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  409. package/src/plugins/builtin/seasonality/client.ts +4 -1
  410. package/src/plugins/builtin/sec/command-bar-search.ts +217 -0
  411. package/src/plugins/builtin/sec/forms.ts +54 -0
  412. package/src/plugins/builtin/sec/headless.ts +31 -5
  413. package/src/plugins/builtin/sec/index.tsx +67 -11
  414. package/src/plugins/builtin/sec/model.ts +35 -5
  415. package/src/plugins/builtin/sectors/headless.ts +1 -0
  416. package/src/plugins/builtin/sectors/index.tsx +72 -26
  417. package/src/plugins/builtin/shared/cloud-upgrade.ts +143 -39
  418. package/src/plugins/builtin/shared/pro-feature-wall.tsx +8 -4
  419. package/src/plugins/builtin/shared/research-cells.tsx +107 -0
  420. package/src/plugins/builtin/shared/series-list-detail.tsx +5 -1
  421. package/src/plugins/builtin/shared/ticker-request.ts +1 -1
  422. package/src/plugins/builtin/shared/wall-teaser-catalog.ts +80 -0
  423. package/src/plugins/builtin/shared/wall-teaser.tsx +192 -0
  424. package/src/plugins/builtin/shared/wall-view-lifecycle.ts +43 -0
  425. package/src/plugins/builtin/short-interest/index.tsx +31 -0
  426. package/src/plugins/builtin/short-interest/watch-client.ts +70 -0
  427. package/src/plugins/builtin/short-interest/watch-headless.ts +49 -0
  428. package/src/plugins/builtin/short-interest/watch-model.ts +185 -0
  429. package/src/plugins/builtin/short-interest/watch-pane.tsx +169 -0
  430. package/src/plugins/builtin/short-volume/pane.tsx +1 -1
  431. package/src/plugins/builtin/social-mentions/pane.tsx +1 -1
  432. package/src/plugins/builtin/supply-chain/client.ts +104 -0
  433. package/src/plugins/builtin/supply-chain/disclosure-quote.tsx +17 -0
  434. package/src/plugins/builtin/supply-chain/evidence.ts +88 -0
  435. package/src/plugins/builtin/supply-chain/flow-layout.ts +133 -0
  436. package/src/plugins/builtin/supply-chain/flow.tsx +323 -0
  437. package/src/plugins/builtin/supply-chain/graph-client.ts +83 -0
  438. package/src/plugins/builtin/supply-chain/graph-evidence.ts +25 -0
  439. package/src/plugins/builtin/supply-chain/graph-model.ts +45 -0
  440. package/src/plugins/builtin/supply-chain/graph-pane.tsx +218 -0
  441. package/src/plugins/builtin/supply-chain/graph.tsx +163 -0
  442. package/src/plugins/builtin/supply-chain/headless.ts +105 -0
  443. package/src/plugins/builtin/supply-chain/index.tsx +17 -0
  444. package/src/plugins/builtin/supply-chain/model.ts +145 -0
  445. package/src/plugins/builtin/supply-chain/pane.tsx +276 -0
  446. package/src/plugins/builtin/supply-chain/row-evidence.tsx +96 -0
  447. package/src/plugins/builtin/supply-chain/trust.ts +34 -0
  448. package/src/plugins/builtin/themes/client.ts +39 -0
  449. package/src/plugins/builtin/themes/headless.ts +38 -0
  450. package/src/plugins/builtin/themes/model.ts +92 -0
  451. package/src/plugins/builtin/themes/pane.tsx +125 -0
  452. package/src/plugins/builtin/thirteenf/pane.tsx +6 -15
  453. package/src/plugins/builtin/ticker-detail/data-panes/historical-prices.tsx +5 -6
  454. package/src/plugins/builtin/ticker-detail/data-panes/returns-model.ts +201 -0
  455. package/src/plugins/builtin/ticker-detail/data-panes/returns-pane.tsx +327 -0
  456. package/src/plugins/builtin/ticker-detail/financials/period-end-history.ts +5 -2
  457. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +60 -12
  458. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +2 -1
  459. package/src/plugins/builtin/ticker-detail/headless.ts +7 -2
  460. package/src/plugins/builtin/ticker-detail/index.tsx +22 -0
  461. package/src/plugins/builtin/ticker-detail/overview/components.tsx +53 -30
  462. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +2 -0
  463. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +112 -47
  464. package/src/plugins/builtin/ticker-detail/pane.tsx +50 -6
  465. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +21 -42
  466. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +3 -0
  467. package/src/plugins/builtin/time-sales/pane.tsx +1 -1
  468. package/src/plugins/builtin/world-indices/indices.ts +1 -0
  469. package/src/plugins/catalog-browser.ts +40 -0
  470. package/src/plugins/catalog-manifest.ts +3 -0
  471. package/src/plugins/catalog-ui.ts +6 -0
  472. package/src/plugins/current-target.ts +0 -9
  473. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  474. package/src/renderers/browser/cloud-transport.ts +66 -1
  475. package/src/renderers/browser/main.tsx +2 -0
  476. package/src/renderers/dom/data-table/row.tsx +2 -0
  477. package/src/renderers/dom/desktop/controls.tsx +38 -25
  478. package/src/renderers/dom/desktop/icons.tsx +8 -0
  479. package/src/renderers/dom/host/chart-surface.tsx +36 -2
  480. package/src/renderers/dom/host/focus-scope.ts +11 -1
  481. package/src/renderers/dom/styles.css +28 -0
  482. package/src/renderers/electrobun/view/backend-rpc.ts +3 -2
  483. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +1 -1
  484. package/src/renderers/electrobun/view/http-fetch.ts +2 -0
  485. package/src/renderers/electrobun/view/main.tsx +3 -1
  486. package/src/renderers/electrobun/view/rpc-timeout.ts +59 -0
  487. package/src/renderers/opentui/start.tsx +3 -0
  488. package/src/shares/api.ts +3 -1
  489. package/src/sources/gloomberb-cloud/index.ts +47 -13
  490. package/src/sources/history-result.ts +1 -0
  491. package/src/sources/history-retention.ts +16 -0
  492. package/src/sources/provider-router/history.ts +4 -2
  493. package/src/sources/sec-edgar/identity.ts +36 -0
  494. package/src/sources/sec-edgar.ts +1 -34
  495. package/src/state/app/context/index.tsx +8 -0
  496. package/src/sync/core-contributors.ts +20 -2
  497. package/src/telemetry/attention-counts.ts +164 -0
  498. package/src/telemetry/live-config.ts +7 -0
  499. package/src/test-support/rpc-loopback.ts +7 -3
  500. package/src/test-support/shell-pane-keys.tsx +34 -0
  501. package/src/tickers/instrument-kind.ts +12 -6
  502. package/src/tickers/open-target.ts +1 -1
  503. package/src/tickers/search/asset-classes.ts +91 -0
  504. package/src/tickers/search/index.ts +62 -15
  505. package/src/tickers/search/ranking.ts +22 -3
  506. package/src/tickers/search/upsert.ts +4 -1
  507. package/src/time-series/live-bars.ts +8 -3
  508. package/src/time-series/resolve.ts +224 -17
  509. package/src/time-series/spec.ts +1 -0
  510. package/src/time-series/types.ts +9 -1
  511. package/src/types/config.ts +23 -1
  512. package/src/types/data-provider.ts +2 -0
  513. package/src/types/headless.ts +17 -0
  514. package/src/types/price-history.ts +2 -0
  515. package/src/ui/host.tsx +6 -0
  516. package/src/utils/double-escape-close.ts +20 -0
  517. package/src/utils/exchanges.ts +1 -0
  518. package/src/utils/html-entities.ts +15 -0
  519. package/src/utils/http-proxy-response.ts +44 -7
  520. package/src/utils/plugin-proxy-hosts.json +3 -0
  521. package/src/utils/price-history.ts +35 -1
  522. package/src/utils/sec.ts +21 -2
  523. package/src/utils/text-wrap.ts +13 -8
  524. package/src/utils/zoned-date-time.ts +67 -0
@@ -0,0 +1,218 @@
1
+ import { useCallback, useMemo, useRef, useState } from "react";
2
+ import { isAccessDenied } from "../../../api-client/errors";
3
+ import { usePlanAccess } from "../../../api-client/plan-access";
4
+ import { DEFAULT_GRAPH_OPTIONS, type GraphOptions, type GraphPath, type GraphPayload } from "../../../api-client/supply-chain-graph";
5
+ import type { SupplyEntity } from "../../../api-client/supply-chain";
6
+ import { ActionRow, Badge, Button, ButtonActionScope, DataTableView, DetailScrollBody, EmptyState, KeyValueRow, Notice, NumberField, PageStackView, PaneStatusBody, QueryBar, StatGrid, TextField, usePaneNoticeFooter, usePaneStatusFooter, type DataTableColumn, type PaneHint, type QueryBarFilter, type StatItem } from "../../../components";
7
+ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
8
+ import { RatioBar } from "../../../components/ui/ratio-bar";
9
+ import { useAsyncResource, useAutoRefresh, useInputCapture, usePaneInstance, usePaneSettingValue, usePluginAppActions, usePluginPaneState, useShortcut } from "../../../public/react";
10
+ import { useThemeColors } from "../../../theme/theme-context";
11
+ import { Box, ScrollBox, Text, TextAttributes, useRendererHost, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
12
+ import { SignInWall } from "../cloud/auth-actions";
13
+ import { CLOUD_PLAN_KEY, useCloudUpgradeAction } from "../shared/cloud-upgrade";
14
+ import { UpgradeLabel } from "../shared/locked-rows";
15
+ import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
16
+ import { cachedGraph, graphOptions, loadGraph, validateGraph } from "./graph-client";
17
+ import { entityKey, entityLabel, exposureLabel, pathLabel } from "./graph-model";
18
+ import { SupplyGraph } from "./graph";
19
+ import { graphEvidenceRow } from "./graph-evidence";
20
+ import { disclosedValue, dollars, nativeValue, ROLE_COLORS, roleLabel, shareParts } from "./model";
21
+ import { SupplySources, SupplyVerification } from "./row-evidence";
22
+ import { evidenceDate, evidenceLabel, isUnconfirmed, trustTier } from "./trust";
23
+ import { scrollByLines } from "../../../state/pane-scroll-registry";
24
+ import { isPlainKey } from "../../../utils/keyboard";
25
+ import { displayWidth } from "../../../utils/format";
26
+ import { useRemoteUiNode } from "../../../remote/semantic-tree";
27
+
28
+ const PATH_COLUMNS: DataTableColumn[] = [{ id: "route", label: "Route", width: 40, align: "left" }, { id: "relationships", label: "Relationships", width: 22, align: "left" }, { id: "hops", label: "Hops", width: 6, align: "right" }, { id: "score", label: "Score", width: 9, align: "right" }, { id: "confidence", label: "Confidence", width: 12, align: "right" }, { id: "exposure", label: "Estimated exposure", width: 35, align: "left" }];
29
+ const SOURCE_LABELS = { xbrl: "Structured filing", filing_text: "Filing text", press_release: "Company release", call: "Earnings call", news: "News", web: "Website", import: "Imported record" };
30
+ const TIER_LABELS = { structured: "Structured", primary: "Primary", secondary: "Secondary", imported: "Imported" };
31
+
32
+ function GraphInputs({ options, focused, width, onSave, onCancel }: { options: GraphOptions; focused: boolean; width: number; onSave: (options: GraphOptions) => void; onCancel: () => void }) {
33
+ const [fields, setFields] = useState({ minPct: String(options.minPct), minConfidence: String(options.minConfidence), limit: String(options.limit), asOf: options.asOf ?? "" });
34
+ const keys = ["minPct", "minConfidence", "limit", "asOf"] as const;
35
+ const [active, setActive] = useState<(typeof keys)[number]>("minPct"), [error, setError] = useState<string | null>(null);
36
+ useInputCapture(focused);
37
+ const submit = () => {
38
+ try { onSave(graphOptions({ ...options, roles: options.roles.join(","), sources: options.sources.join(","), tiers: options.tiers.join(","), ...fields })); }
39
+ catch (err) { setError(err instanceof Error ? err.message : String(err)); }
40
+ };
41
+ useShortcut(event => {
42
+ if (event.name === "tab") { event.preventDefault(); event.stopPropagation(); setActive(old => keys[(keys.indexOf(old) + (event.shift ? -1 : 1) + keys.length) % keys.length]!); }
43
+ else if (event.name === "escape") { event.preventDefault(); event.stopPropagation(); onCancel(); }
44
+ }, { enabled: focused, phase: "before", allowEditable: true, scope: "supply-graph-inputs" });
45
+ const labels = { minPct: "Minimum disclosed percentage (0–100)", minConfidence: "Minimum confidence (0–1)", limit: "Maximum paths / companies per section (1–50)", asOf: "Filing cutoff (YYYY-MM-DD, blank for latest)" };
46
+ return <ScrollBox scrollY flexGrow={1} flexBasis={0} minHeight={0}><Box flexDirection="column" gap={1} paddingX={1}>
47
+ {keys.map(key => {
48
+ const props = { label: labels[key], value: fields[key], width: Math.min(width - 2, 47), focused: focused && active === key,
49
+ onMouseDown: () => setActive(key), onChange: (value: string) => setFields(old => ({ ...old, [key]: value })), onSubmit: submit };
50
+ return key === "asOf" ? <TextField key={key} {...props} /> : <NumberField key={key} {...props} allowDecimal={key !== "limit"} />;
51
+ })}
52
+ {error ? <Notice tone="warning">{error}</Notice> : null}
53
+ <Box flexDirection="row" gap={2}><Button label="Apply filters" variant="primary" onPress={submit} /><Button label="Cancel" variant="secondary" onPress={onCancel} /></Box>
54
+ </Box></ScrollBox>;
55
+ }
56
+ function PathEvidence({ data, path, width, focused, onRecenter }: { data: GraphPayload; path: GraphPath; width: number; focused: boolean; onRecenter: (entity: SupplyEntity) => void }) {
57
+ const colors = useThemeColors(), host = useRendererHost();
58
+ const desktop = !!useUiCapabilities().nativePaneChrome;
59
+ const scrollRef = useRef<ScrollBoxRenderable>(null);
60
+ useShortcut(event => {
61
+ const delta = isPlainKey(event, "j", "down") ? 1 : isPlainKey(event, "k", "up") ? -1 : 0;
62
+ if (focused && delta && scrollRef.current) { event.preventDefault(); event.stopPropagation(); scrollByLines(scrollRef.current, delta); }
63
+ });
64
+ const figures: StatItem[] = [
65
+ { id: "score", label: "Path score", value: path.score.toFixed(4) },
66
+ { id: "confidence", label: "Confidence", value: `${Math.round(path.confidence * 100)}%` },
67
+ { id: "exposure", label: "Estimated exposure", value: exposureLabel(path, data), detail: path.exposure?.period, wide: true },
68
+ ];
69
+ const company = (entity: SupplyEntity) => desktop && entity.ticker ? <Badge label={entity.ticker} tone="accent" />
70
+ : <Text fg={entity.aggregate || entity.anonymous ? colors.textDim : colors.textBright} attributes={TextAttributes.BOLD}>{entityLabel(entity)}</Text>;
71
+ return <DetailScrollBody ref={scrollRef} resetScrollKey={path.id}><ButtonActionScope>
72
+ <StatGrid items={figures} width={Math.max(1, width - 2)} />
73
+ {path.linkIds.map((id, index) => {
74
+ const link = data.links.find(item => item.id === id)!;
75
+ const from = data.nodes.find(node => node.id === path.nodeIds[index])!, to = data.nodes.find(node => node.id === path.nodeIds[index + 1])!;
76
+ return <Box key={id} flexDirection="column" paddingTop={1}>
77
+ <Box flexDirection="row" height={1} gap={1} overflow="hidden">
78
+ <Text fg={colors.textDim}>{`${index + 1}H`}</Text>
79
+ {company(from)}<Text fg={colors.textMuted}>→</Text>{company(to)}
80
+ </Box>
81
+ {link.evidence.map(evidence => {
82
+ const row = graphEvidenceRow(evidence);
83
+ const share = shareParts(row, undefined, { includeReporter: true });
84
+ const native = nativeValue(row);
85
+ return <Box key={evidence.id} flexDirection="column" paddingBottom={1}>
86
+ <Box flexDirection="row" gap={1}><Badge tone={isUnconfirmed(row) ? "neutral" : "accent"} label={evidenceLabel(row)} />
87
+ {row.leadStatus === "verified" ? <Badge tone="positive" label="Verified" /> : null}</Box>
88
+ <KeyValueRow label="Disclosure" value={`${evidence.reporter.name} · ${roleLabel(evidence.role)}`} color={ROLE_COLORS[evidence.role]} labelWidth={20} />
89
+ <KeyValueRow label="Evidence class" value={`${TIER_LABELS[evidence.tier]} · ${SOURCE_LABELS[evidence.sourceKind]}`} detail={`${Math.round(evidence.confidence * 100)}% confidence`} labelWidth={20} />
90
+ <KeyValueRow label="Period" value={evidence.period} detail={trustTier(row) === 1 ? `filed ${row.filedDate ?? "--"}` : `published ${evidenceDate(row)}`} labelWidth={20} />
91
+ {row.entityScope === "group" && !row.counterparty.aggregate ? <KeyValueRow label="Metric scope" value="Corporate group" labelWidth={20} /> : null}
92
+ <SupplyVerification row={row} />
93
+ {share ? <>
94
+ <Box flexDirection="row" gap={1}>
95
+ <KeyValueRow label="Disclosed share" value={share.value} color={ROLE_COLORS[evidence.role]} labelWidth={20} />
96
+ <RatioBar ratio={row.pctOfRevenue! / 100} width={8} color={ROLE_COLORS[evidence.role]} track />
97
+ </Box>
98
+ <KeyValueRow label="Share basis" value={share.basis} labelWidth={20} />
99
+ </> : null}
100
+ {native || row.usd !== null ? <KeyValueRow label="Disclosed value" value={disclosedValue(row)} labelWidth={20} /> : null}
101
+ {native && row.usd !== null ? <KeyValueRow label="USD amount" value={dollars(row)} labelWidth={20} /> : null}
102
+ <SupplySources row={row} width={width} onOpenSource={url => void host.openExternal(url)} />
103
+ </Box>;
104
+ })}
105
+ <ActionRow label={`Recenter on ${entityLabel(to)}`} onPress={() => onRecenter(to)} />
106
+ </Box>;
107
+ })}
108
+ </ButtonActionScope></DetailScrollBody>;
109
+ }
110
+ export function SupplyGraphPane({ symbol, tab, width, height, focused }: { symbol: string; tab: "graph" | "path"; width: number; height: number; focused: boolean }) {
111
+ const colors = useThemeColors(), desktop = !!useUiCapabilities().nativePaneChrome;
112
+ const instance = usePaneInstance(), session = useResearchCloudSession(), access = usePlanAccess();
113
+ const accessKey = `${session.requestKey}:${access.hasProAccess ? "full" : "preview"}`;
114
+ const initialOptions = useMemo(() => { try { return graphOptions(instance?.settings ?? {}); } catch { return DEFAULT_GRAPH_OPTIONS; } }, []);
115
+ const [options, setOptions] = usePluginPaneState<GraphOptions>("supply:graph-options", initialOptions);
116
+ const [focus, setFocus] = usePluginPaneState(`supply:graph-focus:${symbol}`, symbol);
117
+ const [target, setTarget] = usePluginPaneState(`supply:graph-target:${symbol}`, String(instance?.settings?.to ?? ""));
118
+ const [targetDraft, setTargetDraft] = useState(target), [targetActive, setTargetActive] = useState(false);
119
+ const [selectedId, setSelected] = usePluginPaneState<string | null>(`supply:graph-selected:${symbol}`, null);
120
+ const [selectedPathId, setSelectedPath] = usePluginPaneState<string | null>(`supply:path-selected:${symbol}`, null);
121
+ const [openId, setOpen] = usePluginPaneState<string | null>(`supply:path-evidence:${symbol}`, null);
122
+ const [collapsed, setCollapsed] = usePluginPaneState<string[]>(`supply:collapsed:${symbol}`, []);
123
+ const [visibleLinks, setVisibleLinks] = useState<string[]>([]);
124
+ const [inputsOpen, setInputsOpen] = useState(false);
125
+ const [snapshotSetting] = usePaneSettingValue<GraphPayload | null>("graphSnapshot", null);
126
+ const snapshot = useMemo(() => { try { return snapshotSetting ? validateGraph(snapshotSetting) : null; } catch { return null; } }, [snapshotSetting]);
127
+ const loader = useCallback((force: boolean) => snapshot ? Promise.resolve({ payload: snapshot, stale: false, refreshError: null }) : loadGraph(focus, target, options, accessKey, force), [focus, target, options, accessKey, snapshot]);
128
+ const resource = useAsyncResource(tab === "path" && !target ? null : loader, { initialData: () => cachedGraph(focus, target, options, accessKey), clearOnError: isAccessDenied });
129
+ const data = resource.data?.payload ?? null;
130
+ const [sort, setSort] = usePluginPaneState("supply:path-sort", { column: "score", direction: "desc" as "asc" | "desc" });
131
+ const paths = useMemo(() => data ? data.paths.length ? data.paths : [...data.upstream, ...data.downstream, ...data.related].map(row => options.ranking === "shortest" ? row.shortestPath : row.bestPath) : [], [data, options.ranking]);
132
+ const sortedPaths = useMemo(() => [...paths].sort((a, b) => {
133
+ const value = (path: GraphPath): number | string => sort.column === "route" && data ? pathLabel(path, data) : sort.column === "relationships" && data ? path.linkIds.map(id => data.links.find(link => link.id === id)?.relationship ?? "").sort().join(" ") : sort.column === "hops" ? path.hops : sort.column === "confidence" ? path.confidence : sort.column === "exposure" ? path.exposure?.pct ?? -1 : path.score;
134
+ const aValue = value(a), bValue = value(b);
135
+ return (typeof aValue === "string" && typeof bValue === "string" ? aValue.localeCompare(bValue) : Number(aValue) - Number(bValue)) * (sort.direction === "asc" ? 1 : -1);
136
+ }), [paths, data, sort]);
137
+ const initialPath = paths[Math.max(0, Number(instance?.settings?.route ?? 1) - 1)] ?? paths[0] ?? null;
138
+ const selectedPath = paths.find(path => path.id === selectedPathId) ?? paths.find(path => path.nodeIds.at(-1) === selectedId) ?? (target ? initialPath : null) ?? null;
139
+ const selected = (tab === "path" ? null : data?.nodes.find(node => node.id === selectedId)) ?? (selectedPath ? data?.nodes.find(node => node.id === selectedPath.nodeIds.at(-1)) : null) ?? null;
140
+ const openPath = paths.find(path => path.id === openId) ?? (instance?.settings?.evidence && openId !== "closed" ? initialPath : null) ?? null;
141
+ const openUpgrade = useCloudUpgradeAction("splc"), { createPaneFromTemplate } = usePluginAppActions();
142
+ const recenter = (entity: SupplyEntity) => { setFocus(entityKey(entity)); setTarget(""); setTargetDraft(""); setSelected(null); setSelectedPath(null); setOpen(null); setCollapsed([]); };
143
+ const applyTarget = (value: string) => { setTarget(value.trim()); setTargetDraft(value.trim()); setSelected(null); setSelectedPath(null); setOpen(null); setTargetActive(false); };
144
+ const selectNode = (id: string) => { setSelected(id); setSelectedPath(null); };
145
+ const details = () => { if (selectedPath) setOpen(selectedPath.id); };
146
+ const hints: PaneHint[] = inputsOpen ? [] : [
147
+ ...(!openPath ? [{ id: "inputs", key: "i", label: "nputs", onPress: () => setInputsOpen(true) }] : []),
148
+ ...(selectedPath && !openPath ? [{ id: "evidence", key: "e", label: "vidence", onPress: details }] : []),
149
+ ...(tab === "graph" && !openPath && selected && selected.id !== data?.entity?.id ? [{ id: "target", key: "p", label: "aths to target", onPress: () => applyTarget(entityKey(selected)) },
150
+ { id: "collapse", key: "c", label: collapsed.includes(selected.id) ? "expand" : "ollapse", onPress: () => setCollapsed(old => old.includes(selected.id) ? old.filter(id => id !== selected.id) : [...old, selected.id]) }] : []),
151
+ ...(!openPath && selected?.ticker ? [
152
+ { id: "description", key: "d", label: "es", onPress: () => createPaneFromTemplate("new-ticker-detail-pane", { symbol: entityKey(selected) }) },
153
+ { id: "financials", key: "f", label: "a", onPress: () => createPaneFromTemplate("financial-analysis-pane", { symbol: entityKey(selected) }) },
154
+ { id: "chart", key: "g", label: "raph", onPress: () => createPaneFromTemplate("chart-composer-pane", { arg: entityKey(selected) }) },
155
+ ] : []),
156
+ ...(!openPath && (focus !== symbol || target) ? [{ id: "home", key: "z", label: "reset focus", onPress: () => { setFocus(symbol); applyTarget(""); setCollapsed([]); setSelected(null); } }] : []),
157
+ ...(data?.access === "preview" ? [{ id: "upgrade", key: CLOUD_PLAN_KEY, label: "upgrade", onPress: openUpgrade }] : []),
158
+ ];
159
+ useAutoRefresh(resource.updatedAt, resource.load);
160
+ usePaneRefreshKey(() => void resource.reload(), { focused: focused && !inputsOpen && !targetActive });
161
+ usePaneStatusFooter({ registrationId: "supply-graph", loading: resource.loading, error: data ? resource.error : null, stale: resource.data?.stale, hints,
162
+ info: data?.asOf ? [{ id: "as-of", parts: [{ text: `as of ${data.asOf}`, tone: "muted" }] }] : [] });
163
+ usePaneNoticeFooter({ registrationId: "supply-graph:notices", focused, notices: [...(resource.data?.refreshError ? [resource.data.refreshError] : []),
164
+ ...(data && !data.search.complete ? [`Search limited: ${data.search.reasons.join(", ").replaceAll("_", " ")}. Narrow filters or reduce depth to inspect more routes.`] : []),
165
+ ...(data?.access === "preview" ? [`Pro preview: depth ${data.options.depth}. Upgrade for four hops and the full graph.`] : [])] });
166
+ 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) }) });
167
+ const filters: QueryBarFilter[] = [
168
+ { id: "target", kind: "text", label: "To", value: targetDraft, placeholder: "Ticker or id:123", onChange: setTargetDraft, onSubmit: applyTarget, focused, active: targetActive, onActiveChange: setTargetActive, width: 16 },
169
+ { id: "depth", label: "Hops", value: String(options.depth), options: [1, 2, 3, 4].map(value => ({ value: String(value), label: String(value) })), onChange: value => setOptions(old => ({ ...old, depth: Number(value) })) },
170
+ { id: "direction", label: "Direction", value: options.direction, options: [{ value: "both", label: "Both" }, { value: "upstream", label: "Upstream" }, { value: "downstream", label: "Downstream" }], onChange: value => setOptions(old => ({ ...old, direction: value })) },
171
+ { id: "roles", kind: "multi", label: "Roles", values: options.roles, options: ["supplier", "customer", "partner", "competitor", "investee"].map(value => ({ value, label: value[0]!.toUpperCase() + value.slice(1) })), onChange: values => setOptions(old => ({ ...old, roles: values as GraphOptions["roles"] })) },
172
+ { id: "tiers", kind: "multi", label: "Evidence class", values: options.tiers, options: Object.entries(TIER_LABELS).map(([value, label]) => ({ value, label })), onChange: values => setOptions(old => ({ ...old, tiers: values as GraphOptions["tiers"] })) },
173
+ { id: "sources", kind: "multi", label: "Evidence", values: options.sources, options: Object.entries(SOURCE_LABELS).map(([value, label]) => ({ value, label })), onChange: values => setOptions(old => ({ ...old, sources: values as GraphOptions["sources"] })) },
174
+ ];
175
+ const query = <QueryBar width={width} filters={filters} view={{ value: options.ranking, options: [{ value: "score", label: "Top score" }, { value: "shortest", label: "Shortest" }], onChange: value => setOptions(old => ({ ...old, ranking: value })) }} />;
176
+ if (!data && isCloudSessionRequired(resource.error)) return <SignInWall placement="supply-chain-signin" action="explore supply chain paths" needsVerification={session.needsVerification} />;
177
+ const detailOpen = inputsOpen || !!openPath;
178
+ return <PageStackView focused={focused && !targetActive} detailOpen={detailOpen} onBack={() => { setOpen("closed"); setInputsOpen(false); }} detailTitle={inputsOpen ? "Graph filters" : openPath && data ? pathLabel(openPath, data) : undefined}
179
+ detailContent={inputsOpen ? <GraphInputs options={options} focused={focused} width={width} onSave={value => { setOptions(value); setInputsOpen(false); }} onCancel={() => setInputsOpen(false)} /> : openPath && data ? <PathEvidence data={data} path={openPath} width={width} focused={focused} onRecenter={recenter} /> : null}
180
+ rootContent={<Box width={width} height={height} flexDirection="column">{query}
181
+ {tab === "path" && !target ? <EmptyState title="Choose a target company." hint="Enter a ticker or entity ID in To." /> : <PaneStatusBody loading={!data && resource.loading} error={!data ? resource.error : null} empty={!!data && !data.links.length} emptyTitle={target ? "No disclosed route within these filters." : "No disclosed relationships within these filters."} subject="supply chain graph">
182
+ {data ? tab === "graph" ? <SupplyGraph data={data} width={width} height={Math.max(4, height - 1 - (data.access === "preview" ? 1 : 0))} focused={focused && !targetActive && !detailOpen} selectedId={selectedId} selectedPath={selectedPath} collapsed={collapsed} onSelect={selectNode} onRecenter={recenter} onVisible={setVisibleLinks} />
183
+ : <DataTableView<GraphPath> columns={PATH_COLUMNS} items={sortedPaths} sortColumnId={sort.column} sortDirection={sort.direction} onHeaderClick={column => setSort(old => ({ column, direction: old.column === column && old.direction === "desc" ? "asc" : "desc" }))} emptyStateTitle="No disclosed route within these filters." getItemKey={path => path.id} focused={focused && !targetActive && !detailOpen} rootWidth={width} rootHeight={height - 1 - (data.access === "preview" ? 1 : 0)}
184
+ selection={{ kind: "id", selectedId: selectedPath?.id ?? paths[0]?.id ?? null, getId: path => path.id, onChange: id => setSelectedPath(id) }} onActivate={path => setOpen(path.id)}
185
+ renderCell={(path, column, _index, state) => {
186
+ const ink = state.selected ? colors.selectedText : colors.textBright;
187
+ if (column.id === "route") {
188
+ const text = pathLabel(path, data);
189
+ const route = path.nodeIds.map(id => data.nodes.find(node => node.id === id)).filter((node): node is SupplyEntity => !!node);
190
+ const cells = route.reduce((total, node) => total + displayWidth(entityLabel(node)) + (node.ticker ? 2 : 0), 0) + Math.max(0, route.length - 1) * 3;
191
+ return { text, content: desktop && route.length === path.nodeIds.length && cells <= column.width ? <Box flexDirection="row" height={1} gap={1} overflow="hidden">
192
+ {route.flatMap((node, index) => [
193
+ index ? <Text key={`arrow:${index}`} fg={state.selected ? colors.selectedText : colors.textMuted}>→</Text> : null,
194
+ node.ticker ? <Badge key={node.id} label={node.ticker} tone="accent" color={state.selected ? colors.selectedText : undefined} />
195
+ : <Text key={node.id} fg={state.selected ? colors.selectedText : node.aggregate || node.anonymous ? colors.textDim : ink}>{node.name}</Text>,
196
+ ])}
197
+ </Box> : undefined };
198
+ }
199
+ if (column.id === "relationships") {
200
+ const relationships = [...new Set(path.linkIds.map(id => data.links.find(link => link.id === id)!.relationship))];
201
+ const label = (relationship: typeof relationships[number]) => relationship === "commerce" ? "Trade" : roleLabel(relationship);
202
+ return { text: relationships.map(label).join(" / "), content: <Box flexDirection="row" height={1} gap={1} overflow="hidden">
203
+ {relationships.map(relationship => {
204
+ const color = relationship === "commerce" ? colors.textMuted : ROLE_COLORS[relationship];
205
+ return <Box key={relationship} flexDirection="row" gap={1} flexShrink={0}>
206
+ {desktop ? <Box width={1} height={1} alignItems="center" justifyContent="center"><Box style={{ width: 6, height: 6, borderRadius: "50%", backgroundColor: color }} /></Box>
207
+ : <Text fg={color}>●</Text>}
208
+ <Text fg={state.selected ? colors.selectedText : color}>{label(relationship)}</Text>
209
+ </Box>;
210
+ })}
211
+ </Box> };
212
+ }
213
+ return { text: column.id === "hops" ? String(path.hops) : column.id === "score" ? path.score.toFixed(4) : column.id === "confidence" ? `${Math.round(path.confidence * 100)}%` : exposureLabel(path, data) };
214
+ }} showHorizontalScrollbar selectedTextOverridesCellColor resetScrollKey={`${focus}:${target}:${JSON.stringify(options)}`} /> : null}
215
+ </PaneStatusBody>}
216
+ {data?.access === "preview" ? <UpgradeLabel text="Upgrade for four hops and every relationship" onPress={openUpgrade} role="supply-upgrade" /> : null}
217
+ </Box>} />;
218
+ }
@@ -0,0 +1,163 @@
1
+ import { useEffect, useMemo, useRef, useState } from "react";
2
+ import { ActionRow, Badge, Button, usePaneStatusFooter } from "../../../components";
3
+ import { Box, ChartSurface, ScrollBox, Span, Text, TextAttributes, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
4
+ import type { ChartVectorShape } from "../../../ui/host";
5
+ import type { GraphPath, GraphPayload } from "../../../api-client/supply-chain-graph";
6
+ import type { SupplyEntity, SupplyRole } from "../../../api-client/supply-chain";
7
+ import { useThemeColors } from "../../../theme/theme-context";
8
+ import { useShortcut } from "../../../react/input";
9
+ import { useScrollBoxLayout } from "../../../components/use-scrollbox-layout";
10
+ import { isPlainKey } from "../../../utils/keyboard";
11
+ import { displayWidth, truncateToDisplayWidth } from "../../../utils/format";
12
+ import { useStaticChartBitmapSize } from "../../../components/chart/composite/bitmap";
13
+ import { drawLine, fillOpaque, parseHex } from "../../../components/chart/native/raster/primitives";
14
+ import { entityLabel, graphNodes } from "./graph-model";
15
+ import { ROLE_COLORS } from "./model";
16
+ import { blendHex } from "../../../theme/colors";
17
+
18
+ export function SupplyGraph({ data, width, height, focused, selectedId, selectedPath, collapsed, onSelect, onRecenter, onVisible }: {
19
+ data: GraphPayload; width: number; height: number; focused: boolean; selectedId: string | null; selectedPath: GraphPath | null;
20
+ collapsed: string[]; onSelect: (id: string) => void; onRecenter: (entity: SupplyEntity) => void; onVisible: (ids: string[]) => void;
21
+ }) {
22
+ const scrollRef = useRef<ScrollBoxRenderable>(null);
23
+ const colors = useThemeColors(), desktop = !!useUiCapabilities().nativePaneChrome;
24
+ const nodes = useMemo(() => graphNodes(data, collapsed, selectedPath), [data, collapsed, selectedPath]);
25
+ const [pages, setPages] = useState<Record<number, number>>({});
26
+ useEffect(() => setPages({}), [data]);
27
+ const columns = [...new Set(nodes.map(node => node.column))].sort((a, b) => a - b);
28
+ const cellWidth = Math.max(24, Math.floor(width / Math.max(columns.length, 1)));
29
+ const plotWidth = Math.max(width, columns.length * cellWidth);
30
+ const plotHeight = Math.max(6, height - 1);
31
+ const capacity = Math.max(1, Math.floor((plotHeight - 3) / 3));
32
+ const visible = columns.flatMap(column => {
33
+ const peers = nodes.filter(node => node.column === column), start = ((pages[column] ?? 0) * capacity) % Math.max(1, peers.length);
34
+ const page = peers.slice(start, start + capacity);
35
+ const required = peers.find(node => selectedPath?.nodeIds.includes(node.entity.id));
36
+ if (required && !page.includes(required)) page[page.length - 1] = required;
37
+ return page;
38
+ });
39
+ const positioned = visible.map(node => {
40
+ const peers = visible.filter(peer => peer.column === node.column), index = peers.findIndex(peer => peer.entity.id === node.entity.id);
41
+ return { ...node, x: columns.indexOf(node.column) * cellWidth + 1, y: 2 + (peers.length === 1 ? Math.floor((plotHeight - 5) / 2) : index * 3) };
42
+ });
43
+ const positions = new Map(positioned.map(node => [node.entity.id, node]));
44
+ const revealSelected = () => {
45
+ const scroll = scrollRef.current, selected = positions.get(selectedId ?? data.entity?.id ?? "");
46
+ if (!scroll || !selected) return;
47
+ const viewportWidth = scroll.viewport?.width ?? width;
48
+ const left = scroll.scrollLeft ?? 0;
49
+ if (selected.x < left) scroll.scrollLeft = Math.max(0, selected.x - 1);
50
+ else if (selected.x + cellWidth > left + viewportWidth) scroll.scrollLeft = selected.x + cellWidth - viewportWidth;
51
+ };
52
+ useEffect(revealSelected, [selectedId, data, cellWidth, width]);
53
+ useScrollBoxLayout(scrollRef, revealSelected);
54
+ const pathLinks = new Set(selectedPath?.linkIds ?? []);
55
+ const vectors: ChartVectorShape[] = data.links.flatMap(link => {
56
+ const from = positions.get(link.from), to = positions.get(link.to);
57
+ if (!from || !to) return [];
58
+ const left = from.x <= to.x ? from : to, right = from.x <= to.x ? to : from;
59
+ const highlighted = pathLinks.has(link.id);
60
+ const tone = ROLE_COLORS[link.relationship === "commerce" ? (left.column < 0 ? "supplier" : "customer") : link.relationship];
61
+ const opacity = selectedPath && !highlighted ? .15 : Math.max(.28, link.confidence);
62
+ const start = left.x + cellWidth - 3, end = right.x;
63
+ return [{ id: link.id, color: blendHex(colors.bg, tone, opacity), strokeWidth: highlighted ? 3 : 1.2,
64
+ points: Array.from({ length: 33 }, (_, i) => { const t = i / 32, smooth = t * t * (3 - 2 * t); return { x: (start + (end - start) * t) / plotWidth, y: (left.y + 1 + (right.y - left.y) * smooth) / plotHeight }; }) }];
65
+ });
66
+ const visibleIds = vectors.map(vector => vector.id).join("\n");
67
+ useEffect(() => { onVisible(visibleIds ? visibleIds.split("\n") : []); }, [visibleIds, onVisible]);
68
+ const bitmapSize = useStaticChartBitmapSize(plotWidth, plotHeight);
69
+ const vectorKey = JSON.stringify(vectors);
70
+ const bitmap = useMemo(() => {
71
+ if (desktop || !bitmapSize) return null;
72
+ const { pixelWidth: w, pixelHeight: h } = bitmapSize;
73
+ const pixels = new Uint8Array(w * h * 4); fillOpaque(pixels, parseHex(colors.bg));
74
+ for (const vector of vectors) for (let i = 1; i < vector.points.length; i++) {
75
+ const a = vector.points[i - 1]!, b = vector.points[i]!;
76
+ drawLine(pixels, w, h, a.x * w, a.y * h, b.x * w, b.y * h, parseHex(vector.color), vector.strokeWidth ?? 1);
77
+ }
78
+ return { width: w, height: h, pixels };
79
+ }, [desktop, bitmapSize, vectorKey, colors.bg]);
80
+ const fallback = useMemo(() => {
81
+ if (desktop) return [];
82
+ const grid = Array.from({ length: plotHeight }, () => Array.from({ length: plotWidth }, () => ({ mask: 0, color: colors.textDim })));
83
+ const bits = [[1, 8], [2, 16], [4, 32], [64, 128]];
84
+ for (const vector of vectors) for (let p = 1; p < vector.points.length; p++) {
85
+ const a = vector.points[p - 1]!, b = vector.points[p]!;
86
+ const steps = Math.ceil(Math.max(Math.abs(b.x - a.x) * plotWidth * 2, Math.abs(b.y - a.y) * plotHeight * 4)) + 1;
87
+ for (let i = 0; i <= steps; i++) {
88
+ const px = Math.floor((a.x + (b.x - a.x) * i / steps) * plotWidth * 2), py = Math.floor((a.y + (b.y - a.y) * i / steps) * plotHeight * 4);
89
+ const cell = grid[Math.floor(py / 4)]?.[Math.floor(px / 2)];
90
+ if (cell && px >= 0 && py >= 0) { cell.mask |= bits[py % 4]![px % 2]!; cell.color = vector.color; }
91
+ }
92
+ }
93
+ return grid.map(line => {
94
+ const spans: { text: string; color: string }[] = [];
95
+ for (const cell of line) { const char = cell.mask ? String.fromCharCode(0x2800 + cell.mask) : " "; if (spans.at(-1)?.color === cell.color) spans.at(-1)!.text += char; else spans.push({ text: char, color: cell.color }); }
96
+ return spans;
97
+ });
98
+ }, [desktop, plotHeight, plotWidth, vectorKey, colors.textDim]);
99
+ const pageColumn = positions.get(selectedId ?? "")?.column ?? columns.find(column => nodes.filter(node => node.column === column).length > capacity);
100
+ const pageCount = pageColumn === undefined ? 1 : Math.ceil(nodes.filter(node => node.column === pageColumn).length / capacity);
101
+ const advancePage = (column: number, delta: number) => {
102
+ const peers = nodes.filter(node => node.column === column), count = Math.ceil(peers.length / capacity);
103
+ const next = ((pages[column] ?? 0) + delta + count) % count;
104
+ setPages(old => ({ ...old, [column]: next }));
105
+ if (peers[next * capacity]) onSelect(peers[next * capacity]!.entity.id);
106
+ };
107
+ const page = (delta: number) => { if (pageColumn !== undefined) advancePage(pageColumn, delta); };
108
+ usePaneStatusFooter({ registrationId: "supply-graph:paging", enabled: focused && pageCount > 1, hints: [
109
+ { id: "previous-layer-page", key: "[", label: "previous companies", onPress: () => page(-1) },
110
+ { id: "next-layer-page", key: "]", label: "next companies", onPress: () => page(1) },
111
+ ] });
112
+ useShortcut(event => {
113
+ if (!focused || event.defaultPrevented || !visible.length) return;
114
+ const index = Math.max(0, visible.findIndex(node => node.entity.id === selectedId));
115
+ if (isPlainKey(event, "j", "down", "k", "up")) onSelect(visible[(index + (isPlainKey(event, "j", "down") ? 1 : -1) + visible.length) % visible.length]!.entity.id);
116
+ else if (isPlainKey(event, "return", "enter")) onRecenter(visible[index]!.entity);
117
+ else return;
118
+ event.preventDefault(); event.stopPropagation();
119
+ });
120
+ return <ScrollBox ref={scrollRef} width={width} height={height} flexGrow={1} flexBasis={0} minHeight={0} scrollX scrollY focusable={false}>
121
+ <Box width={plotWidth} height={plotHeight} flexShrink={0} position="relative">
122
+ <ChartSurface width={plotWidth} height={plotHeight} position="absolute" top={0} left={0} vectors={desktop ? vectors : undefined} bitmap={bitmap} aria-label="Supply chain multi-hop graph">
123
+ {!desktop ? fallback.map((spans, y) => <Text key={y}>{spans.map((span, i) => <Span key={i} fg={span.color}>{span.text}</Span>)}</Text>) : null}
124
+ </ChartSurface>
125
+ {columns.map((column, index) => <Box key={column} position="absolute" top={0} left={index * cellWidth + 1} width={cellWidth - 2}><Text fg={column < 0 ? ROLE_COLORS.supplier : column > 0 ? ROLE_COLORS.customer : colors.textMuted}>{column < 0 ? `${-column} HOP${column === -1 ? "" : "S"}` : column > 0 ? `${column} HOP${column === 1 ? "" : "S"}` : "FOCUS"}</Text></Box>)}
126
+ {columns.map((column, index) => {
127
+ const count = nodes.filter(node => node.column === column).length;
128
+ return count > capacity ? <Box key={`page:${column}`} position="absolute" top={plotHeight - 1} left={index * cellWidth + 1} width={cellWidth - 2}><ActionRow label="Next companies" onPress={() => advancePage(column, 1)} /></Box> : null;
129
+ })}
130
+ {positioned.map(node => {
131
+ const relationship = data.links.find(link => node.path?.linkIds.includes(link.id) && link.relationship !== "commerce")?.relationship;
132
+ const role: SupplyRole | null = !node.hops ? null : node.related && relationship && relationship !== "commerce" ? relationship : node.column < 0 ? "supplier" : "customer";
133
+ const accent = role ? ROLE_COLORS[role] : colors.textMuted;
134
+ const active = node.entity.id === selectedId, company = !node.entity.aggregate && !node.entity.anonymous;
135
+ const kind = node.entity.aggregate ? "group" : node.entity.anonymous ? "undisclosed" : null;
136
+ const inner = cellWidth - 5;
137
+ const tickerWidth = node.entity.ticker ? displayWidth(node.entity.ticker) + 3 : 0;
138
+ const showTicker = company && tickerWidth > 0 && inner >= tickerWidth + 5;
139
+ const prefix = collapsed.includes(node.entity.id) ? "+ " : "";
140
+ const name = truncateToDisplayWidth(prefix + (showTicker ? node.entity.name : entityLabel(node.entity)), inner - (showTicker ? tickerWidth : 0));
141
+ const relation = kind ?? (node.related ? `${node.hops > 1 ? "via " : ""}${role}` : role);
142
+ const confidence = `${Math.round((node.path?.confidence ?? 0) * 100)}%`;
143
+ const detail = node.hops ? `${node.hops}H · ${relation}${inner >= displayWidth(relation ?? "") + 12 ? ` · ${confidence}` : ""}` : showTicker ? "Focus company" : node.entity.name;
144
+ return <Box key={node.entity.id} position="absolute" left={node.x} top={node.y} width={cellWidth - 3} height={2} zIndex={10} flexDirection="column" overflow="hidden"
145
+ backgroundColor={active ? desktop ? blendHex(colors.bg, accent, 0.2) : colors.selected : node.hops ? blendHex(colors.bg, accent, desktop ? 0.09 : 0.12) : colors.panel}
146
+ style={desktop ? { borderLeft: role ? `3px solid ${accent}` : undefined, border: role ? undefined : `1px solid ${blendHex(colors.bg, colors.textBright, 0.35)}`,
147
+ borderRadius: role ? 3 : 6, paddingLeft: 6, cursor: "pointer", boxShadow: active ? `inset 0 0 0 1px ${blendHex(colors.bg, accent, 0.6)}` : undefined } : undefined}
148
+ onMouseOver={() => onSelect(node.entity.id)} data-gloom-role="supply-graph-node">
149
+ <Button label={`${prefix}${entityLabel(node.entity)}`} title={node.entity.name} variant="plain" compact flush stopPropagation height={2} width={cellWidth - (desktop ? 5 : 3)} onPress={() => onRecenter(node.entity)}>
150
+ <Box flexDirection="column" width="100%">
151
+ <Box flexDirection="row" height={1} gap={desktop ? 1 : 0} overflow="hidden">
152
+ {!desktop ? <Text fg={accent}>▍</Text> : null}
153
+ <Text fg={active && !desktop ? colors.selectedText : company ? colors.textBright : colors.textDim} attributes={company ? TextAttributes.BOLD : 0}>{name}</Text>
154
+ {showTicker ? desktop ? <Badge label={node.entity.ticker!} tone="accent" /> : <Text fg={active ? colors.selectedText : colors.textDim}>{` ${node.entity.ticker}`}</Text> : null}
155
+ </Box>
156
+ <Box height={1} paddingLeft={desktop ? 0 : 1} overflow="hidden"><Text fg={active && !desktop ? colors.selectedText : colors.textDim}>{truncateToDisplayWidth(detail, inner)}</Text></Box>
157
+ </Box>
158
+ </Button>
159
+ </Box>;
160
+ })}
161
+ </Box>
162
+ </ScrollBox>;
163
+ }
@@ -0,0 +1,105 @@
1
+ import type { GraphPath, GraphPayload } from "../../../api-client/supply-chain-graph";
2
+ import type { HeadlessBundleResult, HeadlessPaneDefinition } from "../../../types/plugin";
3
+ import { fetchSupplyChain } from "./client";
4
+ import { evidenceLabel, isUnconfirmed, matchesSupplyOptions, supplyOptions, trustTier } from "./trust";
5
+ import { fetchSupplyGraph, graphOptions } from "./graph-client";
6
+ import { exposureLabel, pathLabel } from "./graph-model";
7
+
8
+ const pathColumns = [
9
+ { key: "route", header: "Route" }, { key: "hops", header: "Hops" },
10
+ { key: "score", header: "Rank score", description: "Product of normalized edge weights; not a probability." },
11
+ { key: "confidence", header: "Confidence" }, { key: "exposureLabel", header: "Estimated exposure" },
12
+ ];
13
+ function graphReport(data: GraphPayload, target: string): HeadlessBundleResult {
14
+ const links = new Map(data.links.map(link => [link.id, link]));
15
+ const nodes = new Map(data.nodes.map(node => [node.id, node]));
16
+ const route = (path: GraphPath) => ({ ...path, route: pathLabel(path, data), exposureLabel: exposureLabel(path, data),
17
+ exposure: path.exposure ? { ...path.exposure, denominatorEntity: nodes.get(path.exposure.denominatorEntityId) } : null,
18
+ evidence: path.linkIds.map((id, index) => ({ hop: index + 1, linkId: id, from: nodes.get(path.nodeIds[index]!),
19
+ to: nodes.get(path.nodeIds[index + 1]!), primaryEvidenceId: links.get(id)!.primaryEvidenceId, disclosures: links.get(id)!.evidence })),
20
+ });
21
+ const sections: HeadlessBundleResult["sections"] = target
22
+ ? [{ title: `Routes to ${data.target?.name ?? target}`, columns: pathColumns, rows: data.paths.map(route) }]
23
+ : (["upstream", "downstream", "related"] as const).map(direction => ({
24
+ title: direction === "upstream" ? "Upstream suppliers" : direction === "downstream" ? "Downstream customers" : "Related companies",
25
+ columns: [{ key: "company", header: "Company" }, { key: "ticker", header: "Ticker" }, ...pathColumns],
26
+ rows: data[direction].map(reach => ({ ...route(data.options.ranking === "shortest" ? reach.shortestPath : reach.bestPath), entityId: reach.entityId, company: nodes.get(reach.entityId)?.name,
27
+ ticker: nodes.get(reach.entityId)?.ticker, direction: reach.direction, bestPath: route(reach.bestPath), shortestPath: route(reach.shortestPath) })),
28
+ }));
29
+ sections.push({ title: "Disclosure evidence", columns: [
30
+ { key: "reporter", header: "Reporting company" }, { key: "from", header: "Supplier / from" }, { key: "to", header: "Customer / to" },
31
+ { key: "role", header: "Role" }, { key: "pct", header: "% disclosed" }, { key: "denominator", header: "Denominator" },
32
+ { key: "period", header: "Period" }, { key: "filed", header: "Filed" }, { key: "confidence", header: "Confidence" },
33
+ { key: "quote", header: "Quote" }, { key: "filingUrl", header: "Filing" },
34
+ ], rows: data.links.flatMap(link => link.evidence.map(item => ({ id: item.id, linkId: link.id, primary: item.id === link.primaryEvidenceId,
35
+ reporter: item.reporter.name, from: item.from.name, to: item.to.name, role: item.role, pct: item.pctOfRevenue ?? null,
36
+ denominator: item.pctBasis && !(item.sourceKind === "xbrl" && item.pctScope) ? `${item.reporter.name} ${item.pctBasis}${item.pctScope ? ` (${item.pctScope})` : ""}` : null,
37
+ pctBasis: item.pctBasis, pctScope: item.pctScope, period: item.period, filed: item.filedDate, asOf: item.asOf,
38
+ confidence: item.confidence, quote: item.quote, quoteLanguage: item.quoteLanguage, quoteGloss: item.quoteGloss ?? null,
39
+ quoteGlossKind: item.quoteGloss ? "machine_translation" : null, nativeAmount: item.nativeAmount ?? null,
40
+ nativeCurrency: item.nativeCurrency ?? null, nativeScale: item.nativeScale ?? null, jurisdiction: item.jurisdiction,
41
+ entityScope: item.entityScope ?? null, sectionRef: item.sectionRef ?? null, sourceAttribution: item.sourceAttribution ?? null,
42
+ filingUrl: item.filingUrl, evidence: item,
43
+ }))) });
44
+ const errors = data.search.reasons.map(reason => `Graph search incomplete: ${reason.replaceAll("_", " ")}`);
45
+ if (data.access === "preview") errors.push("Gloom Pro is required for full graph depth and results");
46
+ if (!data.entity) errors.push("The focus company could not be resolved");
47
+ if (target && !data.target) errors.push("The target company could not be resolved");
48
+ if (data.truncated && !errors.length) errors.push("Graph results are truncated");
49
+ return { sections, complete: data.access === "full" && !!data.entity && (!target || !!data.target) && data.search.complete && !data.truncated && data.requestedDepth <= data.maxDepth,
50
+ errors, metadata: { symbol: data.symbol, target: data.target, asOf: data.asOf, snapshotAt: data.snapshotAt,
51
+ access: data.access, requestedDepth: data.requestedDepth, maxDepth: data.maxDepth, options: data.options,
52
+ search: data.search, truncated: data.truncated, methodology: data.methodology, graph: data } };
53
+ }
54
+
55
+ export const supplyChainHeadless: HeadlessPaneDefinition<"bundle"> = {
56
+ shape: "bundle",
57
+ argument: { kind: "ticker", description: "Company ticker, exchange-qualified ticker, or id:<entity-id>.", placeholder: "ticker" },
58
+ discovery: { aliases: ["SPLC", "SUPPLY"], dataRequirements: ["Gloom Cloud relationship evidence (Pro with free preview)"],
59
+ limitations: ["Filings, company announcements, earnings calls and news where evidence is available globally", "Japan filings await an API key and Taiwan report ingestion is disabled", "English glosses are machine translations, separate from original evidence", "Absence is not proof of no relationship",
60
+ "Table/Flow free preview: three relationships per role in each direction", "Pro: up to four hops; free graph preview: one hop and three results per section", "Reverse percentages belong to the reporting company",
61
+ "Path rank scores are not probabilities; chained percentages are estimates", "Search limits and incomplete reasons accompany every graph report",
62
+ "Unconfirmed leads are opt-in and excluded from flow and disclosed values", "Restricted publisher articles expose links only",
63
+ "Table and Flow evidence tiers differ from Graph and Path evidence tiers"] },
64
+ options: [
65
+ { key: "view", type: "enum", settingKey: "view", defaultValue: "says", values: [{ value: "says" }, { value: "names" }], description: "Statements by the company, or other sources naming it." },
66
+ { key: "tab", type: "enum", settingKey: "tab", defaultValue: "table", values: ["table", "flow", "graph", "path"].map(value => ({ value })), description: "Disclosures table, direct flow, multi-hop graph or routes to a target." },
67
+ { key: "route", type: "integer", minimum: 1, maximum: 50, defaultValue: 1, settingKey: "route", description: "Selected route for graph and evidence screenshots." },
68
+ { key: "evidence", type: "boolean", settingKey: "evidence", defaultValue: false, description: "Open selected relationship or path evidence in screenshots." },
69
+ { key: "depth", type: "integer", settingKey: "depth", minimum: 1, maximum: 4, defaultValue: 2, description: "Maximum graph depth in hops (Pro)." },
70
+ { key: "direction", type: "enum", settingKey: "direction", defaultValue: "both", values: ["upstream", "downstream", "both"].map(value => ({ value })), description: "Follow upstream suppliers, downstream customers, or both." },
71
+ { key: "roles", type: "string", settingKey: "roles", description: "Comma-separated customer,supplier,partner,competitor,investee roles." },
72
+ { key: "sources", type: "string", settingKey: "sources", description: "Comma-separated xbrl,filing_text,press_release,call,news,web,import source kinds." },
73
+ { key: "tiers", type: "string", settingKey: "tiers", description: "Table/Flow: sec (regulatory filings),company,call,reported,unconfirmed (default sec,company,call; unconfirmed opts into leads). Graph/Path: structured,primary,secondary,imported (default all)." },
74
+ { key: "min-pct", type: "string", settingKey: "minPct", defaultValue: "0", description: "Minimum disclosed percentage, 0 to 100; positive thresholds exclude unknown percentages." },
75
+ { key: "min-confidence", type: "string", settingKey: "minConfidence", defaultValue: "0", description: "Minimum edge confidence, 0 to 1." },
76
+ { key: "limit", type: "integer", settingKey: "limit", minimum: 1, maximum: 50, defaultValue: 50, description: "Maximum results per graph section or paths." },
77
+ { key: "ranking", type: "enum", settingKey: "ranking", defaultValue: "score", values: [{ value: "score" }, { value: "shortest" }], description: "Rank paths by edge-weight product or fewest hops." },
78
+ { key: "as-of", type: "string", settingKey: "asOf", description: "Include disclosures known by this date (YYYY-MM-DD)." },
79
+ { key: "to", type: "string", settingKey: "to", description: "Target company ticker or id:<entity-id>; required for Path." },
80
+ ],
81
+ describe: (args) => `Supply chain | ${args.symbols[0]}${args.options.to ? ` → ${args.options.to}` : ""}`,
82
+ async load(args, ctx) {
83
+ if (args.options.tab === "graph" || args.options.tab === "path") {
84
+ const target = String(args.options.to ?? "").trim();
85
+ if (args.options.tab === "path" && !target) throw new Error("Path requires a target company: --to TICKER");
86
+ return graphReport(await fetchSupplyGraph(args.symbols[0]!, graphOptions(args.options), target, ctx.apiClient), target);
87
+ }
88
+ const options = supplyOptions(args.options.tiers);
89
+ const data = await fetchSupplyChain(args.symbols[0]!, ctx.apiClient, options);
90
+ return { complete: !data.truncated, errors: data.truncated ? ["Additional relationships need Gloom Pro"] : [],
91
+ sections: (["says", "names"] as const).flatMap((view) => [false, true].map((leads) => ({ title: `${view === "says" ? `${data.symbol} says` : `Names ${data.symbol}`}${leads ? " | Unconfirmed" : ""}`,
92
+ rows: data[view].filter((row) => matchesSupplyOptions(row, options) && isUnconfirmed(row) === leads).map((row) => ({ counterparty: row.counterparty.name, ticker: row.counterparty.ticker, aggregate: row.counterparty.aggregate, role: row.role, direction: row.direction,
93
+ pct: row.pctOfRevenue, pctBasis: row.pctBasis, pctScope: row.pctScope, usd: row.usd, usdBasis: row.usdBasis, period: row.period, fiscalYear: row.fiscalYear,
94
+ nativeAmount: row.nativeAmount ?? null, nativeCurrency: row.nativeCurrency ?? null, nativeScale: row.nativeScale ?? null,
95
+ jurisdiction: row.jurisdiction ?? null, entityScope: row.entityScope ?? null,
96
+ evidenceTier: evidenceLabel(row), tier: trustTier(row), claimType: row.claimType, corroboration: row.corroboration ?? 1,
97
+ leadStatus: row.leadStatus ?? "none", whyUnconfirmed: row.whyUnconfirmed ?? null,
98
+ firstSeenAt: row.firstSeenAt, lastSeenAt: row.lastSeenAt, lastConfirmedAt: row.lastConfirmedAt,
99
+ source: row.sourceKind, filed: row.filedDate, confidence: row.confidence, reportingCompany: row.reportingEntity.name,
100
+ quote: row.quote, quoteLanguage: row.quoteLanguage, quoteGloss: row.quoteGloss ?? null, quoteGlossKind: row.quoteGloss ? "machine_translation" : null,
101
+ quoteMatchMode: row.quoteMatchMode, sourceUrl: row.filingUrl, filingUrl: row.filingUrl, sectionRef: row.sectionRef ?? null, sourceAttribution: row.sourceAttribution ?? null,
102
+ evidence: row.evidence ?? [] })) })).filter((section) => section.rows.length > 0)),
103
+ metadata: { symbol: data.symbol, asOf: data.asOf, counts: data.counts, tierCounts: data.tierCounts, tiers: options.tiers, disclaimer: data.disclaimer } };
104
+ },
105
+ };
@@ -0,0 +1,17 @@
1
+ import type { PluginModule } from "../plugin-module";
2
+ import { createTickerSurfacePaneTemplate } from "../shared/ticker-surface";
3
+ import { graphCache } from "./graph-client";
4
+ import { supplyChainCache } from "./client";
5
+ import { supplyChainHeadless } from "./headless";
6
+ import { SupplyChainPane } from "./pane";
7
+
8
+ export const supplyChainModule: PluginModule = {
9
+ setup(ctx) { supplyChainCache.attach(ctx.persistence); graphCache.attach(ctx.persistence); },
10
+ dispose() { supplyChainCache.reset(); graphCache.reset(); },
11
+ panes: [{ id: "supply-chain", name: "Supply Chain", icon: "S", component: SupplyChainPane,
12
+ defaultPosition: "right", defaultMode: "floating", defaultFloatingSize: { width: 130, height: 30 },
13
+ tickerFollower: true, tableExport: true, headless: supplyChainHeadless }],
14
+ paneTemplates: [{ ...createTickerSurfacePaneTemplate({ id: "supply-chain-pane", paneId: "supply-chain", label: "Supply Chain",
15
+ description: "Pro global supply chain evidence from filings, company announcements, calls and news, with trust tiers, original quotes, native units, four-hop graphs, ranked paths and a free preview.",
16
+ keywords: ["supply", "supply chain", "suppliers", "customers", "concentration", "filings", "earnings calls", "news", "evidence", "global", "Korea", "Japan", "Taiwan", "graph", "paths", "Pro"], shortcut: "SPLC", shortcutAliases: ["SUPPLY"] }), headless: supplyChainHeadless }],
17
+ };