@gloom-sh/terminal 0.20.14 → 0.20.16

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 (144) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/index.ts +54 -0
  3. package/src/api-client/install-experiments.ts +8 -7
  4. package/src/api-client/paths.ts +2 -1
  5. package/src/api-client/product-waitlist.ts +63 -0
  6. package/src/api-client/request.ts +4 -2
  7. package/src/api-client/types/billing.ts +45 -0
  8. package/src/api-client/yearly-plan.ts +132 -0
  9. package/src/app/global-shortcuts.ts +5 -3
  10. package/src/app/pane-runtime/index.tsx +2 -2
  11. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  12. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  13. package/src/app/since-last-visit/keys.ts +26 -0
  14. package/src/app/since-last-visit/model.ts +266 -0
  15. package/src/app/since-last-visit/strip.tsx +193 -0
  16. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  17. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  18. package/src/app.tsx +15 -0
  19. package/src/cli/commands/market.ts +8 -4
  20. package/src/cli/commands/system.ts +29 -1
  21. package/src/cli/commands/ticker.ts +12 -5
  22. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  23. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  24. package/src/cli/desktop-pane-shot-view.ts +3 -7
  25. package/src/cli/desktop-pane-shot.ts +26 -28
  26. package/src/cli/help.ts +1 -0
  27. package/src/cli/history-rows.ts +24 -0
  28. package/src/cli/index.ts +4 -0
  29. package/src/cli/options.ts +29 -1
  30. package/src/cli/pane-functions/catalog.ts +41 -4
  31. package/src/cli/pane-functions/function-help.ts +1 -1
  32. package/src/cli/pane-functions/headless.ts +63 -1
  33. package/src/cli/pane-functions/index.ts +2 -2
  34. package/src/cli/pane-functions/resolver.ts +43 -0
  35. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  36. package/src/cli/report-tables.ts +20 -5
  37. package/src/cli/shot-temp-dir.ts +30 -0
  38. package/src/cli/suffixed-listing-rows.ts +11 -0
  39. package/src/components/chart/composite/composite-chart.tsx +3 -3
  40. package/src/components/command-bar/commands/direct/index.ts +31 -8
  41. package/src/components/command-bar/commands/registry.ts +7 -0
  42. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  43. package/src/components/command-bar/routes/root/results.ts +16 -0
  44. package/src/components/company-logo.tsx +10 -3
  45. package/src/components/data-table/sections.ts +6 -1
  46. package/src/components/layout/pane/title.ts +6 -2
  47. package/src/components/layout/shell/index.tsx +5 -1
  48. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  49. package/src/components/ticker/badge/format.ts +12 -3
  50. package/src/components/ticker/badge/index.tsx +9 -3
  51. package/src/components/ticker/list-table-view.tsx +119 -17
  52. package/src/components/ui/data-table/display-columns.ts +16 -0
  53. package/src/components/ui/data-table/index.tsx +40 -9
  54. package/src/components/ui/data-table/types.ts +14 -0
  55. package/src/core/state/app/layout-reducer.ts +3 -1
  56. package/src/core/state/app/layout.ts +2 -2
  57. package/src/data/config/layout.ts +14 -0
  58. package/src/data/config/store/normalize.ts +11 -1
  59. package/src/i18n/es.ts +38 -0
  60. package/src/i18n/ja.ts +38 -0
  61. package/src/i18n/ko.ts +38 -0
  62. package/src/i18n/zh-cn.ts +38 -0
  63. package/src/i18n/zh-tw.ts +38 -0
  64. package/src/layout/pane-follow.ts +141 -4
  65. package/src/layout/pane-layout-move.ts +10 -7
  66. package/src/layout/ticker-navigation.ts +13 -19
  67. package/src/layout/ticker-retarget.ts +3 -2
  68. package/src/market-data/market/index-level.ts +19 -0
  69. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  70. package/src/plugins/builtin/account-management/model.ts +2 -0
  71. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  72. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  73. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  74. package/src/plugins/builtin/awards/pane.tsx +6 -8
  75. package/src/plugins/builtin/changelog/index.tsx +6 -44
  76. package/src/plugins/builtin/changelog/versions.ts +17 -68
  77. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  78. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  79. package/src/plugins/builtin/cpi/pane.tsx +1 -1
  80. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  81. package/src/plugins/builtin/earnings/board-table.ts +1 -1
  82. package/src/plugins/builtin/earnings/board.tsx +36 -16
  83. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  84. package/src/plugins/builtin/earnings/history-table.ts +1 -1
  85. package/src/plugins/builtin/earnings/index.tsx +1 -1
  86. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  87. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  88. package/src/plugins/builtin/exposure/index.tsx +1 -1
  89. package/src/plugins/builtin/macro-day/model.ts +6 -4
  90. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  91. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  92. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  93. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  94. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  95. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  96. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  97. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
  98. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  99. package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
  100. package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
  101. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  102. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  103. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  104. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  105. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  106. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  107. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  108. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  109. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  110. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  111. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  112. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  113. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  114. package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
  115. package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
  116. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  117. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  118. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  119. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  120. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  121. package/src/portfolio/column-values.ts +20 -8
  122. package/src/portfolio/suffixed-listings.ts +3 -1
  123. package/src/portfolio/watchlist-groups.ts +212 -0
  124. package/src/react/ticker-source.ts +3 -1
  125. package/src/renderers/dom/styles.css +7 -0
  126. package/src/state/app/bootstrap.ts +11 -0
  127. package/src/state/app/context/index.tsx +6 -0
  128. package/src/sync/collections-contributor.ts +5 -2
  129. package/src/sync/config-merge.ts +10 -2
  130. package/src/sync/sanitize.ts +28 -0
  131. package/src/telemetry/usage-counts.ts +17 -0
  132. package/src/time-series/chart-seed.ts +1 -1
  133. package/src/time-series/financial-period-coverage.ts +4 -12
  134. package/src/time-series/parsed-history-cache.ts +1 -1
  135. package/src/time-series/resolve.ts +1 -1
  136. package/src/time-series/use-chart-resolution.ts +6 -1
  137. package/src/types/config.ts +32 -0
  138. package/src/types/headless.ts +5 -0
  139. package/src/types/plugin-context.ts +5 -0
  140. package/src/types/ticker.ts +14 -0
  141. package/src/ui/ascii-font.ts +1 -4
  142. package/src/utils/async-deadline.ts +2 -2
  143. package/src/utils/csv.ts +44 -5
  144. package/src/utils/futures-generic.ts +3 -0
