gloomberb 0.19.4 → 0.19.6

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 (321) hide show
  1. package/package.json +3 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
  3. package/src/api-client/equity-screener.ts +23 -0
  4. package/src/app/pane-runtime/index.tsx +2 -0
  5. package/src/app/pane-runtime/plugin-bindings.ts +10 -1
  6. package/src/app.tsx +63 -16
  7. package/src/cli/commands/command-utils.ts +4 -0
  8. package/src/cli/commands/market.ts +264 -33
  9. package/src/cli/commands/search.ts +22 -4
  10. package/src/cli/commands/ticker.ts +84 -39
  11. package/src/cli/currency-name-hint.ts +60 -0
  12. package/src/cli/glossary.ts +3 -3
  13. package/src/cli/history-rows.ts +18 -1
  14. package/src/cli/known-gaps.ts +25 -2
  15. package/src/cli/listing-arg.ts +12 -0
  16. package/src/cli/not-a-ticker.ts +5 -3
  17. package/src/cli/pane-functions/capabilities.ts +2 -0
  18. package/src/cli/pane-functions/catalog.ts +31 -5
  19. package/src/cli/pane-functions/function-help.ts +8 -5
  20. package/src/cli/pane-functions/headless.ts +11 -6
  21. package/src/cli/pane-functions/market-session.ts +6 -7
  22. package/src/cli/pane-functions/resolver.ts +75 -2
  23. package/src/cli/quote-answer.ts +9 -0
  24. package/src/cli/series-search.ts +4 -5
  25. package/src/cli/symbol-list.ts +54 -2
  26. package/src/cli/symbol-rows.ts +14 -2
  27. package/src/cli/ticker-resolution.ts +89 -20
  28. package/src/components/chart/composite/axis-overlays.tsx +60 -27
  29. package/src/components/chart/composite/composite-chart.tsx +118 -63
  30. package/src/components/chart/composite/cursor-source.ts +111 -0
  31. package/src/components/chart/composite/format.ts +168 -6
  32. package/src/components/chart/composite/legend.tsx +8 -4
  33. package/src/components/chart/composite/panel-bitmap.ts +28 -2
  34. package/src/components/chart/composite/panel-labels.ts +20 -1
  35. package/src/components/chart/composite/panel-surface.tsx +201 -92
  36. package/src/components/chart/composite/price-axis-labels.tsx +92 -46
  37. package/src/components/chart/composite/price-series.ts +31 -8
  38. package/src/components/chart/composite/scene.ts +154 -59
  39. package/src/components/chart/composite/series-axis-tags.tsx +4 -2
  40. package/src/components/chart/composite/time-axis.ts +30 -7
  41. package/src/components/chart/composite/time-scale.ts +211 -56
  42. package/src/components/chart/composite/types.ts +11 -1
  43. package/src/components/chart/composite/use-composite-chart-keyboard.ts +32 -12
  44. package/src/components/chart/curve/curve-surface.tsx +5 -2
  45. package/src/components/chart/curve/model.ts +4 -1
  46. package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
  47. package/src/components/chart/static/series.ts +3 -0
  48. package/src/components/command-bar/commands/collection-list.ts +81 -0
  49. package/src/components/command-bar/commands/direct/index.ts +6 -0
  50. package/src/components/command-bar/commands/registry.ts +8 -0
  51. package/src/components/command-bar/layout-items/current-layout.ts +22 -1
  52. package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
  53. package/src/components/command-bar/pane-templates/items.ts +19 -3
  54. package/src/components/command-bar/pane-templates/workflow.ts +5 -0
  55. package/src/components/command-bar/routes/root/results.ts +23 -3
  56. package/src/components/command-bar/routes/root/selection.ts +4 -2
  57. package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
  58. package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
  59. package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
  60. package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
  61. package/src/components/command-bar/surface/environment.ts +2 -0
  62. package/src/components/command-bar/view-model.ts +7 -0
  63. package/src/components/command-bar/workflow/ops.ts +2 -1
  64. package/src/components/command-bar/workflow/tickers.ts +20 -0
  65. package/src/components/layout/shell/active-drag.ts +38 -7
  66. package/src/components/layout/shell/drag/magnets.ts +106 -0
  67. package/src/components/layout/shell/menu.ts +15 -1
  68. package/src/components/layout/shell/pane/actions.ts +4 -0
  69. package/src/components/layout/shell/ticker-link-menu.ts +12 -3
  70. package/src/components/layout/status-bar.tsx +20 -0
  71. package/src/components/layout/window-controls.tsx +96 -35
  72. package/src/components/layout/window-fullscreen.ts +20 -0
  73. package/src/components/onboarding/onboarding-keyboard.ts +5 -1
  74. package/src/components/onboarding/onboarding-wizard.tsx +15 -4
  75. package/src/components/onboarding/portfolio-step/positions-panel.tsx +8 -5
  76. package/src/components/onboarding/use-onboarding-progress.ts +20 -1
  77. package/src/components/price-sparkline/view.tsx +14 -6
  78. package/src/components/quote-flash.ts +36 -32
  79. package/src/components/ticker/badge/index.tsx +8 -4
  80. package/src/components/ticker/badge/list.tsx +23 -7
  81. package/src/components/ui/column-grid.tsx +8 -2
  82. package/src/components/ui/data-table/opentui/model.ts +4 -1
  83. package/src/components/ui/tabs.tsx +5 -2
  84. package/src/core/state/app/layout.ts +18 -3
  85. package/src/core/state/app/state.ts +2 -0
  86. package/src/core/state/app/types.ts +5 -0
  87. package/src/data/config/layout.ts +3 -0
  88. package/src/data/config/store/normalize.ts +39 -4
  89. package/src/i18n/es.ts +10 -0
  90. package/src/i18n/ja.ts +10 -0
  91. package/src/i18n/ko.ts +10 -0
  92. package/src/i18n/zh-cn.ts +10 -0
  93. package/src/i18n/zh-tw.ts +10 -0
  94. package/src/layout/pane-manager/floating-placement.ts +7 -4
  95. package/src/layout/pane-manager/floating.ts +5 -2
  96. package/src/market-data/bond-funds.ts +19 -0
  97. package/src/market-data/coordinator/events.ts +17 -1
  98. package/src/market-data/frame-scheduler.ts +47 -10
  99. package/src/market-data/frame-wake.ts +74 -0
  100. package/src/market-data/futures-board.ts +7 -6
  101. package/src/market-data/futures-contract.ts +14 -3
  102. package/src/market-data/hooks.tsx +12 -3
  103. package/src/market-data/market/freshness.ts +18 -0
  104. package/src/market-data/market/status.ts +15 -2
  105. package/src/market-data/performance.ts +78 -9
  106. package/src/market-data/request-types.ts +6 -3
  107. package/src/plugins/builtin/alerts/cli.ts +2 -1
  108. package/src/plugins/builtin/analytics/risk-evidence.ts +1 -0
  109. package/src/plugins/builtin/attention/evidence.ts +1 -1
  110. package/src/plugins/builtin/awards/client.ts +1 -1
  111. package/src/plugins/builtin/awards/evidence.ts +1 -1
  112. package/src/plugins/builtin/awards/pane.tsx +2 -1
  113. package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
  114. package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
  115. package/src/plugins/builtin/bond-calculator/math.ts +1 -1
  116. package/src/plugins/builtin/bond-calculator/model.ts +14 -5
  117. package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
  118. package/src/plugins/builtin/broker-manager/footer.ts +3 -2
  119. package/src/plugins/builtin/broker-manager/index.tsx +2 -1
  120. package/src/plugins/builtin/broker-manager/keyboard.ts +2 -1
  121. package/src/plugins/builtin/buildout/cells.tsx +25 -45
  122. package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
  123. package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
  124. package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
  125. package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
  126. package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
  127. package/src/plugins/builtin/buildout/format.ts +23 -1
  128. package/src/plugins/builtin/buildout/model/types.ts +1 -0
  129. package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
  130. package/src/plugins/builtin/buildout/table-model.ts +12 -4
  131. package/src/plugins/builtin/catalysts/evidence.ts +1 -1
  132. package/src/plugins/builtin/catalysts/pane.tsx +2 -1
  133. package/src/plugins/builtin/cds/headless.ts +1 -0
  134. package/src/plugins/builtin/cds/index.tsx +1 -1
  135. package/src/plugins/builtin/chart-composer/headless.ts +40 -1
  136. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  137. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +28 -3
  138. package/src/plugins/builtin/cloud-tweets/table.tsx +3 -2
  139. package/src/plugins/builtin/comment-letters/client.ts +2 -1
  140. package/src/plugins/builtin/company-kpis/client.ts +1 -1
  141. package/src/plugins/builtin/company-kpis/pane.tsx +2 -1
  142. package/src/plugins/builtin/company-kpis/screenshot-evidence.ts +3 -2
  143. package/src/plugins/builtin/correlation/headless.ts +3 -2
  144. package/src/plugins/builtin/cot/headless.ts +9 -3
  145. package/src/plugins/builtin/cot/model.ts +44 -3
  146. package/src/plugins/builtin/credit-documents/client.ts +1 -1
  147. package/src/plugins/builtin/credit-documents/evidence.ts +1 -1
  148. package/src/plugins/builtin/credit-documents/pane.tsx +2 -1
  149. package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
  150. package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
  151. package/src/plugins/builtin/debt-maturities/model.ts +66 -0
  152. package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
  153. package/src/plugins/builtin/earnings-calls/pane.tsx +1 -1
  154. package/src/plugins/builtin/earnings-ripple/index.tsx +6 -1
  155. package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
  156. package/src/plugins/builtin/econ/calendar-model.ts +30 -6
  157. package/src/plugins/builtin/econ/fred-catalog.ts +5 -5
  158. package/src/plugins/builtin/econ/print-watch.ts +3 -1
  159. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  160. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +4 -16
  161. package/src/plugins/builtin/equity-screener/headless.ts +4 -2
  162. package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
  163. package/src/plugins/builtin/equity-screener/model.ts +180 -12
  164. package/src/plugins/builtin/equity-screener/pane.tsx +52 -12
  165. package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
  166. package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
  167. package/src/plugins/builtin/futures/series.ts +16 -1
  168. package/src/plugins/builtin/futures-curve/client.ts +19 -0
  169. package/src/plugins/builtin/futures-curve/headless.ts +52 -13
  170. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  171. package/src/plugins/builtin/futures-curve/model.ts +77 -6
  172. package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
  173. package/src/plugins/builtin/fx-matrix/headless.ts +4 -2
  174. package/src/plugins/builtin/fx-matrix/index.tsx +37 -3
  175. package/src/plugins/builtin/fx-matrix/pairs.ts +15 -0
  176. package/src/plugins/builtin/gpu/headless.ts +2 -1
  177. package/src/plugins/builtin/help/function-card.tsx +2 -1
  178. package/src/plugins/builtin/help/index.tsx +2 -1
  179. package/src/plugins/builtin/insider/display.ts +45 -6
  180. package/src/plugins/builtin/ipo-calendar/model.ts +2 -0
  181. package/src/plugins/builtin/iv-history/client.ts +2 -1
  182. package/src/plugins/builtin/iv-history/headless.ts +2 -1
  183. package/src/plugins/builtin/jobs/pages.ts +4 -4
  184. package/src/plugins/builtin/kelly-sizer/headless.ts +2 -1
  185. package/src/plugins/builtin/macro-day/client.ts +41 -0
  186. package/src/plugins/builtin/macro-day/headless.ts +19 -9
  187. package/src/plugins/builtin/macro-day/model.ts +3 -1
  188. package/src/plugins/builtin/market-heatmap/index.tsx +2 -1
  189. package/src/plugins/builtin/market-movers/index.tsx +4 -3
  190. package/src/plugins/builtin/members/client.ts +1 -1
  191. package/src/plugins/builtin/mna/distress/client.ts +1 -0
  192. package/src/plugins/builtin/mna/distress/headless.ts +1 -0
  193. package/src/plugins/builtin/mna/pane.tsx +4 -1
  194. package/src/plugins/builtin/options/market-reference.ts +1 -1
  195. package/src/plugins/builtin/options/open-interest-as-of.ts +3 -1
  196. package/src/plugins/builtin/options/view.tsx +2 -1
  197. package/src/plugins/builtin/options-calculator/evidence.ts +1 -1
  198. package/src/plugins/builtin/options-scenario/csp-screen-pane.tsx +1 -1
  199. package/src/plugins/builtin/options-scenario/csp-screen.ts +8 -4
  200. package/src/plugins/builtin/options-scenario/csp.ts +28 -9
  201. package/src/plugins/builtin/options-scenario/evidence.ts +5 -4
  202. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  203. package/src/plugins/builtin/perps/client.ts +1 -1
  204. package/src/plugins/builtin/perps/pane.tsx +3 -1
  205. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
  206. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
  207. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +4 -2
  208. package/src/plugins/builtin/portfolio-list/pane/index.tsx +7 -3
  209. package/src/plugins/builtin/portfolio-list/use-throttled-memo.ts +10 -19
  210. package/src/plugins/builtin/rate-path/headless.ts +24 -10
  211. package/src/plugins/builtin/research/analyst-model.ts +1 -0
  212. package/src/plugins/builtin/research/equity-diagnostic-pane.tsx +2 -1
  213. package/src/plugins/builtin/research/event-model.ts +10 -3
  214. package/src/plugins/builtin/research/events-headless.ts +20 -2
  215. package/src/plugins/builtin/research/index.tsx +1 -0
  216. package/src/plugins/builtin/research/relative-valuation-currency.ts +1 -1
  217. package/src/plugins/builtin/research/relative-valuation-peers.ts +2 -1
  218. package/src/plugins/builtin/research-search/command-bar-search.ts +3 -1
  219. package/src/plugins/builtin/research-search/snippet.ts +1 -0
  220. package/src/plugins/builtin/revenue-breakdown/client.ts +3 -2
  221. package/src/plugins/builtin/seasonality/headless.ts +2 -1
  222. package/src/plugins/builtin/sec/command-bar-search.ts +3 -2
  223. package/src/plugins/builtin/sec/fund-facts.ts +17 -1
  224. package/src/plugins/builtin/sec/index.tsx +8 -5
  225. package/src/plugins/builtin/sec/row-summaries.ts +28 -12
  226. package/src/plugins/builtin/shared/members-menu.tsx +103 -38
  227. package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
  228. package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
  229. package/src/plugins/builtin/short-interest/watch-client.ts +2 -1
  230. package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
  231. package/src/plugins/builtin/social-mentions/client.ts +2 -1
  232. package/src/plugins/builtin/supply-chain/client.ts +1 -1
  233. package/src/plugins/builtin/supply-chain/evidence.ts +1 -1
  234. package/src/plugins/builtin/supply-chain/graph-pane.tsx +2 -1
  235. package/src/plugins/builtin/supply-chain/pane.tsx +2 -1
  236. package/src/plugins/builtin/ticker-detail/adr-pair/headless.ts +1 -1
  237. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +24 -4
  238. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +1 -1
  239. package/src/plugins/builtin/time-sales/client.ts +1 -0
  240. package/src/plugins/builtin/time-sales/pane.tsx +3 -2
  241. package/src/plugins/builtin/trace-bonds/client.ts +7 -4
  242. package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
  243. package/src/plugins/builtin/vol-surface/client.ts +2 -1
  244. package/src/plugins/builtin/volatility/client.ts +6 -1
  245. package/src/plugins/builtin/volatility/headless.ts +0 -1
  246. package/src/plugins/builtin/yield-curve/curves.ts +15 -0
  247. package/src/plugins/builtin/yield-curve/headless.ts +9 -2
  248. package/src/plugins/builtin/yield-curve/index.tsx +5 -8
  249. package/src/plugins/host-modules.ts +22 -3
  250. package/src/plugins/host-smoke.ts +6 -3
  251. package/src/portfolio/collection-name.ts +19 -0
  252. package/src/portfolio/column-values.ts +76 -10
  253. package/src/renderers/browser/http-proxy-transport.ts +78 -8
  254. package/src/renderers/cloudflare/http-proxy.ts +13 -2
  255. package/src/renderers/cloudflare/proxy-session.ts +47 -24
  256. package/src/renderers/cloudflare/worker.ts +15 -2
  257. package/src/renderers/desktop/geometry.ts +279 -0
  258. package/src/renderers/desktop/screen-setup.ts +246 -0
  259. package/src/renderers/desktop/sequential-window-host.ts +179 -0
  260. package/src/renderers/desktop/test-utils.ts +71 -0
  261. package/src/renderers/desktop/window-controller.ts +433 -0
  262. package/src/renderers/desktop/window-host.ts +70 -0
  263. package/src/renderers/desktop/window-layouts.ts +630 -0
  264. package/src/renderers/dom/data-frames.ts +15 -4
  265. package/src/renderers/dom/host/box.tsx +204 -176
  266. package/src/renderers/dom/host/style.ts +49 -20
  267. package/src/renderers/dom/host/text.tsx +3 -2
  268. package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
  269. package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
  270. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
  271. package/src/renderers/electrobun/bun/desktop/backend.ts +322 -19
  272. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
  273. package/src/renderers/electrobun/bun/desktop/host-requests.ts +29 -15
  274. package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
  275. package/src/renderers/electrobun/bun/desktop/relaunch.ts +9 -1
  276. package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
  277. package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
  278. package/src/renderers/electrobun/bun/desktop/windows-script.ts +9 -6
  279. package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
  280. package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
  281. package/src/renderers/electrobun/bun/index.ts +4 -97
  282. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
  283. package/src/renderers/electrobun/bun/window/focus.ts +0 -25
  284. package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
  285. package/src/renderers/electrobun/bun/window/windows-native.ts +26 -1
  286. package/src/renderers/electrobun/shared/protocol.ts +50 -2
  287. package/src/renderers/electrobun/view/backend-rpc.ts +15 -0
  288. package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
  289. package/src/renderers/electrobun/view/main.tsx +13 -7
  290. package/src/renderers/electrobun/view/ui-host.tsx +7 -0
  291. package/src/renderers/electrobun/view/window-fullscreen.ts +10 -3
  292. package/src/series/fred-argument.ts +17 -0
  293. package/src/sources/provider-router/financial-routes.ts +7 -1
  294. package/src/sources/provider-router/index.ts +7 -1
  295. package/src/state/app/context/index.tsx +16 -2
  296. package/src/state/desktop-windows.ts +63 -0
  297. package/src/sync/other-window-tabs.ts +62 -0
  298. package/src/tickers/company-name-listing.ts +23 -3
  299. package/src/tickers/listing-fate.ts +147 -1
  300. package/src/tickers/terminal-codes.ts +5 -0
  301. package/src/time-series/price-units.ts +11 -0
  302. package/src/time-series/types.ts +6 -0
  303. package/src/types/config.ts +10 -1
  304. package/src/types/desktop-window.ts +71 -2
  305. package/src/types/financials.ts +4 -0
  306. package/src/types/headless.ts +19 -0
  307. package/src/types/plugin.ts +6 -0
  308. package/src/ui/host.tsx +2 -0
  309. package/src/ui/index.tsx +14 -13
  310. package/src/ui/same-props.ts +58 -0
  311. package/src/utils/cli-output.ts +33 -4
  312. package/src/utils/currency-names.ts +20 -0
  313. package/src/utils/currency-pair.ts +6 -0
  314. package/src/utils/exchange-rate-snapshot.ts +20 -2
  315. package/src/utils/format.ts +7 -2
  316. package/src/utils/futures-generic.ts +12 -0
  317. package/src/utils/fx-market-hours.ts +43 -0
  318. package/src/utils/http-proxy-upstream.ts +6 -2
  319. package/src/utils/plugin-proxy-hosts.json +0 -4
  320. package/src/utils/plugin-proxy-hosts.ts +22 -0
  321. package/src/utils/sec-filings.ts +7 -1
