@gloom-sh/terminal 0.20.11 → 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 (242) hide show
  1. package/package.json +2 -1
  2. package/src/api-client/awards.ts +16 -0
  3. package/src/api-client/central-bank-rates.ts +5 -0
  4. package/src/api-client/data.ts +55 -2
  5. package/src/api-client/index.ts +18 -1
  6. package/src/api-client/request.ts +86 -3
  7. package/src/api-client/socket-connection.ts +12 -1
  8. package/src/api-client/socket.ts +21 -3
  9. package/src/api-client/supply-chain-graph.ts +4 -2
  10. package/src/api-client/supply-chain.ts +8 -0
  11. package/src/api-client/types/econ.ts +10 -7
  12. package/src/api-client/types/filings-and-calls.ts +8 -0
  13. package/src/app/global-shortcuts.ts +2 -1
  14. package/src/app/keybindings/actions.ts +19 -0
  15. package/src/app/pane-runtime/index.tsx +18 -3
  16. package/src/app/pane-runtime/layout-placement.ts +63 -0
  17. package/src/app/pane-runtime/ticker-open-runtime.ts +10 -2
  18. package/src/capabilities/chart-series.ts +4 -1
  19. package/src/cli/board-coins.ts +10 -1
  20. package/src/cli/commands/crypto-hints.ts +3 -2
  21. package/src/cli/commands/fred-series.ts +0 -54
  22. package/src/cli/commands/market.ts +209 -31
  23. package/src/cli/commands/overview.ts +47 -14
  24. package/src/cli/commands/search.ts +37 -8
  25. package/src/cli/commands/ticker.ts +15 -4
  26. package/src/cli/desktop-pane-shot.ts +27 -2
  27. package/src/cli/fx-quote-rate.ts +1 -1
  28. package/src/cli/glossary.ts +14 -5
  29. package/src/cli/history-catalog-series.ts +85 -0
  30. package/src/cli/index.ts +1 -1
  31. package/src/cli/list-progress.ts +45 -0
  32. package/src/cli/listing-arg.ts +71 -7
  33. package/src/cli/name-entries.ts +8 -4
  34. package/src/cli/not-a-ticker.ts +2 -2
  35. package/src/cli/pane-functions/freshness.ts +50 -3
  36. package/src/cli/pane-functions/index.ts +7 -4
  37. package/src/cli/pane-functions/market-session.ts +66 -14
  38. package/src/cli/pane-functions/options.ts +5 -0
  39. package/src/cli/pane-functions/resolver.ts +9 -2
  40. package/src/cli/pane-functions/screenshot-assessment.ts +28 -3
  41. package/src/cli/pane-functions/screenshot-types.ts +6 -0
  42. package/src/cli/quote-answer.ts +49 -10
  43. package/src/cli/quote-list-reads.ts +87 -0
  44. package/src/cli/report-tables.ts +70 -13
  45. package/src/cli/result.ts +24 -2
  46. package/src/cli/symbol-list.ts +31 -4
  47. package/src/cli/terminal-code-hints.ts +83 -0
  48. package/src/cli/ticker-resolution.ts +2 -1
  49. package/src/cli/treasury-yields.ts +5 -0
  50. package/src/components/command-bar/action-runtime.ts +2 -0
  51. package/src/components/command-bar/routing/launch-request.ts +2 -1
  52. package/src/components/command-bar/routing/navigation-state.ts +4 -2
  53. package/src/components/command-bar/workflow/types.ts +6 -0
  54. package/src/components/layout/detached-pane-shell.tsx +3 -0
  55. package/src/components/layout/double-escape-close.ts +34 -3
  56. package/src/components/layout/floating-pane.tsx +10 -4
  57. package/src/components/layout/pane/cycle-order.ts +66 -2
  58. package/src/components/layout/pane/header.tsx +140 -31
  59. package/src/components/layout/pane/sidebar.tsx +13 -5
  60. package/src/components/layout/pane/status-footer.ts +3 -1
  61. package/src/components/layout/shell/drag/runtime.ts +5 -0
  62. package/src/components/layout/shell/index.tsx +25 -0
  63. package/src/components/layout/shell/menu.ts +9 -0
  64. package/src/components/layout/shell/pane/actions.ts +36 -0
  65. package/src/components/layout/shell/pane/management-shortcuts.ts +27 -3
  66. package/src/components/layout/shell/pane-occlusion.ts +40 -0
  67. package/src/components/layout/shell/shortcuts.ts +17 -1
  68. package/src/components/layout/shell/terminal-pointer-runtime.ts +39 -6
  69. package/src/components/layout/shell/window-mode/index.ts +5 -16
  70. package/src/components/layout/shell/window-mode/overlays.tsx +3 -1
  71. package/src/components/market-board/index.tsx +14 -5
  72. package/src/components/metric-treemap/index.tsx +3 -1
  73. package/src/components/ui/button.tsx +48 -4
  74. package/src/components/ui/data-table/opentui/index.tsx +24 -9
  75. package/src/components/ui/data-table/types.ts +7 -0
  76. package/src/components/ui/inline-quick-add.tsx +19 -3
  77. package/src/components/ui/list-view.tsx +11 -5
  78. package/src/components/ui/query-bar.tsx +16 -1
  79. package/src/components/ui/selection-fill.ts +39 -0
  80. package/src/core/state/app/layout-reducer.ts +2 -1
  81. package/src/core/state/app/pane-choices.ts +68 -0
  82. package/src/core/state/app/state.ts +14 -6
  83. package/src/core/state/app/types.ts +8 -0
  84. package/src/layout/pane-manager/dock-tree.ts +19 -0
  85. package/src/layout/pane-manager/index.ts +3 -0
  86. package/src/market-data/market/freshness.ts +33 -0
  87. package/src/market-data/market/status.ts +5 -1
  88. package/src/market-data/quotes/contributions.ts +10 -0
  89. package/src/market-data/quotes/freshness.ts +19 -0
  90. package/src/market-data/quotes/live-valuation.ts +31 -4
  91. package/src/market-data/quotes/resolution.ts +4 -0
  92. package/src/market-data/quotes/time.ts +0 -14
  93. package/src/plugins/builtin/account-management/index.tsx +1 -0
  94. package/src/plugins/builtin/awards/detail.tsx +12 -4
  95. package/src/plugins/builtin/awards/headless.ts +29 -8
  96. package/src/plugins/builtin/awards/model.ts +36 -2
  97. package/src/plugins/builtin/awards/pane.tsx +7 -4
  98. package/src/plugins/builtin/broker-manager/index.tsx +1 -0
  99. package/src/plugins/builtin/broker-trading/index.tsx +1 -1
  100. package/src/plugins/builtin/central-bank-rates/headless.ts +6 -6
  101. package/src/plugins/builtin/central-bank-rates/index.tsx +1 -1
  102. package/src/plugins/builtin/central-bank-rates/model.ts +21 -3
  103. package/src/plugins/builtin/central-bank-rates/pane.tsx +15 -5
  104. package/src/plugins/builtin/chart-composer/headless.ts +5 -1
  105. package/src/plugins/builtin/chart-composer/pane.tsx +1 -0
  106. package/src/plugins/builtin/chat/content/handle-prompt.tsx +4 -0
  107. package/src/plugins/builtin/chat/controller/realtime.ts +17 -1
  108. package/src/plugins/builtin/chat/message/terminal.tsx +4 -1
  109. package/src/plugins/builtin/chat/sidebar.tsx +3 -4
  110. package/src/plugins/builtin/cloud/askg/pane.tsx +4 -0
  111. package/src/plugins/builtin/cloud/plugin.tsx +1 -0
  112. package/src/plugins/builtin/cloud/team/module.tsx +1 -0
  113. package/src/plugins/builtin/cloud/thesis/detail.tsx +9 -4
  114. package/src/plugins/builtin/commodity-balances/pane.tsx +13 -5
  115. package/src/plugins/builtin/company-kpis/model.ts +3 -3
  116. package/src/plugins/builtin/connections/index.ts +1 -0
  117. package/src/plugins/builtin/credit-boards/cdx-pane.tsx +9 -5
  118. package/src/plugins/builtin/credit-boards/client.ts +5 -0
  119. package/src/plugins/builtin/credit-boards/headless.ts +1 -6
  120. package/src/plugins/builtin/credit-boards/model.ts +0 -6
  121. package/src/plugins/builtin/credit-boards/series.ts +19 -8
  122. package/src/plugins/builtin/credit-boards/sovr-pane.tsx +9 -5
  123. package/src/plugins/builtin/crypto-etf-flows/headless.ts +23 -13
  124. package/src/plugins/builtin/crypto-etf-flows/pane.tsx +8 -3
  125. package/src/plugins/builtin/debt-maturities/headless.ts +16 -7
  126. package/src/plugins/builtin/debt-maturities/model.ts +9 -15
  127. package/src/plugins/builtin/debt-maturities/pane.tsx +9 -10
  128. package/src/plugins/builtin/earnings/board-model.ts +33 -4
  129. package/src/plugins/builtin/earnings/board.tsx +15 -3
  130. package/src/plugins/builtin/earnings/calendar.tsx +10 -6
  131. package/src/plugins/builtin/earnings/client.ts +0 -9
  132. package/src/plugins/builtin/earnings/headless.ts +10 -7
  133. package/src/plugins/builtin/earnings/history.tsx +21 -14
  134. package/src/plugins/builtin/earnings-calls/data.ts +24 -4
  135. package/src/plugins/builtin/earnings-calls/format.ts +23 -5
  136. package/src/plugins/builtin/earnings-calls/headless.ts +23 -3
  137. package/src/plugins/builtin/earnings-calls/index.tsx +1 -0
  138. package/src/plugins/builtin/earnings-calls/model.ts +11 -1
  139. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -5
  140. package/src/plugins/builtin/econ/calendar-model.ts +27 -0
  141. package/src/plugins/builtin/econ/fred-catalog.ts +3 -0
  142. package/src/plugins/builtin/econ/index.tsx +9 -2
  143. package/src/plugins/builtin/econ-statistics/headless.ts +3 -1
  144. package/src/plugins/builtin/econ-statistics/index.tsx +1 -1
  145. package/src/plugins/builtin/fear-greed/headless.ts +16 -13
  146. package/src/plugins/builtin/fear-greed/pane.tsx +12 -4
  147. package/src/plugins/builtin/filing-events/index.tsx +1 -0
  148. package/src/plugins/builtin/fx-matrix/index.tsx +30 -19
  149. package/src/plugins/builtin/insider/table.tsx +10 -7
  150. package/src/plugins/builtin/insider/tickers.tsx +1 -1
  151. package/src/plugins/builtin/iv-history/headless.ts +9 -8
  152. package/src/plugins/builtin/jobs/index.tsx +1 -0
  153. package/src/plugins/builtin/macro-day/headless.ts +3 -3
  154. package/src/plugins/builtin/macro-day/model.ts +1 -1
  155. package/src/plugins/builtin/macro-day/releases.ts +25 -16
  156. package/src/plugins/builtin/market-movers/index.tsx +20 -8
  157. package/src/plugins/builtin/market-movers/model.ts +5 -0
  158. package/src/plugins/builtin/market-movers/session-body.tsx +2 -1
  159. package/src/plugins/builtin/money-markets/headless.ts +12 -2
  160. package/src/plugins/builtin/money-markets/pane.tsx +10 -1
  161. package/src/plugins/builtin/options/view.tsx +1 -0
  162. package/src/plugins/builtin/options-positioning/pane.tsx +1 -1
  163. package/src/plugins/builtin/portfolio-list/cli/bulk-symbols.ts +4 -31
  164. package/src/plugins/builtin/portfolio-list/pane/index.tsx +6 -1
  165. package/src/plugins/builtin/portfolio-list/quick-add/index.tsx +22 -8
  166. package/src/plugins/builtin/portfolio-list/summary/index.tsx +6 -8
  167. package/src/plugins/builtin/portfolio-list/table.tsx +10 -1
  168. package/src/plugins/builtin/realized-vol/headless.ts +28 -2
  169. package/src/plugins/builtin/risk-factors/index.tsx +1 -0
  170. package/src/plugins/builtin/shared/source-footer.ts +70 -0
  171. package/src/plugins/builtin/short-interest/publications-pane.tsx +5 -1
  172. package/src/plugins/builtin/short-volume/pane.tsx +5 -1
  173. package/src/plugins/builtin/social-mentions/outliers.tsx +10 -1
  174. package/src/plugins/builtin/social-mentions/pane.tsx +7 -0
  175. package/src/plugins/builtin/supply-chain/client.ts +3 -1
  176. package/src/plugins/builtin/supply-chain/flow.tsx +25 -8
  177. package/src/plugins/builtin/supply-chain/graph-client.ts +1 -1
  178. package/src/plugins/builtin/supply-chain/graph-evidence.ts +1 -1
  179. package/src/plugins/builtin/supply-chain/graph-model.ts +12 -1
  180. package/src/plugins/builtin/supply-chain/graph-pane.tsx +9 -8
  181. package/src/plugins/builtin/supply-chain/graph.tsx +12 -6
  182. package/src/plugins/builtin/supply-chain/headless.ts +13 -7
  183. package/src/plugins/builtin/supply-chain/model.ts +68 -11
  184. package/src/plugins/builtin/supply-chain/pane.tsx +9 -6
  185. package/src/plugins/builtin/supply-chain/row-evidence.tsx +5 -5
  186. package/src/plugins/builtin/ticker-detail/overview/components.tsx +14 -1
  187. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +2 -0
  188. package/src/plugins/builtin/ticker-detail/pane.tsx +48 -24
  189. package/src/plugins/builtin/ticker-detail/quote-footer.ts +5 -0
  190. package/src/plugins/builtin/ticker-detail/quote-monitor/card.tsx +6 -3
  191. package/src/plugins/builtin/treasury-auctions/after.ts +50 -23
  192. package/src/plugins/builtin/treasury-auctions/cache.ts +23 -5
  193. package/src/plugins/builtin/treasury-auctions/headless.ts +226 -37
  194. package/src/plugins/builtin/treasury-auctions/hk-headless.ts +11 -5
  195. package/src/plugins/builtin/treasury-auctions/hk-view.tsx +27 -25
  196. package/src/plugins/builtin/treasury-auctions/hk.ts +60 -8
  197. package/src/plugins/builtin/treasury-auctions/index.tsx +3 -0
  198. package/src/plugins/builtin/treasury-auctions/keys.ts +27 -0
  199. package/src/plugins/builtin/treasury-auctions/like.ts +137 -0
  200. package/src/plugins/builtin/treasury-auctions/model.ts +100 -22
  201. package/src/plugins/builtin/treasury-auctions/pane.tsx +39 -11
  202. package/src/plugins/builtin/vol-surface/heat-grid.tsx +4 -2
  203. package/src/plugins/builtin/vol-surface/pane.tsx +5 -2
  204. package/src/plugins/runtime/index.tsx +1 -0
  205. package/src/plugins/runtime/state.ts +20 -0
  206. package/src/portfolio/column-values.ts +8 -2
  207. package/src/public/__snapshots__/public-api.test.ts.snap +5 -0
  208. package/src/public/react.ts +7 -0
  209. package/src/react/auto-refresh.ts +29 -0
  210. package/src/renderers/browser/deeplink-bridge.ts +24 -3
  211. package/src/renderers/dom/desktop/query-bar.tsx +229 -60
  212. package/src/renderers/dom/host/overflow-fade-px.ts +2 -0
  213. package/src/renderers/dom/host/overflow-fade.ts +1 -2
  214. package/src/renderers/dom/styles.css +25 -5
  215. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -1
  216. package/src/series/types.ts +2 -0
  217. package/src/sources/gloomberb-cloud/fred-attribution.ts +86 -0
  218. package/src/sources/gloomberb-cloud/index.ts +25 -1
  219. package/src/sources/gloomberb-cloud/normalizers.ts +22 -3
  220. package/src/sources/provider-errors.ts +64 -1
  221. package/src/sources/provider-router/batches.ts +19 -0
  222. package/src/sources/provider-router/index.ts +7 -1
  223. package/src/state/app/context/index.tsx +24 -1
  224. package/src/state/pane-unsent-work.ts +47 -0
  225. package/src/test-support/shell-pane-keys.tsx +5 -0
  226. package/src/test-support/telemetry-guard.ts +83 -0
  227. package/src/test-support/test-env.ts +12 -0
  228. package/src/theme/colors.ts +17 -1
  229. package/src/theme/ui-tokens.ts +50 -1
  230. package/src/tickers/listing-venues.ts +11 -1
  231. package/src/tickers/search/japanese-names.json +1 -0
  232. package/src/tickers/search/japanese-names.ts +152 -0
  233. package/src/tickers/terminal-codes.ts +55 -6
  234. package/src/time-series/base-series.ts +3 -0
  235. package/src/types/data-provider.ts +6 -0
  236. package/src/types/financials.ts +11 -0
  237. package/src/types/plugin-contributions.ts +7 -0
  238. package/src/types/plugin-panes.ts +7 -0
  239. package/src/ui/host.tsx +6 -0
  240. package/src/utils/double-escape-close.ts +42 -0
  241. package/src/utils/fx-status.ts +30 -7
  242. package/src/utils/network-failure.ts +23 -0
