@orangecharts/wrun-chart-host 0.6.0 → 0.7.0
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/README.md +13 -5
- package/dist/constants/marketCapabilities.constants.d.ts +5 -0
- package/dist/constants/marketCapabilities.constants.js +16 -0
- package/dist/host-ports.types.d.ts +35 -3
- package/dist/index.d.ts +11 -1
- package/dist/index.js +11 -1
- package/dist/indicators/controls/tpo-session.util.js +42 -18
- package/dist/market-data/billing.interface.d.ts +2 -1
- package/dist/settings-templates/indicator-fields.js +10 -0
- package/dist/utility/chart/crypto-index.leaf.d.ts +16 -0
- package/dist/utility/chart/crypto-index.leaf.js +19 -0
- package/dist/utility/chart/index-mode-admission.util.js +9 -1
- package/dist/utility/chart/index-mode.util.d.ts +11 -5
- package/dist/utility/chart/index-mode.util.js +22 -10
- package/dist/utility/chart/kscript-source-answer-budget.leaf.d.ts +36 -0
- package/dist/utility/chart/kscript-source-answer-budget.leaf.js +39 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +38 -1
- package/dist/utility/chart/kscript-source-degrade.leaf.js +39 -1
- package/dist/utility/chart/live-bucket.util.d.ts +2 -1
- package/dist/utility/chart/live-bucket.util.js +47 -15
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +15 -1
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +9 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +3 -1
- package/dist/utility/chart/market-session-schedule.util.js +24 -2
- package/dist/utility/chart/marketKind.util.d.ts +12 -7
- package/dist/utility/chart/marketKind.util.js +15 -5
- package/dist/utility/chart/ny-calendar.util.d.ts +104 -0
- package/dist/utility/chart/ny-calendar.util.js +346 -0
- package/dist/utility/chart/om-panel.util.d.ts +14 -2
- package/dist/utility/chart/om-panel.util.js +108 -40
- package/dist/utility/chart/rth-session.util.d.ts +10 -7
- package/dist/utility/chart/rth-session.util.js +17 -22
- package/dist/utility/chart/trading-day.util.js +90 -18
- package/dist/utility/chart/us-equities-session.util.js +20 -67
- package/dist/utility/chart/wrun-bar-session-facts.util.js +14 -1
- package/dist/utility/common/time.util.d.ts +7 -1
- package/dist/utility/common/time.util.js +11 -41
- package/dist/utility/number-format.util.d.ts +17 -7
- package/dist/utility/number-format.util.js +18 -8
- package/dist/utility/options/option-symbol.util.js +13 -2
- package/dist/utility/symbol-selection/contract-expiry.util.js +9 -1
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +4 -1
- package/dist/utility/watchlist/import/import-request.leaf.js +5 -2
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +25 -4
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +62 -4
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +19 -0
- package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +57 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +23 -0
- package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +90 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.d.ts +39 -0
- package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.js +60 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +77 -0
- package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +195 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +56 -0
- package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +70 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +53 -0
- package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +239 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +16 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +14 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +43 -18
- package/dist/utility/wrun/sources/lanes/options_flow.js +209 -72
- package/dist/utility/wrun/sources/lanes/token_supply.js +5 -31
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -18
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +12 -57
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +1 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +22 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +61 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +103 -8
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +5 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +24 -12
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +55 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +95 -18
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +15 -1
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +23 -8
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +11 -11
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +14 -2
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +6 -3
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +43 -8
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +77 -11
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -16
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +2 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +52 -12
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +110 -46
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +10 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
- package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
- package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
- package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
- package/dist/utility/wrun/wrun-failure-cause.js +14 -0
- package/dist/utility/wrun/wrun-frames.js +6 -2
- package/dist/utility/wrun/wrun-host.service.d.ts +26 -18
- package/dist/utility/wrun/wrun-host.service.js +49 -52
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
- package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
- package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
- package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
- package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
- package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
- package/dist/utility/wrun/wrun-option-views.util.js +356 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
- package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +18 -3
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +50 -6
- package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
- package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
- package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
- package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
- package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
- package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
- package/dist/utility/wrun/wrun-refusal.util.js +335 -40
- package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
- package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
- package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
- package/package.json +5 -5
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
- package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The pure half of the TradingView list util (tradingview-list.util.ts, which re-exports every name): the prefix
|
|
3
3
|
* tables (our native escape, the perpetual suffix, the US stock, forex, CME and crypto venues, TVC's spot metals, the
|
|
4
|
-
* venue back to its TradingView prefix, the CME continuous roots, the ticker aliases
|
|
5
|
-
* (`cmeContinuousKeyOf`, `splitCryptoSymbol`, `cryptoCandidate`, `fxPair`).
|
|
6
|
-
* (wrun-pin-spelling.util) reads them, and it moves into the wrun chart-host
|
|
7
|
-
* legacy-venue reads may not reach.
|
|
4
|
+
* venue back to its TradingView prefix, the CME continuous roots, the ticker aliases, the CRYPTOCAP ticker renames)
|
|
5
|
+
* and the symbol parsers (`cmeContinuousKeyOf`, `splitCryptoSymbol`, `cryptoCandidate`, `fxPair`, `cryptoCapSeriesOf`).
|
|
6
|
+
* No imports: the wrun pin spelling step (wrun-pin-spelling.util) reads them, and it moves into the wrun chart-host
|
|
7
|
+
* package, which the util's catalog and legacy-venue reads may not reach.
|
|
8
8
|
*/
|
|
9
9
|
/** Our native escape: `OPENMARKET:<full key>`, for markets TradingView has no name for. */
|
|
10
10
|
export declare const NATIVE_PREFIX = "OPENMARKET";
|
|
@@ -74,3 +74,24 @@ export declare function cryptoCandidate(exchange: string, symbol: string): Marke
|
|
|
74
74
|
export declare function fxPair(symbol: string): [string, string] | null;
|
|
75
75
|
/** Tickers some venues spell their own way. */
|
|
76
76
|
export declare const BASE_ALIASES: Readonly<Record<string, string>>;
|
|
77
|
+
/** TradingView's crypto index prefix, and our venue of the same series (docs/features/data/cryptocap-indices.md). */
|
|
78
|
+
export declare const CRYPTOCAP_PREFIX = "CRYPTOCAP";
|
|
79
|
+
/**
|
|
80
|
+
* The coins TradingView tickers its own way, TradingView's ticker to ours, for a coin's dominance (`HYPEH.D` is our
|
|
81
|
+
* `HYPE.D`) and its market cap (`HYPEH`, our `MCAP.HYPE`) alike. Matched 2026-10-21 by comparing TradingView's caps
|
|
82
|
+
* with CoinGecko's; every other coin shares its ticker. The watchlist import and the wrun pin spelling step both read
|
|
83
|
+
* this one table.
|
|
84
|
+
*/
|
|
85
|
+
export declare const CRYPTOCAP_TICKER_RENAMES: Readonly<Record<string, string>>;
|
|
86
|
+
/**
|
|
87
|
+
* A TradingView `CRYPTOCAP:` symbol as our series: an index by its name (`TOTAL2`), a dominance by its coin's ticker
|
|
88
|
+
* (`BTC.D`; `HYPEH.D` is `HYPE.D`), a coin's market cap (`BTC`, TradingView's cap) as `MCAP.<TICKER>`. `proof` is the
|
|
89
|
+
* listed series that shows we carry it: the series itself, or, for a market cap (the catalog lists no `MCAP.*`
|
|
90
|
+
* series), the coin's dominance, listed for every coin the indices cover. Null for a symbol of no such shape.
|
|
91
|
+
*/
|
|
92
|
+
export declare function cryptoCapSeriesOf(symbol: string): {
|
|
93
|
+
series: string;
|
|
94
|
+
proof: string;
|
|
95
|
+
} | null;
|
|
96
|
+
/** Our CRYPTOCAP series as TradingView spells it (`HYPE.D` is `HYPEH.D`, `MCAP.BTC` is `BTC`), null for no such one. */
|
|
97
|
+
export declare function tradingViewCryptoCapSymbol(series: string): string | null;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The pure half of the TradingView list util (tradingview-list.util.ts, which re-exports every name): the prefix
|
|
3
3
|
* tables (our native escape, the perpetual suffix, the US stock, forex, CME and crypto venues, TVC's spot metals, the
|
|
4
|
-
* venue back to its TradingView prefix, the CME continuous roots, the ticker aliases
|
|
5
|
-
* (`cmeContinuousKeyOf`, `splitCryptoSymbol`, `cryptoCandidate`, `fxPair`).
|
|
6
|
-
* (wrun-pin-spelling.util) reads them, and it moves into the wrun chart-host
|
|
7
|
-
* legacy-venue reads may not reach.
|
|
4
|
+
* venue back to its TradingView prefix, the CME continuous roots, the ticker aliases, the CRYPTOCAP ticker renames)
|
|
5
|
+
* and the symbol parsers (`cmeContinuousKeyOf`, `splitCryptoSymbol`, `cryptoCandidate`, `fxPair`, `cryptoCapSeriesOf`).
|
|
6
|
+
* No imports: the wrun pin spelling step (wrun-pin-spelling.util) reads them, and it moves into the wrun chart-host
|
|
7
|
+
* package, which the util's catalog and legacy-venue reads may not reach.
|
|
8
8
|
*/
|
|
9
9
|
/** Our native escape: `OPENMARKET:<full key>`, for markets TradingView has no name for. */
|
|
10
10
|
export const NATIVE_PREFIX = 'OPENMARKET';
|
|
@@ -219,3 +219,61 @@ export function fxPair(symbol) {
|
|
|
219
219
|
}
|
|
220
220
|
/** Tickers some venues spell their own way. */
|
|
221
221
|
export const BASE_ALIASES = { XBT: 'BTC', XDG: 'DOGE' };
|
|
222
|
+
// ── CRYPTOCAP: the crypto indices ───────────────────────────────────────────────────────────────────────────────
|
|
223
|
+
/** TradingView's crypto index prefix, and our venue of the same series (docs/features/data/cryptocap-indices.md). */
|
|
224
|
+
export const CRYPTOCAP_PREFIX = 'CRYPTOCAP';
|
|
225
|
+
/**
|
|
226
|
+
* The coins TradingView tickers its own way, TradingView's ticker to ours, for a coin's dominance (`HYPEH.D` is our
|
|
227
|
+
* `HYPE.D`) and its market cap (`HYPEH`, our `MCAP.HYPE`) alike. Matched 2026-10-21 by comparing TradingView's caps
|
|
228
|
+
* with CoinGecko's; every other coin shares its ticker. The watchlist import and the wrun pin spelling step both read
|
|
229
|
+
* this one table.
|
|
230
|
+
*/
|
|
231
|
+
export const CRYPTOCAP_TICKER_RENAMES = {
|
|
232
|
+
HYPEH: 'HYPE',
|
|
233
|
+
USDEE: 'USDE',
|
|
234
|
+
TAOB: 'TAO',
|
|
235
|
+
ARBI: 'ARB',
|
|
236
|
+
APTO: 'APT',
|
|
237
|
+
JUPI: 'JUP',
|
|
238
|
+
PUMPF: 'PUMP',
|
|
239
|
+
ASTER2: 'ASTER',
|
|
240
|
+
WLDW: 'WLD',
|
|
241
|
+
MONAD: 'MON',
|
|
242
|
+
};
|
|
243
|
+
/** The indices both sides name alike: never a coin's market cap. */
|
|
244
|
+
const CRYPTOCAP_INDEX_NAMES = new Set(['TOTAL', 'TOTAL2', 'TOTAL3', 'OTHERS']);
|
|
245
|
+
const DOMINANCE_SUFFIX = '.D';
|
|
246
|
+
const CRYPTOCAP_TICKER_RE = /^[A-Z0-9]{1,15}$/;
|
|
247
|
+
/**
|
|
248
|
+
* A TradingView `CRYPTOCAP:` symbol as our series: an index by its name (`TOTAL2`), a dominance by its coin's ticker
|
|
249
|
+
* (`BTC.D`; `HYPEH.D` is `HYPE.D`), a coin's market cap (`BTC`, TradingView's cap) as `MCAP.<TICKER>`. `proof` is the
|
|
250
|
+
* listed series that shows we carry it: the series itself, or, for a market cap (the catalog lists no `MCAP.*`
|
|
251
|
+
* series), the coin's dominance, listed for every coin the indices cover. Null for a symbol of no such shape.
|
|
252
|
+
*/
|
|
253
|
+
export function cryptoCapSeriesOf(symbol) {
|
|
254
|
+
const upper = symbol.trim().toUpperCase();
|
|
255
|
+
if (CRYPTOCAP_INDEX_NAMES.has(upper))
|
|
256
|
+
return { series: upper, proof: upper };
|
|
257
|
+
const dominance = upper.endsWith(DOMINANCE_SUFFIX);
|
|
258
|
+
const ticker = dominance ? upper.slice(0, -DOMINANCE_SUFFIX.length) : upper;
|
|
259
|
+
if (!CRYPTOCAP_TICKER_RE.test(ticker))
|
|
260
|
+
return null;
|
|
261
|
+
const ours = CRYPTOCAP_TICKER_RENAMES[ticker] ?? ticker;
|
|
262
|
+
const proof = `${ours}${DOMINANCE_SUFFIX}`;
|
|
263
|
+
return dominance ? { series: proof, proof } : { series: `MCAP.${ours}`, proof };
|
|
264
|
+
}
|
|
265
|
+
/** Our CRYPTOCAP series as TradingView spells it (`HYPE.D` is `HYPEH.D`, `MCAP.BTC` is `BTC`), null for no such one. */
|
|
266
|
+
export function tradingViewCryptoCapSymbol(series) {
|
|
267
|
+
const upper = series.trim().toUpperCase();
|
|
268
|
+
if (CRYPTOCAP_INDEX_NAMES.has(upper))
|
|
269
|
+
return upper;
|
|
270
|
+
const cap = upper.startsWith('MCAP.');
|
|
271
|
+
const dominance = !cap && upper.endsWith(DOMINANCE_SUFFIX);
|
|
272
|
+
if (!cap && !dominance)
|
|
273
|
+
return null;
|
|
274
|
+
const ours = cap ? upper.slice('MCAP.'.length) : upper.slice(0, -DOMINANCE_SUFFIX.length);
|
|
275
|
+
if (!CRYPTOCAP_TICKER_RE.test(ours))
|
|
276
|
+
return null;
|
|
277
|
+
const theirs = Object.keys(CRYPTOCAP_TICKER_RENAMES).find((ticker) => CRYPTOCAP_TICKER_RENAMES[ticker] === ours);
|
|
278
|
+
return `${theirs ?? ours}${dominance ? DOMINANCE_SUFFIX : ''}`;
|
|
279
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WrunGateReaderIntentSurface, WrunGateReaderIntentWarm } from '../../../host-ports.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The exchange a gate plane's lane reads name, the one the transport routes them by: an OPRA lane asks by the plane's
|
|
4
|
+
* own exchange whatever the chart's venue spelling (`wrunLaneOpraPlaneChain`, the stats lanes' `statsExchange`), a CME
|
|
5
|
+
* chain lane by the chart's own CME exchange.
|
|
6
|
+
*/
|
|
7
|
+
export declare function wrunGateReadExchangeOf(plane: 'cme' | 'opra', chartExchange: string): string;
|
|
8
|
+
/** The exchange the reads of a chart's options route by on their gate plane (see the module comment), or null for a
|
|
9
|
+
* chart whose options ride no plane. Rejects only when the options gate cannot load. */
|
|
10
|
+
export declare function wrunChartGateReadExchange(chartExchange: string): Promise<string | null>;
|
|
11
|
+
/**
|
|
12
|
+
* Warm the gate reader the chart's options are read on, for a surface whose open suspects an options add is coming:
|
|
13
|
+
* dialed through the transport only when no other tab of this browser holds that reader for this identity and tier,
|
|
14
|
+
* once per reader's life (a reader this tab already dials or holds is left alone), and under every guard of a dial (a
|
|
15
|
+
* guest, a terms wall, a refusal). A reader no read ever uses is released by the transport's idle sweep. Resolves with
|
|
16
|
+
* what it did (`no-plane` for a chart whose options ride no gate plane, `failed` when a load or a port failed); never
|
|
17
|
+
* rejects.
|
|
18
|
+
*/
|
|
19
|
+
export declare function warmWrunChartGateReaderOnIntent(chartExchange: string | null | undefined, surface: WrunGateReaderIntentSurface): Promise<WrunGateReaderIntentWarm>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gate reader a chart's options are read on, decided once for both warms of it (OPTLOAD g1):
|
|
3
|
+
*
|
|
4
|
+
* - the door warm of a package whose sheet reads that plane (wrun-gate-reader-warm.util `warmWrunSheetGateReaders`):
|
|
5
|
+
* the add's own dial, made earlier, so it contests another tab's session exactly as the add always did;
|
|
6
|
+
* - the intent warm of a surface whose open suspects an options add is coming (round 2: the Indicators dialog's open,
|
|
7
|
+
* the Options panel's), `warmWrunChartGateReaderOnIntent`: the same reader, dialed only when no other tab of this
|
|
8
|
+
* browser holds it for this identity and tier (the transport's lease, V2Service `warmGateReaderOnIntent`), so an
|
|
9
|
+
* open never takes another tab's session.
|
|
10
|
+
*
|
|
11
|
+
* The plane is the one the run's planner judges the chart by (`governedOptionPlane`: OPRA on a US stock or ETF chart,
|
|
12
|
+
* CME on a CME futures chart, under the account's option venue gates), read once the `opra` flag is known when that
|
|
13
|
+
* flag decides the chart's options (bounded, the run head's own wait), so an unhydrated flag map never reads as a chart
|
|
14
|
+
* off the plane. Light at module load (the env and the plane's exchange): a surface's open loads no lane registry.
|
|
15
|
+
*/
|
|
16
|
+
import { wrunChartHostEnv } from '../../../host-env.js';
|
|
17
|
+
import { OPRA_GOVERNED_EXCHANGES } from '../../../interfaces/opra-realtime.interface.js';
|
|
18
|
+
/**
|
|
19
|
+
* The exchange a gate plane's lane reads name, the one the transport routes them by: an OPRA lane asks by the plane's
|
|
20
|
+
* own exchange whatever the chart's venue spelling (`wrunLaneOpraPlaneChain`, the stats lanes' `statsExchange`), a CME
|
|
21
|
+
* chain lane by the chart's own CME exchange.
|
|
22
|
+
*/
|
|
23
|
+
export function wrunGateReadExchangeOf(plane, chartExchange) {
|
|
24
|
+
return plane === 'opra' ? OPRA_GOVERNED_EXCHANGES[0] : chartExchange;
|
|
25
|
+
}
|
|
26
|
+
/** The exchange the reads of a chart's options route by on their gate plane (see the module comment), or null for a
|
|
27
|
+
* chart whose options ride no plane. Rejects only when the options gate cannot load. */
|
|
28
|
+
export async function wrunChartGateReadExchange(chartExchange) {
|
|
29
|
+
const gate = await wrunChartHostEnv().market.loadOptionsGate();
|
|
30
|
+
if (gate.opraFlagDecidesChartOptions({ exchange: chartExchange }))
|
|
31
|
+
await gate.awaitOpraFlagHydration();
|
|
32
|
+
const plane = gate.governedOptionPlane({ exchange: chartExchange });
|
|
33
|
+
return plane === null ? null : wrunGateReadExchangeOf(plane, chartExchange);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Warm the gate reader the chart's options are read on, for a surface whose open suspects an options add is coming:
|
|
37
|
+
* dialed through the transport only when no other tab of this browser holds that reader for this identity and tier,
|
|
38
|
+
* once per reader's life (a reader this tab already dials or holds is left alone), and under every guard of a dial (a
|
|
39
|
+
* guest, a terms wall, a refusal). A reader no read ever uses is released by the transport's idle sweep. Resolves with
|
|
40
|
+
* what it did (`no-plane` for a chart whose options ride no gate plane, `failed` when a load or a port failed); never
|
|
41
|
+
* rejects.
|
|
42
|
+
*/
|
|
43
|
+
export async function warmWrunChartGateReaderOnIntent(chartExchange, surface) {
|
|
44
|
+
try {
|
|
45
|
+
if (typeof chartExchange !== 'string' || chartExchange === '')
|
|
46
|
+
return 'no-plane';
|
|
47
|
+
const exchange = await wrunChartGateReadExchange(chartExchange);
|
|
48
|
+
if (exchange === null)
|
|
49
|
+
return 'no-plane';
|
|
50
|
+
const { default: v2 } = await wrunChartHostEnv().transport.loadV2Service();
|
|
51
|
+
return await v2.warmGateReaderOnIntent(exchange, surface);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
// Advice: the add's own door warm, and its first ask, dial for themselves.
|
|
55
|
+
return 'failed';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { WrunGateReaderIntentSurface } from '../../../host-ports.types.js';
|
|
2
|
+
import type { WrunIndicatorMetadata } from '../../../interfaces/wrun-runtime.interface.js';
|
|
3
|
+
/** Whether a poll source class's plan reads the chart's options chain: an OPRA lane resolves the chain's underlying, a
|
|
4
|
+
* chain lane the chain itself (sources/opra-option-lanes.util), one summary read on the network. The run's lanes known
|
|
5
|
+
* without it never wait for that plan (`prepareWrunSandboxRun`), and its reads ride the chain's plane. */
|
|
6
|
+
export declare function wrunPollClassReadsChain(sourceClass: unknown): boolean;
|
|
7
|
+
/** Whether a row source class's plan reads the chart's options chain (a governed OPRA lane's underlying, a chain
|
|
8
|
+
* lane's chain): the poll lanes' rule (`wrunPollClassReadsChain`). */
|
|
9
|
+
export declare function wrunRowClassReadsChain(sourceClass: unknown): boolean;
|
|
10
|
+
/** Whether one declared source class reads the chart's options on their gate plane: a chain-reading poll or row lane,
|
|
11
|
+
* or the options chain itself. */
|
|
12
|
+
export declare function wrunSourceClassReadsGatePlane(sourceClass: unknown): boolean;
|
|
13
|
+
/** Whether any input of a sheet reads the chart's options on their gate plane (`wrunSourceClassReadsGatePlane`). */
|
|
14
|
+
export declare function wrunSheetReadsGatePlane(metadata: Pick<WrunIndicatorMetadata, 'inputs' | 'inputSources'>): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Dial the gate reader a sheet's lanes read on this chart, and start the chunk loads their plans await (see the module
|
|
17
|
+
* comment). The plane and its exchange are the chart's (`wrunChartGateReadExchange`, the decision the intent warm of a
|
|
18
|
+
* surface's open shares: the plane the run's planner judges the chart by, read once the `opra` flag is known when that
|
|
19
|
+
* flag decides the chart's options). `intent`: no add was asked yet (a row's settled intent), so the dial asks the
|
|
20
|
+
* transport's lease-guarded warm (`warmGateReaderOnIntent`) and never takes another tab's session; without it the dial
|
|
21
|
+
* is the add's own (`warmGateReaderFor`). Resolves once the dial was asked for, or nothing was to warm.
|
|
22
|
+
*/
|
|
23
|
+
export declare function warmWrunSheetGateReaders(metadata: Pick<WrunIndicatorMetadata, 'inputs' | 'inputSources'> | null | undefined, chartExchange: string | null | undefined, intent?: WrunGateReaderIntentSurface): Promise<void>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The gate reader a run's first lane ask rides, dialed when the door that mounts the package knows the run
|
|
3
|
+
* (OPTLOAD g1, 2026-10-21).
|
|
4
|
+
*
|
|
5
|
+
* Why: a lane that reads a gate plane (an OPRA poll lane, a governed or chain row lane, the options chain) asks on that
|
|
6
|
+
* plane's reader socket, and the transport dialed that socket on demand, at the lane's first ask: after the package
|
|
7
|
+
* download, the module compile and the plan. From Singapore the handshake (TCP, TLS and the upgrade, about 1 s
|
|
8
|
+
* measured on INT) then followed every other wait of the add. Exposure History at 1h on SPY planned at 689 ms, sent its
|
|
9
|
+
* one DAY stats ask at 706 ms, and had its answer at 1,956 ms, where the ask's own wire was 0.25 to 0.43 s: the reader
|
|
10
|
+
* opened 1 s after the ask. Every OPRA indicator measured showed the same open right before its first answer.
|
|
11
|
+
*
|
|
12
|
+
* The door that mounts or warms a package holds its version doc (whose sheet names the lanes) and the chart (whose
|
|
13
|
+
* market names the plane) from its first step. `warmWrunSheetGateReaders` dials the plane's reader then, so the
|
|
14
|
+
* handshake overlaps the download, the compile and the plan, and the lane's ask is one round trip. Beside the dial it
|
|
15
|
+
* starts the chunk loads the lanes' plans await (the options gate, the chain venues, the Deribit listing, the chain
|
|
16
|
+
* resolver), so a cold first add never loads them after the plan.
|
|
17
|
+
*
|
|
18
|
+
* A hint, never a keepalive: the transport keeps every guard of an on-demand dial (a kick, a refusal, a guest on a
|
|
19
|
+
* plane with no guest reads, an unconfigured plane), its idle sweep releases a reader no read ever wants, and a sheet
|
|
20
|
+
* that reads no gate lane, or a chart whose options ride no plane, warms nothing. The lane's own ask still dials for
|
|
21
|
+
* itself when the warm did not (or could not) run. Never throws, never rejects.
|
|
22
|
+
*
|
|
23
|
+
* A door with no add asked yet (round 2: a row's settled intent, `surface` `add-intent`) dials through the transport's
|
|
24
|
+
* intent warm instead, which never takes the session of another tab of the browser reading that reader
|
|
25
|
+
* (V2Service `warmGateReaderOnIntent`); an add's own doors contest it as the add always did.
|
|
26
|
+
*/
|
|
27
|
+
import { wrunChartHostEnv } from '../../../host-env.js';
|
|
28
|
+
import { wrunPollLanesOfClass } from '../sources/registry.js';
|
|
29
|
+
import { wrunRowLaneOfClass } from '../sources/row-lane-registry.js';
|
|
30
|
+
import { wrunChartGateReadExchange } from './wrun-chart-gate-reader.util.js';
|
|
31
|
+
/** The options chain lane's class: its chain summary and expiry reads ride the chart's plane too. */
|
|
32
|
+
const OPTIONS_CHAIN_SOURCE_CLASS = 'options_chain';
|
|
33
|
+
/** Whether a poll source class's plan reads the chart's options chain: an OPRA lane resolves the chain's underlying, a
|
|
34
|
+
* chain lane the chain itself (sources/opra-option-lanes.util), one summary read on the network. The run's lanes known
|
|
35
|
+
* without it never wait for that plan (`prepareWrunSandboxRun`), and its reads ride the chain's plane. */
|
|
36
|
+
export function wrunPollClassReadsChain(sourceClass) {
|
|
37
|
+
return wrunPollLanesOfClass(sourceClass).some((lane) => lane.opra === true || lane.chain !== undefined);
|
|
38
|
+
}
|
|
39
|
+
/** Whether a row source class's plan reads the chart's options chain (a governed OPRA lane's underlying, a chain
|
|
40
|
+
* lane's chain): the poll lanes' rule (`wrunPollClassReadsChain`). */
|
|
41
|
+
export function wrunRowClassReadsChain(sourceClass) {
|
|
42
|
+
const rowLane = wrunRowLaneOfClass(sourceClass);
|
|
43
|
+
return rowLane?.governed === 'opra' || rowLane?.chain !== undefined;
|
|
44
|
+
}
|
|
45
|
+
/** Whether one declared source class reads the chart's options on their gate plane: a chain-reading poll or row lane,
|
|
46
|
+
* or the options chain itself. */
|
|
47
|
+
export function wrunSourceClassReadsGatePlane(sourceClass) {
|
|
48
|
+
return (sourceClass === OPTIONS_CHAIN_SOURCE_CLASS ||
|
|
49
|
+
wrunPollClassReadsChain(sourceClass) ||
|
|
50
|
+
wrunRowClassReadsChain(sourceClass));
|
|
51
|
+
}
|
|
52
|
+
/** Whether any input of a sheet reads the chart's options on their gate plane (`wrunSourceClassReadsGatePlane`). */
|
|
53
|
+
export function wrunSheetReadsGatePlane(metadata) {
|
|
54
|
+
return (metadata.inputs ?? []).some((input) => wrunSourceClassReadsGatePlane(metadata.inputSources?.[input.name]?.source));
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Dial the gate reader a sheet's lanes read on this chart, and start the chunk loads their plans await (see the module
|
|
58
|
+
* comment). The plane and its exchange are the chart's (`wrunChartGateReadExchange`, the decision the intent warm of a
|
|
59
|
+
* surface's open shares: the plane the run's planner judges the chart by, read once the `opra` flag is known when that
|
|
60
|
+
* flag decides the chart's options). `intent`: no add was asked yet (a row's settled intent), so the dial asks the
|
|
61
|
+
* transport's lease-guarded warm (`warmGateReaderOnIntent`) and never takes another tab's session; without it the dial
|
|
62
|
+
* is the add's own (`warmGateReaderFor`). Resolves once the dial was asked for, or nothing was to warm.
|
|
63
|
+
*/
|
|
64
|
+
export async function warmWrunSheetGateReaders(metadata, chartExchange, intent) {
|
|
65
|
+
try {
|
|
66
|
+
if (!metadata || typeof chartExchange !== 'string' || chartExchange === '')
|
|
67
|
+
return;
|
|
68
|
+
if (!wrunSheetReadsGatePlane(metadata))
|
|
69
|
+
return;
|
|
70
|
+
const env = wrunChartHostEnv();
|
|
71
|
+
// The plan's own loads (resolveWrunLaneChainChart, resolveWrunChartChain): advice, so a failed load is the plan's
|
|
72
|
+
// to report when it asks again.
|
|
73
|
+
void Promise.allSettled([
|
|
74
|
+
env.market.loadOptionsChainVenues(),
|
|
75
|
+
env.market.loadDeribitOptions(),
|
|
76
|
+
env.market.loadOptionsChartSource(),
|
|
77
|
+
]);
|
|
78
|
+
const exchange = await wrunChartGateReadExchange(chartExchange);
|
|
79
|
+
if (exchange === null)
|
|
80
|
+
return;
|
|
81
|
+
const { default: v2 } = await env.transport.loadV2Service();
|
|
82
|
+
if (intent === undefined)
|
|
83
|
+
v2.warmGateReaderFor(exchange);
|
|
84
|
+
else
|
|
85
|
+
await v2.warmGateReaderOnIntent(exchange, intent);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
// A warm is advice: the lane's first ask dials the reader for itself, as before.
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run's lane dispatch by group (run scheduling, 2026-10-20): every lane dispatches the moment ITS inputs are known,
|
|
3
|
+
* never after a plan it does not read.
|
|
4
|
+
*
|
|
5
|
+
* Why: the run planned every lane first and dispatched them together, so a lane whose inputs were known at the plan
|
|
6
|
+
* (a daily candle leg, a daily options stats poll lane) waited for every other lane's plan: a chain lane resolving
|
|
7
|
+
* the chart's options chain (one summary read, 1 to 7 s on INT), then the options chain lane's expiry directory. The
|
|
8
|
+
* first source request of an options indicator left a median 2.2 s after the add (74 of 90 measured cells over 1 s;
|
|
9
|
+
* INDICATOR-LOAD-BUDGET, "Frontend costs every add pays"). Now each group is added with the promise of its plan and
|
|
10
|
+
* dispatches through the run's own lane runner as that plan resolves:
|
|
11
|
+
*
|
|
12
|
+
* - `add(planned)`: a group's thunks once its plan resolved (undefined: nothing to dispatch). Groups are added in the
|
|
13
|
+
* order their plans were read before (the run's: the lanes it knows now, the poll lanes, the row lanes, the options
|
|
14
|
+
* chain), and that order decides which refusal wins.
|
|
15
|
+
* - `planned(retract)`: resolves once every plan resolved. The first plan to reject, in group order, is the run's
|
|
16
|
+
* refusal: no later group dispatches, every lane already dispatched is retracted (`retract`: the run lowers the
|
|
17
|
+
* pending mark it raised at dispatch, data-loading rule 3), and its read is abandoned, never aborted (its answer
|
|
18
|
+
* lands in the fetch cache). A plan that never answers keeps only its own lanes waiting.
|
|
19
|
+
* - `settled()`: every dispatched group's outcome, merged by the run (`merge`: declaration order, as one dispatch
|
|
20
|
+
* would have reported them).
|
|
21
|
+
*
|
|
22
|
+
* No timer is armed here: a group dispatches on its plan's own settle (a microtask after it), so a lane whose inputs
|
|
23
|
+
* are known at the plan is on the wire before anything the plans wait for answers (pinned by
|
|
24
|
+
* tests/utility/wrun/wrun-overlay-run.dispatch-at-mount.spec.ts under fake timers).
|
|
25
|
+
*/
|
|
26
|
+
export interface WrunLaneGroupPorts<Thunks, Run> {
|
|
27
|
+
/** The run's lane runner (`runWrunSourceLanes` under the run's policy): dispatches every thunk at once. */
|
|
28
|
+
run: (thunks: Thunks) => Promise<Run>;
|
|
29
|
+
/** The lane ids a group's thunks dispatch (the ids its pending marks name). */
|
|
30
|
+
lanesOf: (thunks: Thunks) => Iterable<string>;
|
|
31
|
+
/** The groups' outcomes as one run's (declaration order). */
|
|
32
|
+
merge: (runs: Run[]) => Run;
|
|
33
|
+
}
|
|
34
|
+
export interface WrunLaneGroupSchedule<Thunks, Run> {
|
|
35
|
+
add(planned: Promise<Thunks | undefined>): void;
|
|
36
|
+
planned(retract: (lane: string) => void): Promise<void>;
|
|
37
|
+
settled(): Promise<Run>;
|
|
38
|
+
}
|
|
39
|
+
export declare function scheduleWrunLaneGroups<Thunks, Run>(ports: WrunLaneGroupPorts<Thunks, Run>): WrunLaneGroupSchedule<Thunks, Run>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A run's lane dispatch by group (run scheduling, 2026-10-20): every lane dispatches the moment ITS inputs are known,
|
|
3
|
+
* never after a plan it does not read.
|
|
4
|
+
*
|
|
5
|
+
* Why: the run planned every lane first and dispatched them together, so a lane whose inputs were known at the plan
|
|
6
|
+
* (a daily candle leg, a daily options stats poll lane) waited for every other lane's plan: a chain lane resolving
|
|
7
|
+
* the chart's options chain (one summary read, 1 to 7 s on INT), then the options chain lane's expiry directory. The
|
|
8
|
+
* first source request of an options indicator left a median 2.2 s after the add (74 of 90 measured cells over 1 s;
|
|
9
|
+
* INDICATOR-LOAD-BUDGET, "Frontend costs every add pays"). Now each group is added with the promise of its plan and
|
|
10
|
+
* dispatches through the run's own lane runner as that plan resolves:
|
|
11
|
+
*
|
|
12
|
+
* - `add(planned)`: a group's thunks once its plan resolved (undefined: nothing to dispatch). Groups are added in the
|
|
13
|
+
* order their plans were read before (the run's: the lanes it knows now, the poll lanes, the row lanes, the options
|
|
14
|
+
* chain), and that order decides which refusal wins.
|
|
15
|
+
* - `planned(retract)`: resolves once every plan resolved. The first plan to reject, in group order, is the run's
|
|
16
|
+
* refusal: no later group dispatches, every lane already dispatched is retracted (`retract`: the run lowers the
|
|
17
|
+
* pending mark it raised at dispatch, data-loading rule 3), and its read is abandoned, never aborted (its answer
|
|
18
|
+
* lands in the fetch cache). A plan that never answers keeps only its own lanes waiting.
|
|
19
|
+
* - `settled()`: every dispatched group's outcome, merged by the run (`merge`: declaration order, as one dispatch
|
|
20
|
+
* would have reported them).
|
|
21
|
+
*
|
|
22
|
+
* No timer is armed here: a group dispatches on its plan's own settle (a microtask after it), so a lane whose inputs
|
|
23
|
+
* are known at the plan is on the wire before anything the plans wait for answers (pinned by
|
|
24
|
+
* tests/utility/wrun/wrun-overlay-run.dispatch-at-mount.spec.ts under fake timers).
|
|
25
|
+
*/
|
|
26
|
+
export function scheduleWrunLaneGroups(ports) {
|
|
27
|
+
let stopped = false;
|
|
28
|
+
const dispatched = [];
|
|
29
|
+
const groups = [];
|
|
30
|
+
return {
|
|
31
|
+
add(planned) {
|
|
32
|
+
const run = planned.then((thunks) => {
|
|
33
|
+
if (stopped || thunks === undefined)
|
|
34
|
+
return undefined;
|
|
35
|
+
dispatched.push(...ports.lanesOf(thunks));
|
|
36
|
+
return ports.run(thunks);
|
|
37
|
+
});
|
|
38
|
+
// Read by `settled` alone, after every plan resolved: never an unhandled rejection before.
|
|
39
|
+
void run.catch(() => undefined);
|
|
40
|
+
groups.push({ planned, run });
|
|
41
|
+
},
|
|
42
|
+
async planned(retract) {
|
|
43
|
+
for (const group of groups) {
|
|
44
|
+
try {
|
|
45
|
+
await group.planned;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
stopped = true;
|
|
49
|
+
for (const lane of dispatched.splice(0))
|
|
50
|
+
retract(lane);
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
async settled() {
|
|
56
|
+
const runs = await Promise.all(groups.map((group) => group.run));
|
|
57
|
+
return ports.merge(runs.filter((run) => run !== undefined));
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The reads a run left out at a lane's degrade budget, which the source ladder joins or adopts instead of asking the
|
|
3
|
+
* same window again (run scheduling, 2026-10-20).
|
|
4
|
+
*
|
|
5
|
+
* The degrade budget (kscript-source-degrade.leaf `resolveSecondarySourceBudgetMs`: 10 s plus 2.5 s per 1,000 rows)
|
|
6
|
+
* stays the authority for the chip: at it the run marks the lane degraded and paints without it. The lane's read is
|
|
7
|
+
* abandoned, never aborted, so it is still on the wire. The ladder's rung used to run the overlay again 15 s later,
|
|
8
|
+
* and its lane asked the same window a second time beside the first (Options Market Stats and Market Share at 1h,
|
|
9
|
+
* 2026-10-20: painted empty at 14 to 15 s, painted with data at 31 s). Now:
|
|
10
|
+
*
|
|
11
|
+
* - the run notes each read it abandoned (`noteWrunLateRead`), by overlay and lane, with the identity of the ask (the
|
|
12
|
+
* run's window, market, chart data generation and settings revision) and a reader of the acquisition the run
|
|
13
|
+
* recorded for the lane (the payload its live session asks the lane again with);
|
|
14
|
+
* - the dispatch of a later run that asks the same lane with the same identity takes it (`takeWrunLateRead`): a read
|
|
15
|
+
* still out is JOINED (the lane waits on it under its own budget, and no second ask leaves), a read that answered
|
|
16
|
+
* with rows is ADOPTED (its rows, no ask); a failed read, or one asked another way, is no read and the lane asks;
|
|
17
|
+
* - the source ladder (wrun-overlay-recovery.util) fires its rung the moment the reads it waits on answer with rows,
|
|
18
|
+
* and a rung that comes due while one is still out waits for it instead of asking again (`onWrunLateReadSettled`).
|
|
19
|
+
*
|
|
20
|
+
* A read that never answers is bounded by the fetch's own deadline (wrun-deadline.util
|
|
21
|
+
* `WRUN_SOURCE_FETCH_DEADLINE_MS`, 45 s from its send) and by the transport's watchdog: it then fails, leaves this
|
|
22
|
+
* registry, and the next rung asks the wire. The degrade budget is a paint deadline, never a stall verdict: those two
|
|
23
|
+
* are. A read is taken once (a run that joined it notes it again if its own budget runs out first), a failed read and
|
|
24
|
+
* an answered one past `WRUN_LATE_READ_ADOPT_MS` are dropped, and every read of an overlay goes with it (teardown,
|
|
25
|
+
* suspend: `forgetWrunLateReads`). Pure module state: nothing here reads the host env.
|
|
26
|
+
*/
|
|
27
|
+
/** The rows a lane read answers (the run's `WrunLaneRows`). */
|
|
28
|
+
export type WrunLateReadRows = ArrayLike<number>[];
|
|
29
|
+
/** How long an answered read stays adoptable: the source-row cache's freshness window (25 s), so an adopted read is
|
|
30
|
+
* never older than a row-cache hit would be. */
|
|
31
|
+
export declare const WRUN_LATE_READ_ADOPT_MS = 25000;
|
|
32
|
+
/** The most reads the registry keeps across every overlay: the oldest noted goes first past it. An overlay's own reads
|
|
33
|
+
* are one per lane and leave with it (`forgetWrunLateReads` on its teardown); the cap bounds the rows held for an
|
|
34
|
+
* overlay no ladder ever watches. */
|
|
35
|
+
export declare const WRUN_LATE_READS_KEPT = 64;
|
|
36
|
+
/** One abandoned read, as `noteWrunLateRead` takes it. */
|
|
37
|
+
export interface WrunLateReadNote {
|
|
38
|
+
indicatorId: string;
|
|
39
|
+
lane: string;
|
|
40
|
+
/** The ask the read answers: equal identities ask the same rows. */
|
|
41
|
+
identity: string;
|
|
42
|
+
/** The read itself: the lane's own answer, which the run stopped waiting for. */
|
|
43
|
+
answer: Promise<WrunLateReadRows>;
|
|
44
|
+
/** The acquisition the abandoning run recorded for the lane, read when a taker settles (a lane asked in pieces
|
|
45
|
+
* records it as its pieces leave). */
|
|
46
|
+
acquisition?: () => unknown;
|
|
47
|
+
}
|
|
48
|
+
/** What a later run takes: the rows (the read itself, or its answer) and the acquisition to record for the lane. */
|
|
49
|
+
export interface WrunLateReadTaken {
|
|
50
|
+
kind: 'joined' | 'adopted';
|
|
51
|
+
rows: Promise<WrunLateReadRows>;
|
|
52
|
+
acquisition: () => unknown;
|
|
53
|
+
}
|
|
54
|
+
/** Note a read the run left out at its lane's budget: the latest note of a lane replaces the one before it. */
|
|
55
|
+
export declare function noteWrunLateRead(note: WrunLateReadNote): void;
|
|
56
|
+
/**
|
|
57
|
+
* The read a run's dispatch joins or adopts for one lane: one with the same identity, still out (joined) or answered
|
|
58
|
+
* with rows inside the adopt window (adopted). Taken once: the entry leaves the registry either way. A read asked
|
|
59
|
+
* another way, failed or answered too long ago is dropped and answers undefined (the lane asks).
|
|
60
|
+
*/
|
|
61
|
+
export declare function takeWrunLateRead(indicatorId: string, lane: string, identity: string): WrunLateReadTaken | undefined;
|
|
62
|
+
/** The lanes of `lanes` whose abandoned read is still out. */
|
|
63
|
+
export declare function wrunLateReadsOut(indicatorId: string, lanes: Iterable<string>): string[];
|
|
64
|
+
/** The lanes of `lanes` whose abandoned read answered with rows (adoptable now). */
|
|
65
|
+
export declare function wrunLateReadsAnswered(indicatorId: string, lanes: Iterable<string>): string[];
|
|
66
|
+
/** Called on every settle of one of the overlay's noted reads (answered or failed); answers the unsubscribe. */
|
|
67
|
+
export declare function onWrunLateReadSettled(indicatorId: string, listener: () => void): () => void;
|
|
68
|
+
/** Every read the overlay left out, and every listener on them, go with it (data-loading rule 3). */
|
|
69
|
+
export declare function forgetWrunLateReads(indicatorId: string): void;
|
|
70
|
+
/**
|
|
71
|
+
* A run's lane thunks with every lane joining or adopting its late read first (`take`, the run's own lookup by its
|
|
72
|
+
* ask identity): a lane with one never runs its thunk, so no second ask leaves. The run's shape: the builtin lanes by
|
|
73
|
+
* name (a function or undefined) and the lists of `[lane id, thunk]` pairs (trades legs, poll lanes, row lanes);
|
|
74
|
+
* everything else is returned as it is.
|
|
75
|
+
*/
|
|
76
|
+
export declare function wrunJoinLateReads<T extends object>(thunks: T, take: (lane: string) => Promise<WrunLateReadRows> | undefined): T;
|
|
77
|
+
export declare function __resetWrunLateReadsForTests(): void;
|