@orangecharts/wrun-chart-host 0.8.0 → 0.10.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 (246) hide show
  1. package/README.md +3 -1
  2. package/dist/constants/feature-flags.constants.d.ts +9 -0
  3. package/dist/constants/feature-flags.constants.js +86 -16
  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 +15 -0
  7. package/dist/constants/opra-compliance.constants.js +15 -0
  8. package/dist/constants/option-venues.constants.d.ts +11 -6
  9. package/dist/constants/option-venues.constants.js +5 -2
  10. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  13. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  14. package/dist/constants/venue-presets.constants.d.ts +20 -20
  15. package/dist/constants/venue-presets.constants.js +24 -26
  16. package/dist/host-env.d.ts +39 -9
  17. package/dist/host-env.js +6 -0
  18. package/dist/host-ports.types.d.ts +108 -18
  19. package/dist/index.d.ts +14 -0
  20. package/dist/index.js +14 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
  22. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  23. package/dist/interfaces/opra-realtime.interface.js +10 -10
  24. package/dist/interfaces/replay.interface.d.ts +8 -0
  25. package/dist/interfaces/wrun-runtime.interface.d.ts +52 -15
  26. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +94 -14
  27. package/dist/kscript-data/controls/live-trades-merge.util.js +132 -22
  28. package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
  29. package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
  30. package/dist/market-data/billing.interface.d.ts +227 -42
  31. package/dist/market-data/billing.interface.js +60 -12
  32. package/dist/market-data/venue.d.ts +88 -6
  33. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  34. package/dist/market-data/venues/cme.d.ts +126 -0
  35. package/dist/market-data/venues/cme.js +133 -0
  36. package/dist/market-data/venues/index.d.ts +165 -8
  37. package/dist/market-data/venues/index.js +48 -6
  38. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  39. package/dist/market-data/venues/opra.d.ts +3 -3
  40. package/dist/market-data/venues/opra.js +5 -4
  41. package/dist/replay/replayLadder.js +3 -1
  42. package/dist/settings-templates/index.js +7 -3
  43. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  44. package/dist/settings-templates/indicator-fields.js +45 -6
  45. package/dist/settings-templates/tool-rules.d.ts +27 -17
  46. package/dist/settings-templates/tool-rules.js +27 -11
  47. package/dist/settings-templates/tool-tables.generated.js +91 -31
  48. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  49. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  50. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  51. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  52. package/dist/utility/chart/index-mode-admission.util.js +24 -3
  53. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  54. package/dist/utility/chart/index-mode.util.js +23 -13
  55. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  56. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  57. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
  58. package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
  59. package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
  60. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
  61. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  62. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  63. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -27
  64. package/dist/utility/chart/kscript-venue-policy.util.js +74 -32
  65. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  66. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  67. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  68. package/dist/utility/chart/marketKind.util.js +17 -7
  69. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  70. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  71. package/dist/utility/chart/om-panel.util.js +6 -6
  72. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  73. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  74. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  75. package/dist/utility/chart/profile-block-size.util.js +7 -0
  76. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  77. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  78. package/dist/utility/chart/rth-session.util.d.ts +3 -2
  79. package/dist/utility/chart/rth-session.util.js +2 -1
  80. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  81. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  82. package/dist/utility/chart/wrun-run-result.util.d.ts +17 -0
  83. package/dist/utility/chart/wrun-run-result.util.js +145 -7
  84. package/dist/utility/common/transformations.util.d.ts +7 -0
  85. package/dist/utility/common/transformations.util.js +11 -0
  86. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  87. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  88. package/dist/utility/options/option-venue.util.d.ts +21 -3
  89. package/dist/utility/options/option-venue.util.js +30 -3
  90. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
  91. package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
  92. package/dist/utility/wrun/derived-roots.util.js +471 -0
  93. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
  94. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  95. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  96. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  97. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +5 -3
  98. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +6 -4
  99. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  100. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  101. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  102. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  103. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  104. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  105. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  108. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +15 -6
  109. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -0
  110. package/dist/utility/wrun/sources/row-lanes/option_prints.js +82 -13
  111. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  112. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -8
  113. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +95 -14
  114. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  115. package/dist/utility/wrun/sources/row-lanes/option_surface.js +7 -3
  116. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  117. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +35 -14
  118. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +70 -20
  119. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
  120. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
  121. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +45 -1
  122. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +114 -6
  123. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +56 -5
  124. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +224 -26
  125. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +822 -58
  126. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  127. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  128. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  129. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  130. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  131. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  132. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  133. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  134. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  135. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +192 -13
  136. package/dist/utility/wrun/wrun-chart-market-facts.util.js +437 -55
  137. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  138. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  139. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  140. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  141. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  142. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  143. package/dist/utility/wrun/wrun-download-meter.util.d.ts +107 -0
  144. package/dist/utility/wrun/wrun-download-meter.util.js +134 -0
  145. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  146. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  147. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  148. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  149. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  150. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  151. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  152. package/dist/utility/wrun/wrun-frames.js +78 -15
  153. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  154. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  155. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  156. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  157. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +51 -21
  158. package/dist/utility/wrun/wrun-hud-looks.util.js +74 -28
  159. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  160. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  161. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  162. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  163. package/dist/utility/wrun/wrun-live-intake.util.d.ts +19 -9
  164. package/dist/utility/wrun/wrun-live-intake.util.js +213 -45
  165. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
  166. package/dist/utility/wrun/wrun-live-tick.util.js +246 -49
  167. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  168. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  169. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +205 -48
  170. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +277 -34
  171. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  172. package/dist/utility/wrun/wrun-market-size-defaults.util.js +340 -56
  173. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  174. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  175. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  176. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  177. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  178. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  179. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +26 -6
  180. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +50 -11
  181. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +109 -19
  182. package/dist/utility/wrun/wrun-option-strike-flow.util.js +222 -61
  183. package/dist/utility/wrun/wrun-option-views.util.d.ts +96 -18
  184. package/dist/utility/wrun/wrun-option-views.util.js +246 -51
  185. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  186. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  187. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  188. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  189. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -0
  190. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  191. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  192. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  193. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  194. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  195. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  196. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  197. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  198. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +134 -37
  199. package/dist/utility/wrun/wrun-overlay-run.util.js +1118 -254
  200. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  201. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  202. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  203. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  204. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  205. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  206. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  207. package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
  208. package/dist/utility/wrun/wrun-panel-style.util.d.ts +37 -24
  209. package/dist/utility/wrun/wrun-panel-style.util.js +100 -29
  210. package/dist/utility/wrun/wrun-param-map.util.d.ts +15 -11
  211. package/dist/utility/wrun/wrun-param-map.util.js +13 -5
  212. package/dist/utility/wrun/wrun-param-values.util.d.ts +21 -3
  213. package/dist/utility/wrun/wrun-param-values.util.js +6 -0
  214. package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
  215. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  216. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  217. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  218. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  219. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  220. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  221. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  222. package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
  223. package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
  224. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +52 -1
  225. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  226. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  227. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  228. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  229. package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
  230. package/dist/utility/wrun/wrun-source-rows.util.d.ts +9 -1
  231. package/dist/utility/wrun/wrun-source-rows.util.js +108 -43
  232. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  233. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  234. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  235. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  236. package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
  237. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  238. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  239. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  240. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  241. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  242. package/dist/utils/replay/replay-buffer-math.js +227 -20
  243. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  244. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  245. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  246. package/package.json +5 -5
