gloomberb 0.19.6 → 0.20.1

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 (209) hide show
  1. package/LICENSE +0 -4
  2. package/package.json +6 -5
  3. package/patches/electrobun-devkit@2.0.5.patch +408 -0
  4. package/src/api-client/bond-trades.ts +59 -0
  5. package/src/api-client/crypto-markets.ts +20 -2
  6. package/src/api-client/data.ts +21 -0
  7. package/src/api-client/fund-facts.ts +23 -1
  8. package/src/api-client/index.ts +2 -0
  9. package/src/api-client/types/account.ts +86 -0
  10. package/src/api-client/types/assist.ts +32 -0
  11. package/src/api-client/types/auth.ts +63 -0
  12. package/src/api-client/types/billing.ts +54 -0
  13. package/src/api-client/types/chat.ts +180 -0
  14. package/src/api-client/types/congress.ts +107 -0
  15. package/src/api-client/types/credit.ts +110 -0
  16. package/src/api-client/types/econ.ts +158 -0
  17. package/src/api-client/types/equity-diagnostic.ts +73 -0
  18. package/src/api-client/types/filings-and-calls.ts +356 -0
  19. package/src/api-client/types/index.ts +25 -0
  20. package/src/api-client/types/jobs.ts +147 -0
  21. package/src/api-client/types/market.ts +122 -0
  22. package/src/api-client/types/news.ts +91 -0
  23. package/src/api-client/types/notes-and-theses.ts +172 -0
  24. package/src/api-client/types/quotes.ts +28 -0
  25. package/src/api-client/types/scanners.ts +125 -0
  26. package/src/api-client/types/screener.ts +65 -0
  27. package/src/api-client/types/search.ts +107 -0
  28. package/src/api-client/types/sync.ts +14 -0
  29. package/src/api-client/types/team-collections.ts +43 -0
  30. package/src/api-client/types/team-views.ts +32 -0
  31. package/src/api-client/types/teams.ts +135 -0
  32. package/src/api-client/types/ticker-data.ts +57 -0
  33. package/src/api-client/types/tweets.ts +59 -0
  34. package/src/api-client/types/world-venues.ts +23 -0
  35. package/src/app/runtime/desktop-deeplink.ts +41 -6
  36. package/src/app/runtime/plugin-seed.ts +119 -0
  37. package/src/app/runtime/startup.ts +45 -9
  38. package/src/app/star-prompt/status-line.tsx +1 -1
  39. package/src/app.tsx +2 -7
  40. package/src/architecture/ui-tokens-allowlist.json +0 -8
  41. package/src/cli/board-coins.ts +38 -5
  42. package/src/cli/commands/crypto-hints.ts +8 -1
  43. package/src/cli/commands/market.ts +29 -26
  44. package/src/cli/commands/overview.ts +13 -6
  45. package/src/cli/commands/ticker.ts +78 -18
  46. package/src/cli/company-name-hint.ts +19 -0
  47. package/src/cli/desktop-pane-shot-browser.ts +69 -3
  48. package/src/cli/entry.ts +10 -4
  49. package/src/cli/glossary.ts +25 -0
  50. package/src/cli/helpers.ts +4 -2
  51. package/src/cli/not-a-ticker.ts +26 -1
  52. package/src/cli/pane-functions/catalog.ts +3 -1
  53. package/src/cli/pane-functions/freshness.ts +45 -29
  54. package/src/cli/pane-functions/market-session.ts +14 -5
  55. package/src/cli/restore-plugins.ts +164 -51
  56. package/src/components/chart/composite/use-composite-chart-keyboard.ts +11 -2
  57. package/src/components/chart-table/header.tsx +10 -1
  58. package/src/components/chart-table/layout.ts +14 -5
  59. package/src/components/command-bar/panel/index.tsx +13 -0
  60. package/src/components/command-bar/panel/layout.ts +7 -0
  61. package/src/components/command-bar/panel/runtime.ts +1 -0
  62. package/src/components/command-bar/panel/types.ts +2 -0
  63. package/src/components/data-table/export.ts +4 -1
  64. package/src/components/layout/detached-pane-shell.tsx +10 -37
  65. package/src/components/layout/double-escape-close.ts +90 -0
  66. package/src/components/layout/header.tsx +3 -2
  67. package/src/components/layout/market-summary.ts +6 -3
  68. package/src/components/layout/pane/footer/index.tsx +2 -6
  69. package/src/components/layout/pane/footer/model.ts +6 -12
  70. package/src/components/layout/shell/active-drag.ts +53 -11
  71. package/src/components/layout/shell/drag/magnets.ts +128 -19
  72. package/src/components/layout/shell/pane/actions.ts +6 -2
  73. package/src/components/layout/shell/pane/management-shortcuts.ts +13 -51
  74. package/src/components/layout/status-bar.tsx +4 -78
  75. package/src/components/layout/status-widget-space.ts +5 -5
  76. package/src/components/onboarding/portfolio-step/positions-panel.tsx +1 -1
  77. package/src/components/ui/data-table/index.tsx +5 -1
  78. package/src/components/ui/data-table/render-cell.ts +19 -0
  79. package/src/components/ui/delayed-mark.tsx +59 -7
  80. package/src/components/ui/icon.tsx +1 -8
  81. package/src/components/ui/menu.tsx +6 -1
  82. package/src/i18n/es.ts +6 -3
  83. package/src/i18n/ja.ts +6 -3
  84. package/src/i18n/ko.ts +6 -3
  85. package/src/i18n/zh-cn.ts +6 -3
  86. package/src/i18n/zh-tw.ts +6 -3
  87. package/src/market-data/fund-facts.ts +7 -1
  88. package/src/market-data/market/change-basis.ts +20 -0
  89. package/src/market-data/market/format.ts +62 -2
  90. package/src/market-data/market/futures-week.ts +3 -1
  91. package/src/plugins/builtin/chart-composer/headless.ts +57 -17
  92. package/src/plugins/builtin/chart-composer/session-range.ts +82 -3
  93. package/src/plugins/builtin/chat/content/composer.tsx +21 -27
  94. package/src/plugins/builtin/chat/content/index.tsx +31 -3
  95. package/src/plugins/builtin/chat/content/shortcuts.ts +4 -2
  96. package/src/plugins/builtin/chat/content/snapshot.ts +0 -3
  97. package/src/plugins/builtin/cloud/auth-actions.tsx +51 -23
  98. package/src/plugins/builtin/cloud/trial-offer-status-widget.tsx +3 -3
  99. package/src/plugins/builtin/cloud/upgrade-status-widget.tsx +32 -25
  100. package/src/plugins/builtin/congress-trades/model.ts +2 -1
  101. package/src/plugins/builtin/congress-trades/pane.tsx +3 -0
  102. package/src/plugins/builtin/correlation/compute.ts +8 -2
  103. package/src/plugins/builtin/correlation/headless.ts +10 -9
  104. package/src/plugins/builtin/correlation/history.ts +30 -0
  105. package/src/plugins/builtin/correlation/matrix/model.ts +10 -10
  106. package/src/plugins/builtin/correlation/relationship/model.ts +3 -6
  107. package/src/plugins/builtin/correlation/relationship/pane.tsx +1 -2
  108. package/src/plugins/builtin/crypto-board/client.ts +6 -1
  109. package/src/plugins/builtin/crypto-board/defi-view.tsx +12 -1
  110. package/src/plugins/builtin/crypto-board/defi.ts +44 -7
  111. package/src/plugins/builtin/crypto-board/headless.ts +83 -12
  112. package/src/plugins/builtin/crypto-board/model.ts +30 -6
  113. package/src/plugins/builtin/crypto-board/pane.tsx +13 -2
  114. package/src/plugins/builtin/custom-view/index.tsx +1 -1
  115. package/src/plugins/builtin/custom-view/loader.ts +85 -8
  116. package/src/plugins/builtin/custom-view/view-spec.ts +28 -0
  117. package/src/plugins/builtin/equity-screener/criterion-editor.tsx +13 -4
  118. package/src/plugins/builtin/equity-screener/headless.ts +33 -1
  119. package/src/plugins/builtin/equity-screener/model.ts +58 -15
  120. package/src/plugins/builtin/equity-screener/pane.tsx +36 -6
  121. package/src/plugins/builtin/executives/format.ts +5 -4
  122. package/src/plugins/builtin/executives/pane.tsx +1 -1
  123. package/src/plugins/builtin/help/index.tsx +55 -1
  124. package/src/plugins/builtin/insider/model.ts +30 -2
  125. package/src/plugins/builtin/jobs/model.ts +2 -2
  126. package/src/plugins/builtin/mna/model.ts +2 -2
  127. package/src/plugins/builtin/notes/files.ts +2 -0
  128. package/src/plugins/builtin/notes/owner.tsx +20 -1
  129. package/src/plugins/builtin/notes/quick-notes-pane.tsx +22 -4
  130. package/src/plugins/builtin/notes/store.ts +6 -1
  131. package/src/plugins/builtin/perps/headless.ts +8 -2
  132. package/src/plugins/builtin/portfolio-list/header.tsx +1 -1
  133. package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -25
  134. package/src/plugins/builtin/risk-factors/index.tsx +2 -28
  135. package/src/plugins/builtin/risk-factors/lock-note.ts +58 -0
  136. package/src/plugins/builtin/risk-factors/pane.tsx +10 -3
  137. package/src/plugins/builtin/scanner/hilo-model.ts +4 -3
  138. package/src/plugins/builtin/sec/fund-facts.ts +45 -11
  139. package/src/plugins/builtin/sec/headless.ts +30 -1
  140. package/src/plugins/builtin/sec/index.tsx +26 -5
  141. package/src/plugins/builtin/series-inventory.ts +1 -0
  142. package/src/plugins/builtin/shared/earnings-report.ts +7 -2
  143. package/src/plugins/builtin/shared/pro-lock-note.ts +5 -1
  144. package/src/plugins/builtin/shared/use-quote-board.ts +85 -46
  145. package/src/plugins/builtin/short-interest/headless.ts +1 -1
  146. package/src/plugins/builtin/short-interest/model.ts +15 -6
  147. package/src/plugins/builtin/short-interest/types.ts +2 -0
  148. package/src/plugins/builtin/thirteenf/overlap-pane.tsx +3 -0
  149. package/src/plugins/builtin/thirteenf/pane.tsx +3 -0
  150. package/src/plugins/builtin/ticker-detail/overview/model.ts +19 -9
  151. package/src/plugins/builtin/ticker-detail/overview-tab.tsx +4 -4
  152. package/src/plugins/builtin/time-sales/headless.ts +23 -7
  153. package/src/plugins/builtin/time-sales/index.tsx +2 -2
  154. package/src/plugins/builtin/trace-bonds/detail.tsx +198 -0
  155. package/src/plugins/builtin/trace-bonds/headless.ts +62 -4
  156. package/src/plugins/builtin/trace-bonds/history.ts +155 -0
  157. package/src/plugins/builtin/trace-bonds/pane.tsx +64 -5
  158. package/src/plugins/extracted-plugins.ts +49 -24
  159. package/src/plugins/installer.ts +234 -32
  160. package/src/plugins/plugin-names.ts +11 -2
  161. package/src/plugins/running-installs.ts +34 -0
  162. package/src/plugins/seed-progress.ts +72 -0
  163. package/src/remote/controller.ts +9 -2
  164. package/src/remote/schema.ts +2 -1
  165. package/src/renderers/cloudflare/http-proxy.ts +67 -8
  166. package/src/renderers/cloudflare/proxy-session.ts +1 -1
  167. package/src/renderers/cloudflare/worker.ts +29 -2
  168. package/src/renderers/dom/desktop/icons.tsx +0 -2
  169. package/src/renderers/dom/styles.css +0 -3
  170. package/src/renderers/electrobun/bun/desktop/backend.ts +14 -0
  171. package/src/renderers/electrobun/bun/desktop/host-requests.ts +14 -7
  172. package/src/renderers/electrobun/bun/desktop/initialization.ts +24 -14
  173. package/src/renderers/electrobun/bun/desktop/install-records.ts +59 -0
  174. package/src/renderers/electrobun/bun/desktop/installer-folder.ts +208 -592
  175. package/src/renderers/electrobun/bun/desktop/macos-objc.ts +14 -0
  176. package/src/renderers/electrobun/bun/desktop/update.ts +1 -1
  177. package/src/renderers/electrobun/bun/index.ts +24 -13
  178. package/src/renderers/electrobun/bun/window/context-menu-thread.ts +84 -0
  179. package/src/renderers/electrobun/bun/window/create.ts +23 -3
  180. package/src/renderers/electrobun/bun/window/electrobun-window-host.ts +4 -4
  181. package/src/renderers/electrobun/bun/window/events.ts +4 -4
  182. package/src/renderers/electrobun/bun/window/frame.ts +2 -1
  183. package/src/renderers/electrobun/bun/window/native-call-thread.ts +224 -0
  184. package/src/renderers/electrobun/bun/window/native-min-size.ts +322 -0
  185. package/src/renderers/electrobun/bun/window/native-timing.ts +10 -0
  186. package/src/renderers/electrobun/bun/window/script-for-webview.ts +15 -0
  187. package/src/renderers/electrobun/bun/window/webview-script-thread.ts +82 -0
  188. package/src/renderers/electrobun/shared/protocol.ts +13 -2
  189. package/src/renderers/electrobun/view/backend-rpc.ts +8 -1
  190. package/src/renderers/electrobun/view/cli-pane-shot-frame.tsx +1 -1
  191. package/src/renderers/electrobun/view/main.tsx +4 -3
  192. package/src/renderers/opentui/start.tsx +3 -0
  193. package/src/sources/gloomberb-cloud/index.ts +5 -7
  194. package/src/sources/provider-router/batches.ts +18 -3
  195. package/src/sources/provider-router/financials.ts +18 -4
  196. package/src/telemetry/stall-reports.ts +21 -4
  197. package/src/types/data-provider.ts +14 -0
  198. package/src/types/financials.ts +15 -3
  199. package/src/types/headless.ts +2 -0
  200. package/src/utils/double-escape-close.ts +38 -16
  201. package/src/utils/format.ts +23 -3
  202. package/src/utils/main-thread-stall.ts +21 -5
  203. package/src/utils/perf-marks.ts +88 -9
  204. package/src/utils/price-earnings.ts +18 -0
  205. package/src/utils/reported-money.ts +9 -2
  206. package/src/utils/sec.ts +34 -3
  207. package/patches/electrobun@1.18.1.patch +0 -633
  208. package/src/api-client/types.ts +0 -2441
  209. package/src/plugins/seed-notice.ts +0 -20
