@orangecharts/wrun-chart-host 0.7.1 → 0.9.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 (210) hide show
  1. package/README.md +27 -4
  2. package/dist/constants/feature-flags.constants.d.ts +5 -0
  3. package/dist/constants/feature-flags.constants.js +32 -0
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +14 -0
  7. package/dist/constants/opra-compliance.constants.js +14 -0
  8. package/dist/constants/option-venues.constants.d.ts +29 -6
  9. package/dist/constants/option-venues.constants.js +19 -2
  10. package/dist/constants/venue-presets.constants.d.ts +17 -3
  11. package/dist/constants/venue-presets.constants.js +17 -3
  12. package/dist/host-env.d.ts +34 -4
  13. package/dist/host-env.js +21 -0
  14. package/dist/host-ports.types.d.ts +51 -3
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +17 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +40 -11
  18. package/dist/indicators/controls/tpo-session.util.js +138 -14
  19. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  20. package/dist/interfaces/opra-realtime.interface.js +10 -10
  21. package/dist/interfaces/option-instrument.interface.d.ts +6 -0
  22. package/dist/interfaces/wrun-runtime.interface.d.ts +34 -13
  23. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +57 -10
  24. package/dist/kscript-data/controls/live-trades-merge.util.js +85 -16
  25. package/dist/market-data/billing.interface.d.ts +138 -17
  26. package/dist/market-data/billing.interface.js +25 -8
  27. package/dist/market-data/venues/index.d.ts +3 -3
  28. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  29. package/dist/market-data/venues/opra.d.ts +3 -3
  30. package/dist/market-data/venues/opra.js +5 -4
  31. package/dist/replay/replayLadder.js +3 -1
  32. package/dist/settings-templates/footprint-rows.d.ts +25 -0
  33. package/dist/settings-templates/footprint-rows.js +127 -0
  34. package/dist/settings-templates/form-rows.d.ts +56 -0
  35. package/dist/settings-templates/form-rows.js +19 -0
  36. package/dist/settings-templates/frvp-fields.js +14 -0
  37. package/dist/settings-templates/index.d.ts +10 -1
  38. package/dist/settings-templates/index.js +11 -2
  39. package/dist/settings-templates/indicator-fields.js +78 -0
  40. package/dist/settings-templates/tool-rules.d.ts +35 -9
  41. package/dist/settings-templates/tool-rules.js +42 -8
  42. package/dist/settings-templates/tool-tables.generated.js +13 -2
  43. package/dist/utility/chart/candle-volume-unit.leaf.d.ts +16 -0
  44. package/dist/utility/chart/candle-volume-unit.leaf.js +61 -0
  45. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  46. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  47. package/dist/utility/chart/footprint-columns.util.d.ts +74 -0
  48. package/dist/utility/chart/footprint-columns.util.js +106 -0
  49. package/dist/utility/chart/footprint-display-mode.util.d.ts +40 -0
  50. package/dist/utility/chart/footprint-display-mode.util.js +62 -0
  51. package/dist/utility/chart/footprint-sierra-look.util.d.ts +2 -0
  52. package/dist/utility/chart/footprint-sierra-look.util.js +37 -0
  53. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  54. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  55. package/dist/utility/chart/index-mode.util.js +23 -13
  56. package/dist/utility/chart/kscript-venue-policy.util.d.ts +28 -21
  57. package/dist/utility/chart/kscript-venue-policy.util.js +34 -26
  58. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  59. package/dist/utility/chart/marketKind.util.js +17 -7
  60. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  61. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  62. package/dist/utility/chart/om-panel.util.d.ts +11 -0
  63. package/dist/utility/chart/om-panel.util.js +65 -6
  64. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  65. package/dist/utility/chart/profile-block-size.util.js +7 -0
  66. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  67. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  68. package/dist/utility/chart/window-geometry.leaf.d.ts +23 -1
  69. package/dist/utility/chart/window-geometry.leaf.js +78 -6
  70. package/dist/utility/chart/window-owner.leaf.d.ts +13 -0
  71. package/dist/utility/chart/window-owner.leaf.js +5 -0
  72. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -0
  73. package/dist/utility/chart/wrun-run-result.util.js +4 -1
  74. package/dist/utility/common/transformations.util.d.ts +7 -0
  75. package/dist/utility/common/transformations.util.js +11 -0
  76. package/dist/utility/options/cme-options-root.util.d.ts +25 -0
  77. package/dist/utility/options/cme-options-root.util.js +40 -0
  78. package/dist/utility/options/option-book.util.d.ts +27 -0
  79. package/dist/utility/options/option-book.util.js +76 -0
  80. package/dist/utility/options/option-trade-date.util.d.ts +50 -0
  81. package/dist/utility/options/option-trade-date.util.js +120 -0
  82. package/dist/utility/options/option-venue.util.d.ts +3 -3
  83. package/dist/utility/options/option-venue.util.js +3 -3
  84. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +1 -1
  85. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +2 -2
  86. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  87. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  88. package/dist/utility/wrun/sources/host-grid-landing.d.ts +4 -2
  89. package/dist/utility/wrun/sources/host-grid-landing.js +8 -0
  90. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +40 -4
  91. package/dist/utility/wrun/sources/lanes/options_flow.js +115 -18
  92. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +12 -9
  93. package/dist/utility/wrun/sources/opra-option-lanes.util.js +10 -7
  94. package/dist/utility/wrun/sources/row-lane-registry.js +10 -5
  95. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  96. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +3 -2
  97. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +30 -5
  98. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  99. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +13 -5
  100. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +25 -1
  101. package/dist/utility/wrun/sources/row-lanes/option_prints.js +161 -30
  102. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.d.ts +4 -0
  103. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +65 -0
  104. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -1
  105. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +83 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +17 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_surface.js +33 -2
  108. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +7 -1
  109. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +51 -5
  110. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +136 -3
  111. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +42 -0
  112. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +146 -0
  113. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +25 -5
  114. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +111 -20
  115. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +291 -48
  116. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  117. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  118. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  119. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  120. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  121. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  122. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  123. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +147 -9
  124. package/dist/utility/wrun/wrun-chart-market-facts.util.js +345 -11
  125. package/dist/utility/wrun/wrun-cloud-record.leaf.d.ts +27 -0
  126. package/dist/utility/wrun/wrun-cloud-record.leaf.js +71 -0
  127. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +4 -21
  128. package/dist/utility/wrun/wrun-cloud-record.util.js +5 -65
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  130. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  131. package/dist/utility/wrun/wrun-color-settings.util.d.ts +22 -9
  132. package/dist/utility/wrun/wrun-color-settings.util.js +57 -23
  133. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  134. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  135. package/dist/utility/wrun/wrun-download-meter.util.d.ts +92 -0
  136. package/dist/utility/wrun/wrun-download-meter.util.js +122 -0
  137. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +10 -3
  138. package/dist/utility/wrun/wrun-draft-overlay.util.js +63 -6
  139. package/dist/utility/wrun/wrun-frames.js +5 -5
  140. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  141. package/dist/utility/wrun/wrun-hosted-wire-caps.js +11 -0
  142. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +33 -17
  143. package/dist/utility/wrun/wrun-hud-looks.util.js +30 -16
  144. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +29 -3
  145. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +33 -3
  146. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  147. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  148. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  149. package/dist/utility/wrun/wrun-live-intake.util.d.ts +6 -2
  150. package/dist/utility/wrun/wrun-live-intake.util.js +136 -21
  151. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -1
  152. package/dist/utility/wrun/wrun-live-tick.util.js +130 -44
  153. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  154. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +224 -0
  156. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +342 -0
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +88 -0
  158. package/dist/utility/wrun/wrun-market-size-defaults.util.js +471 -0
  159. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +43 -8
  160. package/dist/utility/wrun/wrun-opra-flow.leaf.js +37 -6
  161. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +51 -10
  162. package/dist/utility/wrun/wrun-option-contract-flow.util.js +85 -33
  163. package/dist/utility/wrun/wrun-option-prints.util.d.ts +172 -3
  164. package/dist/utility/wrun/wrun-option-prints.util.js +394 -17
  165. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +99 -0
  166. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +218 -0
  167. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +365 -0
  168. package/dist/utility/wrun/wrun-option-strike-flow.util.js +797 -0
  169. package/dist/utility/wrun/wrun-option-views.util.d.ts +231 -7
  170. package/dist/utility/wrun/wrun-option-views.util.js +643 -23
  171. package/dist/utility/wrun/wrun-options-chain.util.d.ts +6 -4
  172. package/dist/utility/wrun/wrun-options-chain.util.js +8 -5
  173. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  174. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  175. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  176. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  177. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  178. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +9 -1
  179. package/dist/utility/wrun/wrun-overlay-recovery.util.js +32 -3
  180. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  181. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  182. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +34 -6
  183. package/dist/utility/wrun/wrun-overlay-run.util.js +527 -180
  184. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +15 -0
  185. package/dist/utility/wrun/wrun-pack-widths.leaf.js +22 -0
  186. package/dist/utility/wrun/wrun-pack.util.d.ts +13 -8
  187. package/dist/utility/wrun/wrun-pack.util.js +38 -21
  188. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +4 -0
  189. package/dist/utility/wrun/wrun-panel-mount.util.js +62 -22
  190. package/dist/utility/wrun/wrun-panel-style.util.d.ts +41 -14
  191. package/dist/utility/wrun/wrun-panel-style.util.js +86 -26
  192. package/dist/utility/wrun/wrun-param-map.util.d.ts +7 -6
  193. package/dist/utility/wrun/wrun-param-map.util.js +8 -5
  194. package/dist/utility/wrun/wrun-param-values.util.d.ts +10 -2
  195. package/dist/utility/wrun/wrun-param-values.util.js +2 -0
  196. package/dist/utility/wrun/wrun-pin-spelling.util.js +19 -10
  197. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  198. package/dist/utility/wrun/wrun-refusal.util.js +17 -2
  199. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +20 -0
  200. package/dist/utility/wrun/wrun-script-inputs.util.js +43 -0
  201. package/dist/utility/wrun/wrun-source-rows.util.d.ts +4 -0
  202. package/dist/utility/wrun/wrun-source-rows.util.js +92 -40
  203. package/dist/utility/wrun/wrun-tape-source.util.d.ts +133 -48
  204. package/dist/utility/wrun/wrun-tape-source.util.js +205 -62
  205. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  206. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  207. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  208. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  209. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  210. package/package.json +11 -11
@@ -111,7 +111,8 @@ import { wrunRowLaneByKey, wrunRowLaneOfClass } from './sources/row-lane-registr
111
111
  import { isWrunRowLaneId } from './sources/wrun-row-lane.types.js';
112
112
  import { fetchWrunRowLaneRows, planWrunRowLanes, wrunRowLaneChainAsk, wrunRowLaneFetchOptions, wrunRowLaneInstanceReadsOpra, wrunRowLaneRequired, wrunRunSourceReachFromMs, } from './sources/wrun-row-lanes.util.js';
113
113
  import { wrunOpraLanePayloadFields } from './wrun-opra-lane.util.js';
114
- import { wrunLaneRefusedCodeOf } from './wrun-lane-refusal.leaf.js';
114
+ import { WRUN_LANE_REFUSED_SETTLE_REASON, wrunLaneRefusedCodeOf } from './wrun-lane-refusal.leaf.js';
115
+ import { TRADES_HISTORY_MAX_CELLS } from '../../kscript-data/controls/live-trades-merge.util.js';
115
116
  import { warmWrunEarningsFacts, wrunEarningsFactsFor, wrunReadsEarningsFacts, } from './wrun-earnings-facts.util.js';
116
117
  import { liveBucketStartsInRange, liveBucketVenueOf } from '../chart/live-bucket.util.js';
117
118
  import { hostBucketResolverFor } from '../chart/host-bar-placement.util.js';
@@ -137,8 +138,10 @@ import { wrunOiLaneExtras } from './wrun-oi-lane.util.js';
137
138
  import { WRUN_LEG_STREAM_CLASSES, isWrunLegStreamClass, wrunLegStreamPayloadWords } from './wrun-leg-stream-classes.js';
138
139
  import { isWrunTradesLegLane, WRUN_TRADES_LANES, wrunTradesLegExtras, wrunTradesLegOf, } from './wrun-trades-lane.util.js';
139
140
  import { substituteWrunChartNames, wrunChartContextHostFill, wrunChartIntervalMsOf, } from './wrun-chart-context.util.js';
140
- import { warmWrunMarketFacts, wrunChartSizeUnit, wrunLaneDemandNeedsDirectory, wrunMarketFactsFor, wrunMarketFactsNeedDirectory, wrunReadsMarketFacts, wrunCoinLegsOf, wrunCoinLegVenues, wrunSheetWithCoinLegs, wrunSheetWithLaneCurrencies, wrunSheetWithLaneDemand, wrunSheetWithLaneGate, } from './wrun-chart-market-facts.util.js';
141
+ import { warmWrunMarketDollarFacts, warmWrunMarketFacts, wrunChartSizeUnit, wrunLaneDemandNeedsDirectory, wrunMarketDollarUnit, wrunMarketFactsFor, wrunMarketFactsNeedDirectory, wrunReadsDollarMultiplier, wrunReadsMarketFacts, wrunCoinLegsOf, wrunCoinLegVenues, wrunSheetWithCoinLegs, wrunSheetWithLaneCurrencies, wrunSheetWithLaneDemand, wrunSheetWithLaneGate, WRUN_DOLLAR_MULTIPLIER_FILL, WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE, } from './wrun-chart-market-facts.util.js';
141
142
  import { wrunFollowsCoin, wrunInputGateOn, wrunRowVisibleHere } from './wrun-market-facts.util.js';
143
+ import { wrunRowsKeepingMarketDefaults } from './wrun-market-size-defaults.leaf.js';
144
+ import { reconcileWrunMarketSizeDefaults } from './wrun-market-size-defaults.util.js';
142
145
  import { rememberWrunSessionChartNames, resolveWrunChartNames, wrunSessionChartNamesOf, } from './wrun-chart-context-names.util.js';
143
146
  import { assertWrunBrowserSources, getWrunBrowserHost, } from './wrun-host.service.js';
144
147
  import { applyWrunInertLegendState } from './wrun-inert-legend.util.js';
@@ -153,6 +156,7 @@ import { wrunTextParamsForRun, wrunTextParamValuesFromSettings } from './wrun-te
153
156
  import { wrunSheetWithSettings, wrunVisibilityOwnedOutputs } from './wrun-color-settings.util.js';
154
157
  import { wrunSheetDrawsOnlyStatsStrip, wrunStatsStripSettings } from './wrun-stats-strip.util.js';
155
158
  import { planWrunHeldLanes } from './wrun-held-lanes.util.js';
