@orangecharts/wrun-chart-host 0.4.0 → 0.5.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 (322) hide show
  1. package/README.md +15 -4
  2. package/dist/constants/exchange-names.leaf.d.ts +8 -0
  3. package/dist/constants/exchange-names.leaf.js +101 -0
  4. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
  5. package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +19 -0
  7. package/dist/constants/opra-compliance.constants.js +19 -0
  8. package/dist/constants/replay-ladder.leaf.d.ts +30 -0
  9. package/dist/constants/replay-ladder.leaf.js +99 -0
  10. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  11. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  12. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  13. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  14. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  15. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  16. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  17. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  18. package/dist/host-env.d.ts +313 -18
  19. package/dist/host-env.js +15 -0
  20. package/dist/host-ports.types.d.ts +853 -16
  21. package/dist/index.d.ts +139 -2
  22. package/dist/index.js +139 -2
  23. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  24. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  25. package/dist/interfaces/market-event.interface.d.ts +231 -0
  26. package/dist/interfaces/market-event.interface.js +15 -0
  27. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  28. package/dist/interfaces/opra-realtime.interface.js +34 -59
  29. package/dist/interfaces/replay.interface.d.ts +285 -0
  30. package/dist/interfaces/replay.interface.js +1 -0
  31. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  32. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  33. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  34. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  35. package/dist/market-data/billing.interface.d.ts +219 -0
  36. package/dist/market-data/billing.interface.js +58 -0
  37. package/dist/market-data/venue-governed.util.d.ts +2 -0
  38. package/dist/market-data/venue-governed.util.js +10 -0
  39. package/dist/market-data/venue.d.ts +122 -0
  40. package/dist/market-data/venue.js +1 -0
  41. package/dist/market-data/venues/index.d.ts +97 -0
  42. package/dist/market-data/venues/index.js +33 -0
  43. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  44. package/dist/market-data/venues/opra.d.ts +70 -0
  45. package/dist/market-data/venues/opra.js +74 -0
  46. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  47. package/dist/replay/replayIndicatorRows.js +117 -0
  48. package/dist/replay/replayLadder.d.ts +85 -0
  49. package/dist/replay/replayLadder.js +388 -0
  50. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  51. package/dist/utility/auth/server-clock.util.js +238 -0
  52. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  53. package/dist/utility/chart/builtin-identity.util.js +51 -0
  54. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  55. package/dist/utility/chart/cache-alignment.util.js +926 -0
  56. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  57. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  58. package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
  59. package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
  60. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  61. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  62. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  63. package/dist/utility/chart/color-customization.leaf.js +16 -0
  64. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  65. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  66. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  67. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  68. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  69. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  70. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  71. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  72. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  73. package/dist/utility/chart/index-host-tier.util.js +118 -0
  74. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  75. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  76. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  77. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  78. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  79. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  80. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  81. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  82. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  83. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  84. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  85. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  86. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  87. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  88. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  89. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  90. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  91. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  92. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  93. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  94. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  95. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  96. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  97. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  98. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  99. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  100. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  101. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  102. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  103. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  104. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  105. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  106. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  107. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  108. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  109. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  110. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  111. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  112. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  113. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  114. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  115. package/dist/utility/chart/live-cadence.util.js +37 -0
  116. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  117. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  118. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  119. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  120. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  121. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  122. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  123. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  124. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  125. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  126. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  127. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  128. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  129. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  130. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  131. package/dist/utility/chart/mixed-mode.util.js +139 -0
  132. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  133. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  134. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  135. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  136. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  137. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  138. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  139. package/dist/utility/chart/price-precision.util.js +70 -0
  140. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  141. package/dist/utility/chart/profile-block-size.util.js +141 -0
  142. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  143. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  144. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  145. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  146. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  147. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  148. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  149. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  150. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  151. package/dist/utility/chart/titan-constants.pin.js +18 -5
  152. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  153. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  154. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  155. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  156. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  157. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  158. package/dist/utility/common/data-processing.util.d.ts +138 -0
  159. package/dist/utility/common/data-processing.util.js +346 -0
  160. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  161. package/dist/utility/common/visible-timeout.util.js +23 -8
  162. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  163. package/dist/utility/exchange-format.leaf.js +47 -0
  164. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  165. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  166. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  167. package/dist/utility/market-events/market-events.util.js +392 -0
  168. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  169. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  170. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  171. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  172. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  173. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  174. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  175. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  176. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  177. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  178. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  179. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  180. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  181. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  182. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  183. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
  184. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
  185. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  186. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  187. package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
  188. package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
  189. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  190. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  191. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  192. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  193. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  194. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  195. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  196. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  197. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  198. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  199. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  200. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  201. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  202. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  203. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  204. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  205. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  206. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  207. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  208. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  209. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  210. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  211. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  212. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  213. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  214. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  215. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  216. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  217. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  218. package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
  219. package/dist/utility/wrun/wrun-host.service.js +655 -0
  220. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  221. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  222. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  223. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  224. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  225. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  226. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  227. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  228. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  229. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  230. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  231. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  232. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  233. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  234. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  235. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  236. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  237. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  238. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  239. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  240. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  241. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  242. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  243. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  244. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  245. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  246. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  247. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  248. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  249. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  250. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  251. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  252. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  253. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  254. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  255. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  256. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  257. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  258. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  259. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  260. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
  261. package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
  262. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  263. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  264. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  265. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  266. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  267. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  268. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  269. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  270. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  271. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  272. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  273. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  274. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  275. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  276. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  277. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  278. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  279. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  280. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  281. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  282. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  283. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  284. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  285. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  286. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  287. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  288. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  289. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  290. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  291. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  292. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  293. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  294. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  295. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  296. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  297. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  298. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  299. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  300. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  301. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  302. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  303. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  304. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  305. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  306. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  307. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  308. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  309. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  310. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  311. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  312. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  313. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  314. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  315. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  316. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  317. package/dist/utils/replay/replay-buffer-math.js +684 -0
  318. package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
  319. package/dist/workers/wrun/wrun-abi-host.js +1201 -0
  320. package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
  321. package/dist/workers/wrun/wrun-engine-handler.js +211 -0
  322. package/package.json +3 -3
