@gloom-sh/terminal 0.19.5 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/LICENSE +0 -4
  2. package/package.json +6 -5
  3. package/patches/@opentui%2Fcore@0.3.2.patch +86 -25
  4. package/patches/electrobun-devkit@2.0.5.patch +148 -0
  5. package/src/api-client/bond-trades.ts +59 -0
  6. package/src/api-client/data.ts +21 -0
  7. package/src/api-client/equity-screener.ts +23 -0
  8. package/src/api-client/index.ts +2 -0
  9. package/src/api-client/types/account.ts +86 -0
  10. package/src/api-client/types/assist.ts +32 -0
  11. package/src/api-client/types/auth.ts +63 -0
  12. package/src/api-client/types/billing.ts +54 -0
  13. package/src/api-client/types/chat.ts +180 -0
  14. package/src/api-client/types/congress.ts +107 -0
  15. package/src/api-client/types/credit.ts +110 -0
  16. package/src/api-client/types/econ.ts +158 -0
  17. package/src/api-client/types/equity-diagnostic.ts +73 -0
  18. package/src/api-client/types/filings-and-calls.ts +350 -0
  19. package/src/api-client/types/index.ts +25 -0
  20. package/src/api-client/types/jobs.ts +147 -0
  21. package/src/api-client/types/market.ts +122 -0
  22. package/src/api-client/types/news.ts +91 -0
  23. package/src/api-client/types/notes-and-theses.ts +172 -0
  24. package/src/api-client/types/quotes.ts +28 -0
  25. package/src/api-client/types/scanners.ts +125 -0
  26. package/src/api-client/types/screener.ts +65 -0
  27. package/src/api-client/types/search.ts +107 -0
  28. package/src/api-client/types/sync.ts +14 -0
  29. package/src/api-client/types/team-collections.ts +43 -0
  30. package/src/api-client/types/team-views.ts +32 -0
  31. package/src/api-client/types/teams.ts +135 -0
  32. package/src/api-client/types/ticker-data.ts +57 -0
  33. package/src/api-client/types/tweets.ts +59 -0
  34. package/src/api-client/types/world-venues.ts +23 -0
  35. package/src/app/pane-runtime/index.tsx +2 -0
  36. package/src/app/pane-runtime/plugin-bindings.ts +10 -1
  37. package/src/app/runtime/desktop-deeplink.ts +41 -6
  38. package/src/app/star-prompt/status-line.tsx +1 -1
  39. package/src/app.tsx +64 -23
  40. package/src/architecture/ui-tokens-allowlist.json +0 -8
  41. package/src/cli/commands/market.ts +149 -10
  42. package/src/cli/commands/search.ts +21 -3
  43. package/src/cli/commands/ticker.ts +90 -36
  44. package/src/cli/desktop-pane-shot-browser.ts +69 -3
  45. package/src/cli/glossary.ts +3 -3
  46. package/src/cli/known-gaps.ts +8 -0
  47. package/src/cli/listing-arg.ts +12 -0
  48. package/src/cli/pane-functions/capabilities.ts +2 -0
  49. package/src/cli/pane-functions/catalog.ts +25 -5
  50. package/src/cli/pane-functions/function-help.ts +8 -5
  51. package/src/cli/pane-functions/headless.ts +4 -3
  52. package/src/cli/pane-functions/resolver.ts +75 -2
  53. package/src/cli/quote-answer.ts +9 -0
  54. package/src/cli/symbol-list.ts +54 -2
  55. package/src/cli/symbol-rows.ts +14 -2
  56. package/src/cli/ticker-resolution.ts +89 -20
  57. package/src/components/chart/composite/axis-overlays.tsx +60 -27
  58. package/src/components/chart/composite/composite-chart.tsx +118 -63
  59. package/src/components/chart/composite/cursor-source.ts +111 -0
  60. package/src/components/chart/composite/format.ts +168 -6
  61. package/src/components/chart/composite/legend.tsx +8 -4
  62. package/src/components/chart/composite/panel-labels.ts +20 -1
  63. package/src/components/chart/composite/panel-surface.tsx +201 -92
  64. package/src/components/chart/composite/price-axis-labels.tsx +92 -46
  65. package/src/components/chart/composite/price-series.ts +31 -8
  66. package/src/components/chart/composite/scene.ts +154 -59
  67. package/src/components/chart/composite/series-axis-tags.tsx +4 -2
  68. package/src/components/chart/composite/time-axis.ts +13 -5
  69. package/src/components/chart/composite/time-scale.ts +211 -56
  70. package/src/components/chart/composite/types.ts +11 -1
  71. package/src/components/chart/composite/use-composite-chart-keyboard.ts +43 -14
  72. package/src/components/chart/curve/curve-surface.tsx +5 -2
  73. package/src/components/chart/curve/model.ts +4 -1
  74. package/src/components/chart/native/use-bitmap-metrics.ts +81 -0
  75. package/src/components/chart/static/series.ts +3 -0
  76. package/src/components/command-bar/commands/collection-list.ts +81 -0
  77. package/src/components/command-bar/commands/direct/index.ts +6 -0
  78. package/src/components/command-bar/commands/registry.ts +8 -0
  79. package/src/components/command-bar/layout-items/current-layout.ts +22 -1
  80. package/src/components/command-bar/layout-items/focused-pane.ts +22 -1
  81. package/src/components/command-bar/pane-templates/items.ts +19 -3
  82. package/src/components/command-bar/pane-templates/workflow.ts +5 -0
  83. package/src/components/command-bar/routes/root/results.ts +23 -3
  84. package/src/components/command-bar/routes/root/selection.ts +4 -2
  85. package/src/components/command-bar/routes/root/shortcut-feedback.ts +1 -1
  86. package/src/components/command-bar/routes/root/shortcut-items.ts +3 -4
  87. package/src/components/command-bar/routes/root/shortcuts.ts +58 -14
  88. package/src/components/command-bar/routes/root/ticker-first.ts +32 -0
  89. package/src/components/command-bar/surface/environment.ts +2 -0
  90. package/src/components/command-bar/view-model.ts +7 -0
  91. package/src/components/command-bar/workflow/ops.ts +2 -1
  92. package/src/components/command-bar/workflow/tickers.ts +20 -0
  93. package/src/components/data-table/export.ts +4 -1
  94. package/src/components/layout/detached-pane-shell.tsx +10 -37
  95. package/src/components/layout/double-escape-close.ts +90 -0
  96. package/src/components/layout/header.tsx +3 -2
  97. package/src/components/layout/market-summary.ts +6 -3
  98. package/src/components/layout/pane/footer/index.tsx +2 -6
  99. package/src/components/layout/pane/footer/model.ts +6 -12
  100. package/src/components/layout/shell/active-drag.ts +53 -11
  101. package/src/components/layout/shell/drag/magnets.ts +128 -19
  102. package/src/components/layout/shell/menu.ts +15 -1
  103. package/src/components/layout/shell/pane/actions.ts +10 -2
  104. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
  105. package/src/components/layout/shell/ticker-link-menu.ts +12 -3
  106. package/src/components/layout/status-bar.tsx +24 -78
  107. package/src/components/layout/status-widget-space.ts +5 -5
  108. package/src/components/onboarding/onboarding-keyboard.ts +5 -1
  109. package/src/components/onboarding/onboarding-wizard.tsx +15 -4
  110. package/src/components/onboarding/portfolio-step/positions-panel.tsx +9 -6
  111. package/src/components/onboarding/use-onboarding-progress.ts +20 -1
  112. package/src/components/price-sparkline/view.tsx +14 -6
  113. package/src/components/ticker/badge/index.tsx +8 -4
  114. package/src/components/ticker/badge/list.tsx +23 -7
  115. package/src/components/ui/column-grid.tsx +8 -2
  116. package/src/components/ui/data-table/index.tsx +5 -1
  117. package/src/components/ui/data-table/opentui/model.ts +4 -1
  118. package/src/components/ui/data-table/render-cell.ts +19 -0
  119. package/src/components/ui/delayed-mark.tsx +59 -7
  120. package/src/components/ui/icon.tsx +1 -8
  121. package/src/components/ui/menu.tsx +6 -1
  122. package/src/components/ui/tabs.tsx +5 -2
  123. package/src/core/state/app/layout.ts +18 -3
  124. package/src/core/state/app/state.ts +2 -0
  125. package/src/core/state/app/types.ts +5 -0
  126. package/src/data/config/layout.ts +3 -0
  127. package/src/data/config/store/normalize.ts +39 -4
  128. package/src/i18n/es.ts +13 -3
  129. package/src/i18n/ja.ts +13 -3
  130. package/src/i18n/ko.ts +13 -3
  131. package/src/i18n/zh-cn.ts +13 -3
  132. package/src/i18n/zh-tw.ts +13 -3
  133. package/src/layout/pane-manager/floating-placement.ts +7 -4
  134. package/src/layout/pane-manager/floating.ts +5 -2
  135. package/src/market-data/bond-funds.ts +19 -0
  136. package/src/market-data/futures-contract.ts +14 -3
  137. package/src/market-data/market/freshness.ts +18 -0
  138. package/src/market-data/market/status.ts +15 -2
  139. package/src/plugins/builtin/bond-calculator/headless.ts +2 -1
  140. package/src/plugins/builtin/bond-calculator/index.tsx +1 -1
  141. package/src/plugins/builtin/bond-calculator/model.ts +14 -5
  142. package/src/plugins/builtin/bond-calculator/pane.tsx +1 -1
  143. package/src/plugins/builtin/buildout/cells.tsx +25 -45
  144. package/src/plugins/builtin/buildout/detail/company.tsx +3 -3
  145. package/src/plugins/builtin/buildout/detail/index.tsx +1 -1
  146. package/src/plugins/builtin/buildout/detail/intel.tsx +4 -7
  147. package/src/plugins/builtin/buildout/detail/site.tsx +4 -4
  148. package/src/plugins/builtin/buildout/detail/ui.tsx +39 -38
  149. package/src/plugins/builtin/buildout/format.ts +23 -1
  150. package/src/plugins/builtin/buildout/model/types.ts +1 -0
  151. package/src/plugins/builtin/buildout/pane/index.tsx +2 -8
  152. package/src/plugins/builtin/buildout/table-model.ts +12 -4
  153. package/src/plugins/builtin/cds/headless.ts +1 -0
  154. package/src/plugins/builtin/cds/index.tsx +1 -1
  155. package/src/plugins/builtin/chat/content/composer.tsx +21 -27
  156. package/src/plugins/builtin/chat/content/index.tsx +31 -3
  157. package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
  158. package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
  159. package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
  160. package/src/plugins/builtin/cloud/plugin.tsx +2 -0
  161. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
  162. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +44 -12
  163. package/src/plugins/builtin/congress-trades/model.ts +2 -1
  164. package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
  165. package/src/plugins/builtin/correlation/headless.ts +3 -2
  166. package/src/plugins/builtin/crypto-board/pane.tsx +5 -4
  167. package/src/plugins/builtin/custom-view/index.tsx +1 -1
  168. package/src/plugins/builtin/custom-view/loader.ts +85 -8
  169. package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
  170. package/src/plugins/builtin/debt-maturities/headless.ts +11 -2
  171. package/src/plugins/builtin/debt-maturities/model.ts +66 -0
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +23 -4
  173. package/src/plugins/builtin/earnings-ripple/pane.tsx +1 -1
  174. package/src/plugins/builtin/econ/calendar-model.ts +28 -6
  175. package/src/plugins/builtin/equity-screener/client.ts +1 -1
  176. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +16 -19
  177. package/src/plugins/builtin/equity-screener/headless.ts +37 -3
  178. package/src/plugins/builtin/equity-screener/ideas.ts +67 -3
  179. package/src/plugins/builtin/equity-screener/model.ts +238 -27
  180. package/src/plugins/builtin/equity-screener/pane.tsx +88 -18
  181. package/src/plugins/builtin/equity-screener/screen-check.ts +7 -4
  182. package/src/plugins/builtin/equity-screener/watchlist.ts +33 -0
  183. package/src/plugins/builtin/executives/format.ts +5 -4
  184. package/src/plugins/builtin/executives/pane.tsx +1 -1
  185. package/src/plugins/builtin/futures-curve/client.ts +19 -0
  186. package/src/plugins/builtin/futures-curve/headless.ts +52 -13
  187. package/src/plugins/builtin/futures-curve/index.tsx +1 -1
  188. package/src/plugins/builtin/futures-curve/model.ts +77 -6
  189. package/src/plugins/builtin/futures-curve/pane.tsx +19 -3
  190. package/src/plugins/builtin/help/index.tsx +55 -1
  191. package/src/plugins/builtin/insider/model.ts +30 -2
  192. package/src/plugins/builtin/jobs/model.ts +2 -2
  193. package/src/plugins/builtin/macro-day/client.ts +41 -0
  194. package/src/plugins/builtin/macro-day/headless.ts +19 -9
  195. package/src/plugins/builtin/macro-day/model.ts +3 -1
  196. package/src/plugins/builtin/market-movers/index.tsx +4 -3
  197. package/src/plugins/builtin/mna/distress/headless.ts +1 -0
  198. package/src/plugins/builtin/mna/model.ts +2 -2
  199. package/src/plugins/builtin/notes/files.ts +2 -0
  200. package/src/plugins/builtin/notes/owner.tsx +20 -1
  201. package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
  202. package/src/plugins/builtin/notes/store.ts +6 -1
  203. package/src/plugins/builtin/perps/pane.tsx +3 -1
  204. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +17 -0
  205. package/src/plugins/builtin/portfolio-list/cli/portfolio-command.ts +2 -1
  206. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +2 -1
  207. package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
  208. package/src/plugins/builtin/rate-path/headless.ts +24 -10
  209. package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
  210. package/src/plugins/builtin/research/event-model.ts +10 -3
  211. package/src/plugins/builtin/research/events-headless.ts +20 -2
  212. package/src/plugins/builtin/sec/fund-facts.ts +17 -1
  213. package/src/plugins/builtin/sec/index.tsx +1 -1
  214. package/src/plugins/builtin/series-inventory.ts +1 -0
  215. package/src/plugins/builtin/shared/earnings-report.ts +7 -2
  216. package/src/plugins/builtin/shared/members-menu.tsx +103 -38
  217. package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
  218. package/src/plugins/builtin/short-interest/headless.ts +1 -1
  219. package/src/plugins/builtin/short-interest/model.ts +15 -6
  220. package/src/plugins/builtin/short-interest/publications-model.ts +22 -1
  221. package/src/plugins/builtin/short-interest/publications-pane.tsx +13 -4
  222. package/src/plugins/builtin/short-interest/types.ts +2 -0
  223. package/src/plugins/builtin/short-interest/watch-model.ts +1 -1
  224. package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
  225. package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
  226. package/src/plugins/builtin/ticker-detail/overview/model.ts +5 -3
  227. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
  228. package/src/plugins/builtin/time-sales/pane.tsx +3 -2
  229. package/src/plugins/builtin/trace-bonds/client.ts +7 -4
  230. package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
  231. package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
  232. package/src/plugins/builtin/trace-bonds/history.ts +155 -0
  233. package/src/plugins/builtin/trace-bonds/index.tsx +1 -1
  234. package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
  235. package/src/plugins/builtin/volatility/client.ts +6 -1
  236. package/src/plugins/builtin/volatility/headless.ts +0 -1
  237. package/src/plugins/builtin/yield-curve/curves.ts +15 -0
  238. package/src/plugins/builtin/yield-curve/headless.ts +6 -1
  239. package/src/plugins/builtin/yield-curve/index.tsx +5 -8
  240. package/src/plugins/host-modules.ts +22 -3
  241. package/src/plugins/host-smoke.ts +6 -3
  242. package/src/plugins/installer.ts +16 -3
  243. package/src/plugins/plugin-names.ts +11 -2
  244. package/src/portfolio/collection-name.ts +19 -0
  245. package/src/remote/controller.ts +9 -2
  246. package/src/remote/schema.ts +2 -1
  247. package/src/renderers/browser/http-proxy-transport.ts +78 -8
  248. package/src/renderers/cloudflare/http-proxy.ts +73 -3
  249. package/src/renderers/cloudflare/proxy-session.ts +47 -24
  250. package/src/renderers/cloudflare/worker.ts +44 -4
  251. package/src/renderers/desktop/geometry.ts +279 -0
  252. package/src/renderers/desktop/screen-setup.ts +246 -0
  253. package/src/renderers/desktop/sequential-window-host.ts +179 -0
  254. package/src/renderers/desktop/test-utils.ts +71 -0
  255. package/src/renderers/desktop/window-controller.ts +433 -0
  256. package/src/renderers/desktop/window-host.ts +70 -0
  257. package/src/renderers/desktop/window-layouts.ts +630 -0
  258. package/src/renderers/dom/data-frames.ts +15 -4
  259. package/src/renderers/dom/desktop/icons.tsx +0 -2
  260. package/src/renderers/dom/styles.css +0 -3
  261. package/src/renderers/electrobun/bun/application-menu/click.ts +1 -0
  262. package/src/renderers/electrobun/bun/application-menu/index.ts +4 -1
  263. package/src/renderers/electrobun/bun/desktop/backend-requests.ts +19 -8
  264. package/src/renderers/electrobun/bun/desktop/backend.ts +320 -19
  265. package/src/renderers/electrobun/bun/desktop/detached-windows.ts +83 -61
  266. package/src/renderers/electrobun/bun/desktop/host-requests.ts +4 -14
  267. package/src/renderers/electrobun/bun/desktop/initialization.ts +30 -11
  268. package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
  269. package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
  270. package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
  271. package/src/renderers/electrobun/bun/desktop/screen-setup-file.ts +55 -0
  272. package/src/renderers/electrobun/bun/desktop/state-broadcaster.ts +44 -8
  273. package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
  274. package/src/renderers/electrobun/bun/desktop/workspace/index.ts +298 -97
  275. package/src/renderers/electrobun/bun/desktop/workspace/requests.ts +44 -6
  276. package/src/renderers/electrobun/bun/index.ts +22 -109
  277. package/src/renderers/electrobun/bun/window/create.ts +23 -3
  278. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +306 -0
  279. package/src/renderers/electrobun/bun/window/events.ts +4 -4
  280. package/src/renderers/electrobun/bun/window/focus.ts +0 -25
  281. package/src/renderers/electrobun/bun/window/frame.ts +2 -1
  282. package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
  283. package/src/renderers/electrobun/bun/window/remembered-frame.ts +4 -82
  284. package/src/renderers/electrobun/shared/protocol.ts +44 -2
  285. package/src/renderers/electrobun/view/backend-rpc.ts +16 -1
  286. package/src/renderers/electrobun/view/desktop/window/bridge.ts +63 -3
  287. package/src/renderers/electrobun/view/main.tsx +13 -7
  288. package/src/series/fred-argument.ts +17 -0
  289. package/src/sources/gloomberb-cloud/index.ts +5 -7
  290. package/src/sources/provider-router/batches.ts +18 -3
  291. package/src/sources/provider-router/financial-routes.ts +7 -1
  292. package/src/sources/provider-router/financials.ts +18 -4
  293. package/src/state/app/context/index.tsx +16 -2
  294. package/src/state/desktop-windows.ts +63 -0
  295. package/src/sync/other-window-tabs.ts +62 -0
  296. package/src/tickers/company-name-listing.ts +23 -3
  297. package/src/tickers/listing-fate.ts +147 -1
  298. package/src/tickers/terminal-codes.ts +5 -0
  299. package/src/time-series/types.ts +6 -0
  300. package/src/types/config.ts +10 -1
  301. package/src/types/data-provider.ts +14 -0
  302. package/src/types/desktop-window.ts +71 -2
  303. package/src/types/financials.ts +19 -3
  304. package/src/types/headless.ts +21 -0
  305. package/src/types/plugin.ts +6 -0
  306. package/src/ui/index.tsx +14 -13
  307. package/src/ui/same-props.ts +58 -0
  308. package/src/utils/cli-output.ts +33 -4
  309. package/src/utils/double-escape-close.ts +38 -16
  310. package/src/utils/format.ts +30 -5
  311. package/src/utils/futures-generic.ts +12 -0
  312. package/src/utils/http-proxy-upstream.ts +6 -2
  313. package/src/utils/plugin-proxy-hosts.json +0 -4
  314. package/src/utils/plugin-proxy-hosts.ts +22 -0
  315. package/src/utils/price-earnings.ts +18 -0
  316. package/src/utils/sec-filings.ts +7 -1
  317. package/patches/electrobun@1.18.1.patch +0 -633
  318. package/src/api-client/types.ts +0 -2441