@@ -5,12 +5,13 @@ import type {
5
5
  DesktopBackendRequestResponse,
6
6
  DesktopHostRequest,
7
7
  DesktopWindowControlAction,
8
+ DesktopWindowResizeEdge,
8
9
  } from "../../shared/protocol";
9
10
  import { safeExternalUrl } from "../../../../utils/external-url";
10
11
  import { getContextMenuRequestId, normalizeContextMenuItems } from "../context-menu/normalize";
11
12
  import { MAIN_WINDOW_RPC_KEY } from "../window/focus";
12
13
  import { applyDesktopWindowControl } from "../window/controls";
13
- import { startSystemWindowMove } from "../window/windows-native";
14
+ import { startSystemWindowMove, startSystemWindowResize } from "../window/windows-native";
14
15
  import { saveTextFileToDownloads } from "../../../../utils/save-text-file";
15
16
  import { setAppBadge } from "./app-badge";
16
17
  import { desktopBootFramePath, saveDesktopBootFrame } from "../window/boot-frame";
@@ -37,9 +38,7 @@ function playNotificationSound(sound: string | undefined): void {
37
38
  }
38
39
 
39
40
  function windowForRpcKey(backend: DesktopBackend, windowKey: string | undefined): BrowserWindow | null {
40
- return windowKey === MAIN_WINDOW_RPC_KEY
41
- ? backend.mainWindow
42
- : backend.detachedWindows.getWindowForRpcKey(windowKey);
41
+ return backend.nativeWindow(windowKey);
43
42
  }