@@ -143,7 +143,7 @@ const BLOOMBERG_INDICES: Readonly<Record<string, string>> = {
143
143
  UKX: "^FTSE", DAX: "^GDAXI", CAC: "^FCHI", SX5E: "^STOXX50E", SMI: "^SSMI", AEX: "^AEX", IBEX: "^IBEX",
144
144
  NKY: "^N225", HSI: "^HSI", KOSPI: "^KS11", TWSE: "^TWII", SENSEX: "^BSESN", NIFTY: "^NSEI", FSSTI: "^STI",
145
145
  AS51: "^AXJO", SPTSX: "^GSPTSE", MEXBOL: "^MXX", IBOV: "^BVSP", XU100: "XU100.IS", DXY: "DX-Y.NYB",
146
- USGG5YR: "^FVX", USGG10YR: "^TNX", USGG30YR: "^TYX",
146
+ USGG3M: "^IRX", USGG5YR: "^FVX", USGG10YR: "^TNX", USGG30YR: "^TYX", MOVE: "^MOVE",
147
147
  };
148
148
 
149
149
  /** Index and volatility futures Bloomberg writes with the Index key (ES1 Index, DM1 Index, UX1 Index), by the root quoted here. */
@@ -159,8 +159,13 @@ const BLOOMBERG_FUTURES_ALIASES: ReadonlySet<string> = new Set([
159
159
  /** "EUR Curncy" is the dollar rate in market convention: these as XXXUSD, every other currency as USDXXX. */
160
160
  const DOLLAR_BASE_CURRENCIES: ReadonlySet<string> = new Set(["EUR", "GBP", "AUD", "NZD"]);
161
161
 
162
- /** Bloomberg writes bitcoin as XBT. */
163
- const BLOOMBERG_CRYPTO: Readonly<Record<string, string>> = { XBT: "BTC-USD", XBTUSD: "BTC-USD" };
162
+ /** Bloomberg writes bitcoin as XBT, and keys the dollar index as a currency too (DXY Curncy). */
163
+ const BLOOMBERG_CURRENCY_CODES: Readonly<Record<string, string>> = { XBT: "BTC-USD", XBTUSD: "BTC-USD", DXY: "DX-Y.NYB" };
164
+
165
+ /** Currency futures Bloomberg keys as currencies (JY1 Curncy is the yen future), by the root quoted here. */
166
+ const BLOOMBERG_CURRENCY_FUTURE_ROOTS: Readonly<Record<string, string>> = {
167
+ JY: "6J", EC: "6E", BP: "6B", AD: "6A", CD: "6C", SF: "6S", NV: "6N", PE: "6M",
168
+ };
164
169
 
165
170
  const REUTERS_VENUES: Record<string, string> = { N: "NYSE", O: "NASDAQ", OQ: "NASDAQ" };
166
171
 
@@ -252,10 +257,13 @@ function readBloombergIndex(typed: string, code: string): TerminalListingCode |
252
257
  return root ? genericFuture(typed, root, future![2]!, "Index") : null;
253
258
  }
254
259
 
255
- /** `EURUSD Curncy`, `JPY Curncy` (the dollar rate in market convention: USDJPY), `XBT Curncy`. */
260
+ /** `EURUSD Curncy`, `JPY Curncy` (the dollar rate in market convention: USDJPY), `XBT Curncy`, `DXY Curncy`, `JY1 Curncy`. */
256
261
  function readBloombergCurrency(typed: string, code: string): TerminalListingCode | null {
257
- const crypto = BLOOMBERG_CRYPTO[code];
258
- if (crypto) return { typed, ...keyOf(crypto, ""), terminal: "bloomberg", yellowKey: "Curncy" };
262
+ const named = BLOOMBERG_CURRENCY_CODES[code];
263
+ if (named) return { typed, ...keyOf(named, ""), terminal: "bloomberg", yellowKey: "Curncy" };
264
+ const future = /^([A-Z]{2})(\d{1,2})$/.exec(code);
265
+ const root = future ? BLOOMBERG_CURRENCY_FUTURE_ROOTS[future[1]!] : undefined;
266
+ if (root) return genericFuture(typed, root, future![2]!, "Curncy");
259
267
  const [base, quote] = /^[A-Z]{6}$/.test(code) ? [code.slice(0, 3), code.slice(3)]
260
268
  : /^[A-Z]{3}$/.test(code) && code !== "USD" ? DOLLAR_BASE_CURRENCIES.has(code) ? [code, "USD"] : ["USD", code]
261
269
  : [null, null];
@@ -363,6 +371,47 @@ export function unknownBloombergMarket(raw: string): UnknownBloombergMarket | nu
363
371
  };
364
372
  }