@@ -122,7 +122,7 @@ export function BondCalculatorPane({ focused, width, height }: PaneProps) {
122
122
  [{ label: "Clean price", value: fixed(result.analytics.cleanPrice) }, { label: "Yield", value: `${fixed(result.analytics.yieldPercent)}%` }],
123
123
  [{ label: "Dirty price", value: fixed(result.analytics.dirtyPrice) }, { label: "Accrued", value: fixed(result.analytics.accruedInterest) }],
124
124
  [{ label: "Macaulay", value: `${fixed(result.analytics.macaulayDuration)} yr` }, { label: "Modified", value: `${fixed(result.analytics.modifiedDuration)} yr` }],
125
- [{ label: "Convexity", value: `${fixed(result.analytics.convexity)} yr²` }, { label: "DV01 / 100", value: fixed(result.analytics.dv01, 6) }],
125
+ [{ label: "Convexity", value: `${fixed(result.analytics.convexity)} yr²` }, { label: "DV01", value: `${fixed(result.analytics.dv01, 6)} per 100 face` }],
126
126
  ] : [];
127
127
  return <Box flexDirection="column" width={width} height={height}>
128
128
  {tabStrip}
@@ -1,11 +1,12 @@
1
1
  import { TextAttributes } from "../../../ui";
2
- import { TickerBadgeList, type DataTableCell } from "../../../components";
2
+ import type { DataTableCell } from "../../../components";
3
3
  import { colors } from "../../../theme/colors";
