@orangecharts/wrun-chart-host 0.5.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 +17 -8
- package/dist/constants/feature-flags.constants.js +7 -2
- package/dist/constants/marketCapabilities.constants.d.ts +5 -0
- package/dist/constants/marketCapabilities.constants.js +16 -0
- package/dist/host-env.d.ts +3 -19
- package/dist/host-ports.types.d.ts +36 -17
- package/dist/index.d.ts +12 -1
- package/dist/index.js +12 -1
- package/dist/indicators/controls/tpo-session.util.js +42 -18
- package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
- package/dist/interfaces/wrun-runtime.interface.js +17 -3
- package/dist/market-data/billing.interface.d.ts +2 -1
- package/dist/settings-templates/indicator-fields.js +10 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +12 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +32 -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-bar-count.util.d.ts +17 -6
- package/dist/utility/wrun/wrun-bar-count.util.js +27 -12
- 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 +131 -59
- package/dist/utility/wrun/wrun-host.service.js +391 -194
- 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-hover.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-hover.util.js +25 -4
- 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 +20 -5
- 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 +52 -8
- package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
- package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
- 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-prefix-cohort.util.d.ts +1 -1
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +1 -1
- 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-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +2 -2
- package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
- 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/dist/workers/wrun/wrun-abi-host.d.ts +15 -2
- package/dist/workers/wrun/wrun-abi-host.js +31 -12
- package/dist/workers/wrun/wrun-engine-handler.d.ts +11 -28
- package/dist/workers/wrun/wrun-engine-handler.js +181 -12
- 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
|
@@ -87,19 +87,23 @@ export interface WrunRowLaneHorizon {
|
|
|
87
87
|
completeFromMs?: number;
|
|
88
88
|
}
|
|
89
89
|
/**
|
|
90
|
-
* A read
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
90
|
+
* A read whose answer can pass the source answer budget (`option_contract_flow` reads every contract of the
|
|
91
|
+
* underlying): how many numeric cells one answered row holds (the raw tuple the worker hands over) and the rows one
|
|
92
|
+
* host bar is projected to read at its tier, up to the clock, for the instance's own acquisition (its payload: a chain
|
|
93
|
+
* lane's plane follows the exchange it names, so each plane reads its own projection). The cap is never the lane's to
|
|
94
|
+
* pick: it is the source answer budget (kscript-source-answer-budget.leaf) in rows of that width
|
|
95
|
+
* (`wrunRowLaneMaxRows`), the one size the row cache, the worker's row cap and the fetch guard agree on. Before any
|
|
96
|
+
* fetch the host keeps the NEWEST asked bars whose projected rows fit it and marks every older asked bar PARTIAL (bit
|
|
97
|
+
* 14 of `present`: one marker tuple), the asks starting at the first kept bar's open, never inside a bar; a bar whose
|
|
98
|
+
* own projection passes it leaves every bar at or before it partial. Applied after the tier rule and the horizon.
|
|
95
99
|
*/
|
|
96
100
|
export interface WrunRowLaneRowBudget {
|
|
97
|
-
|
|
101
|
+
cellsPerRow: number;
|
|
98
102
|
barRows: (bar: {
|
|
99
103
|
openMs: number;
|
|
100
104
|
endMs: number;
|
|
101
105
|
tier?: WrunBackendTier;
|
|
102
|
-
}, nowMs: number) => number;
|
|
106
|
+
}, nowMs: number, acquisition: Readonly<Record<string, unknown>>) => number;
|
|
103
107
|
}
|
|
104
108
|
/** What a lane's live fold reads beside the points: the chart's bar span and grid, and the acquisition the
|
|
105
109
|
* instance's history was asked with (its knobs: a floor, an expiry set). */
|
|
@@ -110,14 +114,22 @@ export interface WrunRowLaneFoldContext {
|
|
|
110
114
|
}
|
|
111
115
|
/**
|
|
112
116
|
* A lane fed live by COIN (UW-PARITY rule for the print class): a coin-scoped channel carries every point of
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
+
* an underlying (one print per contract of the root), and the intake admits a point whose coin is the coin the
|
|
118
|
+
* instance was asked for (`WrunRowLaneDescriptor.coinOf`), whatever contract it names, the chart's own market or not.
|
|
119
|
+
* The channel's key is `wrunCoinChannel` (live-feed-channel-factory.util): for a governed lane its plane's exchange,
|
|
120
|
+
* for a `chain` lane the exchange the instance's chain lists on (a crypto venue, OPRA, a CME Group exchange), with
|
|
121
|
+
* the instance's coin (its chain's underlying), on a governed exchange only while the read is routed real-time
|
|
122
|
+
* (wrun-coin-lane-live.util). The lane's `fold` keeps only the points its acquisition reads (a chain lane's: its
|
|
123
|
+
* exchange and its ONE book). No lane opens a channel until the live-feed serves the coin route.
|
|
117
124
|
*/
|
|
118
125
|
export interface WrunRowLaneLiveByCoin {
|
|
119
126
|
/** The fan-out's script source name the lane's frames arrive under. */
|
|
120
127
|
scriptSource: string;
|
|
128
|
+
/** A chain lane's planes whose coin channel carries its points (a live producer of its type streams there): an
|
|
129
|
+
* instance whose chain lists on another plane subscribes nothing and refreshes from history alone, the live tick's
|
|
130
|
+
* reconcile re-asking it as it re-asks a lane with no channel (its answer merged by `reconcile`). Absent: every
|
|
131
|
+
* plane. */
|
|
132
|
+
chainPlanes?: readonly WrunLaneChainPlane[];
|
|
121
133
|
/** The coin a point names (its series' coin); absent: `point.series.coin`, else the frame's own. */
|
|
122
134
|
coinOf?: (point: unknown) => string | undefined;
|
|
123
135
|
/** A point's time, ms (the host bar it folds into); null for a point that names none. */
|
|
@@ -147,6 +159,8 @@ export interface WrunRowLaneChain {
|
|
|
147
159
|
/** The plane a chain lane instance reads: the gate its chain's exchange rides (`opra`, `cme`), or `plain` (a crypto
|
|
148
160
|
* options venue: no gate, no licence delay, no plane stamp, no routed tier). */
|
|
149
161
|
export type WrunLaneChainPlane = 'opra' | 'cme' | 'plain';
|
|
162
|
+
/** Every chain plane (the registry checks a lane's `liveByCoin.chainPlanes` against it). */
|
|
163
|
+
export declare const WRUN_LANE_CHAIN_PLANES: readonly WrunLaneChainPlane[];
|
|
150
164
|
/** An exchange's plane, read off the governed exchange sets the gate table is built from (never a venue list): a CME
|
|
151
165
|
* Group exchange is `cme`, OPRA `opra`, any other `plain`. Here, beside the chain mark, so the planner on the row
|
|
152
166
|
* builder's (and the boot path's) import graph reads it without the chain resolver's module. */
|
|
@@ -197,9 +211,9 @@ export interface WrunRowLaneDescriptor {
|
|
|
197
211
|
* identity, facets and plane fields) and the window's clock, for a flow or snapshot lane. Absent: the tier rule
|
|
198
212
|
* alone. */
|
|
199
213
|
horizon?: (extras: Readonly<Record<string, unknown>>, nowMs: number) => WrunRowLaneHorizon | undefined;
|
|
200
|
-
/** The
|
|
201
|
-
* that fit are read, every older asked bar is partial. Absent: the asks as the tier rule and the
|
|
202
|
-
* them. */
|
|
214
|
+
/** The source answer budget the lane's read keeps under (`WrunRowLaneRowBudget`), for a flow or snapshot lane: the
|
|
215
|
+
* newest bars that fit are read, every older asked bar is partial. Absent: the asks as the tier rule and the
|
|
216
|
+
* horizon made them (a lane whose answer cannot pass the budget). */
|
|
203
217
|
rowBudget?: WrunRowLaneRowBudget;
|
|
204
218
|
/**
|
|
205
219
|
* The lane reads a governed plane on every chart it serves: `opra` (US options data). Its inputs are refused by
|
|
@@ -215,7 +229,7 @@ export interface WrunRowLaneDescriptor {
|
|
|
215
229
|
* the one chain resolver (sources/opra-option-lanes.util `decideWrunLaneChain`), never per descriptor (see
|
|
216
230
|
* `WrunRowLaneChain`). It is admitted on every chart (a chart with no chain is refused by name in its identity or
|
|
217
231
|
* facets), and its asks ride the native-rows path on every plane (its rows are its chain's, never the chart
|
|
218
|
-
* market's).
|
|
232
|
+
* market's). It may be fed live by coin too (`liveByCoin`): each instance subscribes its own chain's channel.
|
|
219
233
|
*/
|
|
220
234
|
chain?: WrunRowLaneChain;
|
|
221
235
|
/** How an empty answer reads: `quiet` (a window with nothing in it is legitimate: present EMPTY blocks) or
|
|
@@ -242,7 +256,8 @@ export interface WrunRowLaneDescriptor {
|
|
|
242
256
|
/** The lane's OWN fetch in place of the chart's (a series no K control serves): the poll lanes' ask shape,
|
|
243
257
|
* answered as rows `[ts, tuple, ...]` at the asked tier, ascending. */
|
|
244
258
|
fetch?: (ask: WrunPollLaneFetchAsk) => Promise<ReadonlyArray<ReadonlyArray<unknown>>>;
|
|
245
|
-
/** Live points by coin (see `WrunRowLaneLiveByCoin
|
|
259
|
+
/** Live points by coin (see `WrunRowLaneLiveByCoin`: a governed lane's plane, a chain lane's own chain per
|
|
260
|
+
* instance); absent: a poll lane (the reconcile re-asks it). */
|
|
246
261
|
liveByCoin?: WrunRowLaneLiveByCoin;
|
|
247
262
|
}
|
|
248
263
|
/** The input a lane's per-input projection (`cells`) reads: its name, its declaration and the most tuples a bar of
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { isCmeGoverned } from '../../chart/cme-realtime.util.js';
|
|
2
2
|
import { isOpraGoverned } from '../../v2/opra-governed.util.js';
|
|
3
|
+
/** Every chain plane (the registry checks a lane's `liveByCoin.chainPlanes` against it). */
|
|
4
|
+
export const WRUN_LANE_CHAIN_PLANES = Object.freeze(['opra', 'cme', 'plain']);
|
|
3
5
|
/** An exchange's plane, read off the governed exchange sets the gate table is built from (never a venue list): a CME
|
|
4
6
|
* Group exchange is `cme`, OPRA `opra`, any other `plain`. Here, beside the chain mark, so the planner on the row
|
|
5
7
|
* builder's (and the boot path's) import graph reads it without the chain resolver's module. */
|
|
@@ -20,6 +20,9 @@
|
|
|
20
20
|
* chart's grid (exact width, finite values or NaN outside a lane's `finiteColumns`, the lane's per-input
|
|
21
21
|
* projection with a partial bar kept partial unless the class carries no `present` mask; a `latest` lane on the
|
|
22
22
|
* live row).
|
|
23
|
+
* - `wrunRowLaneReachFromMs` / `wrunRunSourceReachFromMs`: how far back a lane's source holds rows (its horizon, its
|
|
24
|
+
* longest-kept tier), and where a run's history sources begin, which the warm-up decider reads so a first value a
|
|
25
|
+
* source's history explains never buys a page of older candles.
|
|
23
26
|
*/
|
|
24
27
|
import type { WrunIndicatorMetadata, WrunInputSource } from '../../../interfaces/wrun-runtime.interface.js';
|
|
25
28
|
import type { LiveBucketVenue } from '../../chart/live-bucket.util.js';
|
|
@@ -134,9 +137,13 @@ export declare function wrunRowLaneEmptyAnswer(lane: Pick<WrunRowLaneDescriptor,
|
|
|
134
137
|
* declare `missing: "empty"` (a celled input's fill over an empty lane, the honest-picture rule). */
|
|
135
138
|
export declare function wrunRowLaneRequired(metadata: WrunIndicatorMetadata, instance: Pick<WrunRowLaneInstance, 'inputIndexes' | 'laneKey'>): boolean;
|
|
136
139
|
/** The fetch options a row lane's asks carry: the native-rows path for a governed lane and a chain lane (their rows
|
|
137
|
-
* are their plane's or their chain's, never the chart market's, an index-mode one included)
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
* are their plane's or their chain's, never the chart market's, an index-mode one included); `endExclusive` for a
|
|
141
|
+
* flow or snapshot lane, whose host-grid asks end at their last bar's close (`wrunHostGridFetchTo`), so the fetch
|
|
142
|
+
* pads no inclusive bar past it (a padded ask read the next bar, one the source answer budget had left partial, and
|
|
143
|
+
* landed it there: OPTFLOW-HANG review 2026-10-20). A `latest` lane's ask keeps the padding. */
|
|
144
|
+
export declare function wrunRowLaneFetchOptions(lane: Pick<WrunRowLaneDescriptor, 'governed' | 'chain' | 'landing'>): {
|
|
145
|
+
nativeRows?: true;
|
|
146
|
+
endExclusive?: true;
|
|
140
147
|
} | undefined;
|
|
141
148
|
/** The payload field a tiered ask names its backend tier in (`landing.tiers`, the tier's key). */
|
|
142
149
|
export declare const WRUN_ROW_LANE_TIER_FIELD = "tier";
|
|
@@ -154,8 +161,11 @@ export interface WrunRowLaneWindow {
|
|
|
154
161
|
* the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
|
|
155
162
|
* where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
|
|
156
163
|
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty); a `latest` lane asked
|
|
157
|
-
* once over `fallback`, its rows as they come.
|
|
158
|
-
*
|
|
164
|
+
* once over `fallback`, its rows as they come. A flow sums every bucket inside its bar, so its plan reads the window's
|
|
165
|
+
* bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer
|
|
166
|
+
* is fit, budgeted and asked over its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from
|
|
167
|
+
* a UTC day bucket; a snapshot keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full
|
|
168
|
+
* run's, a reconcile's). Ascending, one row per host bar.
|
|
159
169
|
*/
|
|
160
170
|
export declare function fetchWrunRowLaneRows(lane: WrunRowLaneDescriptor, extras: Readonly<Record<string, unknown>>, window: WrunRowLaneWindow, fallback: {
|
|
161
171
|
fromTs: number;
|
|
@@ -164,29 +174,59 @@ export declare function fetchWrunRowLaneRows(lane: WrunRowLaneDescriptor, extras
|
|
|
164
174
|
/**
|
|
165
175
|
* A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that
|
|
166
176
|
* opens before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after
|
|
167
|
-
* `servedFromMs` (an ask wholly before it is dropped).
|
|
177
|
+
* `servedFromMs` (an ask wholly before it is dropped). A bar opens and ends where its span does (`wrunHostBarSpanOf`:
|
|
178
|
+
* its session under the plan's session grid, a flow's). No horizon: the plan as the tier rule made it. The cut a
|
|
179
|
+
* host-grid poll lane's `horizon` takes too (wrun-poll-lanes.util `wrunHostGridAsksWithinHorizon`, its one home).
|
|
168
180
|
*/
|
|
169
181
|
export declare function wrunRowLaneAsksWithinHorizon(plan: {
|
|
170
182
|
asks: WrunHostGridAsk[];
|
|
171
183
|
partialBars: number[];
|
|
172
|
-
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs'>, horizon: WrunRowLaneHorizon | undefined): {
|
|
184
|
+
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs'>, horizon: WrunRowLaneHorizon | undefined, sessionGrid?: LiveBucketVenue | null): {
|
|
173
185
|
asks: WrunHostGridAsk[];
|
|
174
186
|
partialBars: number[];
|
|
175
187
|
};
|
|
188
|
+
/** A row budget's cap in rows: the source answer budget (kscript-source-answer-budget.leaf) in rows of the lane's
|
|
189
|
+
* answered width. One number for every lane, the row cache and the worker's cap; a lane never picks its own. */
|
|
190
|
+
export declare function wrunRowLaneMaxRows(budget: Pick<WrunRowLaneRowBudget, 'cellsPerRow'>): number;
|
|
176
191
|
/**
|
|
177
192
|
* A host-grid ask plan cut to a lane's row budget (`WrunRowLaneRowBudget`), before any fetch: walking the asked bars
|
|
178
|
-
* from the newest, each at its ask's tier
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
*
|
|
193
|
+
* from the newest, each at its ask's tier and projected for the instance's own `acquisition` (its payload: a chain
|
|
194
|
+
* lane's plane names its projection), it keeps one run of bars whose projected rows fit `maxRows` (the source answer
|
|
195
|
+
* budget in the lane's rows); every asked bar outside it joins the partial bars and the asks are cut to it (a bar is
|
|
196
|
+
* read whole or not at all).
|
|
197
|
+
* - The NEWEST bars that cannot fit even alone (a daily chart's forming day read from minutes, 262,000 SPY rows at the
|
|
198
|
+
* close) are left partial and the walk goes on to the older bars, so one heavy bar never leaves the whole window
|
|
199
|
+
* unread.
|
|
200
|
+
* - From the first bar that fits, a bar whose projection would pass the cap stops the walk there.
|
|
201
|
+
* A bar is projected, kept and cut over its span (`wrunHostBarSpanOf`: its session under the plan's session grid, a
|
|
202
|
+
* flow's) and marked partial by its stamp. No budget, or every bar fitting: the plan as it came.
|
|
182
203
|
*/
|
|
183
204
|
export declare function wrunRowLaneAsksWithinRowBudget(plan: {
|
|
184
205
|
asks: WrunHostGridAsk[];
|
|
185
206
|
partialBars: number[];
|
|
186
|
-
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined): {
|
|
207
|
+
}, window: Pick<WrunRowLaneWindow, 'barOpens' | 'intervalMs' | 'nowMs'>, budget: WrunRowLaneRowBudget | undefined, acquisition?: Readonly<Record<string, unknown>>, sessionGrid?: LiveBucketVenue | null): {
|
|
187
208
|
asks: WrunHostGridAsk[];
|
|
188
209
|
partialBars: number[];
|
|
189
210
|
};
|
|
211
|
+
/**
|
|
212
|
+
* How far back one row lane's source holds rows for an acquisition at the clock: the later of its horizon's served
|
|
213
|
+
* start and the oldest bar its longest-kept tier still holds; null when it names neither, or a tier keeps its rows for
|
|
214
|
+
* good (it may answer any window). A `latest` lane reads one snapshot on the live row, no history: undefined.
|
|
215
|
+
*/
|
|
216
|
+
export declare function wrunRowLaneReachFromMs(lane: Pick<WrunRowLaneDescriptor, 'landing' | 'horizon'>, extras: Readonly<Record<string, unknown>>, nowMs: number): number | null | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* Where the rows of a run's history sources begin at the clock: the warm-up decider's `sourceReachFromTs`
|
|
219
|
+
* (local-kscript-warmup-depth.util), the earliest reach among the row lane instances that read a history
|
|
220
|
+
* (`wrunRowLaneReachFromMs`). A visible first value at or after it, with it at or after the loaded start, is a
|
|
221
|
+
* source's history beginning, never a warm-up a page of older candles could fill. Null when no instance reads a
|
|
222
|
+
* history, when one names no reach, or when the run reads any other source beside the chart's candles (a poll lane, a
|
|
223
|
+
* pinned leg, a trades lane: none names its reach yet), since older candles may then still bring that source rows.
|
|
224
|
+
*/
|
|
225
|
+
export declare function wrunRunSourceReachFromMs(args: {
|
|
226
|
+
rowLanes: ReadonlyArray<Pick<WrunRowLaneInstance, 'laneKey' | 'extras'>>;
|
|
227
|
+
readsOtherSources: boolean;
|
|
228
|
+
nowMs: number;
|
|
229
|
+
}): number | null;
|
|
190
230
|
/** The ask shape a lane's own `fetch` takes, over a window. */
|
|
191
231
|
export declare function wrunRowLaneOwnAsk(extras: Readonly<Record<string, unknown>>, fromTs: number, toTs: number, intervalMs: number): WrunPollLaneFetchAsk;
|
|
192
232
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { kScriptSourceAnswerRows } from '../../chart/kscript-source-answer-budget.leaf.js';
|
|
1
2
|
import { wrunRowLaneByKey, wrunRowLaneOfClass, wrunRowLanes } from './row-lane-registry.js';
|
|
2
|
-
import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
|
|
3
|
+
import { assertWrunLaneChainPlaneReadable, stableJson, wrunChainLaneStop, wrunChartOpraPlane, wrunHostGridAsksWithinHorizon, wrunLaneNoChainRefusal, wrunOpraPlaneStopDetail, wrunPollLaneChainAsk, wrunPollLaneChainExchange, wrunPollLaneChainGovernedExchange, wrunPollLaneChainPlane, wrunUnservedLaneInput, } from './wrun-poll-lanes.util.js';
|
|
3
4
|
import { WRUN_ROW_LANE_ID_PREFIX, } from './wrun-row-lane.types.js';
|
|
4
5
|
import { assertWrunOpraLaneReadable } from '../wrun-opra-lane.util.js';
|
|
5
6
|
import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../wrun-present-bits.util.js';
|
|
6
|
-
import { wrunCellRowsWithPartialBars, wrunHostGridAsks, wrunHostGridFallbackAsks,
|
|
7
|
+
import { wrunCellRowsWithPartialBars, wrunHostBarSpanOf, wrunHostGridAsks, wrunHostGridFallbackAsks, wrunLandCellRowsOnHostBars, } from '../wrun-tier-grid.util.js';
|
|
7
8
|
/**
|
|
8
9
|
* The static plan: every input whose class a row lane serves, in declaration order, with its lane. Refused by
|
|
9
10
|
* name: a scalar input (a row lane serves cell blocks) and a celled one with no `max_cells` (the bound its blocks
|
|
@@ -230,9 +231,19 @@ export function wrunRowLaneRequired(metadata, instance) {
|
|
|
230
231
|
return metadata.inputs.some((input) => instance.inputIndexes.includes(input.index) && metadata.inputSources[input.name]?.missing !== 'empty');
|
|
231
232
|
}
|
|
232
233
|
/** The fetch options a row lane's asks carry: the native-rows path for a governed lane and a chain lane (their rows
|
|
233
|
-
* are their plane's or their chain's, never the chart market's, an index-mode one included)
|
|
234
|
+
* are their plane's or their chain's, never the chart market's, an index-mode one included); `endExclusive` for a
|
|
235
|
+
* flow or snapshot lane, whose host-grid asks end at their last bar's close (`wrunHostGridFetchTo`), so the fetch
|
|
236
|
+
* pads no inclusive bar past it (a padded ask read the next bar, one the source answer budget had left partial, and
|
|
237
|
+
* landed it there: OPTFLOW-HANG review 2026-10-20). A `latest` lane's ask keeps the padding. */
|
|
234
238
|
export function wrunRowLaneFetchOptions(lane) {
|
|
235
|
-
|
|
239
|
+
const nativeRows = lane.governed !== undefined || lane.chain !== undefined;
|
|
240
|
+
const endExclusive = lane.landing.kind !== 'latest';
|
|
241
|
+
if (!nativeRows && !endExclusive)
|
|
242
|
+
return undefined;
|
|
243
|
+
return {
|
|
244
|
+
...(nativeRows ? { nativeRows: true } : {}),
|
|
245
|
+
...(endExclusive ? { endExclusive: true } : {}),
|
|
246
|
+
};
|
|
236
247
|
}
|
|
237
248
|
/** The payload field a tiered ask names its backend tier in (`landing.tiers`, the tier's key). */
|
|
238
249
|
export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
|
|
@@ -243,24 +254,31 @@ export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
|
|
|
243
254
|
* the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
|
|
244
255
|
* where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
|
|
245
256
|
* tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty); a `latest` lane asked
|
|
246
|
-
* once over `fallback`, its rows as they come.
|
|
247
|
-
*
|
|
257
|
+
* once over `fallback`, its rows as they come. A flow sums every bucket inside its bar, so its plan reads the window's
|
|
258
|
+
* bar grid as its session grid (wrun-tier-grid.util `wrunCmeSessionBarSpan`): a CME session bar of a day or longer
|
|
259
|
+
* is fit, budgeted and asked over its Globex session, from the 17:00 Chicago open before its 00:00Z stamp, never from
|
|
260
|
+
* a UTC day bucket; a snapshot keeps its stamps (D12's settlement DAY rows). `ask` is the caller's fetch (the full
|
|
261
|
+
* run's, a reconcile's). Ascending, one row per host bar.
|
|
248
262
|
*/
|
|
249
263
|
export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask) {
|
|
250
264
|
const landing = lane.landing;
|
|
251
265
|
if (landing.kind === 'latest')
|
|
252
266
|
return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => [...row]);
|
|
267
|
+
const sessionGrid = landing.kind === 'flow' ? window.barGrid : undefined;
|
|
253
268
|
const { asks, partialBars } = wrunRowLaneAsksWithinRowBudget(wrunRowLaneAsksWithinHorizon(wrunHostGridAsks({
|
|
254
269
|
tiers: landing.tiers,
|
|
255
270
|
barOpens: window.barOpens,
|
|
256
271
|
intervalMs: window.intervalMs,
|
|
257
272
|
nowMs: window.nowMs,
|
|
258
273
|
choice: landing.tierChoice,
|
|
259
|
-
|
|
274
|
+
sessionGrid,
|
|
275
|
+
}), window, lane.horizon?.(extras, window.nowMs), sessionGrid), window, lane.rowBudget, extras, sessionGrid);
|
|
260
276
|
const fold = landing.fold;
|
|
261
277
|
const askAndLand = async (gridAsk) => {
|
|
262
278
|
const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_ROW_LANE_TIER_FIELD]: gridAsk.tier.key };
|
|
263
|
-
|
|
279
|
+
// Rows stamped at or past the ask's end belong to a bar the plan did not ask (a skipped newest bar): never land
|
|
280
|
+
// them, whatever the control answered.
|
|
281
|
+
const rows = (await ask(askExtras, gridAsk.fromMs, gridAsk.toMs)).filter((row) => Number(row[0]) < gridAsk.toMs);
|
|
264
282
|
return wrunLandCellRowsOnHostBars(rows, landing.kind, { intervalMs: window.intervalMs, barGrid: window.barGrid, tierMs: gridAsk.tier?.ms, nowMs: window.nowMs }, fold === undefined ? undefined : (group) => fold(group, askExtras));
|
|
265
283
|
};
|
|
266
284
|
const byBar = new Map();
|
|
@@ -298,66 +316,68 @@ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask)
|
|
|
298
316
|
/**
|
|
299
317
|
* A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that
|
|
300
318
|
* opens before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after
|
|
301
|
-
* `servedFromMs` (an ask wholly before it is dropped).
|
|
319
|
+
* `servedFromMs` (an ask wholly before it is dropped). A bar opens and ends where its span does (`wrunHostBarSpanOf`:
|
|
320
|
+
* its session under the plan's session grid, a flow's). No horizon: the plan as the tier rule made it. The cut a
|
|
321
|
+
* host-grid poll lane's `horizon` takes too (wrun-poll-lanes.util `wrunHostGridAsksWithinHorizon`, its one home).
|
|
302
322
|
*/
|
|
303
|
-
export function wrunRowLaneAsksWithinHorizon(plan, window, horizon) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
for (const open of window.barOpens)
|
|
311
|
-
if (open < completeFrom)
|
|
312
|
-
partial.add(open);
|
|
313
|
-
let asks = plan.asks;
|
|
314
|
-
if (servedFrom !== undefined) {
|
|
315
|
-
const firstServed = window.barOpens.find((open) => wrunHostGridFetchTo(open, window.intervalMs) > servedFrom);
|
|
316
|
-
asks =
|
|
317
|
-
firstServed === undefined
|
|
318
|
-
? []
|
|
319
|
-
: plan.asks.flatMap((gridAsk) => {
|
|
320
|
-
const fromMs = Math.max(gridAsk.fromMs, firstServed);
|
|
321
|
-
return fromMs < gridAsk.toMs ? [{ ...gridAsk, fromMs }] : [];
|
|
322
|
-
});
|
|
323
|
-
}
|
|
324
|
-
return { asks, partialBars: [...partial].sort((a, b) => a - b) };
|
|
323
|
+
export function wrunRowLaneAsksWithinHorizon(plan, window, horizon, sessionGrid) {
|
|
324
|
+
return wrunHostGridAsksWithinHorizon(plan, window, horizon, sessionGrid);
|
|
325
|
+
}
|
|
326
|
+
/** A row budget's cap in rows: the source answer budget (kscript-source-answer-budget.leaf) in rows of the lane's
|
|
327
|
+
* answered width. One number for every lane, the row cache and the worker's cap; a lane never picks its own. */
|
|
328
|
+
export function wrunRowLaneMaxRows(budget) {
|
|
329
|
+
return kScriptSourceAnswerRows(budget.cellsPerRow);
|
|
325
330
|
}
|
|
326
331
|
/**
|
|
327
332
|
* A host-grid ask plan cut to a lane's row budget (`WrunRowLaneRowBudget`), before any fetch: walking the asked bars
|
|
328
|
-
* from the newest, each at its ask's tier
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
333
|
+
* from the newest, each at its ask's tier and projected for the instance's own `acquisition` (its payload: a chain
|
|
334
|
+
* lane's plane names its projection), it keeps one run of bars whose projected rows fit `maxRows` (the source answer
|
|
335
|
+
* budget in the lane's rows); every asked bar outside it joins the partial bars and the asks are cut to it (a bar is
|
|
336
|
+
* read whole or not at all).
|
|
337
|
+
* - The NEWEST bars that cannot fit even alone (a daily chart's forming day read from minutes, 262,000 SPY rows at the
|
|
338
|
+
* close) are left partial and the walk goes on to the older bars, so one heavy bar never leaves the whole window
|
|
339
|
+
* unread.
|
|
340
|
+
* - From the first bar that fits, a bar whose projection would pass the cap stops the walk there.
|
|
341
|
+
* A bar is projected, kept and cut over its span (`wrunHostBarSpanOf`: its session under the plan's session grid, a
|
|
342
|
+
* flow's) and marked partial by its stamp. No budget, or every bar fitting: the plan as it came.
|
|
332
343
|
*/
|
|
333
|
-
export function wrunRowLaneAsksWithinRowBudget(plan, window, budget) {
|
|
344
|
+
export function wrunRowLaneAsksWithinRowBudget(plan, window, budget, acquisition = {}, sessionGrid) {
|
|
334
345
|
if (budget === undefined || plan.asks.length === 0)
|
|
335
346
|
return plan;
|
|
347
|
+
const maxRows = wrunRowLaneMaxRows(budget);
|
|
336
348
|
const asked = [];
|
|
337
349
|
for (const ask of plan.asks) {
|
|
338
|
-
for (const
|
|
339
|
-
|
|
350
|
+
for (const stampMs of window.barOpens) {
|
|
351
|
+
const span = wrunHostBarSpanOf(stampMs, window.intervalMs, sessionGrid);
|
|
352
|
+
if (span.fromMs < ask.fromMs || span.fromMs >= ask.toMs)
|
|
340
353
|
continue;
|
|
341
|
-
asked.push({
|
|
354
|
+
asked.push({ stampMs, bar: { openMs: span.fromMs, endMs: span.toMs, tier: ask.tier } });
|
|
342
355
|
}
|
|
343
356
|
}
|
|
344
|
-
asked.sort((a, b) => b.openMs - a.openMs);
|
|
357
|
+
asked.sort((a, b) => b.bar.openMs - a.bar.openMs);
|
|
345
358
|
let rows = 0;
|
|
346
359
|
let keptFrom = Number.POSITIVE_INFINITY;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
360
|
+
let keptEnd = Number.NEGATIVE_INFINITY;
|
|
361
|
+
for (const { bar } of asked) {
|
|
362
|
+
const projected = budget.barRows(bar, window.nowMs, acquisition);
|
|
363
|
+
const barRows = Number.isFinite(projected) && projected > 0 ? projected : 0;
|
|
364
|
+
if (keptEnd === Number.NEGATIVE_INFINITY && barRows > maxRows)
|
|
365
|
+
continue;
|
|
366
|
+
if (rows + barRows > maxRows)
|
|
351
367
|
break;
|
|
368
|
+
rows += barRows;
|
|
352
369
|
keptFrom = bar.openMs;
|
|
370
|
+
if (keptEnd === Number.NEGATIVE_INFINITY)
|
|
371
|
+
keptEnd = bar.endMs;
|
|
353
372
|
}
|
|
354
|
-
const cut = asked.filter((bar) => bar.openMs < keptFrom).map((
|
|
373
|
+
const cut = asked.filter(({ bar }) => bar.openMs < keptFrom || bar.endMs > keptEnd).map(({ stampMs }) => stampMs);
|
|
355
374
|
if (cut.length === 0)
|
|
356
375
|
return plan;
|
|
357
376
|
return {
|
|
358
377
|
asks: plan.asks.flatMap((ask) => {
|
|
359
378
|
const fromMs = Math.max(ask.fromMs, keptFrom);
|
|
360
|
-
|
|
379
|
+
const toMs = Math.min(ask.toMs, keptEnd);
|
|
380
|
+
return fromMs < toMs ? [{ ...ask, fromMs, toMs }] : [];
|
|
361
381
|
}),
|
|
362
382
|
partialBars: [...new Set([...plan.partialBars, ...cut])].sort((a, b) => a - b),
|
|
363
383
|
};
|
|
@@ -365,6 +385,50 @@ export function wrunRowLaneAsksWithinRowBudget(plan, window, budget) {
|
|
|
365
385
|
function finiteOrUndefined(value) {
|
|
366
386
|
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
|
|
367
387
|
}
|
|
388
|
+
/**
|
|
389
|
+
* How far back one row lane's source holds rows for an acquisition at the clock: the later of its horizon's served
|
|
390
|
+
* start and the oldest bar its longest-kept tier still holds; null when it names neither, or a tier keeps its rows for
|
|
391
|
+
* good (it may answer any window). A `latest` lane reads one snapshot on the live row, no history: undefined.
|
|
392
|
+
*/
|
|
393
|
+
export function wrunRowLaneReachFromMs(lane, extras, nowMs) {
|
|
394
|
+
if (lane.landing.kind === 'latest')
|
|
395
|
+
return undefined;
|
|
396
|
+
const horizonFrom = finiteOrUndefined(lane.horizon?.(extras, nowMs)?.servedFromMs);
|
|
397
|
+
const tiers = lane.landing.tiers ?? [];
|
|
398
|
+
const kept = tiers.map((tier) => tier.retentionMs);
|
|
399
|
+
const tierFrom = kept.length > 0 && kept.every((ms) => ms !== undefined)
|
|
400
|
+
? finiteOrUndefined(nowMs - Math.max(...kept))
|
|
401
|
+
: undefined;
|
|
402
|
+
if (horizonFrom === undefined && tierFrom === undefined)
|
|
403
|
+
return null;
|
|
404
|
+
return Math.max(horizonFrom ?? Number.NEGATIVE_INFINITY, tierFrom ?? Number.NEGATIVE_INFINITY);
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Where the rows of a run's history sources begin at the clock: the warm-up decider's `sourceReachFromTs`
|
|
408
|
+
* (local-kscript-warmup-depth.util), the earliest reach among the row lane instances that read a history
|
|
409
|
+
* (`wrunRowLaneReachFromMs`). A visible first value at or after it, with it at or after the loaded start, is a
|
|
410
|
+
* source's history beginning, never a warm-up a page of older candles could fill. Null when no instance reads a
|
|
411
|
+
* history, when one names no reach, or when the run reads any other source beside the chart's candles (a poll lane, a
|
|
412
|
+
* pinned leg, a trades lane: none names its reach yet), since older candles may then still bring that source rows.
|
|
413
|
+
*/
|
|
414
|
+
export function wrunRunSourceReachFromMs(args) {
|
|
415
|
+
if (args.readsOtherSources)
|
|
416
|
+
return null;
|
|
417
|
+
let earliest = null;
|
|
418
|
+
for (const instance of args.rowLanes) {
|
|
419
|
+
const lane = wrunRowLaneByKey(instance.laneKey);
|
|
420
|
+
if (lane === undefined)
|
|
421
|
+
return null;
|
|
422
|
+
const reach = wrunRowLaneReachFromMs(lane, instance.extras, args.nowMs);
|
|
423
|
+
if (reach === undefined)
|
|
424
|
+
continue;
|
|
425
|
+
if (reach === null)
|
|
426
|
+
return null;
|
|
427
|
+
if (earliest === null || reach < earliest)
|
|
428
|
+
earliest = reach;
|
|
429
|
+
}
|
|
430
|
+
return earliest;
|
|
431
|
+
}
|
|
368
432
|
/** The ask shape a lane's own `fetch` takes, over a window. */
|
|
369
433
|
export function wrunRowLaneOwnAsk(extras, fromTs, toTs, intervalMs) {
|
|
370
434
|
return { extras, fromTs, toTs, intervalMs };
|
|
@@ -24,9 +24,14 @@
|
|
|
24
24
|
* (`wrunWarmupSheetReadsCandlesOnly`): its hidden head is candles, so a book, a leg, a feed or a poll lane
|
|
25
25
|
* would reach the head's bars without their rows.
|
|
26
26
|
*
|
|
27
|
+
* Every reader takes the module's import list, never the compiled module: the main thread reads the list off the
|
|
28
|
+
* module's handle (`WrunModuleHandle.imports`, which the engine worker's load answered in WebAssembly.Module.imports()
|
|
29
|
+
* order; the main thread holds no WebAssembly.Module), and the worker's ABI host reads the same predicates over
|
|
30
|
+
* `WebAssembly.Module.imports(module)`, so the two sides cannot answer differently for one module.
|
|
31
|
+
*
|
|
27
32
|
* Pure and worker-safe.
|
|
28
33
|
*/
|
|
29
|
-
import { type WrunAbiVersion, type WrunHistoryWarmup } from '../../interfaces/wrun-runtime.interface.js';
|
|
34
|
+
import { type WrunAbiVersion, type WrunHistoryWarmup, type WrunModuleHandle, type WrunModuleImport } from '../../interfaces/wrun-runtime.interface.js';
|
|
30
35
|
/** The import (the one the shared host links under wrun-6; wrun-bar-count.kit-mirror.spec.ts). */
|
|
31
36
|
export declare const WRUN6_BAR_IMPORTS: readonly ["wrun:wrun_bar_count"];
|
|
32
37
|
/** The refusal names a host raises on the row count (a code of the shared host's refusal table). */
|
|
@@ -34,12 +39,15 @@ export declare const WRUN6_BAR_REFUSALS: {
|
|
|
34
39
|
/** wrun_bar_count called outside state() and finalize(). */
|
|
35
40
|
readonly phase: "wrun_bar_count_phase";
|
|
36
41
|
};
|
|
37
|
-
/** Whether
|
|
38
|
-
|
|
42
|
+
/** Whether an import list carries the row count: `wrun_bar_count` under the `wrun` module, qualified on both (an
|
|
43
|
+
* import of the same name from another module is not the host's count). */
|
|
44
|
+
export declare function wrunImportsBarCount(imports: readonly WrunModuleImport[]): boolean;
|
|
45
|
+
/** Whether a module imports the row count (read once per handle). */
|
|
46
|
+
export declare function wrunModuleImportsBarCount(module: WrunModuleHandle): boolean;
|
|
39
47
|
/** Whether a module READS the row count under its ABI: wrun-6 or later and the import declared.
|
|
40
48
|
* Such a module's live session re-runs every bar when a bar appears; any other keeps the
|
|
41
49
|
* close-confirm. */
|
|
42
|
-
export declare function wrunModuleReadsBarCount(module:
|
|
50
|
+
export declare function wrunModuleReadsBarCount(module: WrunModuleHandle, abi: WrunAbiVersion): boolean;
|
|
43
51
|
/**
|
|
44
52
|
* The import names a stamped module may carry: the kit's own list (`WRUN_HISTORY_INDEPENDENT_IMPORTS`,
|
|
45
53
|
* wrun-history-independence.ts, kit 0.67.1), name for name, read as the kit's decision reads them
|
|
@@ -56,9 +64,12 @@ export declare function wrunModuleReadsBarCount(module: WebAssembly.Module, abi:
|
|
|
56
64
|
* holds this list to exactly the names it admits).
|
|
57
65
|
*/
|
|
58
66
|
export declare const WRUN_STAMP_IMPORTS: ReadonlySet<string>;
|
|
67
|
+
/** Whether every import of a list is on the kit's per-bar list (`WRUN_STAMP_IMPORTS`), by name alone (the kit's
|
|
68
|
+
* decision reads the names, whatever module each comes from). */
|
|
69
|
+
export declare function wrunImportsWithinStamp(imports: readonly WrunModuleImport[]): boolean;
|
|
59
70
|
/** Whether every import of a module is on the kit's per-bar list (`WRUN_STAMP_IMPORTS`), read once per
|
|
60
|
-
*
|
|
61
|
-
export declare function wrunStampCorroborated(module:
|
|
71
|
+
* handle; a handle without a readable import list answers false. */
|
|
72
|
+
export declare function wrunStampCorroborated(module: WrunModuleHandle): boolean;
|
|
62
73
|
/** The first sheet fact that reads or draws beyond the bar at hand, in the kit's own words
|
|
63
74
|
* (`sheet:<fact>[:<name>]`); undefined when the sheet passes. */
|
|
64
75
|
export declare function wrunStampSheetRefusal(sheet: unknown): string | undefined;
|
|
@@ -24,9 +24,14 @@
|
|
|
24
24
|
* (`wrunWarmupSheetReadsCandlesOnly`): its hidden head is candles, so a book, a leg, a feed or a poll lane
|
|
25
25
|
* would reach the head's bars without their rows.
|
|
26
26
|
*
|
|
27
|
+
* Every reader takes the module's import list, never the compiled module: the main thread reads the list off the
|
|
28
|
+
* module's handle (`WrunModuleHandle.imports`, which the engine worker's load answered in WebAssembly.Module.imports()
|
|
29
|
+
* order; the main thread holds no WebAssembly.Module), and the worker's ABI host reads the same predicates over
|
|
30
|
+
* `WebAssembly.Module.imports(module)`, so the two sides cannot answer differently for one module.
|
|
31
|
+
*
|
|
27
32
|
* Pure and worker-safe.
|
|
28
33
|
*/
|
|
29
|
-
import { abiAtLeast } from '../../interfaces/wrun-runtime.interface.js';
|
|
34
|
+
import { abiAtLeast, } from '../../interfaces/wrun-runtime.interface.js';
|
|
30
35
|
import { wrunHistoryWarmupOf } from './wrun-declared-warmup.util.js';
|
|
31
36
|
import { isWrunLegStreamClass } from './wrun-leg-stream-classes.js';
|
|
32
37
|
/** The import (the one the shared host links under wrun-6; wrun-bar-count.kit-mirror.spec.ts). */
|
|
@@ -37,13 +42,18 @@ export const WRUN6_BAR_REFUSALS = {
|
|
|
37
42
|
phase: 'wrun_bar_count_phase',
|
|
38
43
|
};
|
|
39
44
|
const BAR_COUNT_IMPORT_NAME = WRUN6_BAR_IMPORTS[0].slice('wrun:'.length);
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
/** Whether an import list carries the row count: `wrun_bar_count` under the `wrun` module, qualified on both (an
|
|
46
|
+
* import of the same name from another module is not the host's count). */
|
|
47
|
+
export function wrunImportsBarCount(imports) {
|
|
48
|
+
return imports.some((entry) => entry.module === 'wrun' && entry.name === BAR_COUNT_IMPORT_NAME);
|
|
49
|
+
}
|
|
50
|
+
const importsByHandle = new WeakMap();
|
|
51
|
+
/** Whether a module imports the row count (read once per handle). */
|
|
42
52
|
export function wrunModuleImportsBarCount(module) {
|
|
43
|
-
let imports =
|
|
53
|
+
let imports = importsByHandle.get(module);
|
|
44
54
|
if (imports === undefined) {
|
|
45
|
-
imports =
|
|
46
|
-
|
|
55
|
+
imports = wrunImportsBarCount(module.imports);
|
|
56
|
+
importsByHandle.set(module, imports);
|
|
47
57
|
}
|
|
48
58
|
return imports;
|
|
49
59
|
}
|
|
@@ -82,21 +92,26 @@ export const WRUN_STAMP_IMPORTS = new Set([
|
|
|
82
92
|
'wrun_param_len',
|
|
83
93
|
'wrun_param_bytes',
|
|
84
94
|
]);
|
|
85
|
-
|
|
95
|
+
/** Whether every import of a list is on the kit's per-bar list (`WRUN_STAMP_IMPORTS`), by name alone (the kit's
|
|
96
|
+
* decision reads the names, whatever module each comes from). */
|
|
97
|
+
export function wrunImportsWithinStamp(imports) {
|
|
98
|
+
return imports.every((entry) => WRUN_STAMP_IMPORTS.has(entry.name));
|
|
99
|
+
}
|
|
100
|
+
const stampImportsByHandle = new WeakMap();
|
|
86
101
|
/** Whether every import of a module is on the kit's per-bar list (`WRUN_STAMP_IMPORTS`), read once per
|
|
87
|
-
*
|
|
102
|
+
* handle; a handle without a readable import list answers false. */
|
|
88
103
|
export function wrunStampCorroborated(module) {
|
|
89
|
-
const known =
|
|
104
|
+
const known = stampImportsByHandle.get(module);
|
|
90
105
|
if (known !== undefined)
|
|
91
106
|
return known;
|
|
92
107
|
let within = false;
|
|
93
108
|
try {
|
|
94
|
-
within =
|
|
109
|
+
within = wrunImportsWithinStamp(module.imports);
|
|
95
110
|
}
|
|
96
111
|
catch {
|
|
97
|
-
//
|
|
112
|
+
// No import list to read: never corroborated.
|
|
98
113
|
}
|
|
99
|
-
|
|
114
|
+
stampImportsByHandle.set(module, within);
|
|
100
115
|
return within;
|
|
101
116
|
}
|
|
102
117
|
// ---------------------------------------------------------------------------------------------------
|
|
@@ -17,6 +17,16 @@
|
|
|
17
17
|
* served class may still refuse by name at run on its own terms (an odds starter's placeholder
|
|
18
18
|
* market, `funding` serving `rate_close` alone): those limits stay with the row builder. */
|
|
19
19
|
export declare const WRUN_BROWSER_BUILTIN_SOURCE_CLASSES: readonly string[];
|
|
20
|
+
/**
|
|
21
|
+
* The kit classes the browser lane refuses by the kit's own refusal code of the class, before it reads anything of
|
|
22
|
+
* them: classes the kit's chart-browser profile serves whose reads the chart cannot make yet, so no lane serves them
|
|
23
|
+
* and the picker counts them unserved. `option_prints_v2` (kit 0.88.0, the option prints with their block and RFQ
|
|
24
|
+
* identity): the prints the chart reads carry no block or RFQ id until the protocol package names OptionPrint's
|
|
25
|
+
* `block_trade_id` and `rfq_id` (kiyotaka-go fields 32 and 33; pb-common 12.71.0 ends at field 31), and no field
|
|
26
|
+
* carries the leg count, so its lane lands with that protocol release. The record is the protocol gate's
|
|
27
|
+
* (`feed-missing` / `protocol-pending`: the app itself lacks the feed, the way out a reload).
|
|
28
|
+
*/
|
|
29
|
+
export declare const WRUN_BROWSER_REFUSED_CLASS_CODES: Readonly<Record<string, string>>;
|
|
20
30
|
/** The source class a poll-lane file serves: its base name (`lanes/volatility_index.ts` serves
|
|
21
31
|
* `volatility_index`). Undefined for anything that is not a lane file (another extension, a
|
|
22
32
|
* declaration file, a name outside the class spelling), which both readers skip. */
|
|
@@ -44,6 +44,18 @@ export const WRUN_BROWSER_BUILTIN_SOURCE_CLASSES = [
|
|
|
44
44
|
// the raw TRADE channel (wrun-tape-source.util).
|
|
45
45
|
'tape',
|
|
46
46
|
];
|
|
47
|
+
/**
|
|
48
|
+
* The kit classes the browser lane refuses by the kit's own refusal code of the class, before it reads anything of
|
|
49
|
+
* them: classes the kit's chart-browser profile serves whose reads the chart cannot make yet, so no lane serves them
|
|
50
|
+
* and the picker counts them unserved. `option_prints_v2` (kit 0.88.0, the option prints with their block and RFQ
|
|
51
|
+
* identity): the prints the chart reads carry no block or RFQ id until the protocol package names OptionPrint's
|
|
52
|
+
* `block_trade_id` and `rfq_id` (kiyotaka-go fields 32 and 33; pb-common 12.71.0 ends at field 31), and no field
|
|
53
|
+
* carries the leg count, so its lane lands with that protocol release. The record is the protocol gate's
|
|
54
|
+
* (`feed-missing` / `protocol-pending`: the app itself lacks the feed, the way out a reload).
|
|
55
|
+
*/
|
|
56
|
+
export const WRUN_BROWSER_REFUSED_CLASS_CODES = Object.freeze({
|
|
57
|
+
option_prints_v2: 'wrun_option_prints_v2_unsupported',
|
|
58
|
+
});
|
|
47
59
|
/** The source class a poll-lane file serves: its base name (`lanes/volatility_index.ts` serves
|
|
48
60
|
* `volatility_index`). Undefined for anything that is not a lane file (another extension, a
|
|
49
61
|
* declaration file, a name outside the class spelling), which both readers skip. */
|