@gloom-sh/terminal 0.20.14 → 0.20.17

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 (186) hide show
  1. package/package.json +1 -1
  2. package/src/api-client/data.ts +13 -3
  3. package/src/api-client/index.ts +54 -0
  4. package/src/api-client/install-experiments.ts +8 -7
  5. package/src/api-client/paths.ts +2 -1
  6. package/src/api-client/product-waitlist.ts +63 -0
  7. package/src/api-client/request.ts +4 -2
  8. package/src/api-client/types/billing.ts +45 -0
  9. package/src/api-client/types/econ.ts +3 -0
  10. package/src/api-client/yearly-plan.ts +132 -0
  11. package/src/app/global-shortcuts.ts +5 -3
  12. package/src/app/pane-runtime/index.tsx +2 -2
  13. package/src/app/pane-runtime/plugin-bindings.ts +3 -1
  14. package/src/app/pane-runtime/ticker-open-runtime.ts +6 -1
  15. package/src/app/since-last-visit/keys.ts +26 -0
  16. package/src/app/since-last-visit/model.ts +266 -0
  17. package/src/app/since-last-visit/strip.tsx +193 -0
  18. package/src/app/since-last-visit/use-since-last-visit.ts +289 -0
  19. package/src/app/since-last-visit/visit-tracker.ts +191 -0
  20. package/src/app.tsx +15 -0
  21. package/src/cli/commands/fred-series.ts +3 -1
  22. package/src/cli/commands/market.ts +8 -4
  23. package/src/cli/commands/overview.ts +65 -13
  24. package/src/cli/commands/system.ts +29 -1
  25. package/src/cli/commands/ticker.ts +12 -5
  26. package/src/cli/csv-export.ts +73 -0
  27. package/src/cli/desktop-pane-shot-api-policy.ts +4 -1
  28. package/src/cli/desktop-pane-shot-browser.ts +2 -1
  29. package/src/cli/desktop-pane-shot-view.ts +3 -7
  30. package/src/cli/desktop-pane-shot.ts +29 -30
  31. package/src/cli/help.ts +5 -2
  32. package/src/cli/history-rows.ts +24 -0
  33. package/src/cli/index.ts +4 -0
  34. package/src/cli/options.ts +29 -1
  35. package/src/cli/pane-functions/catalog.ts +41 -4
  36. package/src/cli/pane-functions/function-help.ts +1 -1
  37. package/src/cli/pane-functions/headless.ts +70 -3
  38. package/src/cli/pane-functions/index.ts +4 -4
  39. package/src/cli/pane-functions/resolver.ts +43 -0
  40. package/src/cli/pane-functions/screenshot-bridge.ts +4 -2
  41. package/src/cli/pane-functions/screenshot-payload.ts +3 -0
  42. package/src/cli/report-tables.ts +37 -8
  43. package/src/cli/result.ts +3 -6
  44. package/src/cli/shot-temp-dir.ts +30 -0
  45. package/src/cli/suffixed-listing-rows.ts +11 -0
  46. package/src/components/chart/composite/composite-chart.tsx +3 -3
  47. package/src/components/chart/composite/legend.tsx +37 -7
  48. package/src/components/command-bar/commands/direct/index.ts +31 -8
  49. package/src/components/command-bar/commands/registry.ts +7 -0
  50. package/src/components/command-bar/routes/root/command-items.ts +8 -0
  51. package/src/components/command-bar/routes/root/results.ts +16 -0
  52. package/src/components/company-logo.tsx +10 -3
  53. package/src/components/data-table/sections.ts +6 -1
  54. package/src/components/layout/pane/title.ts +6 -2
  55. package/src/components/layout/shell/index.tsx +5 -1
  56. package/src/components/layout/shell/ticker-link-menu.ts +12 -9
  57. package/src/components/ticker/badge/format.ts +12 -3
  58. package/src/components/ticker/badge/index.tsx +9 -3
  59. package/src/components/ticker/list-table-view.tsx +119 -17
  60. package/src/components/ui/data-table/display-columns.ts +19 -0
  61. package/src/components/ui/data-table/hooks.ts +2 -3
  62. package/src/components/ui/data-table/index.tsx +43 -9
  63. package/src/components/ui/data-table/types.ts +21 -0
  64. package/src/components/ui/data-table/visible-range.ts +11 -1
  65. package/src/core/state/app/layout-reducer.ts +3 -1
  66. package/src/core/state/app/layout.ts +2 -2
  67. package/src/data/config/layout.ts +14 -0
  68. package/src/data/config/store/normalize.ts +11 -1
  69. package/src/i18n/es.ts +38 -0
  70. package/src/i18n/ja.ts +38 -0
  71. package/src/i18n/ko.ts +38 -0
  72. package/src/i18n/zh-cn.ts +38 -0
  73. package/src/i18n/zh-tw.ts +38 -0
  74. package/src/layout/pane-follow.ts +141 -4
  75. package/src/layout/pane-layout-move.ts +10 -7
  76. package/src/layout/ticker-navigation.ts +13 -19
  77. package/src/layout/ticker-retarget.ts +3 -2
  78. package/src/market-data/market/index-level.ts +19 -0
  79. package/src/plugins/builtin/account-management/keyboard.ts +14 -0
  80. package/src/plugins/builtin/account-management/model.ts +2 -0
  81. package/src/plugins/builtin/account-management/pane.tsx +79 -7
  82. package/src/plugins/builtin/account-management/payment-recovery-row.tsx +97 -0
  83. package/src/plugins/builtin/account-management/yearly-plan-row.tsx +359 -0
  84. package/src/plugins/builtin/awards/pane.tsx +12 -10
  85. package/src/plugins/builtin/changelog/index.tsx +6 -44
  86. package/src/plugins/builtin/changelog/versions.ts +17 -68
  87. package/src/plugins/builtin/chart-composer/pane.tsx +4 -1
  88. package/src/plugins/builtin/cloud/askg/executor.ts +2 -1
  89. package/src/plugins/builtin/cloud/askg/sources.ts +2 -1
  90. package/src/plugins/builtin/cpi/pane.tsx +1 -1
  91. package/src/plugins/builtin/credit-conditions/series.ts +2 -2
  92. package/src/plugins/builtin/debt-maturities/model.ts +1 -1
  93. package/src/plugins/builtin/earnings/board-model.ts +12 -0
  94. package/src/plugins/builtin/earnings/board-table.ts +8 -5
  95. package/src/plugins/builtin/earnings/board.tsx +38 -18
  96. package/src/plugins/builtin/earnings/highlight.ts +47 -0
  97. package/src/plugins/builtin/earnings/history-table.ts +1 -1
  98. package/src/plugins/builtin/earnings/index.tsx +1 -1
  99. package/src/plugins/builtin/earnings-calls/pane.tsx +2 -2
  100. package/src/plugins/builtin/econ/calendar-model.ts +2 -0
  101. package/src/plugins/builtin/econ/fred-catalog.ts +1 -256
  102. package/src/plugins/builtin/econ-statistics/cache.ts +1 -1
  103. package/src/plugins/builtin/econ-statistics/client.ts +11 -10
  104. package/src/plugins/builtin/econ-statistics/detail.tsx +1 -0
  105. package/src/plugins/builtin/econ-statistics/headless.ts +42 -6
  106. package/src/plugins/builtin/econ-statistics/index.tsx +1 -0
  107. package/src/plugins/builtin/econ-statistics/pane.tsx +7 -2
  108. package/src/plugins/builtin/econ-statistics/stats.ts +2 -1
  109. package/src/plugins/builtin/econ-statistics/view.ts +9 -3
  110. package/src/plugins/builtin/estimate-revisions/model.ts +1 -1
  111. package/src/plugins/builtin/exposure/index.tsx +1 -1
  112. package/src/plugins/builtin/macro-day/model.ts +6 -4
  113. package/src/plugins/builtin/market-valuation/detail.tsx +3 -3
  114. package/src/plugins/builtin/market-valuation/headless.ts +11 -4
  115. package/src/plugins/builtin/market-valuation/pane.tsx +3 -1
  116. package/src/plugins/builtin/market-valuation/view.ts +14 -0
  117. package/src/plugins/builtin/news/wire/news/detail-view.tsx +20 -8
  118. package/src/plugins/builtin/pe-band/pane.tsx +1 -1
  119. package/src/plugins/builtin/portfolio-list/cli/render.ts +8 -1
  120. package/src/plugins/builtin/portfolio-list/cli/watchlist-command.ts +176 -17
  121. package/src/plugins/builtin/portfolio-list/pane/groups.tsx +220 -0
  122. package/src/plugins/builtin/portfolio-list/pane/index.tsx +90 -15
  123. package/src/plugins/builtin/portfolio-list/table.tsx +13 -1
  124. package/src/plugins/builtin/research/corporate-actions-pane.tsx +4 -2
  125. package/src/plugins/builtin/research/relative-valuation-headless.ts +15 -5
  126. package/src/plugins/builtin/research/relative-valuation-model.ts +7 -1
  127. package/src/plugins/builtin/research/relative-valuation-pane.tsx +7 -4
  128. package/src/plugins/builtin/shared/fred-catalog.ts +256 -0
  129. package/src/plugins/builtin/shared/headless-options.ts +1 -1
  130. package/src/plugins/builtin/shared/series-cache.ts +3 -0
  131. package/src/plugins/builtin/shared/series-detail-chart.tsx +3 -0
  132. package/src/plugins/builtin/short-interest/watch-pane.tsx +7 -7
  133. package/src/plugins/builtin/social-mentions/model.ts +2 -2
  134. package/src/plugins/builtin/thirteenf/pane.tsx +1 -1
  135. package/src/plugins/builtin/ticker-detail/adr-pair/model.ts +16 -0
  136. package/src/plugins/builtin/ticker-detail/adr-pair/tab.tsx +8 -4
  137. package/src/plugins/builtin/ticker-detail/financials/model.ts +51 -16
  138. package/src/plugins/builtin/ticker-detail/financials/nopat.ts +16 -0
  139. package/src/plugins/builtin/ticker-detail/financials/ratios.ts +44 -13
  140. package/src/plugins/builtin/ticker-detail/financials/schema.ts +33 -2
  141. package/src/plugins/builtin/ticker-detail/financials/tab.tsx +4 -2
  142. package/src/plugins/builtin/ticker-detail/headless-schema.ts +30 -4
  143. package/src/plugins/builtin/ticker-detail/headless.ts +254 -34
  144. package/src/plugins/builtin/ticker-detail/overview/model.ts +7 -3
  145. package/src/plugins/builtin/ticker-detail/pharma-signals/eligibility.ts +32 -0
  146. package/src/plugins/builtin/ticker-detail/pharma-signals/tab.tsx +162 -0
  147. package/src/plugins/builtin/ticker-detail/pharma-signals/waitlist.ts +126 -0
  148. package/src/plugins/builtin/ticker-detail/research-groups.ts +6 -4
  149. package/src/plugins/builtin/ticker-detail/research-tabs.ts +11 -0
  150. package/src/plugins/builtin/time-sales/headless.ts +4 -1
  151. package/src/plugins/builtin/time-sales/pane.tsx +2 -0
  152. package/src/plugins/builtin/time-sales/window.ts +12 -0
  153. package/src/plugins/builtin/treasury-auctions/client.ts +4 -0
  154. package/src/plugins/builtin/treasury-auctions/treasury-direct.ts +2 -0
  155. package/src/plugins/builtin/treasury-daily/client.ts +23 -11
  156. package/src/portfolio/column-values.ts +20 -8
  157. package/src/portfolio/suffixed-listings.ts +3 -1
  158. package/src/portfolio/watchlist-groups.ts +212 -0
  159. package/src/react/ticker-source.ts +3 -1
  160. package/src/renderers/dom/styles.css +7 -0
  161. package/src/renderers/electrobun/view/cli-pane-shot-entry.tsx +2 -0
  162. package/src/sources/gloomberb-cloud/fred-publisher.ts +25 -0
  163. package/src/sources/gloomberb-cloud/fred-series.ts +1 -1
  164. package/src/state/app/bootstrap.ts +11 -0
  165. package/src/state/app/context/index.tsx +6 -0
  166. package/src/sync/collections-contributor.ts +5 -2
  167. package/src/sync/config-merge.ts +10 -2
  168. package/src/sync/sanitize.ts +28 -0
  169. package/src/telemetry/usage-counts.ts +17 -0
  170. package/src/time-series/base-series.ts +3 -0
  171. package/src/time-series/chart-seed.ts +1 -1
  172. package/src/time-series/financial-period-coverage.ts +4 -12
  173. package/src/time-series/ice-credit.ts +1 -0
  174. package/src/time-series/parsed-history-cache.ts +1 -1
  175. package/src/time-series/resolve.ts +1 -1
  176. package/src/time-series/types.ts +1 -0
  177. package/src/time-series/use-chart-resolution.ts +6 -1
  178. package/src/types/config.ts +32 -0
  179. package/src/types/headless.ts +9 -2
  180. package/src/types/plugin-context.ts +5 -0
  181. package/src/types/ticker.ts +14 -0
  182. package/src/ui/ascii-font.ts +1 -4
  183. package/src/utils/async-deadline.ts +2 -2
  184. package/src/utils/csv.ts +44 -5
  185. package/src/utils/futures-generic.ts +3 -0
  186. package/src/utils/throttled-fetch.ts +15 -1
