@gloom-sh/terminal 0.20.18 → 0.20.19
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.
- package/package.json +1 -1
- package/src/api-client/cot.ts +5 -6
- package/src/api-client/data.ts +11 -1
- package/src/api-client/index.ts +1 -0
- package/src/api-client/request.ts +162 -40
- package/src/api-client/types/news.ts +45 -0
- package/src/api-client/types/world-venues.ts +9 -0
- package/src/app.tsx +4 -2
- package/src/architecture/floating-promise-allowlist.json +1 -1
- package/src/cli/commands/market.ts +53 -17
- package/src/cli/commands/ticker.ts +13 -6
- package/src/cli/context.ts +8 -0
- package/src/cli/desktop-pane-shot-browser.ts +3 -1
- package/src/cli/desktop-pane-shot-view.ts +0 -1
- package/src/cli/desktop-pane-shot.ts +204 -43
- package/src/cli/errors.ts +3 -9
- package/src/cli/exit-codes.ts +1 -1
- package/src/cli/glossary.ts +1 -1
- package/src/cli/help.ts +1 -1
- package/src/cli/history-rows.ts +2 -2
- package/src/cli/index.ts +1 -1
- package/src/cli/listing-arg.ts +87 -23
- package/src/cli/pane-functions/catalog-snapshot.json +17 -6
- package/src/cli/pane-functions/dom.ts +30 -2
- package/src/cli/pane-functions/freshness.ts +23 -4
- package/src/cli/pane-functions/function-help.ts +3 -3
- package/src/cli/pane-functions/headless.ts +9 -1
- package/src/cli/pane-functions/index.ts +77 -10
- package/src/cli/pane-functions/report-notices.ts +10 -0
- package/src/cli/pane-functions/resolver.ts +3 -2
- package/src/cli/pane-functions/screenshot-assessment.ts +10 -5
- package/src/cli/pane-functions/screenshot-data-evidence.ts +7 -15
- package/src/cli/pane-functions/screenshot-payload.ts +24 -10
- package/src/cli/pane-functions/screenshot-render.ts +21 -8
- package/src/cli/pane-functions/screenshot-types.ts +9 -0
- package/src/cli/quote-answer.ts +1 -1
- package/src/cli/result.ts +17 -0
- package/src/cli/scroll-truncation.ts +7 -2
- package/src/cli/ticker-resolution.ts +1 -1
- package/src/cli/unreachable.ts +21 -0
- package/src/components/chart/composite/drawing-store.ts +11 -7
- package/src/components/chart/composite/format.ts +1 -0
- package/src/components/chart/composite/legend.tsx +5 -2
- package/src/components/chart/composite/panel-surface/plot-gestures.ts +9 -2
- package/src/components/chart/composite/panel-surface.tsx +1 -1
- package/src/components/chart/composite/tools.ts +164 -39
- package/src/components/chart-table/header.tsx +2 -2
- package/src/components/chart-table/layout.ts +5 -6
- package/src/components/command-bar/routes/root/runtime.ts +11 -3
- package/src/components/command-bar/routes/ticker-search/results.ts +5 -0
- package/src/components/command-bar/selection-runtime.ts +29 -5
- package/src/components/command-bar/surface/index.tsx +4 -1
- package/src/components/command-bar/workflow/alert.ts +13 -5
- package/src/components/layout/pane/footer/model.ts +10 -2
- package/src/components/layout/pane/status-footer.ts +24 -0
- package/src/components/price-performance.tsx +26 -8
- package/src/components/reader/article-reader.tsx +12 -5
- package/src/components/ui/data-table/opentui/index.tsx +7 -0
- package/src/components/ui/table-layout.ts +32 -1
- package/src/market-data/ah-pair.ts +19 -0
- package/src/market-data/coordinator/entries.ts +6 -4
- package/src/market-data/coordinator/index.ts +14 -3
- package/src/market-data/futures-board.ts +36 -29
- package/src/market-data/futures-contract.ts +37 -1
- package/src/market-data/market/change-basis.ts +9 -0
- package/src/market-data/market/status.ts +40 -4
- package/src/market-data/performance.ts +127 -32
- package/src/market-data/quotes/time.ts +5 -2
- package/src/news/types.ts +28 -0
- package/src/notifications/app-badge.ts +2 -3
- package/src/notifications/app-notifier.ts +5 -0
- package/src/plugins/builtin/alerts/cli.ts +65 -18
- package/src/plugins/builtin/alerts/command.ts +39 -9
- package/src/plugins/builtin/alerts/event-rows.ts +9 -3
- package/src/plugins/builtin/alerts/events-pane.tsx +16 -10
- package/src/plugins/builtin/alerts/headless.ts +12 -6
- package/src/plugins/builtin/alerts/index.tsx +60 -8
- package/src/plugins/builtin/alerts/option-contract.ts +197 -0
- package/src/plugins/builtin/alerts/price.ts +30 -5
- package/src/plugins/builtin/alerts/pro-rules.ts +62 -0
- package/src/plugins/builtin/alerts/research-builder.ts +5 -10
- package/src/plugins/builtin/analytics/account-returns.ts +1 -1
- package/src/plugins/builtin/analytics/pane-model.ts +2 -2
- package/src/plugins/builtin/analytics/risk-client.ts +1 -1
- package/src/plugins/builtin/buildout/company/pane.tsx +4 -14
- package/src/plugins/builtin/catalysts/model.ts +2 -1
- package/src/plugins/builtin/chart-composer/chart-spec.ts +5 -0
- package/src/plugins/builtin/chart-composer/cli-options.ts +5 -3
- package/src/plugins/builtin/chart-composer/headless-schema.ts +14 -10
- package/src/plugins/builtin/chart-composer/headless.ts +2 -0
- package/src/plugins/builtin/chart-composer/index.tsx +17 -5
- package/src/plugins/builtin/chart-composer/pane.tsx +14 -4
- package/src/plugins/builtin/chart-composer/viewport-labels.ts +2 -17
- package/src/plugins/builtin/chat/controller/notifications.ts +1 -0
- package/src/plugins/builtin/chat/index.tsx +0 -1
- package/src/plugins/builtin/commodities-energy/index.tsx +1 -1
- package/src/plugins/builtin/company-kpis/headless.ts +1 -1
- package/src/plugins/builtin/company-kpis/model.ts +21 -9
- package/src/plugins/builtin/congress-trades/model.ts +9 -5
- package/src/plugins/builtin/cot/client.ts +2 -3
- package/src/plugins/builtin/cot/headless.ts +16 -16
- package/src/plugins/builtin/cot/index.tsx +6 -6
- package/src/plugins/builtin/cot/model.ts +25 -5
- package/src/plugins/builtin/cot/pane.tsx +11 -6
- package/src/plugins/builtin/cot/series.ts +11 -8
- package/src/plugins/builtin/cpi/model.ts +15 -4
- package/src/plugins/builtin/cpi/pane.tsx +29 -7
- package/src/plugins/builtin/doe/model.ts +30 -0
- package/src/plugins/builtin/doe/pane.tsx +8 -2
- package/src/plugins/builtin/earnings/board-table.ts +9 -4
- package/src/plugins/builtin/earnings/headless.ts +10 -3
- package/src/plugins/builtin/earnings/history-table.ts +4 -2
- package/src/plugins/builtin/earnings-calls/calendar.tsx +4 -3
- package/src/plugins/builtin/earnings-ripple/pane.tsx +2 -2
- package/src/plugins/builtin/econ/index.tsx +4 -2
- package/src/plugins/builtin/futures/model.ts +14 -1
- package/src/plugins/builtin/futures/series.ts +1 -8
- package/src/plugins/builtin/fx-matrix/index.tsx +2 -2
- package/src/plugins/builtin/insider/detail.tsx +36 -7
- package/src/plugins/builtin/insider/filing-stories.ts +110 -0
- package/src/plugins/builtin/insider/headless.ts +37 -2
- package/src/plugins/builtin/insider/index.tsx +79 -10
- package/src/plugins/builtin/insider/model.ts +43 -5
- package/src/plugins/builtin/ipo-calendar/client.ts +11 -1
- package/src/plugins/builtin/ipo-calendar/model.ts +3 -7
- package/src/plugins/builtin/jobs/headless.ts +2 -1
- package/src/plugins/builtin/jobs/model.ts +6 -0
- package/src/plugins/builtin/jobs/pane.tsx +8 -3
- package/src/plugins/builtin/news/wire/news/detail-view.tsx +118 -10
- package/src/plugins/builtin/news/wire/news/story-evidence.ts +178 -0
- package/src/plugins/builtin/options/analytics.ts +1 -1
- package/src/plugins/builtin/options/view.tsx +18 -11
- package/src/plugins/builtin/options-positioning/model.ts +11 -0
- package/src/plugins/builtin/options-positioning/pane.tsx +22 -1
- package/src/plugins/builtin/options-scenario/client.ts +49 -8
- package/src/plugins/builtin/options-scenario/headless.ts +7 -3
- package/src/plugins/builtin/options-scenario/model.ts +33 -2
- package/src/plugins/builtin/options-scenario/pane.tsx +3 -4
- package/src/plugins/builtin/perps/cascade.ts +4 -3
- package/src/plugins/builtin/perps/markets-section.tsx +5 -2
- package/src/plugins/builtin/perps/model.ts +4 -3
- package/src/plugins/builtin/portfolio-list/table.tsx +3 -2
- package/src/plugins/builtin/research/corporate-actions-pane.tsx +29 -14
- package/src/plugins/builtin/research/event-model.ts +12 -6
- package/src/plugins/builtin/research-search/index.tsx +3 -1
- package/src/plugins/builtin/scanner/denied.tsx +16 -4
- package/src/plugins/builtin/scanner/flow-pane.tsx +1 -1
- package/src/plugins/builtin/scanner/hilo-pane.tsx +1 -1
- package/src/plugins/builtin/sec/filing-display.tsx +14 -2
- package/src/plugins/builtin/sec/headless.ts +42 -4
- package/src/plugins/builtin/sec/index.tsx +21 -1
- package/src/plugins/builtin/sectors/sector-model.ts +1 -1
- package/src/plugins/builtin/shared/earnings-report.ts +32 -3
- package/src/plugins/builtin/shared/options-pro-copy.ts +34 -0
- package/src/plugins/builtin/shared/statement-currency.ts +23 -0
- package/src/plugins/builtin/shared/ticker-surface.ts +1 -1
- package/src/plugins/builtin/supply-chain/pane.tsx +4 -3
- package/src/plugins/builtin/themes/headless.ts +4 -4
- package/src/plugins/builtin/themes/model.ts +11 -8
- package/src/plugins/builtin/themes/pane.tsx +2 -2
- package/src/plugins/builtin/ticker-detail/financials/model.ts +22 -32
- package/src/plugins/builtin/ticker-detail/financials/tab.tsx +7 -9
- package/src/plugins/builtin/ticker-detail/headless-schema.ts +2 -0
- package/src/plugins/builtin/ticker-detail/headless.ts +28 -12
- package/src/plugins/builtin/ticker-detail/overview/board-lot.ts +21 -0
- package/src/plugins/builtin/ticker-detail/overview/model.ts +11 -1
- package/src/plugins/builtin/ticker-detail/overview/pane.tsx +4 -0
- package/src/plugins/builtin/ticker-detail/overview-tab.tsx +61 -13
- package/src/plugins/builtin/volatility/pane.tsx +3 -3
- package/src/plugins/builtin/world-venue-map/headless.ts +4 -2
- package/src/plugins/builtin/world-venue-map/model.ts +6 -1
- package/src/plugins/builtin/world-venue-map/venue-header.tsx +5 -3
- package/src/plugins/catalog-browser.ts +10 -1
- package/src/renderers/browser/activity.ts +16 -0
- package/src/renderers/browser/app-badge-host.ts +14 -0
- package/src/renderers/browser/main.tsx +5 -0
- package/src/renderers/browser/notifications.ts +103 -0
- package/src/renderers/browser/ui-host.tsx +4 -0
- package/src/renderers/dom/data-table/index.tsx +27 -4
- package/src/renderers/electrobun/view/http-fetch.ts +3 -2
- package/src/sources/gloomberb-cloud/index.ts +8 -6
- package/src/sources/gloomberb-cloud/news.ts +35 -0
- package/src/sources/provider-errors.ts +34 -7
- package/src/sources/provider-router/history.ts +32 -6
- package/src/time-series/base-series.ts +39 -6
- package/src/time-series/chart-seed.ts +2 -2
- package/src/time-series/history-quality.ts +4 -1
- package/src/time-series/hooks.ts +2 -0
- package/src/time-series/price-comparison.ts +17 -23
- package/src/time-series/reporting.ts +1 -1
- package/src/time-series/resolution.ts +13 -0
- package/src/time-series/resolve-context.ts +6 -0
- package/src/time-series/resolve.ts +39 -2
- package/src/time-series/types.ts +2 -1
- package/src/types/financials.ts +9 -1
- package/src/types/headless.ts +1 -0
- package/src/types/issuer-listings.ts +2 -0
- package/src/types/plugin-notifications.ts +3 -0
- package/src/types/price-history.ts +6 -4
- package/src/ui/host.tsx +2 -0
- package/src/utils/exchange-announcements.ts +7 -2
- package/src/utils/fundamentals.ts +40 -0
- package/src/utils/network-failure.ts +2 -0
- package/src/utils/price-history-integrity.ts +9 -1
|
@@ -2,7 +2,6 @@ import type { ScannerCapture } from "../plugins/builtin/shared/scanner-capture";
|
|
|
2
2
|
import type { TapeCapture } from "../plugins/builtin/time-sales/snapshot-client";
|
|
3
3
|
import { randomBytes, timingSafeEqual } from "crypto";
|
|
4
4
|
import { join } from "path";
|
|
5
|
-
import { writeOutputFile } from "./output-file";
|
|
6
5
|
import { withShotTempDir } from "./shot-temp-dir";
|
|
7
6
|
import { encodeRpcValue } from "../renderers/electrobun/shared/rpc-codec";
|
|
8
7
|
import type { AppConfig } from "../types/config";
|
|
@@ -21,7 +20,7 @@ import type { HttpProxyRequestEnvelope, HttpProxyResponseEnvelope } from "../uti
|
|
|
21
20
|
import type { PaneAccessGate } from "./pane-functions/access-gate";
|
|
22
21
|
import { countContentFigures } from "./content-figures";
|
|
23
22
|
import { readVisibleKeyValues } from "./visible-key-values";
|
|
24
|
-
import { scrollTruncationReasons } from "./scroll-truncation";
|
|
23
|
+
import { rowViewportVisibility, scrollTruncationReasons } from "./scroll-truncation";
|
|
25
24
|
import {
|
|
26
25
|
SHOT_API_PROXY_PREFIX,
|
|
27
26
|
SHOT_API_SOCKET_PATH,
|
|
@@ -32,6 +31,13 @@ import {
|
|
|
32
31
|
type ShotMarketSocketCall,
|
|
33
32
|
} from "./desktop-pane-shot-routes";
|
|
34
33
|
import { SHOT_REQUEST_REFUSED } from "../api-client/errors";
|
|
34
|
+
import {
|
|
35
|
+
dataServiceAnswerCount, dataServiceReachEpoch, dataServiceUnreachable, isProxyRefusal, MARKET_REQUEST_TIMEOUT_MS, noteDataServiceReach,
|
|
36
|
+
SHOT_SERVICE_UNREACHABLE_HEADER, UNREACHABLE_REQUEST_TIMEOUT_MS,
|
|
37
|
+
} from "../api-client/request";
|
|
38
|
+
import type { FuturesContractTermsPayload } from "../api-client/futures-curve";
|
|
39
|
+
import { rememberFuturesContractTerms, savedFuturesContractTerms } from "../market-data/futures-contract";
|
|
40
|
+
import { DATA_SERVICE_UNREACHABLE_MESSAGE, isNetworkFailure } from "../utils/network-failure";
|
|
35
41
|
import { SESSION_COOKIE_NAMES } from "../api-client/session-cookie";
|
|
36
42
|
import { isShotApiRequestAllowed, isShotSessionPath } from "./desktop-pane-shot-api-policy";
|
|
37
43
|
import { renderElectrobunViewHtml } from "../renderers/dom/build-assets";
|
|
@@ -111,6 +117,47 @@ export interface DesktopPaneShotPayload {
|
|
|
111
117
|
export interface DesktopPaneShotApiProxy {
|
|
112
118
|
baseUrl: string;
|
|
113
119
|
sessionToken: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Called with when a copy was saved (ms) each time the proxy answers a
|
|
122
|
+
* read the data service did not answer from a copy saved earlier, so the
|
|
123
|
+
* report dates what it shows as saved (`SHOT_SAVED_COPY_READS`).
|
|
124
|
+
*/
|
|
125
|
+
onSavedCopy?: (savedAt: number) => void;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The reads the proxy keeps a copy of and answers from it when the data
|
|
130
|
+
* service does not answer: a futures symbol's contract terms, which a pane's
|
|
131
|
+
* settle line and Contract block are drawn from beside the bridged quote's
|
|
132
|
+
* saved copy. Offline, DES GC=F kept the saved price and lost both.
|
|
133
|
+
*/
|
|
134
|
+
const SHOT_SAVED_COPY_READS: ReadonlyArray<{
|
|
135
|
+
path: RegExp;
|
|
136
|
+
save(key: string, body: unknown): void;
|
|
137
|
+
read(key: string): { value: unknown; savedAt: number } | null;
|
|
138
|
+
}> = [{
|
|
139
|
+
path: /^\/cloud\/futures\/contract\/([^/?#]+)$/,
|
|
140
|
+
save: (symbol, body) => rememberFuturesContractTerms(symbol, body as FuturesContractTermsPayload),
|
|
141
|
+
read: (symbol) => {
|
|
142
|
+
const saved = savedFuturesContractTerms(symbol);
|
|
143
|
+
return saved && { value: saved.terms, savedAt: saved.savedAt };
|
|
144
|
+
},
|
|
145
|
+
}];
|
|
146
|
+
|
|
147
|
+
/** The kept read a GET path is, with its key (the symbol), or null. */
|
|
148
|
+
function savedCopyRead(method: string, path: string): { read: typeof SHOT_SAVED_COPY_READS[number]; key: string } | null {
|
|
149
|
+
if (method !== "GET") return null;
|
|
150
|
+
for (const read of SHOT_SAVED_COPY_READS) {
|
|
151
|
+
const match = read.path.exec(path);
|
|
152
|
+
if (!match?.[1]) continue;
|
|
153
|
+
try {
|
|
154
|
+
return { read, key: decodeURIComponent(match[1]) };
|
|
155
|
+
} catch {
|
|
156
|
+
// Intentional ignore: a symbol whose percent-encoding is malformed names no kept copy, so the read goes out as sent.
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
114
161
|
}
|
|
115
162
|
|
|
116
163
|
/**
|
|
@@ -161,6 +208,12 @@ interface DesktopPaneShotSurface {
|
|
|
161
208
|
|
|
162
209
|
export interface DesktopPaneShotRenderResult {
|
|
163
210
|
visibleText: string;
|
|
211
|
+
/**
|
|
212
|
+
* What the visible text fields hold (OVME's Underlying, a search box), which
|
|
213
|
+
* `visibleText` leaves out: an input's value is not its text. A password
|
|
214
|
+
* field is never read. Absent when no field holds anything.
|
|
215
|
+
*/
|
|
216
|
+
fieldValues?: string[];
|
|
164
217
|
/**
|
|
165
218
|
* The visible text a line per block of the page, as the browser lays it out,
|
|
166
219
|
* where `visibleText` has run them together: the words of a pane that is prose
|
|
@@ -279,10 +332,9 @@ export function prepareDesktopPaneShotView(): void {
|
|
|
279
332
|
|
|
280
333
|
export async function renderDesktopPaneScreenshot(
|
|
281
334
|
payload: DesktopPaneShotPayload,
|
|
282
|
-
outputPath: string,
|
|
283
335
|
apiProxy: DesktopPaneShotApiProxy,
|
|
284
336
|
options: { captureImage?: boolean; bridge?: DesktopPaneShotBridge; statusLine?: ShotStatusLine } = {},
|
|
285
|
-
): Promise<DesktopPaneShotRenderResult> {
|
|
337
|
+
): Promise<DesktopPaneShotRenderResult & { image?: Uint8Array }> {
|
|
286
338
|
const chrome = await findChromeExecutable();
|
|
287
339
|
const view = await loadShotView();
|
|
288
340
|
return withShotTempDir("gloom-pane-shot-", async (tempDir) => {
|
|
@@ -291,7 +343,6 @@ export async function renderDesktopPaneScreenshot(
|
|
|
291
343
|
return await capturePageScreenshot({
|
|
292
344
|
chrome,
|
|
293
345
|
url: server.url,
|
|
294
|
-
outputPath,
|
|
295
346
|
widthPx: payload.widthPx,
|
|
296
347
|
heightPx: payload.heightPx,
|
|
297
348
|
deviceScaleFactor: payload.deviceScaleFactor ?? DEFAULT_DEVICE_SCALE_FACTOR,
|
|
@@ -392,6 +443,9 @@ export function serveShotPage(
|
|
|
392
443
|
bridge: DesktopPaneShotBridge | null,
|
|
393
444
|
): ShotServer {
|
|
394
445
|
const secret = randomBytes(32).toString("hex");
|
|
446
|
+
// Every read the page has the proxy make ends when the capture does, answered or not: a read through a proxy that
|
|
447
|
+
// never answers must not hold the command's process open after its report is printed.
|
|
448
|
+
const upstream = new AbortController();
|
|
395
449
|
const server = Bun.serve({
|
|
396
450
|
hostname: "127.0.0.1",
|
|
397
451
|
port: 0,
|
|
@@ -405,7 +459,8 @@ export function serveShotPage(
|
|
|
405
459
|
return server.upgrade(request, { data: undefined }) ? undefined : new Response("Expected a WebSocket upgrade", { status: 426 });
|
|
406
460
|
}
|
|
407
461
|
if (url.pathname.startsWith(`${SHOT_API_PROXY_PREFIX}/`)) {
|
|
408
|
-
|
|
462
|
+
// Also given up when the page stops waiting for it.
|
|
463
|
+
return proxyShotApiRequest(request, url, apiProxy, AbortSignal.any([request.signal, upstream.signal]));
|
|
409
464
|
}
|
|
410
465
|
if (url.pathname === SHOT_MARKET_BRIDGE_PATH || url.pathname === SHOT_HTTP_BRIDGE_PATH) {
|
|
411
466
|
if (request.method !== "POST") return new Response("Method not allowed", { status: 405 });
|
|
@@ -416,13 +471,16 @@ export function serveShotPage(
|
|
|
416
471
|
},
|
|
417
472
|
websocket: {
|
|
418
473
|
message(socket, message) {
|
|
419
|
-
void answerShotApiCall(String(message), apiProxy, bridge).then((reply) => replyOverShotSocket(socket, reply));
|
|
474
|
+
void answerShotApiCall(String(message), apiProxy, bridge, upstream.signal).then((reply) => replyOverShotSocket(socket, reply));
|
|
420
475
|
},
|
|
421
476
|
},
|
|
422
477
|
});
|
|
423
478
|
return {
|
|
424
479
|
url: `http://127.0.0.1:${server.port}/${secret}/`,
|
|
425
|
-
stop: () =>
|
|
480
|
+
stop: () => {
|
|
481
|
+
upstream.abort();
|
|
482
|
+
return server.stop(true);
|
|
483
|
+
},
|
|
426
484
|
};
|
|
427
485
|
}
|
|
428
486
|
|
|
@@ -446,6 +504,7 @@ export async function answerShotApiCall(
|
|
|
446
504
|
message: string,
|
|
447
505
|
apiProxy: DesktopPaneShotApiProxy,
|
|
448
506
|
bridge: DesktopPaneShotBridge | null = null,
|
|
507
|
+
signal?: AbortSignal,
|
|
449
508
|
): Promise<string> {
|
|
450
509
|
let id = 0;
|
|
451
510
|
try {
|
|
@@ -458,7 +517,7 @@ export async function answerShotApiCall(
|
|
|
458
517
|
if (typeof call.path !== "string" || !call.path.startsWith("/") || call.path.startsWith("//")) throw new Error("Not an API path.");
|
|
459
518
|
const url = new URL(`${SHOT_API_PROXY_PREFIX}${call.path}`, "http://127.0.0.1");
|
|
460
519
|
const sent = new Headers(Array.isArray(call.headers) ? call.headers : []);
|
|
461
|
-
response = await proxyShotApiRequest(new Request(url, { headers: sent }), url, apiProxy);
|
|
520
|
+
response = await proxyShotApiRequest(new Request(url, { headers: sent }), url, apiProxy, signal);
|
|
462
521
|
}
|
|
463
522
|
const body = Buffer.from(await response.arrayBuffer()).toString("base64");
|
|
464
523
|
const headers: Array<[string, string]> = [];
|
|
@@ -565,7 +624,10 @@ async function proxyShotApiRequest(
|
|
|
565
624
|
request: Request,
|
|
566
625
|
requestUrl: URL,
|
|
567
626
|
apiProxy: DesktopPaneShotApiProxy,
|
|
627
|
+
signal?: AbortSignal,
|
|
568
628
|
): Promise<Response> {
|
|
629
|
+
// The command this read is for, which records what it came to.
|
|
630
|
+
const epoch = dataServiceReachEpoch();
|
|
569
631
|
const baseUrl = new URL(apiProxy.baseUrl);
|
|
570
632
|
const basePath = baseUrl.pathname.replace(/\/+$/, "");
|
|
571
633
|
let path = requestUrl.pathname.slice(SHOT_API_PROXY_PREFIX.length) || "/";
|
|
@@ -587,13 +649,51 @@ async function proxyShotApiRequest(
|
|
|
587
649
|
target.pathname = `${basePath}${path}`;
|
|
588
650
|
target.search = requestUrl.search;
|
|
589
651
|
target.hash = "";
|
|
652
|
+
const kept = requestUrl.search ? null : savedCopyRead(method, path);
|
|
653
|
+
// Not reached: a kept read answers from its saved copy, dated as saved; any other is told the service was not reached.
|
|
654
|
+
const savedAnswer = () => {
|
|
655
|
+
const saved = kept?.read.read(kept.key);
|
|
656
|
+
if (!saved) return null;
|
|
657
|
+
noteDataServiceReach(false, epoch);
|
|
658
|
+
apiProxy.onSavedCopy?.(saved.savedAt);
|
|
659
|
+
return Response.json(saved.value, { headers: { "Cache-Control": "no-store" } });
|
|
660
|
+
};
|
|
661
|
+
const unreachable = () => savedAnswer() ?? shotApiUnreachable(epoch);
|
|
662
|
+
// Once a read of this command went unanswered, a kept read is its saved copy at once: the page, which knows the
|
|
663
|
+
// service is down too, waits no longer for it than the proxy would for the network.
|
|
664
|
+
if (kept && dataServiceUnreachable()) {
|
|
665
|
+
const saved = savedAnswer();
|
|
666
|
+
if (saved) return saved;
|
|
667
|
+
}
|
|
668
|
+
// As the client's own requests wait (`deadlineFor`): ten seconds for the service to answer anything, three once a
|
|
669
|
+
// read of this command went unanswered. A hung connection was otherwise held until the page gave up, or to the end.
|
|
670
|
+
const answerMs = dataServiceUnreachable() ? UNREACHABLE_REQUEST_TIMEOUT_MS : MARKET_REQUEST_TIMEOUT_MS;
|
|
671
|
+
const answersAtStart = dataServiceAnswerCount();
|
|
672
|
+
const cut = new AbortController();
|
|
673
|
+
const abortFromPage = () => cut.abort(signal?.reason);
|
|
674
|
+
if (signal?.aborted) abortFromPage();
|
|
675
|
+
else signal?.addEventListener("abort", abortFromPage, { once: true });
|
|
676
|
+
let cutOff = false;
|
|
677
|
+
const deadline = setTimeout(function giveUp() {
|
|
678
|
+
// Another read answered meanwhile: the service is up and this one is slow, not cut off.
|
|
679
|
+
if (dataServiceAnswerCount() > answersAtStart) return;
|
|
680
|
+
cutOff = true;
|
|
681
|
+
cut.abort(new Error("The data service sent nothing back"));
|
|
682
|
+
}, answerMs);
|
|
590
683
|
|
|
591
684
|
try {
|
|
592
685
|
let body = method === "GET" || method === "HEAD" ? undefined : new Uint8Array(await request.arrayBuffer());
|
|
593
686
|
for (let followed = 0; ; followed += 1) {
|
|
594
|
-
const response = await fetch(target, { method, headers, body, redirect: "manual" });
|
|
687
|
+
const response = await fetch(target, { method, headers, body, redirect: "manual", signal: cut.signal });
|
|
688
|
+
clearTimeout(deadline);
|
|
689
|
+
// The proxy in HTTPS_PROXY refusing to reach the service answers for it: the page is told the service was not reached.
|
|
690
|
+
if (isProxyRefusal(target.href, response)) {
|
|
691
|
+
await response.body?.cancel().catch(() => { /* Intentional ignore: the refusal's own body is never read. */ });
|
|
692
|
+
return unreachable();
|
|
693
|
+
}
|
|
694
|
+
noteDataServiceReach(true, epoch);
|
|
595
695
|
const location = SHOT_API_REDIRECT_STATUSES.has(response.status) ? response.headers.get("location") : null;
|
|
596
|
-
if (location === null) return await shotApiResponse(response, path);
|
|
696
|
+
if (location === null) return kept && response.ok ? await keptResponse(response, kept) : await shotApiResponse(response, path);
|
|
597
697
|
await response.body?.cancel().catch(() => { /* Intentional ignore: a redirect's own body is never read, only dropped. */ });
|
|
598
698
|
if (followed >= SHOT_API_MAX_REDIRECTS) return shotApiError("Cloud API redirected too many times.", 502);
|
|
599
699
|
const next = new URL(location, target);
|
|
@@ -610,10 +710,42 @@ async function proxyShotApiRequest(
|
|
|
610
710
|
if (!inApi || !isShotApiRequestAllowed(method, path)) return shotApiError("Cloud API redirected the request elsewhere.", 502);
|
|
611
711
|
target = next;
|
|
612
712
|
}
|
|
613
|
-
} catch {
|
|
614
|
-
//
|
|
713
|
+
} catch (error) {
|
|
714
|
+
// A read that never reached the service (no connection, a refused proxy, nothing back by its deadline) is said
|
|
715
|
+
// as one, in the words every command uses; any other failure is told as a dropped connection tells fetch.
|
|
716
|
+
if (cutOff || isNetworkFailure(error)) return unreachable();
|
|
615
717
|
return shotApiError("Cloud API request failed.", 502);
|
|
718
|
+
} finally {
|
|
719
|
+
clearTimeout(deadline);
|
|
720
|
+
signal?.removeEventListener("abort", abortFromPage);
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
/** A kept read's answer as the page gets it, its copy saved for a later run the service does not answer. */
|
|
725
|
+
async function keptResponse(response: Response, kept: NonNullable<ReturnType<typeof savedCopyRead>>): Promise<Response> {
|
|
726
|
+
const text = await response.text();
|
|
727
|
+
try {
|
|
728
|
+
kept.read.save(kept.key, JSON.parse(text));
|
|
729
|
+
} catch {
|
|
730
|
+
// Intentional ignore: an answer that is not the terms' JSON is passed on as it came, and kept nowhere.
|
|
616
731
|
}
|
|
732
|
+
const headers = new Headers(response.headers);
|
|
733
|
+
for (const name of SHOT_API_DROPPED_RESPONSE_HEADERS) headers.delete(name);
|
|
734
|
+
headers.set("Cache-Control", "no-store");
|
|
735
|
+
return new Response(text, { status: response.status, statusText: response.statusText, headers });
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* The page's answer for a read the proxy could not get to the data service:
|
|
740
|
+
* the page's request reads it as the service being unreachable
|
|
741
|
+
* (SHOT_SERVICE_UNREACHABLE_HEADER), as it would a refused connection of its own.
|
|
742
|
+
*/
|
|
743
|
+
function shotApiUnreachable(epoch: number): Response {
|
|
744
|
+
noteDataServiceReach(false, epoch);
|
|
745
|
+
return Response.json({ error: DATA_SERVICE_UNREACHABLE_MESSAGE }, {
|
|
746
|
+
status: 502,
|
|
747
|
+
headers: { "Cache-Control": "no-store", [SHOT_SERVICE_UNREACHABLE_HEADER]: "1" },
|
|
748
|
+
});
|
|
617
749
|
}
|
|
618
750
|
|
|
619
751
|
/**
|
|
@@ -642,7 +774,6 @@ async function shotApiResponse(response: Response, path: string): Promise<Respon
|
|
|
642
774
|
async function capturePageScreenshot({
|
|
643
775
|
chrome,
|
|
644
776
|
url,
|
|
645
|
-
outputPath,
|
|
646
777
|
widthPx,
|
|
647
778
|
heightPx,
|
|
648
779
|
deviceScaleFactor,
|
|
@@ -653,7 +784,6 @@ async function capturePageScreenshot({
|
|
|
653
784
|
}: {
|
|
654
785
|
chrome: string;
|
|
655
786
|
url: string;
|
|
656
|
-
outputPath: string;
|
|
657
787
|
widthPx: number;
|
|
658
788
|
heightPx: number;
|
|
659
789
|
deviceScaleFactor: number;
|
|
@@ -661,7 +791,7 @@ async function capturePageScreenshot({
|
|
|
661
791
|
captureImage: boolean;
|
|
662
792
|
statusLine?: ShotStatusLine;
|
|
663
793
|
fitRows?: { heightCells: number; maxHeightCells: number; roles: readonly string[] };
|
|
664
|
-
}): Promise<DesktopPaneShotRenderResult> {
|
|
794
|
+
}): Promise<DesktopPaneShotRenderResult & { image?: Uint8Array }> {
|
|
665
795
|
const browser = await launchShotBrowser(chrome, { widthPx, heightPx, userDataDir });
|
|
666
796
|
const session = browser.page;
|
|
667
797
|
try {
|
|
@@ -695,7 +825,7 @@ async function capturePageScreenshot({
|
|
|
695
825
|
captureBeyondViewport: false,
|
|
696
826
|
}) as { data?: string };
|
|
697
827
|
if (!screenshot.data) throw new Error("Chrome did not return screenshot data.");
|
|
698
|
-
|
|
828
|
+
return { ...rendered, image: Buffer.from(screenshot.data, "base64") };
|
|
699
829
|
}
|
|
700
830
|
return rendered;
|
|
701
831
|
} catch (error) {
|
|
@@ -746,16 +876,27 @@ async function growToFitRows(session: CdpPage, size: {
|
|
|
746
876
|
}
|
|
747
877
|
|
|
748
878
|
/**
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
*
|
|
752
|
-
* above it stays, cut, rather than leave the list blank. The live pane keeps
|
|
753
|
-
* its partly visible last row, as every scrolling list reads.
|
|
879
|
+
* A capture draws whole rows beneath the sticky header and above the bottom
|
|
880
|
+
* edge. It also draws the table's vertical scrollbar when rows scroll past
|
|
881
|
+
* those edges. The live table keeps smooth scrolling and its partial rows.
|
|
754
882
|
*/
|
|
755
883
|
async function hideCutRows(session: CdpPage): Promise<void> {
|
|
756
884
|
await session.send("Runtime.evaluate", {
|
|
757
885
|
expression: `(() => {
|
|
758
886
|
const root = document.getElementById("root") || document.body;
|
|
887
|
+
const visibilityOf = (${rowViewportVisibility.toString()});
|
|
888
|
+
const bodyRole = 'data-table-body-scroll';
|
|
889
|
+
for (const body of root.querySelectorAll('[data-gloom-role="' + bodyRole + '"]')) {
|
|
890
|
+
const showsOverflow = body.clientHeight > 0 && body.scrollHeight > body.clientHeight + 1
|
|
891
|
+
&& body.getAttribute('data-gloom-scrollbar-y') === 'visible'
|
|
892
|
+
&& /auto|scroll/.test(getComputedStyle(body).overflowY);
|
|
893
|
+
if (showsOverflow) {
|
|
894
|
+
body.style.scrollbarWidth = 'auto';
|
|
895
|
+
body.style.scrollbarColor = 'auto';
|
|
896
|
+
body.setAttribute('data-gloom-scrollbar-active', 'true');
|
|
897
|
+
}
|
|
898
|
+
body.toggleAttribute('data-gloom-shot-table-overflow', showsOverflow);
|
|
899
|
+
}
|
|
759
900
|
const rows = [...root.querySelectorAll(
|
|
760
901
|
'[data-gloom-role="data-table-row"], [data-gloom-role="data-table-section-header"], [data-gloom-role="desktop-list-row"], [data-gloom-row="true"]',
|
|
761
902
|
)];
|
|
@@ -763,28 +904,36 @@ async function hideCutRows(session: CdpPage): Promise<void> {
|
|
|
763
904
|
const style = getComputedStyle(element);
|
|
764
905
|
return /(auto|scroll|hidden|clip)/.test(style.overflowY) && element.clientHeight > 0;
|
|
765
906
|
};
|
|
766
|
-
const
|
|
907
|
+
const viewports = new Map();
|
|
908
|
+
const wholeRows = new Set();
|
|
767
909
|
const cut = [];
|
|
768
910
|
for (const row of rows) {
|
|
911
|
+
if (row.hasAttribute('data-gloom-shot-cut-row')) {
|
|
912
|
+
row.style.removeProperty('visibility');
|
|
913
|
+
row.removeAttribute('data-gloom-shot-cut-row');
|
|
914
|
+
}
|
|
769
915
|
let box = row.parentElement;
|
|
770
916
|
while (box && box !== root && !clips(box)) box = box.parentElement;
|
|
771
917
|
if (!box || box === root) continue;
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
918
|
+
if (!viewports.has(box)) {
|
|
919
|
+
const area = box.getBoundingClientRect();
|
|
920
|
+
const top = area.top + box.clientTop;
|
|
921
|
+
const header = box.getAttribute('data-gloom-role') === bodyRole
|
|
922
|
+
? box.querySelector('[data-gloom-role="data-table-header-row"]') : null;
|
|
923
|
+
viewports.set(box, { top: Math.max(top, header?.getBoundingClientRect().bottom ?? top), bottom: top + box.clientHeight });
|
|
924
|
+
}
|
|
925
|
+
const viewport = viewports.get(box);
|
|
775
926
|
const rect = row.getBoundingClientRect();
|
|
776
927
|
if (rect.height <= 0) continue;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
wholeAbove.set(box, true);
|
|
781
|
-
} else if (rect.bottom > bottom + 1) {
|
|
782
|
-
cut.push({ row, box });
|
|
783
|
-
}
|
|
928
|
+
const visibility = visibilityOf(rect.top, rect.bottom, viewport.top, viewport.bottom);
|
|
929
|
+
if (visibility === 'whole') wholeRows.add(box);
|
|
930
|
+
else cut.push({ row, box, visibility });
|
|
784
931
|
}
|
|
785
|
-
for (const
|
|
786
|
-
if (
|
|
787
|
-
|
|
932
|
+
for (const { row, box, visibility } of cut) {
|
|
933
|
+
if (visibility === 'outside' || wholeRows.has(box)) {
|
|
934
|
+
row.style.visibility = 'hidden';
|
|
935
|
+
row.setAttribute('data-gloom-shot-cut-row', '');
|
|
936
|
+
}
|
|
788
937
|
}
|
|
789
938
|
})()`,
|
|
790
939
|
returnByValue: true,
|
|
@@ -914,20 +1063,24 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
914
1063
|
const managesRows = (element) => element.getAttribute("data-gloom-role") === "data-table-body-scroll";
|
|
915
1064
|
const markScrollTruncation = (element) => {
|
|
916
1065
|
if (!(element instanceof HTMLElement) || !isVisible(element)) return;
|
|
917
|
-
const
|
|
1066
|
+
const metrics = {
|
|
918
1067
|
scrollTop: element.scrollTop,
|
|
919
1068
|
scrollHeight: element.scrollHeight,
|
|
920
1069
|
clientHeight: element.clientHeight,
|
|
921
1070
|
scrollLeft: element.scrollLeft,
|
|
922
1071
|
scrollWidth: element.scrollWidth,
|
|
923
1072
|
clientWidth: element.clientWidth,
|
|
924
|
-
// A
|
|
925
|
-
//
|
|
926
|
-
scrollbarY:
|
|
1073
|
+
// A table's vertical spacer includes virtual rows. Its scrollbar
|
|
1074
|
+
// attribute allows a bar, but does not prove that a bar is drawn.
|
|
1075
|
+
scrollbarY: false,
|
|
927
1076
|
scrollbarX: managesRows(element) && element.getAttribute("data-gloom-scrollbar-x") === "visible",
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
|
|
1077
|
+
};
|
|
1078
|
+
const table = element.closest('[data-gloom-role="data-table"]');
|
|
1079
|
+
const total = semanticTables[visibleTables.indexOf(table)]?.metadata?.rowCount;
|
|
1080
|
+
const rowCountAnnouncesCut = typeof total === 'number' && total > [...element.querySelectorAll('[data-gloom-role="data-table-row"]')].filter(isVisible).length;
|
|
1081
|
+
const rowsAnnounced = managesRows(element) && (element.hasAttribute('data-gloom-shot-table-overflow') || rowCountAnnouncesCut);
|
|
1082
|
+
scrollReasons(metrics, rowsAnnounced).forEach((reason) => truncationReasons.add(reason));
|
|
1083
|
+
if (!inReportedTable(element)) scrollReasons(metrics).forEach((reason) => reportTruncationReasons.add(reason));
|
|
931
1084
|
};
|
|
932
1085
|
[...root.querySelectorAll(
|
|
933
1086
|
'[data-gloom-scrollbar-x="visible"], [data-gloom-scrollbar-y="visible"], [data-gloom-role="data-table-body-scroll"]',
|
|
@@ -1032,6 +1185,11 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
1032
1185
|
}
|
|
1033
1186
|
return {
|
|
1034
1187
|
visibleText: root.innerText || root.textContent || "",
|
|
1188
|
+
// What the visible text fields hold, which innerText leaves out: OVME's Underlying is one.
|
|
1189
|
+
fieldValues: [...root.querySelectorAll("input, textarea")]
|
|
1190
|
+
.filter((field) => isVisible(field) && field.type !== "password" && field.type !== "hidden")
|
|
1191
|
+
.map((field) => normalize(field.value))
|
|
1192
|
+
.filter(Boolean),
|
|
1035
1193
|
footerText: [...root.querySelectorAll('[data-gloom-role="pane-footer"]')]
|
|
1036
1194
|
.map((footer) => normalize(footer.innerText || footer.textContent))
|
|
1037
1195
|
.filter(Boolean)
|
|
@@ -1108,6 +1266,7 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
1108
1266
|
result?: {
|
|
1109
1267
|
value?: {
|
|
1110
1268
|
visibleText?: string;
|
|
1269
|
+
fieldValues?: unknown;
|
|
1111
1270
|
footerText?: string;
|
|
1112
1271
|
footerNotes?: unknown;
|
|
1113
1272
|
visibleKeyValues?: Array<{ label: string; text: string }>;
|
|
@@ -1152,8 +1311,10 @@ async function readRenderedPaneState(session: CdpPage): Promise<DesktopPaneShotR
|
|
|
1152
1311
|
const visibleLines = (value?.visibleText ?? "").split("\n")
|
|
1153
1312
|
.map((line) => line.replace(/\u00a0/g, " ").trimEnd())
|
|
1154
1313
|
.filter((line) => line.trim().length > 0);
|
|
1314
|
+
const fieldValues = Array.isArray(value?.fieldValues) ? value.fieldValues.filter((field): field is string => typeof field === "string") : [];
|
|
1155
1315
|
return {
|
|
1156
1316
|
visibleText,
|
|
1317
|
+
...(fieldValues.length > 0 ? { fieldValues } : {}),
|
|
1157
1318
|
visibleLines,
|
|
1158
1319
|
footerText: typeof value?.footerText === "string" ? value.footerText : "",
|
|
1159
1320
|
visibleKeyValues: Array.isArray(value?.visibleKeyValues) ? value.visibleKeyValues : [],
|
package/src/cli/errors.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { AppPersistence } from "../data/app-persistence";
|
|
|
2
2
|
import { ApiRequestError, wasAskedTwice } from "../api-client/errors";
|
|
3
3
|
import { DEFAULT_CLI_OPTIONS, type CliGlobalOptions } from "./options";
|
|
4
4
|
import { serializeCliError, type CliErrorObject } from "./result";
|
|
5
|
+
import { unreachableHint } from "./unreachable";
|
|
5
6
|
import { cliStyles, cliTerminalWidth, wrapText } from "../utils/cli-output";
|
|
6
7
|
import { withSearchHints, type FredSeriesCheck } from "./not-a-ticker";
|
|
7
8
|
import { isProviderBusy, isSourceFailure, SEARCH_BUSY_CODE, SEARCH_BUSY_MESSAGE, serviceDidNotAnswerMessage } from "../sources/provider-errors";
|
|
@@ -18,14 +19,7 @@ const SERVICE_UNREACHABLE_CODE = "service_unreachable";
|
|
|
18
19
|
/** The code of a command whose data no source could serve just now, one having failed rather than had none. */
|
|
19
20
|
const SOURCE_UNAVAILABLE_CODE = "source_unavailable";
|
|
20
21
|
|
|
21
|
-
|
|
22
|
-
function unreachableHint(): string {
|
|
23
|
-
const env = typeof process === "undefined" ? {} : process.env;
|
|
24
|
-
const proxy = ["HTTPS_PROXY", "https_proxy", "ALL_PROXY", "all_proxy"].find((name) => env[name]?.trim());
|
|
25
|
-
return proxy
|
|
26
|
-
? `Check the internet connection and the proxy in ${proxy}, then try again.`
|
|
27
|
-
: "Check the internet connection, then try again.";
|
|
28
|
-
}
|
|
22
|
+
|
|
29
23
|
|
|
30
24
|
/**
|
|
31
25
|
* An answer of the data service that a source it reads failed and nothing it
|
|
@@ -141,7 +135,7 @@ function cliErrorObject(error: unknown): CliErrorObject {
|
|
|
141
135
|
}
|
|
142
136
|
// A listing read the data service failed to answer twice: said in Gloom's words. Any other 5xx keeps the server's.
|
|
143
137
|
if (wasAskedTwice(error)) {
|
|
144
|
-
return { code: SOURCE_UNAVAILABLE_CODE, message: serviceDidNotAnswerMessage(), retryable: true };
|
|
138
|
+
return { code: SOURCE_UNAVAILABLE_CODE, message: serviceDidNotAnswerMessage(undefined, error), retryable: true };
|
|
145
139
|
}
|
|
146
140
|
// Gloom Cloud refused what was asked (an unknown series, a bad date): the input was wrong, not the program.
|
|
147
141
|
if (error instanceof ApiRequestError && error.status === 400) {
|
package/src/cli/exit-codes.ts
CHANGED
|
@@ -3,6 +3,6 @@ export const CLI_EXIT_CODES = {
|
|
|
3
3
|
ok: 0,
|
|
4
4
|
/** Bad input, nothing found, a failed check, or an unexpected error. */
|
|
5
5
|
error: 1,
|
|
6
|
-
/** `shot --strict`
|
|
6
|
+
/** `shot --strict` did not save an image because the pane had no usable data to show. */
|
|
7
7
|
unusableShot: 2,
|
|
8
8
|
} as const;
|
package/src/cli/glossary.ts
CHANGED
|
@@ -804,7 +804,7 @@ export const GLOSSARY: readonly GlossaryEntry[] = [
|
|
|
804
804
|
{
|
|
805
805
|
term: "Commitments of Traders", short: "COT", aliases: ["cot report", "commitment of traders", "cftc", "cftc report", "cftc positioning", "positioning"],
|
|
806
806
|
functions: ["COT"], shown: ["CFTC", "COT"],
|
|
807
|
-
definition: "
|
|
807
|
+
definition: "Weekly open contracts split by trader type, from the CFTC and ICE Futures Europe. ICE publishes Brent, gasoil and other European markets itself, separately from the CFTC's ICE WTI market. Tuesday positions are released later; ICE's usual release is Friday at 18:30 London time, subject to holidays. "
|
|
808
808
|
+ "It shows whether speculators or hedgers are net long or short, and how that moved since the week before.",
|
|
809
809
|
},
|
|
810
810
|
{
|
package/src/cli/help.ts
CHANGED
|
@@ -62,7 +62,7 @@ const GLOBAL_OPTIONS: Array<[string, string]> = [
|
|
|
62
62
|
const EXIT_CODES: Array<[string, string]> = [
|
|
63
63
|
[String(CLI_EXIT_CODES.ok), "Success"],
|
|
64
64
|
[String(CLI_EXIT_CODES.error), "Failed: bad input, no data found or a failed check. fn exits 0 on partial data with warnings; --json ok is false exactly when this is 1"],
|
|
65
|
-
[String(CLI_EXIT_CODES.unusableShot), "shot --strict
|
|
65
|
+
[String(CLI_EXIT_CODES.unusableShot), "shot --strict found no usable data and did not save an image"],
|
|
66
66
|
];
|
|
67
67
|
|
|
68
68
|
export interface CliHelpEntry {
|
package/src/cli/history-rows.ts
CHANGED
|
@@ -304,8 +304,8 @@ export function historyBarValues(point: PricePoint, monthly: boolean): ReturnTyp
|
|
|
304
304
|
|
|
305
305
|
/**
|
|
306
306
|
* What HP says of its bars whose prices contradict each other: one left
|
|
307
|
-
* blank whole as every price view says it ("1
|
|
308
|
-
*
|
|
307
|
+
* blank whole as every price view says it ("1 bar has contradictory prices;
|
|
308
|
+
* left blank."), a month that keeps its close as `history` says it
|
|
309
309
|
* (historyFlagNote, with no daily bars read). Undefined when none.
|
|
310
310
|
*/
|
|
311
311
|
export function priceTableIntegrityNotice(rows: readonly { flag?: string | null; close: number | null; integrity?: unknown }[]): string | undefined {
|
package/src/cli/index.ts
CHANGED
|
@@ -228,7 +228,7 @@ export function createCoreCliCommands(
|
|
|
228
228
|
{ flags: "--scale <n>", description: "Text scale from 0.5 to 4 (default 1)" },
|
|
229
229
|
{ flags: "--watermark <label>", description: "Label drawn in the pane title bar" },
|
|
230
230
|
{ flags: "--no-status", description: "Leave out the dated status line (as-of, delay, market hours) drawn in the pane footer" },
|
|
231
|
-
{ flags: "--strict", description: `Exit ${CLI_EXIT_CODES.unusableShot} when the pane is empty, shows an error, is still loading, is access-gated, or draws a column blank in every row
|
|
231
|
+
{ flags: "--strict", description: `Exit ${CLI_EXIT_CODES.unusableShot} without saving an image when the pane is empty, shows an error, is still loading, is access-gated, or draws a column blank in every row. The Reason line names what it saw. A column cut at the table's edge is a warning` },
|
|
232
232
|
{ flags: "--<option> <value>", description: "A function setting; gloom catalog <function> lists them" },
|
|
233
233
|
EXCHANGE_OPTION,
|
|
234
234
|
],
|