4
4
  import { formatRelativeTime } from "../../../utils/datetime-format";
5
5
  import {
6
- CompanyCell,
7
6
  FavoriteCell,
7
+ ListingBadges,
8
8
  } from "./detail";
9
+ import type { DatasetTicker } from "./detail/ui";
9
10
  import type { BuildoutColumn, BuildoutRow } from "./model/types";
10
11
  import {
11
12
  activityColor,
@@ -26,6 +27,19 @@ function moneyCell(value: string | null | undefined, color: string): DataTableCe
26
27
  return { text: moneyText(value), ...(amount == null ? {} : { value: amount }), color };
27
28
  }
28
29
 
30
+ /**
31
+ * The dataset's tickers in one cell: a chip for each the app can open, bold
32
+ * plain text for one it cannot read, and the same for every row of the column.
33
+ */
34
+ function tickerCell(tickers: readonly DatasetTicker[], width: number, selected: boolean): DataTableCell | null {
35
+ const symbols = tickers.flatMap((entry) => tickerSymbol(entry.ticker) ?? []);
36
+ if (symbols.length === 0) return null;
37
+ return {
38
+ text: symbols.join(" "),
39
+ content: <ListingBadges tickers={tickers} width={width} fallbackColor={selected ? colors.selectedText : colors.textBright} />,
40
+ };
41
+ }
42
+
29
43
  interface BuildoutCellContext {
30
44
  favoriteBusyKey: string | null;
31
45
  /** The row's last star did not take. */
@@ -78,17 +92,10 @@ export function renderBuildoutCell(
78
92
  ),
79
93
  };