365
373
 
374
+ /** The yellow keys that make a line one code whatever it names: an index, a currency, a commodity, a government bond. */
375
+ const CODE_YELLOW_KEYS: Readonly<Record<string, UnreadBloombergCode["yellowKey"]>> = {
376
+ index: "Index", curncy: "Curncy", comdty: "Comdty", govt: "Govt",
377
+ };
378
+
379
+ /** A word of a code: capitals and digits (MOVE, GTJPY10Y, 1M, 25D), never a word of a name (Hang, Seng). */
380
+ const CODE_WORD = /^[A-Z0-9][A-Z0-9&./-]{0,15}$/;
381
+
382
+ /** A line written as a Bloomberg code that names nothing quoted here (`GTJPY10Y Govt`, `VXJ Index`, `USDJPY BGN Curncy`). */
383
+ export interface UnreadBloombergCode {
384
+ typed: string;
385
+ /** The words before the yellow key, in capitals: `GTJPY10Y`, `USDJPY BGN`. */
386
+ code: string;
387
+ yellowKey: "Index" | "Curncy" | "Comdty" | "Govt";
388
+ }
389
+
390
+ /**
391
+ * A line written as a Bloomberg code with an index, currency, commodity or
392
+ * government bond key that no symbol here is read from: one entry, refused
393
+ * with a hint, never split into words or searched for as a company's name
394
+ * (`MOVE Index` found a Stuttgart product named after the index, and
395
+ * `GTJPY10Y Govt` split into GTJPY10Y and the GOVT fund). An index, a
396
+ * commodity or a bond is one word before its key (`FTSE 100 Index` is a
397
+ * name); a currency's code may carry its pricing source or tenor
398
+ * (`USDJPY BGN Curncy`, `USDJPY 1M 25D RR Curncy`). The first word is in
399
+ * capitals or has a digit, so `Gold Comdty` and `Nasdaq Index` stay names.
400
+ * Null for anything else, and for a code `readTerminalListingCode` reads.
401
+ */
402
+ export function unreadBloombergCode(raw: string): UnreadBloombergCode | null {
403
+ const typed = normalizeTyped(raw);
404
+ const words = typed.split(" ");
405
+ const yellowKey = words.length >= 2 ? CODE_YELLOW_KEYS[words.at(-1)!.toLowerCase()] : undefined;
406
+ if (!yellowKey) return null;
407
+ const parts = words.slice(0, -1);
408
+ if (parts.length > (yellowKey === "Curncy" ? 4 : 1)) return null;
409
+ if (!parts.every((part) => CODE_WORD.test(part.toUpperCase()))) return null;
410
+ if (/\p{Ll}/u.test(parts[0]!) && !/\d/.test(parts[0]!)) return null;
411
+ if (readTerminalListingCode(typed)) return null;
412
+ return { typed, code: parts.join(" ").toUpperCase(), yellowKey };
413
+ }
414
+
366
415
  /** What to type instead where Bloomberg's ticker is not the venue's own code (MK, SP); null elsewhere. */
