@orangecharts/wrun-chart-host 0.11.1 → 0.14.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 (307) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/feature-flags.constants.d.ts +3 -4
  3. package/dist/constants/feature-flags.constants.js +34 -52
  4. package/dist/constants/feature-limits.constants.d.ts +1 -1
  5. package/dist/constants/feature-limits.constants.js +5 -4
  6. package/dist/constants/interval.constants.d.ts +7 -0
  7. package/dist/constants/interval.constants.js +7 -0
  8. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +20 -149
  9. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +20 -309
  10. package/dist/constants/stocks-compliance.constants.d.ts +15 -0
  11. package/dist/constants/stocks-compliance.constants.js +15 -0
  12. package/dist/host-env.d.ts +55 -3
  13. package/dist/host-env.js +6 -0
  14. package/dist/host-ports.types.d.ts +36 -3
  15. package/dist/index.d.ts +17 -0
  16. package/dist/index.js +18 -0
  17. package/dist/indicators/controls/tpo-session.util.d.ts +52 -12
  18. package/dist/indicators/controls/tpo-session.util.js +113 -16
  19. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +6 -0
  20. package/dist/instances/script-engine-worker-ohlcv-transfer.js +16 -0
  21. package/dist/interfaces/cme-realtime.interface.d.ts +8 -0
  22. package/dist/interfaces/cme-realtime.interface.js +2 -1
  23. package/dist/interfaces/feed.interface.d.ts +15 -1
  24. package/dist/interfaces/replay.interface.d.ts +5 -0
  25. package/dist/interfaces/stocks-realtime.interface.d.ts +4 -3
  26. package/dist/interfaces/stocks-realtime.interface.js +5 -4
  27. package/dist/interfaces/wrun-runtime.interface.d.ts +97 -19
  28. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +17 -0
  29. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +22 -0
  30. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +46 -40
  31. package/dist/kscript-data/controls/live-trades-merge.util.js +80 -107
  32. package/dist/market-data/billing.interface.d.ts +9 -1
  33. package/dist/market-data/venue.d.ts +1 -1
  34. package/dist/market-data/venues/index.d.ts +4 -4
  35. package/dist/market-data/venues/stocks.contract.copy.json +4 -4
  36. package/dist/market-data/venues/stocks.d.ts +4 -4
  37. package/dist/market-data/venues/stocks.js +15 -13
  38. package/dist/settings-templates/frvp-fields.d.ts +12 -1
  39. package/dist/settings-templates/frvp-fields.js +15 -4
  40. package/dist/settings-templates/index.js +12 -5
  41. package/dist/settings-templates/indicator-fields.js +28 -2
  42. package/dist/settings-templates/tool-rules.d.ts +17 -8
  43. package/dist/settings-templates/tool-rules.js +15 -8
  44. package/dist/settings-templates/tool-tables.generated.js +4 -2
  45. package/dist/utility/auth/server-clock.util.d.ts +3 -1
  46. package/dist/utility/auth/server-clock.util.js +3 -1
  47. package/dist/utility/chart/book-live-bucket.util.js +2 -2
  48. package/dist/utility/chart/cache-alignment.util.d.ts +15 -7
  49. package/dist/utility/chart/cache-alignment.util.js +14 -7
  50. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +2 -0
  51. package/dist/utility/chart/chart-data-fetch-generation.util.js +16 -0
  52. package/dist/utility/chart/cme-session-bucket.util.d.ts +18 -75
  53. package/dist/utility/chart/cme-session-bucket.util.js +25 -332
  54. package/dist/utility/chart/continuous-contracts.util.js +6 -5
  55. package/dist/utility/chart/display-offset.leaf.d.ts +24 -0
  56. package/dist/utility/chart/display-offset.leaf.js +41 -0
  57. package/dist/utility/chart/effective-chart-session.util.d.ts +2 -1
  58. package/dist/utility/chart/effective-chart-session.util.js +13 -5
  59. package/dist/utility/chart/feed-interval.util.d.ts +6 -20
  60. package/dist/utility/chart/feed-interval.util.js +13 -22
  61. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +27 -7
  62. package/dist/utility/chart/fetch-dedupe-policy.util.js +86 -11
  63. package/dist/utility/chart/host-bar-placement.util.d.ts +7 -4
  64. package/dist/utility/chart/host-bar-placement.util.js +8 -2
  65. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +32 -0
  66. package/dist/utility/chart/indicator-inflight-registry.util.js +52 -0
  67. package/dist/utility/chart/indicator-run-interval.util.d.ts +10 -4
  68. package/dist/utility/chart/indicator-run-interval.util.js +21 -12
  69. package/dist/utility/chart/interval-registry.util.d.ts +1 -1
  70. package/dist/utility/chart/interval-registry.util.js +1 -1
  71. package/dist/utility/chart/kscript-legend-entries.util.d.ts +12 -0
  72. package/dist/utility/chart/kscript-legend-entries.util.js +16 -0
  73. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +1 -1
  74. package/dist/utility/chart/kscript-run-interval-projection.util.js +4 -2
  75. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -62
  76. package/dist/utility/chart/kscript-venue-policy.util.js +85 -94
  77. package/dist/utility/chart/live-bucket.util.d.ts +39 -17
  78. package/dist/utility/chart/live-bucket.util.js +103 -57
  79. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +58 -20
  80. package/dist/utility/chart/local-kscript-source-revalidation.util.js +98 -23
  81. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +35 -11
  82. package/dist/utility/chart/local-kscript-warmup-depth.util.js +24 -3
  83. package/dist/utility/chart/market-session-schedule.util.d.ts +8 -0
  84. package/dist/utility/chart/market-session-schedule.util.js +39 -1
  85. package/dist/utility/chart/market-session.util.d.ts +136 -0
  86. package/dist/utility/chart/market-session.util.js +341 -0
  87. package/dist/utility/chart/om-panel.util.d.ts +5 -3
  88. package/dist/utility/chart/om-panel.util.js +42 -7
  89. package/dist/utility/chart/om-target.util.d.ts +14 -1
  90. package/dist/utility/chart/om-target.util.js +22 -5
  91. package/dist/utility/chart/opra-read-access.leaf.d.ts +16 -1
  92. package/dist/utility/chart/opra-read-access.leaf.js +22 -0
  93. package/dist/utility/chart/profile-row-height.util.d.ts +49 -16
  94. package/dist/utility/chart/profile-row-height.util.js +74 -37
  95. package/dist/utility/chart/rth-session.util.d.ts +55 -20
  96. package/dist/utility/chart/rth-session.util.js +94 -46
  97. package/dist/utility/chart/session-lattice.util.d.ts +150 -0
  98. package/dist/utility/chart/session-lattice.util.js +488 -0
  99. package/dist/utility/chart/trading-day.util.d.ts +40 -2
  100. package/dist/utility/chart/trading-day.util.js +84 -7
  101. package/dist/utility/chart/us-equities-session.util.d.ts +32 -11
  102. package/dist/utility/chart/us-equities-session.util.js +44 -15
  103. package/dist/utility/chart/window-geometry.leaf.d.ts +28 -7
  104. package/dist/utility/chart/window-geometry.leaf.js +57 -8
  105. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +21 -14
  106. package/dist/utility/chart/wrun-bar-session-facts.util.js +32 -38
  107. package/dist/utility/chart/wrun-run-result.util.d.ts +29 -12
  108. package/dist/utility/chart/wrun-run-result.util.js +89 -25
  109. package/dist/utility/common/time.util.js +5 -4
  110. package/dist/utility/market-events/earnings-scope.util.d.ts +10 -5
  111. package/dist/utility/market-events/earnings-scope.util.js +17 -9
  112. package/dist/utility/market-events/market-events.util.d.ts +14 -7
  113. package/dist/utility/market-events/market-events.util.js +30 -17
  114. package/dist/utility/number-format.util.d.ts +14 -21
  115. package/dist/utility/number-format.util.js +38 -24
  116. package/dist/utility/options/option-venue-disclosure.util.d.ts +40 -6
  117. package/dist/utility/options/option-venue-disclosure.util.js +71 -11
  118. package/dist/utility/options/option-venue.util.d.ts +1 -1
  119. package/dist/utility/options/option-venue.util.js +1 -1
  120. package/dist/utility/pool-symbol.leaf.d.ts +7 -0
  121. package/dist/utility/pool-symbol.leaf.js +50 -5
  122. package/dist/utility/stocks/stock-display.util.d.ts +15 -0
  123. package/dist/utility/stocks/stock-display.util.js +37 -0
  124. package/dist/utility/symbol-selection/contract-expiry.util.js +5 -4
  125. package/dist/utility/v2/gate-plane.util.d.ts +6 -0
  126. package/dist/utility/v2/gate-plane.util.js +11 -1
  127. package/dist/utility/v2/gate-session-latch.util.d.ts +1 -1
  128. package/dist/utility/v2/gate-session-latch.util.js +3 -3
  129. package/dist/utility/v2/governed-tier.leaf.d.ts +17 -16
  130. package/dist/utility/v2/governed-tier.leaf.js +17 -16
  131. package/dist/utility/v2/stocks-governed.util.d.ts +5 -0
  132. package/dist/utility/v2/stocks-governed.util.js +14 -0
  133. package/dist/utility/v2/v2-enums.leaf.d.ts +13 -0
  134. package/dist/utility/v2/v2-enums.leaf.js +458 -0
  135. package/dist/utility/wrun/derived-roots.leaf.d.ts +21 -1
  136. package/dist/utility/wrun/derived-roots.leaf.js +27 -1
  137. package/dist/utility/wrun/derived-roots.util.d.ts +44 -32
  138. package/dist/utility/wrun/derived-roots.util.js +97 -56
  139. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +4 -3
  140. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +4 -3
  141. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +2 -1
  142. package/dist/utility/wrun/sources/lanes/option_daily.js +2 -1
  143. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +3 -0
  144. package/dist/utility/wrun/sources/lanes/options_flow.js +23 -5
  145. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +3 -4
  146. package/dist/utility/wrun/sources/row-lane-registry.js +9 -4
  147. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +19 -0
  148. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +104 -0
  149. package/dist/utility/wrun/sources/row-lanes/index.js +2 -0
  150. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.d.ts +20 -0
  151. package/dist/utility/wrun/sources/wrun-lane-fetch-abort.util.js +103 -0
  152. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -2
  153. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +15 -13
  154. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +49 -23
  155. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +14 -9
  156. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +75 -27
  157. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +139 -82
  158. package/dist/utility/wrun/wrun-app-layer.leaf.d.ts +78 -0
  159. package/dist/utility/wrun/wrun-app-layer.leaf.js +89 -0
  160. package/dist/utility/wrun/wrun-bar-count.util.d.ts +11 -7
  161. package/dist/utility/wrun/wrun-bar-count.util.js +12 -8
  162. package/dist/utility/wrun/wrun-batched-kinds.leaf.d.ts +13 -0
  163. package/dist/utility/wrun/wrun-batched-kinds.leaf.js +18 -0
  164. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +41 -22
  165. package/dist/utility/wrun/wrun-batched-marks.util.js +255 -59
  166. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +26 -19
  167. package/dist/utility/wrun/wrun-batched-readout.util.js +81 -27
  168. package/dist/utility/wrun/wrun-book-bands.leaf.d.ts +8 -0
  169. package/dist/utility/wrun/wrun-book-bands.leaf.js +7 -0
  170. package/dist/utility/wrun/wrun-candle-equal.leaf.d.ts +19 -0
  171. package/dist/utility/wrun/wrun-candle-equal.leaf.js +40 -0
  172. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -2
  173. package/dist/utility/wrun/wrun-canvases.util.js +7 -3
  174. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +6 -3
  175. package/dist/utility/wrun/wrun-chart-context-names.util.js +8 -4
  176. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +47 -29
  177. package/dist/utility/wrun/wrun-chart-market-facts.util.js +201 -201
  178. package/dist/utility/wrun/wrun-child-overlay-id.util.js +2 -1
  179. package/dist/utility/wrun/wrun-cme-legs-note.util.d.ts +15 -0
  180. package/dist/utility/wrun/wrun-cme-legs-note.util.js +49 -0
  181. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +38 -0
  182. package/dist/utility/wrun/wrun-cme-root-specs.util.js +81 -0
  183. package/dist/utility/wrun/wrun-coin-lane-live.util.js +3 -0
  184. package/dist/utility/wrun/wrun-color-settings.util.d.ts +6 -1
  185. package/dist/utility/wrun/wrun-color-settings.util.js +32 -7
  186. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +50 -0
  187. package/dist/utility/wrun/wrun-dark-pool.util.js +127 -0
  188. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +67 -12
  189. package/dist/utility/wrun/wrun-declared-warmup.util.js +165 -13
  190. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +18 -8
  191. package/dist/utility/wrun/wrun-draft-legend-note.util.js +57 -11
  192. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +14 -10
  193. package/dist/utility/wrun/wrun-draft-overlay.util.js +26 -14
  194. package/dist/utility/wrun/wrun-earnings-facts.util.js +3 -2
  195. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +2 -0
  196. package/dist/utility/wrun/wrun-etf-funds.util.js +4 -0
  197. package/dist/utility/wrun/wrun-held-lanes.util.js +8 -2
  198. package/dist/utility/wrun/wrun-history-as-of.util.d.ts +77 -0
  199. package/dist/utility/wrun/wrun-history-as-of.util.js +108 -0
  200. package/dist/utility/wrun/wrun-host.service.d.ts +64 -14
  201. package/dist/utility/wrun/wrun-host.service.js +137 -27
  202. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +3 -3
  203. package/dist/utility/wrun/wrun-hosted-wire-caps.js +12 -2
  204. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +13 -0
  205. package/dist/utility/wrun/wrun-inert-legend.util.js +31 -3
  206. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +7 -5
  207. package/dist/utility/wrun/wrun-input-requirements.leaf.js +16 -6
  208. package/dist/utility/wrun/wrun-install-pacer.util.d.ts +26 -0
  209. package/dist/utility/wrun/wrun-install-pacer.util.js +145 -0
  210. package/dist/utility/wrun/wrun-kit-refusal-stages.types.d.ts +22 -0
  211. package/dist/utility/wrun/wrun-kit-refusal-stages.types.js +1 -0
  212. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +12 -5
  213. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +23 -5
  214. package/dist/utility/wrun/wrun-lane-warmup.util.js +22 -4
  215. package/dist/utility/wrun/wrun-leg-close.util.d.ts +6 -5
  216. package/dist/utility/wrun/wrun-leg-close.util.js +11 -9
  217. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +3 -1
  218. package/dist/utility/wrun/wrun-leg-fetch.util.js +9 -2
  219. package/dist/utility/wrun/wrun-levels-child.util.d.ts +2 -0
  220. package/dist/utility/wrun/wrun-levels-child.util.js +6 -0
  221. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -0
  222. package/dist/utility/wrun/wrun-live-intake.util.d.ts +15 -6
  223. package/dist/utility/wrun/wrun-live-intake.util.js +167 -47
  224. package/dist/utility/wrun/wrun-live-tick.util.d.ts +52 -8
  225. package/dist/utility/wrun/wrun-live-tick.util.js +648 -97
  226. package/dist/utility/wrun/wrun-market-facts.util.d.ts +16 -2
  227. package/dist/utility/wrun/wrun-market-facts.util.js +32 -3
  228. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +27 -27
  229. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +28 -16
  230. package/dist/utility/wrun/wrun-market-size-defaults.util.js +34 -5
  231. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +10 -7
  232. package/dist/utility/wrun/wrun-oi-lane.util.js +16 -10
  233. package/dist/utility/wrun/wrun-option-strike-flow.util.js +1 -1
  234. package/dist/utility/wrun/wrun-option-views.util.d.ts +2 -2
  235. package/dist/utility/wrun/wrun-option-views.util.js +5 -2
  236. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.d.ts +5 -0
  237. package/dist/utility/wrun/wrun-options-flow-underlying.leaf.js +16 -0
  238. package/dist/utility/wrun/wrun-options-stop.util.d.ts +3 -2
  239. package/dist/utility/wrun/wrun-options-stop.util.js +6 -4
  240. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +75 -11
  241. package/dist/utility/wrun/wrun-overlay-drivers.util.js +176 -43
  242. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +20 -10
  243. package/dist/utility/wrun/wrun-overlay-park.util.d.ts +84 -0
  244. package/dist/utility/wrun/wrun-overlay-park.util.js +135 -0
  245. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +37 -4
  246. package/dist/utility/wrun/wrun-overlay-recovery.util.js +26 -14
  247. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +239 -24
  248. package/dist/utility/wrun/wrun-overlay-run.util.js +2204 -405
  249. package/dist/utility/wrun/wrun-pack.util.d.ts +8 -5
  250. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +2 -1
  251. package/dist/utility/wrun/wrun-panel-mount.util.js +20 -14
  252. package/dist/utility/wrun/wrun-panel-style.util.d.ts +4 -2
  253. package/dist/utility/wrun/wrun-panel-style.util.js +3 -2
  254. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +7 -0
  255. package/dist/utility/wrun/wrun-pin-spelling.util.js +18 -4
  256. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +26 -17
  257. package/dist/utility/wrun/wrun-pin-venues.util.js +43 -36
  258. package/dist/utility/wrun/wrun-pinned-lanes.util.d.ts +58 -0
  259. package/dist/utility/wrun/wrun-pinned-lanes.util.js +72 -0
  260. package/dist/utility/wrun/wrun-prefix-cohort.util.js +2 -1
  261. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +22 -9
  262. package/dist/utility/wrun/wrun-prefix-lanes.util.js +145 -26
  263. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +29 -0
  264. package/dist/utility/wrun/wrun-prefix-proof.util.js +23 -5
  265. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +9 -1
  266. package/dist/utility/wrun/wrun-refusal-surface.util.js +15 -1
  267. package/dist/utility/wrun/wrun-refusal.util.d.ts +19 -1
  268. package/dist/utility/wrun/wrun-refusal.util.js +103 -16
  269. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +20 -6
  270. package/dist/utility/wrun/wrun-registry-errors.util.js +20 -6
  271. package/dist/utility/wrun/wrun-replay-rows.util.js +6 -10
  272. package/dist/utility/wrun/wrun-run-health.util.d.ts +89 -2
  273. package/dist/utility/wrun/wrun-run-health.util.js +204 -1
  274. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +2 -2
  275. package/dist/utility/wrun/wrun-run-interval-session.util.js +2 -2
  276. package/dist/utility/wrun/wrun-run-interval.util.d.ts +9 -8
  277. package/dist/utility/wrun/wrun-run-interval.util.js +13 -11
  278. package/dist/utility/wrun/wrun-sandbox-row-source.js +5 -2
  279. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +13 -3
  280. package/dist/utility/wrun/wrun-script-inputs.util.js +51 -13
  281. package/dist/utility/wrun/wrun-session-composition.util.d.ts +81 -0
  282. package/dist/utility/wrun/wrun-session-composition.util.js +169 -0
  283. package/dist/utility/wrun/wrun-setting-words.util.d.ts +10 -7
  284. package/dist/utility/wrun/wrun-setting-words.util.js +25 -7
  285. package/dist/utility/wrun/wrun-source-rows.util.d.ts +94 -28
  286. package/dist/utility/wrun/wrun-source-rows.util.js +738 -93
  287. package/dist/utility/wrun/wrun-stream-clock.util.d.ts +45 -0
  288. package/dist/utility/wrun/wrun-stream-clock.util.js +108 -0
  289. package/dist/utility/wrun/wrun-tape-coins.util.d.ts +116 -0
  290. package/dist/utility/wrun/wrun-tape-coins.util.js +110 -0
  291. package/dist/utility/wrun/wrun-tape-source.util.d.ts +62 -32
  292. package/dist/utility/wrun/wrun-tape-source.util.js +72 -34
  293. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +13 -5
  294. package/dist/utility/wrun/wrun-tier-grid.util.js +23 -13
  295. package/dist/utility/wrun/wrun-tpo-rows.util.js +2 -1
  296. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +73 -0
  297. package/dist/utility/wrun/wrun-trades-lane.util.js +82 -0
  298. package/dist/utility/wrun/wrun-twin-compute-inputs.util.d.ts +5 -0
  299. package/dist/utility/wrun/wrun-twin-compute-inputs.util.js +9 -2
  300. package/dist/utility/wrun/wrun-visibility-table.d.ts +13 -0
  301. package/dist/utility/wrun/wrun-visibility-table.js +9 -0
  302. package/dist/utility/wrun/wrun-volume-profile.util.js +7 -3
  303. package/dist/utils/replay/replay-buffer-math.d.ts +16 -6
  304. package/dist/utils/replay/replay-buffer-math.js +60 -30
  305. package/dist/workers/constants/socket-slots.d.ts +11 -7
  306. package/dist/workers/constants/socket-slots.js +6 -5
  307. package/package.json +5 -5