@@ -59,9 +59,10 @@ import { apiClient } from "../../api-client";
59
59
  import { withBalanceSheetRate } from "../../market-data/quotes/balance-sheet-rate";
60
60
  import { enterpriseValueBridgeNote, listingEnterpriseValue } from "../../market-data/quotes/listing-enterprise-value";
61
61
  import { regularSessionValuationPrice } from "../../market-data/quotes/regular-session-valuation";
62
+ import { quoteStatsBasisText } from "../../market-data/quotes/export-identity";
62
63
  import { computeTickerPriceReturns } from "../../market-data/ticker-price-returns";
63
64
  import { instrumentTypeLabel, resolveTickerInstrumentKind } from "../../tickers/instrument-kind";
64
- import { INDEX_POINTS_LABEL, isIndexLevel, reportedQuoteVolume } from "../../market-data/market/index-level";
65
+ import { INDEX_POINTS_LABEL, isIndexLevel, quoteVolumeCurrency, reportedQuoteVolume } from "../../market-data/market/index-level";
65
66
  import type { SecFilingItem } from "../../types/data-provider";
66
67
  import type { NewsArticle } from "../../news/types";
67
68
  import { summaryRestatesHeadline } from "../../news/news-model";
@@ -1479,8 +1480,14 @@ export async function buildTickerReport({
1479
1480
  )
1480
1481
  : "—";
1481
1482
  const volume = reportedQuoteVolume(quote);
1482
- // A coin's volume is traded value in its quote currency (BTC-USD: US dollars), not a count of coins.
1483
- const volumeCurrency = quote.currency && isRoundTheClockCoin(quote.symbol ?? symbol, quote.exchangeName) ? ` ${quote.currency}` : "";
1483
+ // A coin's volume is traded value in its quote currency (BTC-USD: US dollars), not a count of coins, and its
1484
+ // range and volume say whose day they are (composite, 1 exchange), as the Overview's do.
1485
+ const volumeCurrency = quoteVolumeCurrency(quote, symbol);
1486
+ const coinBasis = (range: boolean) => {
1487
+ const basis = quoteStatsBasisText(quote, range);
1488
+ return basis ? ` (${basis})` : "";
1489
+ };
1490
+ const rangeBasis = consolidatedRangeBasis(quote);
1484
1491
  // A futures price is its latest trade; the exchange settlement is its own row, dated by its session.
1485
1492
  appendMetricSection(lines, "Quote", [
1486
1493
  // A price in cents says what it is per: 314.95¢/lb.
@@ -1496,7 +1503,7 @@ export async function buildTickerReport({
1496
1503
  // A listing that no longer trades: its last session's range, never today's. A US line's says what it counts,
1497
1504
  // the rule GIP and TAS read the session's low and high by.
1498
1505
  [quote.delisting ? "Last Session" : "Day Range", quote.low != null || quote.high != null
1499
- ? `${formatPriceRange(quote.low, quote.high, quote.currency, quoteOptions)}${consolidatedRangeBasis(quote) ? ` (${consolidatedRangeBasis(quote)})` : ""}`
1506
+ ? `${formatPriceRange(quote.low, quote.high, quote.currency, quoteOptions)}${rangeBasis ? ` (${rangeBasis})` : coinBasis(true)}`
1500
1507
  : "—"],
1501
1508
  // The year's high and low come from bars (a continuous future's are float32, 54.97999954): they print at
1502
1509
  // the instrument's own decimals, as the Overview's ranges do, never at every digit the bars carry.
@@ -1504,7 +1511,7 @@ export async function buildTickerReport({
1504
1511
  ["52W Range", yearRangeText(quote, quoteOptions)],
1505
1512
  ["Bid / Ask", bidAskText(quote, quoteOptions)],
1506
1513
  // An index's and a perpetual's 0 means none is counted, not no trades: no Volume row.
1507
- ["Volume", volume != null ? `${formatNumber(volume, 0)}${volumeCurrency}` : "—"],
1514
+ ["Volume", volume != null ? `${formatNumber(volume, 0)}${volumeCurrency ? ` ${volumeCurrency}` : ""}${coinBasis(false)}` : "—"],
1508
1515
  ["Updated", formatTimestamp(quoteHeadlineTime(quote))],
1509
1516
  ]);
1510
1517
 
@@ -18,12 +18,15 @@ const AUTH_IN_FAMILY = /^\/cloud\/auth(?:\/|$)/;
18
18
  * theses, and a signed-in broker's catalog, connection status, holdings,
19
19
  * orders and fills. The Buildout plan is one: its answer is the plan and its
20
20
  * prices, never the token `POST /account/buildout/token` mints, which stays
21
- * refused, so the Buildout panes cannot be drawn with a plan's data.
21
+ * refused, so the Buildout panes cannot be drawn with a plan's data. So is
22
+ * the account's place on an add-on waitlist (joined or not); joining and
23
+ * leaving are writes, refused like any other.
22
24
  */
23
25
  const READ_PATHS = [
24
26
  /^\/auth\/get-session$/,
25
27
  /^\/account\/cloud$/,
26
28
  /^\/account\/buildout$/,
29
+ /^\/account\/waitlist\/[a-z0-9-]+$/,
27
30
  /^\/pricing$/,
28
31
  /^\/health$/,
29
32
  /^\/roadmap$/,
@@ -357,7 +357,8 @@ async function startShotBrowser(
357
357
  }
358
358
  throw error;
359
359
  }
360
- const { targetId } = await connection.send("Target.createTarget", { url: "about:blank" }) as { targetId: string };
360
+ const { browserContextId } = await connection.send("Target.createBrowserContext", { disposeOnDetach: true }) as { browserContextId: string };
361
+ const { targetId } = await connection.send("Target.createTarget", { url: "about:blank", browserContextId }) as { targetId: string };
361
362
  const { sessionId } = await connection.send("Target.attachToTarget", { targetId, flatten: true }) as { sessionId: string };
362
363
  const page: CdpPage = { send: (method, params) => connection.send(method, params, sessionId) };
363
364
  return {
@@ -1,8 +1,7 @@
1
1
  import { existsSync } from "fs";
2
- import { mkdtemp, rm } from "fs/promises";
3
- import { tmpdir } from "os";
4
2
  import { join } from "path";
5
3
  import { buildViewBundle, electrobunViewPath, readViewStylesheet } from "../renderers/dom/build-assets";
4
+ import { withShotTempDir } from "./shot-temp-dir";
6
5
 
7
6
  /**
8
7
  * The page `shot` and rendered `fn` reports draw a pane in: the view bundle,
@@ -90,13 +89,10 @@ async function unpackShotView(archivePath: string): Promise<ShotViewFiles> {
90
89
  async function buildShotViewFromSource(): Promise<ShotViewFiles> {
91
90
  // A bundle of the CLI without its sources, and without the page embedded.
92
91
  if (!existsSync(electrobunViewPath(SHOT_VIEW_ENTRY))) throw new Error(MISSING_VIEW_MESSAGE);
93
- const dir = await mkdtemp(join(tmpdir(), "gloom-pane-shot-view-"));
94
- try {
92
+ return withShotTempDir("gloom-pane-shot-view-", async (dir) => {
95
93
  await buildShotView(dir, process.env.GLOOMBERB_API_URL ?? "");
96
94
  return completeShotView(await readShotViewDir(dir));
97
- } finally {
98
- await rm(dir, { recursive: true, force: true });
99
- }
95
+ });
100
96
  }
101
97
 
102
98
  /**
@@ -1,10 +1,9 @@
1
1
  import type { ScannerCapture } from "../plugins/builtin/shared/scanner-capture";
2
2
  import type { TapeCapture } from "../plugins/builtin/time-sales/snapshot-client";
3
- import { mkdtemp, rm } from "fs/promises";
4
3
  import { randomBytes, timingSafeEqual } from "crypto";
5
- import { tmpdir } from "os";
6
4
  import { join } from "path";
7
5
  import { writeOutputFile } from "./output-file";
6
+ import { withShotTempDir } from "./shot-temp-dir";
8
7
  import { encodeRpcValue } from "../renderers/electrobun/shared/rpc-codec";
9
8
  import type { AppConfig } from "../types/config";
10
9
  import type { ChartResolutionResult } from "../time-series/types";
@@ -272,32 +271,31 @@ export async function renderDesktopPaneScreenshot(
272
271
  ): Promise<DesktopPaneShotRenderResult> {
273
272
  const chrome = await findChromeExecutable();
274
273
  const view = await loadShotView();
275
- const tempDir = await mkdtemp(join(tmpdir(), "gloom-pane-shot-"));
276
- let server: ShotServer | null = null;
277
- try {
278
- server = serveShotPage(view, shotPageHtml(view, payload), apiProxy, options.bridge ?? null);
279
- return await capturePageScreenshot({
280
- chrome,
281
- url: server.url,
282
- outputPath,
283
- widthPx: payload.widthPx,
284
- heightPx: payload.heightPx,
285
- deviceScaleFactor: payload.deviceScaleFactor ?? DEFAULT_DEVICE_SCALE_FACTOR,
286
- userDataDir: join(tempDir, "chrome-profile"),
287
- captureImage: options.captureImage !== false,
288
- statusLine: payload.statusLine ? options.statusLine : undefined,
289
- ...(payload.maxHeightCells ? {
290
- fitRows: {
291
- heightCells: payload.heightCells,
292
- maxHeightCells: payload.maxHeightCells,
293
- roles: payload.fitRoles ?? ["data-table-body-scroll"],
294
- },
295
- } : {}),
296
- });
297
- } finally {
298
- server?.stop();
299
- await rm(tempDir, { recursive: true, force: true });
300
- }
274
+ return withShotTempDir("gloom-pane-shot-", async (tempDir) => {
275
+ const server = serveShotPage(view, shotPageHtml(view, payload), apiProxy, options.bridge ?? null);
276
+ try {
277
+ return await capturePageScreenshot({
278
+ chrome,
279
+ url: server.url,
280
+ outputPath,
281
+ widthPx: payload.widthPx,
282
+ heightPx: payload.heightPx,
283
+ deviceScaleFactor: payload.deviceScaleFactor ?? DEFAULT_DEVICE_SCALE_FACTOR,
284
+ userDataDir: join(tempDir, "chrome-profile"),
285
+ captureImage: options.captureImage !== false,
286
+ statusLine: payload.statusLine ? options.statusLine : undefined,
287
+ ...(payload.maxHeightCells ? {
288
+ fitRows: {
289
+ heightCells: payload.heightCells,
290
+ maxHeightCells: payload.maxHeightCells,
291
+ roles: payload.fitRoles ?? ["data-table-body-scroll"],
292
+ },
293
+ } : {}),
294
+ });
295
+ } finally {
296
+ server.stop();
297
+ }
298
+ });
301
299
  }
302
300
 
303
301
  /** The page for one capture: the shared view, with this capture's pane and data in its bootstrap script. */
package/src/cli/help.ts CHANGED
@@ -48,6 +48,7 @@ const GLOBAL_OPTIONS: Array<[string, string]> = [
48
48
  ["--csv", "Print rows as CSV under the columns the text shows; each row ends with what it is, its source, as_of and retrieved_at (when it was read), then any columns a report adds (a formula's leg contracts, a board's Group), and fn reports and fundamentals put each table under # section:. The closing source and note lines go to stderr, not into the rows or an --output file"],
49
49
  ["--ndjson", "Print one JSON object per table row"],
50
50
  ["--output <path>, --out <path>", "Write a --csv, --json or --ndjson export to this file in UTF-8, and print where it went (a redirect is UTF-16 in Windows PowerShell 5.1)"],
51
+ ["--decimal comma|dot", "Write a --csv export's numbers with a decimal comma (17,2), cells split by ;, for a spreadsheet in a decimal-comma locale; or a dot. gloom config set csvDecimal comma makes the comma the default. Text and JSON keep the dot"],
51
52
  ["--limit <n>", "Show at most n rows, the first n as printed"],
52
53
  ["--tail <n>", "Show the newest n rows of a dated series (history, fred, econ) in their printed order, or the last n of another list"],
53
54
  ["--refresh", "Fetch fresh data instead of reading the cache"],
@@ -493,6 +493,30 @@ export function historyRows(
493
493
  });
494
494
  }
495
495
 
496
+ /** Bars a volume step is read from, how many of them must have one, and the newest bars that may differ from it. */
497
+ const VOLUME_STEP_BARS = 20;
498
+ const VOLUME_STEP_MIN_BARS = 5;
499
+ const VOLUME_STEP_NEWEST = 2;
500
+
501
+ /**
502
+ * The volumes a text table prints at the step the rest of the column is in, by bar date: daily or longer bars whose
503
+ * source serves volume in whole hundreds (round lots) and the newest one or two as exact counts (the session's own
504
+ * feed) print those at the hundred too, so the column reads at one precision, never 6,764,700 above 4,650,114.
505
+ * Only the text rounds: the rows, `--json` and `--csv` keep every count as served. Empty for bars of another step
506
+ * and for intraday bars.
507
+ */
508
+ export function historyTextVolumes(rows: ReadonlyArray<{ date: string; volume: number | null }>, intraday: boolean): Map<string, number> {
509
+ const shown = new Map<string, number>();
510
+ if (intraday) return shown;
511
+ const recent = rows.slice(-VOLUME_STEP_BARS);
512
+ const older = recent.slice(0, -VOLUME_STEP_NEWEST).flatMap((row) => row.volume != null && row.volume > 0 ? [row.volume] : []);
513
+ if (older.length < VOLUME_STEP_MIN_BARS || !older.every((volume) => volume % 100 === 0)) return shown;
514
+ for (const row of rows.slice(-VOLUME_STEP_NEWEST)) {
515
+ if (row.volume != null && row.volume % 100 !== 0) shown.set(row.date, Math.round(row.volume / 100) * 100);
516
+ }
517
+ return shown;
518
+ }
519
+
496
520
  /** Bars on each side of a bar whose volumes it is held against. */
497
521
  const THIN_NEIGHBOURS = 5;
498
522
  /** A bar under this share of its neighbours' median volume traded thin. */
package/src/cli/index.ts CHANGED
@@ -28,6 +28,7 @@ import { CLI_EXIT_CODES } from "./exit-codes";
28
28
  import { asUsageError, fail, inferCliErrorOptions, printCliError } from "./errors";
29
29
  import { cliStyles, setCliColorEnabledOverride, setCliPlainOverride, setCliWidthOverride } from "../utils/cli-output";
30
30
  import { setDisplayTimeZone } from "../utils/utc-time";
31
+ import { setCsvDecimal } from "../utils/csv";
31
32
  import { collectSavedCopies } from "../data/saved-copies";
32
33
  import { search, searchCandidatesForCli, buildSearchReport } from "./commands/search";
33
34
  import { ticker } from "./commands/ticker";
@@ -398,6 +399,8 @@ async function createRegistry(options: DispatchCliOptions = {}): Promise<CliComm
398
399
  const config = await loadCliConfigIfAvailable();
399
400
  // Every time a command prints follows the reader's zone from here on.
400
401
  setDisplayTimeZone(config?.timezone);
402
+ // Every CSV is written with the reader's decimal mark from here on; --decimal decides for one run.
403
+ setCsvDecimal(config?.csvDecimal);
401
404
  let registry: CliCommandRegistry | null = null;
402
405
  const coreCommands = createCoreCliCommands(
403
406
  () => listedCommands(registry!).map(({ command, source }) => ({ command, source })),
@@ -435,6 +438,7 @@ export async function dispatchCli(args: string[], options: DispatchCliOptions =
435
438
  }
436
439
 
437
440
  const registry = await createRegistry(options);
441
+ if (parsed.options.decimal) setCsvDecimal(parsed.options.decimal);
438
442
  const token = normalizeCliCommandToken(foldTypedText(command));
439
443
  let resolved = registry.lookup.get(token);
440
444
  if (!resolved) {
@@ -1,3 +1,4 @@
1
+ import type { CsvDecimal } from "../utils/csv";
1
2
  export type CliOutputFormat = "text" | "json" | "csv" | "ndjson";
2
3
 
3
4
  export interface CliGlobalOptions {
@@ -27,6 +28,12 @@ export interface CliGlobalOptions {
27
28
  * `--output` read the flag themselves.
28
29
  */
29
30
  output?: string;
31
+ /**
32
+ * `--decimal comma|dot`: the decimal mark of a `--csv` export, for this run.
33
+ * A decimal comma separates the cells with `;`. Unset, the `csvDecimal`
34
+ * setting decides, and without it the dot.
35
+ */
36
+ decimal?: CsvDecimal;
30
37
  }
31
38
 
32
39
  export interface ParsedCliArgs {
@@ -75,6 +82,14 @@ function parseColumnCount(value: string | undefined): number {
75
82
  return parsed;
76
83
  }
77
84
 
85
+ /** The decimal mark `--decimal` names: `comma` (or `,`), or `dot` (`.`, `point`). */
86
+ export function parseCsvDecimal(value: string | undefined, flag = "--decimal"): CsvDecimal {
87
+ const word = value?.trim().toLowerCase();
88
+ if (word === "comma" || word === ",") return "comma";
89
+ if (word === "dot" || word === "." || word === "point" || word === "period") return "dot";
90
+ throw new Error(`${flag} takes comma or dot: --csv --decimal comma writes 17,2 with cells split by ;, for a spreadsheet that reads a decimal comma.`);
91
+ }
92
+
78
93
  function parseOutputFile(value: string | undefined): string {
79
94
  if (!value?.trim() || value.startsWith("--")) throw new Error("--output needs a file to write, such as --csv --output report.csv.");
80
95
  return value;
@@ -85,7 +100,7 @@ function commandWord(rawArgs: readonly string[]): string | undefined {
85
100
  for (let index = 0; index < rawArgs.length; index += 1) {
86
101
  const arg = rawArgs[index]!;
87
102
  if (arg === "--") return rawArgs[index + 1];
88
- if (arg === "--limit" || arg === "--tail" || arg === "--width" || arg === "--output" || arg === "--out") index += 1;
103
+ if (arg === "--limit" || arg === "--tail" || arg === "--width" || arg === "--output" || arg === "--out" || arg === "--decimal") index += 1;
89
104
  else if (!arg.startsWith("-")) return arg;
90
105
  }
91
106
  return undefined;
@@ -183,6 +198,15 @@ export function parseCliGlobalArgs(rawArgs: string[], settings: { ownsOutput?: b
183
198
  options.output = parseOutputFile(arg.slice(arg.indexOf("=") + 1));
184
199
  continue;
185
200
  }
201
+ if (arg === "--decimal") {
202
+ index += 1;
203
+ options.decimal = parseCsvDecimal(rawArgs[index]);
204
+ continue;
205
+ }
206
+ if (arg.startsWith("--decimal=")) {
207
+ options.decimal = parseCsvDecimal(arg.slice("--decimal=".length));
208
+ continue;
209
+ }
186
210
  if (arg === "--limit" || arg === "--tail") {
187
211
  index += 1;
188
212
  options[arg === "--limit" ? "limit" : "tail"] = parseRowCount(arg, rawArgs[index]);
@@ -212,4 +236,8 @@ export function checkCliOutputFormat(parsed: Pick<ParsedCliArgs, "options" | "he
212
236
  if (parsed.options.output !== undefined && parsed.options.format === "text" && !parsed.help) {
213
237
  throw new Error("--output writes an export: add --csv, --json or --ndjson, such as --csv --output report.csv.");
214
238
  }
239
+ // The text a terminal prints and JSON's numbers keep their dot: only a CSV is read by a spreadsheet's locale.
240
+ if (parsed.options.decimal !== undefined && parsed.options.format !== "csv" && !parsed.help) {
241
+ throw new Error("--decimal sets the decimal mark of a CSV export: add --csv, such as --csv --decimal comma.");
242
+ }
215
243
  }
@@ -14,6 +14,7 @@ import {
14
14
  getPaneFunctionCapability,
15
15
  MAX_INLINE_CHOICES,
16
16
  optionChoices,
17
+ optionFlag,
17
18
  optionFlags,
18
19
  paneFunctionArgument,
19
20
  type PaneFunctionCapability,
@@ -539,6 +540,9 @@ function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string): CatalogM
539
540
  ].filter((value): value is string => !!value).map((value) => normalizeLookupToken(value));
540
541
  const flagKeys = entry.capability.options
541
542
  .flatMap((option) => [option.key, ...(option.aliases ?? [])]).map((value) => normalizeLookupToken(value));
543
+ // A value one of its options takes names the function as a flag's own name does: `compounders` is EQS's preset.
544
+ const flagValues = new Set(entry.capability.options.flatMap((option) => (option.values ?? [])
545
+ .flatMap((value) => [value.value, ...(value.aliases ?? [])])).map((value) => normalizeLookupToken(value)));
542
546
  const named = nameAndDescription(entry);
543
547
  const flags = flagText(entry);
544
548
  const wholeQuery = query.toLowerCase().trim().replace(/\s+/g, " ");
@@ -575,7 +579,7 @@ function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string): CatalogM
575
579
  } else if (normalized !== term && named.includes(normalized)) {
576
580
  score += 1;
577
581
  matchedNamed += 1;
578
- } else if (flagKeys.includes(normalized)) {
582
+ } else if (flagKeys.includes(normalized) || flagValues.has(normalized)) {
579
583
  score += 2;
580
584
  matchedFlagKeys += 1;
581
585
  } else if (containsPhrase(flags, term)) {
@@ -587,6 +591,9 @@ function scorePaneCatalogEntry(entry: PaneCatalogEntry, query: string): CatalogM
587
591
  }
588
592
 
589
593
  if (matchedTerms === 0) return none;
594
+ // The whole query a value an option takes (GF's `operating margin` metric) is a name the function answers to.
595
+ const valueNamed = terms.length > 1 && flagValues.has(normalizeLookupToken(wholeQuery));
596
+ if (valueNamed) matchedNamed = terms.length;
590
597
  // Words found only in a function's flags make a match when they are a flag's own name ("expiration") or,
591
598
  // together, cover the whole query ("funding rate" in two flags); one stray word in a flag's description
592
599
  // ("budget" in OSA's hedge budget) does not.
@@ -930,6 +937,30 @@ function renderCatalogEntry(entry: PaneCatalogEntry): string {
930
937
  return lines.join("\n");
931
938
  }
932
939
 
940
+ /**
941
+ * The command that runs a function with the option value a query names (`compounders` is EQS's `--preset
942
+ * compounders`), with the argument it needs first; null when the query is no value of its options.
943
+ */
944
+ function optionValueCommand(entry: PaneCatalogEntry, query: string): string | null {
945
+ const wanted = normalizeLookupToken(query);
946
+ if (!wanted) return null;
947
+ // A word that opens one case of the function (FA's `roic`) runs it with that case's options.
948
+ const opening = entry.capability.opens?.find((candidate) => candidate.words.some((word) => normalizeLookupToken(word) === wanted));
949
+ if (opening?.options && Object.keys(opening.options).length > 0) {
950
+ const argument = opening.argument || argumentHint(entry);
951
+ const flags = Object.entries(opening.options).map(([key, value]) => `${optionFlag(key)} ${value}`).join(" ");
952
+ return `gloom fn ${entry.token}${argument ? ` ${argument}` : ""} ${flags}`;
953
+ }
954
+ for (const option of entry.capability.options) {
955
+ const value = option.values?.find((candidate) => [candidate.value, ...(candidate.aliases ?? [])]
956
+ .some((name) => normalizeLookupToken(name) === wanted));
957
+ if (!value) continue;
958
+ const argument = argumentHint(entry);
959
+ return `gloom fn ${entry.token}${argument ? ` ${argument}` : ""} ${optionFlag(option.key)} ${value.value}`;
960
+ }
961
+ return null;
962
+ }
963
+
933
964
  /** The functions a search lists, one row each. */
934
965
  function renderMatchesTable(shown: readonly PaneCatalogEntry[]): string {
935
966
  return renderTable(
@@ -1025,9 +1056,12 @@ export function renderPaneCatalogReport(
1025
1056
  const withGap = (text: string) => withSetting([gap ? wrapText(gap, width).join("\n") : "", text].filter(Boolean).join("\n\n"));
1026
1057
  const withTerms = (text: string) => withGap([text, charted, terms].filter(Boolean).join("\n\n"));
1027
1058
  if (args.query && entries.length === 1) {
1028
- // A function found only through a word of its description or keywords is the closest there is, and says so.
1029
- const closest = isClosestCatalogMatch(entries[0]!, args.query)
1030
- ? `${cliStyles.muted(`Closest match for "${args.query.trim()}": no function is named for it.`)}\n\n` : "";
1059
+ // A value of one of its options (EQS's `compounders` preset) is run with that option; a function found only
1060
+ // through a word of its description or keywords is the closest there is, and says so.
1061
+ const run = optionValueCommand(entries[0]!, args.query);
1062
+ const closest = run ? `${cliStyles.muted(`"${args.query.trim()}": ${run}`)}\n\n`
1063
+ : isClosestCatalogMatch(entries[0]!, args.query)
1064
+ ? `${cliStyles.muted(`Closest match for "${args.query.trim()}": no function is named for it.`)}\n\n` : "";
1031
1065
  return withTerms(`${closest}${renderCatalogEntry(entries[0]!)}`);
1032
1066
  }
1033
1067
 
@@ -1049,10 +1083,13 @@ export function renderPaneCatalogReport(
1049
1083
  const more = args.query
1050
1084
  ? `${hidden} more ${hidden === 1 ? "match" : "matches"}: refine the query, or add --all to list every match.`
1051
1085
  : `Add --all to list all ${entries.length}.`;
1086
+ // The functions that take the query as an option's value, with the command that runs them on it.
1087
+ const runs = args.query ? shown.flatMap((entry) => optionValueCommand(entry, args.query) ?? []).slice(0, 3) : [];
1052
1088
  const lines = [
1053
1089
  `${renderSection(title)} ${cliStyles.muted(`(${count})`)}`,
1054
1090
  renderMatchesTable(shown),
1055
1091
  "",
1092
+ ...runs.length > 0 ? [note(`"${args.query.trim()}": ${runs.join("; ")}`)] : [],
1056
1093
  note([
1057
1094
  loose ? "No function carries every word of the query; these are the closest." : "",
1058
1095
  "gloom catalog <function> shows its options and examples.",
@@ -411,7 +411,7 @@ export const FUNCTION_HELP: Readonly<Record<string, FunctionHelp>> = {
411
411
  bloomberg: ["CACS"],
412
412
  },
413
413
  EVTS: {
414
- summary: "The market board: report days with implied and past moves, or a past or coming week or day of them; a ticker highlights its row.",
414
+ summary: "The market board: report days with implied and past moves. In the pane, a ticker opens its next report day, or its latest past one, with its row selected. An explicit week or day keeps that range.",
415
415
  usage: ["EVTS", "EVTS NVDA", "gloom fn EVTS --week last", "gloom fn EVTS --date 2026-10-15"],
416
416
  keys: [key("t", "icker"), key("e", "stimates"), key("c", "alls"), key("a", "nalysts")],
417
417
  data: EARNINGS_DAYS,
@@ -55,6 +55,7 @@ import { noArgumentMessage } from "./capabilities";
55
55
  import { lockedHeadlessReport } from "./lock-note";
56
56
  import { resumeStateKey } from "../../plugins/registry/plugin-state";
57
57
  import { logFailure } from "../../utils/log-failure";
58
+ import { windowRows, type RowWindow, type RowWindowOptions } from "../row-window";
58
59
 
59
60
  interface SerializableHeadlessColumn {
60
61
  key: string;
@@ -539,7 +540,11 @@ function seriesValue(series: HeadlessSeries, value: number | null): string {
539
540
  if (unit === "%" || unit === "pp") return value.toFixed(2);
540
541
  if (unit === "x" || unit === "ratio") return value !== 0 && Math.abs(value) < 0.1 ? value.toPrecision(3) : value.toFixed(2);
541
542
  if (unit === "score") return value.toFixed(1);
542
- return displayNumber(value);
543
+ // A count or amount of five digits or more groups its thousands as every other table does (27,256,037 shares).
544
+ const plain = displayNumber(value);
545
+ const [whole, fraction] = plain.split(".");
546
+ return Math.abs(value) >= 10_000 && /^-?\d+(?:\.\d+)?$/.test(plain)
547
+ ? `${whole!.replace(/\B(?=(\d{3})+$)/g, ",")}${fraction ? `.${fraction}` : ""}` : plain;
543
548
  }
544
549
 
545
550
  function renderRows(
@@ -1100,6 +1105,62 @@ function withUnreached(
1100
1105
  return nothingServed && unreached ? { ...freshness, unreached: true } : freshness;
1101
1106
  }
1102
1107
 
1108
+ /** What a cut says: which rows of how many it kept, and of which table when the report has several. */
1109
+ function cutNote(window: RowWindowOptions, cut: RowWindow<unknown>, table?: string): string | null {
1110
+ if (cut.rows.length >= cut.total) return null;
1111
+ const kept = `${window.tail != null ? (cut.kept === "newest" ? "newest" : "last") : "first"} ${cut.rows.length} of ${cut.total} rows`;
1112
+ return `${table ? `${table}: ` : ""}${cut.note ?? `${kept} (--${window.tail != null ? "tail" : "limit"} ${window.tail ?? window.limit})`}`;
1113
+ }
1114
+
1115
+ /**
1116
+ * The report's rows as `--limit` and `--tail` keep them, for a function with no option of its own for them
1117
+ * (`fn CTM CL --limit 3`): the first or last n of each table, of a series' points the oldest or newest n, as every
1118
+ * command that prints a list keeps them; the notes say what was cut.
1119
+ */
1120
+ function windowHeadlessResult(shape: HeadlessPaneDefinition["shape"], result: HeadlessPaneResult, window: RowWindowOptions): HeadlessPaneResult {
1121
+ const notes: string[] = [];
1122
+ const cut = <Row,>(rows: readonly Row[], table?: string, dateOf?: (row: Row) => unknown): Row[] => {
1123
+ const kept = windowRows(rows, window, dateOf);
1124
+ const note = cutNote(window, kept, table);
1125
+ if (note) notes.push(note);
1126
+ return kept.rows;
1127
+ };
1128
+ const quiet = <Row,>(rows: readonly Row[] | undefined) => rows ? windowRows(rows, window).rows : undefined;
1129
+ let windowed: HeadlessPaneResult;
1130
+ switch (shape) {
1131
+ case "rows": {
1132
+ const rows = result as HeadlessRowsResult;
1133
+ windowed = { ...rows, rows: cut(rows.rows), ...(rows.textRows ? { textRows: quiet(rows.textRows)! } : {}) };
1134
+ break;
1135
+ }
1136
+ case "bundle": {
1137
+ const bundle = result as HeadlessBundleResult;
1138
+ const several = bundle.sections.filter((section) => section.rows).length > 1;
1139
+ windowed = { ...bundle, sections: bundle.sections.map((section) => !section.rows ? section : {
1140
+ ...section, rows: cut(section.rows, several ? section.title : undefined), ...(section.textRows ? { textRows: quiet(section.textRows)! } : {}),
1141
+ }) };
1142
+ break;
1143
+ }
1144
+ case "series": {
1145
+ const series = result as HeadlessSeriesResult;
1146
+ windowed = { ...series, series: series.series.map((entry) => ({
1147
+ ...entry, points: cut(entry.points, series.series.length > 1 ? entry.label : undefined, (point) => point.date),
1148
+ })) };
1149
+ break;
1150
+ }
1151
+ case "snapshot": {
1152
+ const snapshot = result as HeadlessSnapshotResult;
1153
+ windowed = { ...snapshot, items: cut(snapshot.items) };
1154
+ break;
1155
+ }
1156
+ default: {
1157
+ const _exhaustive: never = shape;
1158
+ return _exhaustive;
1159
+ }
1160
+ }
1161
+ return notes.length > 0 ? { ...windowed, notes: [...windowed.notes ?? [], ...notes] } : windowed;
1162
+ }
1163
+
1103
1164
  export async function buildHeadlessFunctionReport(
1104
1165
  resolved: ResolvedPaneFunction,
1105
1166
  context: MarketContext,
@@ -1108,6 +1169,7 @@ export async function buildHeadlessFunctionReport(
1108
1169
  let loaded: LoadedHeadlessPaneModel;
1109
1170
  try {
1110
1171
  loaded = await loadResolvedHeadlessPaneModel(resolved, context, rawArgument);
1172
+ if (resolved.rowWindow) loaded = { ...loaded, result: windowHeadlessResult(loaded.definition.shape, loaded.result, resolved.rowWindow) };
1111
1173
  } catch (error) {
1112
1174
  // A Pro pane the server refused reports what its wall covers, as its rendered view does.
1113
1175
  const locked = await lockedHeadlessReport(resolved, error, () => (
@@ -75,7 +75,7 @@ async function withPaneRuntime<T>(
75
75
  registry: PaneFunctionCatalog;
76
76
  resolved: ResolvedPaneFunction;
77
77
  }) => Promise<T>,
78
- settings: { strictHeadlessOptions?: boolean; tableSection?: boolean; command?: "fn" | "shot" } = {},
78
+ settings: { strictHeadlessOptions?: boolean; tableSection?: boolean; rowWindow?: boolean; command?: "fn" | "shot" } = {},
79
79
  ): Promise<T> {
80
80
  return withMarketData(ctx, async (market) => {
81
81
  const context: MarketContext = ctx.cliOptions.refresh ? { ...market, refresh: true } : market;
@@ -485,7 +485,7 @@ export async function runPaneFunction(args: string[], ctx: CliCommandContext) {
485
485
  }
486
486
  ctx.printResult(result, render);
487
487
  if (failure) process.exitCode = CLI_EXIT_CODES.error;
488
- }, { strictHeadlessOptions: true, tableSection: true });
488
+ }, { strictHeadlessOptions: true, tableSection: true, rowWindow: true });
489
489
  });
490
490
  }
491
491
 
@@ -1,3 +1,4 @@
1
+ import type { RowWindowOptions } from "../row-window";
1
2
  import { logFailure } from "../../utils/log-failure";
2
3
  import type { PaneInstanceConfig } from "../../types/config";
3
4
  import { CHART_COMPOSER_PANE_ID } from "../../types/config";
@@ -79,6 +80,11 @@ export interface ResolvedPaneFunction {
79
80
  optionSettings: Record<string, unknown>;
80
81
  capability: PaneFunctionCapability;
81
82
  options: NormalizedPaneFunctionOptions;
83
+ /**
84
+ * `--limit` and `--tail` of a report whose function takes no such option of its own: the rows the report keeps,
85
+ * as every command that prints a list keeps them (row-window).
86
+ */
87
+ rowWindow?: RowWindowOptions;
82
88
  /** `--section` of a report: the table `--csv` and `--ndjson` write, when the function has no `section` option of its own. */
83
89
  tableSection?: string | true;
84
90
  }
@@ -510,6 +516,8 @@ export async function resolvePaneFunction(
510
516
  resolutionSettings: {
511
517
  strictHeadlessOptions?: boolean;
512
518
  tableSection?: boolean;
519
+ /** `fn`: a `--limit` or `--tail` the function takes no option for picks the report's rows (`rowWindow`). */
520
+ rowWindow?: boolean;
513
521
  command?: "fn" | "shot";
514
522
  /** The plugins whose catalog series a name that opens nothing is pointed at. */
515
523
  seriesSources?: readonly SeriesSource[];
@@ -533,6 +541,14 @@ export async function resolvePaneFunction(
533
541
  throw new Error(`Template "${template?.id}" points at missing pane "${template?.paneId}".`);
534
542
  }
535
543
  const headless = getHeadlessPaneDefinition(template, pane);
544
+ // A report that reads a list for a pane that shows one ticker (FA, INS): a capture of the list is refused with
545
+ // both commands, rather than read as one ticker named by the whole list.
546
+ const asked = argumentSymbols(args.arg ?? "");
547
+ if (resolutionSettings.command === "shot" && headless?.argument.kind === "tickers" && template?.shortcut?.argKind === "ticker"
548
+ && !template.opensTickerList && asked.length > 1) {
549
+ const code = paneFunctionCode(template, pane, registry);
550
+ throw new Error(`${code}'s pane shows one ticker: gloom shot ${code} ${asked[0]}. Its report reads all ${asked.length} in one table: gloom fn ${code} ${asked.join(" ")}`);
551
+ }
536
552
  const createOptions = withTickerList(template, buildCreateOptions(template, args.arg), headless, args.arg, paneFunctionCode(template, pane, registry));
537
553
  const capability = getPaneFunctionCapability(template, pane);
538
554
  let tableSection: string | true | undefined;
@@ -554,6 +570,9 @@ export async function resolvePaneFunction(
554
570
  if (bank) throw new UnknownPaneFunctionError(args.target, bank.details, null, bank.message);
555
571
  throw new Error(noArgumentMessage(capability.options, token, args.arg, resolutionSettings.command ?? "fn"));
556
572
  }
573
+ // `--limit` and `--tail` are global options: a report whose function has none of its own keeps the rows they say.
574
+ const rowWindow = resolutionSettings.rowWindow ? reportRowWindow(capability, args.options) : null;
575
+ if (rowWindow) args = { ...args, options: rowWindow.options };
557
576
  const normalizedOptions = normalizeCapabilityOptions(capability, args.options, {
558
577
  strict: args.requireBotSafe || capability.strictOptions === true || (!!headless && resolutionSettings.strictHeadlessOptions === true),
559
578
  code: token,
@@ -580,12 +599,36 @@ export async function resolvePaneFunction(
580
599
  optionSettings: settings,
581
600
  capability,
582
601
  options: normalizedOptions,
602
+ ...(rowWindow ? { rowWindow: rowWindow.window } : {}),
583
603
  ...(tableSection !== undefined ? { tableSection } : {}),
584
604
  };
585
605
  resolved.instance = await buildPaneInstance(resolved, context, args.arg, resolutionSettings.command ?? "fn");
586
606
  return resolved;
587
607
  }
588
608
 
609
+ /**
610
+ * The `--limit` and `--tail` a function with no option of that name leaves to the report, taken out of its options;
611
+ * null when neither was given or the function reads both itself. A function with options of its own for them
612
+ * (DVD's `--limit`) checks and reads them there.
613
+ */
614
+ function reportRowWindow(
615
+ capability: PaneFunctionCapability,
616
+ options: Record<string, string | true>,
617
+ ): { window: RowWindowOptions; options: Record<string, string | true> } | null {
618
+ const window: RowWindowOptions = {};
619
+ const rest = { ...options };
620
+ for (const key of ["limit", "tail"] as const) {
621
+ const value = options[key];
622
+ if (value === undefined || capabilityHasOption(capability, key)) continue;
623
+ const count = Number(value);
624
+ if (value === true || !Number.isInteger(count) || count < 1) throw new Error(`--${key} must be a positive integer.`);
625
+ window[key] = count;
626
+ delete rest[key];
627
+ }
628
+ if (window.limit != null && window.tail != null) throw new Error("--limit and --tail each pick rows; give one of them.");
629
+ return window.limit != null || window.tail != null ? { window, options: rest } : null;
630
+ }
631
+
589
632
  /**
590
633
  * A one-ticker template whose pane also opens on a list (`opensTickerList`:
591
634
  * DVD's ranking): the list is passed as `symbols`, so `shot` draws the same
@@ -201,6 +201,9 @@ export async function buildDesktopShotPayload(
201
201
  if (isFinancialAnalysisFunction(resolved) && !initialPaneState.activeTabId) {
202
202
  initialPaneState.activeTabId = "financials";
203
203
  }
204
+ // A capture of a ratio tab shows each ratio's inputs (NOPAT, invested capital), as the report lists them; the
205
+ // pane opens them collapsed for a reader who opens the one they want.
206
+ if (shotRatioTab(resolved)) initialPaneState.financialRatiosExpanded = true;
204
207
  // The pane opens on what the report found (13F: the fund a name resolved to, on its view's tab).
205
208
  const opened = resolved.headless?.shotState
206
209
  ? await resolved.headless.shotState(