@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type WrunRowLaneInstance } from './sources/wrun-row-lane.types.js';
|
|
2
2
|
/** One coin channel to subscribe: the script source (its K control), the exchange and the coin. */
|
|
3
3
|
export interface WrunCoinLaneChannel {
|
|
4
4
|
sourceType: string;
|
|
@@ -9,8 +9,8 @@ export interface WrunCoinLaneChannel {
|
|
|
9
9
|
export declare function wrunCoinLaneSourceTypes(): ReadonlySet<string>;
|
|
10
10
|
/**
|
|
11
11
|
* The coin channels a live session's row lanes subscribe, one per (source, exchange, coin): each instance of a lane
|
|
12
|
-
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none),
|
|
13
|
-
*
|
|
12
|
+
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none), on the exchange
|
|
13
|
+
* `coinChannelExchange` names. `chartExchange` stands for a lane that reads no governed plane and no chain.
|
|
14
14
|
*/
|
|
15
15
|
export declare function wrunRowLaneCoinChannels(context: {
|
|
16
16
|
rowLanes?: ReadonlyArray<WrunRowLaneInstance>;
|
|
@@ -1,28 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The live channels of the row lanes fed by COIN (`WrunRowLaneDescriptor.liveByCoin`, UW-PARITY: the
|
|
3
|
-
*
|
|
4
|
-
* names the control, `K_<SOURCE>`, which builds the channel with `formatCoinSubChannel`),
|
|
5
|
-
* technical-script control's wrun branch already subscribes.
|
|
2
|
+
* The live channels of the row lanes fed by COIN (`WrunRowLaneDescriptor.liveByCoin`, UW-PARITY: the print class, on
|
|
3
|
+
* every chain since OPTIONS-PORT P7): one coin-scoped channel per live instance, subscribed through the lane's own K
|
|
4
|
+
* control (its script source names the control, `K_<SOURCE>`, which builds the channel with `formatCoinSubChannel`),
|
|
5
|
+
* beside the push lanes the technical-script control's wrun branch already subscribes.
|
|
6
6
|
*
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
7
|
+
* - The exchange the channel names: a `chain` lane's is the exchange its instance's chain lists on (the acquisition's
|
|
8
|
+
* chain field, wrun-row-lanes.util `wrunRowLaneChainExchange`: a crypto venue, OPRA, a CME Group exchange); a governed
|
|
9
|
+
* lane's is its plane's (the governed set's exchange, never a literal); any other lane's the chart's own.
|
|
10
|
+
* - A lane reading a governed exchange (a governed lane, a chain instance on OPRA or a CME Group exchange:
|
|
11
|
+
* `wrunRowLaneChainGovernedExchange`) subscribes only when its read is routed REAL-TIME (the acquisition's
|
|
12
|
+
* `servedTier`, re-read by the run before its first ask): a delayed read serves history only, the reconcile re-asks
|
|
13
|
+
* it past the embargo. A crypto chain rides no gate, so it subscribes at once.
|
|
14
|
+
* - A chain instance subscribes only on a plane where a live producer of its type streams (the lane's
|
|
15
|
+
* `liveByCoin.chainPlanes`; absent: every plane): `option_prints` names OPRA and CME, whose OPTION_PRINT producers
|
|
16
|
+
* stream, while the gateway derives a crypto venue's prints from stored trades each minute and serves them from
|
|
17
|
+
* history alone, so a crypto chain's instance subscribes nothing and the live tick's reconcile refreshes it (its
|
|
18
|
+
* answer merged by the lane's `reconcile`, by print key).
|
|
19
|
+
* - The coin is the instance's (its acquisition's `coin`, the chain's underlying); an instance naming no coin, or a
|
|
20
|
+
* chain instance naming no exchange, subscribes nothing.
|
|
11
21
|
*
|
|
12
|
-
* Pure and light: reads the row-lane registry and the OPRA lane rules only.
|
|
22
|
+
* Pure and light: reads the row-lane registry, the chain plane rules and the OPRA lane rules only.
|
|
13
23
|
*/
|
|
24
|
+
import { OPRA_GOVERNED_EXCHANGES } from '../../interfaces/opra-realtime.interface.js';
|
|
14
25
|
import { wrunRowLaneByKey, wrunRowLanes } from './sources/row-lane-registry.js';
|
|
26
|
+
import { wrunLaneChainPlaneOf, } from './sources/wrun-row-lane.types.js';
|
|
27
|
+
import { wrunRowLaneChainExchange, wrunRowLaneChainGovernedExchange } from './sources/wrun-row-lanes.util.js';
|
|
15
28
|
import { isWrunOpraLaneAcquisition, wrunOpraLaneServedTier } from './wrun-opra-lane.util.js';
|
|
16
|
-
/** The exchange a governed plane's coin channel names. */
|
|
17
|
-
const PLANE_EXCHANGE = Object.freeze({ opra:
|
|
29
|
+
/** The exchange a governed plane's coin channel names (the governed set's own, never a literal). */
|
|
30
|
+
const PLANE_EXCHANGE = Object.freeze({ opra: OPRA_GOVERNED_EXCHANGES[0] });
|
|
18
31
|
/** The script sources (upper case) every row lane fed by coin rides: the live map admits them. */
|
|
19
32
|
export function wrunCoinLaneSourceTypes() {
|
|
20
33
|
return new Set(wrunRowLanes().flatMap((lane) => (lane.liveByCoin ? [lane.liveByCoin.scriptSource.toUpperCase()] : [])));
|
|
21
34
|
}
|
|
35
|
+
/**
|
|
36
|
+
* The exchange one instance's coin channel names, or undefined when it may not subscribe now: a chain instance its
|
|
37
|
+
* chain's exchange (none named: nothing) on a plane the lane's live producer streams on (`liveByCoin.chainPlanes`), at
|
|
38
|
+
* a real-time routed tier on a governed exchange; a governed lane its plane's, at a real-time routed tier; any other
|
|
39
|
+
* lane the chart's own.
|
|
40
|
+
*/
|
|
41
|
+
function coinChannelExchange(lane, acquisition, chartExchange) {
|
|
42
|
+
if (lane.chain !== undefined) {
|
|
43
|
+
const exchange = wrunRowLaneChainExchange(lane, acquisition).trim().toUpperCase();
|
|
44
|
+
if (exchange === '')
|
|
45
|
+
return undefined;
|
|
46
|
+
const planes = lane.liveByCoin?.chainPlanes;
|
|
47
|
+
if (planes !== undefined && !planes.includes(wrunLaneChainPlaneOf(exchange)))
|
|
48
|
+
return undefined;
|
|
49
|
+
const governed = wrunRowLaneChainGovernedExchange(lane, acquisition) !== null;
|
|
50
|
+
return governed && wrunOpraLaneServedTier(acquisition) !== 'realtime' ? undefined : exchange;
|
|
51
|
+
}
|
|
52
|
+
if (lane.governed !== undefined) {
|
|
53
|
+
if (!isWrunOpraLaneAcquisition(acquisition) || wrunOpraLaneServedTier(acquisition) !== 'realtime')
|
|
54
|
+
return undefined;
|
|
55
|
+
return PLANE_EXCHANGE[lane.governed];
|
|
56
|
+
}
|
|
57
|
+
return chartExchange;
|
|
58
|
+
}
|
|
22
59
|
/**
|
|
23
60
|
* The coin channels a live session's row lanes subscribe, one per (source, exchange, coin): each instance of a lane
|
|
24
|
-
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none),
|
|
25
|
-
*
|
|
61
|
+
* fed by coin, its acquisition the run recorded (the instance's extras when it recorded none), on the exchange
|
|
62
|
+
* `coinChannelExchange` names. `chartExchange` stands for a lane that reads no governed plane and no chain.
|
|
26
63
|
*/
|
|
27
64
|
export function wrunRowLaneCoinChannels(context, chartExchange) {
|
|
28
65
|
const channels = new Map();
|
|
@@ -32,14 +69,12 @@ export function wrunRowLaneCoinChannels(context, chartExchange) {
|
|
|
32
69
|
if (lane === undefined || live === undefined)
|
|
33
70
|
continue;
|
|
34
71
|
const acquisition = context.acquisition[instance.key] ?? instance.extras;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
72
|
+
const exchange = coinChannelExchange(lane, acquisition, chartExchange);
|
|
73
|
+
if (exchange === undefined)
|
|
74
|
+
continue;
|
|
39
75
|
const coin = typeof acquisition.coin === 'string' ? acquisition.coin.trim().toUpperCase() : '';
|
|
40
76
|
if (coin === '')
|
|
41
77
|
continue;
|
|
42
|
-
const exchange = lane.governed !== undefined ? PLANE_EXCHANGE[lane.governed] : chartExchange;
|
|
43
78
|
const channel = { sourceType: live.scriptSource, exchange, coin };
|
|
44
79
|
channels.set(`${channel.sourceType}|${exchange}|${coin}`, channel);
|
|
45
80
|
}
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
* change follow it, the way a timeframe or symbol param rewrites its pins.
|
|
49
49
|
* A value equal to the baked `ticks_per_bar` writes nothing; the lane util
|
|
50
50
|
* clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
|
|
51
|
+
* - A chain view's params (OPTLOAD G5, wrun-option-views.util,
|
|
52
|
+
* `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
|
|
53
|
+
* input that declares views, each view param knob bound to a declared param
|
|
54
|
+
* (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
|
|
55
|
+
* param's current value, the `ticks_per_bar` rule, so a settings change
|
|
56
|
+
* asks the gateway with the new values.
|
|
51
57
|
* - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
|
|
52
58
|
* - A Style page row (`__style__<output>__<property>`, an FE-only declared
|
|
53
59
|
* input that never reaches any host) writes the output's `width`,
|
|
@@ -48,6 +48,12 @@
|
|
|
48
48
|
* change follow it, the way a timeframe or symbol param rewrites its pins.
|
|
49
49
|
* A value equal to the baked `ticks_per_bar` writes nothing; the lane util
|
|
50
50
|
* clamps it to 1..500 (`wrunVolumeProfileLaneExtras`).
|
|
51
|
+
* - A chain view's params (OPTLOAD G5, wrun-option-views.util,
|
|
52
|
+
* `optionViewParamWrites`): on an `options_chain` or `option_contract_state`
|
|
53
|
+
* input that declares views, each view param knob bound to a declared param
|
|
54
|
+
* (`"@<param>"`, or `<knob>_param` beside a literal default) takes the
|
|
55
|
+
* param's current value, the `ticks_per_bar` rule, so a settings change
|
|
56
|
+
* asks the gateway with the new values.
|
|
51
57
|
* - The lane words (kit 0.77.0, `laneWordWrites`): `currency_param` and `when`.
|
|
52
58
|
* - A Style page row (`__style__<output>__<property>`, an FE-only declared
|
|
53
59
|
* input that never reaches any host) writes the output's `width`,
|
|
@@ -85,6 +91,7 @@ import { WRUN_SOURCE_FIELD_WORDS, wrunInputGateOn } from './wrun-market-facts.ut
|
|
|
85
91
|
import { wrunParamValuesFromSettings } from './wrun-param-values.util.js';
|
|
86
92
|
import { bindWrunColorSettings } from './wrun-color-settings.lazy.js';
|
|
87
93
|
import { WRUN_LEVELS_COLOR_PICKED_KEY } from './wrun-style-flags.util.js';
|
|
94
|
+
import { wrunOptionViewParamKnobs } from './wrun-option-views.util.js';
|
|
88
95
|
import { findWrunVisibilityTarget, wrunVisibilitySectionOfPrefix, wrunVisibilityTargetAt, } from './wrun-visibility-table.js';
|
|
89
96
|
import { isWrunHudViewerRowKey, packWrunColor, parseWrunColor, WRUN_HEATMAP_SENSITIVITY_ROW_RE, WRUN_HUD_LOOK_ROW_PREFIX, WRUN_HUD_LOOK_ROW_RE, } from './wrun-color-facts.util.js';
|
|
90
97
|
// The key predicates and the colour parse are thin facts boot-path readers take without this
|
|
@@ -1075,6 +1082,43 @@ function ticksPerBarWrites(metadata, settings) {
|
|
|
1075
1082
|
}
|
|
1076
1083
|
return writes;
|
|
1077
1084
|
}
|
|
1085
|
+
/** The param a chain view's param knob is bound to (OPTLOAD G5), in either sheet spelling, the `ticks_per_bar` ones:
|
|
1086
|
+
* `<knob>_param` beside a literal default, or the in-source reference verbatim, `<knob>: "@<param>"`. */
|
|
1087
|
+
function viewParamBinding(source, knob) {
|
|
1088
|
+
const named = source[`${knob}_param`];
|
|
1089
|
+
if (typeof named === 'string' && named !== '')
|
|
1090
|
+
return named;
|
|
1091
|
+
const reference = source[knob];
|
|
1092
|
+
return typeof reference === 'string' && reference.startsWith('@') && reference.length > 1
|
|
1093
|
+
? reference.slice(1)
|
|
1094
|
+
: undefined;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* The chain view param bindings (OPTLOAD G5, wrun-option-views.util): on an `options_chain` or `option_contract_state`
|
|
1098
|
+
* input that declares views (`page_view` or `page_views`), every param knob of its views bound to a declared param
|
|
1099
|
+
* takes that param's current value (`wrunValueParamSetting`: the setting, else the declared default), so the lane's
|
|
1100
|
+
* ask, and a settings change's ask, carries the value the run computes with. A value equal to the knob's writes
|
|
1101
|
+
* nothing; an unknown param or a value that is not a finite number writes nothing either, so the handle reaches the
|
|
1102
|
+
* lane, which refuses it by name.
|
|
1103
|
+
*/
|
|
1104
|
+
function optionViewParamWrites(metadata, settings) {
|
|
1105
|
+
const sources = isRecord(metadata.inputSources) ? metadata.inputSources : {};
|
|
1106
|
+
const params = Array.isArray(metadata.params) ? metadata.params : [];
|
|
1107
|
+
const writes = [];
|
|
1108
|
+
for (const [name, source] of Object.entries(sources)) {
|
|
1109
|
+
if (!isRecord(source) || (source.source !== 'options_chain' && source.source !== 'option_contract_state'))
|
|
1110
|
+
continue;
|
|
1111
|
+
for (const knob of wrunOptionViewParamKnobs(source)) {
|
|
1112
|
+
const bound = viewParamBinding(source, knob);
|
|
1113
|
+
const param = bound === undefined ? undefined : params.find((candidate) => candidate.name === bound);
|
|
1114
|
+
const value = param === undefined ? undefined : wrunValueParamSetting(param, settings);
|
|
1115
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value === source[knob])
|
|
1116
|
+
continue;
|
|
1117
|
+
writes.push({ path: ['inputSources', name, knob], kind: 'value', value, create: true });
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
return writes;
|
|
1121
|
+
}
|
|
1078
1122
|
/** The lane words a setting rides (kit 0.77.0), off the param's run value (the init() number):
|
|
1079
1123
|
* `currency_param` writes the picked label ("USD" or "Coin") into `currency`; a `when` gate that
|
|
1080
1124
|
* is off marks the input `undemanded`. The browser's one authority: its plan reads neither. */
|
|
@@ -1310,6 +1354,7 @@ export function wrunSheetWithSettings(metadata, settings) {
|
|
|
1310
1354
|
...params.flatMap((param) => paramWrites(param, settings, members)),
|
|
1311
1355
|
...params.flatMap((param) => hostWrites(metadata, param, settings)),
|
|
1312
1356
|
...ticksPerBarWrites(metadata, settings),
|
|
1357
|
+
...optionViewParamWrites(metadata, settings),
|
|
1313
1358
|
...laneWordWrites(metadata, settings),
|
|
1314
1359
|
...styleRowWrites(metadata, settings),
|
|
1315
1360
|
];
|
|
@@ -158,15 +158,21 @@ export const WRUN_KSCRIPT_SOURCE_CLASSES = Object.freeze({
|
|
|
158
158
|
option_contract_state: { type: null, payload: ['market', 'chain_venue', 'book'] },
|
|
159
159
|
option_surface: { type: null, payload: ['market', 'chain_venue', 'book'] },
|
|
160
160
|
token_supply: { type: null, payload: ['token'] },
|
|
161
|
-
//
|
|
162
|
-
// (wrun_option_prints_one_acquisition), so one fetch.
|
|
163
|
-
option_prints: { type: null, payload: [] },
|
|
164
|
-
//
|
|
165
|
-
//
|
|
166
|
-
|
|
161
|
+
// The prints of the chart's chain (sources/row-lanes/option_prints, a chain lane): the package's ONE acquisition
|
|
162
|
+
// (wrun_option_prints_one_acquisition), so one fetch per venue word and book.
|
|
163
|
+
option_prints: { type: null, payload: ['chain_venue', 'book'] },
|
|
164
|
+
// The prints with their block and RFQ identity (kit 0.88.0): the same one acquisition a package, of its own class,
|
|
165
|
+
// keyed by venue word and book (`structure` filters that one read). The browser lane refuses the class by its code
|
|
166
|
+
// until the identity reaches the chart (wrun-browser-sources.leaf WRUN_BROWSER_REFUSED_CLASS_CODES).
|
|
167
|
+
option_prints_v2: { type: null, payload: ['chain_venue', 'book'] },
|
|
168
|
+
// The per-contract flow of the chart's chain (sources/row-lanes/option_contract_flow, a chain lane): one read per
|
|
169
|
+
// chart market, venue word and book at the bars' tier; only `0dte` narrows it (nearest expiries, the strike window
|
|
170
|
+
// and the volume floor fold on the chart).
|
|
171
|
+
option_contract_flow: { type: null, payload: ['market', 'expiries', 'chain_venue', 'book'] },
|
|
167
172
|
series: { type: null, payload: ['ref'] },
|
|
168
|
-
// The
|
|
169
|
-
|
|
173
|
+
// The flow scope rows of the chart's chain (sources/lanes/options_flow, a chain lane read by `auto`, its `venue` a
|
|
174
|
+
// scope's venue): one fetch per scope, dte, moneyness, venue and a ticker's book.
|
|
175
|
+
options_flow: { type: null, payload: ['scope', 'dte', 'moneyness', 'venue', 'book'] },
|
|
170
176
|
// The statistics of the chart's options chain (sources/lanes/option_daily, a chain lane): one fetch per venue word
|
|
171
177
|
// and book, as the lane plans its instances.
|
|
172
178
|
option_daily: { type: null, payload: ['chain_venue', 'book'] },
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* reads it off a failure (wrun-refusal.util `wrunFailureCauseOf`) and carries it at `refusal.telemetry.cause`.
|
|
11
11
|
*/
|
|
12
12
|
import { type WrunServerAnswerRowId } from './wrun-hosted-wire-caps.js';
|
|
13
|
-
export declare const WRUN_FAILURE_CAUSES: readonly ["no-reply", "session-kicked", "connection-unavailable", "connection-lost", "dial-failed", "socket-stale", "worker-restarted", "chart-gone", "capability-unavailable", "request-timeout", "paging-incomplete", "aborted", "superseded", "access-denied", "session-expired", "backend-unavailable", "reply-unreadable", "worker-dead", "chunk-load", "network", "none", "other"];
|
|
13
|
+
export declare const WRUN_FAILURE_CAUSES: readonly ["no-reply", "session-kicked", "connection-unavailable", "connection-lost", "dial-failed", "socket-stale", "worker-restarted", "chart-gone", "capability-unavailable", "request-timeout", "paging-incomplete", "aborted", "superseded", "access-denied", "session-expired", "backend-unavailable", "reply-unreadable", "worker-dead", "chunk-load", "network", "package-withdrawn", "package-hosted", "compile-failed", "twin-declined", "integration-error", "source-budget", "source-failed", "source-declined", "none", "other"];
|
|
14
14
|
export type WrunFailureBaseCause = (typeof WRUN_FAILURE_CAUSES)[number];
|
|
15
15
|
/** A cloud answer's cause: `server:` and the answer-table row the frame matched. */
|
|
16
16
|
export type WrunFailureServerCause = `server:${WrunServerAnswerRowId}`;
|
|
@@ -31,6 +31,20 @@ export const WRUN_FAILURE_CAUSES = Object.freeze([
|
|
|
31
31
|
'worker-dead',
|
|
32
32
|
'chunk-load',
|
|
33
33
|
'network',
|
|
34
|
+
// What stopped a package before it ran (wrun-refusal.util `wrunLoaderFailureCauseOf`): the registry withdrew it (a
|
|
35
|
+
// resolve answered 404 or 410, a yanked version), its version runs on OpenMarket servers only, this device could not
|
|
36
|
+
// compile it, its built-in's twin declined, the chart's adapter refused its output. None is transient.
|
|
37
|
+
'package-withdrawn',
|
|
38
|
+
'package-hosted',
|
|
39
|
+
'compile-failed',
|
|
40
|
+
'twin-declined',
|
|
41
|
+
'integration-error',
|
|
42
|
+
// What the source ladder gave up on (the terminal `service-no-answer` record of a secondary source lane, after its
|
|
43
|
+
// two recovery rungs): the lane did not answer within its budget, its read failed, or its source declined the
|
|
44
|
+
// chart's market. None is transient: the ladder already asked again.
|
|
45
|
+
'source-budget',
|
|
46
|
+
'source-failed',
|
|
47
|
+
'source-declined',
|
|
34
48
|
'none',
|
|
35
49
|
'other',
|
|
36
50
|
]);
|
|
@@ -797,8 +797,12 @@ export function parseWrunPanelFrame(raw, slot, declaration) {
|
|
|
797
797
|
panel: { ...panel, id: 'wrun-frame' },
|
|
798
798
|
rows: frame.rows,
|
|
799
799
|
}, { lane: 'wrun' });
|
|
800
|
-
|
|
801
|
-
|
|
800
|
+
// A row refusal names the row and why (`invalid panel row 3: cell 4 is not ...`), so the one console line that
|
|
801
|
+
// reports a refused frame says which cell refused it.
|
|
802
|
+
if (!result.ok) {
|
|
803
|
+
const row = result.row === undefined ? '' : ` ${result.row.index}: ${result.row.reason}`;
|
|
804
|
+
return invalidWrunFrame(slot, `${result.rejectReason}${row}`);
|
|
805
|
+
}
|
|
802
806
|
if (isPanelClearFrame(result.data))
|
|
803
807
|
return invalidWrunFrame(slot, 'unexpected clear frame');
|
|
804
808
|
if (chrome.markets !== undefined && chrome.markets.length !== result.data.rows.length) {
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Main-thread WRUN host:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Main-thread WRUN host: loads a package's module into the sandbox worker,
|
|
3
|
+
* owns that worker, and runs packed series requests through it. One shared
|
|
4
|
+
* worker serves every dev overlay; requests are id-matched, and a request
|
|
5
|
+
* that outlives its clock poisons the worker (terminate + respawn) so a
|
|
6
|
+
* spinning guest cannot wedge later runs.
|
|
7
|
+
*
|
|
8
|
+
* Modules (the shared engine protocol, wrun-chart-host 0.6.0): the main
|
|
9
|
+
* thread never hashes and never compiles a module. `loadModule` keeps a
|
|
10
|
+
* private copy of the package's bytes and posts them (`module-load`); the
|
|
11
|
+
* worker hashes them, checks the sheet's `wasm_sha256` pin, clamps the
|
|
12
|
+
* memory, prepares and compiles them (wrun-engine-handler.ts) and answers the
|
|
13
|
+
* module's key, digest and imports, which the opaque handle carries. Every
|
|
14
|
+
* full run and live-start names the module by key and carries the bytes
|
|
15
|
+
* again (copied, never transferred), so a respawned worker compiles them
|
|
16
|
+
* anew; nothing here tracks which keys the worker holds. Each request has
|
|
17
|
+
* two clocks of WRUN_RUN_TIMEOUT_MS: the start ceiling from the post (the
|
|
18
|
+
* wait behind other requests, the compile and the instantiation), then the
|
|
19
|
+
* run deadline from the worker's `{ id, running: true }`, posted once the
|
|
20
|
+
* module is instantiated, when the request executes; a terminal answer
|
|
21
|
+
* settles a request in either phase.
|
|
8
22
|
*
|
|
9
23
|
* Isolation: a death of the shared worker (the run timeout, or an error
|
|
10
24
|
* event with a request in flight) rejects every pending request with
|
|
@@ -37,18 +51,17 @@
|
|
|
37
51
|
* carries the engine's StrategyOutput, which rides beside the rows
|
|
38
52
|
* (`attachWrunStrategy`) exactly like the handle set.
|
|
39
53
|
*/
|
|
40
|
-
import type { WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
54
|
+
import type { WrunIndicatorMetadata, WrunModuleHandle, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
|
|
41
55
|
import { attachWrunLive, WrunLiveOrderError, wrunLiveOf } from '../../interfaces/wrun-runtime.interface.js';
|
|
42
56
|
import { type WrunInputRow } from './wrun-pack.util.js';
|
|
43
57
|
import { WrunWorkerPoisonError } from './wrun-registry-errors.util.js';
|
|
44
|
-
/** Sources the kit marks daemon-only
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
export declare function assertWrunBrowserSources(metadata: WrunIndicatorMetadata): Promise<void> | void;
|
|
58
|
+
/** Sources the kit marks daemon-only are computed by the daemon, which owns their dependencies: the first
|
|
59
|
+
* input declaring one refuses the browser run by name, with the kit's words for it. Synchronous: the
|
|
60
|
+
* table is the kit's, copied import-free (wrun-kit-run-tables.util, pinned to the kit's export by its
|
|
61
|
+
* kit-mirror spec), so no run loads the kit bundle on the main thread to read it (OPTLOAD g1 round 3:
|
|
62
|
+
* that read evaluated 3.6 MB of authoring code, 836 ms on a measured add, for a table the kit ships empty).
|
|
63
|
+
* The chart's own candle classes (`ohlcv`, `time`) are never daemon-only. */
|
|
64
|
+
export declare function assertWrunBrowserSources(metadata: WrunIndicatorMetadata): void;
|
|
52
65
|
/** One respawn of the shared worker per window (the kScript shared worker's
|
|
53
66
|
* `restartWithReseedBackoff` rule, sized for this host's 20 s run timeout
|
|
54
67
|
* instead of kScript's 90 s call timeouts): a second death inside the window
|
|
@@ -57,8 +70,8 @@ export declare function assertWrunBrowserSources(metadata: WrunIndicatorMetadata
|
|
|
57
70
|
* below bounds ONE package's deaths geometrically; this window bounds the
|
|
58
71
|
* worker's deaths whatever mix of packages (or overrides) causes them. */
|
|
59
72
|
export declare const WRUN_WORKER_RESPAWN_WINDOW_MS = 60000;
|
|
60
|
-
/** How many
|
|
61
|
-
* and
|
|
73
|
+
/** How many module handles the host keeps (loadModule): every package version, draft Run and REPL compile mints a
|
|
74
|
+
* key, and the engine worker keeps an LRU of the same size of the compiled modules behind them. */
|
|
62
75
|
export declare const WRUN_MODULE_CACHE_CAPACITY = 16;
|
|
63
76
|
/** Why the shared worker died: the run timeout, or the Worker's error event (the worker factory's death test). */
|
|
64
77
|
export type WrunHostDeathReason = WrunWorkerPoisonError['reason'];
|
|
@@ -113,11 +126,14 @@ export { attachWrunLive, wrunLiveOf };
|
|
|
113
126
|
export declare class WrunBrowserHost {
|
|
114
127
|
private worker;
|
|
115
128
|
private pending;
|
|
129
|
+
/** One counter numbers loads, runs and live-ends: a retired incarnation's late answer names an id no entry holds. */
|
|
116
130
|
private requestSeq;
|
|
117
|
-
/**
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
131
|
+
/** The order requests enter the `run` phase in (`PendingRequest.runOrder`). */
|
|
132
|
+
private runSeq;
|
|
133
|
+
/** Loads by module, least recently used first (Map order: a hit moves its entry to the end). The cache only
|
|
134
|
+
* dedupes loads and owns no module: a mounted overlay keeps the handle it was handed (its record), and a live
|
|
135
|
+
* session keeps its instance in the worker (live ticks name the session, never a module), so an eviction stops
|
|
136
|
+
* neither; a handle's bytes stay behind it whatever the cache lets go, and its runs carry them. */
|
|
121
137
|
private moduleCache;
|
|
122
138
|
/** Live sessions the current worker holds (installed by an ok live-start,
|
|
123
139
|
* dropped by live-end, a sessionLost answer, or the worker's death). */
|
|
@@ -133,41 +149,70 @@ export declare class WrunBrowserHost {
|
|
|
133
149
|
* the first death, so the first spawn ever never opens a window. */
|
|
134
150
|
private lastRespawnAt;
|
|
135
151
|
private respawnHeldUntil;
|
|
136
|
-
/** Spin the sandbox worker
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
|
|
152
|
+
/** Spin the sandbox worker (its script's fetch starts with the spawn) and
|
|
153
|
+
* load the shared host (the packer, the leg planner, the strategy
|
|
154
|
+
* resolver; the worker holds its own for the module rewrite) ahead of the
|
|
155
|
+
* first add or Run, so the first package a reader mounts pays neither the
|
|
156
|
+
* worker spawn nor the host's parse on its click. Never the authoring kit:
|
|
157
|
+
* no run reads it on this thread (the kit tables a run reads are
|
|
158
|
+
* import-free copies, wrun-kit-run-tables.util), and its 3.6 MB evaluation
|
|
159
|
+
* was the longest main-thread task of a measured first add (OPTLOAD g1
|
|
160
|
+
* round 3). The
|
|
161
|
+
* web app's signals reach it through one owner
|
|
162
|
+
* (src/utility/chart/demand-code-warm.util.ts: a surface's open, the
|
|
163
|
+
* intent toward it); the add door, a restored package and a row's settled
|
|
164
|
+
* intent call it beside their own loads. Idempotent; a load failure
|
|
165
|
+
* surfaces on the first module load or run as before. A held respawn is not
|
|
166
|
+
* warmed around: the window exists to keep the worker down. Resolves true
|
|
167
|
+
* once the host landed and the worker spawned, false when either failed, so
|
|
168
|
+
* the caller can tell a warm from a failed one (an intent's latch clears on
|
|
169
|
+
* false and the next intent asks again). Never throws, never rejects. */
|
|
170
|
+
warm(): Promise<boolean>;
|
|
146
171
|
/** The active quarantine of a package, if its hold is still running. */
|
|
147
172
|
quarantineOf(metadata: Pick<WrunIndicatorMetadata, 'id' | 'wasm_sha256'>): WrunHostQuarantine | undefined;
|
|
148
173
|
/** Forget every quarantine and the respawn window (specs only). */
|
|
149
174
|
resetGuardsForTests(): void;
|
|
150
|
-
/**
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
175
|
+
/** Load (and cache) a package module: the worker hashes the bytes, refuses a
|
|
176
|
+
* digest other than the sheet's `wasm_sha256` pin with the words this host
|
|
177
|
+
* always used, refuses a memory the clamp refuses (a maximum or a starting
|
|
178
|
+
* size over the worker's memory limit, shared or 64-bit memory), stamps
|
|
179
|
+
* the limit as the maximum of a memory declared without one, exports every
|
|
180
|
+
* mutable global for the live lane's snapshot and restore, and compiles
|
|
181
|
+
* (wrun-engine-handler.ts `compileWrunModuleBytes`). This thread keeps a
|
|
182
|
+
* private copy of the bytes behind the handle and hashes and compiles
|
|
183
|
+
* nothing. A load needs the worker: during a held respawn every load
|
|
184
|
+
* rejects with the held death, a cached one too, and its start ceiling
|
|
185
|
+
* bounds the wait and the compile.
|
|
157
186
|
*
|
|
158
|
-
* The cache is an LRU of WRUN_MODULE_CACHE_CAPACITY
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
* in flight
|
|
187
|
+
* The cache is an LRU of WRUN_MODULE_CACHE_CAPACITY handles, keyed by the
|
|
188
|
+
* sheet's pin and ABI when it pins one (its identity before and after the
|
|
189
|
+
* load), else by the bytes object and the ABI until the worker names the
|
|
190
|
+
* digest, then by the module's key; the first handle of a key stays the
|
|
191
|
+
* one every caller shares. A hit serves only bytes equal to the ones its
|
|
192
|
+
* entry loads: other bytes under the key (a pin claimed by bytes it was
|
|
193
|
+
* not verified from, a reused buffer whose content changed) go to the
|
|
194
|
+
* worker, which checks them against the pin, beside the cached entry and
|
|
195
|
+
* never in its place. Every caller of a load in flight shares its one
|
|
196
|
+
* post, and a load in flight is never evicted; eviction drops loaded
|
|
197
|
+
* entries only, least recently used first, so the cache passes the
|
|
198
|
+
* capacity only while more loads than that are in flight. A failed load is
|
|
199
|
+
* not cached: its entry leaves before its callers see the failure, and the
|
|
200
|
+
* next request loads again. Async, as the compile was: every failure (a
|
|
201
|
+
* detached buffer included) is a rejection, and nothing here awaits before
|
|
202
|
+
* the entry is cached. */
|
|
203
|
+
loadModule(wasmBytes: ArrayBuffer | Uint8Array, metadata: WrunIndicatorMetadata): Promise<WrunModuleHandle>;
|
|
204
|
+
/** A load answered: its entry leaves the key it waited under (an unpinned sheet's provisional key; none for a load
|
|
205
|
+
* that verified other bytes beside a cached entry) for the module's own key. A handle already loaded under that key
|
|
206
|
+
* stays the one every caller shares. */
|
|
207
|
+
private cacheLoadedModule;
|
|
208
|
+
/** Post one `module-load` of the private bytes (copied, never transferred: the handle keeps them for its runs) and
|
|
209
|
+
* mint the handle from the worker's answer. */
|
|
210
|
+
private requestModuleLoad;
|
|
211
|
+
/** Evict loaded entries, least recently used first, until the cache is back at its capacity (a load in flight
|
|
212
|
+
* stays: its callers share it). */
|
|
168
213
|
private trimModuleCache;
|
|
169
214
|
runSeries(input: {
|
|
170
|
-
module:
|
|
215
|
+
module: WrunModuleHandle;
|
|
171
216
|
metadata: WrunIndicatorMetadata;
|
|
172
217
|
rows: readonly WrunInputRow[];
|
|
173
218
|
initArgs: readonly number[];
|
|
@@ -189,7 +234,7 @@ export declare class WrunBrowserHost {
|
|
|
189
234
|
* key (see the worker's ownership rule). */
|
|
190
235
|
startLiveSeries(input: {
|
|
191
236
|
sessionKey: string;
|
|
192
|
-
module:
|
|
237
|
+
module: WrunModuleHandle;
|
|
193
238
|
metadata: WrunIndicatorMetadata;
|
|
194
239
|
rows: readonly WrunInputRow[];
|
|
195
240
|
initArgs: readonly number[];
|
|
@@ -233,22 +278,49 @@ export declare class WrunBrowserHost {
|
|
|
233
278
|
* reason and the package's strikes (the heal ladder reads them). Returns
|
|
234
279
|
* the lane the pending entry remembers. */
|
|
235
280
|
private admit;
|
|
281
|
+
/** A full run or a live-start: the module rides the request, its key (the worker reuses the module it holds under
|
|
282
|
+
* it) and the host's private copy of its bytes (copied by structured clone, never transferred: a worker that does
|
|
283
|
+
* not hold the key, a respawned one or one that let it go, compiles them). The packed request's own `abi` stays
|
|
284
|
+
* the run's sheet's. */
|
|
285
|
+
private dispatchWithModule;
|
|
236
286
|
private dispatch;
|
|
287
|
+
/**
|
|
288
|
+
* Post one request under a pending entry: the respawn hold first (a held death refuses it, nothing posted), then
|
|
289
|
+
* the worker, the entry in its `start` phase with the start ceiling armed (the wait behind other requests, the
|
|
290
|
+
* module's compile and its instantiation, bounded as the dispatch clock bounded the hold before 0.6.0), then the
|
|
291
|
+
* post. A request the structured clone refuses fails alone (its entry and clock go with it).
|
|
292
|
+
*/
|
|
293
|
+
private post;
|
|
294
|
+
/** A phase's clock: a request that outlives it means the worker is stuck (a guest spinning, a compile that never
|
|
295
|
+
* ends), so the worker is poisoned and replaced and later requests start clean. */
|
|
296
|
+
private armClock;
|
|
297
|
+
/** One answer from the worker. `running` moves its request to the `run` phase on a fresh clock (a second one, one
|
|
298
|
+
* for a load or for no pending request changes nothing); a terminal answer settles its request in either phase;
|
|
299
|
+
* an answer for no pending request (an untracked live-end's, a retired incarnation's) is dropped. */
|
|
300
|
+
private receive;
|
|
301
|
+
/** A run's terminal answer: the package answered (an overridden quarantine is cleared by the success, and an
|
|
302
|
+
* opened session is one the worker now holds), a lost session, a live-order refusal, or a failure. */
|
|
303
|
+
private settleRun;
|
|
237
304
|
private ensureWorker;
|
|
238
305
|
/**
|
|
239
306
|
* The shared worker died: quarantine the package that was running (the
|
|
240
|
-
*
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* flight means nothing to quarantine (a worker that dies idle is only a
|
|
307
|
+
* culprit, `culpritOf`), terminate the worker, remember the death for the
|
|
308
|
+
* respawn window, and reject every pending request (loads included) with
|
|
309
|
+
* the poison error naming the live sessions lost with the worker. Nothing
|
|
310
|
+
* in flight means nothing to quarantine (a worker that dies idle is only a
|
|
245
311
|
* death for the window). `message` is what every casualty reads; the
|
|
246
|
-
*
|
|
247
|
-
* (cause, the culprit's package and
|
|
248
|
-
* is recorded here once, frozen, and rides every
|
|
249
|
-
* the respawn hold's included, so a casualty can
|
|
312
|
+
* culprit of a timeout keeps its own deadline sentence. The death's
|
|
313
|
+
* context (cause, the culprit's package, session and phase, the budget a
|
|
314
|
+
* timeout used up) is recorded here once, frozen, and rides every
|
|
315
|
+
* rejection of this death, the respawn hold's included, so a casualty can
|
|
316
|
+
* name who held the sandbox.
|
|
250
317
|
*/
|
|
251
318
|
private poisonWorker;
|
|
319
|
+
/** Who held the worker when it died: the request in the `run` phase, the hog holding the worker's synchronous turn
|
|
320
|
+
* (the expired request itself when it was running, else the first that started running), else the expired
|
|
321
|
+
* request (nothing ran: its own wait and compile used its ceiling up), else, for an error event, the oldest
|
|
322
|
+
* request in flight. */
|
|
323
|
+
private culpritOf;
|
|
252
324
|
/** Put (or keep) a package on the ladder: a death while its previous hold
|
|
253
325
|
* runs, or inside the reset grace after it, is a repeat and doubles the
|
|
254
326
|
* hold (capped); a later death starts over at the base hold. Records past
|