gloomberb 0.20.17 → 0.20.19

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 (453) hide show
  1. package/package.json +3 -1
  2. package/src/account/auth-dialog.tsx +19 -1
  3. package/src/account/billing.ts +2 -1
  4. package/src/account/heard-from-question.tsx +235 -0
  5. package/src/account/heard-from.ts +97 -0
  6. package/src/api-client/cot.ts +5 -6
  7. package/src/api-client/data.ts +14 -3
  8. package/src/api-client/heard-from.ts +72 -0
  9. package/src/api-client/index.ts +64 -6
  10. package/src/api-client/mna.ts +18 -0
  11. package/src/api-client/request.ts +162 -40
  12. package/src/api-client/supply-chain.ts +9 -0
  13. package/src/api-client/types/billing.ts +35 -1
  14. package/src/api-client/types/news.ts +45 -0
  15. package/src/api-client/types/world-venues.ts +9 -0
  16. package/src/app/global-shortcuts.ts +5 -3
  17. package/src/app/pro-welcome/keys.ts +27 -0
  18. package/src/app/pro-welcome/model.ts +158 -0
  19. package/src/app/pro-welcome/row.tsx +176 -0
  20. package/src/app/pro-welcome/use-pro-welcome.ts +156 -0
  21. package/src/app/runtime/external-profile-changes.ts +135 -0
  22. package/src/app.tsx +37 -4
  23. package/src/architecture/core-builtin-allowlist.json +1 -1
  24. package/src/architecture/floating-promise-allowlist.json +1 -2
  25. package/src/architecture/shortcut-labels-allowlist.json +1 -0
  26. package/src/cli/alert-listing.ts +98 -0
  27. package/src/cli/commands/market.ts +191 -39
  28. package/src/cli/commands/overview.ts +7 -1
  29. package/src/cli/commands/plugins.ts +3 -2
  30. package/src/cli/commands/search.ts +30 -6
  31. package/src/cli/commands/ticker.ts +13 -6
  32. package/src/cli/context.ts +24 -5
  33. package/src/cli/csv-export.ts +2 -1
  34. package/src/cli/desktop-pane-shot-browser.ts +3 -1
  35. package/src/cli/desktop-pane-shot-view.ts +0 -1
  36. package/src/cli/desktop-pane-shot.ts +276 -52
  37. package/src/cli/errors.ts +3 -9
  38. package/src/cli/exit-codes.ts +1 -1
  39. package/src/cli/glossary.ts +65 -11
  40. package/src/cli/help.ts +1 -1
  41. package/src/cli/history-demergers.ts +117 -0
  42. package/src/cli/history-rows.ts +8 -4
  43. package/src/cli/index.ts +2 -1
  44. package/src/cli/known-gaps.ts +16 -0
  45. package/src/cli/known-us-stocks.ts +18 -0
  46. package/src/cli/listing-arg.ts +192 -38
  47. package/src/cli/pane-functions/catalog-snapshot-build.ts +83 -0
  48. package/src/cli/pane-functions/catalog-snapshot.json +877 -0
  49. package/src/cli/pane-functions/catalog-snapshot.ts +62 -0
  50. package/src/cli/pane-functions/catalog.ts +50 -16
  51. package/src/cli/pane-functions/data.ts +16 -4
  52. package/src/cli/pane-functions/dom.ts +54 -8
  53. package/src/cli/pane-functions/freshness.ts +39 -4
  54. package/src/cli/pane-functions/function-help.ts +3 -3
  55. package/src/cli/pane-functions/headless.ts +9 -1
  56. package/src/cli/pane-functions/index.ts +175 -50
  57. package/src/cli/pane-functions/report-notices.ts +10 -0
  58. package/src/cli/pane-functions/resolver.ts +11 -7
  59. package/src/cli/pane-functions/screenshot-assessment.ts +38 -10
  60. package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
  61. package/src/cli/pane-functions/screenshot-payload.ts +36 -1
  62. package/src/cli/pane-functions/screenshot-render.ts +24 -9
  63. package/src/cli/pane-functions/screenshot-types.ts +9 -0
  64. package/src/cli/quote-answer.ts +33 -17
  65. package/src/cli/registry.ts +22 -2
  66. package/src/cli/result.ts +22 -4
  67. package/src/cli/scroll-truncation.ts +7 -2
  68. package/src/cli/series-search.ts +45 -6
  69. package/src/cli/shot-temp-dir.ts +4 -9
  70. package/src/cli/ticker-resolution.ts +1 -1
  71. package/src/cli/unreachable.ts +21 -0
  72. package/src/components/chart/composite/drawing-store.ts +11 -7
  73. package/src/components/chart/composite/format.ts +1 -0
  74. package/src/components/chart/composite/legend.tsx +48 -20
  75. package/src/components/chart/composite/panel-surface/panel-cursor.tsx +3 -3
  76. package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
  77. package/src/components/chart/composite/panel-surface.tsx +1 -1
  78. package/src/components/chart/composite/price-axis-labels.tsx +7 -5
  79. package/src/components/chart/composite/tools.ts +164 -39
  80. package/src/components/chart-table/header.tsx +11 -2
  81. package/src/components/chart-table/layout.ts +16 -17
  82. package/src/components/command-bar/pane-templates/items.ts +17 -1
  83. package/src/components/command-bar/routes/root/provider-search.ts +10 -1
  84. package/src/components/command-bar/routes/root/results.ts +34 -2
  85. package/src/components/command-bar/routes/root/runtime.ts +19 -4
  86. package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
  87. package/src/components/command-bar/routes/ticker-search/route.ts +5 -0
  88. package/src/components/command-bar/selection-runtime.ts +29 -5
  89. package/src/components/command-bar/surface/index.tsx +4 -1
  90. package/src/components/command-bar/workflow/alert.ts +32 -13
  91. package/src/components/data-table/view.tsx +15 -2
  92. package/src/components/form-modal/content.tsx +9 -4
  93. package/src/components/index.ts +1 -1
  94. package/src/components/layout/header.tsx +9 -5
  95. package/src/components/layout/pane/capture-status.ts +6 -0
  96. package/src/components/layout/pane/footer/index.tsx +2 -0
  97. package/src/components/layout/pane/footer/model.ts +123 -17
  98. package/src/components/layout/pane/header.tsx +16 -2
  99. package/src/components/layout/pane/status-footer.ts +24 -0
  100. package/src/components/market-board/index.tsx +4 -2
  101. package/src/components/onboarding/onboarding-frame.tsx +6 -2
  102. package/src/components/onboarding/onboarding-keyboard.ts +7 -1
  103. package/src/components/onboarding/onboarding-wizard.tsx +3 -1
  104. package/src/components/onboarding/portfolio-step/positions-panel.tsx +24 -15
  105. package/src/components/onboarding/setup-cards.ts +36 -0
  106. package/src/components/onboarding/use-onboarding-progress.ts +22 -1
  107. package/src/components/onboarding/wizard-account.ts +6 -1
  108. package/src/components/onboarding/wizard-model.ts +32 -6
  109. package/src/components/onboarding/wizard-positions.ts +1 -1
  110. package/src/components/price-performance.tsx +26 -8
  111. package/src/components/reader/article-reader.tsx +12 -5
  112. package/src/components/sign-in-gate.tsx +3 -1
  113. package/src/components/toggle-list.tsx +6 -8
  114. package/src/components/ui/confirm-dialog.tsx +47 -7
  115. package/src/components/ui/data-table/opentui/index.tsx +7 -0
  116. package/src/components/ui/data-table/types.ts +8 -0
  117. package/src/components/ui/display.tsx +17 -2
  118. package/src/components/ui/index.ts +1 -1
  119. package/src/components/ui/stat-grid.tsx +4 -0
  120. package/src/components/ui/status.tsx +13 -1
  121. package/src/components/ui/table-layout.ts +34 -2
  122. package/src/components/use-pane-notice-footer.tsx +16 -3
  123. package/src/data/config/store/index.ts +31 -0
  124. package/src/data/config/store/node.ts +61 -11
  125. package/src/data/config/store/normalize.ts +4 -6
  126. package/src/data/config/store/shared-file.ts +309 -0
  127. package/src/data/profile-merge.ts +299 -0
  128. package/src/data/sqlite/checkpointer.ts +11 -1
  129. package/src/data/sqlite/database.ts +1 -1
  130. package/src/data/ticker-repository.ts +134 -10
  131. package/src/data/ticker-store.ts +67 -0
  132. package/src/data/ticker-writes.ts +5 -0
  133. package/src/i18n/es.ts +27 -0
  134. package/src/i18n/ja.ts +27 -0
  135. package/src/i18n/ko.ts +27 -0
  136. package/src/i18n/zh-cn.ts +27 -0
  137. package/src/i18n/zh-tw.ts +27 -0
  138. package/src/layout-marketplace/gallery-desktop.tsx +2 -2
  139. package/src/market-data/ah-pair.ts +122 -0
  140. package/src/market-data/coordinator/entries.ts +6 -4
  141. package/src/market-data/coordinator/index.ts +14 -3
  142. package/src/market-data/depositary-pair.ts +6 -2
  143. package/src/market-data/futures-board.ts +36 -29
  144. package/src/market-data/futures-contract.ts +37 -1
  145. package/src/market-data/hooks.tsx +33 -2
  146. package/src/market-data/market/change-basis.ts +11 -1
  147. package/src/market-data/market/header-market.ts +11 -0
  148. package/src/market-data/market/status.ts +40 -4
  149. package/src/market-data/performance.ts +127 -32
  150. package/src/market-data/quotes/time.ts +5 -2
  151. package/src/market-data/split-terms.ts +28 -0
  152. package/src/news/types.ts +28 -0
  153. package/src/notifications/app-badge.ts +2 -3
  154. package/src/notifications/app-notifier.ts +5 -0
  155. package/src/plugins/builtin/account-management/footer.ts +1 -1
  156. package/src/plugins/builtin/account-management/keyboard.ts +4 -0
  157. package/src/plugins/builtin/account-management/model.ts +1 -0
  158. package/src/plugins/builtin/account-management/pane.tsx +75 -7
  159. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +12 -5
  160. package/src/plugins/builtin/account-management/pro-cancel.tsx +197 -0
  161. package/src/plugins/builtin/account-management/trial-cancel.ts +1 -1
  162. package/src/plugins/builtin/alerts/cli-move.ts +2 -2
  163. package/src/plugins/builtin/alerts/cli.ts +101 -48
  164. package/src/plugins/builtin/alerts/command.ts +39 -9
  165. package/src/plugins/builtin/alerts/constants.ts +10 -0
  166. package/src/plugins/builtin/alerts/earnings-listing.ts +20 -0
  167. package/src/plugins/builtin/alerts/event-rows.ts +9 -3
  168. package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
  169. package/src/plugins/builtin/alerts/format.ts +24 -8
  170. package/src/plugins/builtin/alerts/headless.ts +12 -6
  171. package/src/plugins/builtin/alerts/index.tsx +97 -16
  172. package/src/plugins/builtin/alerts/move-checks.ts +7 -0
  173. package/src/plugins/builtin/alerts/option-contract.ts +197 -0
  174. package/src/plugins/builtin/alerts/pane.tsx +1 -1
  175. package/src/plugins/builtin/alerts/price.ts +30 -5
  176. package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
  177. package/src/plugins/builtin/alerts/quotes.ts +26 -2
  178. package/src/plugins/builtin/alerts/research-builder.ts +5 -10
  179. package/src/plugins/builtin/alerts/scheduled.ts +6 -1
  180. package/src/plugins/builtin/alerts/types.ts +7 -0
  181. package/src/plugins/builtin/analytics/account-returns.ts +1 -1
  182. package/src/plugins/builtin/analytics/manual-value.ts +61 -0
  183. package/src/plugins/builtin/analytics/pane-model.ts +2 -2
  184. package/src/plugins/builtin/analytics/risk-book.ts +7 -7
  185. package/src/plugins/builtin/analytics/risk-client.ts +27 -14
  186. package/src/plugins/builtin/analytics/risk-headless.ts +13 -8
  187. package/src/plugins/builtin/analytics/risk-model.ts +92 -4
  188. package/src/plugins/builtin/analytics/risk-pane.tsx +85 -38
  189. package/src/plugins/builtin/awards/pane.tsx +1 -1
  190. package/src/plugins/builtin/broker-trading/orders.tsx +2 -2
  191. package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
  192. package/src/plugins/builtin/catalysts/model.ts +2 -1
  193. package/src/plugins/builtin/central-bank-rates/model.ts +8 -2
  194. package/src/plugins/builtin/central-bank-rates/pane.tsx +5 -3
  195. package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
  196. package/src/plugins/builtin/chart-composer/cli-options.ts +9 -5
  197. package/src/plugins/builtin/chart-composer/data-catalog-pane.tsx +2 -6
  198. package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
  199. package/src/plugins/builtin/chart-composer/headless.ts +2 -0
  200. package/src/plugins/builtin/chart-composer/index.tsx +17 -5
  201. package/src/plugins/builtin/chart-composer/pane.tsx +19 -6
  202. package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
  203. package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
  204. package/src/plugins/builtin/chat/index.tsx +0 -1
  205. package/src/plugins/builtin/cloud/auth-actions.tsx +11 -6
  206. package/src/plugins/builtin/cloud/company-picker.tsx +5 -3
  207. package/src/plugins/builtin/cloud/upgrade-command.ts +1 -1
  208. package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
  209. package/src/plugins/builtin/company-kpis/headless.ts +10 -5
  210. package/src/plugins/builtin/company-kpis/latest.ts +45 -0
  211. package/src/plugins/builtin/company-kpis/model.ts +57 -15
  212. package/src/plugins/builtin/company-kpis/pane.tsx +22 -8
  213. package/src/plugins/builtin/composite/alt-data.ts +20 -0
  214. package/src/plugins/builtin/composite/application.ts +14 -0
  215. package/src/plugins/builtin/composite/broker.ts +12 -0
  216. package/src/plugins/builtin/composite/credit.ts +33 -0
  217. package/src/plugins/builtin/composite/crypto.ts +10 -0
  218. package/src/plugins/builtin/composite/earnings.ts +12 -0
  219. package/src/plugins/builtin/composite/filings.ts +13 -0
  220. package/src/plugins/builtin/composite/futures-commodities.ts +23 -0
  221. package/src/plugins/builtin/composite/global-markets.ts +12 -0
  222. package/src/plugins/builtin/composite/options-volatility.ts +23 -0
  223. package/src/plugins/builtin/composite/ownership.ts +23 -0
  224. package/src/plugins/builtin/composite/portfolio.ts +10 -0
  225. package/src/plugins/builtin/composite/quant.ts +15 -0
  226. package/src/plugins/builtin/composite/rates-macro.ts +30 -0
  227. package/src/plugins/builtin/composite/screeners.ts +11 -0
  228. package/src/plugins/builtin/composite/shared.ts +11 -0
  229. package/src/plugins/builtin/composite/ticker-core.ts +36 -0
  230. package/src/plugins/builtin/congress-trades/headless.ts +31 -3
  231. package/src/plugins/builtin/congress-trades/model.ts +9 -5
  232. package/src/plugins/builtin/correlation/index.tsx +13 -17
  233. package/src/plugins/builtin/correlation/matrix/model.ts +18 -0
  234. package/src/plugins/builtin/cot/client.ts +2 -3
  235. package/src/plugins/builtin/cot/headless.ts +16 -16
  236. package/src/plugins/builtin/cot/index.tsx +6 -6
  237. package/src/plugins/builtin/cot/model.ts +25 -5
  238. package/src/plugins/builtin/cot/pane.tsx +11 -6
  239. package/src/plugins/builtin/cot/series.ts +11 -8
  240. package/src/plugins/builtin/cpi/model.ts +15 -4
  241. package/src/plugins/builtin/cpi/pane.tsx +29 -7
  242. package/src/plugins/builtin/dividend-yield/client.ts +57 -16
  243. package/src/plugins/builtin/dividend-yield/headless.ts +17 -11
  244. package/src/plugins/builtin/dividend-yield/model.ts +4 -3
  245. package/src/plugins/builtin/dividend-yield/pane.tsx +22 -18
  246. package/src/plugins/builtin/dividend-yield/ranking.ts +1 -1
  247. package/src/plugins/builtin/dividend-yield/types.ts +4 -0
  248. package/src/plugins/builtin/dividend-yield/view.ts +23 -12
  249. package/src/plugins/builtin/doe/model.ts +30 -0
  250. package/src/plugins/builtin/doe/pane.tsx +8 -2
  251. package/src/plugins/builtin/earnings/board-table.ts +9 -4
  252. package/src/plugins/builtin/earnings/fiscal-quarter.ts +39 -0
  253. package/src/plugins/builtin/earnings/headless.ts +16 -6
  254. package/src/plugins/builtin/earnings/history-model.ts +6 -4
  255. package/src/plugins/builtin/earnings/history-table.ts +7 -4
  256. package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
  257. package/src/plugins/builtin/earnings-calls/pane.tsx +8 -2
  258. package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
  259. package/src/plugins/builtin/econ/calendar-model.ts +16 -0
  260. package/src/plugins/builtin/econ/index.tsx +7 -2
  261. package/src/plugins/builtin/equity-screener/headless.ts +4 -1
  262. package/src/plugins/builtin/equity-screener/model.ts +7 -6
  263. package/src/plugins/builtin/estimate-revisions/headless.ts +1 -1
  264. package/src/plugins/builtin/exposure/model.ts +10 -0
  265. package/src/plugins/builtin/exposure/pane.tsx +10 -3
  266. package/src/plugins/builtin/futures/model.ts +14 -1
  267. package/src/plugins/builtin/futures/series.ts +1 -8
  268. package/src/plugins/builtin/fx-matrix/amount.ts +15 -1
  269. package/src/plugins/builtin/fx-matrix/headless.ts +12 -6
  270. package/src/plugins/builtin/fx-matrix/index.tsx +25 -7
  271. package/src/plugins/builtin/fx-matrix/settings.ts +9 -4
  272. package/src/plugins/builtin/insider/detail.tsx +36 -7
  273. package/src/plugins/builtin/insider/filing-stories.ts +110 -0
  274. package/src/plugins/builtin/insider/headless.ts +37 -2
  275. package/src/plugins/builtin/insider/index.tsx +79 -10
  276. package/src/plugins/builtin/insider/model.ts +43 -5
  277. package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
  278. package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
  279. package/src/plugins/builtin/jobs/headless.ts +2 -1
  280. package/src/plugins/builtin/jobs/model.ts +6 -0
  281. package/src/plugins/builtin/jobs/pane.tsx +8 -3
  282. package/src/plugins/builtin/kelly-sizer/pane.tsx +9 -4
  283. package/src/plugins/builtin/market-valuation/pane.tsx +22 -10
  284. package/src/plugins/builtin/mna/detail.tsx +67 -6
  285. package/src/plugins/builtin/mna/headless.ts +128 -13
  286. package/src/plugins/builtin/mna/model.ts +219 -16
  287. package/src/plugins/builtin/mna/pane.tsx +34 -6
  288. package/src/plugins/builtin/money-markets/model.ts +14 -5
  289. package/src/plugins/builtin/money-markets/pane.tsx +4 -3
  290. package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
  291. package/src/plugins/builtin/news/wire/news/footer.ts +3 -8
  292. package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
  293. package/src/plugins/builtin/options/analytics.ts +1 -1
  294. package/src/plugins/builtin/options/view.tsx +18 -11
  295. package/src/plugins/builtin/options-positioning/model.ts +11 -0
  296. package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
  297. package/src/plugins/builtin/options-scenario/client.ts +49 -8
  298. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +22 -6
  299. package/src/plugins/builtin/options-scenario/csp-screen.ts +39 -12
  300. package/src/plugins/builtin/options-scenario/headless.ts +7 -3
  301. package/src/plugins/builtin/options-scenario/model.ts +33 -2
  302. package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
  303. package/src/plugins/builtin/options-scenario/strategy-screen.ts +7 -5
  304. package/src/plugins/builtin/pe-band/client.ts +13 -1
  305. package/src/plugins/builtin/pe-band/headless.ts +2 -2
  306. package/src/plugins/builtin/pe-band/model.ts +63 -10
  307. package/src/plugins/builtin/pe-band/pane.tsx +5 -5
  308. package/src/plugins/builtin/perps/cascade.ts +4 -3
  309. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  310. package/src/plugins/builtin/perps/model.ts +4 -3
  311. package/src/plugins/builtin/portfolio-list/allocation-rows.ts +26 -7
  312. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +66 -13
  313. package/src/plugins/builtin/portfolio-list/cli/render.ts +76 -33
  314. package/src/plugins/builtin/portfolio-list/headless.ts +69 -22
  315. package/src/plugins/builtin/portfolio-list/pane/data.ts +3 -3
  316. package/src/plugins/builtin/portfolio-list/pane/index.tsx +29 -14
  317. package/src/plugins/builtin/portfolio-list/summary/index.tsx +2 -2
  318. package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
  319. package/src/plugins/builtin/relative-rotation/pane.tsx +2 -3
  320. package/src/plugins/builtin/research/corporate-actions-pane.tsx +33 -14
  321. package/src/plugins/builtin/research/event-model.ts +43 -19
  322. package/src/plugins/builtin/research/headless.ts +8 -1
  323. package/src/plugins/builtin/research/relative-valuation-pane.tsx +19 -17
  324. package/src/plugins/builtin/research-search/index.tsx +3 -1
  325. package/src/plugins/builtin/scanner/denied.tsx +16 -4
  326. package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
  327. package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
  328. package/src/plugins/builtin/sec/filing-display.tsx +14 -2
  329. package/src/plugins/builtin/sec/headless.ts +42 -4
  330. package/src/plugins/builtin/sec/index.tsx +21 -1
  331. package/src/plugins/builtin/sectors/index.tsx +6 -9
  332. package/src/plugins/builtin/sectors/sector-model.ts +1 -1
  333. package/src/plugins/builtin/shared/cloud-upgrade.ts +1 -1
  334. package/src/plugins/builtin/shared/earnings-report.ts +49 -5
  335. package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
  336. package/src/plugins/builtin/shared/report-freshness.ts +2 -3
  337. package/src/plugins/builtin/shared/statement-currency.ts +23 -0
  338. package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
  339. package/src/plugins/builtin/supply-chain/client.ts +34 -9
  340. package/src/plugins/builtin/supply-chain/evidence.ts +3 -2
  341. package/src/plugins/builtin/supply-chain/flow.tsx +4 -3
  342. package/src/plugins/builtin/supply-chain/graph-model.ts +14 -7
  343. package/src/plugins/builtin/supply-chain/graph-pane.tsx +3 -1
  344. package/src/plugins/builtin/supply-chain/graph.tsx +6 -3
  345. package/src/plugins/builtin/supply-chain/headless.ts +19 -4
  346. package/src/plugins/builtin/supply-chain/model.ts +50 -6
  347. package/src/plugins/builtin/supply-chain/pane.tsx +79 -18
  348. package/src/plugins/builtin/themes/headless.ts +4 -4
  349. package/src/plugins/builtin/themes/model.ts +11 -8
  350. package/src/plugins/builtin/themes/pane.tsx +2 -2
  351. package/src/plugins/builtin/ticker-detail/adr-pair/ah.ts +62 -0
  352. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +119 -20
  353. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +51 -1
  354. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +25 -14
  355. package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
  356. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
  357. package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
  358. package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
  359. package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
  360. package/src/plugins/builtin/ticker-detail/overview/model.ts +28 -2
  361. package/src/plugins/builtin/ticker-detail/overview/pane.tsx +8 -0
  362. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +68 -13
  363. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +9 -2
  364. package/src/plugins/builtin/ticker-detail/quote-monitor/index.tsx +5 -2
  365. package/src/plugins/builtin/volatility/model.ts +17 -0
  366. package/src/plugins/builtin/volatility/pane.tsx +16 -7
  367. package/src/plugins/builtin/world-indices/index.tsx +2 -0
  368. package/src/plugins/builtin/world-indices/table.tsx +15 -0
  369. package/src/plugins/builtin/world-venue-map/evidence.ts +3 -2
  370. package/src/plugins/builtin/world-venue-map/headless.ts +32 -18
  371. package/src/plugins/builtin/world-venue-map/index.ts +19 -6
  372. package/src/plugins/builtin/world-venue-map/layered-pane.tsx +9 -5
  373. package/src/plugins/builtin/world-venue-map/layers.ts +33 -11
  374. package/src/plugins/builtin/world-venue-map/map.tsx +12 -0
  375. package/src/plugins/builtin/world-venue-map/model.ts +6 -1
  376. package/src/plugins/builtin/world-venue-map/pane.tsx +35 -6
  377. package/src/plugins/builtin/world-venue-map/place.ts +119 -0
  378. package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
  379. package/src/plugins/catalog-browser.ts +10 -1
  380. package/src/plugins/catalog-data.ts +20 -0
  381. package/src/plugins/catalog-lazy.ts +51 -0
  382. package/src/plugins/catalog-ui.ts +16 -18
  383. package/src/plugins/host-smoke.ts +5 -2
  384. package/src/portfolio/allocation.ts +79 -19
  385. package/src/portfolio/cash-balances.ts +76 -0
  386. package/src/portfolio/mutations.ts +43 -8
  387. package/src/public/__snapshots__/public-api.test.ts.snap +1 -0
  388. package/src/renderers/browser/activity.ts +16 -0
  389. package/src/renderers/browser/app-badge-host.ts +14 -0
  390. package/src/renderers/browser/main.tsx +5 -0
  391. package/src/renderers/browser/notifications.ts +103 -0
  392. package/src/renderers/browser/ui-host.tsx +4 -0
  393. package/src/renderers/desktop/window-layouts.ts +14 -0
  394. package/src/renderers/dom/data-table/index.tsx +27 -4
  395. package/src/renderers/dom/data-table/row.tsx +2 -0
  396. package/src/renderers/dom/host/tabs.tsx +57 -8
  397. package/src/renderers/dom/styles.css +13 -5
  398. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +4 -0
  399. package/src/renderers/electrobun/bun/desktop/backend.ts +22 -1
  400. package/src/renderers/electrobun/bun/window/native-min-size.ts +6 -1
  401. package/src/renderers/electrobun/shared/protocol.ts +4 -0
  402. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +50 -12
  403. package/src/renderers/electrobun/view/http-fetch.ts +3 -2
  404. package/src/renderers/electrobun/view/remote/ticker-repository.ts +10 -0
  405. package/src/series/standalone-catalog.ts +5 -4
  406. package/src/series/standalone.ts +13 -7
  407. package/src/sources/gloomberb-cloud/index.ts +22 -9
  408. package/src/sources/gloomberb-cloud/news.ts +35 -0
  409. package/src/sources/gloomberb-cloud/perpetuals.ts +60 -3
  410. package/src/sources/provider-errors.ts +34 -7
  411. package/src/sources/provider-router/financials.ts +20 -13
  412. package/src/sources/provider-router/history.ts +32 -6
  413. package/src/sources/provider-router/index.ts +4 -0
  414. package/src/sources/provider-router/search.ts +1 -0
  415. package/src/sync/collections-contributor.ts +3 -1
  416. package/src/sync/config-merge.ts +10 -1
  417. package/src/sync/sanitize.ts +26 -2
  418. package/src/tickers/company-name-listing.ts +16 -2
  419. package/src/tickers/listing-fate.ts +12 -8
  420. package/src/tickers/renamed-listings.ts +43 -10
  421. package/src/tickers/search/home-listing.ts +28 -0
  422. package/src/tickers/search/index.ts +19 -7
  423. package/src/tickers/terminal-codes.ts +11 -1
  424. package/src/time-series/base-series.ts +39 -6
  425. package/src/time-series/chart-seed.ts +2 -2
  426. package/src/time-series/history-quality.ts +4 -1
  427. package/src/time-series/hooks.ts +2 -0
  428. package/src/time-series/price-comparison.ts +17 -23
  429. package/src/time-series/reporting.ts +1 -1
  430. package/src/time-series/resolution.ts +13 -0
  431. package/src/time-series/resolve-context.ts +6 -0
  432. package/src/time-series/resolve.ts +42 -3
  433. package/src/time-series/spec.ts +2 -2
  434. package/src/time-series/types.ts +3 -2
  435. package/src/types/data-provider.ts +11 -0
  436. package/src/types/financials.ts +48 -4
  437. package/src/types/headless.ts +1 -0
  438. package/src/types/issuer-listings.ts +2 -0
  439. package/src/types/plugin-notifications.ts +3 -0
  440. package/src/types/price-history.ts +6 -4
  441. package/src/types/ticker.ts +10 -2
  442. package/src/ui/host.tsx +2 -0
  443. package/src/utils/cli-output.ts +1 -1
  444. package/src/utils/declared-dividends.ts +13 -1
  445. package/src/utils/dividend-cash.ts +5 -1
  446. package/src/utils/exchange-announcements.ts +7 -2
  447. package/src/utils/forward-dividend.ts +4 -3
  448. package/src/utils/fundamentals.ts +40 -0
  449. package/src/utils/network-failure.ts +2 -0
  450. package/src/utils/price-history-integrity.ts +9 -1
  451. package/src/utils/remove-folder.ts +37 -0
  452. package/src/utils/trailing-dividend.ts +1 -1
  453. package/src/plugins/builtin/composite-plugins.ts +0 -285