@@ -193,7 +193,7 @@ import { wrunPollLaneByKey } from './sources/registry.js';
193
193
  import { isWrunPollLaneId } from './sources/wrun-poll-lane.types.js';
194
194
  import { wrunRowLaneByKey } from './sources/row-lane-registry.js';
195
195
  import { isWrunRowLaneId } from './sources/wrun-row-lane.types.js';
196
- import { fetchWrunRowLaneRows, wrunRowLaneChainAsk, wrunRowLaneChainGovernedExchange, wrunRowLaneFetchOptions, wrunRowLaneMovedInstance, } from './sources/wrun-row-lanes.util.js';
196
+ import { fetchWrunRowLaneRows, mergeWrunReplayRowLaneRows, wrunReplayRowLaneExtensions, wrunRowLaneAddKey, wrunRowLaneChainAsk, wrunRowLaneChainGovernedExchange, wrunRowLaneFetchOptions, wrunRowLaneMovedInstance, } from './sources/wrun-row-lanes.util.js';
197
197
  import { wrunOpraLanePayloadAt } from './wrun-opra-lane.util.js';
198
198
  import { drainWrunPollLaneLiveRows, setWrunPollLaneLiveDrainRequester, wrunPollLaneLiveOwed, wrunPollLaneLiveUp, } from './wrun-series-stream.util.js';
199
199
  import { fetchWrunPollLaneHostGridRows, wrunPollLaneChainAsk, wrunPollLaneChainGovernedExchange, wrunPollLaneFetchOptions, wrunPollLaneMovedInstance, wrunPollLaneReconcileFrom, wrunPollLaneReconcileTo, } from './sources/wrun-poll-lanes.util.js';
@@ -204,15 +204,16 @@ import { attachWrunHandles, wrunHandlesOf } from './wrun-handles.util.js';
204
204
  import { mergeWrunCandleEvidence, wrunCandleFingerprintsOf } from './wrun-prefix-proof.util.js';
205
205
  import { noteWrunLaneRevision } from './wrun-prefix-lanes.util.js';
206
206
  import { attachWrunFrames, WRUN_CELL_BLOCK_TOO_LARGE_CODE, wrunAbiVersion, wrunCellTupleWidths, wrunFramesOf, } from './wrun-pack.util.js';
207
+ import { wrunCellBoundWords, wrunSheetCellBlockTuples } from './wrun-cell-capacity.leaf.js';
207
208
  import { LIVE_MAX_CELLS_PER_BAR, tradesBarOpenMs, tradesLaneLimits, tradesServedStartMs, } from '../../kscript-data/controls/live-trades-merge.util.js';
208
- import { parseWrunTapeHistory, wrunTapeFloorSettings, wrunTapeHistoryOf } from './wrun-tape-source.util.js';
209
+ import { isWrunAskedTapeSource, parseWrunTapeHistory, wrunTapeAcquisitionFloor, wrunTapeFloorSettings, wrunTapeFloorSettingWords, wrunTapeHistoryOf, } from './wrun-tape-source.util.js';
209
210
  import { serverNowMs } from '../auth/server-clock.util.js';
210
211
  import { wrunModuleReadsBarCount } from './wrun-bar-count.util.js';
211
212
  import { isWrunBatchedChildRefused, mountWrunChildOverlays } from './wrun-panel-mount.util.js';
212
213
  import { getWrunBrowserHost, wrunLiveOf, WrunLiveOrderError, WrunLiveSessionLostError, } from './wrun-host.service.js';
213
214
  import { getWrunOverlayLiveContext, isWrunOverlayRerunInFlight, onWrunOverlayLiveTeardown, rerunWrunOverlayForChartWave, setWrunChartRowsIdentityReader, setWrunLiveSheetReader, suspendWrunOverlayLiveSession, teardownWrunOverlay, withWrunOverlaySessionLock, wrunChartMarketIdentity, } from './wrun-overlay-drivers.util.js';
214
215
  import { withWrunOverlayExecutionMeasure } from './wrun-overlay-lifecycle.util.js';
215
- import { cutWrunReplayRowsAfterApply } from './wrun-replay-rows.util.js';
216
+ import { cutWrunReplayRows, cutWrunReplayRowsAfterApply } from './wrun-replay-rows.util.js';
216
217
  import { healWrunOverlayIfIdle, requestWrunCasualtyRebuilds } from './wrun-overlay-recovery.util.js';
217
218
  import { isWrunQuarantinedError, isWrunWorkerPoisonError, WrunIntegrationError, } from './wrun-registry-errors.util.js';
218
219
  import { wrunLegBarCloseAt, wrunLegCandleClose, wrunLegCloseSettleMs, wrunLegCandleOpen, wrunPrimaryRowBounds, wrunPrimaryRowHoldingMs, wrunChartSession, } from './wrun-leg-close.util.js';
@@ -220,11 +221,11 @@ import { wrunLiveReconcileMaySound } from './wrun-signal-sound-reasons.leaf.js';
220
221
  import { wrunCanvasChildId, wrunCellRowsOf } from './wrun-canvases.util.js';
221
222
  import { readWrunBatchedSections, wrunBatchedChildId, wrunSheetHasBatchedMarks } from './wrun-batched-marks.util.js';
222
223
  import { isWrunStyleTargetHidden } from './wrun-color-settings.util.js';
223
- import { buildWrunOverlayRunResult, closedLegCandles, forgetWrunOverlayCanvasState, openLegCandles, wrunLegReadsFormingOpen, wrunLegReadsLiveCandleOnly, cutWrunOddsLegRows, placeWrunResultTables, presentWrunIntegration, publishWrunRunHealth, publishWrunSessionCanvasNotices, recordWrunHostBuildMs, reseedWrunOverlayFromBuffers, wrunCanvasHostFillFor, wrunChartPriceDigits, wrunHostFillContextFor, wrunLegFetchType, wrunLegPayloadExtras, wrunIntegratedRowsView, wrunSessionCanvasFillOf, wrunSessionPinnedSheet, wrunSessionRespelledSheet, wrunSessionRunHealth, } from './wrun-overlay-run.util.js';
224
+ import { buildWrunOverlayRunResult, closedLegCandles, forgetWrunOverlayCanvasState, openLegCandles, wrunLegReadsFormingOpen, wrunLegReadsLiveCandleOnly, cutWrunOddsLegRows, placeWrunResultTables, presentWrunIntegration, publishWrunRunHealth, publishWrunSessionCanvasNotices, recordWrunHostBuildMs, reseedWrunOverlayFromBuffers, wrunCanvasHostFillFor, wrunChartPriceDigits, wrunDownloadBudgetCutOn, wrunHostFillContextFor, wrunLegFetchType, wrunLegPayloadExtras, wrunIntegratedRowsView, wrunSessionCanvasFillOf, wrunSessionPinnedSheet, wrunSessionRespelledSheet, wrunResultMarketUnits, wrunSessionRunHealth, } from './wrun-overlay-run.util.js';
224
225
  import { forgetWrunCanvasCache } from './wrun-canvas-cache.util.js';
225
226
  import { wrunLegNativeRowsOption } from './wrun-pin-venues.util.js';
226
227
  import { wrunSessionChartNamesOf } from './wrun-chart-context-names.util.js';
227
- import { wrunChartSizeUnit, wrunReadsMarketFacts } from './wrun-chart-market-facts.util.js';
228
+ import { wrunReadsMarketFacts } from './wrun-chart-market-facts.util.js';
228
229
  import { wrunReadsEarningsFacts } from './wrun-earnings-facts.util.js';
