gloomberb 0.20.3 → 0.20.5

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 (348) hide show
  1. package/README.md +2 -0
  2. package/bin/gloom +9 -0
  3. package/bin/without-bun.cjs +98 -0
  4. package/package.json +3 -1
  5. package/src/account/auth-dialog.tsx +17 -0
  6. package/src/api-client/data.ts +144 -35
  7. package/src/api-client/fx-interventions.ts +64 -0
  8. package/src/api-client/index.ts +1 -0
  9. package/src/api-client/release-summaries.ts +21 -0
  10. package/src/api-client/types/econ.ts +12 -0
  11. package/src/api-client/yield-curves.ts +1 -1
  12. package/src/app/global-shortcuts.ts +4 -1
  13. package/src/app/keybindings/actions.ts +8 -2
  14. package/src/app/keybindings/config.ts +2 -1
  15. package/src/app/keybindings/index.ts +1 -0
  16. package/src/app/keybindings/labels.ts +6 -1
  17. package/src/app/keybindings/resolve.ts +23 -4
  18. package/src/app/keybindings/terminal-keys.ts +35 -0
  19. package/src/app/pane-runtime/index.tsx +2 -2
  20. package/src/app/pane-runtime/ticker-open-runtime.ts +274 -67
  21. package/src/architecture/ui-literals-allowlist.json +1 -1
  22. package/src/capabilities/chart-series.ts +27 -1
  23. package/src/cli/commands/keybindings.ts +5 -5
  24. package/src/cli/commands/market.ts +154 -21
  25. package/src/cli/commands/news-search.ts +60 -10
  26. package/src/cli/commands/overview.ts +16 -1
  27. package/src/cli/commands/plugins.ts +27 -5
  28. package/src/cli/commands/remote.ts +16 -17
  29. package/src/cli/commands/system.ts +20 -4
  30. package/src/cli/commands/ticker.ts +60 -19
  31. package/src/cli/fx-forward.ts +25 -7
  32. package/src/cli/glossary.ts +19 -5
  33. package/src/cli/history-rows.ts +5 -3
  34. package/src/cli/index.ts +8 -8
  35. package/src/cli/known-gaps.ts +27 -1
  36. package/src/cli/listing-arg.ts +11 -1
  37. package/src/cli/name-entries.ts +5 -1
  38. package/src/cli/not-a-ticker.ts +4 -0
  39. package/src/cli/pane-functions/function-help.ts +5 -5
  40. package/src/cli/report-tables.ts +18 -6
  41. package/src/cli/result.ts +15 -7
  42. package/src/cli/types.ts +2 -0
  43. package/src/components/chart/composite/axis-overlays.tsx +22 -0
  44. package/src/components/chart/composite/composite-chart.tsx +54 -13
  45. package/src/components/chart/composite/event-captions.ts +109 -0
  46. package/src/components/chart/composite/event-guides.ts +74 -0
  47. package/src/components/chart/composite/rasterizer.ts +2 -0
  48. package/src/components/chart/composite/text-renderer.ts +2 -0
  49. package/src/components/chart/composite/types.ts +31 -0
  50. package/src/components/command-bar/layout-items/focused-pane.ts +5 -5
  51. package/src/components/command-bar/pane-settings.ts +2 -2
  52. package/src/components/command-bar/routes/root/provider-search.ts +5 -4
  53. package/src/components/command-bar/routes/root/results.ts +6 -2
  54. package/src/components/command-bar/routes/ticker-search/results.ts +51 -0
  55. package/src/components/command-bar/routes/ticker-search/route.ts +3 -2
  56. package/src/components/input-search-bar.tsx +9 -2
  57. package/src/components/layout/detached-pane-shell.tsx +1 -1
  58. package/src/components/layout/floating-pane.tsx +5 -1
  59. package/src/components/layout/pane/footer/index.tsx +21 -14
  60. package/src/components/layout/pane/footer/model.ts +6 -0
  61. package/src/components/layout/pane/header.tsx +2 -0
  62. package/src/components/layout/shell/action-menu-overlay.tsx +10 -5
  63. package/src/components/layout/shell/active-drag.ts +149 -105
  64. package/src/components/layout/shell/drag/drop-zones.ts +162 -0
  65. package/src/components/layout/shell/drag/index.ts +47 -218
  66. package/src/components/layout/shell/drag/live.ts +10 -3
  67. package/src/components/layout/shell/drag/overlays.tsx +182 -5
  68. package/src/components/layout/shell/drag/runtime.ts +29 -6
  69. package/src/components/layout/shell/drag/shared-edges.ts +156 -0
  70. package/src/components/layout/shell/index.tsx +11 -6
  71. package/src/components/layout/shell/menu.ts +11 -2
  72. package/src/components/layout/shell/native/pointer-runtime.ts +25 -0
  73. package/src/components/layout/shell/native/window-state.ts +2 -2
  74. package/src/components/layout/shell/pane/capture.ts +4 -1
  75. package/src/components/layout/shell/pane/layers.tsx +71 -7
  76. package/src/components/layout/shell/terminal-pointer-runtime.ts +18 -9
  77. package/src/components/layout/shell/window-mode/index.ts +8 -10
  78. package/src/components/layout/status-bar.tsx +6 -1
  79. package/src/components/layout/window-edit/mode.ts +39 -7
  80. package/src/components/layout/window-edit/presentation.ts +1 -1
  81. package/src/components/onboarding/first-run-workspace.ts +44 -2
  82. package/src/components/onboarding/onboarding-frame.tsx +11 -2
  83. package/src/components/onboarding/onboarding-keyboard.ts +20 -0
  84. package/src/components/onboarding/onboarding-wizard.tsx +16 -11
  85. package/src/components/onboarding/portfolio-step/positions-panel.tsx +62 -1
  86. package/src/components/onboarding/use-onboarding-progress.ts +12 -4
  87. package/src/components/pane-settings-dialog/desktop.tsx +2 -2
  88. package/src/components/pane-settings-dialog/tui.tsx +2 -2
  89. package/src/components/pane-settings-dialog/value.ts +6 -0
  90. package/src/components/pane-settings-dialog.tsx +3 -3
  91. package/src/components/reader/detail-reader.tsx +4 -0
  92. package/src/components/ui/button.tsx +2 -0
  93. package/src/components/ui/choice-dialog.tsx +1 -0
  94. package/src/components/ui/data-table/index.tsx +4 -3
  95. package/src/components/ui/index.ts +1 -1
  96. package/src/components/ui/list-view.tsx +7 -12
  97. package/src/components/ui/loading.tsx +10 -3
  98. package/src/components/ui/menu.tsx +6 -2
  99. package/src/components/ui/page-stack-view.tsx +3 -0
  100. package/src/components/ui/pane-link-chip.tsx +269 -54
  101. package/src/components/ui/query-bar.tsx +2 -1
  102. package/src/components/ui/quote.ts +14 -1
  103. package/src/components/ui/tabs.tsx +97 -19
  104. package/src/core/state/app/layout-reducer.ts +7 -0
  105. package/src/core/state/app/layout.ts +44 -7
  106. package/src/core/state/app/state.ts +1 -1
  107. package/src/core/state/app/types.ts +22 -2
  108. package/src/data/config/layout.ts +5 -2
  109. package/src/docs/snapshot.json +54 -13
  110. package/src/i18n/es.ts +9 -8
  111. package/src/i18n/ja.ts +9 -8
  112. package/src/i18n/ko.ts +9 -8
  113. package/src/i18n/zh-cn.ts +9 -8
  114. package/src/i18n/zh-tw.ts +9 -8
  115. package/src/layout/pane-manager/floating-actions.ts +17 -0
  116. package/src/layout/pane-manager/floating-stack.ts +187 -0
  117. package/src/layout/pane-manager/floating.ts +4 -2
  118. package/src/layout/pane-manager/gridlock.ts +5 -1
  119. package/src/layout/pane-manager/index.ts +11 -0
  120. package/src/layout/pane-manager/layout-state.ts +10 -3
  121. package/src/market-data/depositary-pair.ts +5 -3
  122. package/src/market-data/futures-board.ts +46 -1
  123. package/src/market-data/futures-contract.ts +12 -3
  124. package/src/market-data/fx-interventions.ts +270 -0
  125. package/src/market-data/market/dated-previous-close.ts +94 -15
  126. package/src/market-data/market/status.ts +17 -1
  127. package/src/news/news-model.ts +44 -2
  128. package/src/plugins/builtin/alerts/cli.ts +4 -4
  129. package/src/plugins/builtin/alerts/format.ts +1 -2
  130. package/src/plugins/builtin/alerts/headless.ts +1 -2
  131. package/src/plugins/builtin/alerts/move-checks.ts +12 -6
  132. package/src/plugins/builtin/alerts/move.ts +30 -9
  133. package/src/plugins/builtin/alerts/pane.tsx +0 -2
  134. package/src/plugins/builtin/alerts/storage.ts +4 -2
  135. package/src/plugins/builtin/alerts/types.ts +12 -0
  136. package/src/plugins/builtin/analytics/risk-client.ts +10 -4
  137. package/src/plugins/builtin/analytics/risk-episodes.ts +5 -4
  138. package/src/plugins/builtin/analytics/risk-headless.ts +4 -2
  139. package/src/plugins/builtin/analytics/risk-sectors.ts +91 -0
  140. package/src/plugins/builtin/awards/index.tsx +1 -1
  141. package/src/plugins/builtin/buildout/index.tsx +1 -0
  142. package/src/plugins/builtin/catalysts/index.tsx +2 -2
  143. package/src/plugins/builtin/cds/headless.ts +4 -0
  144. package/src/plugins/builtin/changelog/index.tsx +292 -101
  145. package/src/plugins/builtin/changelog/versions.ts +293 -0
  146. package/src/plugins/builtin/chart-composer/headless.ts +2 -1
  147. package/src/plugins/builtin/chart-composer/index.tsx +1 -0
  148. package/src/plugins/builtin/chart-composer/intervention-events.ts +105 -0
  149. package/src/plugins/builtin/chart-composer/pane.tsx +21 -7
  150. package/src/plugins/builtin/chat/content/composer.tsx +5 -4
  151. package/src/plugins/builtin/chat/content/index.tsx +12 -2
  152. package/src/plugins/builtin/chat/content/layout-metrics.ts +3 -3
  153. package/src/plugins/builtin/chat/content/open-targets.ts +3 -3
  154. package/src/plugins/builtin/chat/layout.ts +5 -2
  155. package/src/plugins/builtin/chat/message/pane-chip.tsx +61 -40
  156. package/src/plugins/builtin/chat/message/render-state.ts +2 -5
  157. package/src/plugins/builtin/chat/message/terminal.tsx +13 -15
  158. package/src/plugins/builtin/chat/pane-links/previews.ts +51 -5
  159. package/src/plugins/builtin/chat/pane-links/share-card.ts +36 -0
  160. package/src/plugins/builtin/cloud/askg/attached-pane.tsx +10 -5
  161. package/src/plugins/builtin/cloud/askg/controller.ts +141 -5
  162. package/src/plugins/builtin/cloud/askg/executor.ts +113 -4
  163. package/src/plugins/builtin/cloud/askg/manifest.ts +28 -13
  164. package/src/plugins/builtin/cloud/askg/model.ts +14 -4
  165. package/src/plugins/builtin/cloud/askg/pane.tsx +70 -46
  166. package/src/plugins/builtin/cloud/askg/tool-display.ts +1 -0
  167. package/src/plugins/builtin/cloud/askg/turn-parts.tsx +70 -0
  168. package/src/plugins/builtin/cloud/terminal-relay/engine.ts +50 -130
  169. package/src/plugins/builtin/cloud/terminal-relay/policy.ts +327 -7
  170. package/src/plugins/builtin/cloud/terminal-relay/prompts.tsx +2 -1
  171. package/src/plugins/builtin/cloud/terminal-relay/redact.ts +52 -9
  172. package/src/plugins/builtin/commodities-energy/index.tsx +1 -3
  173. package/src/plugins/builtin/commodities-energy/view-state.ts +3 -0
  174. package/src/plugins/builtin/commodity-balances/index.tsx +1 -0
  175. package/src/plugins/builtin/company-attention/index.tsx +1 -1
  176. package/src/plugins/builtin/company-kpis/headless.ts +3 -1
  177. package/src/plugins/builtin/company-kpis/index.tsx +2 -2
  178. package/src/plugins/builtin/cot/headless.ts +14 -2
  179. package/src/plugins/builtin/cot/index.tsx +1 -1
  180. package/src/plugins/builtin/cpi/index.tsx +1 -1
  181. package/src/plugins/builtin/crypto-board/index.tsx +1 -0
  182. package/src/plugins/builtin/dividend-yield/index.tsx +1 -0
  183. package/src/plugins/builtin/doe/index.tsx +1 -1
  184. package/src/plugins/builtin/earnings/index.tsx +2 -2
  185. package/src/plugins/builtin/earnings-calls/headless.ts +5 -1
  186. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  187. package/src/plugins/builtin/econ/calendar-model.ts +74 -1
  188. package/src/plugins/builtin/econ/fred-catalog.ts +3 -1
  189. package/src/plugins/builtin/econ/index.tsx +1 -0
  190. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  191. package/src/plugins/builtin/econ-statistics/pane.tsx +6 -0
  192. package/src/plugins/builtin/estimate-revisions/index.tsx +1 -0
  193. package/src/plugins/builtin/executives/index.tsx +1 -0
  194. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  195. package/src/plugins/builtin/fixed-income/index.tsx +1 -0
  196. package/src/plugins/builtin/futures/index.tsx +25 -4
  197. package/src/plugins/builtin/futures/model.ts +28 -32
  198. package/src/plugins/builtin/futures/series.ts +4 -3
  199. package/src/plugins/builtin/futures/table.tsx +16 -9
  200. package/src/plugins/builtin/futures/use-board-terms.ts +3 -3
  201. package/src/plugins/builtin/futures-curve/headless.ts +3 -3
  202. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  203. package/src/plugins/builtin/futures-curve/model.ts +18 -0
  204. package/src/plugins/builtin/gpu/index.tsx +1 -1
  205. package/src/plugins/builtin/help/functions-table.tsx +1 -1
  206. package/src/plugins/builtin/help/index.tsx +14 -4
  207. package/src/plugins/builtin/help/keybindings-editor.tsx +19 -5
  208. package/src/plugins/builtin/holders/index.tsx +1 -0
  209. package/src/plugins/builtin/holders/report-header.ts +2 -2
  210. package/src/plugins/builtin/insider/index.tsx +1 -0
  211. package/src/plugins/builtin/iv-history/index.tsx +1 -1
  212. package/src/plugins/builtin/jobs/index.tsx +1 -0
  213. package/src/plugins/builtin/layout-manager/index.tsx +8 -8
  214. package/src/plugins/builtin/macro-day/headless.ts +27 -8
  215. package/src/plugins/builtin/macro-day/index.tsx +1 -1
  216. package/src/plugins/builtin/macro-day/model.ts +19 -3
  217. package/src/plugins/builtin/macro-day/pane.tsx +14 -9
  218. package/src/plugins/builtin/macro-day/releases.ts +25 -7
  219. package/src/plugins/builtin/market-valuation/index.tsx +1 -0
  220. package/src/plugins/builtin/market-valuation/pane.tsx +8 -0
  221. package/src/plugins/builtin/members/index.tsx +1 -1
  222. package/src/plugins/builtin/mna/index.tsx +1 -0
  223. package/src/plugins/builtin/news/headless.ts +2 -2
  224. package/src/plugins/builtin/news/index.tsx +4 -3
  225. package/src/plugins/builtin/news/wire/index.tsx +5 -1
  226. package/src/plugins/builtin/news/wire/news/detail-view.tsx +4 -0
  227. package/src/plugins/builtin/news/wire/news/list-search.ts +5 -2
  228. package/src/plugins/builtin/options/index.tsx +1 -0
  229. package/src/plugins/builtin/options-positioning/index.tsx +1 -0
  230. package/src/plugins/builtin/pe-band/index.tsx +1 -1
  231. package/src/plugins/builtin/perps/markets-section.tsx +5 -2
  232. package/src/plugins/builtin/plugin-marketplace/pane.tsx +11 -11
  233. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +25 -0
  234. package/src/plugins/builtin/portfolio-list/headless.ts +15 -6
  235. package/src/plugins/builtin/portfolio-list/summary/index.tsx +3 -1
  236. package/src/plugins/builtin/power/index.tsx +1 -1
  237. package/src/plugins/builtin/realized-vol/index.tsx +1 -1
  238. package/src/plugins/builtin/research/event-model.ts +9 -1
  239. package/src/plugins/builtin/research/event-sources.ts +22 -0
  240. package/src/plugins/builtin/research/headless.ts +11 -5
  241. package/src/plugins/builtin/research/index.tsx +4 -0
  242. package/src/plugins/builtin/research-search/index.tsx +1 -0
  243. package/src/plugins/builtin/research-search/pane.tsx +8 -0
  244. package/src/plugins/builtin/revenue-breakdown/index.tsx +1 -0
  245. package/src/plugins/builtin/reverse-dcf/index.tsx +1 -1
  246. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  247. package/src/plugins/builtin/scanner/headless.ts +52 -13
  248. package/src/plugins/builtin/seasonality/index.tsx +1 -1
  249. package/src/plugins/builtin/sec/index.tsx +1 -0
  250. package/src/plugins/builtin/series-inventory.ts +1 -1
  251. package/src/plugins/builtin/shared/cloud-upgrade.ts +27 -3
  252. package/src/plugins/builtin/shared/scanner-capture.ts +11 -3
  253. package/src/plugins/builtin/shared/series-list-detail.tsx +5 -0
  254. package/src/plugins/builtin/short-interest/index.tsx +1 -0
  255. package/src/plugins/builtin/social-mentions/index.tsx +1 -1
  256. package/src/plugins/builtin/supply-chain/index.tsx +1 -0
  257. package/src/plugins/builtin/thirteenf/data.ts +43 -10
  258. package/src/plugins/builtin/thirteenf/headless.ts +55 -11
  259. package/src/plugins/builtin/thirteenf/model.ts +25 -9
  260. package/src/plugins/builtin/thirteenf/report-notes.ts +27 -6
  261. package/src/plugins/builtin/thirteenf/types.ts +2 -0
  262. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +1 -1
  263. package/src/plugins/builtin/ticker-detail/financials/model.ts +12 -0
  264. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +3 -3
  265. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +5 -5
  266. package/src/plugins/builtin/ticker-detail/headless.ts +18 -13
  267. package/src/plugins/builtin/ticker-detail/index.tsx +4 -0
  268. package/src/plugins/builtin/ticker-detail/overview/components.tsx +54 -5
  269. package/src/plugins/builtin/ticker-detail/overview/model.ts +6 -4
  270. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +34 -17
  271. package/src/plugins/builtin/ticker-detail/pane.tsx +7 -2
  272. package/src/plugins/builtin/time-sales/client.ts +9 -11
  273. package/src/plugins/builtin/time-sales/index.tsx +1 -1
  274. package/src/plugins/builtin/treasury-auctions/after.ts +267 -0
  275. package/src/plugins/builtin/treasury-auctions/cache.ts +18 -3
  276. package/src/plugins/builtin/treasury-auctions/client.ts +33 -2
  277. package/src/plugins/builtin/treasury-auctions/headless.ts +109 -19
  278. package/src/plugins/builtin/treasury-auctions/index.tsx +14 -4
  279. package/src/plugins/builtin/treasury-auctions/model.ts +256 -28
  280. package/src/plugins/builtin/treasury-auctions/pane.tsx +139 -28
  281. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +5 -2
  282. package/src/plugins/builtin/treasury-auctions/types.ts +7 -1
  283. package/src/plugins/builtin/vol-surface/index.tsx +1 -1
  284. package/src/plugins/builtin/world-venue-map/index.ts +1 -0
  285. package/src/plugins/builtin/yield-curve/curves.ts +10 -4
  286. package/src/plugins/builtin/yield-curve/headless.ts +6 -2
  287. package/src/plugins/builtin/yield-curve/index.tsx +3 -3
  288. package/src/plugins/builtin/yield-curve/series.ts +10 -0
  289. package/src/plugins/builtin/yield-curve/world.ts +3 -1
  290. package/src/plugins/installer.ts +45 -0
  291. package/src/portfolio/column-values.ts +2 -1
  292. package/src/public/__snapshots__/public-api.test.ts.snap +4 -0
  293. package/src/public/remote.ts +7 -1
  294. package/src/remote/client.ts +191 -11
  295. package/src/remote/controller-utils.ts +13 -1
  296. package/src/remote/controller.ts +88 -26
  297. package/src/remote/endpoint.ts +24 -0
  298. package/src/remote/form.ts +59 -4
  299. package/src/remote/resources.ts +56 -19
  300. package/src/remote/schema.ts +22 -9
  301. package/src/remote/secrets.ts +12 -0
  302. package/src/remote/semantic-helpers.ts +29 -1
  303. package/src/remote/semantic-tree.tsx +44 -15
  304. package/src/remote/server.ts +2 -1
  305. package/src/remote/surface.tsx +192 -0
  306. package/src/remote/types.ts +5 -0
  307. package/src/renderers/cloudflare/worker.ts +16 -1
  308. package/src/renderers/dom/styles.css +40 -6
  309. package/src/renderers/opentui/host.tsx +6 -0
  310. package/src/renderers/share/layout-view.tsx +1 -1
  311. package/src/series/standalone.ts +2 -2
  312. package/src/shares/api.ts +21 -4
  313. package/src/shares/item.ts +73 -0
  314. package/src/shares/pane-item.ts +205 -0
  315. package/src/shares/pane.ts +4 -0
  316. package/src/shares/payload.ts +9 -5
  317. package/src/sources/gloomberb-cloud/news.ts +37 -12
  318. package/src/state/opening-ticker-panes.ts +47 -0
  319. package/src/test-support/cli-context.ts +2 -0
  320. package/src/test-support/preload.ts +4 -1
  321. package/src/tickers/instrument-kind.ts +23 -3
  322. package/src/tickers/renamed-listings.ts +105 -0
  323. package/src/tickers/search/index.ts +103 -16
  324. package/src/time-series/resolve.ts +2 -2
  325. package/src/types/config.ts +5 -0
  326. package/src/types/context-menu.ts +2 -0
  327. package/src/types/financials.ts +1 -0
  328. package/src/types/plugin-commands.ts +140 -0
  329. package/src/types/plugin-context.ts +125 -0
  330. package/src/types/plugin-contributions.ts +55 -0
  331. package/src/types/plugin-definition.ts +234 -0
  332. package/src/types/plugin-notifications.ts +38 -0
  333. package/src/types/plugin-pane-settings.ts +116 -0
  334. package/src/types/plugin-pane-templates.ts +160 -0
  335. package/src/types/plugin-panes.ts +243 -0
  336. package/src/types/plugin-reports.ts +35 -0
  337. package/src/types/plugin-shared.ts +14 -0
  338. package/src/types/plugin-state.ts +71 -0
  339. package/src/types/plugin.ts +14 -1169
  340. package/src/ui/index.tsx +14 -3
  341. package/src/updater/github-releases.ts +23 -0
  342. package/src/utils/central-banks.ts +86 -1
  343. package/src/utils/cli-output.ts +22 -9
  344. package/src/utils/datetime-format.ts +12 -3
  345. package/src/utils/depositary-receipt.ts +28 -3
  346. package/src/utils/fundamentals.ts +14 -0
  347. package/src/utils/max-drawdown.ts +97 -16
  348. package/src/utils/untrusted-text.ts +29 -0