@@ -28,6 +28,7 @@ import { CloudCollectionsApi } from "./collections";
28
28
  import { CloudFeedbackApi } from "./feedback";
29
29
  import { CloudRoadmapApi } from "./roadmap";
30
30
  import { CloudWaitlistApi } from "./product-waitlist";
31
+ import { CloudHeardFromApi } from "./heard-from";
31
32
  import { CloudNotesApi } from "./notes";
32
33
  import { CloudTeamsApi } from "./teams";
33
34
  import { CloudTelemetryApi } from "./telemetry";
@@ -40,6 +41,8 @@ import type {
40
41
  AssistCommandResponse,
41
42
  AuthUser,
42
43
  CloudCancelFeedback,
44
+ CloudRetentionOffer,
45
+ CloudRetentionOfferAnswer,
43
46
  CloudSyncPushResponse,
44
47
  CloudYearlyPlanStatus,
45
48
  CloudYearlyResult,
@@ -78,6 +81,15 @@ const ASSIST_COMMAND_LIMIT = 150;
78
81
  export const ASSIST_ARG_OPTION_LIMIT = 128;
79
82
  /** The longest cancel note the server keeps, in UTF-16 units as its schema counts them. */
80
83
  export const CLOUD_CANCEL_COMMENT_MAX = 500;
84
+
85
+ /** The reason and note a cancel step sends, the note trimmed to what the server keeps. */
86
+ function cancelFeedbackBody(feedback: CloudCancelFeedback): CloudCancelFeedback {
87
+ const comment = feedback.comment === undefined ? undefined : sliceWholeCharacters(feedback.comment.trim(), CLOUD_CANCEL_COMMENT_MAX);
88
+ return {
89
+ ...(feedback.reason ? { reason: feedback.reason } : {}),
90
+ ...(comment ? { comment } : {}),
91
+ };
92
+ }
81
93
  const ASSIST_ARG_OPTION_VALUE_MAX_LENGTH = 40;
82
94
  const ASSIST_ARG_OPTION_LABEL_MAX_LENGTH = 60;
83
95
  const ASSIST_REQUEST_TIMEOUT_MS = 6_000;
@@ -190,6 +202,7 @@ class GloomApiClient {
190
202
  private readonly feedback: CloudFeedbackApi = new CloudFeedbackApi((path, options) => this.request(path, options));
191
203
  private readonly roadmap: CloudRoadmapApi = new CloudRoadmapApi((path, options) => this.request(path, options));
192
204
  private readonly waitlist: CloudWaitlistApi = new CloudWaitlistApi((path, options) => this.request(path, options));
205
+ private readonly heardFrom: CloudHeardFromApi = new CloudHeardFromApi((path, options) => this.request(path, options));
193
206
  private readonly telemetry: CloudTelemetryApi = new CloudTelemetryApi((path, options) => this.request(path, options));
194
207
  private readonly theses: CloudThesesApi = new CloudThesesApi((path, options) => this.request(path, options));
195
208
  private readonly collections: CloudCollectionsApi = new CloudCollectionsApi((path, options) => this.request(path, options));
@@ -688,15 +701,55 @@ class GloomApiClient {
688
701
  * reason and note, when given, go to the billing provider with the cancel.
689
702
  */
690
703
  async endCloudTrial(feedback: CloudCancelFeedback = {}): Promise<{ canceled: boolean; endedNow?: boolean }> {
691
- const comment = feedback.comment === undefined ? undefined : sliceWholeCharacters(feedback.comment.trim(), CLOUD_CANCEL_COMMENT_MAX);
692
704
  return this.request<{ canceled: boolean; endedNow?: boolean }>("/stripe/subscription/cancel", {
693
705
  method: "POST",
694
- body: JSON.stringify({
695
- ...(feedback.reason ? { reason: feedback.reason } : {}),
696
- ...(comment ? { comment } : {}),
697
- endTrialNow: true,
698
- }),
706
+ body: JSON.stringify({ ...cancelFeedbackBody(feedback), endTrialNow: true }),
707
+ });
708
+ }
709
+
710
+ /**
711
+ * Stops a paid Pro plan from renewing: it keeps Pro to the end of the period
712
+ * it paid for. The same request gloom.sh's cancel window sends, the reason
713
+ * and note with it when given. Call it only once the person confirmed.
714
+ */
715
+ async cancelCloudSubscription(feedback: CloudCancelFeedback = {}): Promise<{ canceled: boolean; endedNow?: boolean }> {
716
+ return this.request<{ canceled: boolean; endedNow?: boolean }>("/stripe/subscription/cancel", {
717
+ method: "POST",
718
+ body: JSON.stringify(cancelFeedbackBody(feedback)),
719
+ });
720
+ }
721
+
722
+ /**
723
+ * The save offer and the kept price the cancel flow shows, read as it opens.
724
+ * The server counts this as the cancel flow starting.
725
+ */
726
+ async getCloudRetentionOffer(options?: { signal?: AbortSignal }): Promise<CloudRetentionOfferAnswer> {
727
+ const body = await this.request<Partial<CloudRetentionOfferAnswer> | null>("/stripe/subscription/retention-offer", {
728
+ method: "GET",
729
+ ...(options?.signal ? { signal: options.signal } : {}),
699
730
  });
731
+ const offer = body?.offer === "discount" || body?.offer === "trial_extension" ? body.offer : null;
732
+ const kept = body?.keptPrice;
733
+ return {
734
+ offer,
735
+ extendedTrialEndsAt: typeof body?.extendedTrialEndsAt === "string" ? body.extendedTrialEndsAt : null,
736
+ keptPrice: kept && Number.isFinite(kept.amount) && Number.isFinite(kept.listAmount)
737
+ && (kept.interval === "month" || kept.interval === "year")
738
+ ? { amount: kept.amount, listAmount: kept.listAmount, interval: kept.interval }
739
+ : null,
740
+ };
741
+ }
742
+
743
+ /** Takes the save offer the cancel flow showed, with the reason and note picked. */
744
+ async acceptCloudRetentionOffer(feedback: CloudCancelFeedback = {}): Promise<{ offer: CloudRetentionOffer | null; extendedTrialEndsAt: string | null }> {
745
+ const body = await this.request<{ offer?: unknown; extendedTrialEndsAt?: unknown } | null>("/stripe/subscription/retention-offer", {
746
+ method: "POST",
747
+ body: JSON.stringify(cancelFeedbackBody(feedback)),
748
+ });
749
+ return {
750
+ offer: body?.offer === "discount" || body?.offer === "trial_extension" ? body.offer : null,
751
+ extendedTrialEndsAt: typeof body?.extendedTrialEndsAt === "string" ? body.extendedTrialEndsAt : null,
752
+ };
700
753
  }
701
754
 
702
755
  /**
@@ -985,6 +1038,10 @@ class GloomApiClient {
985
1038
  getWaitlist = this.waitlist.getWaitlist.bind(this.waitlist);
986
1039
  joinWaitlist = this.waitlist.joinWaitlist.bind(this.waitlist);
987
1040
  leaveWaitlist = this.waitlist.leaveWaitlist.bind(this.waitlist);
1041
+ getHeardFrom = this.heardFrom.getHeardFrom.bind(this.heardFrom);
1042
+ reportHeardFromShown = this.heardFrom.reportHeardFromShown.bind(this.heardFrom);
1043
+ answerHeardFrom = this.heardFrom.answerHeardFrom.bind(this.heardFrom);
1044
+ skipHeardFrom = this.heardFrom.skipHeardFrom.bind(this.heardFrom);
988
1045
  reportCrashErrors = this.telemetry.reportCrashErrors.bind(this.telemetry);
989
1046
  reportUsageCounts = this.telemetry.reportUsageCounts.bind(this.telemetry);
990
1047
  reportInstallExperiment = this.telemetry.reportInstallExperiment.bind(this.telemetry);
@@ -1209,6 +1266,7 @@ class GloomApiClient {
1209
1266
  getCloudNews = this.data.getCloudNews.bind(this.data);
1210
1267
  searchCloudNews = this.data.searchCloudNews.bind(this.data);
1211
1268
  getCloudNewsStory = this.data.getCloudNewsStory.bind(this.data);
1269
+ getCloudInsiderFilingStories = this.data.getCloudInsiderFilingStories.bind(this.data);
1212
1270
  getCloudTickerTweets = this.data.getCloudTickerTweets.bind(this.data);
1213
1271
  searchCloudTweets = this.data.searchCloudTweets.bind(this.data);
1214
1272
  }
@@ -58,6 +58,8 @@ export interface MnaDeal {
58
58
  announced: string;
59
59
  /** Expected close as the parties state it, e.g. "2026-12-31" or "Q1 2027". */
60
60
  expectedClose: string | null;
61
+ /** The merger agreement's outside date, as a filing states it; null or left out (older servers) when none was read. */
62
+ outsideDate?: MnaOutsideDate | null;
61
63
  closed: string | null;
62
64
  /** One line on the latest development. */
63
65
  headline: string;
@@ -68,6 +70,22 @@ export interface MnaDeal {
68
70
  stale: boolean;
69
71
  }
70
72
 
73
+ /**
74
+ * The day after which either side may end the merger agreement if the deal
75
+ * has not closed: a deadline, not an expected close. Some agreements move it
76
+ * later on their own on a stated condition (regulatory approvals still
77
+ * pending); `extendedTo` is that day and `extension` the condition, briefly.
78
+ */
79
+ export interface MnaOutsideDate {
80
+ /** `YYYY-MM-DD`. */
81
+ date: string;
82
+ extendedTo: string | null;
83
+ /** What moves it, e.g. "if only antitrust approvals and the Nasdaq listing remain". */
84
+ extension: string | null;
85
+ /** The filing it is read from. */
86
+ source: { form: string; filed: string; url: string | null };
87
+ }
88
+
71
89
  export type MnaStatusFilter = MnaStatus | "all";
72
90
  export type MnaTargetFilter = "all" | "public" | "private";
73
91
  export type MnaRegionFilter = "all" | "us" | "intl";
@@ -30,11 +30,11 @@ export const DEFAULT_API_URL = "https://api.gloom.sh";
30
30
  * fails as the data service being unreachable, as a refused one does.
31
31
  */
32
32
  export const MARKET_REQUEST_TIMEOUT_MS = 10_000;
33
- const DEFAULT_MARKET_REQUEST_TIMEOUT_MS = MARKET_REQUEST_TIMEOUT_MS;
33
+ const DEFAULT_MARKET_READ_LIMIT_MS = 25_000;
34
34
  /**
35
35
  * A search, which a command and a keystroke wait on, gives up on a connection
36
36
  * that sends nothing back sooner. A slow search on a service that answers
37
- * (some take five seconds) still gets the full market deadline.
37
+ * (some take five seconds) still gets the full market read limit.
38
38
  */
39
39
  const SEARCH_ANSWER_TIMEOUT_MS = 4_000;
40
40
  /**
@@ -42,7 +42,7 @@ const SEARCH_ANSWER_TIMEOUT_MS = 4_000;
42
42
  * until any answer comes back: a hung connection is not waited out in full by
43
43
  * every request a command or a pane makes after it.
44
44
  */
45
- const UNREACHABLE_REQUEST_TIMEOUT_MS = 3_000;
45
+ export const UNREACHABLE_REQUEST_TIMEOUT_MS = 3_000;
46
46
  /**
47
47
  * Right after a request hung with nothing back, the requests that follow it
48
48
  * (a fallback, the next step of a command) fail at once rather than each
@@ -54,10 +54,9 @@ const DEFAULT_RESEARCH_REQUEST_TIMEOUT_MS = 45_000;
54
54
  const DEFAULT_SERVICE_REQUEST_LIMIT_MS = 120_000;
55
55
  const UPLOAD_REQUEST_LIMIT_MS = 300_000;
56
56
  /**
57
- * How long the check that the service answers at all waits. It runs this long
58
- * before a request's answer deadline, unless something answered meanwhile, so
59
- * one slow request on a service that answers is waited for and a dead
60
- * connection is not.
57
+ * How long each check that the service answers at all waits. When the answer
58
+ * deadline has room for two checks, one stuck connection isn't enough to
59
+ * declare an outage.
61
60
  */
62
61
  const SERVICE_PROBE_TIMEOUT_MS = 3_000;
63
62
  const SERVICE_PROBE_PATH = "/health";
@@ -75,6 +74,10 @@ const RESEARCH_MARKET_PATHS = new Set([
75
74
  "/market/heatmap", "/market/earnings-calendar", "/market/search/batch",
76
75
  ]);
77
76
 
77
+ export function marketReadLimitMs(pathname: string): number {
78
+ return RESEARCH_MARKET_PATHS.has(pathname) ? DEFAULT_RESEARCH_REQUEST_TIMEOUT_MS : DEFAULT_MARKET_READ_LIMIT_MS;
79
+ }
80
+
78
81
  /**
79
82
  * A read cut off by a server restart is sent once more after a pause in this
80
83
  * range (`sendAgainIfCutOff`): the next connection reaches a server that
@@ -93,6 +96,112 @@ function isRepeatableRead(method: string, path: string): boolean {
93
96
  return method === "GET" || method === "HEAD" || (method === "POST" && path.startsWith("/market/"));
94
97
  }
95
98
 
99
+ /**
100
+ * Set by the local relay a CLI capture's page reads the data service through
101
+ * (`gloom fn`, `gloom shot`) on its answer for a read it could not get to the
102
+ * service at all: the page reads it as the service being unreachable.
103
+ */
104
+ export const SHOT_SERVICE_UNREACHABLE_HEADER = "X-Gloom-Service-Unreachable";
105
+
106
+ /** What the last request to the data service in this process came to: answered, or not reached at all. */
107
+ let lastServiceReach: "answered" | "unreachable" | null = null;
108
+ /** Counts the commands that forgot the state: a request sent before one began says nothing of it. */
109
+ let reachEpoch = 0;
110
+
111
+ /** The current command's count (forgetDataServiceReach), which a request takes when it is sent. */
112
+ export function dataServiceReachEpoch(): number {
113
+ return reachEpoch;
114
+ }
115
+
116
+ /**
117
+ * Whether the data service was unreachable when this process last asked it:
118
+ * a request went unanswered (no connection, a refused proxy, a hung one) and
119
+ * nothing has answered since. A command whose output came out empty then says
120
+ * so, rather than that there is no data (`gloom fn`).
121
+ */
122
+ export function dataServiceUnreachable(): boolean {
123
+ return lastServiceReach === "unreachable";
124
+ }
125
+
126
+ /**
127
+ * Records what a request came to: answered, or not reached. `epoch` is the
128
+ * count it was sent under (dataServiceReachEpoch): one sent before the
129
+ * current command began, still out when it did, records nothing.
130
+ */
131
+ export function noteDataServiceReach(answered: boolean, epoch = reachEpoch): void {
132
+ if (answered) serviceAnswers += 1;
133
+ if (epoch !== reachEpoch) return;
134
+ lastServiceReach = answered ? "answered" : "unreachable";
135
+ }
136
+
137
+ /** How many answers the data service gave this process, whichever command asked. */
138
+ let serviceAnswers = 0;
139
+
140
+ /**
141
+ * The count of the data service's answers (`noteDataServiceReach`): a read
142
+ * with nothing back while the count moved is slow, not cut off, as the
143
+ * client's own deadlines read it.
144
+ */
145
+ export function dataServiceAnswerCount(): number {
146
+ return serviceAnswers;
147
+ }
148
+
149
+ /** Forgets what the last request came to, so a command reads only its own (`gloom fn` and `shot` start with it). */
150
+ export function forgetDataServiceReach(): void {
151
+ lastServiceReach = null;
152
+ reachEpoch += 1;
153
+ }
154
+
155
+ /** The statuses a proxy answers with when it will not, or cannot, reach the server for a request. */
156
+ const PROXY_REFUSAL_STATUSES = new Set([407, 502, 503, 504]);
157
+
158
+ /** The variables a proxy is read from: the process's, or a test's own. */
159
+ type ProxyEnvironment = Readonly<Record<string, string | undefined>>;
160
+
161
+ function processEnvironment(): ProxyEnvironment | null {
162
+ return typeof process === "undefined" ? null : process.env;
163
+ }
164
+
165
+ /** The proxy the runtime sends a request for `url` through, from the environment as Bun reads it; null for none. */
166
+ function environmentProxy(url: string, env: ProxyEnvironment | null): string | null {
167
+ if (!env) return null;
168
+ let target: URL;
169
+ try {
170
+ target = new URL(url);
171
+ } catch {
172
+ // Intentional ignore: a URL that does not parse is sent through no proxy the environment names.
173
+ return null;
174
+ }
175
+ const names = target.protocol === "https:" ? ["HTTPS_PROXY", "https_proxy"] : ["HTTP_PROXY", "http_proxy"];
176
+ const proxy = [...names, "ALL_PROXY", "all_proxy"].map((name) => env[name]?.trim()).find(Boolean);
177
+ if (!proxy) return null;
178
+ const bypass = (env.NO_PROXY ?? env.no_proxy ?? "").split(",").map((entry) => entry.trim().toLowerCase()).filter(Boolean);
179
+ const host = target.hostname.toLowerCase();
180
+ return bypass.some((entry) => entry === "*" || host === entry.replace(/^\./, "") || host.endsWith(entry.startsWith(".") ? entry : `.${entry}`))
181
+ ? null : proxy;
182
+ }
183
+
184
+ /**
185
+ * Whether an answer is a proxy's own, not the service's: what Bun 1.3 hands
186
+ * back when the proxy in HTTPS_PROXY refuses to open a tunnel (a 502 with
187
+ * "Bad Gateway" from the proxy; later Bun throws ERR_PROXY_TUNNEL instead).
188
+ * The data service was never reached, so it reads as unreachable, never as
189
+ * the service being busy ("Search is busy"). Told by a proxy being set for the
190
+ * URL, a status a proxy refuses with, and a body that is not the JSON every
191
+ * answer of the service carries.
192
+ */
193
+ export function isProxyRefusal(
194
+ url: string,
195
+ response: Pick<Response, "status" | "headers">,
196
+ env: ProxyEnvironment | null = processEnvironment(),
197
+ ): boolean {
198
+ if (!PROXY_REFUSAL_STATUSES.has(response.status)) return false;
199
+ // A capture's relay that could not reach the service either.
200
+ if (response.headers.get(SHOT_SERVICE_UNREACHABLE_HEADER) === "1") return true;
201
+ if (!environmentProxy(url, env)) return false;
202
+ return !/\bjson\b/i.test(response.headers.get("Content-Type") ?? "");
203
+ }
204
+
96
205
  /** Waits `ms`, or rejects with the signal's reason once it aborts. */
97
206
  function pause(ms: number, signal: AbortSignal | null | undefined): Promise<void> {
98
207
  return new Promise((resolve, reject) => {
@@ -116,8 +225,6 @@ function pause(ms: number, signal: AbortSignal | null | undefined): Promise<void
116
225
  interface RequestDeadline {
117
226
  answerMs: number;
118
227
  limitMs: number;
119
- /** When to check that the service answers at all, if nothing has by then; null when the deadline is too short for it. */
120
- probeAtMs: number | null;
121
228
  }
122
229
  /** Local status for "this runtime cannot stream", never returned by the server. */
123
230
  export const STREAMING_UNSUPPORTED_STATUS = 0;
@@ -376,8 +483,9 @@ export class CloudApiRequestTransport {
376
483
  private websocketToken: string | null = null;
377
484
  private cookieSessionMode = false;
378
485
  private readonly fetchTransport: CloudApiFetchTransport | null;
486
+ private readonly proxyEnvironment: ProxyEnvironment | undefined;
379
487
  private readonly marketRequestTimeoutMs: number;
380
- private readonly researchRequestTimeoutMs: number;
488
+ private readonly marketReadLimitOverride?: number;
381
489
  private readonly connectionHealth: ConnectionHealthRegistry;
382
490
  /** Answers received from the service, by any request: a request that sees this grow knows the connection works. */
383
491
  private answers = 0;
@@ -389,7 +497,7 @@ export class CloudApiRequestTransport {
389
497
  private connectionGeneration = cloudApiTransportGeneration;
390
498
  /** Requests waiting under a deadline: the check that the service answers runs only while one is. */
391
499
  private pending = 0;
392
- private probe: AbortController | null = null;
500
+ private probe: { controller: AbortController; expiresAt: number } | null = null;
393
501
  /** The next check whether an unreachable service answers again, and how long after it the one after waits. */
394
502
  private recoveryTimer: ReturnType<typeof setTimeout> | null = null;
395
503
  private recoveryDelayMs = RECOVERY_PROBE_FIRST_MS;
@@ -408,12 +516,14 @@ export class CloudApiRequestTransport {
408
516
  fetchTransport?: CloudApiFetchTransport;
409
517
  marketRequestTimeoutMs?: number;
410
518
  connectionHealth?: ConnectionHealthRegistry;
519
+ /** The variables the proxy is read from (isProxyRefusal); the process's by default. */
520
+ proxyEnvironment?: ProxyEnvironment;
411
521
  } = {},
412
522
  ) {
413
523
  this.fetchTransport = options.fetchTransport ?? null;
414
- this.marketRequestTimeoutMs =
415
- options.marketRequestTimeoutMs ?? DEFAULT_MARKET_REQUEST_TIMEOUT_MS;
416
- this.researchRequestTimeoutMs = options.marketRequestTimeoutMs ?? DEFAULT_RESEARCH_REQUEST_TIMEOUT_MS;
524
+ this.proxyEnvironment = options.proxyEnvironment;
525
+ this.marketRequestTimeoutMs = options.marketRequestTimeoutMs ?? MARKET_REQUEST_TIMEOUT_MS;
526
+ this.marketReadLimitOverride = options.marketRequestTimeoutMs;
417
527
  this.connectionHealth = options.connectionHealth ?? connectionHealth;
418
528
  }
419
529
 
@@ -504,7 +614,7 @@ export class CloudApiRequestTransport {
504
614
  GLOOM_CLOUD_HTTP_CONNECTION_ID,
505
615
  operation,
506
616
  async () => {
507
- const response = await this.reachService(() => streamFetch(`${this.baseUrl}${path}`, {
617
+ const response = await this.reachService(`${this.baseUrl}${path}`, () => streamFetch(`${this.baseUrl}${path}`, {
508
618
  ...options,
509
619
  headers,
510
620
  credentials: "include",
@@ -533,20 +643,18 @@ export class CloudApiRequestTransport {
533
643
  }
534
644
 
535
645
  /**
536
- * Every request's deadline. A market read or a search waits about ten
537
- * seconds, research and requests outside market data longer. With nothing
538
- * back from the service, a request gives up at ten seconds, a search at
539
- * four, and any request at three after one went unanswered, until something
540
- * answers again. Three seconds before that, a request still unanswered
541
- * checks that the service answers at all, so one slow request on a working
542
- * connection is waited for and a dead connection is not.
646
+ * With nothing back from the service, a request gives up at ten seconds, a
647
+ * search at four, and any request at three once the service is unreachable.
648
+ * An unanswered request checks the service, twice if there's time. With an
649
+ * answer, a market read may take up to 25 seconds in all; research and
650
+ * requests outside market data get longer.
543
651
  */
544
652
  private deadlineFor(path: string, limitMs?: number): RequestDeadline {
545
653
  this.forgetOtherTransport();
546
654
  const pathname = path.split("?")[0]!;
547
655
  const market = pathname.startsWith("/market/");
548
656
  const limit = limitMs ?? (!market ? DEFAULT_SERVICE_REQUEST_LIMIT_MS
549
- : RESEARCH_MARKET_PATHS.has(pathname) ? this.researchRequestTimeoutMs : this.marketRequestTimeoutMs);
657
+ : this.marketReadLimitOverride ?? marketReadLimitMs(pathname));
550
658
  let answerMs = pathname === "/market/search"
551
659
  ? Math.min(this.marketRequestTimeoutMs, SEARCH_ANSWER_TIMEOUT_MS)
552
660
  : this.marketRequestTimeoutMs;
@@ -554,7 +662,6 @@ export class CloudApiRequestTransport {
554
662
  return {
555
663
  answerMs,
556
664
  limitMs: Math.max(limit, answerMs),
557
- probeAtMs: answerMs >= SERVICE_PROBE_TIMEOUT_MS ? answerMs - SERVICE_PROBE_TIMEOUT_MS : null,
558
665
  };
559
666
  }
560
667
 
@@ -582,6 +689,7 @@ export class CloudApiRequestTransport {
582
689
  const answersAtStart = this.answers;
583
690
  const answered = () => this.answers > answersAtStart;
584
691
  const generation = cloudApiTransportGeneration;
692
+ const epoch = reachEpoch;
585
693
  const what = path.startsWith("/market/") ? "Cloud market request" : "Cloud request";
586
694
  // The endpoint stays out of the message, which reports and panes print; the debug log's line names it.
587
695
  const endpoint = path.split("?")[0]!;
@@ -604,16 +712,17 @@ export class CloudApiRequestTransport {
604
712
  controller.abort(error);
605
713
  };
606
714
  work.then(resolve, reject);
607
- if (deadline.probeAtMs != null) {
715
+ for (const lead of [2 * SERVICE_PROBE_TIMEOUT_MS, SERVICE_PROBE_TIMEOUT_MS]) {
716
+ if (deadline.answerMs < lead) continue;
608
717
  timers.push(setTimeout(() => {
609
718
  if (!answered()) this.checkServiceAnswers();
610
- }, deadline.probeAtMs));
719
+ }, deadline.answerMs - lead));
611
720
  }
612
721
  timers.push(setTimeout(() => {
613
722
  // The caller gave up first: its abort settles the request, and says nothing of the connection.
614
723
  if (callerSignal?.aborted) return;
615
724
  if (!answered()) {
616
- if (!isBackgroundRequest(path)) this.recordNoAnswer(generation, true);
725
+ if (!isBackgroundRequest(path)) this.recordNoAnswer(generation, true, epoch);
617
726
  fail(new DataServiceUnreachableError(timedOut(deadline.answerMs)));
618
727
  } else if (deadline.limitMs > deadline.answerMs) {
619
728
  timers.push(setTimeout(() => fail(timedOut(deadline.limitMs)), deadline.limitMs - deadline.answerMs));
@@ -627,7 +736,7 @@ export class CloudApiRequestTransport {
627
736
  callerSignal?.removeEventListener("abort", abortFromCaller);
628
737
  this.pending -= 1;
629
738
  // Nothing waits on the check any more: it must not hold a command's process open.
630
- if (this.pending === 0) this.probe?.abort();
739
+ if (this.pending === 0) this.probe?.controller.abort();
631
740
  }
632
741
  }
633
742
 
@@ -639,23 +748,29 @@ export class CloudApiRequestTransport {
639
748
  * A caller's abort stays an abort. An answer of any status says the
640
749
  * connection works, for the deadlines of the requests beside it.
641
750
  */
642
- private async reachService<R>(
751
+ private async reachService<R extends Pick<Response, "status" | "headers">>(
752
+ url: string,
643
753
  fetch: () => Promise<R>,
644
754
  signal: AbortSignal | null | undefined,
645
755
  background = false,
646
756
  ): Promise<R> {
647
757
  const generation = cloudApiTransportGeneration;
758
+ const epoch = reachEpoch;
648
759
  let response: R;
649
760
  try {
650
761
  response = await fetch();
762
+ // The proxy's refusal to reach the service, which Bun 1.3 gives back as an answer, is none of the service's.
763
+ if (isProxyRefusal(url, response, this.proxyEnvironment ?? processEnvironment())) {
764
+ throw new DataServiceUnreachableError(new Error(`Proxy refused to open a tunnel: ${response.status}`));
765
+ }
651
766
  } catch (error) {
652
767
  if (signal?.aborted) throw error;
653
768
  const failure = asDataServiceFailure(error);
654
769
  // Background traffic that never got out says nothing of the service (`isBackgroundRequest`).
655
- if (failure instanceof DataServiceUnreachableError && !background) this.recordNoAnswer(generation, false);
770
+ if (failure instanceof DataServiceUnreachableError && !background) this.recordNoAnswer(generation, false, epoch);
656
771
  throw failure;
657
772
  }
658
- this.recordAnswer();
773
+ this.recordAnswer(epoch);
659
774
  return response;
660
775
  }
661
776
 
@@ -667,7 +782,8 @@ export class CloudApiRequestTransport {
667
782
  }
668
783
 
669
784
  /** Something came back from the service: the connection works. */
670
- private recordAnswer(): void {
785
+ private recordAnswer(epoch?: number): void {
786
+ noteDataServiceReach(true, epoch);
671
787
  this.answers += 1;
672
788
  this.markReachable();
673
789
  }
@@ -706,8 +822,9 @@ export class CloudApiRequestTransport {
706
822
  * refused, or `hung` with nothing back by its deadline. Once another
707
823
  * transport is installed, what one sent on the last says nothing of it.
708
824
  */
709
- private recordNoAnswer(generation: number, hung: boolean): void {
825
+ private recordNoAnswer(generation: number, hung: boolean, epoch?: number): void {
710
826
  if (!this.fetchTransport && generation !== cloudApiTransportGeneration) return;
827
+ noteDataServiceReach(false, epoch);
711
828
  if (hung) this.hungAt = Date.now();
712
829
  if (this.unreachable) {
713
830
  // A chain of checks stopped by `dispose` starts again.
@@ -746,8 +863,10 @@ export class CloudApiRequestTransport {
746
863
  this.recoveryProbe = controller;
747
864
  const giveUp = setTimeout(() => controller.abort(), SERVICE_PROBE_TIMEOUT_MS);
748
865
  (giveUp as { unref?: () => void }).unref?.();
749
- (this.fetchTransport ?? cloudApiFetchTransport)(`${this.baseUrl}${SERVICE_PROBE_PATH}`, { signal: controller.signal })
750
- .then(() => this.recordAnswer(), () => {
866
+ const url = `${this.baseUrl}${SERVICE_PROBE_PATH}`;
867
+ (this.fetchTransport ?? cloudApiFetchTransport)(url, { signal: controller.signal })
868
+ // A proxy that refuses to reach the service answers for it: still unreachable.
869
+ .then((response) => { if (!isProxyRefusal(url, response, this.proxyEnvironment ?? processEnvironment())) this.recordAnswer(); }, () => {
751
870
  // Intentional ignore: still unreachable; the next check is scheduled below.
752
871
  })
753
872
  .finally(() => {
@@ -777,18 +896,20 @@ export class CloudApiRequestTransport {
777
896
  * when nothing waits on it any more.
778
897
  */
779
898
  private checkServiceAnswers(): void {
780
- if (this.probe) return;
899
+ if (this.probe && this.probe.expiresAt > Date.now()) return;
900
+ this.probe?.controller.abort();
781
901
  const controller = new AbortController();
782
902
  const timer = setTimeout(() => controller.abort(), SERVICE_PROBE_TIMEOUT_MS);
783
903
  const done = () => {
784
904
  clearTimeout(timer);
785
- if (this.probe === controller) this.probe = null;
905
+ if (this.probe?.controller === controller) this.probe = null;
786
906
  };
787
907
  // Done once given up on, even through a transport that ignores the abort.
788
908
  controller.signal.addEventListener("abort", done, { once: true });
789
- this.probe = controller;
790
- (this.fetchTransport ?? cloudApiFetchTransport)(`${this.baseUrl}${SERVICE_PROBE_PATH}`, { signal: controller.signal })
791
- .then(() => this.recordAnswer(), () => {
909
+ this.probe = { controller, expiresAt: Date.now() + SERVICE_PROBE_TIMEOUT_MS };
910
+ const url = `${this.baseUrl}${SERVICE_PROBE_PATH}`;
911
+ (this.fetchTransport ?? cloudApiFetchTransport)(url, { signal: controller.signal })
912
+ .then((response) => { if (!isProxyRefusal(url, response, this.proxyEnvironment ?? processEnvironment())) this.recordAnswer(); }, () => {
792
913
  // Intentional ignore: an unanswered check only leaves the request it guards to its own deadline.
793
914
  })
794
915
  .finally(done);
@@ -872,6 +993,7 @@ export class CloudApiRequestTransport {
872
993
  });
873
994
  // Inside the reach check: a read that gets through on its second try was answered, not an outage.
874
995
  const response = await this.reachService(
996
+ url,
875
997
  () => (repeatable ? sendAgainIfCutOff(sendOnce, signal) : sendOnce()),
876
998
  signal,
877
999
  isBackgroundRequest(path),
@@ -3,6 +3,8 @@ export type SupplyTier = 1 | 2 | 3 | 4 | 5 | 6;
3
3
  export type SupplyTierFilter = "sec" | "company" | "call" | "reported" | "unconfirmed";
4
4
  type SupplyClaim = "disclosed" | "company_confirmed" | "reported" | "rumored";
5
5
  export interface SupplyOptions { tiers?: SupplyTierFilter[]; includeLeads?: boolean; }
6
+ /** A read of the disclosures: the trust filters, and the day they were known by (YYYY-MM-DD), when one is asked for. */
7
+ export type SupplyRead = SupplyOptions & { asOf?: string };
6
8
  export interface SupplyEvidenceItem {
7
9
  id: string;
8
10
  tier: SupplyTier;
@@ -47,6 +49,13 @@ export interface SupplyRow {
47
49
  direction: "in" | "out" | "mutual";
48
50
  pctOfRevenue: number | null;
49
51
  pctScope: string | null;
52
+ /**
53
+ * For a share tagged with a business segment, what the filing's sentence
54
+ * makes it a share of: "total" for the whole company's revenue the segment
55
+ * earns (NVDA's 16% of total revenue, from Compute & Networking), "segment"
56
+ * for the segment's own. Absent while unread, and from older servers.
57
+ */
58
+ pctScopeBasis?: "total" | "segment" | null;
50
59
  pctBasis: "revenue" | "receivables" | "cost" | "purchases" | null;
51
60
  usd: number | null;
52
61
  usdBasis: "disclosed" | "derived" | null;
@@ -38,12 +38,46 @@ interface CloudPricingTier {
38
38
 
39
39
  /** `/account/cloud`, reduced to the plan fields the apps read. */
40
40
  export interface CloudAccountPlan {
41
- subscription?: { status: string | null };
41
+ /** The account's own Cloud subscription; Pro through a team is never here. */
42
+ subscription?: {
43
+ status: string | null;
44
+ /** Paid or trialing now. */
45
+ active?: boolean;
46
+ /** ISO end of the period paid for: the renewal, or the end once cancelled. */
47
+ currentPeriodEnd?: string | null;
48
+ /** A cancel is scheduled for the period end. */
49
+ cancelAtPeriodEnd?: boolean;
50
+ };
42
51
  effectivePlan?: "free" | "pro";
43
52
  /** Whether a checkout started now comes with the free trial attached. */
44
53
  trialAvailable?: boolean;
45
54
  /** The last charge failed; checkout opens the unpaid invoice instead. */
46
55
  paymentFailed?: boolean;
56
+ /** The team whose plan gives this account Pro, when its own plan does not. */
57
+ proTeam?: { id: string; name: string } | null;
58
+ /**
59
+ * ISO time the account first paid for Pro, while its own subscription is
60
+ * paid; null on a trial, through a team, or when unknown. Older servers
61
+ * leave it out.
62
+ */
63
+ firstChargeAt?: string | null;
64
+ }
65
+
66
+ /** The one save offer the cancel flow can make, as the server decides it. */
67
+ export type CloudRetentionOffer = "trial_extension" | "discount";
68
+
69
+ /** The subscriber's price when it is below what a new subscriber pays, in integer cents. */
70
+ export interface CloudKeptPrice {
71
+ amount: number;
72
+ listAmount: number;
73
+ interval: "month" | "year";
74
+ }
75
+
76
+ /** What the cancel flow offers this subscription, read as it opens. */
77
+ export interface CloudRetentionOfferAnswer {
78
+ offer: CloudRetentionOffer | null;
79
+ extendedTrialEndsAt: string | null;
80
+ keptPrice: CloudKeptPrice | null;
47
81
  }
48
82
 
49
83
  /** Moving a monthly Pro subscription to yearly billing, in integer cents. */
@@ -36,6 +36,49 @@ export interface CloudNewsStoryItemPayload {
36
36
  hasArticleText?: boolean;
37
37
  }
38
38
 
39
+ /**
40
+ * A Form 4 a story about insiders trading reports, as Gloom Cloud matched it:
41
+ * the filing's lines of the side the story reports, by an insider it names,
42
+ * dated in the period it names, summed.
43
+ */
44
+ export interface CloudStoryInsiderFilingPayload {
45
+ accession: string;
46
+ form: string;
47
+ /** YYYY-MM-DD. */
48
+ filedOn: string;
49
+ issuerCik: string;
50
+ issuerName: string | null;
51
+ ticker: string | null;
52
+ /** The reporting owner as filed: "STEVENS MARK A". */
53
+ insider: string;
54
+ title: string | null;
55
+ side: "sale" | "purchase";
56
+ firstTradeDate: string;
57
+ lastTradeDate: string;
58
+ lines: number;
59
+ shares: number;
60
+ value: number;
61
+ /** value / shares: the share-weighted average of the lines' prices. */
62
+ weightedPrice: number;
63
+ /** Under a Rule 10b5-1 plan: true, false, or null when the stored filing does not say. */
64
+ rule10b51: boolean | null;
65
+ /** The filing's index page on SEC EDGAR. */
66
+ url: string;
67
+ }
68
+
69
+ /** A story that reports a Form 4, as the filing's row names it. */
70
+ export interface CloudInsiderFilingStoryPayload {
71
+ id: string;
72
+ headline: string;
73
+ firstPublishedAt: string;
74
+ lastPublishedAt: string;
75
+ primaryPublisher: string;
76
+ }
77
+
78
+ export interface CloudInsiderFilingStoriesResponse {
79
+ items: Array<{ accession: string; stories: CloudInsiderFilingStoryPayload[] }>;
80
+ }
81
+
39
82
  export interface CloudNewsPayload {
40
83
  id: string;
41
84
  headline: string;
@@ -74,6 +117,8 @@ export interface CloudNewsPayload {
74
117
  entities: CloudNewsEntityPayload[];
75
118
  tickerLinks: CloudNewsTickerLinkPayload[];
76
119
  items?: CloudNewsStoryItemPayload[];
120
+ /** A story about insiders trading: the Form 4s it reports. Absent from other stories and older servers. */
121
+ insiderFilings?: CloudStoryInsiderFilingPayload[];
77
122
  /**
78
123
  * The routine notices this story stands for in a company's feed, its own first: a buy-back's daily
79
124
  * "Transaction in own shares", the monthly total voting rights. Absent from servers that list each one.