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,185 @@
1
+ import { useCallback, useMemo } from "react";
2
+ import { isAccessDenied } from "../../../api-client/errors";
3
+ import { usePlanAccess } from "../../../api-client/plan-access";
4
+ import type { CreditDocumentsPayload, CreditHeadroom, CreditInstrument, CreditScreenPayload, CreditScreenRow } from "../../../api-client/credit-documents";
5
+ import { ChartTableHeader, DataTableView, EmptyState, PageStackView, PaneStatusBody, QueryBar, useChartTableSelection, usePaneFooter, usePaneNoticeFooter, usePaneStatusFooter, usePaneTabs, type DataTableCell, type DataTableColumn, type PaneHint } from "../../../components";
6
+ import { formatCompactAxis } from "../../../components/chart-table";
7
+ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
8
+ import { useAsyncResource, useAutoRefresh, usePaneSettingValue, usePluginAppActions, usePluginPaneState } from "../../../public/react";
9
+ import { usePaneTickerIdentity } from "../../../state/hooks/pane-ticker";
10
+ import { useThemeColors } from "../../../theme/theme-context";
11
+ import type { PaneProps } from "../../../types/plugin";
12
+ import { Box, Text, useUiCapabilities } from "../../../ui";
13
+ import { SignInWall } from "../cloud/auth-actions";
14
+ import { CLOUD_PLAN_KEY, useCloudUpgradeAction } from "../shared/cloud-upgrade";
15
+ import { Blurred, LockedOverlay, UpgradeLabel } from "../shared/locked-rows";
16
+ import { isCloudSessionRequired, useResearchCloudSession } from "../shared/research-cloud-session";
17
+ import { cachedCredit, creditIssuerSymbol, CREDIT_UNAVAILABLE, fetchCreditScreen, loadCredit, validateCreditDocuments } from "./client";
18
+ import { CreditInstrumentDetail } from "./detail";
19
+ import { useCreditEvidence } from "./evidence";
20
+ import { HeadroomGauge } from "./gauge";
21
+ import { capitalCell, capitalColumns, capitalFigures, comparatorSymbol, covenantColumns, covenantUsage, CREDIT_TABS, creditAmount, covenantNumber, creditCurrencies, creditMaturityRows, creditPercent, creditTab, fieldLabel, headroomTone, instrumentOutstanding, isClosed, maturityAxis, maturityColumns, maturitySeries, maturityShares, NO_VALUE, screenColumns, screenRowId, sentence } from "./model";
22
+
23
+ type Row = { numbers?: Record<string, number | null>; id: string; values: Record<string, string>; instrumentId?: string; covenant?: CreditHeadroom; screen?: CreditScreenRow; year?: number; locked?: boolean; closed?: boolean };
24
+ const rowId = (row: Row) => row.id;
25
+ /** Cells a footer hint takes: `[k]label` and the space before it. */
26
+ const hintCells = (hint: PaneHint) => hint.key.length + hint.label.length + 3;
27
+
28
+ export function CreditDocumentsPane(props: PaneProps) {
29
+ const { symbol } = usePaneTickerIdentity();
30
+ const session = useResearchCloudSession(), access = usePlanAccess();
31
+ const accessKey = `${session.requestKey}:${access.hasProAccess ? "full" : "preview"}`;
32
+ return <CreditView key={`${symbol}:${accessKey}`} {...props} symbol={symbol} accessKey={accessKey} needsVerification={session.needsVerification} />;
33
+ }
34
+ function CreditView({ symbol, width, height, focused, accessKey, needsVerification }: PaneProps & { symbol: string | null; accessKey: string; needsVerification: boolean }) {
35
+ const colors = useThemeColors(), desktop = !!useUiCapabilities().nativePaneChrome;
36
+ const { createPaneFromTemplate } = usePluginAppActions();
37
+ const openUpgrade = useCloudUpgradeAction("crdoc");
38
+ const [openingTab] = usePaneSettingValue("tab", "capital");
39
+ const [savedTab, setTab] = usePluginPaneState<string>("credit:tab", openingTab);
40
+ const tab = creditTab(savedTab);
41
+ const [openingInstrument] = usePaneSettingValue<string | null>("instrument", null);
42
+ const [openId, setOpen] = usePluginPaneState<string | null>("credit:instrument", openingInstrument);
43
+ const [openingView] = usePaneSettingValue("view", "terms");
44
+ const [view, setView] = usePluginPaneState<string>("credit:view", openingView);
45
+ const [headroomSetting] = usePaneSettingValue("headroom", 20);
46
+ const [headroom, setHeadroom] = usePluginPaneState<number>("credit:headroom", headroomSetting);
47
+ const [monthsSetting] = usePaneSettingValue("months", 12);
48
+ const [months, setMonths] = usePluginPaneState<number>("credit:months", monthsSetting);
49
+ const [currency, setCurrency] = usePluginPaneState<string>("credit:currency", "");
50
+ const [sort, setSort] = usePluginPaneState<{column: string | null; direction: "asc" | "desc"}>(`credit:sort:${tab}`, {column: tab === "maturities" ? "year" : null, direction: "asc"});
51
+ const [selectedId, setSelected] = usePluginPaneState<string | null>(`credit:selected:${tab}`, null);
52
+ const [snapshotSetting] = usePaneSettingValue<CreditDocumentsPayload | null>("creditSnapshot", null);
53
+ const [screenSnapshot] = usePaneSettingValue<CreditScreenPayload | null>("creditScreenSnapshot", null);
54
+ const [instrumentSnapshot] = usePaneSettingValue<CreditInstrument | null>("creditInstrumentSnapshot", null);
55
+ const snapshot = useMemo(() => { try { return snapshotSetting ? validateCreditDocuments(snapshotSetting, symbol ? creditIssuerSymbol(symbol) : undefined) : null; } catch { return null; } }, [snapshotSetting, symbol]);
56
+ const loader = useCallback((force: boolean) => snapshot ? Promise.resolve({ payload: snapshot, stale: false, refreshError: null }) : loadCredit(symbol!, accessKey, force), [symbol, accessKey, snapshot]);
57
+ const resource = useAsyncResource(symbol ? loader : null, { initialData: () => symbol ? cachedCredit(symbol, accessKey) : null, clearOnError: isAccessDenied });
58
+ const data = resource.data?.payload ?? null;
59
+ const screenLoader = useCallback(() => screenSnapshot ? Promise.resolve(screenSnapshot) : fetchCreditScreen({ headroomBelow: headroom, springingWithinMonths: months, limit: 100 }), [screenSnapshot, headroom, months, accessKey]);
60
+ const screen = useAsyncResource(tab === "screen" ? screenLoader : null, { clearOnError: isAccessDenied });
61
+ const screenData = screen.data;
62
+ const currencies = data ? creditCurrencies(data) : [];
63
+ const selectedCurrency = currencies.includes(currency) ? currency : currencies[0] ?? "";
64
+ const maturityRows = useMemo(() => data ? creditMaturityRows(data, selectedCurrency) : [], [data, selectedCurrency]);
65
+ const series = useMemo(() => maturitySeries(maturityRows, selectedCurrency, colors.warning), [maturityRows, selectedCurrency, colors.warning]);
66
+ const preview = data?.access === "preview";
67
+ const columns = useMemo<DataTableColumn[]>(() => tab === "capital" ? data ? capitalColumns(data, width) : [] : tab === "covenants" ? covenantColumns(width)
68
+ : tab === "maturities" ? maturityColumns(width, preview) : screenColumns(width), [tab, data, width, preview]);
69
+ const figures = useMemo(() => tab === "capital" && data ? capitalFigures(data) : [], [tab, data]);
70
+ const unsortedRows = useMemo<Row[]>(() => {
71
+ if (tab === "screen") return (screenData?.rows ?? []).map((row) => ({ id: screenRowId(row), instrumentId: row.instrumentId, screen: row, numbers: {value:row.value}, values: { symbol: row.symbol, kind: row.kind === "springing_maturity" ? "Springing maturity" : row.value != null && row.value < 0 ? "Breach" : "Low headroom", value: creditPercent(row.value), date: row.date ?? NO_VALUE, instrument: row.instrumentName, reason: sentence(row.reason) } }));
72
+ if (!data) return [];
73
+ if (tab === "capital") return data.instruments.map((row) => ({ id: row.id, instrumentId: row.id, closed: isClosed(row), numbers: {principal:instrumentOutstanding(row)}, values: Object.fromEntries(["name", "facility", "coupon", "maturity", "principal", "currency", "ranking", "control"].map((id) => [id, capitalCell(row, id, data)])) }));
74
+ if (tab === "covenants") return data.covenants.map((row) => { const fact=data.instruments.find((item) => item.id === row.instrumentId)?.facts.find((item) => item.id === row.id); return ({ id: row.id, instrumentId: row.instrumentId, covenant: row, numbers: {headroom:row.headroomPercent,usage:covenantUsage(row),threshold:row.threshold,current:row.current}, values: { metric: sentence(row.metric), headroom: creditPercent(row.headroomPercent), usage: "", threshold: `${comparatorSymbol(row.comparator, row.inclusive)} ${covenantNumber(row.threshold,fact)}`, current: covenantNumber(row.current,fact), status: fieldLabel(row.status), date: row.asOf, instrument: row.instrumentName } }); });
75
+ const shares = preview ? new Map() : maturityShares(maturityRows);
76
+ return maturityRows.flatMap((row) => row.instruments.map((instrument) => { const id = `${row.year}:${instrument.id}`, share = shares.get(id); return { id, instrumentId: instrument.id, year: row.year, numbers: {year:row.year,principal:instrument.principal,share:share?.share ?? null,cumulative:share?.cumulative ?? null}, values: { year: String(row.year), principal: creditAmount(instrument.principal), share: creditPercent(share?.share), cumulative: creditPercent(share?.cumulative), instruments: instrument.name } }; }));
77
+ }, [data, screenData, tab, maturityRows, preview]);
78
+ const rows = useMemo(() => !sort.column ? unsortedRows : [...unsortedRows].sort((a,b) => {
79
+ const column=sort.column!;
80
+ const left=a.numbers && column in a.numbers ? a.numbers[column] : a.values[column]?.toLowerCase();
81
+ const right=b.numbers && column in b.numbers ? b.numbers[column] : b.values[column]?.toLowerCase();
82
+ return left == null || right == null ? left == right ? a.id.localeCompare(b.id) : left == null ? 1 : -1
83
+ : left === right ? a.id.localeCompare(b.id) : (left < right ? -1 : 1)*(sort.direction === "asc" ? 1 : -1);
84
+ }),[unsortedRows,sort]);
85
+ const selected = rows.find((row) => row.id === selectedId) ?? rows[0] ?? null;
86
+ const screenOpen = rows.find((row) => row.id === openId)?.screen;
87
+ const openInstrument = data?.instruments.find((row) => row.id === openId) ?? (screenOpen ? { id: screenOpen.instrumentId, key: screenOpen.instrumentId, name: screenOpen.instrumentName, currency: screenOpen.currency, facilityType: null, principal: null, commitment: null, drawn: null, maturity: null, facts: screenOpen.evidence } : null);
88
+ const [initialFact] = usePaneSettingValue<string | null>("fact", null);
89
+ const [openFactId, setOpenFact] = usePluginPaneState<string | null>(`credit:fact:open:${openInstrument?.id ?? "none"}`, initialFact);
90
+ const activeSymbol = screenOpen?.symbol ?? symbol;
91
+ const activeCovenant = tab === "covenants" ? data?.covenants.find((row) => row.id === selected?.id && row.instrumentId === openInstrument?.id) ?? null : null;
92
+ const locked = tab === "screen" ? screenData?.lockedRows ?? 0 : data?.lockedRows ?? 0;
93
+ const items = useMemo<Row[]>(() => [...rows, ...Array.from({ length: Math.min(3, locked) }, (_, index) => ({ id: `locked:${index}`, values: {}, locked: true }))], [rows, locked]);
94
+ const { strip, rows: tabRows } = usePaneTabs({ tabs: [...CREDIT_TABS], activeValue: tab, onSelect: (value) => { setTab(value); setOpen(null); }, focused: focused && !openInstrument, dense: true });
95
+ const bodyHeight = Math.max(3, height - tabRows);
96
+ const link = useChartTableSelection({ rows: rows.filter((row) => row.year !== undefined), getId: rowId, getDate: (row) => new Date(Date.UTC(row.year!, 0, 1)), selectedId: selected?.id ?? null, onSelect: setSelected, focused: focused && !openInstrument, enabled: tab === "maturities" });
97
+ useAutoRefresh(resource.updatedAt, resource.load);
98
+ useAutoRefresh(screen.updatedAt, screen.load);
99
+ usePaneRefreshKey(() => { void resource.reload(); if (tab === "screen") void screen.reload(); }, { focused });
100
+ const currentError = tab === "screen" ? screen.error : resource.error;
101
+ const available = tab === "screen" ? !!screenData : !!data;
102
+ const loading = tab === "screen" ? screen.loading : resource.loading;
103
+ const target = activeSymbol ?? symbol ?? "";
104
+ const allHints: PaneHint[] = [
105
+ ...(symbol ? [
106
+ { id: "credit:des", key: "d", label: "es", title: "Description (DES)", onPress: () => createPaneFromTemplate("new-ticker-detail-pane", { symbol: target }) },
107
+ { id: "credit:fa", key: "f", label: "a", title: "Financial analysis (FA)", onPress: () => createPaneFromTemplate("financial-analysis-pane", { symbol: target }) },
108
+ { id: "credit:graph", key: "g", label: "raph", title: "Price chart (G)", onPress: () => createPaneFromTemplate("chart-composer-pane", { arg: target }) },
109
+ { id: "credit:ddis", key: "m", label: "aturities", title: "DDIS maturity schedule", onPress: () => createPaneFromTemplate("debt-maturities-pane", { symbol: target }) },
110
+ { id: "credit:cds", key: "c", label: "ds", title: "CDS trades", onPress: () => createPaneFromTemplate("cds-pane", { symbol: target }) },
111
+ ] : []),
112
+ ...(locked || preview ? [{ id: "credit:upgrade", key: CLOUD_PLAN_KEY, label: "upgrade", title: "Upgrade to Pro", onPress: openUpgrade }] : []),
113
+ ];
114
+ const asOf = tab === "screen" ? screenData?.asOf : data?.asOf;
115
+ const notices = [...(data?.warnings ?? []), ...(resource.data?.refreshError ? [resource.data.refreshError] : []), ...(screenData?.truncated ? ["Screen results reached the result limit; narrow the thresholds."] : [])];
116
+ // A narrow footer keeps the upgrade and the first links; the rest stay bound
117
+ // and move to the pane menu, so the status on the left never gets cut.
118
+ const footerBudget = width - 2 - (asOf ? 17 : 0) - (notices.length ? 5 : 0) - (openInstrument ? 14 : 0);
119
+ const { shown: hints, folded } = useMemo(() => {
120
+ const keep = new Set(allHints.map((hint) => hint.id));
121
+ let used = allHints.reduce((total, hint) => total + hintCells(hint), 0);
122
+ for (const hint of [...allHints].reverse()) {
123
+ if (used <= footerBudget) break;
124
+ if (hint.id === "credit:upgrade") continue;
125
+ keep.delete(hint.id);
126
+ used -= hintCells(hint);
127
+ }
128
+ return { shown: allHints.filter((hint) => keep.has(hint.id)), folded: allHints.filter((hint) => !keep.has(hint.id)) };
129
+ }, [allHints.map((hint) => hint.id).join(), footerBudget, target, openUpgrade, createPaneFromTemplate]);
130
+ usePaneStatusFooter({ registrationId: "credit-documents", loading, error: available ? currentError : null, stale: resource.data?.stale,
131
+ info: asOf ? [{ id: "as-of", parts: [{ text: `as of ${asOf.slice(0, 10)}`, tone: "muted" as const }] }] : [], hints });
132
+ usePaneFooter("credit:folded", () => folded.length ? { keys: folded, menu: folded.map((hint) => ({ id: `credit:menu:${hint.id}`, label: hint.title ?? hint.label, accelerator: hint.key, onSelect: () => hint.onPress?.() })) } : null, [folded]);
133
+ usePaneNoticeFooter({ registrationId: "credit:notices", focused, notices });
134
+ useCreditEvidence(data, screenData ?? null, instrumentSnapshot, tab, view, rows.map(rowId), openInstrument?.id ?? null, openFactId);
135
+ if (!symbol) return <EmptyState title="Select an issuer ticker." />;
136
+ if (!available && isCloudSessionRequired(currentError)) return <SignInWall placement="credit-documents-signin" action="view credit documents" needsVerification={needsVerification} />;
137
+ const query = tab === "screen" ? <QueryBar width={width} filters={[
138
+ { id: "headroom", label: "Headroom below", value: String(headroom), options: [0, 10, 20, 30, 50, 100].map((value) => ({ value: String(value), label: `${value}%` })), onChange: (value) => setHeadroom(Number(value)) },
139
+ { id: "springing", label: "Springing within", value: String(months), options: [3, 6, 12, 24, 36].map((value) => ({ value: String(value), label: `${value} months` })), onChange: (value) => setMonths(Number(value)) },
140
+ ]} /> : tab === "maturities" ? <QueryBar width={width} filters={currencies.length ? [{ id: "currency", label: "Currency", value: selectedCurrency, options: currencies.map((value) => ({ value, label: value })), onChange: setCurrency }] : []} /> : undefined;
141
+ const rootBefore = tab === "maturities" ? <ChartTableHeader width={width} height={bodyHeight} tableRows={rows.length} tableColumns={columns} query={query}
142
+ chart={series.length ? { series, formatValue: creditAmount, formatAxisValue: formatCompactAxis, cursorDate: link.cursorDate, onCursorDateChange: link.onCursorDateChange, remoteKind: "credit-maturity-wall", xAxis: maturityAxis(maturityRows), onActivate: link.onActivate } : null} />
143
+ : tab === "capital" && figures.length ? <ChartTableHeader width={width} height={bodyHeight} tableRows={items.length} tableColumns={columns} figures={figures} /> : query;
144
+ const lockedText = tab === "screen" ? "Upgrade to see every signal" : "Upgrade to see all terms";
145
+ // The terminal prompt sits in the widest column so it is never cut.
146
+ const lockedColumn = columns.find((column) => column.flexGrow)?.id ?? columns[0]?.id;
147
+ const renderCell = (row: Row, column: DataTableColumn, _index: number, state: { selected: boolean }): DataTableCell => {
148
+ if (row.locked) return desktop ? { text: "", content: <Blurred><Text fg={colors.textDim}>{column.id === lockedColumn ? tab === "screen" ? "Additional signal" : "Additional credit document" : "Hidden"}</Text></Blurred> }
149
+ : { text: column.id === lockedColumn && row.id === "locked:0" ? lockedText : "░░░░", color: colors.textDim, ...(column.id === lockedColumn && row.id === "locked:0" ? { content: <UpgradeLabel text={lockedText} onPress={openUpgrade} /> } : {}) };
150
+ if (column.id === "usage" && row.covenant) return { text: "", content: <HeadroomGauge covenant={row.covenant} width={column.width} selected={state.selected} /> };
151
+ const text = row.values[column.id] ?? "";
152
+ const number = row.numbers?.[column.id];
153
+ const value = column.align === "right" && row.numbers && column.id in row.numbers ? number ?? null : undefined;
154
+ if (text === NO_VALUE) return { text, value, color: colors.textMuted };
155
+ if (row.closed) return { text, value, color: colors.textDim };
156
+ if (column.id === "headroom" && row.covenant) {
157
+ const tone = headroomTone(row.covenant);
158
+ return { text, value, color: tone ? colors[tone] : colors.textBright, keepColorWhenSelected: !!tone };
159
+ }
160
+ if (column.id === "value" && row.screen?.kind === "headroom") {
161
+ const tone = row.screen.value == null ? undefined : headroomTone({ headroomPercent: row.screen.value, status: row.screen.value < 0 ? "breach" : "compliant" });
162
+ return { text, value, color: tone ? colors[tone] : colors.text, keepColorWhenSelected: !!tone };
163
+ }
164
+ if (column.id === "status" && row.covenant) {
165
+ const breach = row.covenant.status === "breach";
166
+ return { text, color: breach ? colors.negative : colors.textDim, keepColorWhenSelected: breach };
167
+ }
168
+ return { text, value, color: column.id === columns[0]!.id ? colors.textBright : colors.text };
169
+ };
170
+ return <Box width={width} height={height} flexDirection="column">{strip}
171
+ <PaneStatusBody loading={!available && loading} error={!available && currentError !== CREDIT_UNAVAILABLE ? currentError : null}
172
+ empty={!available && currentError === CREDIT_UNAVAILABLE} emptyTitle={CREDIT_UNAVAILABLE} subject="credit documents">
173
+ {available ? <PageStackView focused={focused && !openFactId} detailOpen={!!openInstrument} onBack={() => setOpen(null)} detailTitle={openInstrument?.name}
174
+ detailContent={openInstrument && activeSymbol ? <CreditInstrumentDetail key={`${activeSymbol}:${openInstrument.id}`} symbol={activeSymbol} instrument={openInstrument} width={width} height={bodyHeight - 1} focused={focused} accessKey={accessKey} view={view} setView={setView} covenant={activeCovenant} openId={openFactId} setOpen={setOpenFact} captured={instrumentSnapshot?.id === openInstrument.id ? instrumentSnapshot : null} pro={data?.access === "full"} onUpgrade={openUpgrade} /> : null}
175
+ rootContent={<DataTableView<Row> columns={columns} items={items} sortColumnId={sort.column} sortDirection={sort.direction} onHeaderClick={(column) => setSort((current) => ({column,direction:current.column === column && current.direction === "asc" ? "desc" : "asc"}))} focused={focused && !openInstrument} rootWidth={width} rootHeight={bodyHeight} rootBefore={rootBefore}
176
+ getItemKey={rowId} selection={{ kind: "id", selectedId: selected?.id ?? null, getId: rowId, onChange: setSelected }}
177
+ onActivate={(row) => row.locked ? openUpgrade() : setOpen(row.screen ? row.id : row.instrumentId ?? null)}
178
+ renderCell={renderCell}
179
+ emptyStateTitle={tab === "screen" ? "No supported credit signals match these thresholds." : tab === "covenants" ? "No financial maintenance covenants documented." : tab === "maturities" ? "No supported instrument maturity amounts." : CREDIT_UNAVAILABLE}
180
+ emptyStateHint={tab === "screen" && (headroom < 100 || months < 36) ? "Raise either threshold to widen the screen." : undefined}
181
+ selectedTextOverridesCellColor showHorizontalScrollbar freezeFirstColumn resetScrollKey={`${symbol}:${tab}:${selectedCurrency}`}
182
+ bodyAfter={locked > 0 && desktop ? <LockedOverlay rows={Math.min(3, locked)} text={lockedText} onPress={openUpgrade} /> : undefined} />} /> : null}
183
+ </PaneStatusBody>
184
+ </Box>;
185
+ }
@@ -278,11 +278,23 @@ function compare(a: unknown, b: unknown): number {
278
278
  return String(a).localeCompare(String(b), undefined, { numeric: true, sensitivity: "base" });
279
279
  }