@@ -14,7 +14,8 @@ import {
14
14
  } from "./pane-screenshot";
15
15
 
16
16
  export const REMOTE_RESOURCES: RemoteResourceSchema[] = [
17
- { uri: "app://snapshot", description: "Current app snapshot including layout, focus, panes, command bar, and plugin/capability catalogs. app.activePanel is deprecated and always \"left\"; read app.focusedPaneId." },
17
+ { uri: "app://snapshot", description: "What is on screen, in one read: focus, config with the layouts, panes, the command bar, the open form or setup dialog (form), and the labelled UI nodes (ui). Left out for size, and named in references: the schema and this guide, what each pane loaded (runtime state), and unlabelled UI nodes. app.activePanel is deprecated and always \"left\"; read app.focusedPaneId." },
18
+ { uri: "app://snapshot/full", description: "app://snapshot with everything it leaves out inline: the schema and guide, pane runtime state and every UI node. Often several times the size." },
18
19
  { uri: "app://config", description: "Current app config.", patchable: true },
19
20
  { uri: "app://layout/current", description: "Current active layout.", patchable: true },
20
21
  { uri: "app://layouts", description: "Saved layouts." },
@@ -26,12 +27,13 @@ export const REMOTE_RESOURCES: RemoteResourceSchema[] = [
26
27
  { uri: "app://commands", description: "Registered command-bar commands." },
27
28
  { uri: "app://command-bar", description: "Current command-bar state and semantic result rows." },
28
29
  { uri: "app://command-bar/results", description: "Current semantic command-bar result rows." },
29
- { uri: "app://form", description: "The open form or confirm: kind, title, fields with values and options, error, pending state, and submit label, with covered: true while another dialog sits over it; { open: false } when none is open, with otherDialogOpen: true while another dialog (pane settings) is." },
30
+ { uri: "app://form", description: "The open form or confirm: kind, title, fields with values and options, error, pending state, and submit label, with covered: true while another dialog sits over it; { open: false } when none is open, with otherDialogOpen: true while another dialog (pane settings) is. The first-run setup dialog reads as kind 'setup', with its step, title, fields and buttons by node id." },
30
31
  { uri: "app://capabilities", description: "Registered plugin capability manifests." },
31
32
  { uri: "app://accounts", description: "Broker profiles and their accounts: net liquidation, cash by currency, margin requirements, margin loan, leverage, day and unrealized P&L, with source and as-of times." },
32
33
  { uri: "app://auth", description: "What the client believes about its cloud session: credential present, checked, cached user plan and verification. No secrets." },
33
34
  { uri: "app://remote/help", description: "Agent-oriented remote usage guide with efficient recipes and caveats." },
34
35
  { uri: "ui://tree", description: "Live semantic UI node tree populated by shared controls and interactive primitives." },
36
+ { uri: "ui://node/{nodeId}", description: "One node of ui://tree with what the tree leaves out: the title of the pane it is in and, for a table, every row." },
35
37
  ];
36
38
 
37
39
  const stringSchema = { type: "string" } satisfies RemoteJsonSchema;
@@ -73,7 +75,7 @@ const watchlistChangeInput = objectSchema({
73
75
  export const REMOTE_OPERATIONS: RemoteOperationSchema[] = [
74
76
  op(
75
77
  "app.openCommandBar",
76
- "Open the command bar with an optional query and optional mode. Fails while a dialog (a form, a confirm, pane settings) is open.",
78
+ "Open the command bar with an optional query and optional mode. Fails while a dialog (a form, a confirm, pane settings) or the setup dialog is open.",
77
79
  "{ query?: string, mode?: 'command' | 'ticker' | 'default' }",
78
80
  "local-write",
79
81
  objectSchema({
@@ -84,7 +86,7 @@ export const REMOTE_OPERATIONS: RemoteOperationSchema[] = [
84
86
  op("app.closeCommandBar", "Close the command bar.", "{}", "local-write", objectSchema()),
85
87
  op(
86
88
  "app.closeDialog",
87
- "Close the dialog on top, as Esc would: a form, a confirm, pane settings, or a picker opened over a form. Fails when no dialog is open.",
89
+ "Close the dialog on top, as Esc would: a form, a confirm, pane settings, or a picker opened over a form. Fails when no dialog is open; the setup dialog is left with its own buttons (app://form).",
88
90
  "{}",
89
91
  "local-write",
90
92
  objectSchema(),
@@ -98,7 +100,7 @@ export const REMOTE_OPERATIONS: RemoteOperationSchema[] = [
98
100
  ),
99
101
  op(
100
102
  "app.search",
101
- "Open command-bar search without requiring UI prefix syntax. Fails while a dialog is open.",
103
+ "Open command-bar search without requiring UI prefix syntax. Fails while a dialog or the setup dialog is open.",
102
104
  "{ mode?: 'command' | 'ticker' | 'default', query?: string }",
103
105
  "local-write",
104
106
  objectSchema({
@@ -360,7 +362,7 @@ export const REMOTE_OPERATIONS: RemoteOperationSchema[] = [
360
362
  ),
361
363
  op(
362
364
  "ui.invokeMatching",
363
- "Invoke an action on the first semantic UI node matching role, label, index, or metadata. While a form or confirm is open, its own nodes (metadata.scope 'form') match first; while another dialog covers it, they do not match.",
365
+ "Invoke an action on the first semantic UI node matching role, label, index, or metadata. While a form, confirm or the setup dialog is open, its own nodes (metadata.scope 'form') match first; while another dialog covers it, they do not match.",
364
366
  "{ role?: string, label?: string, contains?: string, index?: number, action?: string, input?: any, metadata?: object }",
365
367
  "local-write",
366
368
  objectSchema({
@@ -378,7 +380,8 @@ export const REMOTE_OPERATIONS: RemoteOperationSchema[] = [
378
380
  export const REMOTE_AGENT_HELP = {
379
381
  title: "Gloom remote control guide",
380
382
  quickStart: [
381
- "Read app://snapshot once to orient; it includes schema, current layout, panes, command bar state, and semantic UI nodes.",
383
+ "Read app://snapshot once to orient: focus, layout, panes, command bar, the open form or setup dialog (form), and the labelled UI nodes. Read the schema ({ type: 'schema' }, gloom remote schema) once for every operation and its input.",
384
+ "When form.open is true, a form or the setup dialog covers the app: deal with it first. A change made behind it answers with a warning that says so.",
382
385
  "Prefer app-level operations such as app.search, layout.setGrid, layout.closeFloating, and ticker.pin before falling back to ui.invoke.",
383
386
  "Use commandBar.activateResult with label, itemId, or index after app.search; avoid raw node ids unless there is no stable semantic selector.",
384
387
  "For list-like surfaces, prefer semantic list activation through commandBar.activateResult or ui.invokeMatching.",
@@ -387,8 +390,8 @@ export const REMOTE_AGENT_HELP = {
387
390
  resources: [
388
391
  { uri: "app://command-bar", use: "Current command-bar query, open state, selected row, and semantic result rows." },
389
392
  { uri: "app://command-bar/results", use: "Just the visible command-bar result/list rows." },
390
- { uri: "app://form", use: "The open form or confirm, with field ids, values, options, error and pending state, or whether another dialog is open. Every call includes it as `form`." },
391
- { uri: "ui://tree", use: "Low-level live semantic controls; use when no app-level operation exists." },
393
+ { uri: "app://form", use: "The open form, confirm or setup dialog, with field ids, values, options, error and pending state, or whether another dialog is open. Every call includes it as `form`." },
394
+ { uri: "ui://tree", use: "Every live semantic control, unlabelled click areas too (app://snapshot lists the labelled ones); use when no app-level operation exists." },
392
395
  { uri: "app://panes", use: "Pane instances, placement, focus, and runtime state." },
393
396
  ],
394
397
  recipes: [
@@ -423,6 +426,14 @@ export const REMOTE_AGENT_HELP = {
423
426
  { type: "call", operation: "ui.invokeMatching", input: { role: "form", action: "submit" } },
424
427
  ],
425
428
  },
429
+ {
430
+ goal: "Get past the first-run setup dialog (form.kind 'setup')",
431
+ requests: [
432
+ { type: "call", operation: "ui.invokeMatching", input: { role: "form-field", metadata: { fieldId: "ticker" }, action: "setValue", input: "NVDA" } },
433
+ { type: "call", operation: "ui.invokeMatching", input: { role: "form-field", metadata: { fieldId: "ticker" }, action: "submit" } },
434
+ { type: "call", operation: "ui.invokeMatching", input: { role: "form", action: "submit" } },
435
+ ],
436
+ },
426
437
  {
427
438
  goal: "Activate a visible semantic control without knowing its node id",
428
439
  request: { type: "call", operation: "ui.invokeMatching", input: { role: "button", label: "Done", action: "press" } },
@@ -447,10 +458,12 @@ export const REMOTE_AGENT_HELP = {
447
458
  caveats: [
448
459
  "Capability manifests are for plugin services; UI control should rely on app-level operations and shared semantic UI nodes so plugins remain remote-agnostic.",
449
460
  "If an operation changes UI, request include: ['commandBar'] or use batch include to avoid a follow-up get.",
461
+ "Panes in app://snapshot and in call answers leave out runtimeState, which can hold everything a pane loaded; read app://pane-state/{paneId} for one pane, or app://panes.",
450
462
  "For charts, use visible semantic chart nodes with actions such as moveCursor, press, drag, release, and scroll.",
451
463
  "A command with hasWizard in app://commands opens a form in a centered dialog when activated, and the command bar closes. Read `form` in the response, set fields with ui.invokeMatching { role: 'form-field', metadata: { fieldId }, action: 'setValue' }, then send with { role: 'form', action: 'submit' } or close with action 'cancel'. Selects take an option value, toggles a boolean; neither needs to be opened.",
452
464
  "While a dialog is open (form.open or form.otherDialogOpen), app.openCommandBar and app.search fail; close a form or confirm with { role: 'form', action: 'cancel' }, and any dialog on top with app.closeDialog.",
453
465
  "A form with covered: true has another dialog over it, such as a listing picker or a sign-in; its controls wait until that one is answered or closed with app.closeDialog.",
466
+ "On a new profile the setup dialog covers the app: form.kind is 'setup', with its step, title, fields and buttons by node id. Fill a field with ui.invokeMatching { role: 'form-field', metadata: { fieldId }, action: 'setValue' } (submit on the Ticker field adds the position), press a button with { role: 'button', label }, go on with { role: 'form', action: 'submit' } (the button Enter presses), and skip the whole setup with { role: 'form', action: 'cancel' } where a step offers it. Skip leaves one step without filling it. app.closeDialog does not close it.",
454
467
  "Pane settings open in their own dialog, not as command-bar rows; change one with pane.setSetting, read them from app://pane-settings/{paneId}, and close the dialog with app.closeDialog.",
455
468
  "watchlist.add and watchlist.remove wait while the person answers a confirmation in the app and return what changed; with dryRun they return what would change without asking.",
456
469
  "pane.screenshot returns the pane's PNG as base64 in image.data, with its pixel size; the terminal (TUI) app answers that it needs the desktop app.",
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Words that name a credential: a password or passphrase, a secret, a token,
3
+ * an API or private key, a cookie. Matched against the keys of free-form maps
4
+ * and against a form field's id, label and placeholder, so what such a field
5
+ * holds is withheld wherever remote control lists it.
6
+ */
7
+ export const SECRET_NAME = /(pass(word|phrase)?|secret|token|api[-_ ]?key|private[-_ ]?key|credential|cookie)/i;
8
+
9
+ /** Whether any of these texts names a credential. */
10
+ export function namesSecret(...texts: unknown[]): boolean {
11
+ return texts.some((text) => typeof text === "string" && SECRET_NAME.test(text));
12
+ }
@@ -105,7 +105,7 @@ interface RemoteIndexSelectors<T> {
105
105
  value?: RemoteItemSelector<T>;
106
106
  }
107
107
 
108
- export function resolveRemoteItemIndex<T>(
108
+ function resolveRemoteItemIndex<T>(
109
109
  input: unknown,
110
110
  items: readonly T[],
111
111
  selectors: RemoteIndexSelectors<T>,
@@ -125,6 +125,34 @@ export function resolveRemoteItemIndex<T>(
125
125
  return -1;
126
126
  }
127
127
 
128
+ // How each kit control picks an item for a remote action. The control and the
129
+ // policy that names the item before it runs (terminal-relay/policy.ts) both
130
+ // call these, so the item a person is asked about is the one that runs.
131
+
132
+ /** A Menu's `select`: the id itself, or `{ id }`, and nothing else. */
133
+ export function remoteMenuItemId(input: unknown): string | undefined {
134
+ if (typeof input === "string") return input;
135
+ const id = remoteObjectProp(input, "id");
136
+ return typeof id === "string" ? id : undefined;
137
+ }
138
+
139
+ /** A ListView's `select` and `activate`: by index, id or label. */
140
+ export function resolveRemoteListIndex<T extends { id?: unknown; label?: unknown }>(input: unknown, items: readonly T[]): number {
141
+ return resolveRemoteItemIndex(input, items, {
142
+ id: (item) => (typeof item.id === "string" ? item.id : undefined),
143
+ label: (item) => (typeof item.label === "string" ? item.label : undefined),
144
+ });
145
+ }
146
+
147
+ /** A DataTable's `selectRow` and `activateRow`: by index, or by the row's key as `id` or `key`. */
148
+ export function resolveRemoteRowIndex<T>(
149
+ input: unknown,
150
+ rows: readonly T[],
151
+ keyOf: (row: T, index: number) => string | undefined,
152
+ ): number {
153
+ return resolveRemoteItemIndex(input, rows, { id: keyOf, key: keyOf });
154
+ }
155
+
128
156
  function remoteChartScroll(input: unknown) {
129
157
  if (!input || typeof input !== "object") return undefined;
130
158
  const record = input as Record<string, unknown>;
@@ -19,6 +19,11 @@ export interface RemoteUiNodeRegistration {
19
19
  metadata?: Record<string, unknown>;
20
20
  /** Defers expensive metadata projection until a remote snapshot requests it. */
21
21
  getMetadata?: () => Record<string, unknown>;
22
+ /**
23
+ * What the tree leaves out for its size, read only for this one node
24
+ * (`ui://node/{id}`): a table's every row. Merged over its metadata.
25
+ */
26
+ getDetail?: () => Record<string, unknown>;
22
27
  }
23
28
 
24
29
  interface RegisteredRemoteUiNode {
@@ -30,11 +35,38 @@ export interface RemoteUiRegistry {
30
35
  register(id: string, registration: RemoteUiNodeRegistration): void;
31
36
  unregister(id: string): void;
32
37
  snapshot(): RemoteUiNodeSnapshot[];
38
+ /**
39
+ * The nodes of one role, without projecting the rest (a table's rows, a
40
+ * chart's data): the open form is read this way on every change.
41
+ */
42
+ snapshotRole?(role: string): RemoteUiNodeSnapshot[];
43
+ /** One node as the tree has it, with its detail; null when it is not on screen. */
44
+ detail(nodeId: string): RemoteUiNodeSnapshot | null;
33
45
  invoke(nodeId: string, action: string, input?: unknown): Promise<unknown>;
34
46
  }
35
47
 
36
48
  const RemoteUiRegistryContext = createContext<RemoteUiRegistry | null>(null);
37
49
 
50
+ function nodeSnapshot(node: RegisteredRemoteUiNode): RemoteUiNodeSnapshot {
51
+ return remoteUiNodeSnapshot(node.id, node.registration);
52
+ }
53
+
54
+ /** A registered node as `ui://tree` lists it. */
55
+ export function remoteUiNodeSnapshot(id: string, registration: RemoteUiNodeRegistration): RemoteUiNodeSnapshot {
56
+ return {
57
+ id,
58
+ role: registration.role,
59
+ label: registration.label,
60
+ disabled: registration.disabled,
61
+ actions: Object.entries(registration.actions ?? {})
62
+ .filter((entry): entry is [string, RemoteUiAction] => typeof entry[1] === "function")
63
+ .map(([action]) => action)
64
+ .sort(),
65
+ metadata: registration.getMetadata?.() ?? registration.metadata,
66
+ ...(registration.paneId ? { paneId: registration.paneId } : {}),
67
+ };
68
+ }
69
+
38
70
  export function createRemoteUiRegistry(): RemoteUiRegistry {
39
71
  const nodes = new Map<string, RegisteredRemoteUiNode>();
40
72
 
@@ -46,21 +78,17 @@ export function createRemoteUiRegistry(): RemoteUiRegistry {
46
78
  nodes.delete(id);
47
79
  },
48
80
  snapshot() {
49
- return [...nodes.values()].map((node) => {
50
- const registration = node.registration;
51
- return {
52
- id: node.id,
53
- role: registration.role,
54
- label: registration.label,
55
- disabled: registration.disabled,
56
- actions: Object.entries(registration.actions ?? {})
57
- .filter((entry): entry is [string, RemoteUiAction] => typeof entry[1] === "function")
58
- .map(([action]) => action)
59
- .sort(),
60
- metadata: registration.getMetadata?.() ?? registration.metadata,
61
- ...(registration.paneId ? { paneId: registration.paneId } : {}),
62
- };
63
- });
81
+ return [...nodes.values()].map(nodeSnapshot);
82
+ },
83
+ snapshotRole(role) {
84
+ return [...nodes.values()].filter((node) => node.registration.role === role).map(nodeSnapshot);
85
+ },
86
+ detail(nodeId) {
87
+ const node = nodes.get(nodeId);
88
+ if (!node) return null;
89
+ const snapshot = nodeSnapshot(node);
90
+ const detail = node.registration.getDetail?.();
91
+ return detail ? { ...snapshot, metadata: { ...snapshot.metadata, ...detail } } : snapshot;
64
92
  },
65
93
  async invoke(nodeId, action, input) {
66
94
  const node = nodes.get(nodeId);
@@ -149,6 +177,7 @@ export function useRemoteUiNode(registration: RemoteUiNodeRegistration | null |
149
177
  get actions() { return registrationRef.current?.actions; },
150
178
  get metadata() { return registrationRef.current?.metadata; },
151
179
  get getMetadata() { return registrationRef.current?.getMetadata; },
180
+ get getDetail() { return registrationRef.current?.getDetail; },
152
181
  };
153
182
  }
154
183
  const nodeId = nodeIdRef.current;
@@ -2,7 +2,7 @@ import { randomUUID } from "crypto";
2
2
  import { createServer, type IncomingMessage, type ServerResponse } from "http";
3
3
  import type { RemoteAppKind, RemoteControlRequest, RemoteControlResponse, RemoteEndpoint } from "./types";
4
4
  import { REMOTE_CONTROL_PROTOCOL_VERSION } from "./types";
5
- import { removeRemoteEndpointFiles, writeRemoteEndpointFiles } from "./endpoint";
5
+ import { currentPidNamespace, removeRemoteEndpointFiles, writeRemoteEndpointFiles } from "./endpoint";
6
6
 
7
7
  export interface RemoteControlServerOptions {
8
8
  dataDir: string;
@@ -44,6 +44,7 @@ export async function startRemoteControlServer(options: RemoteControlServerOptio
44
44
  port: address.port,
45
45
  token,
46
46
  startedAt: new Date().toISOString(),
47
+ pidNamespace: currentPidNamespace(),
47
48
  };
48
49
  try {
49
50
  await writeRemoteEndpointFiles(options.dataDir, endpoint);
@@ -0,0 +1,192 @@
1
+ import { createContext, useContext, useRef, type ReactNode } from "react";
2
+ import { isDialogOpen } from "../ui/dialog-stack";
3
+ import {
4
+ RemoteUiRegistryProvider,
5
+ remoteUiNodeSnapshot,
6
+ useRemoteUiNode,
7
+ useRemoteUiRegistry,
8
+ type RemoteUiNodeRegistration,
9
+ type RemoteUiRegistry,
10
+ } from "./semantic-tree";
11
+ import { namesSecret } from "./secrets";
12
+ import type { RemoteUiNodeSnapshot } from "./types";
13
+
14
+ /** What the surface's own title and header say about it, set by the components that draw them. */
15
+ interface SurfaceDetails {
16
+ step?: string;
17
+ section?: string;
18
+ title?: string;
19
+ description?: string;
20
+ /** Closes or skips the whole surface, when it offers that. */
21
+ cancel?: () => void;
22
+ }
23
+
24
+ const RemoteSurfaceContext = createContext<{ current: SurfaceDetails } | null>(null);
25
+
26
+ /** Roles of the controls a person fills in: listed as the surface's fields. */
27
+ const FIELD_ROLES = new Set(["form-field", "text-field", "textarea", "select", "checkbox", "list"]);
28
+ /** The kit's own editors, left out when the surface names its fields as form-field nodes. */
29
+ const EDITOR_ROLES = new Set(["text-field", "textarea"]);
30
+ /** The button Enter presses on the surface is the one it sends with. */
31
+ const SUBMIT_SHORTCUT = "Enter";
32
+
33
+ /**
34
+ * Registers its subtree's nodes in the app's registry, and keeps them, so the
35
+ * surface can list its own controls. Every node drawn inside is the open
36
+ * form's (`metadata.scope` "form"), so `ui.invokeMatching` tries them first,
37
+ * as it does a form modal's.
38
+ */
39
+ function surfaceRegistry(parent: RemoteUiRegistry, own: Map<string, RemoteUiNodeRegistration>): RemoteUiRegistry {
40
+ return {
41
+ register(id, registration) {
42
+ own.set(id, registration);
43
+ parent.register(id, inForm(registration));
44
+ },
45
+ unregister(id) {
46
+ own.delete(id);
47
+ parent.unregister(id);
48
+ },
49
+ snapshot: () => parent.snapshot(),
50
+ snapshotRole: (role) => parent.snapshotRole?.(role) ?? parent.snapshot().filter((node) => node.role === role),
51
+ detail: (nodeId) => parent.detail(nodeId),
52
+ invoke: (nodeId, action, input) => parent.invoke(nodeId, action, input),
53
+ };
54
+ }
55
+
56
+ function inForm(registration: RemoteUiNodeRegistration): RemoteUiNodeRegistration {
57
+ return {
58
+ get role() { return registration.role; },
59
+ get paneId() { return registration.paneId; },
60
+ get label() { return registration.label; },
61
+ get disabled() { return registration.disabled; },
62
+ get actions() { return registration.actions; },
63
+ getMetadata: () => {
64
+ const metadata = registration.getMetadata?.() ?? registration.metadata ?? {};
65
+ return { ...metadata, scope: metadata.scope ?? "form" };
66
+ },
67
+ get getDetail() { return registration.getDetail; },
68
+ };
69
+ }
70
+
71
+ function isPassword(metadata: Record<string, unknown>): boolean {
72
+ return metadata.type === "password" || metadata.inputType === "password" || metadata.fieldType === "password";
73
+ }
74
+
75
+ const FIELD_KEYS = ["placeholder", "active", "focused", "required", "error", "options", "items", "selectedIndex", "checked"] as const;
76
+
77
+ /**
78
+ * A field as the surface lists it. A password, or a field whose id, label or
79
+ * placeholder names a credential (an API key typed in the clear), says
80
+ * whether it is filled, never what.
81
+ */
82
+ function surfaceField(node: RemoteUiNodeSnapshot) {
83
+ const metadata = node.metadata ?? {};
84
+ const value = metadata.value;
85
+ const password = isPassword(metadata);
86
+ const secret = password || namesSecret(metadata.fieldId, node.label, metadata.placeholder);
87
+ const kept = Object.fromEntries(FIELD_KEYS.filter((key) => metadata[key] != null).map((key) => [key, metadata[key]]));
88
+ return {
89
+ nodeId: node.id,
90
+ ...(typeof metadata.fieldId === "string" ? { id: metadata.fieldId } : {}),
91
+ role: node.role,
92
+ label: node.label ?? null,
93
+ ...(secret
94
+ ? { ...(password ? { type: "password" } : {}), secret: true, filled: typeof value === "string" && value.length > 0 }
95
+ : node.role === "list" || node.role === "checkbox" ? {} : { value: value ?? null }),
96
+ ...kept,
97
+ ...(node.disabled ? { disabled: true } : {}),
98
+ actions: node.actions,
99
+ };
100
+ }
101
+
102
+ function surfaceButton(node: RemoteUiNodeSnapshot) {
103
+ const shortcut = node.metadata?.shortcut;
104
+ return {
105
+ nodeId: node.id,
106
+ label: node.label ?? null,
107
+ ...(node.disabled ? { disabled: true } : {}),
108
+ ...(typeof shortcut === "string" && shortcut ? { shortcut } : {}),
109
+ };
110
+ }
111
+
112
+ /** The controls drawn inside the surface, in the order they registered. */
113
+ function surfaceControls(own: Map<string, RemoteUiNodeRegistration>) {
114
+ const nodes = [...own].map(([id, registration]) => remoteUiNodeSnapshot(id, registration));
115
+ // A step that names its fields as form-field nodes drives its editors through them.
116
+ const named = nodes.some((node) => node.role === "form-field");
117
+ const fields = nodes.filter((node) => FIELD_ROLES.has(node.role) && !(named && EDITOR_ROLES.has(node.role)));
118
+ const buttons = nodes.filter((node) => node.role === "button" && node.label);
119
+ const submit = buttons.find((node) => node.metadata?.shortcut === SUBMIT_SHORTCUT);
120
+ return { fields, buttons, submit };
121
+ }
122
+
123
+ /**
124
+ * A full-window card that is not a dialog of the dialog stack, such as the
125
+ * first-run setup: remote control reads it as the open form (`app://form`),
126
+ * with its title, the fields and buttons drawn in it, `submit` for the button
127
+ * Enter presses and `cancel` when it can be skipped. `covered` while a dialog
128
+ * sits over it.
129
+ */
130
+ export function RemoteSurface({ kind, children }: { kind: string; children: ReactNode }) {
131
+ const parent = useRemoteUiRegistry();
132
+ const detailsRef = useRef<SurfaceDetails>({});
133
+ const ownRef = useRef<Map<string, RemoteUiNodeRegistration>>(new Map());
134
+ const registryRef = useRef<RemoteUiRegistry | null>(null);
135
+ if (parent && !registryRef.current) registryRef.current = surfaceRegistry(parent, ownRef.current);
136
+
137
+ const press = async (node: RemoteUiNodeSnapshot | undefined) => {
138
+ if (!node) throw new Error("This step has no button that sends it; press one of its buttons instead.");
139
+ if (node.disabled) throw new Error(`"${node.label}" is disabled.`);
140
+ await ownRef.current.get(node.id)?.actions?.press?.();
141
+ };
142
+
143
+ useRemoteUiNode({
144
+ role: "form",
145
+ get label() { return detailsRef.current.title; },
146
+ get actions() {
147
+ const cancel = detailsRef.current.cancel;
148
+ const { submit } = surfaceControls(ownRef.current);
149
+ return {
150
+ cancel: cancel ? () => cancel() : undefined,
151
+ submit: submit ? () => press(surfaceControls(ownRef.current).submit) : undefined,
152
+ };
153
+ },
154
+ getMetadata: () => {
155
+ const details = detailsRef.current;
156
+ const { fields, buttons, submit } = surfaceControls(ownRef.current);
157
+ return {
158
+ scope: "form",
159
+ kind,
160
+ step: details.step ?? details.section ?? null,
161
+ title: details.title ?? null,
162
+ ...(details.description ? { description: details.description } : {}),
163
+ fields: fields.map(surfaceField),
164
+ buttons: buttons.map(surfaceButton),
165
+ submitLabel: submit?.label ?? null,
166
+ covered: isDialogOpen(),
167
+ };
168
+ },
169
+ } satisfies RemoteUiNodeRegistration);
170
+
171
+ const content = <RemoteSurfaceContext value={detailsRef}>{children}</RemoteSurfaceContext>;
172
+ return registryRef.current
173
+ ? <RemoteUiRegistryProvider registry={registryRef.current}>{content}</RemoteUiRegistryProvider>
174
+ : content;
175
+ }
176
+
177
+ /** Names the surface this is drawn in: its step, title and description. */
178
+ export function useRemoteSurfaceHeading(heading: Pick<SurfaceDetails, "step" | "title" | "description">): void {
179
+ const surface = useContext(RemoteSurfaceContext);
180
+ if (!surface) return;
181
+ surface.current.step = heading.step;
182
+ surface.current.title = heading.title;
183
+ surface.current.description = heading.description;
184
+ }
185
+
186
+ /** The surface's section (shown as its step when the title names none) and how it is skipped, if it can be. */
187
+ export function useRemoteSurfaceHeader(header: Pick<SurfaceDetails, "section" | "cancel">): void {
188
+ const surface = useContext(RemoteSurfaceContext);
189
+ if (!surface) return;
190
+ surface.current.section = header.section;
191
+ surface.current.cancel = header.cancel;
192
+ }
@@ -9,6 +9,11 @@ export interface RemoteEndpoint {
9
9
  port: number;
10
10
  token: string;
11
11
  startedAt: string;
12
+ /**
13
+ * The process-id namespace `pid` belongs to, on Linux. A client in another
14
+ * one (a sandbox, a container) cannot tell from `pid` whether the app runs.
15
+ */
16
+ pidNamespace?: string;
12
17
  }
13
18
 
14
19
  export interface RemoteJsonPatchOperation {
@@ -140,6 +140,20 @@ export function withSecurityHeaders(response: Response, options: { share?: boole
140
140
  return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
141
141
  }
142
142
 
143
+ /**
144
+ * Where a `/api/...` request goes: the API origin followed by the rest of the
145
+ * path, which must start with exactly one slash. The path is appended, never
146
+ * resolved against the origin, since `//host/x` (or `\host/x`, which the URL
147
+ * parser reads as the same) resolves to another host. Anything that does not
148
+ * end up on the API origin gets no upstream.
149
+ */
150
+ function apiUpstreamUrl(url: URL): URL | null {
151
+ const path = url.pathname.slice("/api".length) || "/";
152
+ if (!path.startsWith("/") || /^\/[/\\]/.test(path)) return null;
153
+ const upstream = new URL(`${API_ORIGIN}${path}${url.search}`);
154
+ return upstream.origin === API_ORIGIN ? upstream : null;
155
+ }
156
+
143
157
  async function proxyApi(request: Request, fetchApi: ApiFetch): Promise<Response> {
144
158
  const url = new URL(request.url);
145
159
  if (!API_METHODS.has(request.method)) {
@@ -152,7 +166,8 @@ async function proxyApi(request: Request, fetchApi: ApiFetch): Promise<Response>
152
166
  if (origin && origin !== url.origin) {
153
167
  return Response.json({ error: "Origin not allowed" }, { status: 403 });
154
168
  }
155
- const upstreamUrl = new URL(`${url.pathname.slice(4) || "/"}${url.search}`, API_ORIGIN);
169
+ const upstreamUrl = apiUpstreamUrl(url);
170
+ if (!upstreamUrl) return Response.json({ error: "Not found" }, { status: 404 });
156
171
  return fetchApi(new Request(upstreamUrl, request));
157
172
  }
158
173
 
@@ -674,16 +674,50 @@ button, [data-gloom-interactive="true"] { cursor: pointer; }
674
674
  [data-gloom-role="dock-divider"] {
675
675
  background: transparent !important;
676
676
  }
677
- /* Where a moving pane would land (a spot it would join or stack in, a
678
- screen-edge snap, window mode's keyboard move): the exact rectangle,
679
- outlined in the accent over a light tint of it, so the panes under it still
680
- show. */
677
+ /* Where a moving pane can land and where it will: one look for all of it
678
+ (shell/drag/drop-zones.ts, shell/drag/overlays.tsx). The accent outlines a
679
+ tint of itself, 12% at rest and 40% under the pointer. The landing preview
680
+ is the exact rectangle the pane takes (a split, a tab, an edge of the
681
+ layout, a floating window's tab or half, window mode's keyboard move),
682
+ see-through so the panes under it still show. A strip along each edge of
683
+ the window is see-through too, and thinner. A square of the target on the
684
+ pane under the pointer sits raised and opaque over it. */
681
685
  [data-gloom-role="drop-preview"],
682
- [data-gloom-role="window-mode-drop-preview"] {
686
+ [data-gloom-role="window-mode-drop-preview"],
687
+ [data-gloom-role="drop-strip"],
688
+ [data-gloom-role="drop-zone"] {
689
+ --drop-tint: 12%;
690
+ --drop-under: transparent;
683
691
  border: 2px solid var(--gloom-accent);
684
692
  border-radius: var(--gloom-radius-md);
685
- background: color-mix(in srgb, var(--gloom-accent) 12%, transparent);
693
+ background: color-mix(in srgb, var(--gloom-accent) var(--drop-tint), var(--drop-under));
686
694
  }
695
+ [data-gloom-role="drop-strip"] {
696
+ border-width: 1px;
697
+ border-radius: var(--gloom-radius-sm);
698
+ }
699
+ [data-gloom-role="drop-zone"] {
700
+ --drop-under: var(--gloom-bg);
701
+ box-shadow: var(--gloom-elevation);
702
+ }
703
+ [data-gloom-role="drop-strip"][data-active="true"],
704
+ [data-gloom-role="drop-zone"][data-active="true"] {
705
+ --drop-tint: 40%;
706
+ }
707
+ /* Inside a square, the part of the pane the moving one takes: all of it for a tab, a half for a side. */
708
+ [data-gloom-role="drop-zone"]::before {
709
+ content: "";
710
+ position: absolute;
711
+ inset: var(--gloom-space-xs);
712
+ border-radius: var(--gloom-radius-sm);
713
+ background: var(--gloom-accent);
714
+ opacity: .5;
715
+ }
716
+ [data-gloom-role="drop-zone"][data-side="left"]::before { right: 50%; }
717
+ [data-gloom-role="drop-zone"][data-side="right"]::before { left: 50%; }
718
+ [data-gloom-role="drop-zone"][data-side="top"]::before { bottom: 50%; }
719
+ [data-gloom-role="drop-zone"][data-side="bottom"]::before { top: 50%; }
720
+ [data-gloom-role="drop-zone"][data-active="true"]::before { opacity: 1; }
687
721
  /* The gap between the panes is the divider at rest; its line shows while it
688
722
  is dragged or resized from the keyboard. */
689
723
  [data-gloom-role="dock-divider"]::before {
@@ -11,6 +11,7 @@ import { buildTerminalMediaArgs, createTerminalMediaReaper, terminalMediaStateFi
11
11
  import { saveTextFileToDownloads } from "../../utils/save-text-file";
12
12
  import { installInteractionPerformanceRecorder } from "./interaction-performance";
13
13
  import { provideKittyServices } from "./kitty-services";
14
+ import { setTerminalReportsControlKeys } from "../../app/keybindings/terminal-keys";
14
15
  import { captureRendererFrame } from "./frame-capture";
15
16
  import {
16
17
  createTimerFrameDriver,
@@ -120,6 +121,11 @@ export async function createOpenTuiHost(): Promise<OpenTuiHost> {
120
121
  // at 11 is not a leak here, and it prints over the panes.
121
122
  renderer.setMaxListeners(0);
122
123
  installResolutionEventBridge(renderer);
124
+ // Whether Control reaches a digit, once the terminal has answered: the
125
+ // layout tabs name Alt+1 where it does not. Unknown until then.
126
+ renderer.on("capabilities", (capabilities: { kitty_keyboard?: boolean } | null) => {
127
+ setTerminalReportsControlKeys(capabilities?.kitty_keyboard === true);
128
+ });
123
129
  // Streamed quotes apply and notify on one clock of up to 10 Hz: every
124
130
  // visible row stays live while a burst of ticks costs one terminal redraw,
125
131
  // and a layout whose redraws are expensive gets fewer of them.
@@ -116,7 +116,7 @@ export function LayoutShareView({
116
116
  <section className="layout-workspace" aria-label={`${entry.name} layout preview`}>
117
117
  {entry.layout.dockRoot
118
118
  ? <DockPreview node={entry.layout.dockRoot} panes={panes} />
119
- : <p>No docked panes</p>}
119
+ : <p>No panes in the layout</p>}
120
120
  {extra.length > 0 ? (
121
121
  <div className="layout-extra-panes">
122
122
  {extra.map((pane) => <PaneCard key={pane.instanceId} pane={pane} />)}
@@ -1,5 +1,5 @@
1
1
  import { logFailure } from "../utils/log-failure";
2
- import { chartSeriesResolveRequestSchema } from "../capabilities/chart-series";
2
+ import { chartSeriesResolveRequestSchema, uncoveredCapabilityMessage } from "../capabilities/chart-series";
3
3
  import type { CapabilityInvoker } from "../capabilities/types";
4
4
  import type { GloomPlugin } from "../types/plugin";
5
5
  import { resolveRegisteredSeries } from "./capability";
@@ -43,7 +43,7 @@ export function standaloneSeriesInvoker(
43
43
  registry ??= build();
44
44
  const request = chartSeriesResolveRequestSchema.parse(payload);
45
45
  const resolved = await resolveRegisteredSeries(await registry, capabilityId, request.seriesId, request.viewport, options?.signal);
46
- if (!resolved) throw new Error(`Chart series capability "${capabilityId}" is unavailable. Enable its plugin or provider.`);
46
+ if (!resolved) throw new Error(uncoveredCapabilityMessage(capabilityId, request.seriesId));
47
47
  return resolved as T;
48
48
  },
49
49
  };