@@ -4,7 +4,8 @@ import { ApiRequestError } from "../../api-client/errors";
4
4
  import type { CliCommandDef } from "../../types/plugin";
5
5
  import { withCliServices, withConfigData, withMarketData } from "../context";
6
6
  import { CLI_ERROR_CODE, failWithFields } from "../errors";
7
- import type { CliResultColumn } from "../result";
7
+ import type { CliResult, CliResultColumn, CliResultRenderOptions } from "../result";
8
+ import { fredCitation, fredPublisher } from "../../sources/gloomberb-cloud/fred-publisher";
8
9
  import { MISSING_VALUE, formatCompact } from "../../utils/format";
9
10
  import { DATE_OPTION_EXAMPLES, DATE_OPTION_FORMATS, dateOptionError, readCalendarDate } from "../../utils/calendar-date";
10
11
  import {
@@ -102,6 +103,7 @@ import {
102
103
  fredValueHeader,
103
104
  isSpreadSeries,
104
105
  laggingSeriesNote,
106
+ FRED_VINTAGE_NOTE,
105
107
  parseFredChange,
106
108
  } from "./fred-series";
107
109
  import { fredProvenance, fredPublicationTime, notOnFredSource } from "../../sources/gloomberb-cloud/fred-attribution";
@@ -745,12 +747,12 @@ async function runEcon(args: string[], ctx: Parameters<CliCommandDef["execute"]>
745
747
  }),