80
94
  }
95
+ case "ticker":
96
+ return tickerCell([company], column.width, rowState.selected) ?? { text: "", value: null };
81
97
  case "company":
82
- return {
83
- text: company.ticker ? `${company.ticker} ${company.name}` : company.name,
84
- content: (
85
- <CompanyCell
86
- company={company}
87
- width={column.width}
88
- selected={rowState.selected}
89
- />
90
- ),
91
- };
98
+ return { text: company.name, color: colors.text };
92
99
  case "description":
93
100
  return { text: text(company.description), color: colors.textDim };
94
101
  case "sectorTech":
@@ -147,22 +154,9 @@ export function renderBuildoutCell(
147
154
  return { text: site.name, color: colors.text };
148
155
  case "type":
149
156
  return { text: text(site.type), color: colors.textDim };
150
- case "owner": {
151
- const ownerTicker = tickerSymbol(site.ownerTicker);
152
- if (ownerTicker) {
153
- return {
154
- text: ownerTicker,
155
- content: (
156
- <TickerBadgeList
157
- symbols={[ownerTicker]}
158
- width={column.width}
159
- fallbackColor={rowState.selected ? colors.selectedText : colors.textBright}
160
- />
161
- ),
162
- };
163
- }
164
- return { text: text(site.ownerName), color: colors.textDim };
165
- }
157
+ case "owner":
158
+ return tickerCell([{ ticker: site.ownerTicker }], column.width, rowState.selected)
159
+ ?? { text: text(site.ownerName), color: colors.textDim };
166
160
  case "location":
167
161
  return { text: text(location), color: colors.textDim };
168
162
  case "park":
@@ -185,23 +179,9 @@ export function renderBuildoutCell(
185
179
  switch (column.id) {
186
180
  case "time":
187
181
  return { text: formatRelativeTime(update.publishedAt), color: colors.textDim };
188
- case "companies": {
189
- const symbols = (update.companies ?? [])
190
- .map((company) => tickerSymbol(company.ticker))
191
- .filter((symbol): symbol is string => symbol != null);
192
- return symbols.length > 0
193
- ? {
194
- text: symbols.join(" "),
195
- content: (
196
- <TickerBadgeList
197
- symbols={symbols}
198
- width={column.width}
199
- fallbackColor={rowState.selected ? colors.selectedText : colors.textBright}
200
- />
201
- ),
202
- }
203
- : { text: text(update.companies?.map((company) => company.name).filter(Boolean).join(", ")), color: colors.textDim };
204
- }
182
+ case "companies":
183
+ return tickerCell(update.companies ?? [], column.width, rowState.selected)
184
+ ?? { text: text(update.companies?.map((company) => company.name).filter(Boolean).join(", ")), color: colors.textDim };
205
185
  case "headline":
206
186
  return { text: update.headline, color: colors.text };
207
187
  }
@@ -1,4 +1,4 @@
1
- import { Section, TickerBadgeList } from "../../../../components";
1
+ import { Section } from "../../../../components";
2
2
  import { ClippedText } from "../../../../components/ui/display";
3
3
  import { formatMarketPriceWithCurrency, liveQuoteFormatOptions } from "../../../../market-data/market/format";
4
4
  import { useInlineTickerQuote } from "../../../../state/hooks/inline-tickers";
@@ -11,7 +11,7 @@ import { formatCompact } from "../../../../utils/format";
11
11
  import { truncateWithEllipsis } from "../../../../utils/text-wrap";
12
12
  import { activityLabel, criticalityColor, dateShort, metricColor, metricNumber, textOrNull, tickerSymbol } from "../format";
13
13
  import type { BuildoutCompany } from "../model/types";
14
- import { DetailListLine, DetailSpecGrid, MarkdownBlock, RelatedCompaniesLine, type DetailSpec, type InlineTickerCatalog } from "./ui";
14
+ import { DetailListLine, DetailSpecGrid, ListingBadges, MarkdownBlock, RelatedCompaniesLine, type DetailSpec, type InlineTickerCatalog } from "./ui";
15
15
  import { dateCell, detailListValues, recommendationColor, valueWithOriginal } from "./values";
16
16
  import { regularSessionValuationPrice } from "../../../../market-data/quotes/regular-session-valuation";
17
17
 
@@ -116,7 +116,7 @@ export function CompanyDetail({
116
116
  <>
117
117
  {company.ticker ? (
118
118
  <Box flexDirection="row" height={1}>
119
- <TickerBadgeList symbols={[company.ticker]} width={Math.min(bodyWidth, 16)} />
119
+ <ListingBadges tickers={[company]} width={Math.min(bodyWidth, 16)} />
120
120
  </Box>
121
121
  ) : null}
122
122
  <CompanyOverviewGrid
@@ -7,8 +7,8 @@ import { SiteDetail } from "./site";
7
7
  import { IntelDetail } from "./intel";
8
8
 
9
9
  export {
10
- CompanyCell,
11
10
  FavoriteCell,
11
+ ListingBadges,
12
12
  } from "./ui";
13
13
 
14
14
  export function BuildoutDetail({
@@ -1,10 +1,10 @@
1
- import { Badge, TickerBadgeList } from "../../../../components";
1
+ import { Badge } from "../../../../components";
2
2
  import { RemoteImage } from "../../../../components/ui";
3
3
  import { colors } from "../../../../theme/colors";
4
4
  import { Box, Text } from "../../../../ui";
5
- import { dateDetail, intelSourceDomains, tickerSymbol } from "../format";
5
+ import { dateDetail, intelSourceDomains } from "../format";
6
6
  import type { BuildoutRow } from "../model/types";
7
- import { InlineSources, MarkdownBlock, type InlineTickerCatalog } from "./ui";
7
+ import { InlineSources, ListingBadges, MarkdownBlock, type InlineTickerCatalog } from "./ui";
8
8
 
9
9
  type BuildoutIntel = Extract<BuildoutRow, { kind: "intel" }>["item"];
10
10
 
@@ -29,10 +29,7 @@ export function IntelDetail({
29
29
  </Box>
30
30
  {(item.companies?.length ?? 0) > 0 && (
31
31
  <Box marginTop={1} height={1}>
32
- <TickerBadgeList
33
- symbols={item.companies!.map((company) => tickerSymbol(company.ticker) ?? "")}
34
- width={Math.min(bodyWidth, 56)}
35
- />
32
+ <ListingBadges tickers={item.companies!} width={Math.min(bodyWidth, 56)} />
36
33
  </Box>
37
34
  )}
38
35
  {item.imageUrl ? (
@@ -1,11 +1,11 @@
1
- import { Section, TickerBadgeList } from "../../../../components";
1
+ import { Section } from "../../../../components";
2
2
  import { colors } from "../../../../theme/colors";
3
3
  import { Box, Text } from "../../../../ui";
4
4
  import { truncateWithEllipsis } from "../../../../utils/text-wrap";
5
5
  import { activityColor, activityLabel, dateShort, sourceDomains } from "../format";
6
6
  import type { BuildoutSite } from "../model/types";
7
7
  import { SiteSatelliteImages } from "./satellite-images";
8
- import { DetailSpecGrid, InlineSources, MarkdownBlock, SourceDetailLines, type InlineTickerCatalog } from "./ui";
8
+ import { DetailSpecGrid, InlineSources, ListingBadges, MarkdownBlock, SourceDetailLines, type InlineTickerCatalog } from "./ui";
9
9
  import { booleanText, dateCell, metadataSpecs, reportSectionText } from "./values";
10
10
 
11
11
  export function SiteDetail({
@@ -28,7 +28,7 @@ export function SiteDetail({
28
28
  <>
29
29
  {site.ownerTicker ? (
30
30
  <Box flexDirection="row" height={1}>
31
- <TickerBadgeList symbols={[site.ownerTicker]} width={Math.min(bodyWidth, 16)} />
31
+ <ListingBadges tickers={[{ ticker: site.ownerTicker }]} width={Math.min(bodyWidth, 16)} />
32
32
  </Box>
33
33
  ) : null}
34
34
  <DetailSpecGrid
@@ -99,7 +99,7 @@ export function SiteDetail({
99
99
  <Box key={`${builder.companyName}-${index}`} flexDirection="column" marginTop={index === 0 ? 0 : 1}>
100
100
  <Box flexDirection="row" height={1}>
101
101
  {builder.companyTicker
102
- ? <TickerBadgeList symbols={[builder.companyTicker]} width={Math.min(12, bodyWidth)} />
102
+ ? <ListingBadges tickers={[{ ticker: builder.companyTicker }]} width={Math.min(12, bodyWidth)} />
103
103
  : null}
104
104
  <Text fg={colors.textMuted}>
105
105
  {truncateWithEllipsis(`${builder.companyName ?? "Company"}${builder.role ? ` - ${builder.role}` : ""}`, Math.max(0, bodyWidth - (builder.companyTicker ? 12 : 0)))}
@@ -1,3 +1,4 @@
1
+ import { useMemo } from "react";
1
2
  import { TickerBadgeList } from "../../../../components";
2
3
  import { MarkdownText } from "../../../../components/markdown-text";
3
4
  import { Button } from "../../../../components/ui/button";
@@ -7,8 +8,8 @@ import type { InlineTickerCatalogEntry } from "../../../../state/hooks/inline-ti
7
8
  import { colors } from "../../../../theme/colors";
8
9
  import { Box, Text, TextAttributes } from "../../../../ui";
9
10
  import { truncateWithEllipsis } from "../../../../utils/text-wrap";
10
- import { sourceDetailEntries, text, textOrNull, tickerSymbol } from "../format";
11
- import type { BuildoutCompany, BuildoutRelatedCompany, BuildoutSource } from "../model/types";
11
+ import { listingKey, sourceDetailEntries, text, textOrNull, tickerSymbol } from "../format";
12
+ import type { BuildoutRelatedCompany, BuildoutSource } from "../model/types";
12
13
 
13
14
  export type InlineTickerCatalog = Record<string, InlineTickerCatalogEntry>;
14
15
 
@@ -80,6 +81,38 @@ export function DetailListLine({
80
81
  );
81
82
  }
82
83
 
84
+ /** A ticker as the dataset writes it, with the venue it names when it names one. */
85
+ export interface DatasetTicker {
86
+ ticker?: string | null;
87
+ exchange?: string | null;
88
+ }
89
+
90
+ /**
91
+ * The dataset's tickers, drawn one way: a chip for each the app can look up,
92
+ * price and open, a number-only Asian listing through the venue the dataset
93
+ * names, and bold plain text for one it cannot read. Never a chip that skips
94
+ * the lookup and so looks different from the resolved ones.
95
+ */
96
+ export function ListingBadges({ tickers, width, fallbackColor = colors.textBright }: {
97
+ tickers: readonly DatasetTicker[];
98
+ width: number;
99
+ fallbackColor?: string;
100
+ }) {
101
+ const { symbols, listings } = useMemo(() => {
102
+ const shown: string[] = [];
103
+ const known: Record<string, string | null> = {};
104
+ for (const entry of tickers) {
105
+ const symbol = tickerSymbol(entry.ticker);
106
+ if (!symbol) continue;
107
+ shown.push(symbol);
108
+ const key = listingKey(entry.ticker, entry.exchange);
109
+ if (key !== symbol) known[symbol] = key;
110
+ }
111
+ return { symbols: shown, listings: known };
112
+ }, [tickers]);
113
+ return <TickerBadgeList symbols={symbols} width={width} fallbackColor={fallbackColor} listings={listings} />;
114
+ }
115
+
83
116
  export function RelatedCompaniesLine({
84
117
  label,
85
118
  companies,
@@ -93,25 +126,19 @@ export function RelatedCompaniesLine({
93
126
  if (items.length === 0) return null;
94
127
 
95
128
  const visible = items.slice(0, 8);
96
- const symbols = visible
97
- .map((company) => tickerSymbol(company.ticker))
98
- .filter((symbol): symbol is string => symbol != null);
129
+ const withTicker = visible.filter((company) => tickerSymbol(company.ticker) != null);
99
130
  const names = visible
100
131
  .filter((company) => !tickerSymbol(company.ticker))
101
132
  .map((company) => textOrNull(company.name))
102
133
  .filter((name): name is string => name != null);
103
134
  const overflow = items.length > visible.length ? ` +${items.length - visible.length}` : "";
104
135
  const prefix = `${label}: `;
105
- const badgeWidth = Math.min(Math.max(0, width - prefix.length - (names.length > 0 ? 1 : 0)), Math.max(0, symbols.length * 9));
136
+ const badgeWidth = Math.min(Math.max(0, width - prefix.length - (names.length > 0 ? 1 : 0)), Math.max(0, withTicker.length * 9));
106
137
  return (
107
138
  <Box flexDirection="row" width={width} height={1} overflow="hidden">
108
139
  <Text fg={colors.textMuted}>{prefix}</Text>
109
- {symbols.length > 0 ? (
110
- <TickerBadgeList
111
- symbols={symbols}
112
- width={badgeWidth}
113
- fallbackColor={colors.textBright}
114
- />
140
+ {withTicker.length > 0 ? (
141
+ <ListingBadges tickers={withTicker} width={badgeWidth} />
115
142
  ) : null}
116
143
  <ClippedText fg={colors.textDim} text={`${names.length > 0 ? names.join(", ") : ""}${overflow}`} width={Math.max(0, width - prefix.length - badgeWidth)} cut={truncateWithEllipsis} />
117
144
  </Box>
@@ -207,29 +234,3 @@ export function FavoriteCell({
207
234
  >{failed && !busy ? <Text fg={colors.negative} attributes={TextAttributes.BOLD}>!</Text> : undefined}</Button>
208
235
  );
209
236
  }
210
-
211
- export function CompanyCell({
212
- company,
213
- width,
214
- selected,
215
- }: {
216
- company: BuildoutCompany;
217
- width: number;
218
- selected: boolean;
219
- }) {
220
- const symbol = tickerSymbol(company.ticker);
221
- if (!symbol) {
222
- return <ClippedText fg={selected ? colors.selectedText : colors.text} text={company.name} width={width} cut={truncateWithEllipsis} />;
223
- }
224
- const badgeWidth = Math.min(11, width);
225
- return (
226
- <Box flexDirection="row" width={width} height={1} overflow="hidden">
227
- <TickerBadgeList
228
- symbols={[symbol]}
229
- width={badgeWidth}
230
- fallbackColor={selected ? colors.selectedText : colors.textBright}
231
- />
232
- <ClippedText fg={selected ? colors.selectedText : colors.text} text={company.name} width={Math.max(0, width - badgeWidth)} cut={truncateWithEllipsis} />
233
- </Box>
234
- );
235
- }
@@ -1,4 +1,6 @@
1
1
  import { colors, priceColor } from "../../../theme/colors";
2
+ import { collectUniqueTickerSymbols } from "../../../tickers/tokenizer";
3
+ import { isKnownExchangeCode } from "../../../utils/exchanges";
2
4
  import { formatDetailDate as sharedFormatDetailDate, parseDisplayDate } from "../../../utils/datetime-format";
3
5
  import type { BuildoutSource, BuildoutUpdate } from "./model/types";
4
6
 
@@ -141,9 +143,29 @@ export function tickerSymbol(value: string | null | undefined): string | null {
141
143
  return symbol ? symbol.toUpperCase() : null;
142
144
  }
143
145
 
146
+ /**
147
+ * The key the app looks a dataset ticker up and opens it by. A name-led
148
+ * symbol (NVDA, BRK.B) is its own. The dataset writes some Asian listings by
149
+ * number alone (2330, 005930), which a cashtag reads as money, so one takes
150
+ * the venue the dataset names (2330:TWSE, 005930:KRX). Null when the dataset
151
+ * names no venue the app knows: such a ticker is plain text, never a chip
152
+ * that looks different from the resolved ones around it.
153
+ */
154
+ export function listingKey(ticker: string | null | undefined, exchange?: string | null): string | null {
155
+ const symbol = tickerSymbol(ticker);
156
+ if (!symbol) return null;
157
+ let key: string | null = symbol;
158
+ if (!/^[A-Z]/.test(symbol)) {
159
+ const venue = tickerSymbol(exchange);
160
+ // `688795.SS` names its venue twice: the dataset's venue is the one kept.
161
+ key = venue && isKnownExchangeCode(venue) ? `${symbol.replace(/\.[A-Z]{1,4}$/, "")}:${venue}` : null;
162
+ }
163
+ return key && collectUniqueTickerSymbols([`$${key}`]).includes(key) ? key : null;
164
+ }
165
+
144
166
  export function tickerSearchText(symbols: readonly string[]) {
145
167
  return symbols
146
- .filter((symbol) => /^[A-Z]/.test(symbol))
168
+ .filter((symbol) => collectUniqueTickerSymbols([`$${symbol}`]).includes(symbol))
147
169
  .map((symbol) => `$${symbol}`)
148
170
  .join(" ");
149
171
  }
@@ -293,6 +293,7 @@ export type BuildoutColumnId =
293
293
  | "avgSectorGrowth"
294
294
  | "avgReturn1y"
295
295
  | "avgMargin"
296
+ | "ticker"
296
297
  | "company"
297
298
  | "description"
298
299
  | "sectorTech"
@@ -55,7 +55,7 @@ import {
55
55
  tabs,
56
56
  type BuildoutOpenTarget,
57
57
  } from "../table-model";
58
- import { tickerSearchText, tickerSymbol } from "../format";
58
+ import { listingKey, tickerSearchText, tickerSymbol } from "../format";
59
59
  import {
60
60
  activeBuildoutPage,
61
61
  renderBuildoutPageStatus,
@@ -70,12 +70,6 @@ const BUILDOUT_UPGRADE_URL = "https://thebuildout.ai/pricing";
70
70
  /** How long the cursor rests on a company before linked panes follow it. */
71
71
  const CURSOR_PUBLISH_MS = 150;
72
72
 
73
- /** A symbol the rest of the app can open: the dataset writes some Asian listings by number alone. */
74
- function linkableTicker(value: string | null | undefined): string | null {
75
- const symbol = tickerSymbol(value);
76
- return symbol && /^[A-Z][A-Z0-9.-]*$/.test(symbol) ? symbol : null;
77
- }
78
-
79
73
  function sameScope(left: GeoScope | null, right: GeoScope | null): boolean {
80
74
  return left?.key === right?.key && left?.label === right?.label;
81
75
  }
@@ -193,7 +187,7 @@ export function BuildoutPane({ focused, width, height }: PaneProps) {
193
187
  // Panes linked to this one follow the company under the cursor, and a linked map can widen to the
194
188
  // theme it belongs to. Off the company tabs both stay where they were.
195
189
  const cursorCompany = detailRow?.kind === "company" ? detailRow.item : selectedRow?.kind === "company" ? selectedRow.item : null;
196
- const cursorTicker = linkableTicker(cursorCompany?.ticker);
190
+ const cursorTicker = cursorCompany ? listingKey(cursorCompany.ticker, cursorCompany.exchange) : null;
197
191
  // Published once the cursor rests: arrowing down a theme would otherwise load every company it passes.
198
192
  useEffect(() => {
199
193
  if (!cursorTicker) return;
@@ -10,7 +10,7 @@ import type {
10
10
  } from "./model/types";
11
11
  import { dropColumnsToFit } from "../../../components/ui/table-layout";
12
12
  import type { SortDirection } from "../../../utils/sort-values";
13
- import { LIST_TIER_ORDER, metricNumber, sourceDetailEntries, textOrNull, tickerSymbol } from "./format";
13
+ import { LIST_TIER_ORDER, listingKey, metricNumber, sourceDetailEntries, textOrNull, tickerSymbol } from "./format";
14
14
 
15
15
  export const tabs: Array<{ label: string; value: BuildoutTabId }> = [
16
16
  { label: "Themes", value: "themes" },
@@ -31,8 +31,12 @@ const listColumns: BuildoutColumn[] = [
31
31
 
32
32
  const favoriteColumn: BuildoutColumn = { id: "favorite", label: "", width: 2, align: "left" };
33
33
 
34
+ /** A ticker chip takes its own column, as in every ticker and name table; the name takes the spare width. */
35
+ const tickerColumn: BuildoutColumn = { id: "ticker", label: "Ticker", width: 12, align: "left" };
36
+
34
37
  const companyColumns: BuildoutColumn[] = [
35
- { id: "company", label: "Company", width: 26, align: "left", flexGrow: 2 },
38
+ tickerColumn,
39
+ { id: "company", label: "Company", width: 16, align: "left", flexGrow: 2 },
36
40
  { id: "description", label: "Description", width: 34, align: "left", flexGrow: 2 },
37
41
  { id: "sectorTech", label: "Sector & Tech", width: 26, align: "left", flexGrow: 1 },
38
42
  { id: "criticality", label: "Criticality", width: 12, align: "left" },
@@ -49,7 +53,8 @@ const companyColumns: BuildoutColumn[] = [
49
53
 
50
54
  /** A theme's companies under its board: what each does in the theme, then the figures. */
51
55
  const themeCompanyColumns: BuildoutColumn[] = [
52
- { id: "company", label: "Company", width: 26, align: "left", flexGrow: 2 },
56
+ tickerColumn,
57
+ { id: "company", label: "Company", width: 16, align: "left", flexGrow: 2 },
53
58
  { id: "listRole", label: "Role", width: 15, align: "left" },
54
59
  { id: "listTier", label: "Tier", width: 9, align: "left" },
55
60
  { id: "marketCap", label: "Mkt Cap", width: 10, align: "right" },
@@ -280,6 +285,8 @@ function sortValue(row: BuildoutRow, columnId: BuildoutColumnId): SortComparable
280
285
  switch (columnId) {
281
286
  case "favorite":
282
287
  return numberSort(company.starred ? 1 : 0);
288
+ case "ticker":
289
+ return stringSort(listingKey(company.ticker, company.exchange) ?? tickerSymbol(company.ticker));
283
290
  case "company":
284
291
  return stringSort(company.name);
285
292
  case "description":
@@ -397,7 +404,8 @@ export function defaultSortDirection(columnId: BuildoutColumnId | null): SortDir
397
404
  export function rowTickerSymbols(row: BuildoutRow): string[] {
398
405
  switch (row.kind) {
399
406
  case "company":
400
- return [tickerSymbol(row.item.ticker)].filter((symbol): symbol is string => symbol != null);
407
+ return [listingKey(row.item.ticker, row.item.exchange) ?? tickerSymbol(row.item.ticker)]
408
+ .filter((symbol): symbol is string => symbol != null);
401
409
  case "site":
402
410
  return [
403
411
  tickerSymbol(row.item.ownerTicker),
@@ -375,6 +375,7 @@ export function createCdsHeadless(
375
375
  description: "Days of a named issuer's daily 5Y levels, the report's Daily section (fn CDS F --csv --section daily).",
376
376
  },
377
377
  ],
378
+ discovery: { aliases: ["CDS", "CDSW"] },
378
379
  describe: (args) => typeof args.argument === "string" ? `CDS | ${args.argument}` : "Single-Name CDS",
379
380
  async load(args, ctx) {
380
381
  const issuer = typeof args.argument === "string" ? args.argument : null;
@@ -21,7 +21,7 @@ export const cdsModule: PluginModule = {
21
21
  label: "Single-Name CDS",
22
22
  description: "Single-name corporate CDS from DTCC public dissemination: with no argument, the issuers traded in the last 5 days with their 5Y spread and its 1W and 1M moves (in points upfront past 2,000bp), ranked by any column (fn CDS --sort 1m); with a ticker or issuer, its 5Y spread history, trades and daily levels (fn CDS F --csv --section daily exports them).",
23
23
  keywords: ["cds", "credit", "default", "swap", "spread", "single name", "issuer", "dtcc", "protection"],
24
- shortcut: { prefix: "CDS", argPlaceholder: "ticker", argKind: "ticker", argOptional: true },
24
+ shortcut: { prefix: "CDS", aliases: ["CDSW"], argPlaceholder: "ticker", argKind: "ticker", argOptional: true, focusedIssuer: true },
25
25
  headless: cdsHeadless,
26
26
  createInstance: (_context, options) => {
27
27
  const symbol = explicitSymbol(options);
@@ -1,8 +1,8 @@
1
1
  import type { ReactNode } from "react";
2
- import { Box, Text, TextAttributes, useCommandBarShortcut, type TextareaRenderable } from "../../../../ui";
2
+ import { Box, Text, TextAttributes, type TextareaRenderable } from "../../../../ui";
3
3
  import { getMessageComposerBlockHeight, MessageComposer } from "../../../../components/ui";
4
4
  import { colors } from "../../../../theme/colors";
5
- import { t, tf } from "../../../../i18n";
5
+ import { t } from "../../../../i18n";
6
6
  import { truncateToDisplayWidth } from "../../../../utils/format";
7
7
  import type { ChatMessage } from "../../../../api-client";
8
8
  import { InlineAuthActions } from "../../cloud/auth-actions";
@@ -19,6 +19,14 @@ import type { ComposerShareLink } from "../pane-links/composer";
19
19
  import type { ChatMessagePaneLink } from "../pane-links/model";
20
20
 
21
21
  const DESKTOP_CHAT_INPUT_TOP_MARGIN_PX = 6;
22
+ /**
23
+ * The line saying why the composer is closed, a blank row, then its button,
24
+ * as a wall sets them. The desktop has no pane border under the button, so a
25
+ * row below keeps it off the pane's edge.
26
+ */
27
+ function chatAuthPromptRows(nativePaneChrome: boolean | undefined): number {
28
+ return nativePaneChrome ? 4 : 3;
29
+ }
22
30
 
23
31
  interface MutableRef<T> {
24
32
  current: T;
@@ -36,7 +44,6 @@ interface ChatComposerAreaProps {
36
44
  contentWidth: number;
37
45
  focused: boolean;
38
46
  focusComposer: () => void;
39
- hasSavedSession: boolean;
40
47
  inputFocused: boolean;
41
48
  inputPlaceholder: string;
42
49
  inputRef: MutableRef<TextareaRenderable | null>;
@@ -115,7 +122,6 @@ export function ChatComposerArea({
115
122
  contentWidth,
116
123
  focused,
117
124
  focusComposer,
118
- hasSavedSession,
119
125
  inputFocused,
120
126
  inputPlaceholder,
121
127
  inputRef,
@@ -141,31 +147,19 @@ export function ChatComposerArea({
141
147
  onRemoveDraftLink,
142
148
  attachPickerRef,
143
149
  }: ChatComposerAreaProps) {
144
- const commandBarShortcut = useCommandBarShortcut();
145
150
  if (!canSend) {
146
- const fitText = (value: string) => truncateToDisplayWidth(value, contentWidth);
147
- const fitLine = (value: string) => fitText(t(value));
151
+ // Signed out the pane shows the sign-in wall instead; what reaches here is
152
+ // a saved login to finish or an address to confirm. The line and its
153
+ // button sit as a wall's do, a row apart.
148
154
  return (
149
155
  // Inset like the transcript above it, so the prompt lines up with the messages.
150
- <Box width={contentWidth + 2} paddingX={1} height={2} flexDirection="column">
151
- {!user && !hasSavedSession ? (
152
- <>
153
- <Text fg={colors.textDim}>{fitLine("Read-only chat. Log in or sign up to send.")}</Text>
154
- <InlineAuthActions />
155
- </>
156
- ) : !user ? (
157
- <>
158
- <Text fg={colors.positive}>{fitLine("Saved login found. Log in again to send.")}</Text>
159
- <InlineAuthActions showSignup={false} />
160
- </>
161
- ) : (
162
- <>
163
- <Text fg={colors.positive}>{fitLine("Verify your email to send messages.")}</Text>
164
- <Text fg={colors.textDim}>
165
- {fitText(tf("{shortcut}, then Resend Verification Email", { shortcut: commandBarShortcut }))}
166
- </Text>
167
- </>
168
- )}
156
+ <Box width={contentWidth + 2} paddingX={1} height={chatAuthPromptRows(nativePaneChrome)} flexDirection="column">
157
+ <Text fg={colors.positive}>
158
+ {truncateToDisplayWidth(user ? t("Verify your email to send messages.") : t("Saved login found. Log in again to send."), contentWidth)}
159
+ </Text>
160
+ <Box marginTop={1}>
161
+ <InlineAuthActions showSignup={false} needsVerification={!!user} />
162
+ </Box>
169
163
  </Box>
170
164
  );
171
165
  }
@@ -301,7 +295,7 @@ export function getChatComposerAreaHeight({
301
295
  /** Terminal rows the handle prompt above the composer takes. */
302
296
  promptRows?: number;
303
297
  }) {
304
- if (!canSend) return 2;
298
+ if (!canSend) return chatAuthPromptRows(nativePaneChrome);
305
299
  return promptRows + getMessageComposerBlockHeight({ height: composerHeight, nativePaneChrome })
306
300
  + (editingMessage || replyTo ? 1 : 0)
307
301
  + Math.max(0, mentionSuggestionCount ?? 0)
@@ -75,6 +75,7 @@ import {
75
75
  import { applyCommandSuggestion, detectChatCommandTrigger, filterCommandSuggestions } from "./command-suggestions";
76
76
  import { getComposerCursorOffset } from "./composer-cursor";
77
77
  import { ChatHandlePrompt, chatHandlePromptRows, handleSavedMessage, useChatHandlePrompt } from "./handle-prompt";
78
+ import { SignInWall } from "../../cloud/auth-actions";
78
79
 
79
80
  interface ChatContentProps {
80
81
  width: number;
@@ -88,7 +89,36 @@ interface ChatContentProps {
88
89
  onTargetMessageHandled?: () => void;
89
90
  }
90
91
 
91
- export function ChatContent({
92
+ /** No account and no saved login to finish: the chat shows nothing. */
93
+ function isSignedOut(snapshot: { user: unknown; hasSavedSession: boolean }): boolean {
94
+ return !snapshot.user && !snapshot.hasSavedSession;
95
+ }
96
+
97
+ /** A check the app made this recently (the status bar's, on launch) answers for the pane. */
98
+ const RECENT_SESSION_CHECK_MS = 30_000;
99
+
100
+ /**
101
+ * Chat sits behind the wall every account-gated pane shows: signed out there
102
+ * is no transcript, no channel list and nothing to read, only the wall. A
103
+ * saved login, or an account still confirming its email, reads the chat and
104
+ * is asked at the composer to finish signing in.
105
+ */
106
+ export function ChatContent(props: ChatContentProps) {
107
+ const controller = props.controller ?? chatController;
108
+ const [signedOut, setSignedOut] = useState(() => isSignedOut(controller.getSnapshot()));
109
+ useEffect(() => controller.subscribe((snapshot) => setSignedOut(isSignedOut(snapshot))), [controller]);
110
+ // Nothing behind the wall asks for the session, so a sign-in made elsewhere
111
+ // (the web app's cookie) is picked up here.
112
+ useEffect(() => {
113
+ if (isSignedOut(controller.getSnapshot())) void controller.refreshSession({ reuseCheckWithinMs: RECENT_SESSION_CHECK_MS }).catch(() => {});
114
+ }, [controller]);
115
+ if (signedOut) {
116
+ return <SignInWall placement="chat-signin" action="chat" width={props.width} height={props.height} />;
117
+ }
118
+ return <ChatConversation {...props} />;
119
+ }
120
+
121
+ function ChatConversation({
92
122
  width,
93
123
  height,
94
124
  focused,
@@ -188,7 +218,6 @@ export function ChatContent({
188
218
  conversationActivity,
189
219
  draftAttachments,
190
220
  hasOlderMessages,
191
- hasSavedSession,
192
221
  loading,
193
222
  loadingOlderMessages,
194
223
  messages,
@@ -1211,7 +1240,6 @@ export function ChatContent({
1211
1240
  contentWidth={contentWidth}
1212
1241
  focused={focused}
1213
1242
  focusComposer={focusComposer}
1214
- hasSavedSession={hasSavedSession}
1215
1243
  inputFocused={inputFocused}
1216
1244
  inputPlaceholder={inputPlaceholder}
1217
1245
  inputRef={inputRef}