44
43
 
45
44
  /**
@@ -55,6 +54,14 @@ function isWindowFullscreen(backend: DesktopBackend, windowKey: string | undefin
55
54
  }
56
55
  }
57
56
 
57
+ function isWindowMaximized(backend: DesktopBackend, windowKey: string | undefined): boolean {
58
+ try {
59
+ return windowForRpcKey(backend, windowKey)?.isMaximized?.() === true;
60
+ } catch {
61
+ return false;
62
+ }
63
+ }
64
+
58
65
  function controlWindow(
59
66
  backend: DesktopBackend,
60
67
  windowKey: string | undefined,
@@ -69,17 +76,14 @@ function controlWindow(
69
76
  return true;
70
77
  }
71
78
 
72
- /** Exiting closes the popped-out windows, services and main window; with no main window it quits directly. */
79
+ /** Exiting closes every window and the services, then quits. */
73
80
  function exitDesktopApp(backend: DesktopBackend): void {
74
- backend.detachedWindows.closeAll();
75
- backend.teardownServices();
76
- const mainWindow = backend.mainWindow;
77
- if (mainWindow) {
78
- mainWindow.close();
79
- backend.mainWindow = null;
80
- return;
81
- }
82
- Utils.quit();
81
+ backend.quit();
82
+ }
83
+
84
+ function normalizeWindowResizeEdge(edge: unknown): DesktopWindowResizeEdge {
85
+ if (edge === "top" || edge === "top-left" || edge === "top-right") return edge;
86
+ throw new Error("host.startWindowResize requires a top edge or corner.");
83
87
  }