367
416
  export function bloombergMarketHint(market: string | undefined): string | null {
368
417
  return (market && BLOOMBERG_MARKETS[market]?.hint) || null;
@@ -7,6 +7,7 @@ import type { LiveBarAccumulator } from "./live-bars";
7
7
  import { CHART_RESOLUTION_STEP_MS, type ManualChartResolution } from "./resolution";
8
8
  import type { Quote, QuoteMetadata, TickerFinancials } from "../types/financials";
9
9
  import type { FredSeriesLoadResult } from "../sources/gloomberb-cloud/fred-series";
10
+ import { fredSeriesAttribution } from "../sources/gloomberb-cloud/fred-attribution";
10
11
  import { extractFredSeries } from "./economic";
11
12
  import { isIceSpreadSeries } from "./ice-credit";
12
13
  import { BASIS_POINT_UNIT, BP_PER_PERCENT } from "./studies/units";
@@ -332,6 +333,8 @@ export function baseEconomicSeries(
332
333
  ? points.map((point) => typeof point.value === "number" ? { ...point, value: Number((point.value * BP_PER_PERCENT).toPrecision(12)) } : point)
333
334
  : points,
334
335
  warning: "FRED vintage dates are unavailable; observations use period dates.",
336
+ // Its own publisher and publish date, as `fred` cites them (TurkStat via the CBRT), never Gloom Cloud's name.
337
+ attribution: fredSeriesAttribution(spec.source.seriesId, data),
335
338
  };
336
339
  }
