@gloom-sh/terminal 0.20.10 → 0.20.12

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 (324) hide show
  1. package/package.json +2 -1
  2. package/patches/@opentui%2Fcore@0.3.2.patch +16 -0
  3. package/src/api-client/awards.ts +16 -0
  4. package/src/api-client/central-bank-rates.ts +5 -0
  5. package/src/api-client/data.ts +55 -2
  6. package/src/api-client/index.ts +18 -1
  7. package/src/api-client/request.ts +86 -3
  8. package/src/api-client/socket-connection.ts +366 -0
  9. package/src/api-client/socket-features.ts +75 -0
  10. package/src/api-client/socket-frames.ts +161 -0
  11. package/src/api-client/socket-listeners.ts +207 -0
  12. package/src/api-client/socket-quotes.ts +332 -0
  13. package/src/api-client/socket.ts +168 -983
  14. package/src/api-client/supply-chain-graph.ts +4 -2
  15. package/src/api-client/supply-chain.ts +8 -0
  16. package/src/api-client/types/econ.ts +10 -7
  17. package/src/api-client/types/filings-and-calls.ts +8 -0
  18. package/src/app/global-shortcuts.ts +2 -1
  19. package/src/app/keybindings/actions.ts +19 -0
  20. package/src/app/pane-runtime/index.tsx +18 -3
  21. package/src/app/pane-runtime/layout-placement.ts +63 -0
  22. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  23. package/src/brokers/signed-in/adapter.ts +19 -5
  24. package/src/brokers/signed-in/client.ts +13 -1
  25. package/src/brokers/signed-in/sign-in-dialog.tsx +33 -9
  26. package/src/capabilities/chart-series.ts +4 -1
  27. package/src/cli/board-coins.ts +10 -1
  28. package/src/cli/commands/crypto-hints.ts +3 -2
  29. package/src/cli/commands/fred-series.ts +0 -54
  30. package/src/cli/commands/market.ts +209 -31
  31. package/src/cli/commands/overview.ts +47 -14
  32. package/src/cli/commands/search.ts +37 -8
  33. package/src/cli/commands/ticker.ts +15 -4
  34. package/src/cli/desktop-pane-shot.ts +27 -2
  35. package/src/cli/fx-quote-rate.ts +1 -1
  36. package/src/cli/glossary.ts +14 -5
  37. package/src/cli/history-catalog-series.ts +85 -0
  38. package/src/cli/index.ts +1 -1
  39. package/src/cli/list-progress.ts +45 -0
  40. package/src/cli/listing-arg.ts +71 -7
  41. package/src/cli/name-entries.ts +8 -4
  42. package/src/cli/not-a-ticker.ts +2 -2
  43. package/src/cli/pane-functions/freshness.ts +50 -3
  44. package/src/cli/pane-functions/index.ts +7 -4
  45. package/src/cli/pane-functions/market-session.ts +66 -14
  46. package/src/cli/pane-functions/options.ts +5 -0
  47. package/src/cli/pane-functions/resolver.ts +9 -2
  48. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  49. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  50. package/src/cli/quote-answer.ts +49 -10
  51. package/src/cli/quote-list-reads.ts +87 -0
  52. package/src/cli/report-tables.ts +70 -13
  53. package/src/cli/result.ts +24 -2
  54. package/src/cli/symbol-list.ts +31 -4
  55. package/src/cli/terminal-code-hints.ts +83 -0
  56. package/src/cli/ticker-resolution.ts +2 -1
  57. package/src/cli/treasury-yields.ts +5 -0
  58. package/src/components/chart/native/kitty/manager.ts +2 -0
  59. package/src/components/chart/native/surface/manager.ts +211 -11
  60. package/src/components/command-bar/action-runtime.ts +2 -0
  61. package/src/components/command-bar/panel/index.tsx +2 -13
  62. package/src/components/command-bar/panel/layout.ts +1 -7
  63. package/src/components/command-bar/panel/runtime.ts +0 -1
  64. package/src/components/command-bar/panel/types.ts +0 -2
  65. package/src/components/command-bar/routing/launch-request.ts +2 -1
  66. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  67. package/src/components/command-bar/workflow/types.ts +6 -0
  68. package/src/components/data-table/column-menu.tsx +89 -0
  69. package/src/components/data-table/sort-menu.tsx +9 -2
  70. package/src/components/data-table/view.tsx +33 -6
  71. package/src/components/form-modal/content.tsx +10 -0
  72. package/src/components/index.ts +1 -1
  73. package/src/components/layout/detached-pane-shell.tsx +3 -0
  74. package/src/components/layout/double-escape-close.ts +34 -3
  75. package/src/components/layout/floating-pane.tsx +10 -4
  76. package/src/components/layout/pane/cycle-order.ts +66 -2
  77. package/src/components/layout/pane/footer/index.tsx +25 -11
  78. package/src/components/layout/pane/footer/model.ts +62 -20
  79. package/src/components/layout/pane/header.tsx +140 -31
  80. package/src/components/layout/pane/sidebar.tsx +138 -20
  81. package/src/components/layout/pane/status-footer.ts +3 -1
  82. package/src/components/layout/shell/active-drag.ts +18 -13
  83. package/src/components/layout/shell/drag/magnets.ts +34 -18
  84. package/src/components/layout/shell/drag/runtime.ts +5 -0
  85. package/src/components/layout/shell/index.tsx +25 -0
  86. package/src/components/layout/shell/menu.ts +9 -0
  87. package/src/components/layout/shell/pane/actions.ts +36 -0
  88. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  89. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  90. package/src/components/layout/shell/shortcuts.ts +17 -1
  91. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  92. package/src/components/layout/shell/window-mode/index.ts +5 -16
  93. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  94. package/src/components/market-board/index.tsx +14 -5
  95. package/src/components/metric-treemap/index.tsx +3 -1
  96. package/src/components/ticker/list-table-view.tsx +5 -0
  97. package/src/components/ui/button.tsx +48 -4
  98. package/src/components/ui/data-table/column-order.ts +180 -0
  99. package/src/components/ui/data-table/index.tsx +12 -1
  100. package/src/components/ui/data-table/opentui/index.tsx +291 -32
  101. package/src/components/ui/data-table/opentui/model.ts +43 -4
  102. package/src/components/ui/data-table/types.ts +56 -0
  103. package/src/components/ui/data-table/use-column-order.ts +135 -0
  104. package/src/components/ui/index.ts +1 -1
  105. package/src/components/ui/inline-quick-add.tsx +19 -3
  106. package/src/components/ui/list-view.tsx +11 -5
  107. package/src/components/ui/query-bar.tsx +16 -1
  108. package/src/components/ui/selection-fill.ts +39 -0
  109. package/src/components/ui/table-layout.ts +120 -0
  110. package/src/core/state/app/layout-reducer.ts +2 -1
  111. package/src/core/state/app/pane-choices.ts +68 -0
  112. package/src/core/state/app/state.ts +14 -6
  113. package/src/core/state/app/types.ts +8 -0
  114. package/src/docs/snapshot.json +3 -2
  115. package/src/i18n/es.ts +2 -0
  116. package/src/i18n/ja.ts +2 -0
  117. package/src/i18n/ko.ts +2 -0
  118. package/src/i18n/zh-cn.ts +2 -0
  119. package/src/i18n/zh-tw.ts +2 -0
  120. package/src/layout/pane-manager/dock-tree.ts +19 -0
  121. package/src/layout/pane-manager/index.ts +3 -0
  122. package/src/market-data/coordinator/index.ts +4 -3
  123. package/src/market-data/coordinator/quotes.ts +12 -4
  124. package/src/market-data/market/freshness.ts +33 -0
  125. package/src/market-data/market/status.ts +5 -1
  126. package/src/market-data/quotes/contributions.ts +10 -0
  127. package/src/market-data/quotes/freshness.ts +31 -0
  128. package/src/market-data/quotes/live-valuation.ts +32 -5
  129. package/src/market-data/quotes/regular-session-valuation.ts +1 -1
  130. package/src/market-data/quotes/resolution.ts +4 -0
  131. package/src/market-data/quotes/time.ts +0 -14
  132. package/src/plugins/builtin/account-management/index.tsx +1 -0
  133. package/src/plugins/builtin/awards/detail.tsx +12 -4
  134. package/src/plugins/builtin/awards/headless.ts +29 -8
  135. package/src/plugins/builtin/awards/model.ts +36 -2
  136. package/src/plugins/builtin/awards/pane.tsx +7 -4
  137. package/src/plugins/builtin/broker-manager/detail.tsx +5 -3
  138. package/src/plugins/builtin/broker-manager/index.tsx +7 -6
  139. package/src/plugins/builtin/broker-manager/model.ts +15 -6
  140. package/src/plugins/builtin/broker-manager/pane-actions.tsx +11 -4
  141. package/src/plugins/builtin/broker-manager/sign-in-end.ts +50 -19
  142. package/src/plugins/builtin/broker-manager/table.ts +10 -4
  143. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  144. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  145. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  146. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  147. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  148. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  149. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  150. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  151. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  152. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  153. package/src/plugins/builtin/chat/sidebar.tsx +35 -19
  154. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  155. package/src/plugins/builtin/cloud/askg/tool-timeline.tsx +2 -0
  156. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  157. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  158. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  159. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  160. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  161. package/src/plugins/builtin/connections/index.ts +1 -0
  162. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  163. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  164. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  165. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  166. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  167. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  168. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  169. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  170. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  171. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  172. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  173. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  174. package/src/plugins/builtin/earnings/board.tsx +15 -3
  175. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  176. package/src/plugins/builtin/earnings/client.ts +0 -9
  177. package/src/plugins/builtin/earnings/headless.ts +10 -7
  178. package/src/plugins/builtin/earnings/history.tsx +21 -14
  179. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  180. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  181. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  182. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  183. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  184. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  185. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  186. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  187. package/src/plugins/builtin/econ/index.tsx +9 -2
  188. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  189. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  190. package/src/plugins/builtin/equity-screener/live.ts +74 -18
  191. package/src/plugins/builtin/equity-screener/model.ts +19 -4
  192. package/src/plugins/builtin/equity-screener/pane.tsx +19 -14
  193. package/src/plugins/builtin/equity-screener/refresh-anchor.ts +45 -0
  194. package/src/plugins/builtin/equity-screener/results.ts +22 -2
  195. package/src/plugins/builtin/equity-screener/screen-check.ts +9 -3
  196. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  197. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  198. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  199. package/src/plugins/builtin/futures/index.tsx +15 -1
  200. package/src/plugins/builtin/futures/table.tsx +1 -1
  201. package/src/plugins/builtin/fx-matrix/index.tsx +32 -19
  202. package/src/plugins/builtin/holders/pane.tsx +30 -20
  203. package/src/plugins/builtin/insider/table.tsx +10 -7
  204. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  205. package/src/plugins/builtin/iv-history/events.ts +5 -0
  206. package/src/plugins/builtin/iv-history/headless.ts +15 -9
  207. package/src/plugins/builtin/jobs/index.tsx +1 -0
  208. package/src/plugins/builtin/kelly-sizer/sections.tsx +2 -0
  209. package/src/plugins/builtin/macro-day/headless.ts +15 -6
  210. package/src/plugins/builtin/macro-day/model.ts +1 -1
  211. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  212. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  213. package/src/plugins/builtin/market-movers/model.ts +5 -0
  214. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  215. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  216. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  217. package/src/plugins/builtin/options/view.tsx +3 -0
  218. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  219. package/src/plugins/builtin/options-scenario/pane.tsx +2 -1
  220. package/src/plugins/builtin/perps/cascade-tabs.tsx +2 -1
  221. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  222. package/src/plugins/builtin/portfolio-list/pane/index.tsx +19 -1
  223. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  224. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  225. package/src/plugins/builtin/portfolio-list/table.tsx +15 -1
  226. package/src/plugins/builtin/rate-path/pane.tsx +2 -0
  227. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  228. package/src/plugins/builtin/revenue-breakdown/pane.tsx +2 -0
  229. package/src/plugins/builtin/reverse-dcf/pane.tsx +2 -1
  230. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  231. package/src/plugins/builtin/seasonality/pane.tsx +2 -1
  232. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  233. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  234. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  235. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  236. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  237. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  238. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  239. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  240. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  241. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  242. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  243. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  244. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  245. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  246. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  247. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  248. package/src/plugins/builtin/thirteenf/pane.tsx +2 -0
  249. package/src/plugins/builtin/ticker-detail/financials/model.ts +28 -6
  250. package/src/plugins/builtin/ticker-detail/financials/ratio-table.tsx +26 -9
  251. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +58 -35
  252. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  253. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  254. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  255. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  256. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  257. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  258. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  259. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  260. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  261. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  262. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  263. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  264. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  265. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  266. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  267. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  268. package/src/plugins/builtin/vol-surface/heat-grid.tsx +6 -3
  269. package/src/plugins/builtin/vol-surface/pane.tsx +7 -3
  270. package/src/plugins/builtin/world-indices/index.tsx +5 -1
  271. package/src/plugins/builtin/yield-curve/index.tsx +2 -1
  272. package/src/plugins/runtime/index.tsx +1 -0
  273. package/src/plugins/runtime/state.ts +20 -0
  274. package/src/portfolio/column-values.ts +8 -2
  275. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  276. package/src/public/react.ts +7 -0
  277. package/src/react/auto-refresh.ts +29 -0
  278. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  279. package/src/renderers/dom/data-table/column-drag.ts +147 -0
  280. package/src/renderers/dom/data-table/index.tsx +22 -0
  281. package/src/renderers/dom/data-table/row.tsx +27 -5
  282. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  283. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  284. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  285. package/src/renderers/dom/styles.css +47 -5
  286. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  287. package/src/renderers/opentui/chart-surface.tsx +1 -0
  288. package/src/renderers/opentui/frame-hits.ts +33 -0
  289. package/src/renderers/opentui/host.tsx +2 -0
  290. package/src/renderers/opentui/native-surface.ts +14 -21
  291. package/src/renderers/opentui/test-utils.tsx +3 -0
  292. package/src/series/types.ts +2 -0
  293. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  294. package/src/sources/gloomberb-cloud/index.ts +25 -1
  295. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  296. package/src/sources/provider-errors.ts +64 -1
  297. package/src/sources/provider-router/batches.ts +19 -0
  298. package/src/sources/provider-router/index.ts +7 -1
  299. package/src/state/app/context/index.tsx +46 -1
  300. package/src/state/pane-unsent-work.ts +47 -0
  301. package/src/test-support/app-store.ts +24 -1
  302. package/src/test-support/shell-pane-keys.tsx +5 -0
  303. package/src/test-support/telemetry-guard.ts +83 -0
  304. package/src/test-support/test-env.ts +12 -0
  305. package/src/theme/colors.ts +17 -1
  306. package/src/theme/ui-tokens.ts +50 -1
  307. package/src/tickers/listing-venues.ts +11 -1
  308. package/src/tickers/search/japanese-names.json +1 -0
  309. package/src/tickers/search/japanese-names.ts +152 -0
  310. package/src/tickers/terminal-codes.ts +55 -6
  311. package/src/time-series/base-series.ts +3 -0
  312. package/src/time-series/live-quotes.ts +3 -9
  313. package/src/types/data-provider.ts +6 -0
  314. package/src/types/financials.ts +11 -0
  315. package/src/types/plugin-contributions.ts +7 -0
  316. package/src/types/plugin-panes.ts +7 -0
  317. package/src/ui/host.tsx +24 -0
  318. package/src/ui/pointer-drag.ts +11 -2
  319. package/src/utils/double-escape-close.ts +42 -0
  320. package/src/utils/fundamentals.ts +14 -3
  321. package/src/utils/fx-status.ts +30 -7
  322. package/src/utils/network-failure.ts +23 -0
  323. package/src/utils/share-multiples.cases.json +780 -2
  324. package/src/utils/share-multiples.ts +154 -24