229
230
  import { wrunLaneRefusalLeavesWindowOwed, wrunLaneRefusedCodeOf } from './wrun-lane-refusal.leaf.js';
230
231
  import { WRUN_RUN_INTERVAL_ROWS_KEY, wrunRunIntervalComputeRows, wrunRunIntervalProjectionOf, wrunRunIntervalRowsThrough, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
@@ -237,6 +238,7 @@ import { advanceWrunInputCarry, buildWrunInputTailRows, planWrunPinnedWires, wru
237
238
  import { isWrunTradesLegLane, WRUN_TRADES_LANES, wrunTradesLegExtras } from './wrun-trades-lane.util.js';
238
239
  import { drainWrunLiveIntake, dropWrunLiveQueuedBuckets, dropWrunLiveQueuedLegBuckets, enqueueWrunLiveFrame, markWrunLiveGap, noteWrunLiveIntakeEvent, setWrunLiveDrainRequester, takeWrunLiveGaps, wrunLaneAnswerCoversBucket, wrunLiveBucketTs, wrunLiveIntakeBacklogDue, wrunLiveIntakeStats, WRUN_LIVE_LANE_OF_SCRIPT_SOURCE, } from './wrun-live-intake.util.js';
239
240
  import { stampWrunLiveFrameOpra } from './wrun-cloud-opra-stamp.util.js';
241
+ import { createWrunDownloadMeter, } from './wrun-download-meter.util.js';
240
242
  /** Book frames are full snapshots and book runs are the heavy case: same 1s
241
243
  * floor the kScript coalescer applies to orderbook-sourced scripts. */
242
244
  const WRUN_BOOK_LIVE_UPDATE_MIN_MS = 1_000;
@@ -355,6 +357,17 @@ const wrunHiddenHeldIds = new Set();
355
357
  * which wakes a drain that re-asks the legs. Dropped on teardown. */
356
358
  const pinnedCloseTimers = new Map();
357
359
  const ledgers = new Map();
360
+ /** Each live session's download meter (wrun-download-meter.util), by session: every reconcile ask charges it. Counted,
361
+ * never budgeted: a reconcile re-asks the newest bars, and the add's attempt settled with its first run. */
362
+ const liveDownloadMeters = new WeakMap();
363
+ function wrunLiveDownloadMeter(context) {
364
+ let meter = liveDownloadMeters.get(context);
365
+ if (meter === undefined) {
366
+ meter = createWrunDownloadMeter(0);
367
+ liveDownloadMeters.set(context, meter);
368
+ }
369
+ return meter;
370
+ }
358
371
  function emptyTickStats() {
359
372
  return {
360
373
  computes: 0,
@@ -533,6 +546,14 @@ export function markWrunSourceFedLiveContext(context, session) {
533
546
  diagnostics: session.diagnostics !== undefined ? wrunSourceVerdictKey(session.diagnostics) : undefined,
534
547
  });
535
548
  }
549
+ /** A Cloud session's receipt from here on (`WrunOverlayLiveContext.cloudOpraServed`): the receipt an answer with the
550
+ * OPRA mark named for its rows, or none when it named no tier. */
551
+ export function noteWrunCloudOpraServed(context, served) {
552
+ if (served === undefined)
553
+ delete context.cloudOpraServed;
554
+ else
555
+ context.cloudOpraServed = { ...served };
556
+ }
536
557
  /** Whether a row source feeds `context` from elsewhere (its drain integrates the source's frames only). */
537
558
  export function isWrunSourceFedLiveContext(context) {
538
559
  return context !== undefined && wrunSourceFedContexts.has(context);
@@ -575,12 +596,49 @@ export function queueWrunSourceLiveFrame(context, frame, cellRowsOf) {
575
596
  if (getWrunOverlayLiveContext(context.indicatorId) !== context || context.replay)
576
597
  return;
577
598
  const queued = queuedSourceFrames.get(context);
599
+ // A move of the served tier never folds into the rows of the tier before it: the source drops its session on one
600
+ // (`servedTierMoved`), and a frame naming another tier than the rows the session holds reseeds it the same way.
601
+ if (frame.servedTierMoved === true || wrunFrameMovesServedTier(context, queued?.frame, frame)) {
602
+ reseedWrunSourceSessionAtServedTier(context);
603
+ return;
604
+ }
578
605
  // The verdict is weighed against the one the drain reaches next: the queued frames', else the session's.
579
606
  if (!wrunRowFrameDraws(frame) && !wrunSourceVerdictMoves(context, frame, queued?.frame))
580
607
  return;
581
608
  queuedSourceFrames.set(context, { frame: queued ? coalesceWrunRowFrames(queued.frame, frame) : frame, cellRowsOf });
582
609
  armWrunLiveDrain(context, false);
583
610
  }
611
+ /**
612
+ * The cloud served the session's OPRA rows at another tier than the rows the overlay shows (its source's transition,
613
+ * `WrunRowFrame.servedTierMoved`: the source dropped every row it held). Nothing drawn at the old tier stays: the
614
+ * frames queued for the session go, the overlay's rows come off the chart (the parent, its nested plots and its child
615
+ * panes), its live session ends with the source it held (the driver stays: `suspendWrunOverlayLiveSession`, the
616
+ * primitive the browser lane's downgrade discard ends a session with), and a rebuild creates a fresh session at the
617
+ * tier the cloud serves now, whose result names its receipt to the legend. A downgraded viewer never keeps real-time
618
+ * rows under a delayed word, and an upgraded one never keeps delayed rows under none.
619
+ */
620
+ /** Whether a frame names another served tier than the rows its session holds: the newest receipt queued for it, else
621
+ * the session's own (`cloudOpraServed`). A frame or a session that names no tier moves nothing. */
622
+ function wrunFrameMovesServedTier(context, queued, frame) {
623
+ const tier = frame.opra === true ? frame.opraServed?.tier : undefined;
624
+ if (tier === undefined)
625
+ return false;
626
+ const held = (queued?.opra === true ? queued.opraServed?.tier : undefined) ?? context.cloudOpraServed?.tier;
627
+ return held !== undefined && held !== tier;
628
+ }
629
+ function reseedWrunSourceSessionAtServedTier(context) {
630
+ const { chartIndex, indicatorId } = context;
631
+ queuedSourceFrames.delete(context);
632
+ try {
633
+ cutWrunReplayRows(wrunChartHostEnv().chart.instance(chartIndex), indicatorId, Number.NEGATIVE_INFINITY);
634
+ }
635
+ catch (error) {
636
+ console.warn(`[wrun] the served-tier reseed could not take '${indicatorId}' off the chart:`, error);
637
+ }
638
+ suspendWrunOverlayLiveSession(indicatorId);
639
+ noteWrunLiveIntakeEvent(indicatorId, { kind: 'rebuild' });
640
+ void rerunWrunOverlayForChartWave(indicatorId, { reason: 'live-rebuild' })?.catch(() => undefined);
641
+ }
584
642
  /**
585
643
  * The frames queued for `replaced`, a session the pass replaced with `context` over the same row source, go to
586
644
  * `context` when both stand for the same calculation (`WrunSourceFedSession.generation`: a page of the held source):
@@ -667,8 +725,16 @@ function coalesceWrunRowFrames(held, next) {
667
725
  : {}),
668
726
  // The cloud's OPRA mark survives the fold: either frame's stamps the overlay before the tail lands.
669
727
  ...(next.opra === true || held.opra === true ? { opra: true } : {}),
728
+ // The receipt of the newest frame that carried the mark (its rows are the newest): its tier, or none.
729
+ ...coalescedOpraServed(held, next),
670
730
  };
671
731
  }
732
+ /** The receipt a fold of two frames carries: the newer frame's when it carried the OPRA mark (none when it named no
733
+ * tier), else the held frame's (a frame without the mark says nothing of OPRA). */
734
+ function coalescedOpraServed(held, next) {
735
+ const served = next.opra === true ? next.opraServed : held.opraServed;
736
+ return served !== undefined ? { opraServed: served } : {};
737
+ }
672
738
  /** A frame's handle records with their bar stamps moved by `offset` rows. */
673
739
  function rebaseWrunFrameHandles(handles, offset) {
674
740
  return handles.map((record) => ({
@@ -1568,6 +1634,11 @@ export async function advanceWrunReplaySession(indicatorId, ohlcvRows) {
1568
1634
  if (wrunSourceFedContexts.has(context))
1569
1635
  return 'skipped';
1570
1636
  const newestTs = Number(ohlcvRows[ohlcvRows.length - 1][0]);
1637
+ // The session's flow and snapshot row lanes reach the step's cursor first (SKYLIT-PARITY L6a): the tail, and a
1638
+ // bar-count reseed, read the bars the step reveals off their buffers. One the session cannot extend reopens it.
1639
+ const owed = wrunReplayRowLaneExtensions(context.rowLanes, context.coveredThroughTs, newestTs);
1640
+ if (owed.length > 0 && !(await extendWrunReplayRowLanes(context, owed, newestTs)))
1641
+ return 'skipped';
1571
1642
  if (wrunLiveContextReadsBarCount(context) && newestTs > context.lastRowTs)
1572
1643
  return 'reseed';
1573
1644
  const ledger = ledgerFor(indicatorId);
@@ -1600,6 +1671,51 @@ export async function advanceWrunReplaySession(indicatorId, ohlcvRows) {
1600
1671
  ledger.inFlight = false;
1601
1672
  }
1602
1673
  }
1674
+ /**
1675
+ * A replay session's flow and snapshot row lanes extended to a step's cursor (SKYLIT-PARITY L6a): the replay run read
1676
+ * each through its cursor (wrun-row-lanes.util `replayCursorMs`), so the bars a step reveals are asked now, at the
1677
+ * step's cursor, from the bar after each lane's coverage (`wrunReplayRowLaneExtensions`; the lane's replay memo answers
1678
+ * the bars it already landed), merged into the lane's buffer (`mergeWrunReplayRowLaneRows`), and its coverage moves to
1679
+ * the cursor. The step then computes them as it computes every other lane's: the replay record's coverage stays its
1680
+ * window's end, so no step reopens the session for its row lanes. False when an ask failed or was not confirmed whole
1681
+ * (no memo keeps its bars, so the reopened run asks them again), when another drain holds the session, or when the
1682
+ * session moved meanwhile: the step reopens the session then.
1683
+ */
1684
+ async function extendWrunReplayRowLanes(context, owed, cursorTs) {
1685
+ const ledger = ledgerFor(context.indicatorId);
1686
+ if (ledger.inFlight)
1687
+ return false;
1688
+ const tc = wrunChartHostEnv().chart.instance(context.chartIndex);
1689
+ const meta = tc?.metadata?.find((candidate) => candidate.id === context.indicatorId);
1690
+ if (meta === undefined)
1691
+ return false;
1692
+ const generation = context.generation;
1693
+ ledger.inFlight = true;
1694
+ try {
1695
+ for (const { key, fromTs } of owed) {
1696
+ const heard = { confirmed: true };
1697
+ const rows = await fetchWrunRowLaneReconcile(context, ledger, key, fromTs, cursorTs + 1, meta, {
1698
+ cursorMs: cursorTs,
1699
+ onUnconfirmed: () => {
1700
+ heard.confirmed = false;
1701
+ },
1702
+ });
1703
+ if (!wrunLiveContextCurrent(context, generation) || !heard.confirmed)
1704
+ return false;
1705
+ const merged = mergeWrunReplayRowLaneRows(context.rowLaneRows?.[key], rows);
1706
+ setLaneRows(context, key, merged);
1707
+ context.coveredThroughTs[key] = cursorTs;
1708
+ }
1709
+ return true;
1710
+ }
1711
+ catch (error) {
1712
+ console.warn(`[wrun] replay row lane extension failed for '${context.indicatorId}':`, error);
1713
+ return false;
1714
+ }
1715
+ finally {
1716
+ ledger.inFlight = false;
1717
+ }
1718
+ }
1603
1719
  /**
1604
1720
  * A socket row source's live frames (WRUN-PARITY-PLAN C7, plan row 18), the drain's integrate of every
1605
1721
  * frame folded since the last one (`queueWrunSourceLiveFrame`): the bars the cloud moved enter the live
@@ -1658,6 +1774,13 @@ export async function integrateWrunOverlayLiveFrame(indicatorId, frame, cellRows
1658
1774
  return;
1659
1775
  if (!wrunLiveTickEligible(context, generation))
1660
1776
  return;
1777
+ // A frame with the mark names the receipt of the rows it carries (contract opra-server-lanes C4): the legend's
1778
+ // served word follows it from this tick on, and a frame naming no tier leaves none (never the account's tier).
1779
+ // The session reads OPRA from here: its debug lines state it (the console provenance).
1780
+ if (frame.opra === true) {
1781
+ noteWrunCloudOpraServed(context, frame.opraServed);
1782
+ context.opraRead = true;
1783
+ }
1661
1784
  // The verdict first: a refusal set that moved cuts the sheet again, so the integrate below builds without
1662
1785
  // a family the source now leaves out (and with one it serves again).
1663
1786
  const recut = await landWrunSourceFrameVerdict(context, meta, frame);
@@ -1770,15 +1893,18 @@ export class WrunTapeLiveRefusal extends Error {
1770
1893
  this.name = 'WrunTapeLiveRefusal';
1771
1894
  }
1772
1895
  }
1773
- /** The tape inputs of a sheet, by declaration order: index, name, cap, and whether an oversize
1774
- * block reads empty (C1.2b `missing: "empty"`, the packer's own rule). */
1896
+ /** The tape inputs the session asks (isWrunAskedTapeSource: an unasked tape reads zero cells and folds no print), by
1897
+ * declaration order: index, name, `max_cells`, the tuples a bar's block may hold in the module (the packer's own
1898
+ * bound, wrun-cell-capacity.leaf `wrunSheetCellBlockTuples`: the sheet's `capacity ?? max_cells`, unbounded without
1899
+ * either), and whether an oversize block reads empty (C1.2b `missing: "empty"`, the packer's own rule). */
1775
1900
  function wrunTapeInputsOf(metadata) {
1776
1901
  return metadata.inputs
1777
- .filter((input) => metadata.inputSources[input.name]?.source === 'tape')
1902
+ .filter((input) => isWrunAskedTapeSource(metadata.inputSources[input.name]))
1778
1903
  .map((input) => ({
1779
1904
  index: input.index,
1780
1905
  name: input.name,
1781
1906
  ...(input.max_cells !== undefined ? { maxCells: input.max_cells } : {}),
1907
+ capacity: wrunSheetCellBlockTuples(metadata, input),
1782
1908
  emptyWhenOversize: metadata.inputSources[input.name]?.missing === 'empty',
1783
1909
  }));
1784
1910
  }
@@ -1793,7 +1919,8 @@ function refuseWrunTapeCappedBucket(context) {
1793
1919
  const input = wrunTapeInputsOf(context.metadata)[0];
1794
1920
  throw attachWrunRefusal(new WrunTapeLiveRefusal(`WRUN ${context.metadata.id}: input '${input?.name ?? 'tape'}' bar at ts ${bucket} holds more prints than ` +
1795
1921
  `the live tape keeps (${LIVE_MAX_CELLS_PER_BAR}), so its block would be truncated ` +
1796
- `(${WRUN_CELL_BLOCK_TOO_LARGE_CODE}). Blocks are never truncated: raise min_size so fewer prints qualify`), { cls: 'live-stopped', severity: 'note', out: { kind: 'resume-live' } });
1922
+ `(${WRUN_CELL_BLOCK_TOO_LARGE_CODE}). Blocks are never truncated: raise ${wrunTapeFloorSettingWords(context.metadata)} ` +
1923
+ 'so fewer prints qualify'), { cls: 'live-stopped', severity: 'note', out: { kind: 'resume-live' } });
1797
1924
  }
1798
1925
  /** The intake's queue cap dropped live prints of a tape bar that nothing can restore (a live-edge
1799
1926
  * tape, history "0", or a market the large-print table never holds; a restorable loss rides the
@@ -1807,12 +1934,13 @@ function refuseWrunTapeLostBucket(context) {
1807
1934
  const input = wrunTapeInputsOf(context.metadata)[0];
1808
1935
  throw attachWrunRefusal(new WrunTapeLiveRefusal(`WRUN ${context.metadata.id}: input '${input?.name ?? 'tape'}' bar at ts ${bucket} lost live prints to the ` +
1809
1936
  'intake queue cap between drains, and nothing restores them (a live-edge tape with history "0", or a ' +
1810
- 'market the large-print table does not hold), so its block would be incomplete. Raise min_size so ' +
1811
- 'fewer prints qualify, or declare a history so the reconcile can restore them'), { cls: 'live-stopped', severity: 'note', out: { kind: 'resume-live' } });
1937
+ 'market the large-print table does not hold), so its block would be incomplete. Raise ' +
1938
+ `${wrunTapeFloorSettingWords(context.metadata)} so fewer prints qualify, or declare a history so the reconcile ` +
1939
+ 'can restore them'), { cls: 'live-stopped', severity: 'note', out: { kind: 'resume-live' } });
1812
1940
  }
1813
- /** A forming tape block over its input's max_cells (the packer's refusal, in its words, so the
1814
- * record reads the counts): a tape bar's block only grows until the bar closes. An input reading
1815
- * an oversize block as empty (C1.2b) is left to the packer. */
1941
+ /** A forming tape block over the tuples its module holds a bar in (the packer's bound and refusal, in its words, so
1942
+ * the record reads the counts): a tape bar's block only grows until the bar closes. An input reading an oversize
1943
+ * block as empty (C1.2b) is left to the packer. */
1816
1944
  function refuseWrunTapeTailOverCap(context, tailRows) {
1817
1945
  const inputs = wrunTapeInputsOf(context.metadata);
1818
1946
  if (inputs.length === 0)
@@ -1820,14 +1948,14 @@ function refuseWrunTapeTailOverCap(context, tailRows) {
1820
1948
  const width = wrunCellTupleWidths().tape ?? 4;
1821
1949
  for (const row of tailRows) {
1822
1950
  for (const input of inputs) {
1823
- if (input.maxCells === undefined || input.emptyWhenOversize)
1951
+ if (input.emptyWhenOversize)
1824
1952
  continue;
1825
1953
  const tuples = (row.cellBlocks?.get(input.index)?.length ?? 0) / width;
1826
- if (!(tuples > input.maxCells))
1954
+ if (!(tuples > input.capacity))
1827
1955
  continue;
1828
1956
  throw new WrunTapeLiveRefusal(`WRUN ${context.metadata.id}: ${WRUN_CELL_BLOCK_TOO_LARGE_CODE}: input ${input.index} bar at ts ${row.ts} ` +
1829
- `has ${tuples} cells; max_cells is ${input.maxCells}, so the evaluation is refused (a block is never ` +
1830
- `truncated): raise max_cells or min_size`);
1957
+ `has ${tuples} cells; ${wrunCellBoundWords(input.maxCells, input.capacity)}, so the evaluation is refused ` +
1958
+ `(a block is never truncated): raise max_cells or ${wrunTapeFloorSettingWords(context.metadata)}`);
1831
1959
  }
1832
1960
  }
1833
1961
  }
@@ -2296,8 +2424,9 @@ async function integrateWrunLiveTail(tail) {
2296
2424
  // ran with, so a tick never flips a `{{label}}` back to the declared ones.
2297
2425
  texts: wrunTextParamValuesFromSettings(context.metadata, meta.settings),
2298
2426
  // And the legend note (wrun-draft-legend-note.util: the draft's word, an OPRA chain's served
2299
- // tier off the session's chain acquisition), so a tick never drops it.
2300
- legendNote: wrunOverlayLegendNote(meta.settings, context.acquisition.options_chain, context.acquisition),
2427
+ // tier off the session's chain acquisition, a Cloud session's off its newest frame's receipt), so a tick
2428
+ // never drops it.
2429
+ legendNote: wrunOverlayLegendNote(meta.settings, context.acquisition.options_chain, context.acquisition, context.cloudOpraServed),
2301
2430
  position: context.position,
2302
2431
  axis: context.axis,
2303
2432
  colors: context.colors,
@@ -2308,8 +2437,9 @@ async function integrateWrunLiveTail(tail) {
2308
2437
  // reads like the session's and a superseded run's late lookup never
2309
2438
  // retitles it.
2310
2439
  chartNames: wrunSessionChartNamesOf(context),
2311
- // The session market's size unit: an output its `visible_by` leaves out mounts nothing.
2312
- sizeUnit: wrunChartSizeUnit(context.market),
2440
+ // The session market's size unit (an output its `visible_by` leaves out mounts nothing) and its dollar unit
2441
+ // (the batched marks' `units`), the ones its full run handed the children.
2442
+ ...wrunResultMarketUnits(context.market),
2313
2443
  // A session at another interval: the run timeline rides the result
2314
2444
  // (the adapter's projection places its bar-index drawings).
2315
2445
  ...(runSession ? { runTimeline: true } : {}),
@@ -2400,7 +2530,12 @@ async function integrateWrunLiveTail(tail) {
2400
2530
  // The presentation every integrate owes (the full run's twin): the
2401
2531
  // nested visibility a full adapter re-apply or a child remount reset,
2402
2532
  // and the latest-values snapshot the HUD follows per tick.
2403
- presentWrunIntegration(context.chartIndex, indicatorId, context.metadata, meta.settings, outputRows, tc, context.sessionSeed?.initArgs, wrunSessionChartNamesOf(context), runSession?.run);
2533
+ presentWrunIntegration(context.chartIndex, indicatorId, context.metadata, meta.settings, outputRows, tc, context.sessionSeed?.initArgs, wrunSessionChartNamesOf(context), runSession?.run,
2534
+ // A tick carries the session's rows on: a full run refused since keeps its snapshot, so the
2535
+ // numbers it superseded never come back under its chip.
2536
+ 'republish',
2537
+ // The build the chart now shows (applied, or found unchanged against it); a clamped session's covers its window.
2538
+ { emptyTargets: runResult.emptyTargets, partial: context.window?.partial === true });
2404
2539
  context.paintedThroughTs = newestTs;
2405
2540
  context.repaintOwed = false;
2406
2541
  // The retained range an eviction moved, on the "Cells capped" row (design 5).
@@ -2796,7 +2931,7 @@ function laneSourcesOf(context, ohlcvRows) {
2796
2931
  tapeRows: context.tapeRows,
2797
2932
  // The session's own tape floor, the one its lane was asked at (a param-bound floor the plan
2798
2933
  // resolves from these settings).
2799
- settings: wrunTapeFloorSettings(context.metadata, context.acquisition.tape?.minSize),
2934
+ settings: wrunTapeFloorSettings(context.metadata, wrunTapeAcquisitionFloor(context.acquisition.tape)),
2800
2935
  pollLanes: context.pollLanes,
2801
2936
  pollLaneRows: context.pollLaneRows,
2802
2937
  rowLanes: context.rowLanes,
@@ -3161,7 +3296,12 @@ async function fetchWrunReconcileLane(context, ledger, lane, fromTs, toTs, meta)
3161
3296
  // The full run already stamped this overlay's legend; a reconcile
3162
3297
  // must not re-stamp it (every stamp is a legend repaint). A session
3163
3298
  // at another interval asks its lanes at the run interval.
3164
- { ...wrunReconcileRunIntervalOption(context), ...fetchOptions, silentLegend: true }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${spec.type}' for '${context.fetchKey}'`);
3299
+ {
3300
+ ...wrunReconcileRunIntervalOption(context),
3301
+ ...fetchOptions,
3302
+ silentLegend: true,
3303
+ meter: wrunLiveDownloadMeter(context),
3304
+ }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${spec.type}' for '${context.fetchKey}'`);
3165
3305
  // Packed-lane SUCCESS arrives as the packed transport object: unpack it,
3166
3306
  // or a real success misclassifies as a decline.
3167
3307
  if (isPackedOhlcvRows(fetched))
@@ -3220,6 +3360,7 @@ async function askWrunReconcileSourceAnswer(context, ledger, ask, meta) {
3220
3360
  ...(ask.interval === undefined ? wrunReconcileRunIntervalOption(context) : { interval: ask.interval }),
3221
3361
  ...(ask.nativeRows === true ? { nativeRows: true } : {}),
3222
3362
  ...(ask.endExclusive === true ? { endExclusive: true } : {}),
3363
+ meter: ask.meter ?? wrunLiveDownloadMeter(context),
3223
3364
  }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${ask.type}' (${ask.key}) for '${context.fetchKey}'`);
3224
3365
  return Array.isArray(fetched) ? fetched : null;
3225
3366
  }
@@ -3332,8 +3473,11 @@ function wrunReconcileHostGridWindow(context, fromTs, toTs) {
3332
3473
  * or snapshot lane's under the tier rule on the window's host bars and landed on them, a latest lane's once; through
3333
3474
  * its own fetch when it has one, deadline-raced like the chart's. The window opens where the lane's reconcile does
3334
3475
  * (`wrunReconcileLaneWindowFrom`: a governed lane's reaches past its plane's embargo). An instance the context does
3335
- * not hold, or whose lane left the registry, answers empty (which keeps every cached row). */
3336
- async function fetchWrunRowLaneReconcile(context, ledger, laneId, fromTs, toTs, meta) {
3476
+ * not hold, or whose lane left the registry, answers empty (which keeps every cached row). Each ask hands the chart
3477
+ * fetch's verdict, heard on the download charge it makes at its answer, to the read's memo (wrun-row-lanes.util
3478
+ * `ask`). A replay step's read (`replay`, SKYLIT-PARITY L6a) names the replay's cursor (the read keeps its replay
3479
+ * memo, never the add's) and hears the bars no ask confirmed. */
3480
+ async function fetchWrunRowLaneReconcile(context, ledger, laneId, fromTs, toTs, meta, replay) {
3337
3481
  const instance = context.rowLanes?.find((candidate) => candidate.key === laneId);
3338
3482
  const lane = instance === undefined ? undefined : wrunRowLaneByKey(instance.laneKey);
3339
3483
  if (instance === undefined || lane === undefined)
@@ -3345,19 +3489,43 @@ async function fetchWrunRowLaneReconcile(context, ledger, laneId, fromTs, toTs,
3345
3489
  : wrunRowLaneChainAsk(lane, recorded, governedMarketDataTier);
3346
3490
  const laneFetch = lane.fetch;
3347
3491
  const laneFromTs = wrunReconcileLaneWindowFrom(context, laneId, fromTs, toTs);
3348
- const rows = await fetchWrunRowLaneRows(lane, extras, wrunReconcileHostGridWindow(context, laneFromTs, toTs), { fromTs: laneFromTs, toTs }, async (askExtras, from, to) => {
3492
+ const window = wrunReconcileHostGridWindow(context, laneFromTs, toTs);
3493
+ const rows = await fetchWrunRowLaneRows(lane, extras, replay === undefined ? window : { ...window, replayCursorMs: replay.cursorMs }, { fromTs: laneFromTs, toTs }, async (askExtras, from, to, whole) => {
3349
3494
  if (laneFetch !== undefined) {
3350
3495
  ledger.stats.fetches += 1;
3351
- return withWrunDeadline(laneFetch({ extras: askExtras, fromTs: from, toTs: to, intervalMs: context.intervalMs }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${lane.kType}' (${instance.key}) for '${context.fetchKey}'`);
3496
+ const own = await withWrunDeadline(laneFetch({ extras: askExtras, fromTs: from, toTs: to, intervalMs: context.intervalMs }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${lane.kType}' (${instance.key}) for '${context.fetchKey}'`);
3497
+ // A lane's own fetch rides no chart transport (no synthetic completion): its answer is whole once it resolved.
3498
+ whole?.(true);
3499
+ return own;
3352
3500
  }
3353
- return (await askWrunReconcileSource(context, ledger, {
3501
+ let heard;
3502
+ const sessionMeter = wrunLiveDownloadMeter(context);
3503
+ const answer = (await askWrunReconcileSource(context, ledger, {
3354
3504
  type: lane.kType,
3355
3505
  key: instance.key,
3356
3506
  payload: { symbol: 'currentSymbol', exchange: 'currentExchange', ...askExtras },
3357
3507
  fromTs: from,
3358
3508
  toTs: to,
3359
3509
  ...(wrunRowLaneFetchOptions(lane) ?? {}),
3510
+ meter: {
3511
+ charge: (charge) => {
3512
+ if (charge.verdict !== undefined)
3513
+ heard = charge.verdict;
3514
+ sessionMeter.charge(charge);
3515
+ },
3516
+ },
3360
3517
  }, meta));
3518
+ whole?.(wrunSourceVerdictWhole(heard));
3519
+ return answer;
3520
+ }, {
3521
+ // One download budget per add (wrun-row-lane-add-memo.util): the live start and every reconcile reuse what the
3522
+ // add's budgeted run landed, keep what it cut partial, and ask only the rest (a new bar, a bar still forming).
3523
+ ...(wrunDownloadBudgetCutOn()
3524
+ ? {
3525
+ addMemo: { key: wrunRowLaneAddKey(context.chartIndex, context.indicatorId, laneId), role: 'live' },
3526
+ }
3527
+ : {}),
3528
+ ...(replay !== undefined ? { onUnconfirmed: replay.onUnconfirmed } : {}),
3361
3529
  });
3362
3530
  return rows;
3363
3531
  }
@@ -3482,7 +3650,12 @@ async function fetchWrunReconcileLeg(context, ledger, leg, meta) {
3482
3650
  const native = leg.nativeRows === true ? { nativeRows: true } : wrunLegNativeRowsOption(leg, context.market?.exchange);
3483
3651
  const fetchType = wrunLegFetchType(leg);
3484
3652
  const ask = async (fromTs, toTs, options, onSourceVerdict) => {
3485
- const fetched = await withWrunDeadline(wrunChartHostEnv().transport.fetchSource(context.chartIndex, fetchType, { symbol: 'currentSymbol', exchange: 'currentExchange', ...wrunLegPayloadExtras(leg) }, fromTs, toTs, meta, `${context.fetchKey}-live-${suffix}`, false, { silentLegend: true, ...options, ...(onSourceVerdict !== undefined ? { onSourceVerdict } : {}) }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${fetchType}' (${suffix}) for '${context.fetchKey}'`);
3653
+ const fetched = await withWrunDeadline(wrunChartHostEnv().transport.fetchSource(context.chartIndex, fetchType, { symbol: 'currentSymbol', exchange: 'currentExchange', ...wrunLegPayloadExtras(leg) }, fromTs, toTs, meta, `${context.fetchKey}-live-${suffix}`, false, {
3654
+ silentLegend: true,
3655
+ ...options,
3656
+ ...(onSourceVerdict !== undefined ? { onSourceVerdict } : {}),
3657
+ meter: wrunLiveDownloadMeter(context),
3658
+ }), WRUN_SOURCE_FETCH_DEADLINE_MS, `wrun live reconcile fetch '${fetchType}' (${suffix}) for '${context.fetchKey}'`);
3486
3659
  if (isPackedOhlcvRows(fetched))
3487
3660
  return unpackOhlcvRows(fetched);
3488
3661
  return Array.isArray(fetched) ? fetched : [];
@@ -3660,8 +3833,9 @@ function noteWrunRunIntervalLive(context, session, details) {
3660
3833
  * lane's covered watermark advances to the window's end, and a closed bar
3661
3834
  * (before the session watermark) whose value changed reports as revised.
3662
3835
  *
3663
- * Every answered row is installed whatever its stamp, so a revision is
3664
- * looked for over every row the answer can replace: from the window's start
3836
+ * Every answered row is installed whatever its stamp (but a row lane drawing
3837
+ * its first slice alone, `rowLaneFilling`, takes none before the slice), so a
3838
+ * revision is looked for over every row the answer can replace: from the window's start
3665
3839
  * or the earliest answered row, whichever is earlier. A control may answer
3666
3840
  * rows stamped before its window (a monthly series answers the month its
3667
3841
  * window opens inside, stamped on the 1st); such a row used to overwrite the
@@ -3679,7 +3853,12 @@ servedStartMs) {
3679
3853
  // window's day, the lane's lookback earlier): the answer is authoritative
3680
3854
  // from there, and a revised or late-published day is detected from there,
3681
3855
  // not from the chart-bar window.
3682
- const windowFrom = wrunReconcileLaneWindowFrom(context, lane, fromTs, toTs);
3856
+ // A row lane drawing its first slice alone (`rowLaneFilling`, by the slice's first bar): the reconcile lands none of
3857
+ // its rows before that bar. Those bars read partial until the fill, with the earlier bars of their session, so a row
3858
+ // landed on one would sum a session from its middle; the fill's own run lands them all.
3859
+ const fillFromTs = isWrunRowLaneId(lane) ? context.rowLaneFilling?.[lane] : undefined;
3860
+ const windowFrom = Math.max(wrunReconcileLaneWindowFrom(context, lane, fromTs, toTs), fillFromTs ?? Number.NEGATIVE_INFINITY);
3861
+ const answerRowsInWindow = fillFromTs === undefined ? answerRows : answerRows.filter((row) => Number(row[0]) >= fillFromTs);
3683
3862
  const before = laneRowsOf(context, lane) ?? [];
3684
3863
  // The tape lane answers DENSE rows from its served start only: K_TRADES aligns and clamps the
3685
3864
  // history start (the declared history, the gateway's bar limit, the table's retention), so a
@@ -3699,7 +3878,7 @@ servedStartMs) {
3699
3878
  ? answerRows
3700
3879
  : wrunTapeAnswerWithoutPartialHead(answerRows, servedStartMs, context.intervalMs, context.market?.exchange), before)
3701
3880
  : isWrunRowLaneId(lane)
3702
- ? wrunRowLaneReconcileAnswer(context, lane, before, answerRows)
3881
+ ? wrunRowLaneReconcileAnswer(context, lane, before, answerRowsInWindow)
3703
3882
  : answerRows;
3704
3883
  const horizonTs = lane === 'tape' ? wrunTapeAnswerHorizonTs(answer) : Number.NEGATIVE_INFINITY;
3705
3884
  // A row lane fed live with a union rule of its own (`liveByCoin.reconcile`) keeps, like the tape, every held bar the
@@ -3901,18 +4080,27 @@ function wrunTapeAnswerWithoutPartialHead(answer, servedStartMs, intervalMs, exc
3901
4080
  return answer;
3902
4081
  return answer.filter((row) => Number(row[0]) !== horizonTs);
3903
4082
  }
3904
- /** A tape print's identity in a union: its whole `[offsetMs, price, size, side]` tuple. */
3905
- function wrunTapeCellKey(cell) {
3906
- return `${cell[0]}|${cell[1]}|${cell[2]}|${cell[3]}`;
4083
+ /** A tape print's place in a union: its `[offsetMs, price, size, side]` tuple without the size, the columns both
4084
+ * copies of one print carry bit for bit (the stamp and the price as the venue sent them, the side). */
4085
+ function wrunTapePrintPlaceKey(cell) {
4086
+ return `${cell[0]}|${cell[1]}|${cell[3]}`;
3907
4087
  }
3908
4088
  /**
3909
4089
  * A tape answer folded over the held rows: each answered bucket with a held row becomes the union
3910
- * of both rows' prints, a multiset union by tuple (a print the two share is kept once, two equal
4090
+ * of both rows' prints, a multiset union by print (a print the two share is kept once, two equal
3911
4091
  * prints of one row stay two), in time order with the answer's prints first among equal offsets.
3912
4092
  * A reconcile only ever adds prints to a bar: the large-print table holds no print of a quote it
3913
4093
  * does not price, and the live floors can still keep a print it lacks (a contract's notional, a
3914
4094
  * print the writer had not committed when the ask landed), so a print shown live never vanishes
3915
4095
  * on the next poll.
4096
+ *
4097
+ * A print is the same print in both rows when its stamp, price and side are equal and its size agrees within float
4098
+ * rounding (`laneValuesEqual`, the session's own noise rule): two hosts compute one print's size, and under a dollar
4099
+ * floor (C-DOLLAR) they compute it differently, the gateway's writer on the stored row (an inverse contract's dollar
4100
+ * face), this browser as price x the live-feed COIN-arm size x the market's dollar unit: Binance delivery BTCUSD_PERP
4101
+ * trade 1160180465 (2026-10-22, tests/fixtures/wrun/tape-live-history-pairs.json) is $179,300 stored and
4102
+ * 84,428.9 x 2.12368039853652 = 179299.99999999997 live. Two equal prints still stay two: each held print matches one
4103
+ * answer print at most.
3916
4104
  */
3917
4105
  function wrunTapeAnswerUnion(answer, held) {
3918
4106
  if (held.length === 0)
@@ -3924,21 +4112,26 @@ function wrunTapeAnswerUnion(answer, held) {
3924
4112
  const previous = heldByTs.get(Number(row[0]));
3925
4113
  if (previous === undefined || previous.length <= 1)
3926
4114
  return row;
4115
+ // The answer's sizes not matched yet, by the place of their print.
3927
4116
  const unmatched = new Map();
3928
4117
  const cells = [];
3929
4118
  for (let at = 1; at < row.length; at += 1) {
3930
4119
  const cell = row[at];
3931
4120
  cells.push(cell);
3932
- const key = wrunTapeCellKey(cell);
3933
- unmatched.set(key, (unmatched.get(key) ?? 0) + 1);
4121
+ const key = wrunTapePrintPlaceKey(cell);
4122
+ const sizes = unmatched.get(key);
4123
+ if (sizes === undefined)
4124
+ unmatched.set(key, [cell[2]]);
4125
+ else
4126
+ sizes.push(cell[2]);
3934
4127
  }
3935
4128
  const extra = [];
3936
4129
  for (let at = 1; at < previous.length; at += 1) {
3937
4130
  const cell = previous[at];
3938
- const key = wrunTapeCellKey(cell);
3939
- const left = unmatched.get(key) ?? 0;
3940
- if (left > 0)
3941
- unmatched.set(key, left - 1);
4131
+ const sizes = unmatched.get(wrunTapePrintPlaceKey(cell));
4132
+ const match = sizes === undefined ? -1 : sizes.findIndex((size) => laneValuesEqual(size, cell[2]));
4133
+ if (match >= 0)
4134
+ sizes?.splice(match, 1);
3942
4135
  else
3943
4136
  extra.push(cell);
3944
4137
  }
@@ -3962,9 +4155,12 @@ function wrunTapeServedStartMs(context, windowFromTs, nowMs) {
3962
4155
  catch {
3963
4156
  // The full run validated the history; a malformed record reads as the live edge.
3964
4157
  }
3965
- // The lane the ask rode (tradesLaneLimits, the control's own rule): the table's retention and bar
3966
- // limit, or the raw tape's two-hour seed on a CME Group root the table skips.
3967
- const lane = tradesLaneLimits(context.acquisition.tape?.large === true, context.market ?? {});
4158
+ // The lane the ask rode (tradesLaneLimits, the control's own rule, under the acquisition's floor): the table's
4159
+ // retention and bar limit, the raw tape's two-hour seed on a CME Group root the table skips, or no history at all
4160
+ // for a dollar floor there.
4161
+ const lane = tradesLaneLimits(context.acquisition.tape?.large === true, context.market ?? {}, {
4162
+ minValue: context.acquisition.tape?.minValue,
4163
+ });
3968
4164
  return tradesServedStartMs(nowMs, Math.min(historySec, lane.historyCapSec), context.intervalMs, {
3969
4165
  windowFromMs: windowFromTs,
3970
4166
  retentionSec: lane.retentionSec,
@@ -4863,7 +5059,8 @@ function publishWrunDebugTick(context, outputRows) {
4863
5059
  if (wrunDebugSlotIndex(context.metadata) === undefined)
4864
5060
  return;
4865
5061
  const store = wrunChartHostEnv().chart.chartStore();
4866
- store.setIndicatorPrintOutputs(context.chartIndex, context.indicatorId, selectWrunDebugLines(context.metadata, outputRows));
5062
+ // The session's own console provenance (the run that installed it), never the chart's market now.
5063
+ store.setIndicatorPrintOutputs(context.chartIndex, context.indicatorId, selectWrunDebugLines(context.metadata, outputRows), { opra: context.opraRead === true });
4867
5064
  }
4868
5065
  export function __resetWrunLiveTickForTests() {
4869
5066
  for (const state of tickStates.values()) {
@@ -0,0 +1,53 @@
1
+ /** One carry into a contracts param (`to`), from the raw count's old name (`raw`) or the changed dollar param
2
+ * (`dollars`). */
3
+ export interface WrunContractCarryRule {
4
+ readonly to: string;
5
+ readonly raw: string;
6
+ readonly dollars: string;
7
+ }
8
+ /** The contracts carries by package, by param name (never by version: every saved version moves the same way).
9
+ * tests/utility/wrun/wrun-market-size-contract-carry.leaf.spec.ts holds each row to the 0.8.0 sheet and its dollar
10
+ * rule. */
11
+ export declare const WRUN_CONTRACT_CARRIES: Readonly<Record<string, readonly WrunContractCarryRule[]>>;
12
+ /** The record's stamp of a pending migration carry (above): `true` from the pin move until a run head settles it. */
13
+ export declare const WRUN_CONTRACT_CARRY_PENDING = "wrunContractCarryPending";
14
+ /** A pending contracts carry: the rule and what it carries from (`raw`: the count itself; `dollars`: a dollar value
15
+ * priced at the market's dollars per contract; `stale`: a raw count a later dollar choice of the user's replaced,
16
+ * cleared and carried nowhere). */
17
+ export type WrunPendingContractCarry = WrunContractCarryRule & ({
18
+ readonly from: 'raw';
19
+ readonly count: number;
20
+ } | {
21
+ readonly from: 'dollars';
22
+ readonly value: number;
23
+ } | {
24
+ readonly from: 'stale';
25
+ });
26
+ /**
27
+ * The smallest whole contract count at or above `dollars` at `perContract` dollars a contract: `ceil(dollars /
28
+ * perContract)`, the float noise of a count priced back taken off first (6.9999999999 is 7, never 8). Undefined when
29
+ * either is not finite and above zero (the carry waits, never guesses).
30
+ */
31
+ export declare function wrunCarriedContracts(dollars: unknown, perContract: number): number | undefined;
32
+ /**
33
+ * The contracts carries a record (`settings`: its `scriptInputs` rows and each value flat under its row's name) holds
34
+ * for a sheet declaring `sheetParams`, on a market of size unit `sizeUnit`, in table order: none off contracts, none
35
+ * for a contracts param the sheet does not declare or the user already set (or a carry marked). Pure.
36
+ */
37
+ export declare function wrunPendingContractCarries(settings: unknown, packageName: string | undefined, sheetParams: ReadonlySet<string>, sizeUnit: number | undefined): WrunPendingContractCarry[];
38
+ /**
39
+ * Whether the run head settles the record's migration stamp now (`WRUN_CONTRACT_CARRY_PENDING` cleared on the engine
40
+ * copy and the workspace row): a stamped record, on a sheet declaring its package's contracts params (the version the
41
+ * stamp moved it to), at once on a market that does not count contracts (nothing converts there, and nothing may later),
42
+ * and on one that does once no dollar carry of `pending` waits on its price (`perContract` unproven: the next run asks
43
+ * again). Pure.
44
+ */
45
+ export declare function wrunContractCarrySettles(settings: unknown, packageName: string | undefined, sheetParams: ReadonlySet<string>, sizeUnit: number | undefined, pending: readonly WrunPendingContractCarry[], perContract: number | undefined): boolean;
46
+ /**
47
+ * The patch that carries a record's pending contracts carries once (above): each contracts value (a raw count as it
48
+ * is, a dollar value at `perContract` dollars a contract, `wrunCarriedContracts`), held to its row's bounds, written
49
+ * flat under the contracts param with its row marked (`carriedValue`); the old name cleared; the dollar row back to
50
+ * untouched (its row default, its mark dropped). A dollar carry with no proven `perContract` writes nothing (the next
51
+ * run asks again). Undefined when nothing moves. Pure.
52
+ */
53
+ export declare function wrunContractCarryPatch(settings: unknown, pending: readonly WrunPendingContractCarry[], perContract: number | undefined): Record<string, unknown> | undefined;