84
88
 
85
89
  function normalizeWindowControlAction(action: unknown): DesktopWindowControlAction {
@@ -112,6 +116,8 @@ export async function handleDesktopHostRequest(
112
116
  }
113
117
  case "host.windowFullscreen":
114
118
  return isWindowFullscreen(backend, backend.rpcs.getRpcWindowKey(rpc));
119
+ case "host.windowMaximized":
120
+ return isWindowMaximized(backend, backend.rpcs.getRpcWindowKey(rpc));
115
121
  case "host.startWindowDrag": {
116
122
  const targetWindow = windowForRpcKey(backend, backend.rpcs.getRpcWindowKey(rpc));
117
123
  if (!targetWindow?.ptr || !startSystemWindowMove(targetWindow.ptr)) {
@@ -119,6 +125,14 @@ export async function handleDesktopHostRequest(
119
125
  }
120
126
  return null;
121
127
  }
128
+ case "host.startWindowResize": {
129
+ const edge = normalizeWindowResizeEdge(request.payload.edge);
130
+ const targetWindow = windowForRpcKey(backend, backend.rpcs.getRpcWindowKey(rpc));
131
+ if (!targetWindow?.ptr || !startSystemWindowResize(targetWindow.ptr, edge)) {
132
+ throw new Error("This window cannot be resized by the system.");
133
+ }
134
+ return null;
135
+ }
122
136
  case "host.openExternal": {
123
137
  if (typeof request.payload.url !== "string") {
124
138
  throw new Error("host.openExternal requires a URL.");
@@ -131,7 +145,7 @@ export async function handleDesktopHostRequest(
131
145
  return null;
132
146
  case "host.focusWindow": {
133
147
  const windowKey = backend.rpcs.getRpcWindowKey(rpc);
134
- if (windowKey) backend.detachedWindows.focusWindowForRpcKey(windowKey);
148
+ backend.focusWindow(windowKey);
135
149
  return null;
136
150
  }
137
151
  case "host.copyPngImage": {
@@ -31,13 +31,15 @@ import { markStartupComplete } from "../../../../utils/main-thread-stall";
31
31
  interface DesktopWindowTarget {
32
32
  kind: "main" | "detached";
33
33
  paneId?: string;
34
+ /** A full window's id: the main window's, or an extra window's. */
35
+ windowId?: string;
34
36
  }
35
37
 
36
38
  function normalizeInitWindowTarget(
37
39
  rpcKey: string | undefined,
38
40
  payload: DesktopBackendRequestPayload<"init">,
39
41
  ): DesktopWindowTarget {
40
- if (rpcKey === MAIN_WINDOW_RPC_KEY) return { kind: "main" };
42
+ if (rpcKey === MAIN_WINDOW_RPC_KEY) return { kind: "main", windowId: MAIN_WINDOW_RPC_KEY };
41
43
 
42
44
  const detachedPaneId = paneIdFromDetachedRpcKey(rpcKey);
43
45
  if (detachedPaneId) {
@@ -46,6 +48,8 @@ function normalizeInitWindowTarget(
46
48
  paneId: detachedPaneId,
47
49
  };
48
50
  }
51
+ // Every other window the backend opens is a full window with its own tabs.
52
+ if (rpcKey) return { kind: "main", windowId: rpcKey };
49
53
 
50
54
  const kind = payload.kind === "detached" ? "detached" : "main";
51
55
  return {
@@ -75,13 +79,21 @@ function buildInitializationPayload(
75
79
  config: AppConfig,
76
80
  services: AppServices,
77
81
  windowTarget: DesktopWindowTarget,
82
+ windowKey: string | undefined,
78
83
  ): ElectrobunBackendInit {
84
+ const mainWindow = windowTarget.windowId === MAIN_WINDOW_RPC_KEY;
79
85
  // The main window says once what the launch's seed could not install.
80
- const pluginSeedNotice = windowTarget.kind === "main" ? takePluginSeedNotice() : null;
86
+ const pluginSeedNotice = mainWindow ? takePluginSeedNotice() : null;
87
+ // Each full window draws its own tabs; a popped-out pane's draws the main
88
+ // window's. Numbered like every state sent, so the window's first sync is
89
+ // merged against it.
90
+ const projected = backend.workspace?.getWindowSnapshot(windowTarget.windowId ?? MAIN_WINDOW_RPC_KEY) ?? null;
91
+ const desktopSnapshot = projected ? backend.stateBroadcaster.stamp(projected) : null;
92
+ if (desktopSnapshot && windowKey) backend.workspace?.noteDelivered(windowKey, desktopSnapshot.stateSeq!, desktopSnapshot);
81
93
  return {
82
- config,
94
+ config: desktopSnapshot?.config ?? config,
83
95
  sessionSnapshot: backend.getSessionSnapshot(),
84
- desktopSnapshot: backend.workspace?.getSnapshot() ?? null,
96
+ desktopSnapshot,
85
97
  desktopThemePreview: backend.stateBroadcaster.currentThemePreview,
86
98
  pluginState: loadDesktopPluginState(services.pluginRegistry),
87
99
  savedResources: loadSavedResources(services, config),
@@ -90,6 +102,8 @@ function buildInitializationPayload(
90
102
  hostName: hostname(),
91
103
  windowKind: windowTarget.kind,
92
104
  paneId: windowTarget.paneId,
105
+ ...(windowTarget.windowId ? { windowId: windowTarget.windowId, windows: backend.windowInfos() } : {}),
106
+ ...(mainWindow ? { otherWindowTabs: backend.otherWindowTabsForInit() } : {}),
93
107
  ...(pluginSeedNotice ? { pluginSeedNotice } : {}),
94
108
  telemetry: {
95
109
  installId: readOrCreateInstallId(config.dataDir),
@@ -185,23 +199,28 @@ export async function initializeDesktopBackend(
185
199
  rpc: DesktopRpc,
186
200
  payload: DesktopBackendRequestPayload<"init">,
187
201
  ): Promise<ElectrobunBackendInit> {
188
- const windowTarget = normalizeInitWindowTarget(backend.rpcs.getRpcWindowKey(rpc), payload);
202
+ const windowKey = backend.rpcs.getRpcWindowKey(rpc);
203
+ const windowTarget = normalizeInitWindowTarget(windowKey, payload);
189
204
  backend.rpcs.markWindowRpcReady(rpc);
190
205
  backend.stateBroadcaster.forgetWindowState(rpc);
206
+ // Its page loaded and runs: the next window waiting to open may.
207
+ if (windowKey) backend.windowHost?.windowDrawn(windowKey);
191
208
 
192
209
  await startDesktopBackend(backend);
193
210
  const config = backend.requireConfig();
194
211
  const services = backend.requireServices();
195
212
  if (!backend.workspace) {
196
- backend.workspace = createDesktopWorkspace(config, backend.getSessionSnapshot());
197
- backend.detachedWindows.reconcile();
213
+ backend.workspace = createDesktopWorkspace(config, backend.getSessionSnapshot(), backend.windowController?.screenSetup.windows);
214
+ backend.reconcileWindows();
198
215
  }
199
- const init = buildInitializationPayload(backend, config, services, windowTarget);
216
+ // A window that loads again starts from this state: nothing sent before counts.
217
+ if (windowKey) backend.workspace.forgetWindow(windowKey);
218
+ const init = buildInitializationPayload(backend, config, services, windowTarget, windowKey);
200
219
  // The main window has what it needs to draw: this process is up, and the
201
- // popped-out windows open next.
202
- if (windowTarget.kind === "main") {
220
+ // popped-out panes and extra windows open next.
221
+ if (windowTarget.windowId === MAIN_WINDOW_RPC_KEY) {
203
222
  markStartupComplete();
204
- backend.detachedWindows.openAfterMainWindow();
223
+ backend.openWindowsAfterMainWindow();
205
224
  }
206
225
  return init;
207
226
  }
@@ -144,6 +144,14 @@ try {
144
144
  ].join("\n");
145
145
  }
146
146
 
147
+ /**
148
+ * How long a restart waits for its script, with the error screen saying the
149
+ * restart was asked. Windows PowerShell started by the Task Scheduler can take
150
+ * over 20 s to run its first line: 23 s on an idle Windows on Arm machine,
151
+ * over a minute on a busy one, where a task runs below normal priority.
152
+ */
153
+ const RESTART_SCRIPT_START_TIMEOUT_MS = 120_000;
154
+
147
155
  /**
148
156
  * Electrobun puts the Windows app in a job that ends every process it starts
149
157
  * when it exits, so the script runs from a scheduled task, which outlives it.
@@ -164,7 +172,7 @@ async function scheduleWindowsRelaunch(context: RelaunchContext): Promise<void>
164
172
  taskName: `GloomRestart-${context.pid}`,
165
173
  home: context.home,
166
174
  }));
167
- const answer = await runScriptAfterExit(script, log, cancel, `GloomRestart-${context.pid}`);
175
+ const answer = await runScriptAfterExit(script, log, cancel, `GloomRestart-${context.pid}`, RESTART_SCRIPT_START_TIMEOUT_MS);
168
176
  if (answer.kind !== "started") throw new Error(`the restart script did not start: ${answer.reason}`);
169
177
  }
170
178
 
@@ -0,0 +1,55 @@
1
+ import { copyFileSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "fs";
2
+ import { dirname, join } from "path";
3
+ import { getGloomberbDirs } from "../../../../data/config/home";
4
+ import { emptyScreenSetup, parseScreenSetup, type ScreenSetup } from "../../../desktop/screen-setup";
5
+ import type { ScreenSetupStore } from "../../../desktop/window-controller";
6
+
7
+ /**
8
+ * The windows and where they sit, per monitor arrangement, beside the config
9
+ * and never in it: launch reads it before the config, and it describes this
10
+ * machine's screens, so it stays out of the synced config.
11
+ */
12
+ const FILE_NAME = "desktop-windows.json";
13
+
14
+ function desktopScreenSetupPath(env: NodeJS.ProcessEnv = process.env): string {
15
+ return join(dirname(getGloomberbDirs(env).configFile), FILE_NAME);
16
+ }
17
+
18
+ export function desktopScreenSetupStore(path: string = desktopScreenSetupPath()): ScreenSetupStore {
19
+ return {
20
+ load(): ScreenSetup {
21
+ let text: string;
22
+ try {
23
+ text = readFileSync(path, "utf8");
24
+ } catch {
25
+ // Intentional ignore: no file yet; the windows start from the defaults.
26
+ return emptyScreenSetup();
27
+ }
28
+ try {
29
+ const raw: unknown = JSON.parse(text);
30
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) return parseScreenSetup(raw);
31
+ } catch {
32
+ // Not JSON: kept below.
33
+ }
34
+ // The next save would replace a file this build cannot read: a copy stays beside it.
35
+ try {
36
+ copyFileSync(path, `${path}.bak`);
37
+ } catch {
38
+ // Intentional ignore: the windows start from the defaults either way.
39
+ }
40
+ console.error("[desktop] the window setup could not be read; a copy was kept as desktop-windows.json.bak");
41
+ return emptyScreenSetup();
42
+ },
43
+ save(setup: ScreenSetup): void {
44
+ const temporary = `${path}.${process.pid}.tmp`;
45
+ try {
46
+ mkdirSync(dirname(path), { recursive: true });
47
+ writeFileSync(temporary, JSON.stringify(setup));
48
+ renameSync(temporary, path);
49
+ } catch (error) {
50
+ rmSync(temporary, { force: true });
51
+ console.error("[desktop] could not save the window setup", error instanceof Error ? error.message : String(error));
52
+ }
53
+ },
54
+ };
55
+ }
@@ -15,6 +15,21 @@ export interface DesktopStateRpc {
15
15
 
16
16
  interface DesktopStateBroadcasterOptions<Rpc extends DesktopStateRpc> {
17
17
  forEachReadyWindowRpc: (callback: (rpc: Rpc) => void) => void;
18
+ /**
19
+ * Which state a window draws: windows with the same view share one key.
20
+ * Without it every window gets the shared state.
21
+ */
22
+ viewKey?: (rpc: Rpc) => string;
23
+ /** The state for a view key, from the shared one; null sends that window nothing. */
24
+ project?: (viewKey: string, shared: DesktopSharedStateSnapshot) => DesktopSharedStateSnapshot | null;
25
+ /** Each state sent to a window, with the number it carries, which the window's next sync names as its base. */
26
+ delivered?: (rpc: Rpc, snapshot: DesktopSharedStateSnapshot) => void;
27
+ }
28
+
29
+ interface ProjectedState {
30
+ snapshot: DesktopSharedStateSnapshot | null;
31
+ key?: string;
32
+ encoded?: DesktopSharedStateSnapshot;
18
33
  }
19
34
 
20
35
  /**
@@ -29,6 +44,7 @@ function desktopStateKey(snapshot: DesktopSharedStateSnapshot): string {
29
44
  focusedPaneId: snapshot.focusedPaneId,
30
45
  statusBarVisible: snapshot.statusBarVisible,
31
46
  brokerSyncErrors: snapshot.brokerSyncErrors ?? {},
47
+ linkedTickers: snapshot.linkedTickers ?? {},
32
48
  });
33
49
  }
34
50
 
@@ -37,6 +53,7 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
37
53
  private themePreview: DesktopThemePreviewState = { theme: null };
38
54
  /** The state held by each window that sends its whole state: what it last sent here or was sent. */
39
55
  private readonly heldStateKeys = new WeakMap<Rpc, string>();
56
+ private seq = 0;
40
57
 
41
58
  constructor(private readonly options: DesktopStateBroadcasterOptions<Rpc>) {}
42
59
 
@@ -52,6 +69,12 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
52
69
  this.dockPreview = { paneId: null, edge: null };
53
70
  }
54
71
 
72
+ /** Numbers a state handed to a window outside a broadcast (its `init`), in the same series. */
73
+ stamp(snapshot: DesktopSharedStateSnapshot): DesktopSharedStateSnapshot {
74
+ this.seq += 1;
75
+ return { ...snapshot, stateSeq: this.seq };
76
+ }
77
+
55
78
  /** A window that sent its whole state holds it, and is not sent it back. */
56
79
  noteWindowState(rpc: Rpc, snapshot: DesktopSharedStateSnapshot): void {
57
80
  this.heldStateKeys.set(rpc, desktopStateKey(snapshot));
@@ -72,18 +95,29 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
72
95
  */
73
96
  sendDesktopState(snapshot: DesktopSharedStateSnapshot | null): void {
74
97
  if (!snapshot) return;
75
- let encodedSnapshot: DesktopSharedStateSnapshot | null = null;
76
- let snapshotKey: string | null = null;
98
+ this.seq += 1;
99
+ const seq = this.seq;
100
+ const views = new Map<string, ProjectedState>();
101
+ const { viewKey, project, delivered } = this.options;
77
102
  this.options.forEachReadyWindowRpc((rpc) => {
103
+ const view = viewKey?.(rpc) ?? "";
104
+ let projected = views.get(view);
105
+ if (!projected) {
106
+ const shown = project ? project(view, snapshot) : snapshot;
107
+ projected = { snapshot: shown ? { ...shown, stateSeq: seq } : null };
108
+ views.set(view, projected);
109
+ }
110
+ if (!projected.snapshot) return;
78
111
  const heldKey = this.heldStateKeys.get(rpc);
79
112
  if (heldKey !== undefined) {
80
- snapshotKey ??= desktopStateKey(snapshot);
81
- if (heldKey === snapshotKey) return;
82
- this.heldStateKeys.set(rpc, snapshotKey);
113
+ projected.key ??= desktopStateKey(projected.snapshot);
114
+ if (heldKey === projected.key) return;
115
+ this.heldStateKeys.set(rpc, projected.key);
83
116
  }
84
- encodedSnapshot ??= encodeRpcValue(snapshot) as DesktopSharedStateSnapshot;
117
+ projected.encoded ??= encodeRpcValue(projected.snapshot) as DesktopSharedStateSnapshot;
118
+ delivered?.(rpc, projected.snapshot);
85
119
  rpc.send["desktop.state"]({
86
- snapshot: encodedSnapshot,
120
+ snapshot: projected.encoded,
87
121
  });
88
122
  });
89
123
  }
@@ -101,11 +135,13 @@ export class DesktopStateBroadcaster<Rpc extends DesktopStateRpc> {
101
135
  });
102
136
  }
103
137
 
104
- sendThemePreview(preview: DesktopThemePreviewState): void {
138
+ /** Every window but the one previewing (`fromRpc`) previews the theme too. */
139
+ sendThemePreview(preview: DesktopThemePreviewState, fromRpc?: Rpc): void {
105
140
  if (this.themePreview.theme === preview.theme) return;
106
141
  this.themePreview = preview;
107
142
  const encodedPreview = encodeRpcValue(preview) as DesktopThemePreviewState;
108
143
  this.options.forEachReadyWindowRpc((rpc) => {
144
+ if (rpc === fromRpc) return;
109
145
  rpc.send["desktop.themePreview"]({
110
146
  preview: encodedPreview,
111
147
  });
@@ -5,7 +5,10 @@ import { readFile, writeFile } from "fs/promises";
5
5
  * it runs: its own files are locked until it quits.
6
6
  */
7
7
 
8
- /** How long a script has to answer before the app stops waiting and keeps running. */
8
+ /**
9
+ * How long a script has, by default, to answer before the app stops waiting
10
+ * and keeps running. The app may still be opening: no window shows until then.
11
+ */
9
12
  const SCRIPT_START_TIMEOUT_MS = 20_000;
10
13
 
11
14
  /**
@@ -62,16 +65,16 @@ function schtasks(...args: string[]): void {
62
65
  * Runs `script` from the scheduled task `taskName`, which outlives the app (a
63
66
  * child of its process dies with it), and resolves to the answer it writes to
64
67
  * `log`: only on `started` may the app quit for it. The script removes the
65
- * task. When it does not answer in time, the app writes `cancel`, which keeps
66
- * a script that starts late from doing anything, and this throws with the
67
- * task gone, as it does when the task could not be made.
68
+ * task. When it does not answer within `timeoutMs`, the app writes `cancel`,
69
+ * which keeps a script that starts late from doing anything, and this throws
70
+ * with the task gone, as it does when the task could not be made.
68
71
  */
69
- export async function runScriptAfterExit(script: string, log: string, cancel: string, taskName: string): Promise<ScriptAnswer> {
72
+ export async function runScriptAfterExit(script: string, log: string, cancel: string, taskName: string, timeoutMs = SCRIPT_START_TIMEOUT_MS): Promise<ScriptAnswer> {
70
73
  const command = powershellCommand(script).map((part) => (part === script ? `"${part}"` : part)).join(" ");
71
74
  try {
72
75
  schtasks("/create", "/tn", taskName, "/tr", command, "/sc", "once", "/st", "00:00", "/f");
73
76
  schtasks("/run", "/tn", taskName);
74
- const deadline = Date.now() + SCRIPT_START_TIMEOUT_MS;
77
+ const deadline = Date.now() + timeoutMs;
75
78
  while (Date.now() < deadline) {
76
79
  const answer = scriptAnswer(await readFile(log, "utf8").catch(() => ""));
77
80
  if (answer) return answer;