280
280
 
281
+ function isEmptyValue(value: unknown): boolean {
282
+ return value === null || value === undefined || value === "";
283
+ }
284
+
285
+ /** Rows without a value sort last in either direction, so a descending sort leads with real values. */
286
+ function compareForSort(a: unknown, b: unknown, direction: 1 | -1): number {
287
+ const aEmpty = isEmptyValue(a);
288
+ const bEmpty = isEmptyValue(b);
289
+ if (aEmpty || bEmpty) return aEmpty === bEmpty ? 0 : aEmpty ? 1 : -1;
290
+ return compare(a, b) * direction;
291
+ }
292
+
281
293
  function matches(row: ViewRow, filter: ViewFilter): boolean {
282
294
  const value = row[filter.key];
283
295
  switch (filter.op) {
284
296
  case "exists":
285
- return value !== null && value !== undefined && value !== "";
297
+ return !isEmptyValue(value);
286
298
  case "eq":
287
299
  return compare(value, filter.value) === 0;
288
300
  case "neq":
@@ -311,7 +323,7 @@ export function applyViewProjection(rows: readonly ViewRow[], projection: ViewPr
311
323
  const sort = sortOverride === undefined ? projection.sort : sortOverride ?? undefined;
312
324
  if (sort) {
313
325
  const direction = sort.direction === "asc" ? 1 : -1;
314
- result = [...result].sort((a, b) => compare(a[sort.by], b[sort.by]) * direction);
326
+ result = [...result].sort((a, b) => compareForSort(a[sort.by], b[sort.by], direction));
315
327
  }
316
328
  if (projection.limit !== undefined) result = result.slice(0, projection.limit);
317
329
  return result;
@@ -488,6 +488,7 @@ export function DebtMaturitiesPane({ width, height, focused }: PaneProps) {
488
488
  if (!data && isCloudSessionRequired(resource.error))
489
489
  return (
490
490
  <SignInWall
491
+ placement="debt-maturities-signin"
491
492
  action="view debt maturities"
492
493
  needsVerification={session.needsVerification}
493
494
  />
@@ -245,7 +245,7 @@ export function DividendYieldPane({ focused, width, height, loadData = fetchDivi
245
245
  ? "Loading dividends..."
246
246
  : error ?? (data?.historyAvailable ? "No cash distributions reported." : "Dividend history unavailable.");
247
247
 
248
- if (authWall) return <SignInWall action="view dividend history" needsVerification={cloudSession.needsVerification} />;
248
+ if (authWall) return <SignInWall placement="dividend-yield-signin" action="view dividend history" needsVerification={cloudSession.needsVerification} />;
249
249
 
250
250
  return (
251
251
  <DataTableView<DividendRow, DividendColumn>
@@ -0,0 +1,73 @@
1
+ import { apiClient } from "../../../api-client";
2
+ import type { DoeBoardPayload, DoeSeriesRow } from "../../../api-client/doe";
3
+ import { ApiRequestError } from "../../../api-client/errors";
4
+ import { createPluginCache } from "../../../data/plugin-cache";
5
+ import { cachedCloudResource, loadCloudResource } from "../shared/cloud-resource";
6
+
7
+ /** What the pane says while the server has no EIA weeks to serve: before the backend ships, or before its first read. */
8
+ export const DOE_NOT_AVAILABLE = "Oil and gas inventories are not available yet.";
9
+
10
+ export const doeBoardCache = createPluginCache<DoeBoardPayload>({
11
+ kind: "doe-board", source: "gloom-cloud", schemaVersion: 1,
12
+ // Weekly data: a quarter hour is soon enough to catch a release.
13
+ policy: { staleMs: 15 * 60_000, expireMs: 14 * 24 * 60 * 60_000 },
14
+ });
15
+
16
+ const UNITS = new Set(["kb", "kbd", "pct", "bcf"]);
17
+ const TABS = new Set(["crude", "products", "gas"]);
18
+ const date = (value: unknown) => typeof value === "string" && /^\d{4}-\d{2}-\d{2}$/.test(value)
19
+ && new Date(`${value}T00:00:00Z`).toISOString().slice(0, 10) === value;
20
+ const dateOrNull = (value: unknown) => value === null || date(value);
21
+ const instantOrNull = (value: unknown) => value === null || typeof value === "string" && Number.isFinite(Date.parse(value));
22
+ const finite = (value: unknown): value is number => typeof value === "number" && Number.isFinite(value);
23
+ const finiteOrNull = (value: unknown) => value === null || finite(value);
24
+ const pairs = (value: unknown) => Array.isArray(value)
25
+ && value.every((pair) => Array.isArray(pair) && Number.isInteger(pair[0]) && finite(pair[1]));
26
+
27
+ function validRow(row: DoeSeriesRow): boolean {
28
+ const five = row.fiveYear, ago = row.yearAgo, seasonal = row.seasonal;
29
+ return typeof row.id === "string" && typeof row.label === "string" && UNITS.has(row.unit) && TABS.has(row.tab)
30
+ && dateOrNull(row.weekEnding) && finiteOrNull(row.value) && finiteOrNull(row.weekChange) && (row.value == null) === (row.weekEnding == null)
31
+ && (row.read === null || typeof row.read === "string")
32
+ && (ago === null || date(ago.weekEnding) && finite(ago.value) && finite(ago.change) && finiteOrNull(ago.changePercent))
33
+ && (five === null || Array.isArray(five.years) && five.years.length > 0 && [five.min, five.max, five.average, five.vsAverage].every(finite)
34
+ && five.min <= five.max && finiteOrNull(five.averageChange) && finiteOrNull(five.vsAveragePercent) && finiteOrNull(five.position))
35
+ && (seasonal === null || Number.isInteger(seasonal.year) && (seasonal.weeks === 52 || seasonal.weeks === 53)
36
+ && pairs(seasonal.current) && pairs(seasonal.previous) && Array.isArray(seasonal.band)
37
+ && seasonal.band.every((week) => Array.isArray(week) && Number.isInteger(week[0]) && week.slice(1).every(finiteOrNull)));
38
+ }
39
+
40
+ /** A board that breaks the contract is refused whole rather than drawn with holes in it. */
41
+ function validateDoeBoard(payload: DoeBoardPayload): DoeBoardPayload {
42
+ if (!payload || payload.source !== "EIA" || !Number.isFinite(Date.parse(payload.generatedAt))
43
+ || !["available", "partial", "unavailable"].includes(payload.status)
44
+ || !Array.isArray(payload.gaps) || !payload.gaps.every((gap) => typeof gap === "string")
45
+ || !Array.isArray(payload.reports) || !payload.reports.every((report) => (report.id === "petroleum" || report.id === "gas")
46
+ && dateOrNull(report.weekEnding) && dateOrNull(report.nextWeekEnding)
47
+ && instantOrNull(report.releasedAt) && instantOrNull(report.nextReleaseAt))
48
+ || !Array.isArray(payload.series) || new Set(payload.series.map((row) => row.id)).size !== payload.series.length
49
+ || !payload.series.every(validRow)) {
50
+ throw new Error("The server returned an invalid EIA weekly board");
51
+ }
52
+ return payload;
53
+ }
54
+
55
+ /**
56
+ * The board, or the not-available message when the server does not serve the
57
+ * route yet (404), cannot read its tables yet (503) or has no weeks stored.
58
+ */
59
+ export async function fetchDoeBoard(client: Pick<typeof apiClient, "getCloudDoeBoard"> = apiClient): Promise<DoeBoardPayload> {
60
+ let payload: DoeBoardPayload;
61
+ try {
62
+ payload = await client.getCloudDoeBoard();
63
+ } catch (error) {
64
+ if (error instanceof ApiRequestError && (error.status === 404 || error.status === 503)) throw new Error(DOE_NOT_AVAILABLE);
65
+ throw error;
66
+ }
67
+ const board = validateDoeBoard(payload);
68
+ if (board.status === "unavailable" || !board.series.some((row) => row.value != null)) throw new Error(DOE_NOT_AVAILABLE);
69
+ return board;
70
+ }
71
+
72
+ export const getCachedDoeBoard = () => cachedCloudResource(doeBoardCache, "board", validateDoeBoard);
73
+ export const loadDoeBoard = (force = false) => loadCloudResource(doeBoardCache, "board", () => fetchDoeBoard(), { force, validate: validateDoeBoard });
@@ -0,0 +1,93 @@
1
+ import type { DoeSeriesRow, DoeTab } from "../../../api-client/doe";
2
+ import type { HeadlessPaneDefinition } from "../../../types/plugin";
3
+ import { fetchDoeBoard } from "./client";
4
+ import {
5
+ DOE_TABS,
6
+ DOE_UNIT_LABEL,
7
+ doeHeaderLine,
8
+ doeReport,
9
+ doeRows,
10
+ doeSeriesOption,
11
+ doeTab,
12
+ formatDoeChange,
13
+ formatDoeLevel,
14
+ formatDoePosition,
15
+ formatDoeVsFive,
16
+ formatDoeVsYear,
17
+ } from "./model";
18
+
19
+ const text = (value: unknown) => typeof value === "string" ? value : "--";
20
+
21
+ /** One row per series, in the pane's words and units; numbers keep their published precision. */
22
+ function reportRow(row: DoeSeriesRow) {
23
+ return {
24
+ id: row.id, series: row.label, unit: DOE_UNIT_LABEL[row.unit], weekEnding: row.weekEnding,
25
+ level: formatDoeLevel(row.unit, row.value), weekChange: formatDoeChange(row.unit, row.weekChange),
26
+ vsYearAgo: formatDoeVsYear(row), vsFiveYear: formatDoeVsFive(row),
27
+ fiveYearLow: formatDoeLevel(row.unit, row.fiveYear?.min ?? null), fiveYearHigh: formatDoeLevel(row.unit, row.fiveYear?.max ?? null),
28
+ position: formatDoePosition(row), read: row.read,
29
+ };
30
+ }
31
+
32
+ const SUMMARY_COLUMNS = [
33
+ { key: "series", header: "Series" }, { key: "unit", header: "Unit" },
34
+ { key: "level", header: "Level", align: "right" as const }, { key: "weekChange", header: "1W change", align: "right" as const },
35
+ { key: "vsYearAgo", header: "Vs 1Y", align: "right" as const }, { key: "vsFiveYear", header: "Vs 5Y avg", align: "right" as const },
36
+ { key: "fiveYearLow", header: "5Y low", align: "right" as const }, { key: "fiveYearHigh", header: "5Y high", align: "right" as const },
37
+ { key: "position", header: "In 5Y range", align: "right" as const }, { key: "read", header: "Read", format: text },
38
+ ];
39
+
40
+ /** The selected series' year, week by week, against last year and the five-year band: the chart as a table. */
41
+ function seasonalRows(row: DoeSeriesRow) {
42
+ const seasonal = row.seasonal;
43
+ if (!seasonal) return [];
44
+ const current = new Map(seasonal.current), previous = new Map(seasonal.previous);
45
+ const level = (value: number | null | undefined) => formatDoeLevel(row.unit, value ?? null);
46
+ return seasonal.band.map(([week, min, average, max]) => ({ week, thisYear: level(current.get(week)), lastYear: level(previous.get(week)),
47
+ fiveYearLow: level(min), fiveYearAverage: level(average), fiveYearHigh: level(max) }));
48
+ }
49
+
50
+ /** `DOE` reads every tab unless one is named; `NGS` starts on gas storage; a series argument adds its year. */
51
+ export function doeHeadless(defaultTab: DoeTab | "all"): HeadlessPaneDefinition<"bundle"> {
52
+ return {
53
+ shape: "bundle",
54
+ argument: { kind: "free-text", optional: true, placeholder: "series", description: "A series such as cushing, gasoline or east; omit for the tables." },
55
+ options: [{ key: "tab", type: "enum", values: [{ value: "all" }, ...DOE_TABS.map(({ value }) => ({ value }))], defaultValue: defaultTab,
56
+ description: "Crude, products, gas storage, or all three." }],
57
+ discovery: { aliases: ["DOE", "NGS"], dataRequirements: ["Gloom Cloud EIA weekly history"],
58
+ limitations: ["Weekly data, published Wednesday (petroleum) and Thursday (gas) at 10:30 ET, moved by holidays",
59
+ "Five-year ranges read earlier years on the same calendar day", "A range holds fewer than five years where a series is younger"] },
60
+ describe: "EIA weekly petroleum and natural gas storage",
61
+ async load(args) {
62
+ const data = await fetchDoeBoard();
63
+ const argument = Array.isArray(args.argument) ? args.argument.join(" ") : args.argument;
64
+ if (argument) {
65
+ const option = doeSeriesOption(argument);
66
+ const row = option ? data.series.find((entry) => entry.id === option.value) : null;
67
+ if (!row) throw new Error("Use a series such as cushing, gasoline, distillate or east");
68
+ return {
69
+ sections: [
70
+ { title: doeHeaderLine(doeReport(data, row.tab)) ?? row.label, columns: SUMMARY_COLUMNS, rows: [reportRow(row)] },
71
+ { title: `${row.label} ${row.seasonal?.year ?? ""} by week, ${DOE_UNIT_LABEL[row.unit]}`.trim(),
72
+ columns: [{ key: "week", header: "Week", align: "right" as const }, { key: "thisYear", header: "This year", align: "right" as const },
73
+ { key: "lastYear", header: "Last year", align: "right" as const }, { key: "fiveYearLow", header: "5Y low", align: "right" as const },
74
+ { key: "fiveYearAverage", header: "5Y avg", align: "right" as const }, { key: "fiveYearHigh", header: "5Y high", align: "right" as const }],
75
+ rows: seasonalRows(row) },
76
+ ],
77
+ errors: data.gaps,
78
+ metadata: { ...data, series: [row], complete: data.status === "available" },
79
+ };
80
+ }
81
+ const tabs = args.options.tab === "all" || args.options.tab == null ? DOE_TABS.map(({ value }) => value) : [doeTab(args.options.tab)];
82
+ return {
83
+ sections: tabs.map((tab) => ({
84
+ title: `${DOE_TABS.find((entry) => entry.value === tab)!.label}${doeHeaderLine(doeReport(data, tab)) ? `: ${doeHeaderLine(doeReport(data, tab))}` : ""}`,
85
+ columns: SUMMARY_COLUMNS,
86
+ rows: doeRows(data, tab).map(reportRow),
87
+ })),
88
+ errors: data.gaps,
89
+ metadata: { ...data, complete: data.status === "available" },
90
+ };
91
+ },
92
+ };
93
+ }
@@ -0,0 +1,41 @@
1
+ import type { DoeTab } from "../../../api-client/doe";
2
+ import type { PaneTemplateCreateOptions, PaneTemplateInstanceConfig } from "../../../types/plugin";
3
+ import type { PluginModule } from "../plugin-module";
4
+ import { doeBoardCache } from "./client";
5
+ import { doeHeadless } from "./headless";
6
+ import { DOE_SERIES_OPTIONS, doeSeriesOption } from "./model";
7
+ import { DoePane } from "./pane";
8
+
9
+ /** Opens on a tab, or on the series typed after the mnemonic and its tab. */
10
+ function doeInstance(tab: DoeTab, options?: PaneTemplateCreateOptions): PaneTemplateInstanceConfig {
11
+ const input = options?.arg?.trim();
12
+ const series = doeSeriesOption(input);
13
+ if (input && !series) throw new Error("Use a series such as cushing, gasoline, distillate or east");
14
+ return { placement: "floating", settings: { tab: series?.tab ?? tab }, ...(series ? { params: { series: series.value } } : {}) };
15
+ }
16
+
17
+ const shortcut = (prefix: string, tab: DoeTab | null) => ({
18
+ prefix, argKind: "text" as const, argPlaceholder: "series", argOptional: true,
19
+ argOptions: () => DOE_SERIES_OPTIONS.filter((option) => !tab || option.tab === tab).map(({ value, label }) => ({ value, label })),
20
+ });
21
+
22
+ export const doeModule: PluginModule = {
23
+ panes: [{ id: "doe", name: "Oil and Gas Inventories", icon: "D", component: DoePane,
24
+ defaultPosition: "right", defaultMode: "floating", defaultFloatingSize: { width: 96, height: 34 },
25
+ tableExport: true, headless: doeHeadless("all") }],
26
+ paneTemplates: [{
27
+ id: "doe-pane", paneId: "doe", label: "Oil and Gas Inventories",
28
+ description: "EIA weekly petroleum and gas storage: builds and draws, year-ago and five-year ranges, seasonal charts.",
29
+ keywords: ["doe", "eia", "oil", "crude", "cushing", "spr", "gasoline", "distillate", "inventories", "stocks", "refinery"],
30
+ shortcut: shortcut("DOE", null), headless: doeHeadless("all"),
31
+ createInstance: (_context, options) => doeInstance("crude", options),
32
+ }, {
33
+ id: "doe-gas-pane", paneId: "doe", label: "Natural Gas Storage",
34
+ description: "EIA weekly working gas in storage, lower 48 and by region, against a year ago and the five-year range.",
35
+ keywords: ["ngs", "natural gas", "storage", "working gas", "injection", "withdrawal", "eia"],
36
+ shortcut: shortcut("NGS", "gas"), headless: doeHeadless("gas"),
37
+ createInstance: (_context, options) => doeInstance("gas", options),
38
+ }],
39
+ setup(ctx) { doeBoardCache.attach(ctx.persistence); },
40
+ dispose() { doeBoardCache.reset(); },
41
+ };