@@ -1,13 +1,13 @@
1
1
  import { logFailure } from "../../utils/log-failure";
2
2
  import { formatShortDate, parseDisplayDate } from "../../utils/datetime-format";
3
- import { formatReportedMoney } from "../../utils/reported-money";
3
+ import { formatReportedMoney, REPORTING_CURRENCY_NOT_SOURCED } from "../../utils/reported-money";
4
4
  import {
5
5
  appTtmRate, computedEnterpriseValueNote, convertedPriceEarningsNote, enterpriseValueLabel, enterpriseValueReconciliationNote, epsConversionNote,
6
6
  fundamentalsCurrency, reportedEnterpriseValue, trailingEpsSourceNote, ttmAtAppRate, ttmConversionNote,
7
7
  } from "../../utils/fundamentals";
8
8
  import { latestFinancialPeriod } from "../../utils/latest-financial-period";
9
9
  import { burnsCash, cashRunway, SHORT_RUNWAY_HISTORY, formatRunwayMonths, offeringNote, offeringsAfter, runwayMethod, type CashRunway, type OfferingFiling, type RunwayEstimate } from "../../utils/cash-runway";
10
- import { exportedFundamentals, formatPriceEarnings, NOT_MEANINGFUL, priceEarningsOnEarnings } from "../../utils/price-earnings";
10
+ import { exportedFundamentals, formatPriceEarnings, forwardFiscalYear, NOT_MEANINGFUL, priceEarningsOnEarnings } from "../../utils/price-earnings";
11
11
  import { describeFundamentalMarketCap, marketCapBasisNote, selectMarketCapitalization, viewMarketCapitalization, withheldMarketCap } from "../../utils/market-capitalization";