@@ -0,0 +1,114 @@
1
+ import type { WrunLaneRevision, WrunOverlayLiveContext } from './wrun-overlay-drivers.util.js';
2
+ import type { WrunLiveLane } from './wrun-live-intake.util.js';
3
+ import { type WrunChartSourceRows } from './wrun-source-rows.util.js';
4
+ import { type WrunPollLaneInstance } from './sources/wrun-poll-lane.types.js';
5
+ /** The clause of the lanes rule that refuses, which the skip reason names (`lanes:<clause>`):
6
+ * - `input-source`: an input outside every admitted source (a `time` input with a key of its own, or a time field
7
+ * past the bar's open and its trade date, included);
8
+ * - `primary-carry`: a primary (input 0) under carry (the default the stamp admits on input 0) that reads a lane a
9
+ * page asks again: its first page rows carry observations from before the page, which a whole run reads off its
10
+ * hidden lane head and a page never asks (an explicit `missing: "nan"` or `"zero"` primary is admitted, and so is
11
+ * one whose lane holds no row: undemanded, or never dispatched);
12
+ * - `legs` (a pinned, period, intrabar, candles or odds leg, and a trades input pinned to another market: its leg lane
13
+ * is asked on that market, which a page does not ask again), `preroll` (a forming pre-roll), `degraded` (a lane the
14
+ * session's run computed without);
15
+ * - `vp`, `iv`, `daily`, `tape-history`, `carry-cache`, `worker-empty`: a feed a page cannot ask again exactly (above);
16
+ * - `index-mode`: a fetched lane on an index-mode chart; `live-row`: the options chain's snapshot inside the window;
17
+ * - `book-transport` (a book fetched without the packed transport), `book-missing` (a served book input with no
18
+ * book lane);
19
+ * - `poll`: a poll lane the session holds no instance for; a lane's own name: a fetched lane this rule does not
20
+ * know, or a served lane an input demands that the session never fetched. */
21
+ export type WrunPrefixLaneClause = 'input-source' | 'primary-carry' | 'legs' | 'poll' | 'preroll' | 'degraded' | 'book-transport' | 'book-missing' | 'vp' | 'iv' | 'daily' | 'tape-history' | 'carry-cache' | 'worker-empty' | 'index-mode' | 'live-row' | Exclude<WrunLiveLane, 'book'>;
22
+ /** The row-builder lanes a prefix page asks again. */
23
+ export type WrunPrefixAskLane = 'trades' | 'trades_usd' | 'oi' | 'funding' | 'liquidations' | 'trade_volume_by_size';
24
+ /** Each asked lane: the fetch type the full run rode, the fetch-key suffix of the page's ask
25
+ * (`<fetchKey>-prefix-<suffix>`, the full run's own suffix) and the buffer the session holds it in. */
26
+ export declare const WRUN_PREFIX_ASK_LANES: Readonly<Record<WrunPrefixAskLane, {
27
+ type: string;
28
+ suffix: string;
29
+ rows: keyof WrunOverlayLiveContext & keyof WrunChartSourceRows;
30
+ }>>;
31
+ /** The fetch-key suffix of a poll lane instance's page ask: `poll-<instance id>`. */
32
+ export declare function wrunPrefixPollSuffix(instance: Pick<WrunPollLaneInstance, 'key'>): string;
33
+ /** What a prefix page asks again: the row-builder lanes, then the poll lane instances (the book keeps its own ask). */
34
+ export interface WrunPrefixLanePlan {
35
+ builtin: WrunPrefixAskLane[];
36
+ poll: WrunPollLaneInstance[];
37
+ }
38
+ /**
39
+ * The lanes rule (C1 v3, widened for the per-bar stamp and the roster 2026-10-14): the clause that refuses
40
+ * (`WrunPrefixLaneClause`), or what a page asks again. Inputs first, in declaration order (the first refusal wins),
41
+ * then the session's legs, pre-roll and degraded lanes, then every lane the session fetched (its acquisition record)
42
+ * and every poll lane instance, the index-mode chart, last a book input with no book lane. An exact warm-up session
43
+ * reading any of these keeps its own refusal (`warmup-lanes`): its hidden head is candles only.
44
+ */
45
+ export declare function planWrunPrefixLanes(context: WrunOverlayLiveContext): {
46
+ refused: WrunPrefixLaneClause;
47
+ } | {
48
+ plan: WrunPrefixLanePlan;
49
+ };
50
+ /** The lanes rule's clause for a session, null when it admits (`planWrunPrefixLanes`). */
51
+ export declare function wrunPrefixLaneClauseOf(context: WrunOverlayLiveContext): WrunPrefixLaneClause | null;
52
+ /** Whether a planned window reaches the session's live row while the session's options chain lane holds a snapshot
53
+ * (`live-row`): the build lands the chain on its LAST grid row only, so a window ending before the live row reads the
54
+ * empty block a whole run's older bars read, and one reaching it cannot (an empty build would differ there). */
55
+ export declare function wrunPrefixLiveRowRefused(context: WrunOverlayLiveContext, toMs: number): boolean;
56
+ /** The rows of a page answer strictly before `beforeTs` (the session's first row): the chart's fetch pads the end of
57
+ * an explicit window by one source interval, so the answer can reach the session's own rows, which stay the
58
+ * session's. */
59
+ export declare function wrunPrefixPageRows<Row extends ArrayLike<unknown>>(rows: ReadonlyArray<Row>, beforeTs: number): Row[];
60
+ /** The page answers a prefix run staged, by lane (a poll instance by its id): rows strictly before the session's
61
+ * first row (`wrunPrefixPageRows`). */
62
+ export type WrunPrefixLanePages = ReadonlyMap<string, ReadonlyArray<ArrayLike<unknown>>>;
63
+ /** One lane's rows as the overlap proof reads them (`WrunPrefixEvidence.lanes`). */
64
+ export interface WrunPrefixLaneEvidence {
65
+ lane: string;
66
+ rows: ReadonlyArray<ArrayLike<unknown>>;
67
+ }
68
+ /**
69
+ * The window build's lane rows (C1 v3 window split): every lane field the row builder reads, as the whole run's row
70
+ * build hands them. An asked lane: its page, then the session's own rows over the overlap `[firstRowTs, toMs]` (the
71
+ * very objects the session holds). The tape (a live edge): the session's own rows over the overlap, none before (a
72
+ * live-edge tape serves no history). Every other lane the session holds: empty (the options chain, a lane the
73
+ * capability rule never dispatched); a lane it never held stays absent. The tape's floor settings and the poll lane
74
+ * instances ride along. Beside it the window's lane evidence (the proof's prefix side, `wrunPrefixHeldLanes` the
75
+ * mounted side): every asked lane and the tape.
76
+ */
77
+ export declare function wrunPrefixWindowLanes(context: WrunOverlayLiveContext, plan: WrunPrefixLanePlan, pages: WrunPrefixLanePages, firstRowTs: number, toMs: number): {
78
+ sourceRows: Partial<WrunChartSourceRows>;
79
+ lanes: WrunPrefixLaneEvidence[];
80
+ };
81
+ /** The session's buffers of the lanes a window's evidence names (`wrunPrefixWindowLanes`), as they stand now: the
82
+ * proof's mounted side. */
83
+ export declare function wrunPrefixHeldLanes(context: WrunOverlayLiveContext, plan: WrunPrefixLanePlan): WrunPrefixLaneEvidence[];
84
+ /** The buffers a landed page leaves its session (`wrunPrefixLaneSplice`): each asked row-builder lane's by its field,
85
+ * each poll instance's by its id. */
86
+ export interface WrunPrefixLaneSplice {
87
+ builtin: Array<[field: (typeof WRUN_PREFIX_ASK_LANES)[WrunPrefixAskLane]['rows'], rows: ArrayLike<unknown>[]]>;
88
+ poll: Record<string, ArrayLike<unknown>[]>;
89
+ }
90
+ /**
91
+ * The commit's splice, all or none: every asked lane's buffer becomes its page, then the session's rows from its first
92
+ * row on, read as the buffer stands now (a fold since the prepare is kept; the rows before the first row, a whole run's
93
+ * hidden lane head among them, give way to the page). Null when an asked lane has no buffer to splice: the page must
94
+ * not land (a reseed would compute it without that lane's rows). The book, the tape and the options chain are not
95
+ * spliced here (the book's is the caller's; the others asked nothing, and their buffers stay the session's).
96
+ */
97
+ export declare function wrunPrefixLaneSplice(context: WrunOverlayLiveContext, plan: WrunPrefixLanePlan, pages: WrunPrefixLanePages, firstRowTs: number): WrunPrefixLaneSplice | null;
98
+ /** Write a splice onto its session (synchronous; a poll instance's buffers as a new record, the reseed and the tail
99
+ * builder read the context's own). */
100
+ export declare function applyWrunPrefixLaneSplice(context: WrunOverlayLiveContext, splice: WrunPrefixLaneSplice): void;
101
+ /** The span of timestamps at or after `fromTs` where two buffers differ exactly (a row on one side only, or any
102
+ * value), null when none does. */
103
+ export declare function wrunLaneRevisionSpan(before: ReadonlyArray<ArrayLike<unknown>>, after: ReadonlyArray<ArrayLike<unknown>>, fromTs: number): WrunLaneRevision | null;
104
+ /** Record a reconcile's replacement of a lane's buffer (`before` to `after`, the rows from `fromTs` on the answer could
105
+ * reach) on the session, tolerated float noise included: a new record (the reseed compares it by identity). */
106
+ export declare function noteWrunLaneRevision(context: WrunOverlayLiveContext, lane: WrunLiveLane, before: ReadonlyArray<ArrayLike<unknown>>, after: ReadonlyArray<ArrayLike<unknown>>, fromTs: number): void;
107
+ /**
108
+ * Whether the session's mounted outputs over `[fromTs, toTs]` (a prefix's overlap) may rest on inputs other than the
109
+ * ones its buffers hold now, so an output mismatch there proves nothing against the module: a lane row a reconcile
110
+ * replaced since the outputs were last computed whole (`laneRevisions`), a late input or a revised closed candle a
111
+ * reseed still owes (`dirtyFromTs`), or an options chain snapshot stamped inside it (it lands on whichever row was the
112
+ * live one when it was computed).
113
+ */
114
+ export declare function wrunPrefixOverlapUnproven(context: WrunOverlayLiveContext, fromTs: number, toTs: number): boolean;
@@ -0,0 +1,486 @@
1
+ /**
2
+ * The lanes a pan-back prefix run computes over (C1 v3; prefix feeds, 2026-10-14). A prefix run computes the bars a
3
+ * page added in front of a live session plus a 32-row overlap with it, then lands the page before the session's
4
+ * rows. Its candles are the chart's own rows; every other feed the session read is judged here, lane by lane:
5
+ *
6
+ * - The rule (`planWrunPrefixLanes`): admitted with a window ask (the page is asked again under its own fetch key
7
+ * with the session's recorded acquisition): buy/sell volume (`trades`, `trades_usd`), open interest, funding,
8
+ * liquidations, trade volume by size and the bar-joined registry poll lanes (a relay `series` through its own
9
+ * fetch), each read per bar. Admitted with NO ask (the fill or an empty block on every page row, exactly as a whole
10
+ * run's older bars read them): the options chain (its live snapshot lands on the build's last row only), a
11
+ * live-edge tape (`history` "0"), an undemanded input and a lane the capability rule never dispatched
12
+ * (`unservedLanes`). The book keeps its own packed ask (`book-transport`, `book-missing`). Every other feed refuses
13
+ * by a named clause: a feed primary under carry (`primary-carry`), the volume profile (`vp`), the option summaries
14
+ * (`iv`), the daily-joined lanes (`daily`), legs and odds (`legs`), the forming pre-roll (`preroll`), a degraded
15
+ * lane (`degraded`), a tape with history (`tape-history`), ETF holdings (`carry-cache`: its worker carries across
16
+ * requests), the options OI and options volume lanes (`worker-empty`: their workers answer a failed upstream as an
17
+ * empty page), any fetched lane on an index-mode chart (`index-mode`: the chart's fetch replaces an explicit window
18
+ * with the chart's whole span there), and an options chain whose snapshot would land inside the window
19
+ * (`live-row`, judged against the planned window, `wrunPrefixLiveRowRefused`).
20
+ * - The window split (`wrunPrefixWindowLanes`): each asked lane's page is `[fromMs, firstRowTs)` (the answer cut
21
+ * strictly before the session's first row: the transport pads its inclusive end); the overlap
22
+ * `[firstRowTs, toMs]` takes the session's OWN rows, so the guest computes the overlap on the very row objects
23
+ * the session holds and the proof's lane evidence (`wrunPrefixHeldLanes`, the mounted side) compares them by
24
+ * identity first. A live-edge tape takes the session's own rows over the overlap too (live prints exact-join).
25
+ * - The splice (`wrunPrefixLaneSplice`, `applyWrunPrefixLaneSplice`): every asked lane's buffer becomes the page
26
+ * then the session's rows from its first row on, decided at the commit before anything applies, all or none; the
27
+ * commit then starts the session's lanes (`lanesFromTs`) at the page's first bar, the certified start.
28
+ * - The revisions (`noteWrunLaneRevision`, `wrunPrefixOverlapUnproven`): a live reconcile that replaces a buffer row
29
+ * with another value (exactly: its tolerated float noise included) records the span, until a reseed computes the
30
+ * session's outputs whole again. An overlap such a span reaches rests on values the mounted outputs never read, so
31
+ * an output mismatch there is the data's, never the module's: the prefix rejects without latching.
32
+ *
33
+ * Pure and synchronous: the asks themselves ride the run pass's lane machinery (wrun-overlay-run.util
34
+ * `acquireWrunPrefixLanePages`).
35
+ */
36
+ import { checkIsIndexMode } from '../chart/index-mode.util.js';
37
+ import { wrunInputReadsChartFeed } from './wrun-bar-count.util.js';
38
+ import { wrunSourceLane } from './wrun-source-rows.util.js';
39
+ import { wrunPollLaneByKey, wrunPollLanesOfClass } from './sources/registry.js';
40
+ import { isWrunPollLaneId } from './sources/wrun-poll-lane.types.js';
41
+ import { parseWrunTapeHistory, wrunTapeFloorSettings, wrunTapeHistoryOf } from './wrun-tape-source.util.js';
42
+ import { isWrunTradesLegLane } from './wrun-trades-lane.util.js';
43
+ import { isWrunLegStreamClass } from './wrun-leg-stream-classes.js';
44
+ /** Each asked lane: the fetch type the full run rode, the fetch-key suffix of the page's ask
45
+ * (`<fetchKey>-prefix-<suffix>`, the full run's own suffix) and the buffer the session holds it in. */
46
+ export const WRUN_PREFIX_ASK_LANES = {
47
+ trades: { type: 'buy_sell_volume', suffix: 'bsv', rows: 'buySellVolumeRows' },
48
+ trades_usd: { type: 'buy_sell_volume', suffix: 'bsvusd', rows: 'buySellVolumeUsdRows' },
49
+ oi: { type: 'open_interest', suffix: 'oi', rows: 'openInterestRows' },
50
+ funding: { type: 'funding_rate', suffix: 'fr', rows: 'fundingRateRows' },
51
+ liquidations: { type: 'liquidations', suffix: 'liq', rows: 'liquidationRows' },
52
+ trade_volume_by_size: { type: 'trade_volume_by_size', suffix: 'tvbs', rows: 'tradeVolumeBySizeRows' },
53
+ };
54
+ /** The fetch-key suffix of a poll lane instance's page ask: `poll-<instance id>`. */
55
+ export function wrunPrefixPollSuffix(instance) {
56
+ return `poll-${instance.key}`;
57
+ }
58
+ /** The row-builder lanes a prefix run reads with no ask, by their buffer: the window build reads them empty (the
59
+ * tape: the session's own rows from its first row on, `wrunPrefixWindowLanes`). */
60
+ const WRUN_PREFIX_NO_ASK_ROWS = [
61
+ 'volumeProfileRows',
62
+ 'impliedVolatilityRows',
63
+ 'skewRows',
64
+ 'optionsChainRows',
65
+ 'etfFlowRows',
66
+ ];
67
+ /** The chart's own time fields a prefix run computes over beside its candles: a bar's open (`bar_open_sec`) and its
68
+ * trade date (`trade_date`, a fact of the bar's open on the chart's market and interval). Each is read off the candle
69
+ * row it rides, so a page's rows (its warm-up head's included) carry exactly the values a whole run's rows carry for
70
+ * the same bars; admitted in the chart-feed shape only (`wrunInputReadsChartFeed`), never with a market or an
71
+ * interval of its own. */
72
+ const WRUN_PREFIX_TIME_FIELDS = new Set(['bar_open_sec', 'trade_date']);
73
+ /** The poll lanes whose answer a page cannot trust, by source class, with the clause that names why: ETF holdings
74
+ * carries values across requests (its worker's cross-request cache), and the options OI and options volume workers
75
+ * answer an upstream failure as an ordinary empty page. */
76
+ const WRUN_PREFIX_POLL_REFUSALS = {
77
+ etf_holdings: 'carry-cache',
78
+ options_oi: 'worker-empty',
79
+ options_volume: 'worker-empty',
80
+ };
81
+ /** The seconds a tape's declared `history` reaches back (0 for the live edge), NaN for a spelling the lane refuses. */
82
+ function wrunPrefixTapeHistorySeconds(metadata, history) {
83
+ try {
84
+ return parseWrunTapeHistory(metadata, 'tape', wrunTapeHistoryOf({ history: history }));
85
+ }
86
+ catch {
87
+ return Number.NaN;
88
+ }
89
+ }
90
+ /** Whether the capability rule kept a lane from dispatch on the session's market (the whole run's own verdict,
91
+ * `unservedLanes`; a trades input of either quote judged under its source class, as the rule judges it). */
92
+ function wrunPrefixUnserved(context, lane) {
93
+ const unserved = context.unservedLanes;
94
+ if (unserved === undefined)
95
+ return false;
96
+ return unserved.has(lane) || ((lane === 'trades' || lane === 'trades_usd') && unserved.has('trades'));
97
+ }
98
+ /** Whether an input that reads a lane a page asks again is a primary (input 0) under carry: a scalar input that
99
+ * declares no `missing: "nan"` or `"zero"` (the kit reads input 0's absent policy as carry, and its stamp admits it
100
+ * there because the primary walks its own grid). A cell block reads an empty block, never a carried one. */
101
+ function wrunPrefixPrimaryCarries(input, entry) {
102
+ if (input.index !== 0 || input.cellType === 'array')
103
+ return false;
104
+ return entry.missing !== 'nan' && entry.missing !== 'zero';
105
+ }
106
+ /** A poll lane instance's clause, or null when its page is asked (a bar join no rule above refuses). */
107
+ function wrunPrefixPollClause(instance) {
108
+ const lane = wrunPollLaneByKey(instance.laneKey);
109
+ if (lane === undefined)
110
+ return 'poll';
111
+ if (lane.join !== 'bar')
112
+ return 'daily';
113
+ // A host-grid lane (`barGrid`) lands its tier asks on the chart's bars in the full run and the reconcile; a page
114
+ // asks no tier and lands nothing, so it hands the window to a full run.
115
+ if (lane.barGrid !== undefined)
116
+ return 'poll';
117
+ return WRUN_PREFIX_POLL_REFUSALS[lane.sourceClass] ?? null;
118
+ }
119
+ /**
120
+ * The lanes rule (C1 v3, widened for the per-bar stamp and the roster 2026-10-14): the clause that refuses
121
+ * (`WrunPrefixLaneClause`), or what a page asks again. Inputs first, in declaration order (the first refusal wins),
122
+ * then the session's legs, pre-roll and degraded lanes, then every lane the session fetched (its acquisition record)
123
+ * and every poll lane instance, the index-mode chart, last a book input with no book lane. An exact warm-up session
124
+ * reading any of these keeps its own refusal (`warmup-lanes`): its hidden head is candles only.
125
+ */
126
+ export function planWrunPrefixLanes(context) {
127
+ const refused = (clause) => ({ refused: clause });
128
+ const sheet = context.metadata;
129
+ const pollLanes = context.pollLanes ?? [];
130
+ let readsBook = false;
131
+ for (const input of sheet.inputs) {
132
+ const entry = sheet.inputSources[input.name];
133
+ if (entry === undefined)
134
+ return refused('input-source');
135
+ if (entry.source === 'time') {
136
+ // The chart's own time feed is no lane: the row builder reads it off each candle row the window holds.
137
+ if (!WRUN_PREFIX_TIME_FIELDS.has(entry.field ?? '') || !wrunInputReadsChartFeed(input, entry)) {
138
+ return refused('input-source');
139
+ }
140
+ continue;
141
+ }
142
+ // An input the run's sheet on this market left undemanded asks nothing and reads its fill on every row.
143
+ if (entry.undemanded === true)
144
+ continue;
145
+ switch (entry.source) {
146
+ case 'ohlcv':
147
+ // The chart's candles; a leg on them (a market or an interval of its own) is judged with the legs below.
148
+ continue;
149
+ case 'book':
150
+ readsBook = true;
151
+ continue;
152
+ case 'trades':
153
+ case 'oi':
154
+ case 'funding':
155
+ case 'liquidations':
156
+ case 'trade_volume_by_size': {
157
+ // A trades input on another market reads its leg lane there (kit 0.77.0): a leg, which no page asks.
158
+ if (isWrunTradesLegLane(wrunSourceLane(entry)))
159
+ return refused('legs');
160
+ const lane = wrunSourceLane(entry);
161
+ // Asked when the session fetched it (the acquisition loop below), read empty when the capability rule never
162
+ // dispatched it, and otherwise a lane the session should hold and does not.
163
+ if (context.acquisition[lane] === undefined) {
164
+ if (!wrunPrefixUnserved(context, lane))
165
+ return refused(lane);
166
+ continue;
167
+ }
168
+ // A primary under carry: the page's first rows would carry from observations before the page, which no page
169
+ // asks (a whole run reads them off its hidden lane head).
170
+ if (wrunPrefixPrimaryCarries(input, entry))
171
+ return refused('primary-carry');
172
+ continue;
173
+ }
174
+ case 'options_chain':
175
+ continue;
176
+ case 'tape': {
177
+ const seconds = wrunPrefixTapeHistorySeconds(sheet, entry.history);
178
+ if (seconds !== 0)
179
+ return refused('tape-history');
180
+ continue;
181
+ }
182
+ case 'volume_profile':
183
+ if (wrunPrefixUnserved(context, 'volume_profile'))
184
+ continue;
185
+ return refused('vp');
186
+ case 'implied_volatility':
187
+ case 'skew':
188
+ if (wrunPrefixUnserved(context, entry.source))
189
+ continue;
190
+ return refused('iv');
191
+ case 'etf_flow':
192
+ if (wrunPrefixUnserved(context, 'etf_flow'))
193
+ continue;
194
+ return refused('daily');
195
+ case 'odds':
196
+ case 'intrabar':
197
+ return refused('legs');
198
+ default: {
199
+ // Every leg stream (candles, oi_candles, volume_profile_candles) is a leg, which no page asks.
200
+ if (isWrunLegStreamClass(entry.source))
201
+ return refused('legs');
202
+ if (wrunPollLanesOfClass(entry.source).length === 0)
203
+ return refused('input-source');
204
+ // A registry class: judged with the instance that serves it (below); one the plan dropped (an index-mode
205
+ // chart, a declared fill) reads its fill on every row.
206
+ const instance = pollLanes.find((candidate) => candidate.inputIndexes.includes(input.index));
207
+ if (instance !== undefined) {
208
+ const clause = wrunPrefixPollClause(instance);
209
+ if (clause !== null)
210
+ return refused(clause);
211
+ // A primary under carry, as above.
212
+ if (wrunPrefixPrimaryCarries(input, entry))
213
+ return refused('primary-carry');
214
+ }
215
+ continue;
216
+ }
217
+ }
218
+ }
219
+ if ((context.pinnedLegs?.length ?? 0) > 0)
220
+ return refused('legs');
221
+ if (context.formingPreRoll !== undefined)
222
+ return refused('preroll');
223
+ if ((context.degradedLanes?.size ?? 0) > 0)
224
+ return refused('degraded');
225
+ const plan = { builtin: [], poll: [] };
226
+ for (const [lane, acquisition] of Object.entries(context.acquisition)) {
227
+ if (acquisition === undefined || isWrunPollLaneId(lane))
228
+ continue;
229
+ if (isWrunTradesLegLane(lane))
230
+ return refused('legs');
231
+ switch (lane) {
232
+ case 'book':
233
+ if (acquisition.preferPackedOrderbookWorker !== true) {
234
+ return refused('book-transport');
235
+ }
236
+ continue;
237
+ case 'trades':
238
+ case 'trades_usd':
239
+ case 'oi':
240
+ case 'funding':
241
+ case 'liquidations':
242
+ case 'trade_volume_by_size':
243
+ plan.builtin.push(lane);
244
+ continue;
245
+ case 'options_chain':
246
+ continue;
247
+ case 'tape': {
248
+ const seconds = wrunPrefixTapeHistorySeconds(sheet, acquisition.history);
249
+ if (seconds !== 0)
250
+ return refused('tape-history');
251
+ continue;
252
+ }
253
+ case 'volume_profile':
254
+ return refused('vp');
255
+ case 'implied_volatility':
256
+ case 'skew':
257
+ return refused('iv');
258
+ case 'etf_flow':
259
+ return refused('daily');
260
+ default:
261
+ return refused(lane);
262
+ }
263
+ }
264
+ for (const instance of pollLanes) {
265
+ const clause = wrunPrefixPollClause(instance);
266
+ if (clause !== null)
267
+ return refused(clause);
268
+ plan.poll.push(instance);
269
+ }
270
+ // A poll lane fetched under no instance the session keeps: nothing to ask it again with.
271
+ for (const lane of Object.keys(context.acquisition)) {
272
+ if (isWrunPollLaneId(lane) && !pollLanes.some((instance) => instance.key === lane))
273
+ return refused('poll');
274
+ }
275
+ const fetchesLanes = plan.builtin.length > 0 || plan.poll.length > 0 || context.acquisition.book !== undefined;
276
+ if (fetchesLanes && checkIsIndexMode(context.market?.exchange))
277
+ return refused('index-mode');
278
+ if (readsBook && context.acquisition.book === undefined && !wrunPrefixUnserved(context, 'book')) {
279
+ return refused('book-missing');
280
+ }
281
+ return { plan };
282
+ }
283
+ /** The lanes rule's clause for a session, null when it admits (`planWrunPrefixLanes`). */
284
+ export function wrunPrefixLaneClauseOf(context) {
285
+ const verdict = planWrunPrefixLanes(context);
286
+ return 'refused' in verdict ? verdict.refused : null;
287
+ }
288
+ /** Whether a planned window reaches the session's live row while the session's options chain lane holds a snapshot
289
+ * (`live-row`): the build lands the chain on its LAST grid row only, so a window ending before the live row reads the
290
+ * empty block a whole run's older bars read, and one reaching it cannot (an empty build would differ there). */
291
+ export function wrunPrefixLiveRowRefused(context, toMs) {
292
+ return context.acquisition.options_chain !== undefined && !(toMs < context.lastRowTs);
293
+ }
294
+ /** The rows of a page answer strictly before `beforeTs` (the session's first row): the chart's fetch pads the end of
295
+ * an explicit window by one source interval, so the answer can reach the session's own rows, which stay the
296
+ * session's. */
297
+ export function wrunPrefixPageRows(rows, beforeTs) {
298
+ return rows.filter((row) => Number(row[0]) < beforeTs);
299
+ }
300
+ /** A buffer's rows inside `[fromTs, toTs]`. */
301
+ function wrunRowsInside(rows, fromTs, toTs) {
302
+ const inside = [];
303
+ for (const row of rows ?? []) {
304
+ const ts = Number(row[0]);
305
+ if (ts >= fromTs && ts <= toTs)
306
+ inside.push(row);
307
+ }
308
+ return inside;
309
+ }
310
+ /**
311
+ * The window build's lane rows (C1 v3 window split): every lane field the row builder reads, as the whole run's row
312
+ * build hands them. An asked lane: its page, then the session's own rows over the overlap `[firstRowTs, toMs]` (the
313
+ * very objects the session holds). The tape (a live edge): the session's own rows over the overlap, none before (a
314
+ * live-edge tape serves no history). Every other lane the session holds: empty (the options chain, a lane the
315
+ * capability rule never dispatched); a lane it never held stays absent. The tape's floor settings and the poll lane
316
+ * instances ride along. Beside it the window's lane evidence (the proof's prefix side, `wrunPrefixHeldLanes` the
317
+ * mounted side): every asked lane and the tape.
318
+ */
319
+ export function wrunPrefixWindowLanes(context, plan, pages, firstRowTs, toMs) {
320
+ const sourceRows = {};
321
+ const lanes = [];
322
+ const windowOf = (page, held) => [
323
+ ...(page ?? []),
324
+ ...wrunRowsInside(held, firstRowTs, toMs),
325
+ ];
326
+ for (const [lane, { rows: field }] of Object.entries(WRUN_PREFIX_ASK_LANES)) {
327
+ const held = context[field];
328
+ if (!plan.builtin.includes(lane)) {
329
+ // A lane the capability rule never dispatched: the session holds it empty, and so does the window.
330
+ if (held !== undefined)
331
+ sourceRows[field] = [];
332
+ continue;
333
+ }
334
+ const rows = windowOf(pages.get(lane), held ?? []);
335
+ sourceRows[field] = rows;
336
+ lanes.push({ lane, rows });
337
+ }
338
+ for (const field of WRUN_PREFIX_NO_ASK_ROWS) {
339
+ if (context[field] !== undefined)
340
+ sourceRows[field] = [];
341
+ }
342
+ if (context.tapeRows !== undefined) {
343
+ const rows = wrunRowsInside(context.tapeRows, firstRowTs, toMs);
344
+ sourceRows.tapeRows = rows;
345
+ lanes.push({ lane: 'tape', rows });
346
+ }
347
+ const settings = wrunTapeFloorSettings(context.metadata, context.acquisition.tape?.minSize);
348
+ if (settings !== undefined)
349
+ sourceRows.settings = settings;
350
+ const instances = context.pollLanes ?? [];
351
+ if (instances.length > 0) {
352
+ const pollLaneRows = {};
353
+ for (const instance of plan.poll) {
354
+ const rows = windowOf(pages.get(instance.key), context.pollLaneRows?.[instance.key] ?? []);
355
+ pollLaneRows[instance.key] = rows;
356
+ lanes.push({ lane: instance.key, rows });
357
+ }
358
+ sourceRows.pollLanes = instances;
359
+ sourceRows.pollLaneRows = pollLaneRows;
360
+ }
361
+ return { sourceRows: sourceRows, lanes };
362
+ }
363
+ /** The session's buffers of the lanes a window's evidence names (`wrunPrefixWindowLanes`), as they stand now: the
364
+ * proof's mounted side. */
365
+ export function wrunPrefixHeldLanes(context, plan) {
366
+ const lanes = plan.builtin.map((lane) => ({
367
+ lane,
368
+ rows: (context[WRUN_PREFIX_ASK_LANES[lane].rows] ?? []),
369
+ }));
370
+ if (context.tapeRows !== undefined)
371
+ lanes.push({ lane: 'tape', rows: context.tapeRows });
372
+ for (const instance of plan.poll)
373
+ lanes.push({ lane: instance.key, rows: context.pollLaneRows?.[instance.key] ?? [] });
374
+ return lanes;
375
+ }
376
+ /**
377
+ * The commit's splice, all or none: every asked lane's buffer becomes its page, then the session's rows from its first
378
+ * row on, read as the buffer stands now (a fold since the prepare is kept; the rows before the first row, a whole run's
379
+ * hidden lane head among them, give way to the page). Null when an asked lane has no buffer to splice: the page must
380
+ * not land (a reseed would compute it without that lane's rows). The book, the tape and the options chain are not
381
+ * spliced here (the book's is the caller's; the others asked nothing, and their buffers stay the session's).
382
+ */
383
+ export function wrunPrefixLaneSplice(context, plan, pages, firstRowTs) {
384
+ const spliced = (held, lane) => [
385
+ ...(pages.get(lane) ?? []),
386
+ ...held.filter((row) => Number(row[0]) >= firstRowTs),
387
+ ];
388
+ const splice = { builtin: [], poll: {} };
389
+ for (const lane of plan.builtin) {
390
+ const field = WRUN_PREFIX_ASK_LANES[lane].rows;
391
+ const held = context[field];
392
+ if (held === undefined)
393
+ return null;
394
+ splice.builtin.push([field, spliced(held, lane)]);
395
+ }
396
+ for (const instance of plan.poll) {
397
+ const held = context.pollLaneRows?.[instance.key];
398
+ if (held === undefined)
399
+ return null;
400
+ splice.poll[instance.key] = spliced(held, instance.key);
401
+ }
402
+ return splice;
403
+ }
404
+ /** Write a splice onto its session (synchronous; a poll instance's buffers as a new record, the reseed and the tail
405
+ * builder read the context's own). */
406
+ export function applyWrunPrefixLaneSplice(context, splice) {
407
+ for (const [field, rows] of splice.builtin)
408
+ context[field] = rows;
409
+ if (Object.keys(splice.poll).length > 0) {
410
+ context.pollLaneRows = { ...context.pollLaneRows, ...splice.poll };
411
+ }
412
+ }
413
+ // ---------------------------------------------------------------------------
414
+ // Lane revisions: what the mounted outputs no longer rest on
415
+ // ---------------------------------------------------------------------------
416
+ /** Whether two lane cells are the same value exactly: the same object, `Object.is`-equal, or two arrays (a cell,
417
+ * typed or plain) equal element by element. No tolerance: the outputs read the exact values. */
418
+ function wrunLaneValueSame(a, b) {
419
+ if (Object.is(a, b))
420
+ return true;
421
+ const list = (value) => Array.isArray(value) || (ArrayBuffer.isView(value) && !(value instanceof DataView));
422
+ if (!list(a) || !list(b) || a.length !== b.length)
423
+ return false;
424
+ for (let at = 0; at < a.length; at += 1)
425
+ if (!wrunLaneValueSame(a[at], b[at]))
426
+ return false;
427
+ return true;
428
+ }
429
+ /** The span of timestamps at or after `fromTs` where two buffers differ exactly (a row on one side only, or any
430
+ * value), null when none does. */
431
+ export function wrunLaneRevisionSpan(before, after, fromTs) {
432
+ const index = (rows) => {
433
+ const byTs = new Map();
434
+ for (const row of rows) {
435
+ const ts = Number(row[0]);
436
+ if (Number.isFinite(ts) && ts >= fromTs)
437
+ byTs.set(ts, row);
438
+ }
439
+ return byTs;
440
+ };
441
+ const was = index(before);
442
+ const now = index(after);
443
+ let span = null;
444
+ const note = (ts) => {
445
+ span =
446
+ span === null ? { fromTs: ts, toTs: ts } : { fromTs: Math.min(span.fromTs, ts), toTs: Math.max(span.toTs, ts) };
447
+ };
448
+ for (const [ts, row] of was) {
449
+ const current = now.get(ts);
450
+ if (current === undefined || !wrunLaneValueSame(row, current))
451
+ note(ts);
452
+ }
453
+ for (const ts of now.keys())
454
+ if (!was.has(ts))
455
+ note(ts);
456
+ return span;
457
+ }
458
+ /** Record a reconcile's replacement of a lane's buffer (`before` to `after`, the rows from `fromTs` on the answer could
459
+ * reach) on the session, tolerated float noise included: a new record (the reseed compares it by identity). */
460
+ export function noteWrunLaneRevision(context, lane, before, after, fromTs) {
461
+ const span = wrunLaneRevisionSpan(before, after, fromTs);
462
+ if (span === null)
463
+ return;
464
+ const known = context.laneRevisions?.[lane];
465
+ const merged = known === undefined ? span : { fromTs: Math.min(known.fromTs, span.fromTs), toTs: Math.max(known.toTs, span.toTs) };
466
+ context.laneRevisions = { ...context.laneRevisions, [lane]: merged };
467
+ }
468
+ /**
469
+ * Whether the session's mounted outputs over `[fromTs, toTs]` (a prefix's overlap) may rest on inputs other than the
470
+ * ones its buffers hold now, so an output mismatch there proves nothing against the module: a lane row a reconcile
471
+ * replaced since the outputs were last computed whole (`laneRevisions`), a late input or a revised closed candle a
472
+ * reseed still owes (`dirtyFromTs`), or an options chain snapshot stamped inside it (it lands on whichever row was the
473
+ * live one when it was computed).
474
+ */
475
+ export function wrunPrefixOverlapUnproven(context, fromTs, toTs) {
476
+ for (const revision of Object.values(context.laneRevisions ?? {})) {
477
+ if (revision !== undefined && revision.fromTs <= toTs && revision.toTs >= fromTs)
478
+ return true;
479
+ }
480
+ if (context.dirtyFromTs !== null && context.dirtyFromTs <= toTs)
481
+ return true;
482
+ return (context.optionsChainRows ?? []).some((row) => {
483
+ const ts = Number(row[0]);
484
+ return ts >= fromTs && ts <= toTs;
485
+ });
486
+ }