746
748
  // The exports add what a script needs to read a row; the text table keeps the columns it had.
747
749
  columns: [...econExportHeadColumns(viewerZone, publisherTimed), ...econFigureColumns(false), ...econExportColumns],
748
- textColumns: [...econTextHeadColumns(viewerZone, publisherTimed), ...econFigureColumns(true), ECON_PUBLISHER_COLUMN],
750
+ textColumns: [...econTextHeadColumns(viewerZone, publisherTimed), { key: "referencePeriod", header: "Period" }, ...econFigureColumns(true), ECON_PUBLISHER_COLUMN],
749
751
  });
750
752
  });
751
753
  }
752
754
 
753
- const FRED_USAGE = "fred <series-id> [--start <date>] [--sort desc|asc] [--change 1D|1W]";
755
+ const FRED_USAGE = "fred <series-id> [series-id ...] [--start <date>] [--sort desc|asc] [--change 1D|1W]";
754
756
  const FRED_LIST_USAGE = "fred --list [filter]";
755
757
 
756
758
  /** A year or a month stands for the first day of it. */
@@ -844,12 +846,55 @@ async function runFred(rawArgs: string[], ctx: Parameters<CliCommandDef["execute
844
846
  if (changeGiven && !horizon) {
845
847
  ctx.fail(change ? `Unknown change "${change}".` : "--change needs 1D or 1W.", "Use 1D (from the previous observation) or 1W (from a week before).");
846
848
  }
849
+ if (args.length > 1 || args[0]?.includes(",")) {
850
+ const seriesIds = [...new Set(args.flatMap((value) => value.split(",")).map((value) => value.trim().toUpperCase()).filter(Boolean))];
851
+ if (!seriesIds.length || seriesIds.some((seriesId) => !/^[A-Z0-9_]+$/.test(seriesId))) ctx.fail("Use space- or comma-separated series IDs.", `Usage: gloom ${FRED_USAGE}`);
852
+ if (seriesIds.length > 20) ctx.fail("fred accepts at most 20 series in one aligned report.");
853
+ return withSavedFredSeries(ctx, () => printFredAligned(ctx, seriesIds, { start, startDate, sortOrder, horizon }));
854
+ }
847
855
  const asked = requireOneArg(args, FRED_USAGE, "series", ctx);
848
856
  // A series by its name (`3 month t-bill` is DTB3) when one alone fits it.
849
857
  const seriesId = (/\s/.test(asked.trim()) ? fredSeriesIdForName(asked) : null) ?? asked.toUpperCase();
850
858
  await withSavedFredSeries(ctx, () => printFredSeries(ctx, { seriesId, start, startDate, sortOrder, horizon }));
851
859
  }
852
860
 
861
+ async function printFredAligned(ctx: Parameters<CliCommandDef["execute"]>[1], seriesIds: string[],
862
+ options: { start?: string; startDate: string; sortOrder: "asc" | "desc"; horizon: ReturnType<typeof parseFredChange> }) {
863
+ const reports: Array<{ seriesId: string; result: CliResult; render: CliResultRenderOptions }> = [];
864
+ for (const seriesId of seriesIds) {
865
+ await printFredSeries({ ...ctx, printResult: (result, render = {}) => { reports.push({ seriesId, result, render: render as unknown as CliResultRenderOptions }); } }, { ...options, start: options.start, seriesId });
866
+ }
867
+ const byDate = new Map<string, Record<string, unknown>>();
868
+ const metadata: Record<string, unknown> = {};
869
+ const notes = ["Aligned on observation dates, not release dates. Missing observations remain blank; values are not forward-filled."];
870
+ const suffixes = ["unit", "interval", "source", "released", "first_released", "revised_on", "first_release_value", ...options.horizon ? ["change", "changeFrom"] : [], "as_of"];
871
+ for (const { seriesId, result, render } of reports) {
872
+ metadata[seriesId] = result.metadata;
873
+ notes.push(...render.exportNotes ?? []);
874
+ for (const entry of result.data as Record<string, unknown>[]) {
875
+ const date = String(entry.date);
876
+ const row = byDate.get(date) ?? { date };
877
+ const identity = typeof render.exportIdentity === "function" ? render.exportIdentity(entry) : render.exportIdentity;
878
+ row[seriesId] = entry.value;
879
+ row[`${seriesId}_unit`] = identity?.currencyOrUnit;
880
+ row[`${seriesId}_interval`] = identity?.interval;
881
+ row[`${seriesId}_source`] = result.freshness?.source;
882
+ for (const suffix of suffixes.slice(3)) row[`${seriesId}_${suffix}`] = entry[suffix];
883
+ row[`${seriesId}_as_of`] = identity?.asOf;
884
+ byDate.set(date, row);
885
+ }
886
+ }
887
+ const rows = [...byDate.values()].sort((left, right) => options.sortOrder === "asc"
888
+ ? String(left.date).localeCompare(String(right.date)) : String(right.date).localeCompare(String(left.date)));
889
+ ctx.printResult({ data: rows, metadata: { series: metadata, alignment: "observation date" },
890
+ warnings: reports.flatMap(({ result }) => result.warnings ?? []),
891
+ freshness: rowsFreshness(rows, { source: [...new Set(reports.map(({ result }) => result.freshness?.source).filter(Boolean))].join("; "),
892
+ status: "not-a-feed", basis: "published statistics", observedKey: "date", oldest: null }),
893
+ }, { dateKey: "date", columns: ["date", ...seriesIds, ...seriesIds.flatMap((seriesId) => suffixes.map((suffix) => `${seriesId}_${suffix}`))].map((key) => ({ key, header: key })),
894
+ exportIdentity: { symbolOrSeries: seriesIds.join(" "), currencyOrUnit: "see per-series unit columns", interval: "see per-series interval columns" },
895
+ exportNotes: [...new Set(notes)], footnote: [...new Set(notes)].join("\n") });
896
+ }
897
+
853
898
  async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { seriesId, start, startDate, sortOrder, horizon }: {
854
899
  seriesId: string;
855
900
  start: string | undefined;
@@ -870,11 +915,11 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
870
915
  if (mismatch) ctx.fail(mismatch);
871
916
  // Each row's change in the unit its value exports in, and the date it is from; a holiday's stays blank.
872
917
  const changes = horizon ? fredChanges(seriesId, data.observations, horizon) : null;
873
- const releasedOf = (observation: { publisher?: string; publishedAt?: string; releasedOn?: string }) =>
874
- observation.releasedOn ?? (observation.publisher?.trim() ? observation.publishedAt : undefined);
918
+ const releasedOf = (observation: { publisher?: string; publishedAt?: string; releasedOn?: string; firstReleased?: string }) =>
919
+ observation.firstReleased ?? observation.releasedOn ?? (observation.publisher?.trim() ? observation.publishedAt : undefined);
875
920
  // A value FRED does not list yet carries its publisher and when it published, in every export.
876
921
  // A row from the copy an earlier read saved, the refresh having failed, carries its mark: the source line says so.
877
- const exportRow = (observation: { date: string; value: number | null; publisher?: string; publishedAt?: string; releasedOn?: string }) => ({
922
+ const exportRow = (observation: CloudFredSeriesPayload["observations"][number]) => ({
878
923
  ...savedCopyMark(data),
879
924
  date: observation.date,
880
925
  value: fredExportValue(seriesId, observation.value),
@@ -882,6 +927,9 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
882
927
  ...(observation.publisher?.trim() ? { publisher: observation.publisher.trim(), ...(observation.publishedAt ? { publishedAt: observation.publishedAt } : {}) } : {}),
883
928
  // When the figure came out, where the data says: only a series' newest observation does. `date` is the period it covers.
884
929
  ...releasedOf(observation) ? { released: releasedOf(observation) } : {},
930
+ ...(observation.firstReleased ? { first_released: observation.firstReleased } : {}),
931
+ ...(observation.revisedOn ? { revised_on: observation.revisedOn } : {}),
932
+ ...(observation.firstReleaseValue != null ? { first_release_value: fredExportValue(seriesId, observation.firstReleaseValue) } : {}),
885
933
  });
886
934
  // A --start before the series begins comes back padded with blank days: the rows start at its first observation.
887
935
  const fromStart = fredObservationsFromStart(data.observations, data.info?.observationStart)
@@ -892,6 +940,7 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
892
940
  ...fredHistoryNotes({ startDate, startGiven: start != null, seriesStart: data.info?.observationStart }),
893
941
  laggingSeriesNote(seriesId),
894
942
  computedFredSeriesNote(seriesId),
943
+ ...(data.observations.some((observation) => observation.firstReleased) ? [FRED_VINTAGE_NOTE] : []),
895
944
  // A publisher's licence asks for its attribution wherever its series is shown (MAS's SORA).
896
945
  seriesNotOnFred(seriesId)?.attribution ?? null,
897
946
  ].filter((note): note is string => note != null);
@@ -913,7 +962,7 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
913
962
  // A newest value FRED does not list yet names its publisher, Treasury for a yield; FRED's own stay "FRED".
914
963
  const ahead = fredProvenance(data.observations.filter((observation) => observation.date === newestDate), seriesId);
915
964
  // FRED names the series' publisher when Gloom Cloud passes it on, and when it last updated the series.
916
- const publisher = ahead?.publisher ?? data.info?.source?.trim();
965
+ const publisher = ahead?.publisher ?? fredPublisher(seriesId, data.info?.source);
917
966
  const publishedAt = ahead ? ahead.publishedAt : fredPublicationTime(data.info, newestDate);
918
967
  // When the newest figure was released: the report is as of then, `Sep 2026, released Tue 20 Oct`.
919
968
  const releasedOn = ahead ? undefined : data.observations.find((observation) => observation.date === newestDate)?.releasedOn;
@@ -926,7 +975,7 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
926
975
  ...(latest && !closedDay ? { latestObservation: exportRow(latest) } : {}),
927
976
  },
928
977
  freshness: rowsFreshness(rows, {
929
- source: ahead?.source ?? notOnFredSource(seriesId) ?? "FRED", status: "not-a-feed", basis: "published statistics", observedKey: "date", oldest: null,
978
+ source: ahead?.source ?? notOnFredSource(seriesId) ?? fredCitation(seriesId, data.info?.source), status: "not-a-feed", basis: "published statistics", observedKey: "date", oldest: null,
930
979
  // A monthly or quarterly observation is dated the first of its period, not a day it was seen.
931
980
  ...(periodicity ? { periodicity } : {}),
932
981
  ...(releasedOn ? { releasedOn } : {}),
@@ -937,16 +986,18 @@ async function printFredSeries(ctx: Parameters<CliCommandDef["execute"]>[1], { s
937
986
  dateKey: "date",
938
987
  empty: fredEmptyMessage(startDate, latest == null ? null : exportRow(latest)),
939
988
  ...(notes.length ? { footnote: notes.join("\n"), exportNotes: notes } : {}),
940
- // `as_of` is the release. A figure with none stated is as of its own day when the series is known to observe
989
+ // `as_of` is the revision or release. Without either, it is its own day when the series is known to observe
941
990
  // days (a daily or weekly rate), and of nothing otherwise, never the first day of the period it covers.
942
991
  exportDated: true,
992
+ exportAppendedKeys: ["first_released", "revised_on", "first_release_value"],
943
993
  exportIdentity: (row) => {
944
994
  const released = typeof row.released === "string" ? row.released : null;
995
+ const revised = typeof row.revised_on === "string" ? row.revised_on : null;
945
996
  const date = typeof row.date === "string" ? row.date : null;
946
- return { symbolOrSeries: seriesId, currencyOrUnit: unit, interval, asOf: released ?? (observesDays ? date : null), period: date, released };
997
+ return { symbolOrSeries: seriesId, currencyOrUnit: unit, interval, asOf: revised ?? released ?? (observesDays ? date : null), period: date, released };
947
998
  },
948
999
  // The release closes the row with the other dating columns, so it is not one of the observation's own.
949
- columns: [...new Set(rows.flatMap((row) => Object.keys(row)))].filter((key) => key !== "released").map((key) => ({ key, header: key })),
1000
+ columns: [...new Set([...rows.flatMap((row) => Object.keys(row)), "first_released", "revised_on", "first_release_value"])].filter((key) => key !== "released").map((key) => ({ key, header: key })),
950
1001
  textColumns: [
951
1002
  { key: "date", header: "Date" },
952
1003
  isSpreadSeries(seriesId)
@@ -1140,7 +1191,7 @@ export const overviewCliCommands: CliCommandDef[] = [
1140
1191
  options: [
1141
1192
  { flags: "--country <regions or countries>", description: "US, G7, EU, all (default), or countries by their two-letter codes, comma separated, such as MX or MX,BR,ZA" },
1142
1193
  { flags: "--impact <level>", description: "high, medium, low, or all (default all)" },
1143
- { flags: "--search <words>", description: "Events whose name or publisher has these words, case, spaces and hyphens aside, such as nonfarm, fed funds or USDA" },
1194
+ { flags: "--search <words>", description: "Match all words in an event name or publisher; OR joins alternatives, such as \"housing OR mortgage OR NAHB\". Case, spaces and hyphens are ignored" },
1144
1195
  { flags: "--from <date>", description: `First day listed, as ${DATE_OPTION_EXAMPLES} (default today, UTC); an earlier day lists past events from the stored calendar and says where it starts` },
1145
1196
  { flags: "--tz <zone>", description: "Add a column with each release's time on that clock, an IANA zone such as America/New_York; with the weekday when it falls on another day than the UTC date" },
1146
1197
  ],
@@ -1168,9 +1219,10 @@ export const overviewCliCommands: CliCommandDef[] = [
1168
1219
  title: "Series",
1169
1220
  lines: [
1170
1221
  "Gloom Cloud serves a curated set of FRED series and needs no sign-in for them. gloom fred (or fred --list) prints them by topic; any other ID fails with that pointer.",
1222
+ "Several IDs, separated by spaces or commas, align on observation dates without forward filling. Each series keeps its own unit, source and release fields.",
1171
1223
  ],
1172
1224
  }],
1173
- examples: ["fred CPIAUCSL", "fred DGS10 --tail 5", "fred DGS10 --change 1D --tail 5", "fred UNRATE --start 2020-01-01 --csv", "fred", "fred --list credit", "fred --list fx"],
1225
+ examples: ["fred CPIAUCSL", "fred DGS10 --tail 5", "fred DGS10 --change 1D --tail 5", "fred UNRATE --start 2020-01-01 --csv", "fred PERMIT HOUST --start 2026-01-01 --csv", "fred", "fred --list credit", "fred --list fx"],
1174
1226
  },
1175
1227
  execute: runFred,
1176
1228
  },
@@ -6,6 +6,8 @@ import { layoutWindowCounts } from "../../layout/pane-manager/transient";
6
6
  import { builtinPluginGroupMembers } from "../../plugins/ownership";
7
7
  import type { AppConfig, TelemetryConfig } from "../../types/config";
8
8
  import { canonicalTimeZone } from "../../utils/utc-time";
9
+ import type { CsvDecimal } from "../../utils/csv";
10
+ import { parseCsvDecimal } from "../options";
9
11
  import { readBaseCurrency } from "../../utils/base-currency";
10
12
  import { NIGHTLY_CHANNEL_SUMMARY, parseUpdateChannel, withUpdateChannel } from "../../updater/channel";
11
13
  import type { CliCommandDef } from "../../types/plugin";
@@ -40,6 +42,8 @@ const TIMEZONE_CONFIG_KEY = "timezone";
40
42
  const NO_TIMEZONE = "none";
41
43
  /** Stable releases, or nightly builds as well. */
42
44
  const UPDATE_CHANNEL_CONFIG_KEY = "updates.channel";
45
+ /** The decimal mark CSV exports write: a dot, or a comma with `;` between cells. */
46
+ const CSV_DECIMAL_CONFIG_KEY = "csvDecimal";
43
47
  const EDITABLE_CONFIG_KEYS = [
44
48
  "baseCurrency",
45
49
  "refreshIntervalMinutes",
@@ -49,6 +53,7 @@ const EDITABLE_CONFIG_KEYS = [
49
53
  STAR_PROMPT_CONFIG_KEY,
50
54
  TIMEZONE_CONFIG_KEY,
51
55
  UPDATE_CHANNEL_CONFIG_KEY,
56
+ CSV_DECIMAL_CONFIG_KEY,
52
57
  ];
53
58
 
54
59
  function isTelemetryConfigKey(key: string): key is TelemetryConfigKey {
@@ -120,6 +125,16 @@ function describeConfigValue(value: unknown): string {
120
125
  return String(value);
121
126
  }
122
127
 
128
+ /** The config with CSV exports' decimal mark: a comma is saved, the dot is the default and leaves nothing. */
129
+ function withCsvDecimal(config: AppConfig, decimal: CsvDecimal): AppConfig {
130
+ const { csvDecimal: _previous, ...rest } = config;
131
+ return decimal === "comma" ? { ...rest, csvDecimal: "comma" } : rest;
132
+ }
133
+
134
+ function describeCsvDecimal(value: unknown): string {
135
+ return value === "comma" ? "comma: CSV numbers as 17,2, cells split by ;" : "dot: CSV numbers as 17.2, cells split by ,";
136
+ }
137
+
123
138
  function withTimezone(config: AppConfig, timezone: string | null): AppConfig {
124
139
  const { timezone: _previous, ...rest } = config;
125
140
  return timezone ? { ...rest, timezone } : rest;
@@ -253,6 +268,7 @@ export function createSystemCliCommands(): CliCommandDef[] {
253
268
  "config set starPrompt.enabled false",
254
269
  "config set timezone <Region/City>|none",
255
270
  "config set updates.channel stable|nightly",
271
+ "config set csvDecimal comma|dot",
256
272
  "config get keybindings",
257
273
  "config set keybindings.actions.<action> <keys>|null|default",
258
274
  "config set keybindings.commands.<keys> <command>|null",
@@ -265,6 +281,11 @@ export function createSystemCliCommands(): CliCommandDef[] {
265
281
  lines: [
266
282
  "Times print in UTC. timezone takes an IANA zone name such as Asia/Tokyo or America/New_York, and CLI text and function reports then show your local time beside every UTC time. Trading days keep their market's date. none goes back to UTC alone. JSON and CSV keep the raw values.",
267
283
  ],
284
+ }, {
285
+ title: "CSV numbers",
286
+ lines: [
287
+ "CSV exports write numbers with a decimal point, cells split by commas. csvDecimal comma writes 17,2 with cells split by ; for a spreadsheet in a decimal-comma locale (German, French), every CSV the CLI and the app export; --decimal comma or --decimal dot decides for one command. Text and JSON keep the dot, and dates stay ISO.",
288
+ ],
268
289
  }, {
269
290
  title: "Themes",
270
291
  lines: [
@@ -328,6 +349,7 @@ export function createSystemCliCommands(): CliCommandDef[] {
328
349
  [STAR_PROMPT_CONFIG_KEY]: context.config.starPrompt?.enabled !== false,
329
350
  [TIMEZONE_CONFIG_KEY]: context.config.timezone ?? null,
330
351
  [UPDATE_CHANNEL_CONFIG_KEY]: context.config.updates?.channel ?? "stable",
352
+ [CSV_DECIMAL_CONFIG_KEY]: context.config.csvDecimal ?? "dot",
331
353
  };
332
354
 
333
355
  if (action === "list") {
@@ -338,6 +360,7 @@ export function createSystemCliCommands(): CliCommandDef[] {
338
360
  ...(key === KEYBINDINGS_CONFIG_KEY ? { format: summarizeKeybindings } : {}),
339
361
  ...(key === "theme" ? { format: (value: unknown) => describeThemeId(String(value)) } : {}),
340
362
  ...(key === TIMEZONE_CONFIG_KEY ? { format: describeTimezone } : {}),
363
+ ...(key === CSV_DECIMAL_CONFIG_KEY ? { format: describeCsvDecimal } : {}),
341
364
  ...(key === "baseCurrency" ? { format: describeBaseCurrency } : {}),
342
365
  ...(key === "telemetry.attention" ? { format: describeAttentionSetting } : {}),
343
366
  })),
@@ -359,6 +382,7 @@ export function createSystemCliCommands(): CliCommandDef[] {
359
382
  ctx.printResult({ data: { key, value: safeConfig[key] } }, {
360
383
  text: (data) => key === KEYBINDINGS_CONFIG_KEY ? renderKeybindings(data.value)
361
384
  : key === TIMEZONE_CONFIG_KEY ? describeTimezone(data.value)
385
+ : key === CSV_DECIMAL_CONFIG_KEY ? describeCsvDecimal(data.value)
362
386
  : key === "baseCurrency" ? describeBaseCurrency(data.value)
363
387
  : key === "telemetry.attention" ? describeAttentionSetting(data.value) : describeConfigValue(data.value),
364
388
  });
@@ -404,6 +428,8 @@ export function createSystemCliCommands(): CliCommandDef[] {
404
428
  ? parseTimezoneSetting(value)
405
429
  : key === UPDATE_CHANNEL_CONFIG_KEY
406
430
  ? parseUpdateChannel(value)
431
+ : key === CSV_DECIMAL_CONFIG_KEY
432
+ ? parseCsvDecimal(value, `config set ${CSV_DECIMAL_CONFIG_KEY}`)
407
433
  : key === "refreshIntervalMinutes"
408
434
  ? Number(value)
409
435
  : isBooleanConfigKey(key)
@@ -417,7 +443,9 @@ export function createSystemCliCommands(): CliCommandDef[] {
417
443
  ? withTimezone(context.config, parsedValue as string | null)
418
444
  : key === UPDATE_CHANNEL_CONFIG_KEY
419
445
  ? withUpdateChannel(context.config, parsedValue as "stable" | "nightly")
420
- : { ...context.config, [key]: parsedValue };
446
+ : key === CSV_DECIMAL_CONFIG_KEY
447
+ ? withCsvDecimal(context.config, parsedValue as CsvDecimal)
448
+ : { ...context.config, [key]: parsedValue };
421
449
  if (!ctx.cliOptions.dryRun) await saveConfig(nextConfig);
422
450
  ctx.printResult({
423
451
  data: {
@@ -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
 
@@ -0,0 +1,73 @@
1
+ import { csvDecimal, serializeCsv } from "../utils/csv";
2
+ import { splitCsvFooter } from "./report-tables";
3
+
4
+ function csvRows(text: string, separator: string): string[][] {
5
+ const rows: string[][] = [];
6
+ let row: string[] = [], cell = "", quoted = false;
7
+ for (let index = 0; index < text.length; index++) {
8
+ const character = text[index];
9
+ if (character === '"') {
10
+ if (quoted && text[index + 1] === '"') { cell += '"'; index++; }
11
+ else quoted = !quoted;
12
+ } else if (!quoted && character === separator) {
13
+ row.push(cell); cell = "";
14
+ } else if (!quoted && (character === "\n" || character === "\r")) {
15
+ if (character === "\r" && text[index + 1] === "\n") index++;
16
+ rows.push([...row, cell]); row = []; cell = "";
17
+ } else cell += character;
18
+ }
19
+ if (row.length || cell) rows.push([...row, cell]);
20
+ return rows;
21
+ }
22
+
23
+ export function portableCsv(text: string, warnings: readonly string[] = [], extraNotes: readonly string[] = []): string {
24
+ const decimal = csvDecimal();
25
+ const separator = decimal === "comma" ? ";" : ",";
26
+ const { csv, footer } = splitCsvFooter(text);
27
+ const tables: Array<{ section: string; columns: string[]; rows: string[][] }> = [];
28
+ let section = "", current: (typeof tables)[number] | null = null;
29
+ for (const row of csvRows(csv, separator)) {
30
+ if (row.length === 1 && row[0] === "") { current = null; continue; }
31
+ if (!current && row[0]?.startsWith("# section: ")) {
32
+ section = row.join(separator).slice("# section: ".length); current = null; continue;
33
+ }
34
+ if (!current) {
35
+ current = { section, columns: row.map((name) => name.replace(/\r\n?|\n/g, "\\n")), rows: [] }; tables.push(current);
36
+ } else current.rows.push(row);
37
+ }
38
+ const usedNames = new Set(tables.flatMap((table) => table.columns));
39
+ const variants = new Map<string, string[]>();
40
+ for (const table of tables) {
41
+ const occurrences = new Map<string, number>();
42
+ table.columns = table.columns.map((name) => {
43
+ const occurrence = occurrences.get(name) ?? 0;
44
+ occurrences.set(name, occurrence + 1);
45
+ const names = variants.get(name) ?? [name];
46
+ if (names[occurrence] === undefined) {
47
+ let suffix = occurrence + 1;
48
+ while (usedNames.has(`${name}_${suffix}`)) suffix++;
49
+ names[occurrence] = `${name}_${suffix}`;
50
+ usedNames.add(names[occurrence]!);
51
+ }
52
+ variants.set(name, names);
53
+ return names[occurrence]!;
54
+ });
55
+ }
56
+ const columns = [...new Set(tables.flatMap((table) => table.columns))];
57
+ const tagged = tables.length > 1 || tables.some((table) => table.section);
58
+ let sectionKey = "section", notesKey = "export_notes";
59
+ while (usedNames.has(sectionKey)) sectionKey = `_${sectionKey}`;
60
+ while (usedNames.has(notesKey)) notesKey = `_${notesKey}`;
61
+ const notes = [...new Set([...footer, ...extraNotes.flatMap((note) => note.split(/\r\n?|\n/).filter(Boolean).map((line) => `note: ${line}`)), ...warnings.map((warning) => `warning: ${warning}`)].map((note) => note.replace(/\r\n?|\n/g, " | ")))].join(" | ");
62
+ const header = [...columns, ...tagged ? [sectionKey] : [], notesKey];
63
+ const rows = tables.flatMap((table) => {
64
+ const indices = columns.map((column) => table.columns.indexOf(column));
65
+ return table.rows.map((row) => [...indices.map((index) => index < 0 ? "" : row[index] ?? ""), ...tagged ? [table.section] : [], notes]);
66
+ });
67
+ if (!rows.length && notes) rows.push([...header.slice(0, -1).map(() => ""), notes]);
68
+ const records = [header, ...rows];
69
+ const normalized = decimal === "comma"
70
+ ? records.map((row) => row.map((cell) => /^[+-]?(?:\d+(?:,\d+)?|,\d+)(?:e[+-]?\d+)?%?$/i.test(cell) ? cell.replace(",", ".") : cell))
71
+ : records;
72
+ return serializeCsv(normalized);
73
+ }
@@ -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";
@@ -123,7 +122,8 @@ export interface DesktopPaneShotApiProxy {
123
122
  */
124
123
  export interface DesktopPaneShotBridge {
125
124
  marketData(operation: string, args: unknown[]): Promise<unknown>;
126
- httpFetch(request: HttpProxyRequestEnvelope): Promise<HttpProxyResponseEnvelope>;
125
+ /** `signal` ends the read when the page gives up on it (its own deadline), so it holds nothing past that. */
126
+ httpFetch(request: HttpProxyRequestEnvelope, signal?: AbortSignal): Promise<HttpProxyResponseEnvelope>;
127
127
  }
128
128
 
129
129
  interface DesktopPaneShotRenderedCell {
@@ -272,32 +272,31 @@ export async function renderDesktopPaneScreenshot(
272
272
  ): Promise<DesktopPaneShotRenderResult> {
273
273
  const chrome = await findChromeExecutable();
274
274
  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
- }
275
+ return withShotTempDir("gloom-pane-shot-", async (tempDir) => {
276
+ const server = serveShotPage(view, shotPageHtml(view, payload), apiProxy, options.bridge ?? null);
277
+ try {
278
+ return await capturePageScreenshot({
279
+ chrome,
280
+ url: server.url,
281
+ outputPath,
282
+ widthPx: payload.widthPx,
283
+ heightPx: payload.heightPx,
284
+ deviceScaleFactor: payload.deviceScaleFactor ?? DEFAULT_DEVICE_SCALE_FACTOR,
285
+ userDataDir: join(tempDir, "chrome-profile"),
286
+ captureImage: options.captureImage !== false,
287
+ statusLine: payload.statusLine ? options.statusLine : undefined,
288
+ ...(payload.maxHeightCells ? {
289
+ fitRows: {
290
+ heightCells: payload.heightCells,
291
+ maxHeightCells: payload.maxHeightCells,
292
+ roles: payload.fitRoles ?? ["data-table-body-scroll"],
293
+ },
294
+ } : {}),
295
+ });
296
+ } finally {
297
+ server.stop();
298
+ }
299
+ });
301
300
  }
302
301
 
303
302
  /** The page for one capture: the shared view, with this capture's pane and data in its bootstrap script. */
@@ -496,7 +495,7 @@ async function runShotHttpBridge(
496
495
  if (!bridge) return Response.json({ ok: false, error: "No HTTP bridge" }, { status: 404 });
497
496
  try {
498
497
  const payload = await request.json() as HttpProxyRequestEnvelope;
499
- const data = await bridge.httpFetch(payload);
498
+ const data = await bridge.httpFetch(payload, request.signal);
500
499
  return Response.json({ ok: true, data });
501
500
  } catch (error) {
502
501
  return Response.json({ ok: false, error: errorMessage(error) });
package/src/cli/help.ts CHANGED
@@ -45,10 +45,11 @@ const START_HERE: Array<[string, string]> = [
45
45
 
46
46
  const GLOBAL_OPTIONS: Array<[string, string]> = [
47
47
  ["--json", "Print the full result as JSON"],
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"],
48
+ ["--csv", "Print one rectangular CSV with a single header, readable by pandas.read_csv with no options. Existing columns stay in order; duplicate headers gain unique numeric suffixes, and extra tables add columns and a section column. Header line breaks are escaped as \\n; data cells preserve quoted newlines. The final export_notes column stays single-line and repeats source details, caveats, warnings and truncation notes joined with |, including in files and pipes"],
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
- ["--limit <n>", "Show at most n rows, the first n as printed"],
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"],
52
+ ["--limit <n>", "For row/table reports, keep the first n rows in printed order, not the newest n (use --tail). Applies to text, JSON, CSV and NDJSON, not shot or scalar results. Pane reports may set a per-table limit or a source cap; see help fn <function>. It does not request all available source rows"],
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"],
54
55
  ["--dry-run", "Preview config, cache, notes, alerts, plugin on/off, and remote changes without saving"],
@@ -172,6 +173,8 @@ export function renderCommandHelp(command: CliCommandDef): string {
172
173
  { width, termStyle: cliStyles.command },
173
174
  ));
174
175
  }
176
+ lines.push("", renderSection("Output And Row Limits"));
177
+ lines.push(...renderDefinitions(GLOBAL_OPTIONS.filter(([flag]) => ["--csv", "--limit <n>", "--tail <n>"].includes(flag)), { width, termStyle: cliStyles.command }));
175
178
 
176
179
  for (const section of help.sections ?? []) {
177
180
  lines.push("", renderSection(section.title));
@@ -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. */