@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.
Files changed (157) hide show
  1. package/README.md +17 -8
  2. package/dist/constants/feature-flags.constants.js +7 -2
  3. package/dist/constants/marketCapabilities.constants.d.ts +5 -0
  4. package/dist/constants/marketCapabilities.constants.js +16 -0
  5. package/dist/host-env.d.ts +3 -19
  6. package/dist/host-ports.types.d.ts +36 -17
  7. package/dist/index.d.ts +12 -1
  8. package/dist/index.js +12 -1
  9. package/dist/indicators/controls/tpo-session.util.js +42 -18
  10. package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
  11. package/dist/interfaces/wrun-runtime.interface.js +17 -3
  12. package/dist/market-data/billing.interface.d.ts +2 -1
  13. package/dist/settings-templates/indicator-fields.js +10 -0
  14. package/dist/utility/chart/chart-mount-epoch.util.d.ts +12 -0
  15. package/dist/utility/chart/chart-mount-epoch.util.js +32 -0
  16. package/dist/utility/chart/crypto-index.leaf.d.ts +16 -0
  17. package/dist/utility/chart/crypto-index.leaf.js +19 -0
  18. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  19. package/dist/utility/chart/index-mode.util.d.ts +11 -5
  20. package/dist/utility/chart/index-mode.util.js +22 -10
  21. package/dist/utility/chart/kscript-source-answer-budget.leaf.d.ts +36 -0
  22. package/dist/utility/chart/kscript-source-answer-budget.leaf.js +39 -0
  23. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +38 -1
  24. package/dist/utility/chart/kscript-source-degrade.leaf.js +39 -1
  25. package/dist/utility/chart/live-bucket.util.d.ts +2 -1
  26. package/dist/utility/chart/live-bucket.util.js +47 -15
  27. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +15 -1
  28. package/dist/utility/chart/local-kscript-warmup-depth.util.js +9 -0
  29. package/dist/utility/chart/market-session-schedule.util.d.ts +3 -1
  30. package/dist/utility/chart/market-session-schedule.util.js +24 -2
  31. package/dist/utility/chart/marketKind.util.d.ts +12 -7
  32. package/dist/utility/chart/marketKind.util.js +15 -5
  33. package/dist/utility/chart/ny-calendar.util.d.ts +104 -0
  34. package/dist/utility/chart/ny-calendar.util.js +346 -0
  35. package/dist/utility/chart/om-panel.util.d.ts +14 -2
  36. package/dist/utility/chart/om-panel.util.js +108 -40
  37. package/dist/utility/chart/rth-session.util.d.ts +10 -7
  38. package/dist/utility/chart/rth-session.util.js +17 -22
  39. package/dist/utility/chart/trading-day.util.js +90 -18
  40. package/dist/utility/chart/us-equities-session.util.js +20 -67
  41. package/dist/utility/chart/wrun-bar-session-facts.util.js +14 -1
  42. package/dist/utility/common/time.util.d.ts +7 -1
  43. package/dist/utility/common/time.util.js +11 -41
  44. package/dist/utility/number-format.util.d.ts +17 -7
  45. package/dist/utility/number-format.util.js +18 -8
  46. package/dist/utility/options/option-symbol.util.js +13 -2
  47. package/dist/utility/symbol-selection/contract-expiry.util.js +9 -1
  48. package/dist/utility/watchlist/import/import-request.leaf.d.ts +4 -1
  49. package/dist/utility/watchlist/import/import-request.leaf.js +5 -2
  50. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +25 -4
  51. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +62 -4
  52. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +19 -0
  53. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +57 -0
  54. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +23 -0
  55. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +90 -0
  56. package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.d.ts +39 -0
  57. package/dist/utility/wrun/run-schedule/wrun-lane-groups.util.js +60 -0
  58. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +77 -0
  59. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +195 -0
  60. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.d.ts +56 -0
  61. package/dist/utility/wrun/run-schedule/wrun-own-candles.util.js +70 -0
  62. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +53 -0
  63. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +239 -0
  64. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +16 -0
  65. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +14 -0
  66. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +43 -18
  67. package/dist/utility/wrun/sources/lanes/options_flow.js +209 -72
  68. package/dist/utility/wrun/sources/lanes/token_supply.js +5 -31
  69. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -18
  70. package/dist/utility/wrun/sources/opra-option-lanes.util.js +12 -57
  71. package/dist/utility/wrun/sources/row-lane-registry.d.ts +1 -1
  72. package/dist/utility/wrun/sources/row-lane-registry.js +22 -8
  73. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +61 -0
  74. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +103 -8
  75. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +5 -0
  76. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +24 -12
  77. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +55 -0
  78. package/dist/utility/wrun/sources/row-lanes/option_prints.js +95 -18
  79. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +15 -1
  80. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +23 -8
  81. package/dist/utility/wrun/sources/row-lanes/option_surface.js +11 -11
  82. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +14 -2
  83. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +6 -3
  84. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +43 -8
  85. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +77 -11
  86. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +31 -16
  87. package/dist/utility/wrun/sources/wrun-row-lane.types.js +2 -0
  88. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +52 -12
  89. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +110 -46
  90. package/dist/utility/wrun/wrun-bar-count.util.d.ts +17 -6
  91. package/dist/utility/wrun/wrun-bar-count.util.js +27 -12
  92. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +10 -0
  93. package/dist/utility/wrun/wrun-browser-sources.leaf.js +12 -0
  94. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +3 -3
  95. package/dist/utility/wrun/wrun-coin-lane-live.util.js +53 -18
  96. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -0
  97. package/dist/utility/wrun/wrun-color-settings.util.js +45 -0
  98. package/dist/utility/wrun/wrun-draft-overlay.util.js +14 -8
  99. package/dist/utility/wrun/wrun-failure-cause.d.ts +1 -1
  100. package/dist/utility/wrun/wrun-failure-cause.js +14 -0
  101. package/dist/utility/wrun/wrun-frames.js +6 -2
  102. package/dist/utility/wrun/wrun-host.service.d.ts +131 -59
  103. package/dist/utility/wrun/wrun-host.service.js +391 -194
  104. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +1 -1
  105. package/dist/utility/wrun/wrun-hosted-wire-caps.js +2 -0
  106. package/dist/utility/wrun/wrun-hover.util.d.ts +3 -0
  107. package/dist/utility/wrun/wrun-hover.util.js +25 -4
  108. package/dist/utility/wrun/wrun-input-requirements.leaf.js +7 -4
  109. package/dist/utility/wrun/wrun-kit-run-tables.util.d.ts +24 -0
  110. package/dist/utility/wrun/wrun-kit-run-tables.util.js +87 -0
  111. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +2 -1
  112. package/dist/utility/wrun/wrun-live-tick.util.d.ts +8 -2
  113. package/dist/utility/wrun/wrun-live-tick.util.js +35 -16
  114. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +40 -13
  115. package/dist/utility/wrun/wrun-opra-flow.leaf.js +39 -12
  116. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +70 -21
  117. package/dist/utility/wrun/wrun-option-contract-flow.util.js +257 -112
  118. package/dist/utility/wrun/wrun-option-prints.util.d.ts +62 -22
  119. package/dist/utility/wrun/wrun-option-prints.util.js +148 -46
  120. package/dist/utility/wrun/wrun-option-views.util.d.ts +262 -0
  121. package/dist/utility/wrun/wrun-option-views.util.js +356 -0
  122. package/dist/utility/wrun/wrun-options-chain.util.d.ts +23 -2
  123. package/dist/utility/wrun/wrun-options-chain.util.js +37 -3
  124. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -5
  125. package/dist/utility/wrun/wrun-overlay-drivers.util.js +32 -7
  126. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -3
  127. package/dist/utility/wrun/wrun-overlay-recovery.util.js +146 -18
  128. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +52 -8
  129. package/dist/utility/wrun/wrun-overlay-run.util.js +816 -243
  130. package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
  131. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +5 -0
  132. package/dist/utility/wrun/wrun-pin-spelling.util.js +28 -12
  133. package/dist/utility/wrun/wrun-pin-venues.util.js +4 -6
  134. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +1 -1
  135. package/dist/utility/wrun/wrun-prefix-cohort.util.js +1 -1
  136. package/dist/utility/wrun/wrun-present-bits.util.d.ts +9 -0
  137. package/dist/utility/wrun/wrun-present-bits.util.js +39 -0
  138. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +3 -2
  139. package/dist/utility/wrun/wrun-refusal-surface.util.js +5 -4
  140. package/dist/utility/wrun/wrun-refusal.util.d.ts +66 -6
  141. package/dist/utility/wrun/wrun-refusal.util.js +335 -40
  142. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  143. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +2 -2
  144. package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
  145. package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
  146. package/dist/utility/wrun/wrun-source-rows.util.js +11 -0
  147. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +28 -3
  148. package/dist/utility/wrun/wrun-tier-grid.util.js +79 -19
  149. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +14 -3
  150. package/dist/utility/wrun/wrun-transient-rerun.util.js +33 -8
  151. package/dist/workers/wrun/wrun-abi-host.d.ts +15 -2
  152. package/dist/workers/wrun/wrun-abi-host.js +31 -12
  153. package/dist/workers/wrun/wrun-engine-handler.d.ts +11 -28
  154. package/dist/workers/wrun/wrun-engine-handler.js +181 -12
  155. package/package.json +5 -5
  156. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +0 -12
  157. package/dist/utility/wrun/wrun-opra-underlying.util.js +0 -1