@@ -35,7 +35,9 @@
35
35
  * asking for rows the last good run already computed over the same main rows
36
36
  * is skipped (the kScript wave's duplicate-range rule, widened to coverage: a
37
37
  * pan-back page's live rebuild already computed the rows its wave then asks
38
- * for). Settled runs and successful computes are announced through hooks, so
38
+ * for), and one the live tick's open backward-extension rebuild episode takes
39
+ * in runs nothing (WRUN-PANBACK A2: the episode's one handoff rebuilds every
40
+ * page of the gesture). Settled runs and successful computes are announced through hooks, so
39
41
  * the lifecycle door and the recovery ladders follow the executor without
40
42
  * this module importing them.
41
43
  *
@@ -122,9 +124,18 @@ export interface WrunRunEpisode {
122
124
  origin: 'user' | 'system';
123
125
  reason: WrunRunReason | 'mount';
124
126
  }
127
+ /** Whether the overlay's queued follow-up is a run a person, the mount or the replay lane asked for
128
+ * (`WRUN_USER_RUN_REASONS`): an install held for the gesture (wrun-overlay-run `holdWrunInstallForGesture`) drops its
129
+ * result as superseded instead of making that run wait out the pan. */
130
+ export declare function hasQueuedWrunUserRun(indicatorId: string): boolean;
125
131
  /** Register (or clear, with null) the chart main-rows identity reader the
126
132
  * pan wave's coverage skip compares runs by. */