337
340
 
@@ -265,6 +265,12 @@ export interface QuoteBatchResult {
265
265
  * stale, or none.
266
266
  */
267
267
  followUp?: "default" | "refresh";
268
+ /**
269
+ * The error is a source failing (a timeout, the request limit, an
270
+ * unreachable service), not an answer about the listing: asked again
271
+ * shortly it may be quoted. Kept where `error` crosses a bridge as text.
272
+ */
273
+ transient?: boolean;
268
274
  }
269
275
 
270
276
  export interface QuoteBatchOptions {
@@ -205,6 +205,17 @@ export interface Quote extends DepositaryReceiptFacts {
205
205
  changeSessionDate?: string;
206
206
  high52w?: number;
207
207
  low52w?: number;
208
+ /**
209
+ * The 52-week range is the high and low of the stored daily bars over 52
210
+ * weeks, the source's own having been unusable (an index's that only
211
+ * repeated the day's range, or reached zero): said beside it.
212
+ */
213
+ yearRangeBasis?: "daily-bars";
214
+ /**
215
+ * No live quote: the price is the close of the latest stored daily bar of
216
+ * `session` (an exchange-local date), said beside the price.
217
+ */
218
+ dailyClose?: { session: string };
208
219
  marketCap?: number;
209
220
  volume?: number;
210
221
  name?: string;
@@ -37,6 +37,13 @@ export interface TickerResearchTabDef {
37
37
  instruments?: readonly TickerInstrumentKind[];
38
38
  /** Narrower checks than `instruments`: a US listing, an options chain, a connected broker. */
39
39
  isVisible?: (context: TickerResearchTabVisibilityContext) => boolean;
40
+ /**
41
+ * Opens only with Gloom Cloud Pro: an account without it sees the tab's
42
+ * wall. A ticker pane restored on this tab for such an account opens on
43
+ * Overview, and the wall shows once someone picks the tab; the tab stays
44
+ * saved for when the plan has Pro.
45
+ */
46
+ proOnly?: boolean;
40
47
  }
41
48
 
42
49
  export interface TickerAction {
@@ -47,6 +47,13 @@ export interface PaneDef {
47
47
  defaultWidth?: string;
48
48
  defaultFloatingSize?: { width: number; height: number };
49
49
  defaultMode?: "docked" | "floating";
50
+ /**
51
+ * A window for the account or the app rather than data (account, brokers,
52
+ * orders, connections, team, Ask Gloom): it opens floating even in a layout
53
+ * being built as a grid, and is not one of the layout's panes when deciding
54
+ * whether a new one docks.
55
+ */
56
+ utilityWindow?: true;
50
57
  /** Pane publishes its selected symbol as pane-state `cursorSymbol`, so ticker panes can follow it. */
51
58
  tickerSource?: boolean;
52
59
  /**
package/src/ui/host.tsx CHANGED
@@ -563,6 +563,10 @@ export interface HostQueryBarItem {
563
563
  narrowing: boolean;
564
564
  /** Short exclusive choice drawn as inline segments instead of a menu. */
565
565
  inline?: boolean;
566
+ /** Inline: a long list that runs past the bar's edge, drawn as a strip that scrolls by itself rather than folding into its menu. */
567
+ scrolls?: boolean;
568
+ /** Toggles: a shorter label for a bar short of room. */
569
+ short?: string;
566
570
  /** Text filters: the live input, rendered by the kit, and its field state. */
567
571
  node?: ReactNode;
568
572
  active?: boolean;
@@ -594,6 +598,8 @@ export interface HostQueryBarProps {
594
598
  onChange(value: string): void;
595
599
  /** Drawn first, where a tab row starts: a nested tab strip. */
596
600
  start?: boolean;
601
+ /** What the choice is ("Interval"), for a screen reader and its folded menu; "View" when unnamed. */
602
+ label?: string;
597
603
  };
598
604
  onClearAll?: () => void;
599
605
  /** Muted context at the right edge, e.g. the selected row's date. Gives way first. */
@@ -31,6 +31,8 @@ export interface DoubleEscapeCloseState {
31
31
  streamAt: number;
32
32
  /** The last Esc that armed, closed or looked like a repeat. */
33
33
  pressAt: number;
34
+ /** The last Esc that closed a window on its own (`takeSingleEscapeClose`), until the Esc after it. */
35
+ singleClosedAt: number;
34
36
  }
35
37
 
36
38
  export function createDoubleEscapeCloseState(): DoubleEscapeCloseState {
@@ -39,12 +41,14 @@ export function createDoubleEscapeCloseState(): DoubleEscapeCloseState {
39
41
  targetId: null,
40
42
  streamAt: Number.NEGATIVE_INFINITY,
41
43
  pressAt: Number.NEGATIVE_INFINITY,
44
+ singleClosedAt: Number.NEGATIVE_INFINITY,
42
45
  };
43
46
  }
44
47
 
45
48
  export function resetDoubleEscapeClose(state: DoubleEscapeCloseState) {
46
49
  state.lastAt = 0;
47
50
  state.targetId = null;
51
+ state.singleClosedAt = Number.NEGATIVE_INFINITY;
48
52
  }
49
53
 
50
54
  /**
@@ -81,6 +85,44 @@ function isHeldEscape(state: DoubleEscapeCloseState, now: number, repeat: boolea
81
85
  && now - state.streamAt < HELD_ESCAPE_STALL_MS;
82
86
  }
83
87
 
88
+ /**
89
+ * Whether an Esc is a held key rather than a press: the host's repeat, or one
90
+ * that comes as fast as a held key's while a stream is live. Read before the
91
+ * Esc arms anything, since arming moves the last press to it.
92
+ */
93
+ export function isHeldEscapePress(state: DoubleEscapeCloseState, now: number, repeat?: boolean): boolean {
94
+ return repeat === true || isHeldEscape(state, now, repeat);
95
+ }
96
+
97
+ /**
98
+ * One Esc nothing else took closes a floating window on its own. Call it once
99
+ * the window closed, for a press that was not held (`isHeldEscapePress`): the
100
+ * Esc a double press sends after it closes nothing more
101
+ * (`swallowEscapeAfterSingleClose`), so Esc Esc still closes one window, and
102
+ * a held key, as after a double close, goes on closing nothing.
103
+ */
104
+ export function takeSingleEscapeClose(state: DoubleEscapeCloseState, now: number) {
105
+ resetDoubleEscapeClose(state);
106
+ state.streamAt = now;
107
+ state.pressAt = now;
108
+ state.singleClosedAt = now;
109
+ }
110
+
111
+ /**
112
+ * The Esc right after one that closed a window on its own, at a double
113
+ * press's pace: the second half of a pair whose first half already closed.
114
+ * It is taken, and reaches nothing. A host's repeat is left to the held-key
115
+ * rules.
116
+ */
117
+ export function swallowEscapeAfterSingleClose(state: DoubleEscapeCloseState, now: number, repeat?: boolean): boolean {
118
+ if (repeat === true || now - state.singleClosedAt > DOUBLE_ESCAPE_CLOSE_MS) return false;
119
+ state.singleClosedAt = Number.NEGATIVE_INFINITY;
120
+ resetDoubleEscapeClose(state);
121
+ state.streamAt = now;
122
+ state.pressAt = now;
123
+ return true;
124
+ }
125
+
84
126
  interface EscapeOffer {
85
127
  count(): void;
86
128
  keep(): void;
@@ -7,8 +7,19 @@ export interface FxRateStatus {
7
7
  unknownTime: number;
8
8
  oldestAsOf: number | null;
9
9
  latestFetchedAt: number | null;
10
+ /** The pairs counted as unavailable and as stale (`TRY/USD`), so a label names them. */
11
+ unavailablePairs?: string[];
12
+ stalePairs?: string[];
13
+ /** The pair whose rate is the oldest (`oldestAsOf`). */
14
+ oldestPair?: string | null;
10
15
  }
11
16
 
17
+ /** A currency's rate as the pair it is read as: every rate is against the US dollar. */
18
+ const usdPair = (currency: string) => `${currency}/USD`;
19
+
20
+ /** Up to this many pairs are named; more are counted. */
21
+ const NAMED_PAIRS = 3;
22
+
12
23
  /** A rate whose last load failed, or whose observation is past its stale time. */
13
24
  export function isFxRateStale(entry: QueryEntry<number> | null | undefined, now = Date.now()): boolean {
14
25
  return Boolean(entry?.error || (entry?.staleAt != null && entry.staleAt <= now));
@@ -21,27 +32,39 @@ export function summarizeFxRates(
21
32
  read: (currency: string) => QueryEntry<number> | null | undefined,
22
33
  now = Date.now(),
23
34
  ): FxRateStatus {
24
- const status: FxRateStatus = { loading: 0, unavailable: 0, stale: 0, unknownTime: 0, oldestAsOf: null, latestFetchedAt: null };
35
+ const status: FxRateStatus = { loading: 0, unavailable: 0, stale: 0, unknownTime: 0, oldestAsOf: null, latestFetchedAt: null,
36
+ unavailablePairs: [], stalePairs: [], oldestPair: null };
25
37
  for (const currency of new Set(currencies.map((value) => value.trim().toUpperCase()))) {
26
38
  if (currency === "USD") continue;
27
39
  const entry = read(currency);
28
40
  if (entry?.phase === "loading" || entry?.phase === "refreshing") status.loading++;
29
41
  const rate = rates.get(currency);
30
- if (rate == null || !Number.isFinite(rate) || rate <= 0) { status.unavailable++; continue; }
42
+ if (rate == null || !Number.isFinite(rate) || rate <= 0) { status.unavailable++; status.unavailablePairs!.push(usdPair(currency)); continue; }
31
43
  // A legacy persisted numeric rate may be present without a dated query.
32
44
  if (!entry || entry.asOf == null || !Number.isFinite(entry.asOf)) status.unknownTime++;
33
- else status.oldestAsOf = Math.min(status.oldestAsOf ?? Infinity, entry.asOf);
34
- if (isFxRateStale(entry, now)) status.stale++;
45
+ else if (status.oldestAsOf == null || entry.asOf < status.oldestAsOf) {
46
+ status.oldestAsOf = entry.asOf;
47
+ status.oldestPair = usdPair(currency);
48
+ }
49
+ if (isFxRateStale(entry, now)) { status.stale++; status.stalePairs!.push(usdPair(currency)); }
35
50
  if (entry?.fetchedAt != null) status.latestFetchedAt = Math.max(status.latestFetchedAt ?? 0, entry.fetchedAt);
36
51
  }
37
52
  return status;
38
53
  }
39
54
 
55
+ /** `TRY/USD` or `TRY/USD, EGP/USD` when few enough are named, else their count. */
56
+ function pairsText(count: number, pairs: readonly string[] | undefined): string {
57
+ return pairs && pairs.length === count && count <= NAMED_PAIRS ? pairs.join(", ") : String(count);
58
+ }
59
+
60
+ /** `TRY/USD stale · oldest rate TRY/USD 2026-11-12 03:49 UTC`: each pair named, as a footer has room for, else counted. */
40
61
  export function fxStatusLabel(status: FxRateStatus): string {
41
62
  const parts: string[] = [];
42
- if (status.unavailable) parts.push(`${status.unavailable} unavailable`);
43
- if (status.stale) parts.push(`${status.stale} stale`);
63
+ if (status.unavailable) parts.push(`${pairsText(status.unavailable, status.unavailablePairs)} unavailable`);
64
+ if (status.stale) parts.push(`${pairsText(status.stale, status.stalePairs)} stale`);
44
65
  if (status.unknownTime) parts.push(`${status.unknownTime} rate ${status.unknownTime === 1 ? "time" : "times"} unknown`);
45
- if (status.oldestAsOf != null) parts.push(`oldest rate ${new Date(status.oldestAsOf).toISOString().slice(0, 16).replace("T", " ")} UTC`);
66
+ if (status.oldestAsOf != null) {
67
+ parts.push(`oldest rate ${status.oldestPair ? `${status.oldestPair} ` : ""}${new Date(status.oldestAsOf).toISOString().slice(0, 16).replace("T", " ")} UTC`);
68
+ }
46
69
  return parts.join(" · ");
47
70
  }
@@ -78,6 +78,29 @@ export function isNetworkFailure(error: unknown): boolean {
78
78
  return false;
79
79
  }
80
80
 
81
+ /** Codes of a connection that closed under a request: Node's and the system's, then Bun's. */
82
+ const DROPPED_CODES = new Set(["ECONNRESET", "ECONNABORTED", "EPIPE", "ConnectionClosed"]);
83
+
84
+ /**
85
+ * Whether a request failed because its connection closed under it (Bun's "The
86
+ * socket connection was closed unexpectedly"): what a server restarting, or a
87
+ * proxy moving to new servers, does to the requests caught on it, and asking
88
+ * again moments later reaches a server that answers. A refused connection, a
89
+ * timeout or an abort is not one: those say the service, or the network, is
90
+ * not there, and asking again at once would not change that.
91
+ */
92
+ export function isDroppedConnection(error: unknown): boolean {
93
+ if (error instanceof DataServiceUnreachableError) return false;
94
+ for (let current = error, depth = 0; current && typeof current === "object" && depth < 4; depth += 1) {
95
+ if (cameFromServer(current)) return false;
96
+ const { name, code } = current as { name?: unknown; code?: unknown };
97
+ if (name === "AbortError" || name === "TimeoutError") return false;
98
+ if (typeof code === "string" && DROPPED_CODES.has(code)) return true;
99
+ current = (current as { cause?: unknown }).cause;
100
+ }
101
+ return false;
102
+ }
103
+
81
104
  /** A network failure as `DataServiceUnreachableError`; anything else as it was. */
82
105
  export function asDataServiceFailure(error: unknown): unknown {
83
106
  return isNetworkFailure(error) && !(error instanceof DataServiceUnreachableError)