@@ -1,4 +1,4 @@
1
- import type { WrunRowLaneInstance } from './sources/wrun-row-lane.types.js';
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), a governed one only at
13
- * a real-time routed tier. `chartExchange` stands for a lane that reads no governed plane.
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 OPRA print
3
- * class): one coin-scoped channel per live instance, subscribed through the lane's own K control (its script source
4
- * names the control, `K_<SOURCE>`, which builds the channel with `formatCoinSubChannel`), beside the push lanes the
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
- * - A governed lane subscribes only when its read is routed REAL-TIME (the acquisition's `servedTier`, re-read by the
8
- * run before its first ask): a delayed read serves history only, the reconcile re-asks it past the embargo.
9
- * - The channel names the plane's exchange for a governed lane (`OPRA`) and the instance's coin (its acquisition's
10
- * `coin`, the chart's underlying); an instance naming no coin subscribes nothing.
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: '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), a governed one only at
25
- * a real-time routed tier. `chartExchange` stands for a lane that reads no governed plane.
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
- if (lane.governed !== undefined) {
36
- if (!isWrunOpraLaneAcquisition(acquisition) || wrunOpraLaneServedTier(acquisition) !== 'realtime')
37
- continue;
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
- // OPRA's prints of the chart's underlying (sources/row-lanes/option_prints): the package's ONE acquisition
162
- // (wrun_option_prints_one_acquisition), so one fetch.
163
- option_prints: { type: null, payload: [] },
164
- // OPRA's per-contract flow (sources/row-lanes/option_contract_flow): one read per chart market at the bars' tier;
165
- // only `0dte` narrows it (nearest expiries, the strike window and the volume floor fold on the chart).
166
- option_contract_flow: { type: null, payload: ['market', 'expiries'] },
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 OPRA flow scope rows (sources/lanes/options_flow): one fetch per scope, dte, moneyness and venue.
169
- options_flow: { type: null, payload: ['scope', 'dte', 'moneyness', 'venue'] },
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
- if (!result.ok)
801
- return invalidWrunFrame(slot, result.rejectReason);
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: compiles a package's wasm (sha256-verified against
3
- * the metadata pin when present), owns the sandbox worker, and runs packed
4
- * series requests through it. One shared worker serves every dev overlay;
5
- * requests are id-matched, and a request that outlives its timeout poisons
6
- * the worker (terminate + respawn) so a spinning guest cannot wedge later
7
- * runs.
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 (`WRUN_DAEMON_ONLY_SOURCES`, a Set of source names; a kit that
45
- * supplies per-source disclosure wording is a record read by the same key) are computed by the daemon,
46
- * which owns their dependencies: the first input declaring one refuses the browser run by name. The
47
- * chart's own candle classes (`ohlcv`, `time`) are served off the chart's rows and never need the kit,
48
- * so a plain package dispatches synchronously; any other declared class asks the kit (`warm` loads it
49
- * ahead of the first add). The table is one of the two the run path still reads from the kit: the
50
- * shared host entry does not export it. */
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 compiled modules the host keeps by wasm digest (compileModule). Every package version, draft Run
61
- * and REPL compile mints a digest, and a compiled module is mostly native memory the heap never shows. */
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
- /** Compiles by wasm digest, least recently used first (Map order: a hit moves its entry to the end). The cache
118
- * only dedupes compiles and owns no module: a mounted overlay keeps the module it was handed (its record), and
119
- * a live session keeps its instance in the worker (live ticks name the session, never a module), so an
120
- * eviction stops neither. */
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 and load the shared host (the compile's module
137
- * rewrite, the packer, the strategy resolver) and the authoring kit (the
138
- * run path's two kit tables, the daemon-only sources and the token
139
- * names) ahead of the first add (the Indicators tab opening is the
140
- * signal), so the first package a reader mounts pays neither the worker
141
- * spawn nor a module parse on its click. Idempotent; a load failure
142
- * surfaces on the first compile or run as before, never here. A held
143
- * respawn is not warmed around: the window exists to keep the worker
144
- * down. */
145
- warm(): void;
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
- /** Compile (and cache) a package module. The cache key is the sha256 of
151
- * the bytes, so identical bytes compile once whatever package name they
152
- * arrive under. When the metadata pins `wasm_sha256`, a mismatch refuses
153
- * before compilation; so does a memory the clamp refuses (a maximum or a
154
- * starting size over the worker's memory limit, shared or 64-bit memory),
155
- * and a memory declared with no maximum compiles with the limit as its
156
- * maximum (clampWrunModuleMemory).
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 compiled modules.
159
- * Every consumer of a digest in flight shares its one compile, and a
160
- * compile in flight is never evicted; eviction drops compiled entries
161
- * only, least recently used first, so the cache passes the capacity
162
- * only while more compiles than that are in flight. A failed compile is
163
- * not cached: its entry leaves before its consumers see the failure, and
164
- * the next request compiles again. */
165
- compileModule(wasmBytes: ArrayBuffer, metadata: WrunIndicatorMetadata): Promise<WebAssembly.Module>;
166
- /** Evict compiled entries, least recently used first, until the cache is back at its capacity (a compile
167
- * in flight stays: its consumers share it). */
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: WebAssembly.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: WebAssembly.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
- * timed-out request's, or the oldest in flight when the error event fired, the
241
- * worker answers in dispatch order), terminate the worker, remember the
242
- * death for the respawn window, and reject every pending request with the
243
- * poison error naming the live sessions lost with the worker. Nothing in
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
- * timed-out request keeps its own deadline sentence. The death's context
247
- * (cause, the culprit's package and session, the budget a timeout used up)
248
- * is recorded here once, frozen, and rides every rejection of this death,
249
- * the respawn hold's included, so a casualty can name who held the sandbox.
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