159
+ import { createWrunDownloadMeter, wrunDownloadAnswerSize, } from './wrun-download-meter.util.js';
156
160
  import { clearedColorCustomizationFlags } from '../chart/color-customization.leaf.js';
157
161
  import { WRUN_LATEST_HISTORY_LENGTH } from './wrun-latest-history.leaf.js';
158
162
  import { resolveChartPricePrecision } from '../chart/price-precision.util.js';
@@ -163,20 +167,21 @@ import { kScriptSettingsRevision } from '../chart/kscript-settings-revision.leaf
163
167
  import { getChartMountEpoch } from '../chart/chart-mount-epoch.util.js';
164
168
  import { checkIsIndexMode } from '../chart/index-mode.util.js';
165
169
  import { checkIsCryptoIndex } from '../chart/crypto-index.leaf.js';
170
+ import { checkIsQuotePerp } from '../chart/quote-perp.leaf.js';
166
171
  import { buildMixedModeContext, getFirstTokenMode } from '../chart/mixed-mode.util.js';
167
172
  import { inferPriceTickFromRows } from '../chart/footprint-band.util.js';
168
173
  import { getMarketKind } from '../chart/marketKind.util.js';
169
174
  import { isCmeGoverned } from '../chart/cme-realtime.util.js';
170
- import { wrunBarVenueOf } from '../chart/wrun-bar-session-facts.util.js';
175
+ import { wrunBarSessionFactsResolver, wrunBarVenueOf } from '../chart/wrun-bar-session-facts.util.js';
176
+ import { wrunPresentIsPartial } from './wrun-present-bits.util.js';
171
177
  import { assertWrunPinnedLegVenues, partitionWrunLegsByVenue, wrunLegFetchedRowReaders, wrunLegRidesNativeRows, wrunPinnedLegRefusalOf, wrunPinVenueVerdict, } from './wrun-pin-venues.util.js';
172
178
  import { annotateWrunErrorFailureRow, annotateWrunErrorIndicatorId, isWrunOverlayPausedError, isWrunQuarantinedError, isWrunWorkerPoisonError, WrunChartGoneError, WrunDeadlineError, WrunIntegrationError, WrunNoBarsError, WrunOverlayPausedError, WrunSourceDataUnavailableError, WrunVenueBlockedError, } from './wrun-registry-errors.util.js';
173
- import { createKScriptVenueBlockedError, isKScriptDisplayBlockedOnExchange, isOfficialWrunOverlay, isOpraUserScriptCandidate, isOpraUserScriptRun, payloadTouchesOpraVenue, } from '../chart/kscript-venue-policy.util.js';
174
- import { OPRA_UNDERLYING_EXCHANGES } from '../../constants/option-venues.constants.js';
179
+ import { createKScriptVenueBlockedError, isKScriptDisplayBlockedOnExchange, isOfficialWrunOverlay, isOpraUserScriptRun, } from '../chart/kscript-venue-policy.util.js';
175
180
  import { governedMarketDataTier, governedOptionSummaryTier } from '../v2/governed-tier.leaf.js';
176
181
  import { awaitWrunChildOverlays, mountWrunChildOverlays, prepareWrunHeatmapWindowLanding, WrunStaleLandingError, } from './wrun-panel-mount.util.js';
177
182
  import { planWrunFormingPreRoll, planWrunIntrabarLegFetch, planWrunLegFetch, wrunClampedLegDiagnostics, wrunIntrabarServedNotes, wrunLegFetchReads, } from './wrun-leg-fetch.util.js';
178
183
  import { barEndMs, isCalendarIntervalLabel, isCalendarIntervalMs } from '../chart/calendar-interval.util.js';
179
- import { resolveWrunTapeAcquisition, WRUN_TAPE_INTERVAL_UNSUPPORTED_CODE, wrunTapeFloorSettings, } from './wrun-tape-source.util.js';
184
+ import { resolveWrunTapeAcquisition, WRUN_TAPE_INTERVAL_UNSUPPORTED_CODE, WRUN_TAPE_TOO_MANY_TRADES_CODE, WRUN_TAPE_VALUE_UNPROVEN_CODE, wrunTapeAcquisitionFloor, wrunTapeFloorOf, wrunTapeFloorSettingWords, wrunTapeFloorSettings, wrunTapeFloorWords, wrunTapeLaneExtras, } from './wrun-tape-source.util.js';
180
185
  import { wrunChartSession, wrunLegCandleClose, wrunPrimaryRowBounds } from './wrun-leg-close.util.js';
181
186
  import { isWrunRowSourceTransientError, wrunRowBatchDeliveredSheet, wrunRowSourceSettingsLeftBy, } from './wrun-row-source.js';
182
187
  import { wrunOverlayOpraStamped } from './wrun-cloud-opra-stamp.util.js';
@@ -185,7 +190,7 @@ import { __resetWrunSocketSessionLossesForTests, noteWrunSocketSessionLoss, wrun
185
190
  import { isWrunRunMountOnChart, raiseWrunSandboxLoading, wrunRowBatchCellRows, } from './wrun-sandbox-row-source.js';
186
191
  import { advanceWrunInputCarry, buildWrunInitArgs, buildWrunInputRows, emptyWrunInputCarry, planWrunPinnedWires, wrunChartIntervalKeyOf, wrunDeclaredSourceLanes, wrunDemandedSourceClass, wrunFormingBucketStart, WrunWirePiecesIncomplete, wrunAskWirePieces, wrunPinnedLegFetchSuffix, wrunSourceLane, wrunPinnedLegTierMs, wrunSourceVerdictWhole, wrunTradeLegIntervals, wrunWireRowPieces, wrunChartCandleRows, wrunChartCandleRowsAfterHead, wrunChartRowsOffIntervalGrid, wrunChartCandleRowsWithin, } from './wrun-source-rows.util.js';
187
192
  import { ringWrunRunRetained, wrunChartWalkedRows, wrunRetainedCanvasSources, wrunRunBlockRowsCap, wrunRunRetainedHeadFits, wrunRunRetainedRowsCap, wrunRunRetainedWindowOf, } from './wrun-run-retained.util.js';
188
- import { isWrunOptionsChainCryptoVenueWord, WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE, WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, WRUN_OPTIONS_CHAIN_VENUE_CODE, wrunOptionsChainExpiries, wrunOptionsChainIdentityKey, wrunOptionsChainLaneExtras, wrunOptionsChainLaneScope, wrunOptionsChainOneVenueRefusal, } from './wrun-options-chain.util.js';
193
+ import { isWrunOptionsChainCryptoVenueWord, WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE, WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, WRUN_OPTIONS_CHAIN_VENUE_CODE, wrunOptionsChainExpiries, wrunOptionsChainIdentityKey, wrunOptionsChainLaneExtras, wrunOptionsChainOneVenueRefusal, } from './wrun-options-chain.util.js';
189
194
  import { adoptWrunLiveIntakeGeneration, markWrunLiveGap, noteWrunLiveIntakeEvent, wrunPushEligible, } from './wrun-live-intake.util.js';
190
195
  import { openWrunPollLaneLiveChannels } from './wrun-series-stream.util.js';
191
196
  import { serverNowMs } from '../auth/server-clock.util.js';
@@ -205,6 +210,19 @@ import { buildWrunOverlayRunResult, withCanvasHostFill, } from './wrun-overlay-r
205
210
  import { applyWrunIntegrationBudgetPolicy, wrunIntegratedRowsView } from './wrun-integration-budget.util.js';
206
211
  // The result build lives in wrun-overlay-result.util (the result reader core); its importers keep this path.
207
212
  export { buildWrunOverlayRunResult };
213
+ /**
214
+ * The chart market's units a result build reads, together: its size unit (`wrunChartSizeUnit`: an output whose
215
+ * `visible_by` leaves it out mounts nothing) and its dollar unit when proven (`wrunMarketDollarUnit`: the CME registry's
216
+ * point value of the contract, NQ 20; 1 on crypto and US stocks), which the batched marks' `units` caption and hover
217
+ * divide a record's dollar value by. Synchronous over the facts the run head warmed. Every build spreads it (the full
218
+ * run, the row-source run, the reseed, the refine, the prefix landing and the live tick), so a tail or a reseed never
219
+ * hands the children a size unit without the dollar unit: a tail without it would re-register the hover in dollars.
220
+ * tests/utility/wrun/wrun-big-trades-size-shown-as.spec.ts fails on a build that names a size unit by hand.
221
+ */
222
+ export function wrunResultMarketUnits(market) {
223
+ const dollars = wrunMarketDollarUnit(market);
224
+ return { sizeUnit: wrunChartSizeUnit(market), ...(dollars.kind === 'dollars' ? { valuePerUnit: dollars.unit } : {}) };
225
+ }
208
226
  // The integration budget's pure policy lives in wrun-integration-budget.util; its view keeps this path too.
209
227
  export { wrunIntegratedRowsView };
210
228
  /** The number of closed bars whose evaluated OHLCV the context retains for
@@ -361,6 +379,14 @@ export async function runWrunOverlayOnChart(target) {
361
379
  // reports it as not applied.
362
380
  const computed = { generation: 0, stage: 'head' };
363
381
  let integrated = false;
382
+ // The run's download (its meter, once its window made one) goes to the add's open attempt once, when the run ends.
383
+ let downloadNoted = false;
384
+ const noteDownload = () => {
385
+ if (downloadNoted || !attempt || computed.download === undefined)
386
+ return;
387
+ downloadNoted = true;
388
+ wrunChartHostEnv().diagnostics.noteAttemptDownload(attempt, computed.download.summary());
389
+ };
364
390
  // The run is still the overlay's own: the chart and the overlay it computed for stand, and the
365
391
  // attempt it resolved is still the live one (a teardown, a restore or a later request retires it).
366
392
  const isCurrent = () => mount.tc !== undefined &&
@@ -428,30 +454,20 @@ export async function runWrunOverlayOnChart(target) {
428
454
  chartMetadata,
429
455
  });
430
456
  const provenance = meta.settings;
431
- // A run the `opra-user-scripts` flag may open the OPRA plane to (a browser run the viewer wrote or
432
- // added) waits, bounded, for the flag map before either OPRA wall reads it, where one can: on an OPRA
433
- // chart (the display wall), or a chain read on a US stock or ETF chart (the chain wall). A restore can
434
- // run before the map hydrates, and an unhydrated map reads closed with no retry for this run; any other
435
- // market never waits on the map. A run reading options that list on OPRA waits the same way for the
436
- // `opra` flag the plane and its stop reasons are judged by (FE-REASON-CHIPS review): unhydrated, the
437
- // map would read the plane closed and the lanes "not on your account".
457
+ // A run reading options that list on OPRA waits, bounded, for the `opra` flag the plane and its stop
458
+ // reasons are judged by (FE-REASON-CHIPS review): a restore can run before the map hydrates, and
459
+ // unhydrated, the map would read the plane closed and the lanes "not on your account". No run waits for
460
+ // the `opra-user-scripts` flag: no OPRA wall honours it any more (the compliance round, plan row D3), so
461
+ // a user run on an OPRA chart is refused at once, whatever the map says.
438
462
  const readsOpraOptions = target.metadata.inputs.some((input) => target.metadata.inputSources[input.name]?.source === 'options_chain') ||
439
463
  wrunSheetReadsOpraLane(target.metadata);
440
- const opraWallAhead = payloadTouchesOpraVenue(chartExchange) ||
441
- (typeof chartExchange === 'string' && OPRA_UNDERLYING_EXCHANGES.includes(chartExchange) && readsOpraOptions);
442
- if (readsOpraOptions || opraWallAhead) {
464
+ if (readsOpraOptions) {
443
465
  const opraGate = await wrunChartHostEnv().market.loadOptionsGate();
444
- const waitsOpra = readsOpraOptions &&
445
- opraGate.opraFlagDecidesChartOptions({
446
- exchange: typeof chartExchange === 'string' ? chartExchange : undefined,
447
- });
448
- const waitsUserScripts = opraWallAhead && isOpraUserScriptCandidate(provenance);
449
- if (waitsOpra || waitsUserScripts) {
450
- await Promise.all([
451
- waitsOpra ? opraGate.awaitOpraFlagHydration() : undefined,
452
- waitsUserScripts ? opraGate.awaitOpraUserScriptsFlagHydration() : undefined,
453
- ]);
454
- }
466
+ const waitsOpra = opraGate.opraFlagDecidesChartOptions({
467
+ exchange: typeof chartExchange === 'string' ? chartExchange : undefined,
468
+ });
469
+ if (waitsOpra)
470
+ await opraGate.awaitOpraFlagHydration();
455
471
  }
456
472
  if (isKScriptDisplayBlockedOnExchange(chartExchange, provenance)) {
457
473
  throw new WrunVenueBlockedError(createKScriptVenueBlockedError(String(chartExchange)).message);
@@ -478,6 +494,25 @@ export async function runWrunOverlayOnChart(target) {
478
494
  const hostLoading = ensureWrunChartHostSharedHost();
479
495
  if (hostLoading)
480
496
  await hostLoading;
497
+ // A size threshold the package scales with the market (Big Trades' Min size and Whale size,
498
+ // wrun-market-size-defaults.leaf) moves to this market's default before anything reads the settings: once per
499
+ // mount and market, a value the user changed kept, the engine copy and the workspace row one record. Its tape
500
+ // then asks a floor the market's volume sized (10 ETH kept 487,132 prints over seven days, past the worker's
501
+ // cap), and the panel's reset goes to the same default. It reads its facts for the market this run computes for
502
+ // (C4's identity and reader), proven after each of its awaits. Full runs only: a pan page computes beside the rows
503
+ // and the live session the full run drew at its floor, and a move here would draw the page at another one (no
504
+ // save follows `updateSettings`, so nothing would rerun the rest).
505
+ if (prefixWindow === undefined) {
506
+ await reconcileWrunMarketSizeDefaults({
507
+ chartIndex: target.chartIndex,
508
+ indicatorId: target.indicatorId,
509
+ tc,
510
+ meta,
511
+ sheet: target.metadata,
512
+ market,
513
+ isCurrent,
514
+ });
515
+ }
481
516
  // The coin legs (kit 0.77.0, `follow: "coin"`) this run reads, resolved on the chart's coin by
482
517
  // the native venue resolver before anything reads the sheet, so each is a literal pin or an
483
518
  // undemanded input past this point; a switch re-runs the overlay through here, so the legs
@@ -499,7 +534,7 @@ export async function runWrunOverlayOnChart(target) {
499
534
  chartIndex: target.chartIndex,
500
535
  mountEpoch,
501
536
  tc,
502
- });
537
+ }, computed);
503
538
  }
504
539
  finally {
505
540
  hold.lower();
@@ -525,7 +560,13 @@ export async function runWrunOverlayOnChart(target) {
525
560
  // surfaceWrunRunFailureOnLegend): only a success clears it.
526
561
  void clearWrunRuntimeTrapDiagnostic(target.chartIndex, target.indicatorId);
527
562
  }
528
- wrunChartHostEnv().diagnostics.settleAttempt(attempt, { ok: true });
563
+ // The run's download joins the add's before the settle reads it (a first slice's older asks are still out).
564
+ noteDownload();
565
+ // A first-slice picture settles the attempt too (the time to the first result), and says it was one.
566
+ wrunChartHostEnv().diagnostics.settleAttempt(attempt, {
567
+ ok: true,
568
+ ...(computed.firstSlice === true ? { firstSlice: true } : {}),
569
+ });
529
570
  }
530
571
  catch (rejection) {
531
572
  // What the run computed for, judged now (C4): a run its overlay's own newer intent superseded (a
@@ -574,6 +615,8 @@ export async function runWrunOverlayOnChart(target) {
574
615
  // cell cap's too-big) settles `refused` with its class, as the lane row reads it. A dropped run
575
616
  // settles nothing (C4): the attempt stays live for the run that replaces it, and a mount that
576
617
  // leaves settles it `cancelled` (the removal's abandon, the loader's first-run settle).
618
+ // A dropped run's download counts toward the add too: the run that replaces it settles the attempt.
619
+ noteDownload();
577
620
  if (!(error instanceof WrunChartGoneError))
578
621
  wrunChartHostEnv().diagnostics.settleAttempt(attempt, { ok: false, error });
579
622
  if (sourceHold) {
@@ -702,8 +745,14 @@ function wrunRunSettleOf(error) {
702
745
  return { outcome: 'held', reason: error.hold };
703
746
  if (error instanceof WrunVenueBlockedError)
704
747
  return { outcome: 'held', reason: 'venue-blocked' };
705
- if (isWrunSourceHold(error))
706
- return { outcome: 'held', reason: 'source-hold' };
748
+ // A hold on a lane refused by name says so: the store's settings reconcile reads "Not applied" at once (the
749
+ // same settings ask the same read), where a hold on a slow or failed lane gets its reruns.
750
+ if (isWrunSourceHold(error)) {
751
+ return {
752
+ outcome: 'held',
753
+ reason: wrunRefusedSourceHolds.has(error) ? WRUN_LANE_REFUSED_SETTLE_REASON : 'source-hold',
754
+ };
755
+ }
707
756
  return { outcome: 'failed', reason: error instanceof Error ? error.message : String(error) };
708
757
  }
709
758
  /** Whether a failed run's rejection carries a refusal record: every one but the quiet rejections
@@ -878,6 +927,9 @@ catch {
878
927
  /** The source holds this pass threw (a degraded lane an input reads under a
879
928
  * carry or zero policy): retryable, with no toast and no chip of their own. */
880
929
  const wrunSourceHolds = new WeakSet();
930
+ /** The source holds on a lane the data plane refused by name (wrun-lane-refusal.leaf): the same settings meet
931
+ * the same refusal, so they settle as `WRUN_LANE_REFUSED_SETTLE_REASON` (wrunRunSettleOf). */
932
+ const wrunRefusedSourceHolds = new WeakSet();
881
933
  function isWrunSourceHold(error) {
882
934
  return typeof error === 'object' && error !== null && wrunSourceHolds.has(error);
883
935
  }
@@ -1346,6 +1398,39 @@ function wrunSourceGivenUpOf(outcome) {
1346
1398
  }
1347
1399
  return outcome.cause === 'budget' ? WRUN_SOURCE_GIVEN_UP.budget : WRUN_SOURCE_GIVEN_UP.failed;
1348
1400
  }