12
12
  import {
13
13
  formatCompact,
@@ -16,8 +16,9 @@ import {
16
16
  formatNumber,
17
17
  formatPercent,
18
18
  formatPercentRaw,
19
+ MISSING_VALUE,
19
20
  } from "../../utils/format";
20
- import { formatMarketCostWithCurrency, formatMarketPriceWithCurrency, formatMarketQuantity, quoteFormatOptions, withCurrencyMinorDigits, type MarketFormatOptions } from "../../market-data/market/format";
21
+ import { formatMarketCostWithCurrency, formatMarketPriceWithCurrency, formatMarketQuantity, nearParCoinPriceDigits, quoteFormatOptions, withCurrencyMinorDigits, type MarketFormatOptions } from "../../market-data/market/format";
21
22
  import {
22
23
  cliStyles,
23
24
  cliTerminalWidth,
@@ -75,7 +76,7 @@ import {
75
76
  import { NotesFiles } from "../../plugins/builtin/notes/files";
76
77
  import { getFormDescription } from "../../plugins/builtin/sec/model";
77
78
  import { ownerNames, rowSummary, rowSummaryTarget } from "../../plugins/builtin/sec/row-summaries";
78
- import { isKnownNonUsListing, secFilingItemCodes, US_FUND_FACTS_ONLY } from "../../utils/sec";
79
+ import { fundFactsAbroadKey, hasFundFactsAbroad, isKnownNonUsListing, secFilingItemCodes, US_FUND_FACTS_ONLY } from "../../utils/sec";
79
80
  import { currentReportItemsLabel, hiddenFilingsNote, loadLatestFilings, type HiddenFilings } from "../../utils/sec-filings";
80
81
  import { canonicalExchange, exchangeLabel, isKnownExchangeCode, isUsListingExchange } from "../../utils/exchanges";
81
82
  import {
@@ -544,9 +545,36 @@ interface FundamentalsMetric {
544
545
 
545
546
  type MetricFigure = Omit<FundamentalsMetric, "label">;
546
547
 
547
- /** An amount in the currency the source reported it in; `ccy?` when it named none, as the text says. `codes`: per share too (6.54 USD). */
548
+ /**
549
+ * An amount in the currency the source reported it in. One it named none for
550
+ * is bare, with no unit, and a note under the block says so
551
+ * (unsourcedCurrencyNote). `codes`: per share too (6.54 USD).
552
+ */
548
553
  function reportedMoney(value: number | undefined, currency: string | undefined, perShare = false, codes = false): MetricFigure {
549
- return { text: formatReportedMoney(value, currency, perShare, codes), value, unit: currency?.trim() || "ccy?" };
554
+ const unit = currency?.trim();
555
+ return { text: formatReportedMoney(value, currency, perShare, codes), value, ...(unit ? { unit } : {}) };
556
+ }
557
+
558
+ /**
559
+ * What a US stock or fund line's day range from Gloom Cloud counts: its
560
+ * regular session's prints on every US venue that set a price, odd lots
561
+ * excluded, as GIP's bars and TAS's session range count them. Null for a
562
+ * future, a coin, a listing abroad or another source's quote.
563
+ */
564
+ function consolidatedRangeBasis(quote: Quote): string | null {
565
+ const venue = quote.listingExchangeName || quote.exchangeName || "";
566
+ if (quote.providerId !== "gloomberb-cloud" || !isUsListingExchange(venue) || quote.instrumentType === "FUTURE"
567
+ || isRoundTheClockCoin(quote.symbol ?? "", venue)) return null;
568
+ return "regular session, every US venue, odd lots excluded";
569
+ }
570
+
571
+ /** `Reporting currency not sourced for EPS (TTM) and Revenue (TTM).`: the trailing amounts shown bare. */
572
+ function unsourcedCurrencyNote(metrics: readonly FundamentalsMetric[]): string | undefined {
573
+ const bare = metrics.filter((metric) => TRAILING_MONEY_METRICS.has(metric.label) && metric.text !== "—" && !metric.unit)
574
+ .map((metric) => metric.label);
575
+ if (bare.length === 0) return undefined;
576
+ const list = bare.length === 1 ? bare[0]! : `${bare.slice(0, -1).join(", ")} and ${bare.at(-1)}`;
577
+ return `${REPORTING_CURRENCY_NOT_SOURCED[0]!.toUpperCase()}${REPORTING_CURRENCY_NOT_SOURCED.slice(1)} for ${list}.`;
550
578
  }
551
579
 
552
580
  /**
@@ -728,9 +756,12 @@ export async function loadReportFundFacts(
728
756
  tickerFile: TickerRecord | null = null,
729
757
  load: (symbol: string) => Promise<FundFactsPayload> = (ticker) => readFundFacts(ticker),
730
758
  ): Promise<FundFactsPayload | null> {
731
- if (resolveTickerInstrumentKind(tickerFile, financials) !== "fund" || (exchange && !isUsListingExchange(exchange))) return null;
759
+ // A fund abroad has none, but for Hong Kong's spot coin funds, which the server answers for.
760
+ if (resolveTickerInstrumentKind(tickerFile, financials) !== "fund"
761
+ || (exchange && !isUsListingExchange(exchange) && !hasFundFactsAbroad(exchange))) return null;
732
762
  try {
733
- return await load(symbol);
763
+ // Hong Kong's by its listing's key (3046:XHKG), so the server does not read a bare 3046 as a US ticker.
764
+ return await load(exchange && hasFundFactsAbroad(exchange) ? fundFactsAbroadKey(symbol, exchange) : symbol);
734
765
  } catch (error) {
735
766
  logFailure("cli.commands-ticker", "Read fund facts failed")(error);
736
767
  return null;
@@ -761,7 +792,11 @@ function fundamentalsMetrics(
761
792
  { label: "Enterprise Value", ...enterpriseValueFigure(enterpriseValue, fundamentals) },
762
793
  // A multiple over a loss is N/M, even beside a positive one the source served from an older period.
763
794
  { label: "P/E (TTM)", ...multipleFigure(priceEarningsOnEarnings(fundamentals?.trailingPE, fundamentals?.eps)) },
764
- { label: "Forward P/E", ...multipleFigure(priceEarningsOnEarnings(fundamentals?.forwardPE, fundamentals?.forwardEps)) },
795
+ // Next fiscal year's consensus, named by its year: `Forward P/E FY27`.
796
+ {
797
+ label: forwardLabel(fundamentals),
798
+ ...multipleFigure(priceEarningsOnEarnings(fundamentals?.forwardPE, fundamentals?.forwardEps)),
799
+ },
765
800
  { label: "PEG", ...multipleFigure(fundamentals?.pegRatio) },
766
801
  // EPS (TTM) is the last four filed quarters' (filed-trailing-eps), so its twelve months can end before those of
767
802
  // the flows below, Gloom Cloud's trailing block; Gloom Cloud's EPS standing in is noted (trailingEpsSourceNote).
@@ -828,8 +863,16 @@ function floatAndShortInterestMetrics(
828
863
  const STOCK_ONLY_METRICS = new Set(["Enterprise Value", "P/E (TTM)", "Forward P/E", "PEG", "EPS (TTM)", "Revenue (TTM)", "Net Income (TTM)",
829
864
  "Operating Cash Flow (TTM)", "Free Cash Flow (TTM)", "Operating Margin", "Profit Margin", "Revenue Growth", "Last Quarter Growth"]);
830
865
 
866
+ function forwardLabel(fundamentals: TickerFinancials["fundamentals"]): string {
867
+ const year = forwardFiscalYear(fundamentals?.forwardEpsPeriodEnd);
868
+ return year ? `Forward P/E ${year}` : "Forward P/E";
869
+ }
870
+
871
+ /** A line's name without the fiscal year a forward figure names: `Forward P/E FY27` is Forward P/E. */
872
+ const metricName = (label: string) => label.replace(/ FY\d{2}$/, "");
873
+
831
874
  function withoutStockRows<T extends { label: string }>(metrics: T[], fund: boolean): T[] {
832
- return fund ? metrics.filter((metric) => !STOCK_ONLY_METRICS.has(metric.label)) : metrics;
875
+ return fund ? metrics.filter((metric) => !STOCK_ONLY_METRICS.has(metricName(metric.label))) : metrics;
833
876
  }
834
877
 
835
878
  function metricLines(metrics: readonly FundamentalsMetric[]): Array<[string, string]> {
@@ -867,7 +910,8 @@ function fundamentalsNotes(
867
910
  : undefined;
868
911
  // A cap Gloom Cloud withheld says why, as RV and EQS do.
869
912
  const withheld = withheldMarketCap(fundamentals)?.note;
870
- return [withheld, shareBasis, enterpriseValue, conversion, eps, epsSource, priceEarnings].filter((note): note is string => !!note);
913
+ return [withheld, shareBasis, enterpriseValue, conversion, eps, epsSource, priceEarnings, unsourcedCurrencyNote(metrics)]
914
+ .filter((note): note is string => !!note);
871
915
  }
872
916
 
873
917
  // The share count is the market cap's basis: the cap is the count times the price, or a note says why not.
@@ -918,7 +962,7 @@ function fundFactsNote(
918
962
  facts: FundFactsPayload | null = null,
919
963
  ): string | null {
920
964
  if (resolveTickerInstrumentKind(tickerFile, financials) !== "fund") return null;
921
- if (exchange && !isUsListingExchange(exchange)) return US_FUND_FACTS_ONLY;
965
+ if (exchange && !isUsListingExchange(exchange) && !facts?.covered) return US_FUND_FACTS_ONLY;
922
966
  if (!facts?.covered) return null;
923
967
  const figures = [facts.expenseRatio && "fee", facts.nav && "NAV", facts.premiumDiscount && "premium", facts.netAssets && "net assets"]
924
968
  .filter((figure): figure is string => !!figure);
@@ -931,14 +975,20 @@ function fundFactsNote(
931
975
  * close's move), and a pre-market, after-hours or overnight print is a line
932
976
  * of its own, measured from that close.
933
977
  */
978
+ /** A coin near a dollar prints to four decimals, as `quote`, `G` and CRYP print it: $0.9989, not $0.99886. */
979
+ function withNearParCoinDigits(options: MarketFormatOptions, quote: Quote | null | undefined): MarketFormatOptions {
980
+ const digits = nearParCoinPriceDigits(quote);
981
+ return digits == null ? options : { ...options, fixedFractionDigits: digits };
982
+ }
983
+
934
984
  function valuationPriceMetrics(financials: FundamentalsReportData): FundamentalsMetric[] {
935
985
  const quote = financials.quote;
936
986
  const session = getRegularSessionDisplay(quote);
937
987
  if (!quote || !session) return [];
938
- const options = withCurrencyMinorDigits({
988
+ const options = withNearParCoinDigits(withCurrencyMinorDigits({
939
989
  ...quoteFormatOptions(quote, undefined, financials.quoteMetadata?.instrumentType),
940
990
  ...financials.currencyCodes ? { currencyCode: true } : {},
941
- }, quote.currency);
991
+ }, quote.currency), quote);
942
992
  const price = (value: number) => formatMarketPriceWithCurrency(value, quote.currency, options);
943
993
  const extended = getExtendedSessionDisplay(quote);
944
994
  const extendedLabel = extended ? EXTENDED_SESSION_LABELS[extended.session] : "";
@@ -989,7 +1039,7 @@ function fundamentalsReportMetrics(snapshot: FundamentalsReportData, view: "fund
989
1039
  return [...metrics, ...floatAndShortInterestMetrics(quote, fundamentals, financials.profile)]
990
1040
  .filter((metric) => metric.text !== "—");
991
1041
  }
992
- const valued = metrics.filter(({ label, text }) => (VALUATION_METRICS.has(label) || isYieldMetric(label)) && text !== "—");
1042
+ const valued = metrics.filter(({ label, text }) => (VALUATION_METRICS.has(metricName(label)) || isYieldMetric(label)) && text !== MISSING_VALUE);
993
1043
  // The share count follows the market cap it is the basis of.
994
1044
  const isShares = (label: string) => label === "Shares Outstanding" || label === "Shares Outstanding As Of";
995
1045
  const shares = valued.filter((metric) => isShares(metric.label));
@@ -1191,7 +1241,10 @@ export async function buildTickerReport({
1191
1241
  boughtAt: boughtRateCurrencies(tickerFile, quote?.currency?.trim() || tickerFile?.metadata.currency?.trim() || "", config.baseCurrency),
1192
1242
  };
1193
1243
  // Pad money prices to the currency's minor unit so a range reads £35.10 - £35.485, never past it (JPY has none).
1194
- const quoteOptions = withCurrencyMinorDigits(codes ? { ...baseQuoteOptions, currencyCode: true } : baseQuoteOptions, quote?.currency);
1244
+ const quoteOptions = withNearParCoinDigits(
1245
+ withCurrencyMinorDigits(codes ? { ...baseQuoteOptions, currencyCode: true } : baseQuoteOptions, quote?.currency),
1246
+ quote,
1247
+ );
1195
1248
  const lines: string[] = [];
1196
1249
 
1197
1250
  lines.push(`${cliStyles.accent(quote?.symbol ?? symbol)} ${cliStyles.bold(name)}`);
@@ -1299,9 +1352,10 @@ export async function buildTickerReport({
1299
1352
  // European gas beside Henry Hub: "≈ $30.832/MMBtu at EUR/USD 1.1650", a conversion that says so.
1300
1353
  ...usdPerMmbtu ? [["In USD", usdPerMmbtuText(usdPerMmbtu)] as [string, string]] : [],
1301
1354
  ["Open", quote.open != null ? formatMarketPriceWithCurrency(quote.open, quote.currency, quoteOptions) : "—"],
1302
- // A listing that no longer trades: its last session's range, never today's.
1355
+ // A listing that no longer trades: its last session's range, never today's. A US line's says what it counts,
1356
+ // the rule GIP and TAS read the session's low and high by.
1303
1357
  [quote.delisting ? "Last Session" : "Day Range", quote.low != null || quote.high != null
1304
- ? formatPriceRange(quote.low, quote.high, quote.currency, quoteOptions)
1358
+ ? `${formatPriceRange(quote.low, quote.high, quote.currency, quoteOptions)}${consolidatedRangeBasis(quote) ? ` (${consolidatedRangeBasis(quote)})` : ""}`
1305
1359
  : "—"],
1306
1360
  ["52W Range", quote.low52w != null || quote.high52w != null
1307
1361
  ? formatPriceRange(quote.low52w, quote.high52w, quote.currency, quoteOptions)
@@ -1357,15 +1411,21 @@ export async function buildTickerReport({
1357
1411
  lines.push(cliStyles.muted(`Market cap: ${describeFundamentalMarketCap(capitalization.provenance)}.`));
1358
1412
  }
1359
1413
 
1414
+ // A statement whose currency no source names reads bare, and says so once under its amounts.
1415
+ const unsourced = (row: FinancialStatement) => {
1416
+ if (!statementCurrency(row)) lines.push(cliStyles.muted(`${REPORTING_CURRENCY_NOT_SOURCED[0]!.toUpperCase()}${REPORTING_CURRENCY_NOT_SOURCED.slice(1)}.`));
1417
+ };
1360
1418
  if (latestAnnual) {
1361
1419
  appendMetricSection(lines, `Latest Annual (${statementPeriodText(latestAnnual.date, statementFilings?.latestAnnual ?? null)})`,
1362
1420
  buildStatementMetrics(latestAnnual, statementCurrency(latestAnnual), codes));
1421
+ unsourced(latestAnnual);
1363
1422
  }
1364
1423
 
1365
1424
  if (latestQuarter) {
1366
1425
  const runway = cashRunway(financials);
1367
1426
  appendMetricSection(lines, `Latest Quarter (${statementPeriodText(latestQuarter.date, statementFilings?.latestQuarter ?? null)})`,
1368
1427
  buildStatementMetrics(latestQuarter, statementCurrency(latestQuarter), codes, runway));
1428
+ unsourced(latestQuarter);
1369
1429
  // How the months are counted, and an offering since the balance sheet that the cash does not include yet.
1370
1430
  if (burnsCash(runway)) lines.push(cliStyles.muted(runwayMethod(runway.includesShortTerm)));
1371
1431
  const offering = runway ? offeringNote(offeringsAfter(offerings, runway.periodEnd), runway.periodEnd) : null;
@@ -2,6 +2,9 @@ import type { CliListing } from "./listing-arg";
2
2
  import { companyNameSuggestion, isUnsettledNoProvider, type ListingDeps } from "./listing-arg";
3
3
  import { describeSuggestion } from "./listing-suggestion";
4
4
  import { isNotATickerMessage, withListingSuggestion } from "./not-a-ticker";
5
+ import { tradingListing } from "../tickers/listing-fate";
6
+ import { parsePublicTickerKey } from "../utils/exchanges";
7
+ import { logFailure } from "../utils/log-failure";
5
8
 
6
9
  type SearchDeps = Pick<ListingDeps, "dataProvider">;
7
10
 
@@ -39,3 +42,19 @@ export async function notATickerStop(
39
42
  if (!suggestion) return notATicker ? message : null;
40
43
  return withListingSuggestion(notATicker ? message! : `Not a ticker: ${listing.symbol}.`, describeSuggestion(suggestion));
41
44
  }
45
+
46
+ /**
47
+ * "Did you mean D05:SGX (DBS Group Holdings Ltd.)?", for a bare symbol whose
48
+ * listing stopped trading (DBS, the Invesco silver fund delisted in 2023)
49
+ * when search names a company by the symbol that still trades. Null when
50
+ * search names none, names the symbol itself, or the company's line has
51
+ * stopped too. Never throws.
52
+ */
53
+ export async function liveCompanyQuestion(typed: string, deps: SearchDeps, now = Date.now()): Promise<string | null> {
54
+ const suggestion = await companyNameSuggestion(typed, deps);
55
+ if (!suggestion) return null;
56
+ const { symbol, exchange } = parsePublicTickerKey(suggestion.symbol);
57
+ const quote = await deps.dataProvider.getQuote(symbol, exchange ?? "")
58
+ .catch(logFailure("cli.company-name-hint", "Quote a company suggested for a stopped symbol failed", null));
59
+ return quote && tradingListing(quote, now) ? `Did you mean ${describeSuggestion(suggestion)}?` : null;
60
+ }
@@ -15,6 +15,12 @@ import { logFailure } from "../utils/log-failure";
15
15
  * where other accounts could read it. Bun cannot hand a browser those pipes
16
16
  * on Windows yet, so there the browser listens on a local port for its
17
17
  * DevTools, as before, and is still told the page over the protocol.
18
+ *
19
+ * Chrome keeps its sandbox, which holds a page that goes wrong inside its
20
+ * renderer. It runs without one only where Chrome cannot have it: as root
21
+ * on Linux, which Chrome refuses, or on a Linux machine whose kernel does not
22
+ * let it build one (some containers), where Chrome says so as it fails to
23
+ * start and the capture starts it again without.
18
24
  */
19
25
 
20
26
  /** A DevTools command sent to the capture's page, and its result. */
@@ -142,7 +148,6 @@ const CHROME_ARGS = [
142
148
  // Software WebGL for GPU-drawn panes (the 3D volatility surface).
143
149
  "--use-angle=swiftshader",
144
150
  "--enable-unsafe-swiftshader",
145
- "--no-sandbox",
146
151
  "--disable-dev-shm-usage",
147
152
  "--disable-background-networking",
148
153
  "--disable-default-apps",
@@ -154,15 +159,44 @@ const CHROME_ARGS = [
154
159
  "--allow-file-access-from-files",
155
160
  ];
156
161
 
162
+ const NO_SANDBOX = "--no-sandbox";
163
+ /** What Chrome prints when it cannot start with its sandbox: run as root, or no kernel support for one. */
164
+ const SANDBOX_REFUSED = /No usable sandbox|Running as root without --no-sandbox/;
165
+ /** How much of Chrome's stderr a failed start keeps to tell why. */
166
+ const STDERR_KEPT_BYTES = 16_384;
167
+
168
+ /** Whether Chrome starts without its sandbox from the outset: as root on Linux, where it refuses one. */
169
+ export function startsWithoutSandbox(platform: NodeJS.Platform, uid: number | undefined): boolean {
170
+ return platform === "linux" && uid === 0;
171
+ }
172
+
173
+ /** Whether a Chrome that failed to start said it was for want of its sandbox. */
174
+ export function chromeSandboxRefused(stderr: string): boolean {
175
+ return SANDBOX_REFUSED.test(stderr);
176
+ }
177
+
157
178
  interface LaunchedChrome {
158
179
  connection: CdpConnection;
159
180
  stop(): Promise<void>;
181
+ /** The start of what the browser wrote to stderr, once it has exited. */
182
+ stderr(): Promise<string>;
160
183
  }
161
184
 
162
185
  /** Chrome with DevTools on fds 3 (to the browser) and 4 (from it): messages are JSON, each ended by a NUL. */
163
186
  function launchOverPipe(chrome: string, args: string[]): LaunchedChrome {
164
187
  const child = spawn(chrome, [...args, "--remote-debugging-pipe", "about:blank"], {
165
- stdio: ["ignore", "ignore", "ignore", "pipe", "pipe"],
188
+ stdio: ["ignore", "ignore", "pipe", "pipe", "pipe"],
189
+ });
190
+ // Read to the end, so a chatty browser never blocks on a full pipe; only the start is kept.
191
+ let stderrText = "";
192
+ const fromStderr = child.stderr!;
193
+ fromStderr.setEncoding("utf8");
194
+ fromStderr.on("data", (chunk: string) => {
195
+ if (stderrText.length < STDERR_KEPT_BYTES) stderrText += chunk.slice(0, STDERR_KEPT_BYTES - stderrText.length);
196
+ });
197
+ const stderrDone = new Promise<void>((resolve) => {
198
+ fromStderr.once("close", () => resolve());
199
+ fromStderr.once("error", () => resolve());
166
200
  });
167
201
  const toChrome = child.stdio[3] as Writable;
168
202
  const fromChrome = child.stdio[4] as Readable;
@@ -197,6 +231,11 @@ function launchOverPipe(chrome: string, args: string[]): LaunchedChrome {
197
231
  await exited;
198
232
  clearTimeout(timer);
199
233
  },
234
+ stderr: async () => {
235
+ await exited;
236
+ await Promise.race([stderrDone, new Promise((resolve) => setTimeout(resolve, 1_000))]);
237
+ return stderrText;
238
+ },
200
239
  };
201
240
  }
202
241
 
@@ -228,6 +267,8 @@ async function launchOverPort(chrome: string, args: string[], userDataDir: strin
228
267
  socket.close();
229
268
  await stop();
230
269
  },
270
+ // Windows gives Chrome its sandbox without kernel support to miss.
271
+ stderr: async () => "",
231
272
  };
232
273
  } catch (error) {
233
274
  await stop();
@@ -258,6 +299,8 @@ async function messageText(data: unknown): Promise<string> {
258
299
  return String(data);
259
300
  }
260
301
 
302
+ class ChromeSandboxRefusedError extends Error {}
303
+
261
304
  /**
262
305
  * Starts the capture browser with one blank page of `widthPx` by `heightPx`,
263
306
  * its profile in `userDataDir`. Nothing is loaded until `open`.
@@ -268,13 +311,36 @@ export async function launchShotBrowser(
268
311
  ): Promise<ShotBrowser> {
269
312
  await mkdir(options.userDataDir, { recursive: true });
270
313
  const args = [...CHROME_ARGS, `--user-data-dir=${options.userDataDir}`, `--window-size=${options.widthPx},${options.heightPx}`];
314
+ if (startsWithoutSandbox(process.platform, process.getuid?.())) return startShotBrowser(chrome, [...args, NO_SANDBOX], options);
315
+ try {
316
+ return await startShotBrowser(chrome, args, options);
317
+ } catch (error) {
318
+ if (!(error instanceof ChromeSandboxRefusedError)) throw error;
319
+ logFailure("cli.screenshot", "Chrome has no sandbox on this machine; capturing without it")(error);
320
+ return startShotBrowser(chrome, [...args, NO_SANDBOX], options);
321
+ }
322
+ }
323
+
324
+ async function startShotBrowser(
325
+ chrome: string,
326
+ args: string[],
327
+ options: { userDataDir: string },
328
+ ): Promise<ShotBrowser> {
271
329
  const launched = process.platform === "win32"
272
330
  ? await launchOverPort(chrome, args, options.userDataDir)
273
331
  : launchOverPipe(chrome, args);
274
332
  const { connection } = launched;
275
333
  try {
276
334
  // The first answer waits for the browser to start.
277
- await connection.send("Browser.getVersion", undefined, undefined, CHROME_START_TIMEOUT_MS);
335
+ try {
336
+ await connection.send("Browser.getVersion", undefined, undefined, CHROME_START_TIMEOUT_MS);
337
+ } catch (error) {
338
+ await launched.stop();
339
+ if (!args.includes(NO_SANDBOX) && chromeSandboxRefused(await launched.stderr())) {
340
+ throw new ChromeSandboxRefusedError("Chrome could not start with its sandbox.", { cause: error });
341
+ }
342
+ throw error;
343
+ }
278
344
  const { targetId } = await connection.send("Target.createTarget", { url: "about:blank" }) as { targetId: string };
279
345
  const { sessionId } = await connection.send("Target.attachToTarget", { targetId, flatten: true }) as { sessionId: string };
280
346
  const page: CdpPage = { send: (method, params) => connection.send(method, params, sessionId) };
package/src/cli/entry.ts CHANGED
@@ -22,17 +22,23 @@ import {
22
22
  async function launchOpenTuiApp(cliLaunchRequest: CliLaunchRequest | null = null): Promise<void> {
23
23
  // Before anything in the app can reach for the render library, so a temp
24
24
  // folder that cannot run it is worked around (or named) first.
25
- const { restoreExtractedPlugins } = await import("./restore-plugins");
25
+ const { prepareExtractedPluginSeed } = await import("./restore-plugins");
26
26
  const { loadExternalPlugins } = await import("../plugins/loader");
27
27
  const { loadRenderLib } = await import("../renderers/opentui/render-lib");
28
28
  await measurePerfAsync("startup.opentui.render-lib", loadRenderLib);
29
29
  const { startOpenTuiApp } = await import("../renderers/opentui/start");
30
- // Before the catalog is read, so a plugin that moved out of this repository is
31
- // available in the same session rather than only after a restart.
32
- await measurePerfAsync("startup.opentui.restore-plugins", restoreExtractedPlugins);
30
+ // Plugins that moved out of this repository are planned before the config
31
+ // is read, which records the ones already settled, and installed once the
32
+ // app is drawn: cloning them first held a blank screen for seconds, or for
33
+ // good on a connection that hangs. The app brings each in as it lands.
34
+ const seed = await measurePerfAsync("startup.opentui.restore-plugins", () => prepareExtractedPluginSeed());
33
35
  const externalPlugins = await measurePerfAsync("startup.opentui.load-external-plugins", () => loadExternalPlugins("tui"));
34
36
  try {
35
37
  await startOpenTuiApp({ externalPlugins, cliLaunchRequest });
38
+ if (seed?.start) {
39
+ const { logFailure } = await import("../utils/log-failure");
40
+ void seed.start().catch(logFailure("plugin-seed", "Plugin restore failed"));
41
+ }
36
42
  } catch (error) {
37
43
  // A failed launch still prints and exits as before; the report is only
38
44
  // sent when the config was read far enough to install the reporter.
@@ -369,6 +369,31 @@ export const GLOSSARY: readonly GlossaryEntry[] = [
369
369
  definition: "How far a perpetual's price sits above or below the reference price it tracks, as a percent. "
370
370
  + "Positive means buyers are paying up for the contract; funding pulls it back toward zero.",
371
371
  },
372
+ // Stablecoins (CRYP --list stablecoin).
373
+ {
374
+ term: "Off peg", aliases: ["off-peg", "peg", "depeg", "de-peg", "peg deviation", "stablecoin peg"], functions: ["CRYP"],
375
+ definition: "How far a stablecoin trades from its peg, in basis points: (price ÷ peg − 1) × 10,000, the peg being $1 for a dollar coin "
376
+ + "and the EUR/USD rate for a euro coin (Peg EUR 1.1194). A coin whose Peg reads USD yield (yield accrues into its price) or USD bond "
377
+ + "(a bond token priced toward a dollar at maturity) has no par to be off, so it shows none.",
378
+ },
379
+ {
380
+ term: "24h low/high", aliases: ["24h low", "24h high", "24-hour low", "24-hour high", "24h range", "low utc", "high utc"], functions: ["CRYP"],
381
+ shown: ["24h low", "24h high", "Low UTC", "High UTC"],
382
+ definition: "A stablecoin's lowest and highest trade over the rolling 24 hours to the board's time, not since midnight, "
383
+ + "with when each traded in UTC (Low UTC, High UTC). A newer price outside them becomes the low or the high.",
384
+ },
385
+ {
386
+ term: "Supply", aliases: ["stablecoin supply", "total supply", "supply 7d", "supply 30d", "supply change"], functions: ["CRYP"],
387
+ shown: ["Supply", "Total supply"],
388
+ definition: "The dollar value of a stablecoin's coins in circulation, from a daily series that ends on the previous day: "
389
+ + "the line above the table gives its as-of date. Supply 7D and Supply 30D are its change over those days, in dollars and in percent; "
390
+ + "supply grows as coins are issued and shrinks as they are redeemed.",
391
+ },
392
+ {
393
+ term: "Share", aliases: ["supply share", "share of supply", "tvl share"], functions: ["CRYP"],
394
+ definition: "A stablecoin's part of all stablecoin supply, in percent, on the same previous-day series as Supply. "
395
+ + "On the DeFi chain list, a chain's part of all value locked.",
396
+ },
372
397
  // Portfolio weights and rebalancing (PF, portfolio show).
373
398
  {
374
399
  term: "Weight", aliases: ["weights", "portfolio weight", "allocation weight"], functions: ["PF"],
@@ -6,7 +6,7 @@ import {
6
6
  formatPercentRaw,
7
7
  } from "../utils/format";
8
8
  import { formatMarketChangeWithCurrency, formatMarketPriceWithCurrency, type MarketFormatOptions } from "../market-data/market/format";
9
- import { changeBasisLabel, changeBasisNote, quoteChangeBasis } from "../market-data/market/change-basis";
9
+ import { changeBasisLabel, changeBasisNote, printPredatesChangeBasis, quoteChangeBasis } from "../market-data/market/change-basis";
10
10
  import type { FuturesContractTermsPayload } from "../api-client/futures-curve";
11
11
  import type { ActiveQuoteDisplay } from "../market-data/market/status";
12
12
  import type { Quote } from "../types/financials";
@@ -39,11 +39,13 @@ export function quoteChangeText(
39
39
  ): string {
40
40
  // A listing that no longer trades: its last close moves no more.
41
41
  if (quote.delisting) return "—";
42
+ const basis = quoteChangeBasis(quote, { terms });
43
+ // A print older than what its move is from (a coin's before 00:00 UTC) has no move as of now, as `quote` says.
44
+ if (printPredatesChangeBasis(quote, basis, now)) return "—";
42
45
  const move = colorBySign(
43
46
  `${formatMarketChangeWithCurrency(session.change, quote.currency ?? "USD", options, session.price)} (${formatPercentRaw(session.changePercent)})`,
44
47
  session.change,
45
48
  );
46
- const basis = quoteChangeBasis(quote, { terms });
47
49
  if (!basis) return move;
48
50
  const note = changeBasisNote(basis, now);
49
51
  return `${move} ${cliStyles.muted(changeBasisLabel(basis, now))}${note ? `\n${cliStyles.muted(note)}` : ""}`;
@@ -45,7 +45,7 @@ export type FredSeriesCheck = (seriesId: string) => boolean;
45
45
  * "APPLE" as AAPL:NASDAQ") is put back in the user's spelling too.
46
46
  */
47
47
  export function withSearchHints(text: string, args: readonly string[], isFredSeries: FredSeriesCheck = () => false): string {
48
- const named = withTypedNames(text, args);
48
+ const named = withCoinHints(withTypedNames(text, args), args);
49
49
  return named.includes("Not a ticker: ")
50
50
  ? named.replace(NOT_A_TICKER_SENTENCE, (sentence, symbol: string) => {
51
51
  const typed = typedSymbol(symbol, args);
@@ -60,6 +60,31 @@ export function withSearchHints(text: string, args: readonly string[], isFredSer
60
60
  : named;
61
61
  }
62
62
 
63
+ // "Could not check USDT, FOOBARX: ..." as `quote` says the symbols the data service did not answer for, and "Could not
64
+ // look up USDT: ..." as a command that resolves one says it; a hint already given is not given twice.
65
+ const UNCHECKED_LINE = /^((?:.*?\b)?Could not (?:check|look up) ([^\s,]+(?:, [^\s,]+)*): [^\n]*?)(?<! Did you mean [^\n]*)$/gm;
66
+
67
+ /**
68
+ * The coin a bare word the data service could not check may be, after the
69
+ * line that says so: "Did you mean USDT-USD (Tether USDt)?", "... for USDT"
70
+ * when the line names several. The coins come from the crypto board, or when
71
+ * it cannot be read either (the same service is down), the largest coins this
72
+ * build knows (`boardCoinFor`), so the hint stands in an outage.
73
+ */
74
+ function withCoinHints(text: string, args: readonly string[]): string {
75
+ if (!text.includes("Could not ")) return text;
76
+ return text.replace(UNCHECKED_LINE, (line, _whole, list: string) => {
77
+ const symbols = list.split(",").map((symbol) => symbol.trim()).filter(Boolean);
78
+ const hints = symbols.flatMap((symbol) => {
79
+ const coin = boardCoinFor(typedSymbol(symbol, args).toUpperCase());
80
+ if (!coin) return [];
81
+ const name = coin.name && coin.name.toUpperCase() !== coin.symbol ? ` (${coin.name})` : "";
82
+ return [`${coin.symbol}${name}${symbols.length > 1 ? ` for ${symbol}` : ""}`];
83
+ });
84
+ return hints.length ? `${line}${/[.!?]$/.test(line) ? "" : "."} Did you mean ${hints.join(", or ")}?` : line;
85
+ });
86
+ }
87
+
63
88
  // "Read "APPLE" as AAPL:NASDAQ (Apple Inc.)." as a list reads a one-word name, upper-cased like a symbol.
64
89
  const READ_AS_NAME = /Read "([^"\n]+)" as /g;
65
90
 
@@ -735,7 +735,9 @@ function renderCatalogEntry(entry: PaneCatalogEntry): string {
735
735
  lines.push(...wrapCommandLine(`gloom fn ${invocation}`, width));
736
736
  for (const example of entry.argExamples ?? []) lines.push(...wrapCommandLine(`gloom fn ${entry.token} ${example}`, width));
737
737
  for (const option of capability.options) {
738
- if (option.example) lines.push(...wrapCommandLine(`gloom fn ${option.exampleWithoutArgument ? entry.token : invocation} ${option.example}`, width));
738
+ for (const example of [option.example, ...(option.examples ?? [])]) {
739
+ if (example) lines.push(...wrapCommandLine(`gloom fn ${option.exampleWithoutArgument ? entry.token : invocation} ${example}`, width));
740
+ }
739
741
  }
740
742
  }
741
743
  const shotInvocation = entry.shotArgument ? `${entry.token} ${entry.shotArgument}` : invocation;