127
133
  export declare function setWrunChartRowsIdentityReader(reader: ((chartIndex: number, indicatorId?: string) => string | undefined) | null): void;
134
+ /** The live tick's answer to a pan wave (WRUN-PANBACK A2): true when the overlay's backward-extension rebuild episode
135
+ * takes the wave in, so the episode's one handoff computes its page and the wave runs nothing. */
136
+ export type WrunLazyWaveAbsorber = (chartIndex: number, indicatorId: string, window: WrunRunWindow | undefined) => boolean;
137
+ /** Register (or clear, with null) the live tick's pan-wave absorber (`isWrunWaveAbsorbed`). */
138
+ export declare function setWrunLazyWaveAbsorber(absorber: WrunLazyWaveAbsorber | null): void;
128
139
  /** Subscribe to every settled executor run (wave, initial compute, follow-up):
129
140
  * once per run, with the run's reason and outcome. Returns the unsubscribe.
130
141
  * Only a run of an overlay that still stands is announced: a run that settles
@@ -166,6 +177,10 @@ export interface WrunOverlayLiveContext {
166
177
  * style save never): the switch's stand-in capture stores the shown picture only while the row still carries it,
167
178
  * since a save moves the row at once and the session shows the previous computation until the rerun lands. */
168
179
  settingsRevision?: number;