1401
+ /**
1402
+ * The record each refusal BY NAME a row-builder lane's worker twin may answer (wrun-lane-refusal.leaf), by lane and
1403
+ * code, built from the run's facts: the row-builder lanes' counterpart of a poll lane's `refusedAnswers`. A code
1404
+ * without a record reads as the lane's source declining the market (`source-declined`, Remove), so a lane whose worker
1405
+ * refuses by name names its record here.
1406
+ */
1407
+ const WRUN_BUILTIN_LANE_REFUSED_ANSWERS = {
1408
+ // The tape's history held more prints at its floor than the trades worker reads (k-trades.worker, the large lane):
1409
+ // too much data, with the cap, the floor and the history's days (seven for Big Trades), and the way out raises the
1410
+ // floor in the settings. Never Remove: the market serves the tape, the floor was too low for it.
1411
+ tape: {
1412
+ [WRUN_TAPE_TOO_MANY_TRADES_CODE]: ({ metadata, tape }) => ({
1413
+ cls: 'too-big',
1414
+ variant: 'tape',
1415
+ params: {
1416
+ max: TRADES_HISTORY_MAX_CELLS,
1417
+ setting: wrunTapeFloorSettingWords(metadata),
1418
+ // The floor in its own unit: the raw number under `min_size` (as it always was), a dollar amount under
1419
+ // `min_value` ($500,000).
1420
+ min: tape?.minValue === undefined ? (tape?.minSize ?? 0) : wrunTapeFloorWords(tape),
1421
+ n: tape === undefined ? 0 : Math.round((tape.historySeconds / 86_400) * 10) / 10,
1422
+ },
1423
+ out: { kind: 'open-settings' },
1424
+ }),
1425
+ },
1426
+ };
1427
+ /** The seed a row-builder lane declares for a refusal by name, or undefined (a poll lane, an undeclared code). */
1428
+ function wrunBuiltinLaneRefusedSeed(lane, code, facts) {
1429
+ if (!Object.hasOwn(WRUN_BUILTIN_LANE_REFUSED_ANSWERS, lane))
1430
+ return undefined;
1431
+ const answers = WRUN_BUILTIN_LANE_REFUSED_ANSWERS[lane];
1432
+ return answers !== undefined && Object.hasOwn(answers, code) ? answers[code](facts) : undefined;
1433
+ }
1349
1434
  /**
1350
1435
  * The record a degraded lane shows once the source ladder gives up on it: the code of what it was
1351
1436
  * (`wrunSourceGivenUpOf`: `wrun_source_budget`, `wrun_source_failed`, `wrun_source_declined`) in the
@@ -1353,7 +1438,9 @@ function wrunSourceGivenUpOf(outcome) {
1353
1438
  * and the matching cause stamped (`telemetry.cause`: `source-budget`, `source-failed`,
1354
1439
  * `source-declined`), so the record and `wrun_failure_shown` tell a slow source from a broken or an
1355
1440
  * absent one; a note when the run drew around the lane, paused when it held on it; its details
1356
- * today's words for the lane (the hold's sentence).
1441
+ * today's words for the lane (the hold's sentence). An answer the data plane refused by name reads in
1442
+ * the record its lane declares for the code (a poll lane's `refusedAnswers`, a row-builder lane's
1443
+ * WRUN_BUILTIN_LANE_REFUSED_ANSWERS).
1357
1444
  */