@@ -25,6 +25,7 @@ import {
25
25
  withFocusedPane,
26
26
  } from "./layout";
27
27
  import { reduceLayoutAction } from "./layout-reducer";
28
+ import { paneStateChoiceKeys, pluginChoiceKey, withPaneChoices } from "./pane-choices";
28
29
  import type { AppAction, AppState, CollectionSortPreference, PaneRuntimeState } from "./types";
29
30
  import type { AppSessionSnapshot } from "../session-persistence";
30
31
 
@@ -287,9 +288,11 @@ export function appReducer(state: AppState, action: AppAction): AppState {
287
288
  return hydrateDesktopSnapshot(state, action.snapshot);
288
289
 
289
290
  case "UPDATE_PANE_STATE": {
291
+ // Written in this session, even with the value it holds: see pane-choices.ts.
292
+ const chosen = withPaneChoices(state, action.paneId, Object.keys(action.patch));
290
293
  const current = state.paneState[action.paneId] ?? {};
291
294
  if (Object.keys(action.patch).every((key) => Object.is(current[key], action.patch[key]))) {
292
- return state;
295
+ return chosen;
293
296
  }
294
297
  const nextState = { ...current, ...action.patch };
295
298
  const recentTickers = Object.prototype.hasOwnProperty.call(action.patch, "cursorSymbol")
@@ -300,7 +303,7 @@ export function appReducer(state: AppState, action: AppAction): AppState {
300
303
  [action.paneId]: nextState,
301
304
  };
302
305
  return {
303
- ...state,
306
+ ...chosen,
304
307
  config: syncConfigActiveLayoutState(state.config, paneState, state.focusedPaneId),
305
308
  paneState,
306
309
  recentTickers,
@@ -308,9 +311,10 @@ export function appReducer(state: AppState, action: AppAction): AppState {
308
311
  }
309
312
 
310
313
  case "REPLACE_PANE_STATE": {
314
+ const chosen = withPaneChoices(state, action.paneId, paneStateChoiceKeys(action.state));
311
315
  const current = state.paneState[action.paneId] ?? {};
312
316
  const nextState = action.state;
313
- if (Object.is(current, nextState)) return state;
317
+ if (Object.is(current, nextState)) return chosen;
314
318
  const paneState = {
315
319
  ...state.paneState,
316
320
  [action.paneId]: nextState,
@@ -319,7 +323,7 @@ export function appReducer(state: AppState, action: AppAction): AppState {
319
323
  ? nextRecentTickers(state.recentTickers, typeof nextState.cursorSymbol === "string" ? nextState.cursorSymbol : null)
320
324
  : state.recentTickers;
321
325
  return {
322
- ...state,
326
+ ...chosen,
323
327
  config: syncConfigActiveLayoutState(state.config, paneState, state.focusedPaneId),
324
328
  paneState,
325
329
  recentTickers,
@@ -327,11 +331,12 @@ export function appReducer(state: AppState, action: AppAction): AppState {
327
331
  }
328
332
 
329
333
  case "UPDATE_PLUGIN_PANE_STATE": {
334
+ const chosen = withPaneChoices(state, action.paneId, [pluginChoiceKey(action.pluginId, action.key)]);
330
335
  const current = state.paneState[action.paneId] ?? {};
331
336
  const currentPluginState = current.pluginState ?? {};
332
337
  const currentPluginValues = currentPluginState[action.pluginId] ?? {};
333
338
  if (Object.is(currentPluginValues[action.key], action.value)) {
334
- return state;
339
+ return chosen;
335
340
  }
336
341
  const paneState = {
337
342
  ...state.paneState,
@@ -347,12 +352,15 @@ export function appReducer(state: AppState, action: AppAction): AppState {
347
352
  },
348
353
  };
349
354
  return {
350
- ...state,
355
+ ...chosen,
351
356
  config: syncConfigActiveLayoutState(state.config, paneState, state.focusedPaneId),
352
357
  paneState,
353
358
  };
354
359
  }
355
360
 
361
+ case "CHOOSE_PANE_STATE":
362
+ return withPaneChoices(state, action.paneId, [action.key]);
363
+
356
364
  default:
357
365
  return state;
358
366
  }
@@ -118,6 +118,12 @@ export interface AppState {
118
118
  updateCheckInProgress: boolean;
119
119
  updateNotice: string | null;
120
120
  layoutHistory: Record<number, LayoutHistoryEntry>;
121
+ /**
122
+ * The pane-state keys set in this session, by pane id, as opposed to
123
+ * restored with the workspace (see `pane-choices.ts`). Session only: never
124
+ * saved and never sent to another window.
125
+ */
126
+ paneChoices?: Record<string, Readonly<Record<string, true>>>;
121
127
  }
122
128
 
123
129
  export type AppAction =
@@ -226,4 +232,6 @@ export type AppAction =
226
232
  value: unknown;
227
233
  }
228
234
  | { type: "REPLACE_PANE_STATE"; paneId: string; state: PaneRuntimeState }
235
+ /** The user chose this pane-state value now, even if it already holds what they chose (see `pane-choices.ts`). */
236
+ | { type: "CHOOSE_PANE_STATE"; paneId: string; key: string }
229
237
  | { type: "UPDATE_PANE_STATE"; paneId: string; patch: Partial<PaneRuntimeState> };
@@ -7382,8 +7382,9 @@
7382
7382
  "They read brokerage accounts, not team portfolios (use `collections.get`).",
7383
7383
  "An IBKR order instruction is not an order: IBKR returns a link where you review and submit it yourself.",
7384
7384
  "IBKR allows one AI connection per user, and Gloom holds it: connecting IBKR in Gloom disconnects it from other AI apps, so reach it through Gloom.",
7385
- "The IBKR sign-in ends seven days after you consent, however often it is used; only signing in again brings it back.",
7386
- "A day before, the Brokers pane shows when it ends, and Gloom emails you once."
7385
+ "The IBKR sign-in ends seven days after you consent, however often it is used; only signing in again brings it back. Signing in before it ends starts a new seven days.",
7386
+ "The Brokers pane shows when it ends. Two days before, Gloom emails you once with a link to renew. IBKR then asks to replace your existing Gloom connection: choose replace.",
7387
+ "Connecting another AI app to the same IBKR account disconnects Gloom. Connect IBKR in Gloom again to get it back."
7387
7388
  ]
7388
7389
  },
7389
7390
  {
package/src/i18n/es.ts CHANGED
@@ -1662,6 +1662,8 @@ export const es: Record<string, string> = {
1662
1662
  "Sign in to Gloom": "Inicia sesión en Gloom",
1663
1663
  "Continue in your browser or scan the code.": "Continúa en tu navegador o escanea el código.",
1664
1664
  "Other AI apps linked to {broker} get disconnected. Connect them to Gloom instead.": "Otras apps de IA vinculadas a {broker} se desconectarán. Conéctalas a Gloom en su lugar.",
1665
+ "{broker} will ask to replace your existing Gloom connection. Choose to replace it.": "{broker} te pedirá reemplazar tu conexión actual con Gloom. Elige reemplazarla.",
1666
+ "{broker} may ask to replace your existing Gloom connection. If it does, choose to replace it.": "{broker} puede pedirte reemplazar tu conexión actual con Gloom. Si lo hace, elige reemplazarla.",
1665
1667
  "Waiting for {broker}...": "Esperando a {broker}...",
1666
1668
  "Contacting Gloom...": "Contactando con Gloom...",
1667
1669
  "Something went wrong.": "Algo salió mal.",
package/src/i18n/ja.ts CHANGED
@@ -1659,6 +1659,8 @@ export const ja: Record<string, string> = {
1659
1659
  "Sign in to Gloom": "Gloom にサインイン",
1660
1660
  "Continue in your browser or scan the code.": "ブラウザーで続けるか、コードをスキャンしてください。",
1661
1661
  "Other AI apps linked to {broker} get disconnected. Connect them to Gloom instead.": "{broker} に連携している他の AI アプリは切断されます。代わりに Gloom に接続してください。",
1662
+ "{broker} will ask to replace your existing Gloom connection. Choose to replace it.": "{broker} から既存の Gloom 接続を置き換えるか確認されます。置き換えを選んでください。",
1663
+ "{broker} may ask to replace your existing Gloom connection. If it does, choose to replace it.": "{broker} から既存の Gloom 接続を置き換えるか確認される場合があります。その場合は置き換えを選んでください。",
1662
1664
  "Waiting for {broker}...": "{broker} を待っています...",
1663
1665
  "Contacting Gloom...": "Gloom に接続中...",
1664
1666
  "Something went wrong.": "問題が発生しました。",
package/src/i18n/ko.ts CHANGED
@@ -1657,6 +1657,8 @@ export const ko: Record<string, string> = {
1657
1657
  "Sign in to Gloom": "Gloom에 로그인",
1658
1658
  "Continue in your browser or scan the code.": "브라우저에서 계속하거나 코드를 스캔하세요.",
1659
1659
  "Other AI apps linked to {broker} get disconnected. Connect them to Gloom instead.": "{broker}에 연결된 다른 AI 앱은 연결이 해제됩니다. 대신 Gloom에 연결하세요.",
1660
+ "{broker} will ask to replace your existing Gloom connection. Choose to replace it.": "{broker}에서 기존 Gloom 연결을 교체할지 묻습니다. 교체를 선택하세요.",
1661
+ "{broker} may ask to replace your existing Gloom connection. If it does, choose to replace it.": "{broker}에서 기존 Gloom 연결을 교체할지 물을 수 있습니다. 그러면 교체를 선택하세요.",
1660
1662
  "Waiting for {broker}...": "{broker} 기다리는 중...",
1661
1663
  "Contacting Gloom...": "Gloom에 연결하는 중...",
1662
1664
  "Something went wrong.": "문제가 발생했습니다.",
package/src/i18n/zh-cn.ts CHANGED
@@ -1659,6 +1659,8 @@ export const zhCN: Record<string, string> = {
1659
1659
  "Sign in to Gloom": "登录 Gloom",
1660
1660
  "Continue in your browser or scan the code.": "在浏览器中继续,或扫描二维码。",
1661
1661
  "Other AI apps linked to {broker} get disconnected. Connect them to Gloom instead.": "已关联 {broker} 的其他 AI 应用会被断开。请改为将它们连接到 Gloom。",
1662
+ "{broker} will ask to replace your existing Gloom connection. Choose to replace it.": "{broker} 会询问是否替换你现有的 Gloom 连接。请选择替换。",
1663
+ "{broker} may ask to replace your existing Gloom connection. If it does, choose to replace it.": "{broker} 可能会询问是否替换你现有的 Gloom 连接。如果询问,请选择替换。",
1662
1664
  "Waiting for {broker}...": "正在等待 {broker}...",
1663
1665
  "Contacting Gloom...": "正在连接 Gloom...",
1664
1666
  "Something went wrong.": "出了点问题。",
package/src/i18n/zh-tw.ts CHANGED
@@ -1659,6 +1659,8 @@ export const zhTW: Record<string, string> = {
1659
1659
  "Sign in to Gloom": "登入 Gloom",
1660
1660
  "Continue in your browser or scan the code.": "在瀏覽器中繼續,或掃描 QR 碼。",
1661
1661
  "Other AI apps linked to {broker} get disconnected. Connect them to Gloom instead.": "已連結 {broker} 的其他 AI 應用程式會被中斷連線。請改為將它們連線到 Gloom。",
1662
+ "{broker} will ask to replace your existing Gloom connection. Choose to replace it.": "{broker} 會詢問是否取代你現有的 Gloom 連線。請選擇取代。",
1663
+ "{broker} may ask to replace your existing Gloom connection. If it does, choose to replace it.": "{broker} 可能會詢問是否取代你現有的 Gloom 連線。如果詢問,請選擇取代。",
1662
1664
  "Waiting for {broker}...": "正在等待 {broker}...",
1663
1665
  "Contacting Gloom...": "正在連線 Gloom...",
1664
1666
  "Something went wrong.": "發生錯誤。",
@@ -90,6 +90,25 @@ export function getDockedInstanceIds(node: DockLayoutNode | null): string[] {
90
90
  return collectDockLeafRefs(node).map((entry) => entry.instanceId);
91
91
  }
92
92
 
93
+ /** The docked panes behind the tab their stack shows. */
94
+ export function hiddenDockTabIds(layout: LayoutConfig): Set<string> {
95
+ const hidden = new Set<string>();
96
+ for (const leaf of collectDockLeafRefs(layout.dockRoot)) {
97
+ if (!leaf.stackPath) continue;
98
+ const stack = getNodeAtPath(layout.dockRoot, leaf.stackPath);
99
+ if (stack && dockStackShown(stack) !== leaf.instanceId) hidden.add(leaf.instanceId);
100
+ }
101
+ return hidden;
102
+ }
103
+
104
+ /** The tabs of the dock stack `instanceId` is in, in tab order; empty when it is not in one. */
105
+ export function dockStackTabIds(layout: LayoutConfig, instanceId: string): string[] {
106
+ const leaf = findDockLeaf(layout, instanceId);
107
+ if (!leaf?.stackPath) return [];
108
+ const stack = getNodeAtPath(layout.dockRoot, leaf.stackPath);
109
+ return stack && isDockStack(stack) ? getDockedInstanceIds(stack) : [];
110
+ }
111
+
93
112
  export function getRepresentativeLeafId(node: DockLayoutNode, preferStart: boolean): string {
94
113
  if (node.kind === "pane") return node.instanceId;
95
114
  if (isDockStack(node)) return dockStackShown(node);
@@ -8,17 +8,20 @@ export {
8
8
  } from "./floating";
9
9
 
10
10
  export {
11
+ dockStackTabIds,
11
12
  findDockLeaf,
12
13
  getDockDividerLayouts,
13
14
  getDockedPaneIds,
14
15
  getDockLeafLayouts,
15
16
  getDockResizeTargets,
16
17
  getDockSplitGeometry,
18
+ hiddenDockTabIds,
17
19
  showDockTab,
18
20
  type DockDividerLayout,
19
21
  type DockGeometryOptions,
20
22
  type DockLeafLayout,
21
23
  type DockResizeTarget,
24
+ type DockTarget,
22
25
  type LayoutBounds,
23
26
  } from "./dock-tree";
24
27
 
@@ -93,9 +93,10 @@ import { readsInBatches } from "../batched-reads";
93
93
  /** How long a streamed tick may reuse the quote fields read from the cache. */
94
94
  const STREAM_QUOTE_BASELINE_TTL_MS = 60_000;
95
95
  /**
96
- * A repeat of an unchanged quote only moves its arrival time. Writing that
97
- * would re-render every reader per heartbeat, so it is recorded at most this
98
- * often: often enough that quote ages and the stream watchdog see a live feed.
96
+ * A repeat of an unchanged quote, or one restamped within the same minute,
97
+ * only moves its arrival time and stamp. Writing that would re-render every
98
+ * reader per heartbeat, so it is recorded at most this often: often enough
99
+ * that quote ages and the stream watchdog see a live feed.
99
100
  */
100
101
  const STREAM_RECEIPT_REFRESH_MS = 5_000;
101
102
  /** Keeps a long session of browsing from holding a baseline per visited symbol. */
@@ -7,6 +7,7 @@ import { QueryStore } from "../query-store";
7
7
  import type { QueryEntry } from "../result-types";
8
8
  import { buildQuoteKey, instrumentFromQuoteTarget, toMarketDataContext } from "../selectors";
9
9
  import { measurePerf } from "../../utils/perf-marks";
10
+ import { quoteStampBucket } from "../quotes/freshness";
10
11
  import { withSavedCopyMarkOf } from "../../data/saved-copies";
11
12
  import {
12
13
  failureStatus,
@@ -491,8 +492,13 @@ export class QuoteSubscriptionManager {
491
492
  }
492
493
 
493
494
  /**
494
- * Whether a tick would change nothing but its arrival time. Unavailable
495
- * numbers are NaN on the wire and count as equal to each other; key order and
495
+ * Whether a tick would change nothing but its arrival time, or its stamp
496
+ * within the minute it already has. Most of a busy symbol's ticks restamp a
497
+ * quote whose price, size and book did not move, and a stamp that stays in the
498
+ * same minute changes no chart bar, as-of clock or session edge, so the pane
499
+ * has nothing to redraw (the caller still refreshes the receipt now and then).
500
+ * A stamp that reaches another minute is a change. Unavailable numbers are NaN
501
+ * on the wire and count as equal to each other; key order and
496
502
  * absent-versus-undefined keys do not matter.
497
503
  */
498
504
  export function areStreamQuotesEquivalent(current: Quote | null | undefined, next: Quote): boolean {
@@ -500,12 +506,14 @@ export function areStreamQuotesEquivalent(current: Quote | null | undefined, nex
500
506
  if (current === next) return true;
501
507
  const left = current as unknown as Record<string, unknown>;
502
508
  const right = next as unknown as Record<string, unknown>;
509
+ const sameStampMinute = Object.is(quoteStampBucket(current), quoteStampBucket(next))
510
+ && Number.isFinite(current.lastUpdated);
503
511
  for (const key in left) {
504
- if (key === "receivedAt" || key === "provenance") continue;
512
+ if (key === "receivedAt" || key === "provenance" || (key === "lastUpdated" && sameStampMinute)) continue;
505
513
  if (!Object.is(left[key], right[key])) return false;
506
514
  }
507
515
  for (const key in right) {
508
- if (key === "receivedAt" || key === "provenance") continue;
516
+ if (key === "receivedAt" || key === "provenance" || (key === "lastUpdated" && sameStampMinute)) continue;
509
517
  if (!(key in left) && right[key] !== undefined) return false;
510
518
  }
511
519
  return current.provenance === next.provenance
@@ -128,6 +128,39 @@ const REGULAR_CLOSE_MINUTES: Record<string, number> = {
128
128
  // Borsa Istanbul: continuous trading to 18:00, then the closing auction and trading at the close to 18:10.
129
129
  BIST: 18 * 60 + 10,
130
130
  };
131
+ // How long before its calendar's close (REGULAR_CLOSE_MINUTES, rounded up and
132
+ // running through any trading at the close, or the after-hours session the
133
+ // calendar keeps) a venue's closing price is set: the end of its closing
134
+ // auction, or of regular trading where the calendar runs on (TWSE's close is
135
+ // 13:30, its calendar 14:30 for after-hours fixed-price trading). A venue not
136
+ // listed sets its close at the calendar's. Rounded early, never late: a print
137
+ // is only called the close from this time on (closingPriceTime).
138
+ const CLOSING_PRICE_LEAD_MINUTES: Record<string, number> = {
139
+ // The closing auctions: Xetra, Vienna, Euronext and London to 17:35 (16:35), SIX and Milan to 17:30 and 17:35,
140
+ // Nasdaq Stockholm and Helsinki to 17:30 and 18:30, Copenhagen to 17:00, Oslo to 16:25, Iceland to 15:35, Warsaw to 17:00.
141
+ XETRA: 5, VIE: 5, EPA: 5, AMS: 5, BRU: 5, LIS: 5, LSE: 5, SWX: 10, BIT: 10,
142
+ SFB: 10, HEL: 10, CPH: 10, OSL: 5, ICEX: 5, WSE: 10, PSE: 5,
143
+ // Hong Kong's auction ends at random from 16:08, Sydney's from 16:10, Singapore's at 17:06, Wellington's by 16:50.
144
+ HKEX: 2, ASX: 5, SGX: 15, NZX: 10,
145
+ // Regular trading ends 13:30 in Taipei, 15:30 in Mumbai and Seoul and 15:00 in Shanghai and Shenzhen;
146
+ // the calendars run on through after-hours or closing-price sessions.
147
+ TWSE: 60, TPEX: 60, NSE: 30, BSE: 30, KRX: 30, KOSDAQ: 30, SSE: 30, SZSE: 30,
148
+ // Mexico, Buenos Aires and Johannesburg close at 15:00, 17:00 and 17:00; B3's close is 17:00 or 18:00 with New
149
+ // York's clocks, and the earlier is taken.
150
+ BMV: 10, BYMA: 10, JSE: 15, B3: 90,
151
+ // The Gulf and Tel Aviv: the closing auction's end, before trading at last.
152
+ TASE: 6, TADAWUL: 10, QE: 5, DFM: 5, MSX: 5, BIST: 5,
153
+ };
154
+
155
+ /**
156
+ * When a venue's closing price was set for the session its calendar closes at
157
+ * `close` (latestRegularSessionClose's): the closing auction's end or the end
158
+ * of regular trading, before any trading at the close or after-hours session
159
+ * the calendar runs through (CLOSING_PRICE_LEAD_MINUTES).
160
+ */
161
+ export function closingPriceTime(exchange: string | undefined, close: number): number {
162
+ return close - (CLOSING_PRICE_LEAD_MINUTES[canonicalExchange(exchange)] ?? 0) * 60_000;
163
+ }
131
164
  // Venues whose week is not Monday to Friday, as their days off (0 is Sunday).
132
165
  // Tadawul, Qatar, Boursa Kuwait and the Egyptian Exchange trade Sunday to
133
166
  // Thursday. Dubai's DFM has traded Monday to Friday since 2022, like the
@@ -74,6 +74,8 @@ const STALE_SESSION_LABEL = "STALE";
74
74
  * one (Quote.nominalPrice).
75
75
  */
76
76
  const NO_TRADES_SESSION_LABEL = "NO TRADES";
77
+ /** What a quote's session reads as when no live quote prices it: the close of its latest daily bar (Quote.dailyClose). */
78
+ const DAILY_CLOSE_SESSION_LABEL = "DAILY CLOSE";
77
79
 
78
80
  const WEEKDAYS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] as const;
79
81
  const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] as const;
@@ -147,6 +149,7 @@ function quoteMarketState(quote: Quote | null | undefined, now = Date.now()): Ma
147
149
  export function quoteMarketStateLabel(quote: Quote | null | undefined, now = Date.now()): string | null {
148
150
  if (quote?.delisting) return delistingLabel(quote.delisting);
149
151
  if (quote?.nominalPrice) return NO_TRADES_SESSION_LABEL;
152
+ if (quote?.dailyClose) return DAILY_CLOSE_SESSION_LABEL;
150
153
  if (!quote?.marketState) return null;
151
154
  if (isQuoteBeforeLatestSession(quote, now)) return STALE_SESSION_LABEL;
152
155
  const awaiting = preMarketCloseAwaitingPrint(quote);
@@ -254,6 +257,7 @@ export function quoteSessionStateLabel(quote: Quote | null | undefined, now = Da
254
257
  function sessionLabel(quote: Quote | null | undefined, now: number, standingClose: boolean): string | null {
255
258
  if (quote?.delisting) return standingClose ? delistingLabel(quote.delisting) : delistingStateLabel(quote.delisting);
256
259
  if (quote?.nominalPrice) return NO_TRADES_SESSION_LABEL;
260
+ if (quote?.dailyClose) return DAILY_CLOSE_SESSION_LABEL;
257
261
  if (!quote?.marketState) return null;
258
262
  if (isQuoteBeforeLatestSession(quote, now)) return STALE_SESSION_LABEL;
259
263
  if (overnightSessionDisplay(quote)) return "OVERNIGHT";
@@ -268,7 +272,7 @@ function sessionLabel(quote: Quote | null | undefined, now: number, standingClos
268
272
  * pre-market still stands at.
269
273
  */
270
274
  export function quoteSessionColor(quote: Quote | null | undefined, palette: ThemeColors = colors, now = Date.now()): string {
271
- if (quote?.delisting || quote?.nominalPrice) return palette.warning;
275
+ if (quote?.delisting || quote?.nominalPrice || quote?.dailyClose) return palette.warning;
272
276
  if (!quote?.marketState) return palette.textDim;
273
277
  if (isQuoteBeforeLatestSession(quote, now)) return palette.warning;
274
278
  if (overnightSessionDisplay(quote)) return marketStateColor("POST", palette);
@@ -230,6 +230,16 @@ export function mergeQuoteContribution(
230
230
  regularChangePercent: next.regularClose != null ? next.regularChangePercent : undefined,
231
231
  };
232
232
 
233
+ // Where a 52-week range comes from is said of that range: it goes with the range the merge keeps. A tick that
234
+ // relays the same range without saying (a stream's quote built on the served one) keeps the word; one with
235
+ // another range, or a copy saved before the word existed, says its own, or none.
236
+ if (next.high52w !== undefined || next.low52w !== undefined) {
237
+ const relayed = next.yearRangeBasis === undefined && next.high52w === current.high52w && next.low52w === current.low52w;
238
+ const basis = relayed ? current.yearRangeBasis : next.yearRangeBasis;
239
+ if (basis) merged.yearRangeBasis = basis;
240
+ else delete merged.yearRangeBasis;
241
+ }
242
+
233
243
  // What this observation's move is from, when not its previous close (a coin's
234
244
  // 24 hours), is said with each one: a quote back on its
235
245
  // previous close drops an earlier "24h", and one on 24 hours drops the
@@ -33,6 +33,18 @@ export function hasValidQuoteObservationTime(quote: Pick<Quote, "lastUpdated">,
33
33
  && Number.isFinite(new Date(timestamp).getTime()) && Number.isFinite(new Date(now).getTime());
34
34
  }
35
35
 
36
+ /**
37
+ * The size of the stamp window a chart bar, an as-of clock and a session edge
38
+ * all move on: a whole minute. A stamp that stays inside the held one's window
39
+ * changes none of them.
40
+ */
41
+ const QUOTE_STAMP_BUCKET_MS = 60_000;
42
+
43
+ /** The whole minute a quote's stamp falls in; NaN for an unusable stamp. */
44
+ export function quoteStampBucket(quote: Pick<Quote, "lastUpdated">): number {
45
+ return Number.isFinite(quote.lastUpdated) ? Math.floor(quote.lastUpdated / QUOTE_STAMP_BUCKET_MS) : Number.NaN;
46
+ }
47
+
36
48
  /** The source date of a validated daily fund observation, including an old NAV. */
37
49
  export function dailyNavDate(quote: Quote, now = Date.now()): string | null {
38
50
  if (quote.priceObservation !== "nav" || quote.instrumentType !== "MUTUALFUND"
@@ -212,6 +224,25 @@ export function nominalSessionLabel(quote: Pick<Quote, "nominalPrice"> | null |
212
224
  return day && Number.isFinite(day.getTime()) ? `${day.getUTCDate()} ${PRINT_MONTHS[day.getUTCMonth()]} close` : null;
213
225
  }
214
226
 
227
+ /**
228
+ * What a quote with no live price says beside it (Quote.dailyClose): "no live
229
+ * quote, daily close of Wed 11 Nov". Null for any other quote.
230
+ */
231
+ export function dailyCloseText(quote: Pick<Quote, "dailyClose"> | null | undefined): string | null {
232
+ const session = quote?.dailyClose?.session;
233
+ const day = session ? new Date(`${session}T00:00:00Z`) : null;
234
+ return day && Number.isFinite(day.getTime())
235
+ ? `no live quote, daily close of ${PRINT_WEEKDAYS[day.getUTCDay()]} ${day.getUTCDate()} ${PRINT_MONTHS[day.getUTCMonth()]}`
236
+ : null;
237
+ }
238
+
239
+ /** When a daily close is from, as an Updated cell names it: "11 Nov daily close" (Quote.dailyClose). Null for any other quote. */
240
+ export function dailyCloseSessionLabel(quote: Pick<Quote, "dailyClose"> | null | undefined): string | null {
241
+ const session = quote?.dailyClose?.session;
242
+ const day = session ? new Date(`${session}T00:00:00Z`) : null;
243
+ return day && Number.isFinite(day.getTime()) ? `${day.getUTCDate()} ${PRINT_MONTHS[day.getUTCMonth()]} daily close` : null;
244
+ }
245
+
215
246
  /** A US listing's after-hours session ends four hours past its regular close (17:00 New York after an early close). */
216
247
  const US_AFTER_HOURS_MS = 4 * 60 * 60_000;
217
248
 
@@ -1,5 +1,7 @@
1
1
  import type { AnalystResearchData, CorporateActionsData, Fundamentals, Quote, TickerFinancials } from "../../types/financials";
2
2
  import { atRegularSessionPrice, regularSessionValuationPrice } from "./regular-session-valuation";
3
+ import { isIndexLevel } from "../market/index-level";
4
+ import { isYieldIndexSymbol } from "../../tickers/index-roots";
3
5
  import { hasLikelyQuoteUnitMismatch, resolveCurrencyUnit } from "../../utils/currency-units";
4
6
  import { cashInMajorUnits } from "../../utils/dividend-cash";
5
7
  import { cashDistribution, dividendReferencePrice, trailingDividendYield, type CashDistribution } from "../../utils/trailing-dividend";
@@ -72,7 +74,7 @@ export function liveTrailingPE(quote: Quote | null | undefined, fundamentals: Fu
72
74
  // Withdrawn as no multiple of the share (utils/share-multiples).
73
75
  if (fundamentals?.notMeaningful?.trailingPE) return NOT_MEANINGFUL;
74
76
  const stored = pricedFundamentals(quote, fundamentals)?.trailingPE;
75
- return priceEarningsOnEarnings(repriceMultiple(stored, priceEarningsEps(fundamentals), quote, fundamentals), fundamentals?.eps);
77
+ return priceEarningsOnEarnings(repriceMultiple(stored, priceEarningsEps(fundamentals, quote?.currency), quote, fundamentals), fundamentals?.eps);
76
78
  }
77
79
 
78
80
  /** Forward P/E over the regular session price; not meaningful when the forward EPS behind it is zero or a loss. */
@@ -196,6 +198,30 @@ export function liveMarketCapitalization(
196
198
  return { ...stored, value: shares * price, live: true };
197
199
  }
198
200
 
201
+ /** Whether a value is one of the quote's levels: above 0, or any finite yield for a Treasury yield index (^IRX can read 0). */
202
+ function quoteLevel(quote: Quote): (value: number | null | undefined) => value is number {
203
+ return isYieldIndexSymbol(quote.symbol)
204
+ ? (value: number | null | undefined): value is number => value != null && Number.isFinite(value)
205
+ : positive;
206
+ }
207
+
208
+ /**
209
+ * The 52-week range a quote states, when it is one: both bounds above 0 (a
210
+ * Treasury yield index's at any level, 0 and below included), and for an index
211
+ * not its day's range again (a source that repeats the session's low and high
212
+ * as the year's: the EGX 30's 52,691.30 high on a day its bars spanned 39,537
213
+ * to 56,931). A range the service read from the stored daily bars instead
214
+ * (Quote.yearRangeBasis) is one whatever it equals.
215
+ */
216
+ export function statedYearRange(quote: Quote | null | undefined): { low: number; high: number } | null {
217
+ if (!quote) return null;
218
+ const level = quoteLevel(quote);
219
+ if (!level(quote.low52w) || !level(quote.high52w) || quote.high52w < quote.low52w) return null;
220
+ const repeatsDay = quote.low52w === quote.low && quote.high52w === quote.high;
221
+ if (repeatsDay && quote.yearRangeBasis !== "daily-bars" && isIndexLevel(quote.instrumentType)) return null;
222
+ return { low: quote.low52w, high: quote.high52w };
223
+ }
224
+
199
225
  /**
200
226
  * The 52-week extremes with today's session folded in, so a new high or low
201
227
  * reads 100% or 0% instead of pinning against a stale bound. A caller that
@@ -205,10 +231,11 @@ export function liveFiftyTwoWeekRange(
205
231
  quote: Quote | null | undefined,
206
232
  displayedPrice?: number | null,
207
233
  ): { low: number; high: number } | null {
208
- if (!quote || !positive(quote.low52w) || !positive(quote.high52w)) return null;
209
- const session = [quote.price, quote.high, quote.low, displayedPrice].filter(positive);
210
- const low = Math.min(quote.low52w, ...session);
211
- const high = Math.max(quote.high52w, ...session);
234
+ const stated = statedYearRange(quote);
235
+ if (!quote || !stated) return null;
236
+ const session = [quote.price, quote.high, quote.low, displayedPrice].filter(quoteLevel(quote));
237
+ const low = Math.min(stated.low, ...session);
238
+ const high = Math.max(stated.high, ...session);
212
239
  return high > low ? { low, high } : null;
213
240
  }
214
241
 
@@ -188,7 +188,7 @@ export function atRegularSessionPrice<T extends Pick<TickerFinancials, "quote" |
188
188
  if (!fundamentals || fundamentals.stale === true) {
189
189
  return { ...financials, quote: { ...quote, marketCap: scaledAmount(quote.marketCap, capMove(quote.marketCap)) } };
190
190
  }
191
- const trailing = per(fundamentals.trailingPE, priceEarningsEps(fundamentals));
191
+ const trailing = per(fundamentals.trailingPE, priceEarningsEps(fundamentals, quote.currency));
192
192
  const forward = per(fundamentals.forwardPE, fundamentals.forwardEps);
193
193
  const dividend = fundamentals.dividendRate != null && positive(fundamentals.dividendYield)
194
194
  ? fundamentals.dividendRate / fundamentals.dividendYield : undefined;
@@ -510,6 +510,10 @@ export function resolveCanonicalQuote(
510
510
  changeSessionDate: resolved.changeSessionDate as Quote["changeSessionDate"],
511
511
  high52w: resolved.high52w as Quote["high52w"],
512
512
  low52w: resolved.low52w as Quote["low52w"],
513
+ // Said of the range, so it comes with the provider whose range it is.
514
+ yearRangeBasis: contributions.find((quote) => quote.high52w === resolved.high52w && quote.low52w === resolved.low52w)?.yearRangeBasis,
515
+ // Said of the price, so it comes with it.
516
+ dailyClose: priceProvider?.dailyClose,
513
517
  marketCap: resolved.marketCap as Quote["marketCap"],
514
518
  volume: resolved.volume as Quote["volume"],
515
519
  name: resolved.name as Quote["name"],
@@ -108,17 +108,3 @@ export function formatQuoteAgeWithSource(
108
108
  const prefix = quote.dataSource === "delayed" ? "◷" : "";
109
109
  return prefix ? `${prefix}${age}` : age;
110
110
  }
111
-
112
- export function getMostRecentQuoteUpdate(
113
- quotes: Iterable<Pick<Quote, "lastUpdated" | "receivedAt"> | null | undefined>,
114
- now = Date.now(),
115
- ): number | null {
116
- let latest: number | null = null;
117
- for (const quote of quotes) {
118
- const timestamp = resolveQuoteAgeTimestamp(quote, now);
119
- if (timestamp != null && (latest == null || timestamp > latest)) {
120
- latest = timestamp;
121
- }
122
- }
123
- return latest;
124
- }
@@ -10,6 +10,7 @@ export const accountManagementModule: PluginModule = {
10
10
  reportFreshness: { status: "not-a-feed", basis: "account data", local: true },
11
11
  defaultPosition: "right",
12
12
  defaultMode: "floating",
13
+ utilityWindow: true,
13
14
  defaultFloatingSize: { width: 72, height: 36 },
14
15
  portableShare: {
15
16
  private: { title: true, params: true, settings: true, state: true },
@@ -5,14 +5,16 @@ import { usePaneRefreshKey } from "../../../components/data-table/table-pane";
5
5
  import { useThemeColors } from "../../../theme/theme-context";
6
6
  import { Box, ScrollBox, Text, useRendererHost, useUiCapabilities, type ScrollBoxRenderable } from "../../../ui";
7
7
  import { fetchAward, loadAward } from "./client";
8
- import { awardPeriod, awardTypeLabel, money } from "./model";
8
+ import { amountWithheld, awardPeriod, awardTypeLabel, money, statementText, WITHHELD_AMOUNT } from "./model";
9
9
  import { UpgradeLabel } from "../shared/locked-rows";
10
10
 
11
- export function AwardDetail({ row, accessKey, width, height, focused, openAward, openChildren, openUpgrade, attribution }: {
11
+ export function AwardDetail({ row, accessKey, width, height, focused, openAward, openChildren, openUpgrade, attribution: boardAttribution, amountNotice: boardAmountNotice }: {
12
12
  row: AwardRow; accessKey: string; width: number; height: number; focused: boolean; openAward: (id: string) => void;
13
13
  openChildren: (type: "subaward" | "modification") => void; openUpgrade: () => void;
14
14
  /** The statement the award's source licence asks for wherever its data is shown. */
15
15
  attribution?: string;
16
+ /** How the award's source's amounts read, when it withholds some (GeBIZ). */
17
+ amountNotice?: string;
16
18
  }) {
17
19
  const colors = useThemeColors();
18
20
  const host = useRendererHost();
@@ -30,6 +32,11 @@ export function AwardDetail({ row, accessKey, width, height, focused, openAward,
30
32
  usePaneRefreshKey(resource.reload, { focused });
31
33
  const loaded = resource.pages[0], detail = loaded?.payload;
32
34
  const current = detail?.row ?? row;
35
+ // The board's statements, else the ones the award's own read carries.
36
+ const attribution = statementText(boardAttribution) || statementText(detail?.attribution);
37
+ const amountNotice = statementText(boardAmountNotice) || statementText(detail?.amountNotice);
38
+ // Withheld by the award's own reason (GeBIZ's "under S$6,000"); an amount never printed stays unreported.
39
+ const withheld = amountWithheld(current);
33
40
  const scrollRef = useRef<ScrollBoxRenderable | null>(null);
34
41
  const loadMore = useTableLoadMore(scrollRef, resource.hasMore, resource.loadMore);
35
42
  usePaneStatusFooter({ registrationId: "awards:detail", loading: resource.loading || resource.loadingMore, error: resource.error?.message ?? resource.moreError?.message, stale: loaded?.stale });
@@ -37,10 +44,11 @@ export function AwardDetail({ row, accessKey, width, height, focused, openAward,
37
44
  const labelWidth = width < 85 ? 18 : 23;
38
45
  return <ScrollBox ref={scrollRef} scrollY width={width} height={desktop ? undefined : height} flexGrow={1} flexBasis={0} contentOptions={{ paddingX: 1 }} onMouseScroll={loadMore}>
39
46
  <StatGrid width={Math.max(1, width - 2)} items={[
40
- { id: "value", label: `Value (${current.currency})`, value: money(current.awardAmount), detail: current.fieldAsOf?.awardAmount ? `as of ${current.fieldAsOf.awardAmount.slice(0, 10)}` : undefined },
47
+ { id: "value", label: `Value (${current.currency})`, value: withheld ? WITHHELD_AMOUNT : money(current.awardAmount), detail: withheld ?? (current.fieldAsOf?.awardAmount ? `as of ${current.fieldAsOf.awardAmount.slice(0, 10)}` : undefined) },
41
48
  { id: "obligated", label: `Obligated (${current.currency})`, value: money(current.obligatedAmount), detail: current.fieldAsOf?.obligatedAmount ? `as of ${current.fieldAsOf.obligatedAmount.slice(0, 10)}` : undefined },
42
49
  { id: "ceiling", label: `Ceiling (${current.currency})`, value: money(current.ceilingAmount), detail: current.fieldAsOf?.ceilingAmount ? `as of ${current.fieldAsOf.ceilingAmount.slice(0, 10)}` : undefined },
43
50
  ]} />
51
+ {withheld && amountNotice ? <Text fg={colors.textDim} width={width - 2} wrapMode="word" wrapText>{amountNotice}</Text> : null}
44
52
  <Section title="Contract" width={width - 2}>
45
53
  <KeyValueRow label="Awardee" value={current.recipient.name} labelWidth={labelWidth} />
46
54
  <KeyValueRow label={current.entity?.parentName && current.entity.parentName !== current.recipient.name ? "Listed parent" : "Listed company"} value={current.entity ? `${current.entity.ticker} · ${current.entity.parentName ?? current.entity.legalName}` : "Unresolved"} labelWidth={labelWidth} />
@@ -85,7 +93,7 @@ export function AwardDetail({ row, accessKey, width, height, focused, openAward,
85
93
  <KeyValueRow label="Record" value={revision.id} detail={revision.supersedes ? `Supersedes ${revision.supersedes}` : "Original observation"} labelWidth={labelWidth} />
86
94
  <KeyValueRow label="Awardee" value={revision.award.recipient.name} labelWidth={labelWidth} />
87
95
  <KeyValueRow label="Agency" value={revision.award.agency.name} labelWidth={labelWidth} />
88
- <KeyValueRow label="Award date / value" value={`${revision.award.awardDate} · ${revision.award.currency} ${money(revision.award.awardAmount)}`} labelWidth={labelWidth} />
96
+ <KeyValueRow label="Award date / value" value={`${revision.award.awardDate} · ${amountWithheld(revision.award) ? WITHHELD_AMOUNT : `${revision.award.currency} ${money(revision.award.awardAmount)}`}`} labelWidth={labelWidth} />
89
97
  <KeyValueRow label="Performance period" value={`${revision.award.periodStart ?? "--"} / ${revision.award.periodEnd ?? "--"}`} labelWidth={labelWidth} />
90
98
  <Text fg={colors.textDim} width={width - 2} wrapMode="word" wrapText>{revision.award.title}</Text>
91
99
  {revision.award.evidenceQuote ? <Text fg={colors.text} width={width - 2} wrapMode="word" wrapText>{revision.award.evidenceQuote}</Text> : null}