180
+ /** The guest's linear memory as the session's live-start block reported it (`WrunLiveBlockStats.memoryBytes`): the
181
+ * worker keeps it and one forming-bar snapshot of it while the session lives, which a warm switch's park counts
182
+ * (wrunParkedLiveSessionBytes). Absent when the worker named none: the park counts the memory ceiling. */
183
+ workerMemoryBytes?: number;
169
184
  /** An editor draft (isWrunDraftOverlaySettings): the run seam raised its run-health
170
185
  * verdict (wrun-run-health.util) and the live session keeps it honest. */
171
186
  draft: boolean;
@@ -206,6 +221,12 @@ export interface WrunOverlayLiveContext {
206
221
  * once per shape instead of re-firing the full run on every drain; a
207
222
  * successful rerun replaces the context and the latch with it. */
208
223
  rebuildHandoffShape?: string;
224
+ /** A backward extension's rebuild the live tick holds while the pan or the main candle fetch runs (WRUN-PANBACK A2,
225
+ * the settle gate): when the hold began (the pacing clock, performance.now), so one handoff after the pan settles,
226
+ * or at the ceiling, carries how long it held. Cleared at the handoff; a fresh context carries none. */
227
+ rebuildSettleSinceMs?: number;
228
+ /** The chart first rows (one per page) the held episode saw: the pages one handoff collapses. Cleared with the hold. */
229
+ rebuildSettlePages?: Set<number>;
209
230
  /** The live source buffers (the row builder's own lanes): the last full
210
231
  * run's fetched rows, extended by the push intake's folds and corrected
211
232
  * by the reconcile fetches. Undeclared lanes stay undefined. */
@@ -217,6 +238,8 @@ export interface WrunOverlayLiveContext {
217
238
  /** The trades leg lanes the full run asked (kit 0.77.0), by leg lane id: push lanes like the
218
239
  * chart's own, on the leg's market. */
219
240
  tradeLegRows?: Record<string, ArrayLike<number>[]>;
241
+ /** The pinned lanes' rows by lane id (wrun-pinned-lanes.util). */
242
+ pinnedLaneRows?: Record<string, ArrayLike<number>[]>;
220
243
  openInterestRows?: ArrayLike<number>[];
221
244
  volumeProfileRows?: ReadonlyArray<ReadonlyArray<unknown>>;
222
245
  /** The trade_volume_by_size lane's dense per-bar rows `[ts, [bucket, buy_usd,
@@ -237,6 +260,8 @@ export interface WrunOverlayLiveContext {
237
260
  * them at the drain): their blocks are short, so the tick refuses them by name and suspends the
238
261
  * session, like a capped bucket. A restorable loss rides the reconcile instead (`tape-lost`). */
239
262
  tapeLostBuckets?: Set<number>;
263
+ /** A coins tape's lowest live print price, before any floor (C-COINS item 2, wrun-tape-coins.util). */
264
+ tapePriceLow?: number;
240
265
  liquidationRows?: ArrayLike<number>[];
241
266
  fundingRateRows?: ArrayLike<number>[];
242
267
  impliedVolatilityRows?: ArrayLike<number>[];
@@ -304,6 +329,10 @@ export interface WrunOverlayLiveContext {
304
329
  * or a drain carrying another generation belongs to a superseded session
305
330
  * and is discarded. */
306
331
  generation: number;
332
+ /** The epoch the worker's live series was opened under (the live-start of the full run or the reseed that opened
333
+ * it): the generation moves again at a warm switch's adoption, the series' epoch only at a live-start, and a park
334
+ * names the series by it. Absent on contexts stored before this field: the generation is the epoch. */
335
+ seriesEpoch?: number;
307
336
  /** The chart interval in ms the run computed on (every lane's bucket rule
308
337
  * and the tail window read it). */
309
338
  intervalMs: number;
@@ -321,19 +350,24 @@ export interface WrunOverlayLiveContext {
321
350
  * chart, or one whose lanes read the CME plane): every debug line its ticks and reseeds publish states it. No
322
351
  * cloud frame raises it (the Cloud lane never reads CME). */
323
352
  cmeRead?: true;
353
+ /** The delayed CME legs its legend names (the installing run's `computed.cmeDelayed`). */
354
+ cmeDelayed?: ReadonlyArray<{
355
+ symbol: string;
356
+ mins: number;
357
+ }>;
324
358
  /** The carry-forward state after every input row strictly before
325
359
  * `lastRowTs` (the seed the tail builder resumes from): the forward-fill
326
360
  * scalars, the forming buckets and the pinned legs' confirmed cursors. */
327
361
  carrySeed: WrunInputCarry;
362
+ /** The instant the session's declared depth counts back from (wrun-history-as-of.util): the
363
+ * installing run clock's as-of, the earliest pin among its legs (its first run's now on a live
364
+ * session, a replay's present), else that run's now. The reseed (a revised bar, a late input, a
365
+ * wake that lost the session) and the drains build under it, never under their own now alone. */
366
+ historyAsOfMs?: number;
328
367
  /** Per lane, the buckets the push intake fed since the last reconcile
329
368
  * covered them (a fed bucket is live data, not fetched data). */
330
369
  fedBuckets: Partial<Record<WrunLiveLane, Set<number>>>;
331
- /** False when the package declares a pin the push intake cannot ride (a
332
- * market pin, a finer or non-ohlcv interval pin): no push, a repair on
333
- * every drain. The full run refuses those pins by name before any fetch,
334
- * so a context it installs is eligible; an own-market coarser interval
335
- * pin is eligible (the chart's own push lanes stay valid, the leg is a
336
- * poll lane). */
370
+ /** False for a pin the push intake cannot ride (`wrunPushEligible`): a repair on every drain. */
337
371
  pushEligible: boolean;
338
372
  /** The newest row ts a successful integrate has painted; `lastRowTs` may
339
373
  * run ahead of it after a failed integrate (the next successful patch
@@ -524,8 +558,9 @@ export interface WrunOverlayPinnedLeg extends WrunPinnedLeg {
524
558
  * driver goes too) or 'suspend' (Pause: the live session ends, the driver
525
559
  * and the overlay stay, and Resume reruns it). */
526
560
  export type WrunLiveTeardownCause = 'teardown' | 'suspend';
527
- /** The host's side of the teardown door: bound once, when the host service evaluates. */
528
- export declare function bindWrunHostLiveSeriesEnd(end: (sessionKey: string) => void): void;
561
+ /** The host's side of the teardown door: bound once, when the host service evaluates. With `epoch` it ends that
562
+ * generation's series only (a parked session's end), without it whatever the key holds (the teardown). */
563
+ export declare function bindWrunHostLiveSeriesEnd(end: (sessionKey: string, epoch?: number) => void): void;
529
564
  /** Bump and return the overlay's live generation. Every install (the full
530
565
  * run opening a session) and every teardown moves it; the run passes the
531
566
  * new value to the worker as the session epoch and stores it on the
@@ -565,6 +600,10 @@ export declare function withWrunOverlaySessionLock<T>(indicatorId: string, fn: (
565
600
  * nothing. Read from the chart metadata the caller hands in (the store stays
566
601
  * out of this registry's eager graph); metadata without the word reads as
567
602
  * the market's default.
603
+ * A sixth term, the market the rows come from when not the chart's own
604
+ * (`wrunMainCandleSourceOf`: a US stock on Trades rides its tape), makes a
605
+ * feed switch an identity change too; other charts keep five terms. INT
606
+ * 2026-11-05: a Trades session drew tape prints again after Price only.
568
607
  */
569
608
  export declare function wrunChartMarketIdentity(metadata: {
570
609
  exchange?: unknown;
@@ -621,6 +660,16 @@ export declare function teardownWrunOverlaysForChart(chartIndex: number): void;
621
660
  * driver or live context names. Returns the unregister function.
622
661
  */
623
662
  export declare function onWrunChartTeardown(fn: (chartIndex: number) => void): () => void;
663
+ /**
664
+ * The warm switch's park (wrun-overlay-park.util): release an overlay from its chart as a teardown while its worker
665
+ * series stays open, and hand back its live context (out of the registry, its last patch dropped: it names the outgoing
666
+ * chart's plots). Undefined, releasing nothing, for a session that cannot be kept whole: none, a run in flight, a held,
667
+ * replaying or repaint-owed session, a pan page's prefix run not landed, or a session operation holding its lock (a
668
+ * tick's worker call, a reseed, a repaint: it would end, reopen or advance the series after the park).
669
+ */
670
+ export declare function releaseWrunOverlayLiveSessionForPark(indicatorId: string): WrunOverlayLiveContext | undefined;
671
+ /** End one generation's worker series (a parked session's end): a later run's series under the id stays. */
672
+ export declare function endWrunOverlayLiveSeriesAt(indicatorId: string, epoch: number): void;
624
673
  /** One live session as the memory census reads it (titan-charts' census walk, `wrun.overlays`). */
625
674
  export interface WrunOverlayMemoryCensusEntry {
626
675
  id: string;
@@ -633,7 +682,20 @@ export interface WrunOverlayMemoryCensusEntry {
633
682
  laneBytes: number;
634
683
  /** The rows of the result the live tick last applied (`liveApplied`), plus its build's when that is another result. */
635
684
  liveAppliedRows: number;
685
+ /** A session a warm workspace switch parked (parkWrunOverlayLiveSession): out of the registry, its worker series
686
+ * open, waiting for its adoption; its `liveAppliedRows` are the shown result it keeps. Absent for a live one. */
687
+ parked?: true;
636
688
  }
689
+ /** The data rows of a built result, over its outputs. */
690
+ export declare function wrunCensusResultRows(result: WrunLiveApplied['result'] | undefined): number;
691
+ /** A context's lane buffers, counted and sampled (rows, and bytes at 8 a number). */
692
+ export declare function wrunCensusLaneBytes(context: WrunOverlayLiveContext): {
693
+ laneRows: number;
694
+ laneBytes: number;
695
+ };
696
+ /** One context's census entry: `shown` is the result it keeps when no live patch is applied (a parked session's). */
697
+ export declare function wrunLiveContextCensusOf(context: WrunOverlayLiveContext, shown?: WrunLiveApplied['result']): WrunOverlayMemoryCensusEntry;
698
+ export declare function onWrunOverlayMemoryCensus(contribute: () => WrunOverlayMemoryCensusEntry[]): void;
637
699
  /** Every live session's retention (memory spec 4.4), read-only: rows counted, bytes sampled, nothing created. */
638
700
  export declare function wrunOverlayMemoryCensus(): WrunOverlayMemoryCensusEntry[];
639
701
  /** A prefix run's owner on the session it extends (C1 v3): its request, window, the session and the
@@ -744,9 +806,11 @@ export declare function noteWrunOverlayWholeWindowDrawn(indicatorId: string): vo
744
806
  * (every request queued behind one run shares it), so a settings save's tail
745
807
  * waits for its own settings to land, not for the run that read the older
746
808
  * ones. Undefined when the overlay has no driver, is no longer mounted (which
747
- * also tears it down), or the request is a pan wave whose window the last
809
+ * also tears it down), the request is a pan wave whose window the last
748
810
  * good run already computed over the same main rows while nothing is in
749
- * flight (the coverage skip).
811
+ * flight (the coverage skip), or a pan wave the live tick's open rebuild
812
+ * episode took in (`isWrunWaveAbsorbed`, WRUN-PANBACK A2: its one handoff
813
+ * rebuilds the page).
750
814
  */
751
815
  export declare function rerunWrunOverlayForChartWave(indicatorId: string, options?: WrunWaveRerunOptions): Promise<void> | undefined;
752
816
  /**
@@ -35,7 +35,9 @@
35
35
  * asking for rows the last good run already computed over the same main rows
36
36
  * is skipped (the kScript wave's duplicate-range rule, widened to coverage: a
37
37
  * pan-back page's live rebuild already computed the rows its wave then asks
38
- * for). Settled runs and successful computes are announced through hooks, so
38
+ * for), and one the live tick's open backward-extension rebuild episode takes
39
+ * in runs nothing (WRUN-PANBACK A2: the episode's one handoff rebuilds every
40
+ * page of the gesture). Settled runs and successful computes are announced through hooks, so
39
41
  * the lifecycle door and the recovery ladders follow the executor without
40
42
  * this module importing them.
41
43
  *
@@ -81,8 +83,10 @@ import { WrunChartGoneError, WrunDeadlineError } from './wrun-registry-errors.ut
81
83
  import { closeWrunRefusalAttempts, concludeWrunRefusalAttempt, liveWrunRefusalAttempt, openWrunRefusalAttempt, wrunRefusalAttemptOrigin, } from './wrun-refusal-surface.util.js';
82
84
  import { attachWrunRefusal, stampWrunRefusalTelemetry } from './wrun-refusal.util.js';
83
85
  import { wrunRunFailedIdentityOf } from './wrun-cap-notice.util.js';
86
+ import { __resetWrunHistoryAsOfForTests, forgetWrunHistoryAsOf } from './wrun-history-as-of.util.js';
84
87
  import { effectiveChartSessionType } from '../chart/effective-chart-session.util.js';
85
- import { wrunChartHostEnv } from '../../host-env.js';
88
+ import { wrunMainCandleSourceOf } from './run-schedule/wrun-own-candles.util.js';
89
+ import { hasWrunChartHostEnv, wrunChartHostEnv } from '../../host-env.js';
86
90
  const drivers = new Map();
87
91
  /** The executor's merge rank (wrun-lifecycle.contract.ts): settings > switch
88
92
  * > theme > resume = retry > heal > live-rebuild > the range reasons.
@@ -121,11 +125,20 @@ function wrunRunRequestOf(options) {
121
125
  ...(options?.prefix && reason === 'lazy-range-refresh' ? { prefix: options.prefix } : {}),
122
126
  // Only a source-recovery rung answers its episode's attempt.
123
127
  ...(options?.episode && reason === 'source-recovery' ? { episode: options.episode } : {}),
128
+ ...wrunGestureHeldOf(options?.gestureHeldMs),
124
129
  };
125
130
  }
126
- /** The options a driver's rerun receives: the reason and the window only. */
131
+ /** The pan hold a request carries (`gestureHeldMs`): a positive finite number of ms, else nothing. */
132
+ function wrunGestureHeldOf(gestureHeldMs) {
133
+ return gestureHeldMs !== undefined && Number.isFinite(gestureHeldMs) && gestureHeldMs > 0 ? { gestureHeldMs } : {};
134
+ }
135
+ /** The options a driver's rerun receives: the reason, the window and the pan hold the episode already spent. */
127
136
  function wrunRerunOptionsOf(request) {
128
- return request.window ? { reason: request.reason, window: request.window } : { reason: request.reason };
137
+ return {
138
+ reason: request.reason,
139
+ ...(request.window ? { window: request.window } : {}),
140
+ ...wrunGestureHeldOf(request.gestureHeldMs),
141
+ };
129
142
  }
130
143
  /** Latest-wins by rank: the higher-ranked reason wins and a tie goes to the
131
144
  * newer request; the wider window wins (a tie to the newer), and an absent
@@ -143,12 +156,33 @@ function mergeWrunRunRequests(pending, incoming) {
143
156
  // A rung's episode survives only while the merged request is still a rung (the newer rung's).
144
157
  const rungEpisode = reason === 'source-recovery' ? (incoming.episode ?? pending.episode) : undefined;
145
158
  const episode = rungEpisode !== undefined ? { episode: rungEpisode } : {};
159
+ // One ceiling per rebuild episode: the merged run waits at most what the longer-held request has left.
160
+ const held = wrunGestureHeldOf(Math.max(pending.gestureHeldMs ?? 0, incoming.gestureHeldMs ?? 0));
146
161
  if (!pending.window || !incoming.window)
147
- return { reason, ...origin, ...prefix, ...episode };
162
+ return { reason, ...origin, ...prefix, ...episode, ...held };
148
163
  const window = incoming.window.toMs - incoming.window.fromMs >= pending.window.toMs - pending.window.fromMs
149
164
  ? incoming.window
150
165
  : pending.window;
151
- return { reason, window, ...origin, ...prefix, ...episode };
166
+ return { reason, window, ...origin, ...prefix, ...episode, ...held };
167
+ }
168
+ /** The reasons a person (a settings save, a switch, a theme, a Resume, a Retry), the mount's first run or the replay
169
+ * lane asks a run for: a held install yields to one of them queued behind it (`hasQueuedWrunUserRun`). */
170
+ const WRUN_USER_RUN_REASONS = new Set([
171
+ 'initial',
172
+ 'settings',
173
+ 'switch',
174
+ 'theme',
175
+ 'resume',
176
+ 'retry',
177
+ 'replay',
178
+ ]);
179
+ /** Whether the overlay's queued follow-up is a run a person, the mount or the replay lane asked for
180
+ * (`WRUN_USER_RUN_REASONS`): an install held for the gesture (wrun-overlay-run `holdWrunInstallForGesture`) drops its
181
+ * result as superseded instead of making that run wait out the pan. */
182
+ export function hasQueuedWrunUserRun(indicatorId) {
183
+ const state = drivers.get(indicatorId);
184
+ const queued = state?.pendingAgain === true ? state.pendingOptions : undefined;
185
+ return queued !== undefined && WRUN_USER_RUN_REASONS.has(queued.reason);
152
186
  }
153
187
  /** Merge a request into the queued follow-up; a prefix tag the merge dropped will never run. */
154
188
  function queueWrunRunRequest(indicatorId, state, incoming) {
@@ -259,6 +293,31 @@ function isWrunCoveredWaveRequest(indicatorId, state, request) {
259
293
  return false;
260
294
  return readWrunChartRowsIdentity(state.driver.chartIndex, indicatorId) === coverage.rowsIdentity;
261
295
  }
296
+ // The live tick's pan-wave absorber, registered at its import (this registry stays off the tick's imports). Without
297
+ // one, every wave runs.
298
+ let lazyWaveAbsorber = null;
299
+ /** Register (or clear, with null) the live tick's pan-wave absorber (`isWrunWaveAbsorbed`). */
300
+ export function setWrunLazyWaveAbsorber(absorber) {
301
+ lazyWaveAbsorber = absorber;
302
+ }
303
+ /** Whether the live tick takes a pan wave into the overlay's open rebuild episode (WRUN-PANBACK A2): the chart's
304
+ * lazy wave asks every overlay for a run per lazy page, a second dispatcher beside the tick's rebuild. Only a whole
305
+ * wave the chart asked for is offered (a planned prefix page computes its page alone, a person's request is answered
306
+ * by its own run); a wave already queued or in flight is left alone, every other reason runs, and an absorber that
307
+ * throws takes nothing in. */
308
+ function isWrunWaveAbsorbed(indicatorId, state, request) {
309
+ if (request.reason !== 'lazy-range-refresh' || request.prefix !== undefined || request.userOrigin === true) {
310
+ return false;
311
+ }
312
+ if (lazyWaveAbsorber === null)
313
+ return false;
314
+ try {
315
+ return lazyWaveAbsorber(state.driver.chartIndex, indicatorId, request.window) === true;
316
+ }
317
+ catch {
318
+ return false;
319
+ }
320
+ }
262
321
  const runSettledHooks = new Set();
263
322
  const computeSucceededHooks = new Set();
264
323
  /** Run every subscriber; a throwing one is logged and never breaks the
@@ -306,7 +365,8 @@ const chartTeardownHooks = new Set();
306
365
  * step is a no-op. This module never imports the host (its worker, packer and kit stay off the
307
366
  * boot graph, docs/features/kscript/wrun/wrun-browser-runtime.md "Boot doors"). */
308
367
  let endHostLiveSeries;
309
- /** The host's side of the teardown door: bound once, when the host service evaluates. */
368
+ /** The host's side of the teardown door: bound once, when the host service evaluates. With `epoch` it ends that
369
+ * generation's series only (a parked session's end), without it whatever the key holds (the teardown). */
310
370
  export function bindWrunHostLiveSeriesEnd(end) {
311
371
  endHostLiveSeries = end;
312
372
  }
@@ -370,14 +430,20 @@ export function withWrunOverlaySessionLock(indicatorId, fn) {
370
430
  * nothing. Read from the chart metadata the caller hands in (the store stays
371
431
  * out of this registry's eager graph); metadata without the word reads as
372
432
  * the market's default.
433
+ * A sixth term, the market the rows come from when not the chart's own
434
+ * (`wrunMainCandleSourceOf`: a US stock on Trades rides its tape), makes a
435
+ * feed switch an identity change too; other charts keep five terms. INT
436
+ * 2026-11-05: a Trades session drew tape prints again after Price only.
373
437
  */
374
438
  export function wrunChartMarketIdentity(metadata) {
375
439
  if (!metadata)
376
440
  return '';
377
441
  const session = effectiveChartSessionType(metadata.exchange, metadata.symbol, metadata.interval, metadata.sessionType);
378
- return [metadata.exchange, metadata.symbol, metadata.interval, metadata.transformations, session]
379
- .map((part) => (part === undefined || part === null ? '' : String(part)))
380
- .join('|');
442
+ const terms = [metadata.exchange, metadata.symbol, metadata.interval, metadata.transformations, session];
443
+ const rows = wrunMainCandleSourceOf(metadata);
444
+ if (rows)
445
+ terms.push(`${rows.exchange}:${rows.symbol}`);
446
+ return terms.map((part) => (part === undefined || part === null ? '' : String(part))).join('|');
381
447
  }
382
448
  export function registerWrunOverlayDriver(indicatorId, driver) {
383
449
  const existing = drivers.get(indicatorId);
@@ -438,6 +504,19 @@ export function noteWrunOverlayRunSettle(indicatorId, note) {
438
504
  }
439
505
  export function setWrunOverlayLiveContext(context) {
440
506
  liveContexts.set(context.indicatorId, context);
507
+ // The host's session re-reads whether it may own the overlay's lanes (a settings run may have moved them between
508
+ // contracts and dollars). Absent seams: nothing. A failing seam never fails the install.
509
+ if (!hasWrunChartHostEnv())
510
+ return;
511
+ const session = wrunChartHostEnv().session;
512
+ if (session === undefined)
513
+ return;
514
+ try {
515
+ session.onLiveContextInstalled(context.indicatorId);
516
+ }
517
+ catch (error) {
518
+ console.warn(`[wrun] the session seam failed on '${context.indicatorId}':`, error);
519
+ }
441
520
  }
442
521
  export function getWrunOverlayLiveContext(indicatorId) {
443
522
  return liveContexts.get(indicatorId);
@@ -480,7 +559,11 @@ export function suspendWrunOverlayLiveSession(indicatorId) {
480
559
  return;
481
560
  releaseWrunOverlayLiveSession(indicatorId, 'suspend');
482
561
  }
483
- function releaseWrunOverlayLiveSession(indicatorId, cause) {
562
+ function releaseWrunOverlayLiveSession(indicatorId, mode) {
563
+ // The overlay leaves its chart on a park as on a teardown: every hook releases what it holds for that chart (the
564
+ // feed channels, the timers, the queues, the held row source, the chrome). Only this module tells the two apart,
565
+ // below: the worker's series stays open and the context goes to the park instead of away.
566
+ const cause = mode === 'park' ? 'teardown' : mode;
484
567
  // The identity being torn down: read before anything moves, so the bump
485
568
  // and the hooks act on the live context (a hook may still read it).
486
569
  const context = liveContexts.get(indicatorId);
@@ -500,6 +583,8 @@ function releaseWrunOverlayLiveSession(indicatorId, cause) {
500
583
  }
501
584
  if (cause === 'teardown') {
502
585
  drivers.delete(indicatorId);
586
+ // The overlay's history session goes with it: an overlay mounted again pins its lanes afresh.
587
+ forgetWrunHistoryAsOf(indicatorId);
503
588
  // The overlay's refusal attempts and verdicts go with it: a settlement
504
589
  // landing after this claims nothing, and a later tenant starts clean.
505
590
  if (chartIndex !== undefined)
@@ -511,6 +596,9 @@ function releaseWrunOverlayLiveSession(indicatorId, cause) {
511
596
  }
512
597
  }
513
598
  liveContexts.delete(indicatorId);
599
+ // A park keeps the worker's series for the adoption (its handle ends it, by its epoch, on every other way out).
600
+ if (mode === 'park')
601
+ return;
514
602
  // Unconditional once the host exists: live-end is idempotent in the
515
603
  // worker, and a context that was never stored here can still shadow a
516
604
  // session opened by an earlier mount under the same id. No host yet: no
@@ -553,6 +641,32 @@ export function onWrunChartTeardown(fn) {
553
641
  chartTeardownHooks.delete(fn);
554
642
  };
555
643
  }
644
+ /**
645
+ * The warm switch's park (wrun-overlay-park.util): release an overlay from its chart as a teardown while its worker
646
+ * series stays open, and hand back its live context (out of the registry, its last patch dropped: it names the outgoing
647
+ * chart's plots). Undefined, releasing nothing, for a session that cannot be kept whole: none, a run in flight, a held,
648
+ * replaying or repaint-owed session, a pan page's prefix run not landed, or a session operation holding its lock (a
649
+ * tick's worker call, a reseed, a repaint: it would end, reopen or advance the series after the park).
650
+ */
651
+ export function releaseWrunOverlayLiveSessionForPark(indicatorId) {
652
+ const context = liveContexts.get(indicatorId);
653
+ const state = drivers.get(indicatorId);
654
+ if (context === undefined || state === undefined || state.inFlight !== null)
655
+ return undefined;
656
+ if (sessionLocks.has(indicatorId))
657
+ return undefined;
658
+ if (context.liveSuspended || context.replay === true || context.repaintOwed)
659
+ return undefined;
660
+ if (context.prefixOwner?.state === 'pending')
661
+ return undefined;
662
+ releaseWrunOverlayLiveSession(indicatorId, 'park');
663
+ context.liveApplied = undefined;
664
+ return context;
665
+ }
666
+ /** End one generation's worker series (a parked session's end): a later run's series under the id stays. */
667
+ export function endWrunOverlayLiveSeriesAt(indicatorId, epoch) {
668
+ endHostLiveSeries?.(indicatorId, epoch);
669
+ }
556
670
  /** The lane buffers a live context keeps one array of rows for. */
557
671
  const WRUN_CENSUS_LANE_BUFFERS = [
558
672
  'bookRows',
@@ -573,6 +687,7 @@ const WRUN_CENSUS_LANE_BUFFERS = [
573
687
  const WRUN_CENSUS_KEYED_BUFFERS = [
574
688
  'pollLaneRows',
575
689
  'tradeLegRows',
690
+ 'pinnedLaneRows',
576
691
  'pinnedCandleRows',
577
692
  'pinnedLiveCandleRows',
578
693
  'intrabarRows',
@@ -603,44 +718,55 @@ function wrunCensusBufferBytes(rows) {
603
718
  return Math.round((numbers / sampled) * rows.length * 8);
604
719
  }
605
720
  /** The data rows of a built result, over its outputs. */
606
- function wrunCensusResultRows(result) {
721
+ export function wrunCensusResultRows(result) {
607
722
  let rows = 0;
608
723
  for (const output of Object.values(result?.outputs ?? {})) {
609
724
  rows += Array.isArray(output.data) ? output.data.length : 0;
610
725
  }
611
726
  return rows;
612
727
  }
728
+ /** A context's lane buffers, counted and sampled (rows, and bytes at 8 a number). */
729
+ export function wrunCensusLaneBytes(context) {
730
+ const buffers = [];
731
+ for (const key of WRUN_CENSUS_LANE_BUFFERS) {
732
+ const rows = context[key];
733
+ if (rows !== undefined)
734
+ buffers.push(rows);
735
+ }
736
+ for (const key of WRUN_CENSUS_KEYED_BUFFERS)
737
+ buffers.push(...Object.values(context[key] ?? {}));
738
+ if (context.formingPreRoll !== undefined)
739
+ buffers.push(context.formingPreRoll.rows);
740
+ let laneRows = 0;
741
+ let laneBytes = 0;
742
+ for (const rows of buffers) {
743
+ laneRows += rows.length;
744
+ laneBytes += wrunCensusBufferBytes(rows);
745
+ }
746
+ return { laneRows, laneBytes };
747
+ }
748
+ /** One context's census entry: `shown` is the result it keeps when no live patch is applied (a parked session's). */
749
+ export function wrunLiveContextCensusOf(context, shown) {
750
+ const applied = context.liveApplied;
751
+ const build = applied?.build?.result;
752
+ return {
753
+ id: context.indicatorId,
754
+ chartIndex: context.chartIndex,
755
+ liveRows: context.outputRows.length,
756
+ ...wrunCensusLaneBytes(context),
757
+ liveAppliedRows: wrunCensusResultRows(applied?.result ?? shown) + (build !== applied?.result ? wrunCensusResultRows(build) : 0),
758
+ };
759
+ }
760
+ /** Sessions held outside the registry that the census lists too (the warm switch's parks), registered at import. */
761
+ const censusContributors = new Set();
762
+ export function onWrunOverlayMemoryCensus(contribute) {
763
+ censusContributors.add(contribute);
764
+ }
613
765
  /** Every live session's retention (memory spec 4.4), read-only: rows counted, bytes sampled, nothing created. */
614
766
  export function wrunOverlayMemoryCensus() {
615
- const entries = [];
616
- for (const context of liveContexts.values()) {
617
- const buffers = [];
618
- for (const key of WRUN_CENSUS_LANE_BUFFERS) {
619
- const rows = context[key];
620
- if (rows !== undefined)
621
- buffers.push(rows);
622
- }
623
- for (const key of WRUN_CENSUS_KEYED_BUFFERS)
624
- buffers.push(...Object.values(context[key] ?? {}));
625
- if (context.formingPreRoll !== undefined)
626
- buffers.push(context.formingPreRoll.rows);
627
- let laneRows = 0;
628
- let laneBytes = 0;
629
- for (const rows of buffers) {
630
- laneRows += rows.length;
631
- laneBytes += wrunCensusBufferBytes(rows);
632
- }
633
- const applied = context.liveApplied;
634
- const build = applied?.build?.result;
635
- entries.push({
636
- id: context.indicatorId,
637
- chartIndex: context.chartIndex,
638
- liveRows: context.outputRows.length,
639
- laneRows,
640
- laneBytes,
641
- liveAppliedRows: wrunCensusResultRows(applied?.result) + (build !== applied?.result ? wrunCensusResultRows(build) : 0),
642
- });
643
- }
767
+ const entries = [...liveContexts.values()].map((context) => wrunLiveContextCensusOf(context));
768
+ for (const contribute of censusContributors)
769
+ entries.push(...contribute());
644
770
  return entries;
645
771
  }
646
772
  let prefixRuntime = null;
@@ -1143,9 +1269,11 @@ function beginExecutorRun(indicatorId, state, planned) {
1143
1269
  * (every request queued behind one run shares it), so a settings save's tail
1144
1270
  * waits for its own settings to land, not for the run that read the older
1145
1271
  * ones. Undefined when the overlay has no driver, is no longer mounted (which
1146
- * also tears it down), or the request is a pan wave whose window the last
1272
+ * also tears it down), the request is a pan wave whose window the last
1147
1273
  * good run already computed over the same main rows while nothing is in
1148
- * flight (the coverage skip).
1274
+ * flight (the coverage skip), or a pan wave the live tick's open rebuild
1275
+ * episode took in (`isWrunWaveAbsorbed`, WRUN-PANBACK A2: its one handoff
1276
+ * rebuilds the page).
1149
1277
  */
1150
1278
  export function rerunWrunOverlayForChartWave(indicatorId, options) {
1151
1279
  const state = drivers.get(indicatorId);
@@ -1156,6 +1284,9 @@ export function rerunWrunOverlayForChartWave(indicatorId, options) {
1156
1284
  return undefined;
1157
1285
  }
1158
1286
  const request = wrunRunRequestOf(options);
1287
+ // Asked before anything queues or starts: a wave already queued or in flight stays as it is.
1288
+ if (isWrunWaveAbsorbed(indicatorId, state, request))
1289
+ return undefined;
1159
1290
  if (state.inFlight) {
1160
1291
  queueWrunRunRequest(indicatorId, state, request);
1161
1292
  return followUpWaitersOf(state).promise;
@@ -1210,6 +1341,8 @@ export function __resetWrunOverlayDriversForTests() {
1210
1341
  liveContexts.clear();
1211
1342
  liveGenerations.clear();
1212
1343
  sessionLocks.clear();
1344
+ // Every overlay's history session goes with its driver: a spec's next run pins its lanes afresh.
1345
+ __resetWrunHistoryAsOfForTests();
1213
1346
  // The teardown hooks are module registrations (the intake and the tick
1214
1347
  // register at import), never per-test state: they stay.
1215
1348
  }
@@ -349,10 +349,10 @@ const revalidationTimers = new Map();
349
349
  const revalidationCharts = new Map();
350
350
  /**
351
351
  * After an integrated wrun run: when any of its lanes was served from the
352
- * replay cache (the shared acquisition marked the overlay), arm the one-shot
353
- * revalidation the SWR contract owes, once per mark. Replay drops the mark
354
- * (replay owns its own data plane). The kScript scheduler's rules verbatim
355
- * (data-fetching.util maybeScheduleLocalKScriptSourceRevalidation).
352
+ * replay cache (the shared acquisition marked the overlay with the lane), arm
353
+ * the one-shot revalidation the SWR contract owes, once per mark. Replay
354
+ * drops the mark (replay owns its own data plane). The kScript scheduler's
355
+ * rules verbatim (data-fetching.util maybeScheduleLocalKScriptSourceRevalidation).
356
356
  */
357
357
  function maybeScheduleWrunSourceRevalidation(indicatorId, chartIndex) {
358
358
  if (!hasWrunOverlayDriver(indicatorId))
@@ -381,10 +381,12 @@ function maybeScheduleWrunSourceRevalidation(indicatorId, chartIndex) {
381
381
  /**
382
382
  * The owed revalidation: guards run before the mark is taken (an
383
383
  * undispatchable moment disarms so the next integrated run re-arms); the
384
- * mark is taken, the per-overlay bypass token installed so every lane of the
385
- * run reaches the wire, the run goes through the door ('loaded-range-refresh'),
386
- * the token is released in finally, and the mark is restored when the door
387
- * held or skipped the run.
384
+ * mark is taken with its lanes, the bypass token installed over those lanes
385
+ * (the take comes first, so the lane set travels inside the token) so only
386
+ * the lanes the replay cache served reach the wire and every other lane of
387
+ * the run takes its normal ladder, the run goes through the door
388
+ * ('loaded-range-refresh'), the token is released in finally, and the mark is
389
+ * restored, lane by lane, when the door held or skipped the run.
388
390
  */
389
391
  async function runWrunSourceRevalidation(chartIndex, indicatorId, armedGeneration) {
390
392
  const bail = () => disarmLocalKScriptSourceRevalidation(chartIndex, indicatorId);
@@ -400,16 +402,24 @@ async function runWrunSourceRevalidation(chartIndex, indicatorId, armedGeneratio
400
402
  if (!pending)
401
403
  return;
402
404
  const restoreMark = () => {
403
- markLocalKScriptSourceCacheHit(chartIndex, indicatorId, pending.fromMs, pending.toMs);
405
+ // Every lane of the take owes the revalidation again, over the same window. A take with no lanes restores as a
406
+ // mark naming no lane (''), so its overlay-wide revalidation is never lost either.
407
+ const laneKeys = pending.lanes.size > 0 ? [...pending.lanes] : [''];
408
+ for (const laneKey of laneKeys) {
409
+ markLocalKScriptSourceCacheHit(chartIndex, indicatorId, pending.fromMs, pending.toMs, laneKey);
410
+ }
404
411
  disarmLocalKScriptSourceRevalidation(chartIndex, indicatorId);
405
412
  };
406
- const token = installLocalKScriptSourceCacheBypass(chartIndex, indicatorId);
413
+ // Only the lanes the replay cache served; an empty set installs a token over every lane (never a silent skip).
414
+ const token = installLocalKScriptSourceCacheBypass(chartIndex, indicatorId, pending.lanes);
407
415
  ring('wrun-source-revalidation-start', {
408
416
  chartIndex,
409
417
  indicatorId,
410
418
  fromMs: pending.fromMs,
411
419
  toMs: pending.toMs,
412
420
  markedAt: pending.markedAt,
421
+ lanes: pending.lanes.size,
422
+ laneKeys: [...pending.lanes].sort().slice(0, 32),
413
423
  });
414
424
  try {
415
425
  const outcome = await dispatchWrunOverlayRerun(chartIndex, indicatorId, 'loaded-range-refresh');