1358
1445
  function wrunTerminalDegradeRefusalFor(args) {
1359
1446
  const instance = args.pollLanes.find((candidate) => candidate.key === args.lane);
@@ -1369,7 +1456,9 @@ function wrunTerminalDegradeRefusalFor(args) {
1369
1456
  }
1370
1457
  // An answer the data plane refused by name reads in the record its lane declares for that refusal.
1371
1458
  const refused = wrunLaneRefusedCodeOf(args.outcome.error);
1372
- const declared = refused === undefined ? undefined : pollLane?.refusedAnswers?.[refused];
1459
+ const declared = refused === undefined
1460
+ ? undefined
1461
+ : (pollLane?.refusedAnswers?.[refused] ?? wrunBuiltinLaneRefusedSeed(args.lane, refused, args.facts));
1373
1462
  if (declared !== undefined) {
1374
1463
  return wrunSeededRefusal({ ...declared, params: { feed, ...declared.params }, severity }, wrunLaneDegradeMessage(args.title, wrunLaneSourceOf(args.lane, args.pollLanes), args.outcome), args.ctx);
1375
1464
  }
@@ -1722,6 +1811,32 @@ export function wrunSessionRespelledSheet(context, sheet, settings) {
1722
1811
  const pins = wrunSessionRespelledPins.get(context);
1723
1812
  return pins === undefined ? undefined : wrunSheetWithRespelledPins(wrunSheetWithSettings(sheet, settings), pins);
1724
1813
  }
1814
+ /**
1815
+ * The run head's refusal of a sheet that reads the market's dollar multiplier (kit 0.95.0) on a market whose dollar
1816
+ * unit is not proven (wrunMarketDollarUnit), by name and before any fetch: a unit no read can ever prove (no point
1817
+ * value for its contracts, a quote that is no dollar) reads as the dollar tape's own refusal does (`feed-missing`,
1818
+ * the market has no tape to value), and one a later read can still prove as a source that did not answer
1819
+ * (`service-no-answer`, Retry; the reads retry on their own windows), so the module never runs over a 0 it would
1820
+ * keep for the session.
1821
+ */
1822
+ function wrunDollarMultiplierRefusal(metadata, chartMetadata, unit, tape) {
1823
+ const exchange = typeof chartMetadata?.exchange === 'string' ? chartMetadata.exchange : '';
1824
+ const symbol = typeof chartMetadata?.symbol === 'string' ? chartMetadata.symbol : '';
1825
+ const param = metadata.params.find((candidate) => candidate.host_fill === WRUN_DOLLAR_MULTIPLIER_FILL)?.name;
1826
+ const why = unit.transient
1827
+ ? unit.reason === 'point-value'
1828
+ ? "the instrument registry's point value for it has not been read yet"
1829
+ : 'its quote has not been read yet'
1830
+ : unit.reason === 'point-value'
1831
+ ? 'no point value is known for its contracts'
1832
+ : 'it is not quoted in US dollars or a dollar stablecoin';
1833
+ // The tape's own feed where the run asks one (Big Trades), else the trades the fact values.
1834
+ const params = { feed: tape !== undefined ? 'tape' : 'trades' };
1835
+ return attachWrunRefusal(new Error(`WRUN ${metadata.id}: ${WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE}: param '${param ?? 'market_dollar_multiplier'}' ` +
1836
+ `reads market.dollar_multiplier() on ${exchange}:${symbol}, and ${why}, so no trade can be valued`), unit.transient
1837
+ ? { cls: 'service-no-answer', variant: 'lane', params, severity: 'paused' }
1838
+ : { cls: 'feed-missing', variant: 'market-paused', params, severity: 'paused' });
1839
+ }
1725
1840
  /**
1726
1841
  * The browser lane's lanes for one window, the sandbox row source's `prepare` (contract C7,
1727
1842
  * wrun-sandbox-row-source.ts): everything the run reads before the engine worker. The first run's
@@ -1831,6 +1946,9 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
1831
1946
  if (chartRows.length === 0) {
1832
1947
  throw new WrunChartGoneError(`wrun overlay '${target.indicatorId}': its run window holds no chart rows (superseded)`);
1833
1948
  }
1949
+ // What the run downloads, from its first ask on, against the budget of its window's bars.
1950
+ const download = createWrunDownloadMeter(chartRows.length);
1951
+ computed.download = download;
1834
1952
  // The replay's completed chart bars (the head rows join the compute rows below).
1835
1953
  const replayChartRows = chartRows;
1836
1954
  // A clamped window short of the chart's newest bar is a page panned back
@@ -1862,6 +1980,43 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
1862
1980
  if (tape !== undefined) {
1863
1981
  await assertWrunTapeServedOnInterval(target.metadata, tape.inputNames[0], typeof chartMetadata?.interval === 'string' ? chartMetadata.interval : '');
1864
1982
  }
1983
+ // A dollar tape (C-DOLLAR) prices its live prints in its history's unit: the dollar unit of the market's own facts
1984
+ // (wrunMarketDollarUnit: a CME contract's registry point value, else the point value on a market quoted in dollars).
1985
+ // Its reads are the directory row's quote and the instrument registry's units, each waited on once
1986
+ // (warmWrunMarketDollarFacts never rejects). A unit no read can ever prove (a quote that is no dollar, a venue or a
1987
+ // contract with no point value) refuses the tape by name before any fetch, the daemon's `wrun_tape_value_unproven`:
1988
+ // none of its live prints could fold, so it never draws silently stopped. A unit a later read can still prove is
1989
+ // never frozen into the acquisition: the payload carries no `valuePerUnit`, and the live intake resolves it again on
1990
+ // its prints (wrun-live-intake.util `wrunTapeLiveFloorOf`).
1991
+ let tapeValuePerUnit;
1992
+ if (tape?.minValue !== undefined) {
1993
+ await warmWrunMarketDollarFacts(chartMetadata);
1994
+ const unit = wrunMarketDollarUnit(chartMetadata);
1995
+ tapeValuePerUnit = unit.kind === 'dollars' ? unit.unit : undefined;
1996
+ if (unit.kind === 'unproven' && !unit.transient) {
1997
+ const exchange = typeof chartMetadata?.exchange === 'string' ? chartMetadata.exchange : '';
1998
+ const symbol = typeof chartMetadata?.symbol === 'string' ? chartMetadata.symbol : '';
1999
+ const why = unit.reason === 'point-value'
2000
+ ? 'no point value is known for its contracts'
2001
+ : 'it is not quoted in US dollars or a dollar stablecoin';
2002
+ // The host's words lead with the code (`<code>: <sentence>`), as every host refusal reads.
2003
+ throw attachWrunRefusal(new Error(`WRUN ${target.metadata.id}: ${WRUN_TAPE_VALUE_UNPROVEN_CODE}: input '${tape.inputNames[0]}' (tape) floors ` +
2004
+ `${exchange}:${symbol} by dollar value (min_value), and ${why}, so no print can be valued`), { cls: 'feed-missing', variant: 'market-paused', params: { feed: 'tape' }, severity: 'paused' });
2005
+ }
2006
+ }
2007
+ // A package that reads the market's dollar multiplier (kit 0.95.0, `market.dollar_multiplier()`: Big Trades 0.8.0
2008
+ // values a CME contracts tape's fills with it) reads the same unit the dollar tape prices its live prints with and
2009
+ // the batched captions read (wrunMarketDollarUnit, wrunResultMarketUnits): one number for the module, the caption
2010
+ // and the hover. The module takes it once, at init(), so the run never computes over a unit it could not prove (0
2011
+ // values no trade): its reads are waited on here, a unit no read can ever prove refuses by name before any fetch,
2012
+ // and one a later read can still prove (a failed registry read, a continuous chart's lead not known yet) refuses as
2013
+ // a source that did not answer (retried, `service-no-answer`), never frozen into the session this run installs.
2014
+ if (wrunReadsDollarMultiplier(target.metadata)) {
2015
+ await warmWrunMarketDollarFacts(chartMetadata);
2016
+ const unit = wrunMarketDollarUnit(chartMetadata);
2017
+ if (unit.kind === 'unproven')
2018
+ throw wrunDollarMultiplierRefusal(target.metadata, chartMetadata, unit, tape);
2019
+ }
1865
2020
  // The market the run computes for: the integrate drops a result the chart moved off meanwhile.
1866
2021
  const marketIdentity = wrunChartMarketIdentity(chartMetadata);
1867
2022
  // A package that declares a fact the directory row answers (`market.kind()`,
@@ -1948,7 +2103,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
1948
2103
  // before the chart's first bar ride the K_OHLCV lane the kScript engine fetches them on (a run at
1949
2104
  // another interval warms up on its run bars, the live rule).
1950
2105
  const replayHeadRows = replay && !run && replay.fromMs < chartRows[0][0]
1951
- ? await fetchWrunReplayHeadRows(target, view, replay.fromMs, chartRows[0][0])
2106
+ ? await fetchWrunReplayHeadRows(target, view, replay.fromMs, chartRows[0][0], download)
1952
2107
  : [];
1953
2108
  // Joined ahead of the chart's bars with their missing bars kept (a spread drops them).
1954
2109
  chartRows = wrunChartCandleRowsAfterHead(replayHeadRows, chartRows);
@@ -2047,9 +2202,10 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2047
2202
  // The run clock: the run interval when there is one (the venue facts, the host fill, the leg
2048
2203
  // plan, the poll plans and the push eligibility read it), else the chart's. A replay run's
2049
2204
  // `now` is the end its lanes are fetched through: every row's as-of read stays at its own close.
2205
+ // The now is the server's: the lanes plan their windows over the gateway's bars.
2050
2206
  const clock = {
2051
2207
  intervalMs: run ? run.intervalMs : chartIntervalMs,
2052
- nowMs: replay ? Math.min(Date.now(), Math.max(replay.toMs, chartLastTs + chartIntervalMs)) : Date.now(),
2208
+ nowMs: replay ? Math.min(serverNowMs(), Math.max(replay.toMs, chartLastTs + chartIntervalMs)) : serverNowMs(),
2053
2209
  };
2054
2210
  const { legs: plannedLegs, wires: plannedWires } = planWrunPinnedWires(target.metadata, clock.intervalMs);
2055
2211
  // The chart's head store for this run's first bar (wrun-warmup-head-store.util): one per chart, so every overlay
@@ -2090,6 +2246,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2090
2246
  intervalMs: chartIntervalMs,
2091
2247
  held: heldHeadsUsable ? heldContext.warmupHead : undefined,
2092
2248
  store: headStore,
2249
+ meter: download,
2093
2250
  }
2094
2251
  : undefined;
2095
2252
  // A chart whose candles are not asked as a plain time window (index mode, a mixed transformation) answers its exact
@@ -2117,6 +2274,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2117
2274
  beforeTs: chartFirstTs,
2118
2275
  held: heldHeadsUsable ? heldContext.laneWarmupHead : undefined,
2119
2276
  store: headStore,
2277
+ meter: download,
2120
2278
  }
2121
2279
  : undefined;
2122
2280
  const laneHeadTake = laneHeadArgs !== undefined
@@ -2176,6 +2334,10 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2176
2334
  // The OPRA-plane predicate an OPRA lane is admitted by (loaded only when the sheet reads one).
2177
2335
  const opraPlaneFacts = wrunOpraPlaneFacts(target.metadata);
2178
2336
  const opraFacts = { official: head.official, opraUserScripts: head.opraUserScripts };
2337
+ // The overlay's current setting values, read once for both planners: an option knob naming a setting
2338
+ // (`min_premium: "@floor"`) asks with the setting's value, and a settings change re-plans with the new one
2339
+ // (wrun-poll-lanes.util `resolveWrunOptionSettingKnobs`, before a poll lane's plan and a row lane's facets).
2340
+ const laneParamValues = wrunParamValuesFromSettings(target.metadata, view.settings);
2179
2341
  // The chart's category rides along: a chain poll lane resolves the chart's chain with it, as the row lanes do.
2180
2342
  const planPollLanes = (readsChain) => {
2181
2343
  const sheet = wrunSheetForLaneGroup(target.metadata, (sourceClass) => wrunPollLanesOfClass(sourceClass).length > 0, (sourceClass) => wrunPollClassReadsChain(sourceClass) === readsChain);
@@ -2187,7 +2349,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2187
2349
  symbol: pickText(chartMetadata?.symbol),
2188
2350
  category: chartMetadata?.category,
2189
2351
  intervalMs: clock.intervalMs,
2190
- }, checkIsIndexMode, isWrunCryptoVenueExchange, { ...opraFacts, ...(opraPlane !== undefined ? opraPlane : {}) }));
2352
+ }, checkIsIndexMode, isWrunCryptoVenueExchange, { ...opraFacts, ...(opraPlane !== undefined ? opraPlane : {}), paramValues: laneParamValues }));
2191
2353
  };
2192
2354
  // The row lanes' plan (sources/row-lane-registry.ts: one celled descriptor per class), before any of its fetches,
2193
2355
  // beside the poll lanes': the OPRA wall, the chart's admission (a governed OPRA lane where the chart's
@@ -2195,6 +2357,8 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2195
2357
  // index-mode charts), the lane's identity and each input's facets, grouped into instances; an input of a
2196
2358
  // lane the chart never serves that declared `missing: "empty"` is dropped and named in `missingFeeds`.
2197
2359
  // The chart's category rides along: a chain lane resolves the chart's chain with it, as the options chain lane does.
2360
+ // The setting values ride as they do for the poll lanes: a row lane's knob naming a setting (`strike_rows`,
2361
+ // `min_premium`, a print filter) asks with its value instead of being refused by name.
2198
2362
  const chartCategory = chartMetadata?.category;
2199
2363
  const planRowLanes = (readsChain) => {
2200
2364
  const sheet = wrunSheetForLaneGroup(target.metadata, (sourceClass) => wrunRowLaneOfClass(sourceClass) !== undefined, (sourceClass) => wrunRowClassReadsChain(sourceClass) === readsChain);
@@ -2210,7 +2374,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2210
2374
  isCryptoVenueExchange: isWrunCryptoVenueExchange,
2211
2375
  isOpraPlaneExchange: opraPlane?.isOpraPlaneExchange,
2212
2376
  opraPlaneStop: opraPlane?.opraPlaneStop,
2213
- }, opraFacts));
2377
+ }, { ...opraFacts, paramValues: laneParamValues }));
2214
2378
  };
2215
2379
  const pollPlannedLocal = planPollLanes(false);
2216
2380
  const rowPlannedLocal = planRowLanes(false);
@@ -2517,6 +2681,20 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2517
2681
  })
2518
2682
  : null;
2519
2683
  if (own !== null) {
2684
+ // The chart's own rows answer the ask: it downloaded nothing.
2685
+ download.charge({
2686
+ key: `${target.fetchKey}-${key}`,
2687
+ kType: type,
2688
+ verdict: {
2689
+ complete: true,
2690
+ servedEmpty: false,
2691
+ source: 'main-rows',
2692
+ wireBytes: 0,
2693
+ wireFrames: 0,
2694
+ wirePoints: 0,
2695
+ },
2696
+ ...wrunDownloadAnswerSize(own.rows),
2697
+ });
2520
2698
  fetchOptions?.onSourceVerdict?.({ complete: true, servedEmpty: false, source: 'main-rows' });
2521
2699
  return own.rows;
2522
2700
  }
@@ -2534,12 +2712,16 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
2534
2712
  // A run at another interval: a source naming no interval of its own rides the run interval
2535
2713
  // (the kScript engine's rule, runIntervalForSource), one naming its own keeps it.
2536
2714
  run && fetchOptions?.interval === undefined
2537
- ? { ...fetchOptions, interval: run.interval, ...sendNotices }
2538
- : { ...fetchOptions, ...sendNotices });
2715
+ ? { ...fetchOptions, interval: run.interval, ...sendNotices, meter: download }
2716
+ : { ...fetchOptions, ...sendNotices, meter: download });
2539
2717
  const label = `wrun source fetch '${type}' for '${target.fetchKey}'`;
2540
2718
  const fetched = await (request === undefined
2541
2719
  ? withWrunDeadline(asked, WRUN_SOURCE_FETCH_DEADLINE_MS, label)
2542
2720
  : raceWrunSendDeadline(asked, request.bound, label));
2721
+ // A relay feed's own fetch rides no chart transport and no stamp measures it: its rows are charged their cell bytes.
2722
+ if (fetchOptions?.ownFetch) {
2723
+ download.charge({ key: `${target.fetchKey}-${key}`, kType: type, ...wrunDownloadAnswerSize(fetched) });
2724
+ }
2543
2725
  // Packed-lane SUCCESS arrives as the packed transport object (only the
2544
2726
  // kScript engine worker consumes it un-unpacked); unpack it here, or a
2545
2727
  // real success misclassifies as a decline and re-fetches on the plain
@@ -3024,13 +3206,52 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3024
3206
  }
3025
3207
  return hostGridMemo;
3026
3208
  };
3209
+ // A full run's FIRST PAINT (`drawFirst`: nothing of this overlay computed or on screen, a stand-in included, no
3210
+ // strategy, no replay, the whole loaded window; and live at the chart's edge): a row lane whose first-paint slice
3211
+ // split its asks hands the slice's rows over before its older bars land (`runWrunSourceLanes` early rows), the older
3212
+ // bars read partial until the source ladder's rung adopts the whole answer (wrun-overlay-recovery.util). Every other
3213
+ // run waits for the whole window, as it always did: a run over a picture already drawn never trades it for a
3214
+ // partial one.
3215
+ const firstSlicePaint = live && drawFirst;
3216
+ // The chart's trade date of a bar (its `time.trade_date`): every run cuts a row lane's first-paint slice on a
3217
+ // session's first bar when it can, so a first paint's asks and every later run's ask the same windows (one cache).
3218
+ let tradeDateMemo;
3219
+ const chartTradeDateOf = () => {
3220
+ if (tradeDateMemo === undefined) {
3221
+ const venue = wrunBarVenueOf(chartMetadata, clock.intervalMs);
3222
+ if (venue === undefined)
3223
+ return undefined;
3224
+ const facts = wrunBarSessionFactsResolver(venue);
3225
+ tradeDateMemo = (barOpenMs) => facts(barOpenMs).tradeDateSec;
3226
+ }
3227
+ return tradeDateMemo;
3228
+ };
3229
+ // Each row lane that drew its first slice alone, by the slice's first bar: the live session's reconcile never lands
3230
+ // rows before it until the fill (`rowLaneFilling`, wrun-live-tick.util `mergeWrunReconcileAnswer`).
3231
+ const firstSliceFrom = new Map();
3232
+ // A first slice's shape in the debug ring (`wrun-row-lane-first-slice`): where the slice starts, how many bars it drew
3233
+ // from data and how many it holds back as partial until the fill.
3234
+ const ringFirstSlice = (lane, rows, sliceFromTs) => {
3235
+ if (!wrunChartHostEnv().diagnostics.debugEnabled())
3236
+ return;
3237
+ const drawn = rows.filter((row) => row.slice(1).some((cell) => Array.isArray(cell) && !wrunPresentIsPartial(Number(cell[cell.length - 1]))));
3238
+ wrunChartHostEnv().diagnostics.debug('wrun-row-lane-first-slice', {
3239
+ chartIndex: target.chartIndex,
3240
+ indicatorId: target.indicatorId,
3241
+ lane,
3242
+ sliceFromTs,
3243
+ drawnBars: drawn.length,
3244
+ heldBars: rows.length - drawn.length,
3245
+ });
3246
+ };
3027
3247
  // A row lane instance's rows (sources/row-lane-registry.ts): its asks over the window (a flow or snapshot lane's
3028
3248
  // under the tier rule on the host bars, landed on them with the partial bars marked; a latest lane's once), the
3029
3249
  // K type its descriptor names with the instance's acquisition (a governed lane's on the native-rows path, naming
3030
3250
  // the plane and its routed tier; a chain lane's on the native-rows path naming what its instance's plane names,
3031
3251
  // `wrunRowLaneChainAsk`), or its own fetch. A lane that degrades on an empty answer (a snapshot's) must
3032
- // answer rows unless every input reading it declares `missing: "empty"`; a flow's empty window is quiet.
3033
- const fetchRowLaneRows = async (instance) => {
3252
+ // answer rows unless every input reading it declares `missing: "empty"`; a flow's empty window is quiet. On a first
3253
+ // paint (`firstSlicePaint`) the lane runner's `early` takes the first-paint slice's rows before the older bars land.
3254
+ const fetchRowLaneRows = async (instance, early) => {
3034
3255
  const lane = wrunRowLaneByKey(instance.laneKey);
3035
3256
  if (lane === undefined)
3036
3257
  return [];
@@ -3038,7 +3259,8 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3038
3259
  ? { ...instance.extras, ...wrunOpraLanePayloadFields(governedMarketDataTier('OPRA')) }
3039
3260
  : wrunRowLaneChainAsk(lane, instance.extras, governedMarketDataTier);
3040
3261
  const laneFetch = lane.fetch;
3041
- const rows = await fetchWrunRowLaneRows(lane, extras, hostGridWindow(), { fromTs: from, toTs: to }, async (askExtras, fromTs, toTs) => ((await fetchLane(lane.kType, instance.key, laneFetch
3262
+ const tradeDateOf = chartTradeDateOf();
3263
+ const rows = await fetchWrunRowLaneRows(lane, extras, tradeDateOf === undefined ? hostGridWindow() : { ...hostGridWindow(), tradeDateOf }, { fromTs: from, toTs: to }, async (askExtras, fromTs, toTs) => ((await fetchLane(lane.kType, instance.key, laneFetch
3042
3264
  ? {
3043
3265
  ownFetch: async (askFrom, askTo) => (await laneFetch({
3044
3266
  extras: askExtras,
@@ -3047,7 +3269,18 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3047
3269
  intervalMs: clock.intervalMs,
3048
3270
  })),
3049
3271
  }
3050
- : wrunRowLaneFetchOptions(lane), { ...askExtras }, fromTs, toTs)) ?? []));
3272
+ : wrunRowLaneFetchOptions(lane), { ...askExtras }, fromTs, toTs)) ?? []),
3273
+ // The slice's own rows always hold one with data (an empty slice has no early answer), so a lane that must
3274
+ // answer rows never paints off an empty one.
3275
+ tradeDateOf === undefined || early === undefined || !firstSlicePaint
3276
+ ? undefined
3277
+ : {
3278
+ onFirstSlice: (sliceRows, sliceFromTs) => {
3279
+ firstSliceFrom.set(instance.key, sliceFromTs);
3280
+ ringFirstSlice(instance.key, sliceRows, sliceFromTs);
3281
+ early(sliceRows);
3282
+ },
3283
+ });
3051
3284
  const laneRows = rows;
3052
3285
  return wrunRowLaneRequired(target.metadata, instance)
3053
3286
  ? requireDegradableRows(lane.kType, lane.label, laneRows, instance.key)
@@ -3241,19 +3474,18 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3241
3474
  // The options_chain lane dispatches in its own group, once its identity resolved (below).
3242
3475
  etf_flow: etfLanePlan !== undefined ? () => fetchEtfFlowRows(etfLanePlan) : undefined,
3243
3476
  // The trade tape (C2): the K_TRADES lane asked for the large-print table (`large: true`, the
3244
- // TRADE_LARGE type) at the acquisition's facets, `minSize` pushed down to the gateway as
3245
- // `minAmount` and `history` passed as declared: the control serves the history start aligned
3246
- // to the bar inside the chart's window, clamped to the table's 90-day retention. A history of
3247
- // "0" answers EMPTY by contract (the live edge only) and a quiet filtered window answers empty
3248
- // on a clean wire, so an empty answer computes (present empty blocks on every bar), a quiet
3249
- // lane like trades; a lane error (the worker's 300k-cell cap, a refused stream) degrades it.
3250
- // The payload stays the lane's acquisition: the live fold's floor and the reconcile's re-ask.
3477
+ // TRADE_LARGE type) at the acquisition's facets, the one floor pushed down to the gateway
3478
+ // (`minSize` as `minAmount`, a dollar `minValue` as `minQuoteAmount`, C-DOLLAR) and `history`
3479
+ // passed as declared: the control serves the history start aligned to the bar inside the
3480
+ // chart's window, clamped to the table's 90-day retention. A history of "0" answers EMPTY by
3481
+ // contract (the live edge only) and a quiet filtered window answers empty on a clean wire, so an
3482
+ // empty answer computes (present empty blocks on every bar), a quiet lane like trades; a lane
3483
+ // error (the worker's 300k-cell cap, a refused stream) degrades it. The payload stays the lane's
3484
+ // acquisition: the live fold's floor (a dollar floor with the market's `valuePerUnit`, the
3485
+ // market facts' dollar unit, so a live print is priced in the history's unit, never guessed)
3486
+ // and the reconcile's re-ask.
3251
3487
  tape: tape !== undefined
3252
- ? async () => (await fetchLane('trades', 'tp', undefined, {
3253
- minSize: tape.minSize,
3254
- history: tape.history,
3255
- large: true,
3256
- })) ?? []
3488
+ ? async () => (await fetchLane('trades', 'tp', undefined, wrunTapeLaneExtras(tape, tapeValuePerUnit))) ?? []
3257
3489
  : undefined,
3258
3490
  // The trades leg lanes (kit 0.77.0), one thunk per (quote, market): K_BUY_SELL_VOLUME asked on
3259
3491
  // the leg's market in its quote, under the lane id as its fetch key (its own cache entry and
@@ -3332,13 +3564,27 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3332
3564
  landedBefore: hasGoodResult,
3333
3565
  });
3334
3566
  },
3335
- onLate: (lane, answer) => noteWrunLateRead({
3336
- indicatorId: target.indicatorId,
3337
- lane,
3338
- identity: lateReadIdentity,
3339
- answer,
3340
- acquisition: () => acquisitionByLane[lane],
3341
- }),
3567
+ // A read the run stopped waiting for: its lane's budget ran out (`budget`), or the lane drew its first-paint slice
3568
+ // and the rest of its window is still out (`first-slice`). Either is noted the same way, so the ladder's rung joins
3569
+ // or adopts it and never asks it again.
3570
+ onLate: (lane, answer, why) => {
3571
+ if (wrunChartHostEnv().diagnostics.debugEnabled()) {
3572
+ wrunChartHostEnv().diagnostics.debug('wrun-late-read-noted', {
3573
+ chartIndex: target.chartIndex,
3574
+ indicatorId: target.indicatorId,
3575
+ lane,
3576
+ why,
3577
+ reason,
3578
+ });
3579
+ }
3580
+ noteWrunLateRead({
3581
+ indicatorId: target.indicatorId,
3582
+ lane,
3583
+ identity: lateReadIdentity,
3584
+ answer,
3585
+ acquisition: () => acquisitionByLane[lane],
3586
+ });
3587
+ },
3342
3588
  };
3343
3589
  // A lane whose read an earlier run left out under this run's identity joins that read (still out) or adopts its
3344
3590
  // answer: the lane sends no second ask. The acquisition the earlier run recorded is the lane's here.
@@ -3395,7 +3641,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3395
3641
  // The registry poll lanes and the row lanes, one thunk per planned instance, after the row builder's own lanes in
3396
3642
  // declaration order: those whose plan read no chain dispatch with the lanes known now.
3397
3643
  const pollThunksOf = (lanes) => lanes.map((instance) => [instance.key, () => fetchPollLaneRows(instance)]);
3398
- const rowThunksOf = (lanes) => lanes.map((instance) => [instance.key, () => fetchRowLaneRows(instance)]);
3644
+ const rowThunksOf = (lanes) => lanes.map((instance) => [instance.key, (_abandoned, early) => fetchRowLaneRows(instance, early)]);
3399
3645
  schedule.add(localPlanned.then(({ poll, row }) => {
3400
3646
  laneInstances.push(...poll.lanes, ...row.lanes);
3401
3647
  return wrunJoinLateReads({ ...laneThunks, pollLanes: pollThunksOf(poll.lanes), rowLanes: rowThunksOf(row.lanes) }, joinLateRead);
@@ -3534,12 +3780,26 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3534
3780
  title: target.title,
3535
3781
  ctx: refusal.ctx,
3536
3782
  gateStop: gateStops.get(lane),
3783
+ facts: { metadata: target.metadata, ...(tape !== undefined ? { tape } : {}) },
3537
3784
  }),
3538
3785
  }));
3539
3786
  for (const { lane, outcome } of laneRun.outcomes) {
3540
3787
  if (outcome.kind === 'rows')
3541
3788
  wrunChartHostEnv().chart.markSourceRecovered(guardKey, lane);
3542
3789
  }
3790
+ // The row lanes that answered their first-paint slice alone (`firstSlicePaint`): their older bars are still out, a
3791
+ // late read the source ladder's rung adopts (cause `filling`: a planned fill, no failure). Like a degraded lane each
3792
+ // leaves the warm-up evidence unsettled, so a picture over partial bars never buys older candles.
3793
+ const fillingLanes = laneRun.outcomes.flatMap(({ lane, outcome }) => outcome.kind === 'rows' && outcome.filling === true
3794
+ ? [{ lane, ...wrunLaneSourceOf(lane, laneInstances), cause: 'filling', retryable: true }]
3795
+ : []);
3796
+ for (const entry of fillingLanes)
3797
+ unsettledLanes.add(entry.lane);
3798
+ // Each filling lane's slice start, for the session the integrate installs (`rowLaneFilling`).
3799
+ const fillingFrom = Object.fromEntries(fillingLanes.flatMap(({ lane }) => {
3800
+ const fromTs = firstSliceFrom.get(lane);
3801
+ return fromTs === undefined ? [] : [[lane, fromTs]];
3802
+ }));
3543
3803
  for (const entry of degraded) {
3544
3804
  unsettledLanes.add(entry.lane);
3545
3805
  wrunChartHostEnv().chart.markSourceDegraded(guardKey,
@@ -3640,15 +3900,25 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3640
3900
  // no chip of its own: the registry's chip says what it waits for), keeping
3641
3901
  // whatever the overlay shows, and the source ladder reruns it.
3642
3902
  if (holding.length > 0) {
3643
- armWrunSourceRecovery(target.chartIndex, target.indicatorId, degraded);
3903
+ // The ladder watches the filling lanes' reads too: one rung adopts them all.
3904
+ armWrunSourceRecovery(target.chartIndex, target.indicatorId, [...degraded, ...fillingLanes]);
3644
3905
  // A lane another screen's session stopped names the hold: its record (Resume here) rides the rejection, so a
3645
3906
  // caller reading it (the editor console, the run's own catch) offers the take-back, never a Retry that cannot
3646
3907
  // serve it.
3647
3908
  const stopped = holding.find(({ lane }) => gateStops.has(lane));
3648
- const shown = stopped ?? holding[0];
3909
+ // A lane the data plane refused by name names the hold the same way (its record: the tape over the trades
3910
+ // worker's cap reads too much data with Open the settings, never a Retry), and the hold settles as a refusal
3911
+ // the same settings meet again (`wrunRefusedSourceHolds`): the settings reconcile spends no rerun on it.
3912
+ const refused = stopped === undefined
3913
+ ? holding.find(({ outcome }) => wrunLaneRefusedCodeOf(outcome.error) !== undefined)
3914
+ : undefined;
3915
+ const shown = stopped ?? refused ?? holding[0];
3649
3916
  const hold = wrunSourceHoldError(target.title, wrunLaneSourceOf(shown.lane, laneInstances), shown.outcome);
3650
- const stopRecord = stopped !== undefined ? refusal.degraded?.find(({ lane }) => lane === stopped.lane)?.refusal : undefined;
3651
- throw stopRecord !== undefined ? annotateWrunErrorRefusal(hold, stopRecord) : hold;
3917
+ if (refused !== undefined)
3918
+ wrunRefusedSourceHolds.add(hold);
3919
+ const named = stopped ?? refused;
3920
+ const namedRecord = named !== undefined ? refusal.degraded?.find(({ lane }) => lane === named.lane)?.refusal : undefined;
3921
+ throw namedRecord !== undefined ? annotateWrunErrorRefusal(hold, namedRecord) : hold;
3652
3922
  }
3653
3923
  // The exact warm-up session's head, asked beside the lanes above: a head that cannot be had runs the existing
3654
3924
  // cold path unchanged and records no warmth. A deferred head (draw first) is not awaited: the run is cold now
@@ -3774,7 +4044,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3774
4044
  tapeRows,
3775
4045
  // The plan resolves a param-bound tape floor from the settings it is handed: the floor the
3776
4046
  // lane was asked at (the param's current value).
3777
- ...(tape !== undefined ? { settings: wrunTapeFloorSettings(target.metadata, tape.minSize) } : {}),
4047
+ ...(tape !== undefined ? { settings: wrunTapeFloorSettings(target.metadata, wrunTapeFloorOf(tape)) } : {}),
3778
4048
  ...(pollLanes.length > 0 ? { pollLanes, pollLaneRows } : {}),
3779
4049
  ...(rowLanes.length > 0 ? { rowLanes, rowLaneRows } : {}),
3780
4050
  ...(Object.keys(tradeLegRows).length > 0
@@ -3936,6 +4206,8 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3936
4206
  etfFlowRows,
3937
4207
  evaluatedCandles,
3938
4208
  fetchedRunBars,
4209
+ fillingFrom,
4210
+ fillingLanes,
3939
4211
  formingPreRoll,
3940
4212
  from,
3941
4213
  fundingRateRows,
@@ -4651,7 +4923,11 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
4651
4923
  await integrateWrunRowSourceBatch(runTarget, tc, meta, refusal, computed, owner, head, ask, batch);
4652
4924
  return;
4653
4925
  }
4654
- const { acquisitionByLane, writeOpraProvenance, readsOpraPlane, bookRows, buySellVolumeRows, buySellVolumeUsdRows, chartExchange, chartFirstTs, chartInterval, chartIntervalMs, chartMetadata, chartNames, chartRows, clampedLegs, clock, computeIdentity, computeSourceRows, cryptoVenue, degraded, emptyLegs, etfFlowRows, evaluatedCandles, fetchedRunBars, formingPreRoll, from, fundingRateRows, generationAtStart, hasGoodResult, hasIntrabarLegs, hasLiveCandleLegs, hasPinnedLegs, headWarm, heldCoverage, impliedVolatilityRows, initArgs, intrabarRows, laneHead, laneRun, legs, liquidationRows, live, loadedRows, marketIdentity, missingFeeds, ohlcvRows, openInterestRows, optionsChainRows, paramValues, pinnedCandleRows, pinnedLiveCandleRows, planGeneration, pollLaneRows, pollLanes, rowLaneRows, rowLanes, projection, reason, replay, replayChartRows, replayHeadRows, retainedRowsCap, retainedWindow, rows, run, runBars, runBlockRowsCap, runKey, runRowsPlan, skewRows, strategy, tapeRows, target, textParams, to, tradeLegRows, tradeVolumeBySizeRows, twinAtChart, unservedLanes, unservedLegs, unservedTradeLegs, unsettledLanes, volumeProfileRows, warmupBarsNow, warmupHead, warmupMiss, warmupWall, window, headsDeferred, epoch: generation, pinNotes, respelledPins, } = prepared;
4926
+ const { acquisitionByLane, writeOpraProvenance, readsOpraPlane, bookRows, buySellVolumeRows, buySellVolumeUsdRows, chartExchange, chartFirstTs, chartInterval, chartIntervalMs, chartMetadata, chartNames, chartRows, clampedLegs, clock, computeIdentity, computeSourceRows, cryptoVenue, degraded, emptyLegs, etfFlowRows, evaluatedCandles, fetchedRunBars, fillingFrom, fillingLanes, formingPreRoll, from, fundingRateRows, generationAtStart, hasGoodResult, hasIntrabarLegs, hasLiveCandleLegs, hasPinnedLegs, headWarm, heldCoverage, impliedVolatilityRows, initArgs, intrabarRows, laneHead, laneRun, legs, liquidationRows, live, loadedRows, marketIdentity, missingFeeds, ohlcvRows, openInterestRows, optionsChainRows, paramValues, pinnedCandleRows, pinnedLiveCandleRows, planGeneration, pollLaneRows, pollLanes, rowLaneRows, rowLanes, projection, reason, replay, replayChartRows, replayHeadRows, retainedRowsCap, retainedWindow, rows, run, runBars, runBlockRowsCap, runKey, runRowsPlan, skewRows, strategy, tapeRows, target, textParams, to, tradeLegRows, tradeVolumeBySizeRows, twinAtChart, unservedLanes, unservedLegs, unservedTradeLegs, unsettledLanes, volumeProfileRows, warmupBarsNow, warmupHead, warmupMiss, warmupWall, window, headsDeferred, epoch: generation, pinNotes, respelledPins, } = prepared;
4927
+ // The filling chip (`fillingLanes`, a first-slice picture): raised right before the integrate, lowered if the run
4928
+ // fails after it.
4929
+ const fillingGuardKey = overlayExecutionGuardKey(target.chartIndex, target.indicatorId);
4930
+ let fillingRaised = false;
4655
4931
  try {
4656
4932
  // The module's rows, the batch's own array (its frames, handles and strategy ride on it). A hidden head's rows
4657
4933
  // are cut by timestamp here (D4), where the pass receives them from the row source, before the integrate, the
@@ -4702,8 +4978,9 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
4702
4978
  chartNames,
4703
4979
  // The draft's word and an OPRA chain's served tier (wrun-draft-legend-note.util); every tick repeats it.
4704
4980
  legendNote: wrunOverlayLegendNote(meta.settings, acquisitionByLane.options_chain, acquisitionByLane),
4705
- // The market's size unit: an output its `visible_by` leaves out here mounts nothing.
4706
- sizeUnit: wrunChartSizeUnit(chartMetadata),
4981
+ // The market's size unit (an output its `visible_by` leaves out here mounts nothing) and its dollar unit (the
4982
+ // batched marks' `units`).
4983
+ ...wrunResultMarketUnits(chartMetadata),
4707
4984
  ...(projection ? { projection } : {}),
4708
4985
  // WRUN-STYLE g6: the canvases' cells, the batch's (the run's source rows, shared, never
4709
4986
  // copied, with the profile children's context); the chart index above hands the price
@@ -4722,6 +4999,19 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
4722
4999
  (generation !== undefined && currentWrunOverlayLiveGeneration(target.indicatorId) !== generation)) {
4723
5000
  throw new WrunOverlayPausedError('paused');
4724
5001
  }
5002
+ // A first-slice picture: each filling lane's chip says its older bars are still loading, raised in this turn so
5003
+ // the integrate's own diagnostics write carries it (still text, never a spinner: the registry's filling class). The
5004
+ // rung's run that adopts the whole answer lowers it with its lanes' verdict; a failure from here on lowers it in the
5005
+ // catch below.
5006
+ for (const entry of fillingLanes) {
5007
+ wrunChartHostEnv().chart.markSourcePending(fillingGuardKey, {
5008
+ sourceName: entry.lane,
5009
+ sourceType: entry.kType,
5010
+ landedBefore: true,
5011
+ filling: true,
5012
+ });
5013
+ fillingRaised = true;
5014
+ }
4725
5015
  const runSerial = nextWrunCanvasRunSerial(target.indicatorId);
4726
5016
  const integration = integrateWrunRunThroughRoute({
4727
5017
  ...integrateOptions,
@@ -4745,6 +5035,9 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
4745
5035
  throw new WrunChartGoneError(`wrun overlay '${target.indicatorId}' was superseded during its run (${route.reason})`);
4746
5036
  }
4747
5037
  const runResult = integration.runResult;
5038
+ // The picture drew a row lane's first slice alone (its older bars still out): the attempt says so at its settle.
5039
+ if (fillingLanes.length > 0 && integration.applied)
5040
+ computed.firstSlice = true;
4748
5041
  // The first accepted integrate replaces a proven twin's or a pinned
4749
5042
  // package's stand-in (D3 B5); a no-op for an overlay no stand-in stands for.
4750
5043
  if (integration.applied) {
@@ -4873,7 +5166,8 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
4873
5166
  }
4874
5167
  // A proven twin's or a pinned package's whole result is the stand-in the
4875
5168
  // next reload or switch paints (D3 B5); a merge lands a page, never a
4876
- // stand-in.
5169
+ // stand-in, and a first-slice picture (older bars still loading) is no
5170
+ // whole result: the fill's run stores it.
4877
5171
  if (route.action === 'apply-remount' && integration.applied) {
4878
5172
  await writeWrunStandIn({
4879
5173
  chartIndex: target.chartIndex,
@@ -4884,6 +5178,7 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
4884
5178
  chartMetadata,
4885
5179
  window,
4886
5180
  executedVersion: target.version,
5181
+ firstSlice: fillingLanes.length > 0,
4887
5182
  });
4888
5183
  }
4889
5184
  if (live && generation !== undefined && rows.length > 0) {
@@ -4966,6 +5261,9 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
4966
5261
  ? {
4967
5262
  rowLanes,
4968
5263
  rowLaneRows: Object.fromEntries(Object.entries(rowLaneRows).map(([key, rows]) => [key, [...rows]])),
5264
+ // Lanes whose rows hold their first slice alone, by its first bar: no prefix page stands on them and
5265
+ // no reconcile lands rows before that bar until the fill.
5266
+ ...(Object.keys(fillingFrom).length > 0 ? { rowLaneFilling: fillingFrom } : {}),
4969
5267
  }
4970
5268
  : {}),
4971
5269
  // The trades leg lanes the run asked (kit 0.77.0): a copy of each one's rows by lane id. The
@@ -5194,6 +5492,11 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
5194
5492
  // instead of ticking a session it does not own); the session lock and the load signals go.
5195
5493
  // A page or a save on the held source ends nothing more of the overlay's live session.
5196
5494
  releaseWrunRowSourceAsk(runTarget, ask, { epoch: generation, land: wrunTickOwnedFrames });
5495
+ // A filling chip this run raised says nothing once the run failed: lowered with it (data-loading rule 3).
5496
+ if (fillingRaised) {
5497
+ for (const entry of fillingLanes)
5498
+ wrunChartHostEnv().chart.markSourceRecovered(fillingGuardKey, entry.lane);
5499
+ }
5197
5500
  throw error;
5198
5501
  }
5199
5502
  // The batch landed: a live run hands its session to the overlay (the source lets the session
@@ -5207,10 +5510,12 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
5207
5510
  source.teardown();
5208
5511
  }
5209
5512
  // End of run: lanes it computed without arm the source ladder (kScript's
5210
- // recovery rungs, each a whole rerun riding the fetch cache); a run that
5211
- // landed every lane retires it.
5212
- if (degraded.length > 0)
5213
- armWrunSourceRecovery(target.chartIndex, target.indicatorId, degraded);
5513
+ // recovery rungs, each a whole rerun riding the fetch cache), and so do the lanes that drew their first slice
5514
+ // alone (their older bars' read, adopted by the rung the moment it lands); a run that landed every lane whole
5515
+ // retires it.
5516
+ const unfinished = [...degraded, ...fillingLanes];
5517
+ if (unfinished.length > 0)
5518
+ armWrunSourceRecovery(target.chartIndex, target.indicatorId, unfinished);
5214
5519
  else
5215
5520
  retireWrunSourceRecovery(target.indicatorId, 'recovered');
5216
5521
  }
@@ -5342,7 +5647,10 @@ async function reconcileWrunSourceRecord(chartIndex, tc, indicatorId, meta, shee
5342
5647
  await wrunChartHostEnv().chart.raiseSlotCharge(chartIndex, tc, indicatorId, meta, sheet);
5343
5648
  let declarationsMoved = false;
5344
5649
  try {
5345
- const scriptInputs = buildWrunScriptInputs(sheet);
5650
+ // A market-scaled param's row keeps the default the run head moved it to (wrun-market-size-defaults.util): the
5651
+ // sheet's own (Big Trades' 10) is no record's default off its market, and a value at the market's would read as
5652
+ // changed.
5653
+ const scriptInputs = wrunRowsKeepingMarketDefaults(buildWrunScriptInputs(sheet), settingsObjectOf(meta).scriptInputs, wrunRegistryRefOf(meta.settings)?.package);
5346
5654
  const enginePatch = wrunSourceRecordPatchOf(meta.settings, scriptInputs);
5347
5655
  if (enginePatch !== undefined) {
5348
5656
  const chart = tc;
@@ -5571,8 +5879,9 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
5571
5879
  fills: runTarget.fills,
5572
5880
  candles: runTarget.candles,
5573
5881
  chartNames,
5574
- // The market's size unit: an output its `visible_by` leaves out here mounts nothing, as on the own run.
5575
- sizeUnit: wrunChartSizeUnit(chartMetadata),
5882
+ // The market's size unit (an output its `visible_by` leaves out here mounts nothing) and its dollar unit, as on
5883
+ // the own run.
5884
+ ...wrunResultMarketUnits(chartMetadata),
5576
5885
  // The canvases' cells: the batch's own lanes when it carries them, else the cells the source keeps.
5577
5886
  cellRows: wrunRowBatchCellRows(batch) ?? source.cellRowsOf(chartRows),
5578
5887
  intervalMs: chartIntervalMs,
@@ -5993,7 +6302,7 @@ function askWrunWarmupBackfillIfOwed(args) {
5993
6302
  declaredWarmupEndTs: declaredWarmupBars === null
5994
6303
  ? null
5995
6304
  : wrunDeclaredWarmupEndTs(runRows, declaredWarmupBars, intervalMs, creditedBars),
5996
- sourceReachFromTs: wrunRunSourceReachFromMs({ ...args.historySources, nowMs: Date.now() }),
6305
+ sourceReachFromTs: wrunRunSourceReachFromMs({ ...args.historySources, nowMs: serverNowMs() }),
5997
6306
  }),
5998
6307
  requestOlderHistory: wrunWarmupPageRequester(chartIndex, indicatorId, tc, isCurrent, ringDetails),
5999
6308
  ringDetails,
@@ -6262,8 +6571,8 @@ function assertWrunRunMayPaint(chartIndex, indicatorId, replay) {
6262
6571
  /** The kScript replay window's warm-up candles before the chart's first bar,
6263
6572
  * on the K_OHLCV lane the kScript engine fetches them on (deadline-raced like
6264
6573
  * every lane): [fromMs, beforeMs). */
6265
- async function fetchWrunReplayHeadRows(target, meta, fromMs, beforeMs) {
6266
- const fetched = await withWrunDeadline(wrunChartHostEnv().transport.fetchSource(target.chartIndex, 'ohlcv', { symbol: 'currentSymbol', exchange: 'currentExchange' }, fromMs, beforeMs, meta, `${target.fetchKey}-replay-head`, false, {}), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun replay head for '${target.fetchKey}'`);
6574
+ async function fetchWrunReplayHeadRows(target, meta, fromMs, beforeMs, meter) {
6575
+ const fetched = await withWrunDeadline(wrunChartHostEnv().transport.fetchSource(target.chartIndex, 'ohlcv', { symbol: 'currentSymbol', exchange: 'currentExchange' }, fromMs, beforeMs, meta, `${target.fetchKey}-replay-head`, false, { meter }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun replay head for '${target.fetchKey}'`);
6267
6576
  const rows = isPackedOhlcvRows(fetched)
6268
6577
  ? unpackOhlcvRows(fetched)
6269
6578
  : Array.isArray(fetched)
@@ -6353,6 +6662,8 @@ async function writeWrunStandIn(args) {
6353
6662
  return refuse('template');
6354
6663
  if (args.window?.partial)
6355
6664
  return refuse('window-partial');
6665
+ if (args.firstSlice === true)
6666
+ return refuse('first-slice');
6356
6667
  if (args.executedVersion !== undefined && args.executedVersion !== identity.version) {
6357
6668
  return refuse('version-mismatch');
6358
6669
  }
@@ -6768,9 +7079,9 @@ export async function reseedWrunOverlayFromBuffers(indicatorId, reason, options
6768
7079
  outputs: context.metadata.outputs.length,
6769
7080
  });
6770
7081
  }
6771
- // The reseed's own clock: the legs re-align as-of now over the buffers
6772
- // (a candle that closed since the last build is admitted by it).
6773
- const clock = { intervalMs: context.intervalMs, nowMs: Date.now() };
7082
+ // The reseed's own clock: the legs re-align as-of the server's now over the
7083
+ // buffers (a candle that closed since the last build is admitted by it).
7084
+ const clock = { intervalMs: context.intervalMs, nowMs: serverNowMs() };
6774
7085
  const sourceRows = {
6775
7086
  ohlcvRows,
6776
7087
  bookRows: context.bookRows,
@@ -6786,7 +7097,7 @@ export async function reseedWrunOverlayFromBuffers(indicatorId, reason, options
6786
7097
  optionsChainRows: context.optionsChainRows,
6787
7098
  etfFlowRows: context.etfFlowRows,
6788
7099
  tapeRows: context.tapeRows,
6789
- settings: wrunTapeFloorSettings(context.metadata, context.acquisition.tape?.minSize),
7100
+ settings: wrunTapeFloorSettings(context.metadata, wrunTapeAcquisitionFloor(context.acquisition.tape)),
6790
7101
  pollLanes: context.pollLanes,
6791
7102
  pollLaneRows: context.pollLaneRows,
6792
7103
  rowLanes: context.rowLanes,
@@ -7013,7 +7324,7 @@ export async function reseedWrunOverlayFromBuffers(indicatorId, reason, options
7013
7324
  candles: context.candles,
7014
7325
  chartNames,
7015
7326
  legendNote: wrunOverlayLegendNote(meta.settings, context.acquisition.options_chain, context.acquisition),
7016
- sizeUnit: wrunChartSizeUnit(context.market),
7327
+ ...wrunResultMarketUnits(context.market),
7017
7328
  ...(runSession
7018
7329
  ? { projection: wrunRunIntervalProjectionOf(runSession.run, context.chartIndex, context.market?.exchange) }
7019
7330
  : {}),
@@ -7276,18 +7587,20 @@ function wrunDegradedLaneOutcome(error) {
7276
7587
  * poll lanes (`thunks.pollLanes`, one thunk per planned instance) dispatch with
7277
7588
  * them, after the row builder's own lanes; their rows come back under
7278
7589
  * `tradeLegRows` and `pollLaneRows`, keyed by lane id and instance id.
7590
+ *
7591
+ * A lane may hand its first rows over before its whole answer (`early`, a row lane's first-paint slice on a full run's
7592
+ * first paint): when they come before the whole answer and before the budget, the lane settles on them (outcome
7593
+ * rows, `filling`) and its whole answer goes on as a late read (`onLate`, `first-slice`), exactly as a read its budget
7594
+ * abandoned does, so the source ladder adopts it and nothing asks it twice. Early rows after the budget change
7595
+ * nothing: the budget's late read is the whole answer already.
7279
7596
  */
7280
7597
  export async function runWrunSourceLanes(thunks, policy = {}) {
7281
7598
  const builtin = WRUN_SOURCE_LANE_ORDER.flatMap((lane) => {
7282
7599
  const run = thunks[lane];
7283
7600
  return typeof run === 'function' ? [[lane, run]] : [];
7284
7601
  });
7285
- const declared = [
7286
- ...builtin,
7287
- ...(thunks.tradeLegs ?? []),
7288
- ...(thunks.pollLanes ?? []),
7289
- ...(thunks.rowLanes ?? []),
7290
- ];
7602
+ const declared = [...builtin, ...(thunks.tradeLegs ?? []), ...(thunks.pollLanes ?? []), ...(thunks.rowLanes ?? [])];
7603
+ const filling = new Set();
7291
7604
  const settled = await Promise.allSettled(declared.map(([lane, run]) => {
7292
7605
  const laneBudgetMs = typeof policy.budgetMs === 'function' ? policy.budgetMs(lane) : policy.budgetMs;
7293
7606
  const deadline = wrunLaneSendDeadline(laneBudgetMs ?? 0, policy.capMs);
@@ -7295,27 +7608,49 @@ export async function runWrunSourceLanes(thunks, policy = {}) {
7295
7608
  // Raised when the lane's budget runs out: its run no longer waits on it, so a lane asked in pieces asks no
7296
7609
  // further piece (`wrunAskWirePieces`); the asks already out finish into the fetch's cache.
7297
7610
  const abandon = new AbortController();
7611
+ // The lane's first rows (`early`), if it hands any over before its whole answer: the first call wins.
7612
+ let landEarly = () => undefined;
7613
+ const early = new Promise((resolve) => {
7614
+ let landed = false;
7615
+ landEarly = (rows) => {
7616
+ if (landed)
7617
+ return;
7618
+ landed = true;
7619
+ resolve({ rows, whole: false });
7620
+ };
7621
+ });
7298
7622
  let answer;
7299
7623
  try {
7300
- answer = run(abandon.signal);
7624
+ answer = run(abandon.signal, (rows) => landEarly(rows));
7301
7625
  }
7302
7626
  catch (error) {
7303
7627
  answer = Promise.reject(error);
7304
7628
  }
7305
- if (laneBudgetMs === undefined)
7306
- return answer;
7629
+ const first = Promise.race([answer.then((rows) => ({ rows, whole: true })), early]);
7307
7630
  // One phase per send notice, each racing what is left of the deadline the notice moved to
7308
7631
  // (`wrunLaneSendDeadline`). Only the budget's own expiry abandons the read and hands it on as a late read: an
7309
7632
  // answer that failed (its fetch's own deadline included) is no read to join or adopt.
7310
- return raceWrunSendDeadline(answer, deadline, `wrun source lane '${lane}'`, (expired) => {
7311
- abandon.abort(expired);
7312
- policy.onLate?.(lane, answer);
7633
+ const answered = laneBudgetMs === undefined
7634
+ ? first
7635
+ : raceWrunSendDeadline(first, deadline, `wrun source lane '${lane}'`, (expired) => {
7636
+ abandon.abort(expired);
7637
+ policy.onLate?.(lane, answer, 'budget');
7638
+ });
7639
+ return answered.then(({ rows, whole }) => {
7640
+ if (!whole) {
7641
+ // The lane drew its first rows alone: the rest of its window is the late read the ladder adopts.
7642
+ filling.add(lane);
7643
+ policy.onLate?.(lane, answer, 'first-slice');
7644
+ }
7645
+ return rows;
7313
7646
  });
7314
7647
  }));
7315
7648
  const run = { results: {}, outcomes: [], degraded: [] };
7316
7649
  declared.forEach(([lane], at) => {
7317
7650
  const answer = settled[at];
7318
- const outcome = answer.status === 'fulfilled' ? { kind: 'rows', rows: answer.value } : wrunDegradedLaneOutcome(answer.reason);
7651
+ const outcome = answer.status === 'fulfilled'
7652
+ ? { kind: 'rows', rows: answer.value, ...(filling.has(lane) ? { filling: true } : {}) }
7653
+ : wrunDegradedLaneOutcome(answer.reason);
7319
7654
  run.outcomes.push({ lane, outcome });
7320
7655
  if (outcome.kind === 'degraded')
7321
7656
  run.degraded.push({ lane, outcome });
@@ -7377,6 +7712,10 @@ function wrunUnservedLaneReason(type, exchange, coin, service) {
7377
7712
  if (checkIsCryptoIndex(exchange)) {
7378
7713
  return `the ${type} source lane answers nothing on ${market} (a crypto index market serves its value candles only)`;
7379
7714
  }
7715
+ if (checkIsQuotePerp(exchange)) {
7716
+ return (`the ${type} source lane answers nothing on ${market} (a quote-priced perpetual market serves its quote ` +
7717
+ 'candles, funding and open interest only)');
7718
+ }
7380
7719
  return (`the ${type} source lane answers nothing on ${market} (a forex or commodity market serves no volume ` +
7381
7720
  'profile, buy/sell volume, order book, implied volatility or skew)');
7382
7721
  case 'coin':
@@ -7501,9 +7840,7 @@ function wrunOptionsChainExtrasGoverned(extras) {
7501
7840
  * provenance (the wall's door read it): `auto` reads an OPRA chain for an
7502
7841
  * OpenMarket package, and for a run `opraUserScripts` says the
7503
7842
  * `opra-user-scripts` flag opened the plane to. A governed identity carries
7504
- * the lane's scope (`wrunOptionsChainLaneScope` over every chain input: the
7505
- * nearest expiries at a bounded strike window the smallest `max_cells` holds)
7506
- * and the tier the viewer is served now (`governedOptionSummaryTier`, the
7843
+ * the tier the viewer is served now (`governedOptionSummaryTier`, the
7507
7844
  * routing's own rule: the lane's acquisition names it and the legend follows
7508
7845
  * it). Returns the lane's payload extras (`chain*` fields).
7509
7846
  *
@@ -7514,10 +7851,19 @@ function wrunOptionsChainExtrasGoverned(extras) {
7514
7851
  * the gateway's scope inputs in place of a scope (`chainNearestExpiries`,
7515
7852
  * `chainMaxContracts`, O2: the gateway sizes B on its page, so no expiry
7516
7853
  * directory is read here or in the worker); the chain's inputs read views all,
7517
- * or none.
7854
+ * or none, and its view inputs one expiries word (one block B for the lane).
7855
+ *
7856
+ * OPTLOAD W3 FE-CHAIN: a governed chain whose inputs declare no views asks the
7857
+ * gateway's WHOLE view of B through the implicit view
7858
+ * (`wrunOptionsChainImplicitViewFields`: `chainViews: "whole"` and the same
7859
+ * scope inputs), so the gateway sizes B on its page by the lane scope's own
7860
+ * rule and no expiry directory is read before the ask; the worker sizes
7861
+ * today's scope itself only for an answer that is not B's rows. A crypto
7862
+ * chain keeps its plain reader (OPTLOAD W3 decision 1): its payload is
7863
+ * today's, byte for byte.
7518
7864
  */
7519
7865
  async function wrunOptionsChainLaneExtrasFor(metadata, chartMetadata, official, opraUserScripts) {
7520
- const [{ decideWrunLaneChainIdentity, resolveWrunChartChain }, { hasDeribitOptions }, { resolveWrunOptionsChainCryptoVenues }, { WRUN_OPTION_VIEWS_ONE_ASK_CODE, wrunHeldOpraPlaneChain, wrunOptionViewLaneFields, wrunOptionViewsOfSource, wrunOptionViewsUnion, },] = await Promise.all([
7866
+ const [{ decideWrunLaneChainIdentity, resolveWrunChartChain }, { hasDeribitOptions }, { resolveWrunOptionsChainCryptoVenues }, { WRUN_OPTION_VIEWS_ONE_ASK_CODE, WRUN_OPTION_VIEWS_ONE_EXPIRIES_CODE, wrunHeldOpraPlaneChain, wrunOptionsChainImplicitViewFields, wrunOptionViewLaneFields, wrunOptionViewsOfSource, wrunOptionViewsUnion, },] = await Promise.all([
7521
7867
  import('./sources/opra-option-lanes.util.js'),
7522
7868
  wrunChartHostEnv().market.loadDeribitOptions(),
7523
7869
  wrunChartHostEnv().market.loadOptionsChainVenues(),
@@ -7587,28 +7933,51 @@ async function wrunOptionsChainLaneExtrasFor(metadata, chartMetadata, official,
7587
7933
  `one options_chain lane, one through views and one whole (${WRUN_OPTION_VIEWS_ONE_ASK_CODE}): declare ` +
7588
7934
  'views on both, or on neither'), wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_ONE_ASK_CODE));
7589
7935
  }
7936
+ // The gateway sizes B on its page from the inputs' expiries word (their `nearest:N` when every input declares one;
7937
+ // none when one reads every expiry) and budget (the smallest max_cells), for a view ask and the implicit WHOLE alike
7938
+ // (O2): the lane scope's own inputs (`wrunOptionsChainLaneScope`), so B is the block today's scoped page builds.
7939
+ const nearest = laneInputs.flatMap((input) => (input.expiries?.kind === 'nearest' ? [input.expiries.count] : []));
7940
+ const budgets = laneInputs
7941
+ .map((input) => Number(input.maxCells))
7942
+ .filter((cells) => Number.isFinite(cells) && cells > 0);
7943
+ const gatewayScope = {
7944
+ ...(nearest.length === laneInputs.length ? { nearestExpiries: Math.max(...nearest) } : {}),
7945
+ ...(budgets.length > 0 ? { maxContracts: Math.floor(Math.min(...budgets)) } : {}),
7946
+ };
7590
7947
  if (firstWithViews >= 0) {
7591
- // A view ask on any chain: the gateway sizes B on its page from the inputs' expiries word (the largest
7592
- // `nearest:N`, none when one input reads every expiry) and budget (the smallest max_cells) (O2).
7593
- const nearest = laneInputs.flatMap((input) => (input.expiries?.kind === 'nearest' ? [input.expiries.count] : []));
7594
- const budgets = laneInputs
7595
- .map((input) => Number(input.maxCells))
7596
- .filter((cells) => Number.isFinite(cells) && cells > 0);
7597
- const viewFields = wrunOptionViewLaneFields('options_chain', wrunOptionViewsUnion(viewSets.filter((views) => views !== undefined)), {
7598
- ...(nearest.length === laneInputs.length ? { nearestExpiries: Math.max(...nearest) } : {}),
7599
- ...(budgets.length > 0 ? { maxContracts: Math.floor(Math.min(...budgets)) } : {}),
7600
- });
7948
+ // One block B for the lane, built for one expiries word: view inputs of two words would read views of one B, so
7949
+ // the lane refuses by name (the SDK asks each word apart; one acquisition per word would serve them).
7950
+ const wordOf = (at) => {
7951
+ const expiries = laneInputs[at].expiries;
7952
+ if (expiries === undefined)
7953
+ return String(metadata.inputSources[chainInputs[at].name]?.expiries);
7954
+ return expiries.kind === 'nearest' ? `nearest:${expiries.count}` : 'all';
7955
+ };
7956
+ const otherWord = chainInputs.findIndex((_, at) => wordOf(at) !== wordOf(0));
7957
+ if (otherWord > 0) {
7958
+ throw attachWrunRefusal(new Error(`WRUN ${metadata.id}: inputs '${chainInputs[0].name}' and '${chainInputs[otherWord].name}' read one ` +
7959
+ `options_chain lane through views with expiries '${wordOf(0)}' and '${wordOf(otherWord)}' ` +
7960
+ `(${WRUN_OPTION_VIEWS_ONE_EXPIRIES_CODE}): declare the same expiries on every view input of one ` +
7961
+ 'options_chain lane (this host builds one block for the lane)'), wrunAuthorRuleSeed(WRUN_OPTION_VIEWS_ONE_EXPIRIES_CODE));
7962
+ }
7963
+ // A view ask on any chain, its one expiries word the gateway's scope input.
7964
+ const viewFields = wrunOptionViewLaneFields('options_chain', wrunOptionViewsUnion(viewSets.filter((views) => views !== undefined)), gatewayScope);
7601
7965
  const viewIdentity = identity.venue === 'cme' || identity.venue === 'opra'
7602
7966
  ? { ...identity, servedTier: governedOptionSummaryTier(identity.exchange) }
7603
7967
  : identity;
7604
7968
  return { ...wrunOptionsChainLaneExtras(viewIdentity), ...viewFields };
7605
7969
  }
7970
+ // A crypto chain keeps its plain reader (OPTLOAD W3 decision 1): the gateway's B prices an expiry at its page's one
7971
+ // underlying, where the crypto read takes each contract's own sample.
7606
7972
  if (identity.venue !== 'cme' && identity.venue !== 'opra')
7607
7973
  return wrunOptionsChainLaneExtras(identity);
7608
- // A governed chain asks the scope the package's declared appetite fits (`wrunOptionsChainLaneScope`: the smallest
7609
- // max_cells over its chain inputs), sized on the chain's live expiry count.
7610
- const scope = wrunOptionsChainLaneScope(laneInputs, await wrunGovernedLiveExpiryCount(identity));
7611
- return wrunOptionsChainLaneExtras({ ...identity, scope, servedTier: governedOptionSummaryTier(identity.exchange) });
7974
+ // A governed chain whose inputs declare no views reads B whole through the implicit view (OPTLOAD W3 FE-CHAIN): ONE
7975
+ // summary read of the gateway's WHOLE view, sized on its page, with no expiry directory before it (the inputs apply
7976
+ // their own expiries words to B as they land, as they did to today's scoped page).
7977
+ return {
7978
+ ...wrunOptionsChainLaneExtras({ ...identity, servedTier: governedOptionSummaryTier(identity.exchange) }),
7979
+ ...wrunOptionsChainImplicitViewFields(gatewayScope),
7980
+ };
7612
7981
  }
7613
7982
  /**
7614
7983
  * One run's OPRA provenance writer (options-overlay-provenance.util `setOptionsOverlayOpraProvenance`, both
@@ -7640,53 +8009,6 @@ async function wrunOpraProvenanceWriter(chartIndex, indicatorId, ownership) {
7640
8009
  return true;
7641
8010
  };
7642
8011
  }
7643
- /**
7644
- * How many expiries a governed chain lists live now: its plane's expiry directory, the one
7645
- * StreamOptionChain read the option chain service caches (`listOptionExpiries`, the same answer the
7646
- * worker's chain store sizes its own reads by), read for the underlying the chain's summary serves
7647
- * (`wrunChainDirectoryUnderlying`) and bounded by the source fetch deadline. Undefined when it cannot
7648
- * be read, its underlying cannot be resolved, or it lists none (a directory that names no live expiry
7649
- * tells nothing): the lane scope then sizes for an unknown count (the most expiries the budget fits at
7650
- * the floor window), never for one. Lazy imports: the service reaches the metadata service and the gate
7651
- * transport.
7652
- */
7653
- async function wrunGovernedLiveExpiryCount(identity) {
7654
- try {
7655
- const [{ default: optionChainService }, { Exchange }] = await Promise.all([
7656
- wrunChartHostEnv().market.loadOptionChainService(),
7657
- import('@orangecharts/orange-v2-pb-common'),
7658
- ]);
7659
- // The wire enum of the chain's exchange (a name this pb-common build lacks reads no listing).
7660
- const exchange = Exchange[identity.exchange.toUpperCase()];
7661
- if (typeof exchange !== 'number')
7662
- return undefined;
7663
- const expiries = await withWrunDeadline((async () => {
7664
- const underlying = await wrunChainDirectoryUnderlying(identity);
7665
- if (underlying === null)
7666
- return [];
7667
- return optionChainService.forVenue(identity.venue).listOptionExpiries({ exchange, underlying });
7668
- })(), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun options chain expiry directory for ${identity.venue}:${identity.exchange}:${identity.underlying}`);
7669
- return expiries.length > 0 ? expiries.length : undefined;
7670
- }
7671
- catch {
7672
- return undefined;
7673
- }
7674
- }
7675
- /**
7676
- * The underlying a governed chain's expiry directory is listed for: the chain's own, or, for a
7677
- * continuous alias (`ES1!`), the outright leading it now through the continuous lead resolver
7678
- * (`getResolvedLead`, the roll rule the gateway's summary path resolves the alias with, fixture-pinned
7679
- * to it, and the one the terminal identity admitted the alias by). The directory never resolves an
7680
- * alias: it lists nothing for one. Null when the lead cannot be resolved.
7681
- */
7682
- async function wrunChainDirectoryUnderlying(identity) {
7683
- const { isContinuousSymbol } = await import('../chart/continuous-contracts.util.js');
7684
- if (!isContinuousSymbol(identity.underlying))
7685
- return identity.underlying;
7686
- const { default: continuousContracts } = await wrunChartHostEnv().market.loadContinuousContracts();
7687
- const lead = await continuousContracts.getResolvedLead(identity.exchange, identity.underlying);
7688
- return lead?.symbol ? lead.symbol : null;
7689
- }
7690
8012
  /** A run target whose sheet is the sheet on the chart's market (wrunChartSizeUnit): a lane's
7691
8013
  * `currency: "Auto"` reads the unit it resolves to there (wrunSheetWithLaneCurrencies), an input
7692
8014
  * whose `needed_by` leaves the market's size unit out is not demanded (wrunSheetWithLaneDemand), and
@@ -8181,7 +8503,7 @@ async function reintegrateWrunSessionCanvases(indicatorId, context, fill, curren
8181
8503
  candles: context.candles,
8182
8504
  chartNames,
8183
8505
  legendNote: wrunOverlayLegendNote(meta.settings, context.acquisition.options_chain, context.acquisition),
8184
- sizeUnit: wrunChartSizeUnit(context.market),
8506
+ ...wrunResultMarketUnits(context.market),
8185
8507
  ...(runSession
8186
8508
  ? { projection: wrunRunIntervalProjectionOf(runSession.run, context.chartIndex, context.market?.exchange) }
8187
8509
  : {}),
@@ -9139,7 +9461,7 @@ let wrunWarmupHeadPageSerial = 0;
9139
9461
  * unserved (a laundered connection failure, an embargoed window) or rejected page. `lane` names the head in the transport id, the diagnostics and the grid guard: an exact warm-up
9140
9462
  * session's (`wrun-warmup-head`) or the cloud's warm-up head (`wrun-lane-warmup`, row 53).
9141
9463
  */
9142
- async function fetchWrunWarmupHeadPage(chartIndex, request, fromTs, toTs, lane = 'wrun-warmup-head') {
9464
+ async function fetchWrunWarmupHeadPage(chartIndex, request, fromTs, toTs, meter, lane = 'wrun-warmup-head') {
9143
9465
  wrunWarmupHeadPageSerial += 1;
9144
9466
  const ovId = `${lane}-${wrunWarmupHeadPageSerial}`;
9145
9467
  const from = Math.floor(fromTs / 1000);
@@ -9156,6 +9478,8 @@ async function fetchWrunWarmupHeadPage(chartIndex, request, fromTs, toTs, lane =
9156
9478
  // head store would keep the gap as walked.
9157
9479
  let served = false;
9158
9480
  let failed = false;
9481
+ // The page's completion (its own request, never shared): what it downloaded is the run's.
9482
+ const heard = { completed: false };
9159
9483
  const controller = new AbortController();
9160
9484
  try {
9161
9485
  await withWrunDeadline(request.transport.fetchData('OHLCV', payload, chartIndex, {
@@ -9171,6 +9495,8 @@ async function fetchWrunWarmupHeadPage(chartIndex, request, fromTs, toTs, lane =
9171
9495
  },
9172
9496
  onComplete: (info) => {
9173
9497
  served = info?.completedOnWire === true && info.embargoed !== true;
9498
+ heard.completed = true;
9499
+ heard.info = info;
9174
9500
  },
9175
9501
  signal: controller.signal,
9176
9502
  shareable: false,
@@ -9181,6 +9507,22 @@ async function fetchWrunWarmupHeadPage(chartIndex, request, fromTs, toTs, lane =
9181
9507
  controller.abort();
9182
9508
  return null;
9183
9509
  }
9510
+ if (heard.completed) {
9511
+ const { info } = heard;
9512
+ meter.charge({
9513
+ key: ovId,
9514
+ kType: 'OHLCV',
9515
+ verdict: {
9516
+ complete: served,
9517
+ servedEmpty: info?.servedEmpty === true,
9518
+ source: 'wire',
9519
+ ...(typeof info?.wireBytes === 'number'
9520
+ ? { wireBytes: info.wireBytes, wireFrames: info.wireFrames ?? 0, wirePoints: info.wirePoints ?? 0 }
9521
+ : {}),
9522
+ },
9523
+ ...wrunDownloadAnswerSize(replied),
9524
+ });
9525
+ }
9184
9526
  if (failed || !served)
9185
9527
  return null;
9186
9528
  request.lane.stripMainCandleRows(replied, 0);
@@ -9328,7 +9670,7 @@ async function acquireWrunWarmupHead(args) {
9328
9670
  if (getChartDataFetchGeneration(args.chartIndex) !== dataGen)
9329
9671
  break;
9330
9672
  pages += 1;
9331
- const answered = await fetchWrunWarmupHeadPage(args.chartIndex, request, fromTs, toTs);
9673
+ const answered = await fetchWrunWarmupHeadPage(args.chartIndex, request, fromTs, toTs, args.meter);
9332
9674
  if (answered === null)
9333
9675
  break;
9334
9676
  const page = [];
@@ -9445,7 +9787,7 @@ async function acquireWrunLaneWarmupHead(args) {
9445
9787
  if (getChartDataFetchGeneration(args.chartIndex) !== dataGen)
9446
9788
  break;
9447
9789
  pages += 1;
9448
- const answered = await fetchWrunWarmupHeadPage(args.chartIndex, args.request, fromTs, toTs, 'wrun-lane-warmup');
9790
+ const answered = await fetchWrunWarmupHeadPage(args.chartIndex, args.request, fromTs, toTs, args.meter, 'wrun-lane-warmup');
9449
9791
  if (answered === null)
9450
9792
  break;
9451
9793
  const page = [];
@@ -10209,11 +10551,11 @@ function wrunPrefixBatchedGapRows(mountedMetas, context, sheet, child, childId,
10209
10551
  * reconcile). Packed only: the session the candidate rules admitted rode it, and a decline hands
10210
10552
  * the page to the full run.
10211
10553
  */
10212
- async function fetchWrunPrefixBookRows(context, meta, fromTs, toTs) {
10554
+ async function fetchWrunPrefixBookRows(context, meta, fromTs, toTs, meter) {
10213
10555
  const { preferPackedOrderbookWorker: _packed, ...acquisition } = (context.acquisition.book ?? {});
10214
10556
  const fetched = await withWrunDeadline(wrunChartHostEnv().transport.fetchSource(context.chartIndex, 'orderbook', { symbol: 'currentSymbol', exchange: 'currentExchange', ...acquisition }, fromTs, toTs, meta, `${context.fetchKey}-prefix-ob`, false,
10215
10557
  // The full run stamped the legend; a prefix page never restamps it.
10216
- { preferPackedOrderbookWorker: true, silentLegend: true }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun prefix source fetch 'orderbook' for '${context.fetchKey}'`);
10558
+ { preferPackedOrderbookWorker: true, silentLegend: true, meter }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun prefix source fetch 'orderbook' for '${context.fetchKey}'`);
10217
10559
  if (isPackedOhlcvRows(fetched))
10218
10560
  return unpackOhlcvRows(fetched);
10219
10561
  if (Array.isArray(fetched))
@@ -10264,7 +10606,7 @@ function wrunPrefixDegradedPageDetail(lane, outcome) {
10264
10606
  * when the session's buffer holds none either (the page of an old stretch, a lane's horizon past it, reads empty as a
10265
10607
  * whole run's older bars do).
10266
10608
  */
10267
- async function acquireWrunPrefixLanePages(context, meta, plan, fromMs, beforeTs, chartMetadata) {
10609
+ async function acquireWrunPrefixLanePages(context, meta, plan, fromMs, beforeTs, chartMetadata, meter) {
10268
10610
  const pages = new Map();
10269
10611
  if (plan.builtin.length === 0 && plan.poll.length === 0 && plan.daily.length === 0 && plan.rows.length === 0) {
10270
10612
  return { pages };
@@ -10282,6 +10624,7 @@ async function acquireWrunPrefixLanePages(context, meta, plan, fromMs, beforeTs,
10282
10624
  {
10283
10625
  ...fetchOptions,
10284
10626
  silentLegend: true,
10627
+ meter,
10285
10628
  onSourceVerdict: (heard) => {
10286
10629
  verdict = heard;
10287
10630
  },
@@ -10715,7 +11058,7 @@ function wrunPrefixSnapshotsStale(prepared, tc, meta, indicatorId) {
10715
11058
  * parent payload for the merge route, and every heatmap child's window landing (C6). Every await of the
10716
11059
  * run is here; the commit reads what this returns and awaits nothing.
10717
11060
  */
10718
- async function prepareWrunPrefixRun(runTarget, tc, meta, window, landings, startedAt) {
11061
+ async function prepareWrunPrefixRun(runTarget, tc, meta, window, landings, startedAt, computed) {
10719
11062
  const { chartIndex, indicatorId } = runTarget;
10720
11063
  const requestId = window.prefix.requestId;
10721
11064
  // The session the executor planned the window against, still the overlay's (a newer pan wave may
@@ -10761,6 +11104,9 @@ async function prepareWrunPrefixRun(runTarget, tc, meta, window, landings, start
10761
11104
  if (windowRows.length === 0 || windowRows[0][0] !== window.fromMs) {
10762
11105
  return wrunPrefixRejected('stale', 'the window is no longer loaded');
10763
11106
  }
11107
+ // What the page downloads, from its first ask on, against the budget of its window's bars.
11108
+ const download = createWrunDownloadMeter(windowRows.length);
11109
+ computed.download = download;
10764
11110
  // The admission again, the plan's rule (O8f): an exact warm-up session admitted on its warm guest runs from W
10765
11111
  // candles before the window, its hidden head asked through the main candle request; a session the roster admits
10766
11112
  // never needs warmth (a listed package with a cold warm-up stamp runs its page as the roster runs it). A guest no
@@ -10782,6 +11128,7 @@ async function prepareWrunPrefixRun(runTarget, tc, meta, window, landings, start
10782
11128
  beforeTs: window.fromMs,
10783
11129
  bars: warmupBars,
10784
11130
  intervalMs: context.intervalMs,
11131
+ meter: download,
10785
11132
  });
10786
11133
  ringWrunWarmupHead(chartIndex, indicatorId, 'prefix', warmupBars, acquired);
10787
11134
  if ('miss' in acquired) {
@@ -10810,9 +11157,9 @@ async function prepareWrunPrefixRun(runTarget, tc, meta, window, landings, start
10810
11157
  // other lane's page at once: a book the capability rule never dispatched reads empty, as the session's does.
10811
11158
  const [bookRows, lanePages] = await Promise.all([
10812
11159
  context.acquisition.book !== undefined
10813
- ? fetchWrunPrefixBookRows(context, meta, window.fromMs, window.toMs)
11160
+ ? fetchWrunPrefixBookRows(context, meta, window.fromMs, window.toMs, download)
10814
11161
  : Promise.resolve(context.bookRows !== undefined ? [] : undefined),
10815
- acquireWrunPrefixLanePages(context, meta, lanePlan, window.fromMs, firstRowTs, chartMetadata),
11162
+ acquireWrunPrefixLanePages(context, meta, lanePlan, window.fromMs, firstRowTs, chartMetadata, download),
10816
11163
  ]);
10817
11164
  // A lane whose page could not be had (declined, failed, out of budget, or empty where the full run degrades it):
10818
11165
  // the data, never the module. Nothing staged lands; the wave's full run follows.
@@ -10881,7 +11228,7 @@ async function prepareWrunPrefixRun(runTarget, tc, meta, window, landings, start
10881
11228
  candles: runTarget.candles,
10882
11229
  ...(chartNames !== undefined ? { chartNames } : {}),
10883
11230
  ...(priceDigits !== undefined ? { priceDigits } : {}),
10884
- sizeUnit: wrunChartSizeUnit(chartMetadata),
11231
+ ...wrunResultMarketUnits(chartMetadata),
10885
11232
  cellRows: wrunCellRowsOf(context.metadata, sourceRows),
10886
11233
  intervalMs: clock.intervalMs,
10887
11234
  ...(chartExchange !== undefined ? { exchange: chartExchange } : {}),
@@ -11446,7 +11793,7 @@ function commitWrunPrefixRun(prepared, tc, meta, chartOwner, indicatorId) {
11446
11793
  * (C7). Never throws: the executor sees a settled run either way, and a prefix never words a failure.
11447
11794
  * The commit boundary is `withWrunOverlaySessionLock` around `commitWrunPrefixRun`.
11448
11795
  */
11449
- async function runWrunPrefixOverlay(runTarget, tc, meta, window, refusal, owner) {
11796
+ async function runWrunPrefixOverlay(runTarget, tc, meta, window, refusal, owner, computed) {
11450
11797
  const { chartIndex, indicatorId } = runTarget;
11451
11798
  const startedAt = wrunHostClockMs();
11452
11799
  const planned = getWrunOverlayLiveContext(indicatorId);
@@ -11454,7 +11801,7 @@ async function runWrunPrefixOverlay(runTarget, tc, meta, window, refusal, owner)
11454
11801
  let prepared;
11455
11802
  let outcome;
11456
11803
  try {
11457
- const ready = await prepareWrunPrefixRun(runTarget, tc, meta, window, landings, startedAt);
11804
+ const ready = await prepareWrunPrefixRun(runTarget, tc, meta, window, landings, startedAt, computed);
11458
11805
  if (ready.kind === 'rejected') {
11459
11806
  outcome = ready;
11460
11807
  }