@orangecharts/wrun-chart-host 0.3.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 (362) hide show
  1. package/README.md +23 -6
  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/builtin-script-snippets.d.ts +133 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
  12. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  13. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  14. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  15. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  16. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  17. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  18. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  19. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  20. package/dist/host-env.d.ts +321 -24
  21. package/dist/host-env.js +15 -0
  22. package/dist/host-ports.types.d.ts +857 -35
  23. package/dist/index.d.ts +149 -2
  24. package/dist/index.js +149 -2
  25. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  26. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  27. package/dist/interfaces/market-event.interface.d.ts +231 -0
  28. package/dist/interfaces/market-event.interface.js +15 -0
  29. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  30. package/dist/interfaces/opra-realtime.interface.js +34 -59
  31. package/dist/interfaces/replay.interface.d.ts +285 -0
  32. package/dist/interfaces/replay.interface.js +1 -0
  33. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  34. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  35. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  36. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  37. package/dist/market-data/billing.interface.d.ts +219 -0
  38. package/dist/market-data/billing.interface.js +58 -0
  39. package/dist/market-data/venue-governed.util.d.ts +2 -0
  40. package/dist/market-data/venue-governed.util.js +10 -0
  41. package/dist/market-data/venue.d.ts +122 -0
  42. package/dist/market-data/venue.js +1 -0
  43. package/dist/market-data/venues/index.d.ts +97 -0
  44. package/dist/market-data/venues/index.js +33 -0
  45. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  46. package/dist/market-data/venues/opra.d.ts +70 -0
  47. package/dist/market-data/venues/opra.js +74 -0
  48. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  49. package/dist/replay/replayIndicatorRows.js +117 -0
  50. package/dist/replay/replayLadder.d.ts +85 -0
  51. package/dist/replay/replayLadder.js +388 -0
  52. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  53. package/dist/utility/auth/server-clock.util.js +238 -0
  54. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  55. package/dist/utility/chart/builtin-identity.util.js +51 -0
  56. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  57. package/dist/utility/chart/cache-alignment.util.js +926 -0
  58. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  59. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  60. package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
  61. package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
  62. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  63. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  64. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  65. package/dist/utility/chart/color-customization.leaf.js +16 -0
  66. package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
  67. package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
  68. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  69. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  70. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  71. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  72. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  73. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  74. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  75. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  76. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  77. package/dist/utility/chart/index-host-tier.util.js +118 -0
  78. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  79. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  80. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  81. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  82. package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
  83. package/dist/utility/chart/indicator-run-interval.util.js +268 -0
  84. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  85. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  86. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  87. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  88. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  89. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  90. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  91. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  92. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  93. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  94. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  95. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  96. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  97. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  98. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  99. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  100. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  101. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  102. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  103. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  104. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  105. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  106. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  107. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  108. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  109. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  110. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  111. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  112. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  113. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  114. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  115. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  116. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  117. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  118. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  119. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  120. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  121. package/dist/utility/chart/live-cadence.util.js +37 -0
  122. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  123. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  124. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  125. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  126. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  127. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  128. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  129. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  130. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  131. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  132. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  133. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  134. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  135. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  136. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  137. package/dist/utility/chart/mixed-mode.util.js +139 -0
  138. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  139. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  140. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  141. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  142. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  143. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  144. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  145. package/dist/utility/chart/price-precision.util.js +70 -0
  146. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  147. package/dist/utility/chart/profile-block-size.util.js +141 -0
  148. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  149. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  150. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  151. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  152. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  153. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  154. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  155. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  156. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  157. package/dist/utility/chart/titan-constants.pin.js +18 -5
  158. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  159. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  160. package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
  161. package/dist/utility/chart/window-geometry.leaf.js +391 -0
  162. package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
  163. package/dist/utility/chart/window-owner.leaf.js +24 -0
  164. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  165. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  166. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  167. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  168. package/dist/utility/common/data-processing.util.d.ts +138 -0
  169. package/dist/utility/common/data-processing.util.js +346 -0
  170. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  171. package/dist/utility/common/visible-timeout.util.js +23 -8
  172. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  173. package/dist/utility/exchange-format.leaf.js +47 -0
  174. package/dist/utility/html-escape.leaf.d.ts +11 -0
  175. package/dist/utility/html-escape.leaf.js +20 -0
  176. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  177. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  178. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  179. package/dist/utility/market-events/market-events.util.js +392 -0
  180. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  181. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  182. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  183. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  184. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  185. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  186. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  187. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  188. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  189. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  190. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  191. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  192. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  193. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  194. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +43 -15
  195. package/dist/utility/wrun/sources/lanes/option_daily.js +78 -20
  196. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +14 -10
  197. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +5 -4
  198. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  199. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +22 -3
  200. package/dist/utility/wrun/sources/opra-option-lanes.util.js +38 -7
  201. package/dist/utility/wrun/sources/registry.js +31 -1
  202. package/dist/utility/wrun/sources/row-lane-registry.js +5 -5
  203. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +49 -0
  204. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +75 -20
  205. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +49 -0
  206. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +57 -47
  207. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +36 -4
  208. package/dist/utility/wrun/sources/row-lanes/option_surface.js +6 -12
  209. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +37 -3
  210. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +128 -2
  211. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +233 -51
  212. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +0 -8
  213. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +26 -24
  214. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +85 -104
  215. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  216. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  217. package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
  218. package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
  219. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  220. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  221. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  222. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  223. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  224. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  225. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  226. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  227. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  228. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  229. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  230. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  231. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  232. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  233. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  234. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  235. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  236. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  237. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  238. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  239. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  240. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  241. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  242. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  243. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  244. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  245. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  246. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  247. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  248. package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
  249. package/dist/utility/wrun/wrun-host.service.js +655 -0
  250. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  251. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  252. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  253. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  254. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  255. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  256. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  257. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  258. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  259. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  260. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  261. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  262. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  263. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  264. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  265. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  266. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  267. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  268. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  269. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  270. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  271. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  272. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  273. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  274. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  275. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  276. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +29 -10
  277. package/dist/utility/wrun/wrun-opra-stats.leaf.js +29 -10
  278. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  279. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  280. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  281. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  282. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  283. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  284. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  285. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  286. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  287. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  288. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  289. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  290. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  291. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  292. package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
  293. package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
  294. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +392 -0
  295. package/dist/utility/wrun/wrun-panel-mount.util.js +2346 -0
  296. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  297. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  298. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  299. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  300. package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
  301. package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
  302. package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
  303. package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
  304. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  305. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  306. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  307. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  308. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  309. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  310. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  311. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  312. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  313. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  314. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  315. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  316. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  317. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  318. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  319. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  320. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  321. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  322. package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
  323. package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
  324. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  325. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  326. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  327. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  328. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  329. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  330. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  331. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  332. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  333. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  334. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  335. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  336. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  337. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  338. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  339. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  340. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  341. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  342. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  343. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  344. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  345. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  346. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  347. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  348. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  349. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  350. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  351. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  352. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  353. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  354. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  355. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  356. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  357. package/dist/utils/replay/replay-buffer-math.js +684 -0
  358. package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
  359. package/dist/workers/wrun/wrun-abi-host.js +1201 -0
  360. package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
  361. package/dist/workers/wrun/wrun-engine-handler.js +211 -0
  362. package/package.json +3 -3
@@ -0,0 +1,484 @@
1
+ /**
2
+ * Who may take a prefix run (TITAN-RENDER-SAFEGUARDS pan-back plan, contract C8): a pan-back that prepends older
3
+ * bars computes only those bars plus a short overlap, instead of re-running the whole loaded history, when the
4
+ * package is admitted (the compiler's stamp, or the roster here) AND the landing shape here says yes. The overlap
5
+ * check (wrun-prefix-proof.util) only validates a prefix; it never admits one.
6
+ *
7
+ * - isWrunPrefixSafePackage (the audited exceptions): the package is on the roster
8
+ * (src/constants/wrun-prefix-safe.constants.ts).
9
+ * The property both admissions rest on is history independence: every bar's outputs and price-canvas cells read
10
+ * only that bar's inputs, no module-level state carries from bar to bar, and nothing reads a bar index or the run's
11
+ * length. Only that property makes a cold run started at the chart's first bar agree with the mounted rows AFTER
12
+ * the overlap, and no comparison of the overlap can see it (wrun-prefix-proof.util has the counterexample). The
13
+ * compiler proves it for most authors and says so on the sheet (`history_independent: true`, kit 0.66.0), and the
14
+ * overlay run admits a session on that stamp once the module corroborates it (wrun-overlay-run.util,
15
+ * `wrunPrefixStampCorroborated`), with no roster entry: the shipped Book Heat template is admitted that way since
16
+ * kit 0.67.2, which dropped its corner note and with it the one value the template carried from bar to bar. This
17
+ * roster is the audited-exception list beside the stamp: modules a person read and found history-independent where
18
+ * it matters although the compiler cannot prove it (today the registry's compiled Book Heat, whose sheet carries no
19
+ * stamp, pinned to its audited module bytes), each admitted with the closed-book guard the stamp does not need. A
20
+ * registry package is looked up by its name; an editor draft (a kit template the Indicators dialog compiles in the
21
+ * browser, or an author's own Run) carries no registry identity, so it is looked up by the sha256 of the source it
22
+ * was compiled from (`wrunDraftRef.sourceDigest`), never by a name; no shipped template has an entry.
23
+ * - wrunPrefixCohort (the landing shape): every output the overlay mounts lands as an exact prepend through the
24
+ * merge route, so the union of the prefix rows and the mounted rows is the full run's picture. Dense per-bar
25
+ * series, the lower pane that carries them, book or grid heatmap children, and the batched marks children
26
+ * (WRUN-BATCHED-MARKS: `marks`, `spans` and `rays`, one row per bar read off the bar's own data-only outputs, so a
27
+ * landing prepends rows like a heatmap's) do; anything whose picture depends on more than its own bar does not
28
+ * (price and corner labels, tables, drawings, displaced outputs, profiles, matrices and other children,
29
+ * strategies). One exception is a SNAPSHOT
30
+ * output: a label handle pinned to one of the nine pane corners. The run hands back its handle ledger's whole live
31
+ * set and a landing replaces the mounted set with it (drawings are never merged), so a prefix may land it only when
32
+ * its set equals the mounted one; the proof compares the two (wrun-prefix-proof.util), and the cohort answers which
33
+ * mounted outputs those handles are (`snapshotHandles`). Every other handle kind or anchor still refuses.
34
+ * - Three declarations a run reads past its own bar are admitted under the landing-time proofs the run lane takes
35
+ * (WRUN-WARMUP-LEVELS 4a, wrun-prefix-proof.util `proveWrunPrefixRunSnapshots` and `proveWrunPrefixSparseMount`):
36
+ * a guide (`role: "guide"`, mounted as the engine's hline: one constant value, the last finite value its run gave
37
+ * it), held to the mounted guide and the session rows (`guides`); a style read from the run's last ready row
38
+ * (`stroke_width_by`, `show_price_display_by`, `edge_width_by`), held to the one the session derives and the one
39
+ * its mounted plot shows (`styles`); and a sparse output or range (`omit_if_empty`, mounted only once a run gave it
40
+ * a value), whose presence on the mount and whose band fields there the prefix result must keep (`sparse-mount`),
41
+ * the prefix payload carrying every one the mount shows.
42
+ *
43
+ * Pure and leaf: no run module, no store, no chart; the roster loads once with the module.
44
+ */
45
+ import { WRUN_PREFIX_SAFE_ROSTER } from '../../constants/wrun-prefix-safe.constants.js';
46
+ import { compareSemver, parseSemver } from '../scriptEditor/package-semver.util.js';
47
+ // The registry's package-name grammar (tharamine ANY_PACKAGE_NAME_RE, mirrored as WRUN_PACKAGE_NAME_RE in
48
+ // wrun-registry.service). Mirrored again rather than imported so this leaf never pulls the registry service in.
49
+ const PACKAGE_NAME_RE = /^@[a-z0-9_-]+\/[a-z0-9_-]+$/;
50
+ // A kit template's audit name (`template:<id>`, the id of src/constants/scriptEditor/wrun-templates.generated.json).
51
+ const TEMPLATE_NAME_RE = /^template:[a-z0-9_-]+$/;
52
+ const SHA256_RE = /^[0-9a-f]{64}$/i;
53
+ const AUDIT_DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
54
+ const ENTRY_KEYS = new Set([
55
+ 'packageName',
56
+ 'versions',
57
+ 'wasmSha256',
58
+ 'sourceDigest',
59
+ 'auditedOn',
60
+ 'why',
61
+ ]);
62
+ const COMPARATOR_RE = /^(>=|<=|>|<|=|\^|~)?(.+)$/;
63
+ /** One comparator token as plain comparators: `^` and `~` become their lower and upper bounds. Null = malformed. */
64
+ function comparatorsOf(token) {
65
+ const match = COMPARATOR_RE.exec(token);
66
+ if (!match)
67
+ return null;
68
+ const op = match[1] ?? '=';
69
+ const version = match[2];
70
+ const parsed = parseSemver(version);
71
+ if (!parsed)
72
+ return null;
73
+ if (op === '^') {
74
+ const { major, minor, patch } = parsed;
75
+ const upper = major > 0 ? `${major + 1}.0.0` : minor > 0 ? `0.${minor + 1}.0` : `0.0.${patch + 1}`;
76
+ return [
77
+ { op: '>=', version },
78
+ { op: '<', version: upper },
79
+ ];
80
+ }
81
+ if (op === '~') {
82
+ return [
83
+ { op: '>=', version },
84
+ { op: '<', version: `${parsed.major}.${parsed.minor + 1}.0` },
85
+ ];
86
+ }
87
+ return [{ op: op, version }];
88
+ }
89
+ /** A range's alternatives, null for '*', undefined when the range is malformed. */
90
+ function alternativesOf(range) {
91
+ const text = range.trim();
92
+ if (text === '*')
93
+ return null;
94
+ const alternatives = [];
95
+ for (const alternative of text.split('||')) {
96
+ const tokens = alternative.trim().split(/\s+/);
97
+ if (tokens.length === 0 || tokens[0] === '')
98
+ return undefined;
99
+ const comparators = [];
100
+ for (const token of tokens) {
101
+ const parsed = comparatorsOf(token);
102
+ if (parsed === null)
103
+ return undefined;
104
+ comparators.push(...parsed);
105
+ }
106
+ alternatives.push(comparators);
107
+ }
108
+ return alternatives;
109
+ }
110
+ function holds(cmp, op) {
111
+ switch (op) {
112
+ case '=':
113
+ return cmp === 0;
114
+ case '>':
115
+ return cmp > 0;
116
+ case '>=':
117
+ return cmp >= 0;
118
+ case '<':
119
+ return cmp < 0;
120
+ case '<=':
121
+ return cmp <= 0;
122
+ }
123
+ }
124
+ /** A release satisfies an alternative when every comparator holds; a prerelease also needs an exact pin of itself
125
+ * in that alternative, so a range never admits a build nobody named. */
126
+ function versionAdmitted(version, alternatives) {
127
+ if (alternatives === null)
128
+ return true;
129
+ if (version === null)
130
+ return false;
131
+ const parsed = parseSemver(version);
132
+ if (!parsed)
133
+ return false;
134
+ const prerelease = parsed.prerelease.length > 0;
135
+ return alternatives.some((comparators) => {
136
+ let pinned = false;
137
+ for (const comparator of comparators) {
138
+ const cmp = compareSemver(version, comparator.version);
139
+ if (!holds(cmp, comparator.op))
140
+ return false;
141
+ if (comparator.op === '=')
142
+ pinned = true;
143
+ }
144
+ return !prerelease || pinned;
145
+ });
146
+ }
147
+ function isAuditDay(value) {
148
+ if (typeof value !== 'string' || !AUDIT_DAY_RE.test(value))
149
+ return false;
150
+ const day = new Date(`${value}T00:00:00Z`);
151
+ return !Number.isNaN(day.getTime()) && day.toISOString().slice(0, 10) === value;
152
+ }
153
+ /** A list of sha256 hex strings, lowercased: null when absent, undefined when malformed (not a list, empty, or an
154
+ * item that is not 64 hex digits). */
155
+ function sha256ListOf(value) {
156
+ if (value === undefined)
157
+ return null;
158
+ if (!Array.isArray(value) || value.length === 0)
159
+ return undefined;
160
+ if (!value.every((hash) => typeof hash === 'string' && SHA256_RE.test(hash)))
161
+ return undefined;
162
+ return value.map((hash) => hash.toLowerCase());
163
+ }
164
+ /** A well-formed roster entry, else null. Strict on purpose: an unknown key (a misspelt `wasmSha256` would silently
165
+ * widen the audit to every build) or any malformed field disables the entry, never the roster. A template entry
166
+ * without `sourceDigest` is malformed: it is matched by digest alone, so it could only ever admit nothing. */
167
+ function rosterEntryOf(value) {
168
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
169
+ return null;
170
+ const record = value;
171
+ if (Object.keys(record).some((key) => !ENTRY_KEYS.has(key)))
172
+ return null;
173
+ const { packageName, versions, wasmSha256, sourceDigest, auditedOn, why } = record;
174
+ if (typeof packageName !== 'string')
175
+ return null;
176
+ const template = TEMPLATE_NAME_RE.test(packageName);
177
+ if (!template && !PACKAGE_NAME_RE.test(packageName))
178
+ return null;
179
+ if (typeof versions !== 'string')
180
+ return null;
181
+ const alternatives = alternativesOf(versions);
182
+ if (alternatives === undefined)
183
+ return null;
184
+ const hashes = sha256ListOf(wasmSha256);
185
+ if (hashes === undefined)
186
+ return null;
187
+ const digests = sha256ListOf(sourceDigest);
188
+ if (digests === undefined || (template && digests === null))
189
+ return null;
190
+ if (!isAuditDay(auditedOn))
191
+ return null;
192
+ if (typeof why !== 'string' || why.trim() === '')
193
+ return null;
194
+ return {
195
+ entry: {
196
+ packageName,
197
+ versions,
198
+ ...(hashes !== null ? { wasmSha256: hashes } : {}),
199
+ ...(digests !== null ? { sourceDigest: digests } : {}),
200
+ auditedOn,
201
+ why,
202
+ },
203
+ alternatives,
204
+ hashes: hashes !== null ? new Set(hashes) : null,
205
+ digests: digests !== null ? new Set(digests) : null,
206
+ };
207
+ }
208
+ function indexEntry(index, key, entry) {
209
+ const list = index.get(key);
210
+ if (list)
211
+ list.push(entry);
212
+ else
213
+ index.set(key, [entry]);
214
+ }
215
+ /** The roster, indexed. A roster that is not an array admits nothing. */
216
+ function loadRoster(raw) {
217
+ const byName = new Map();
218
+ const byDigest = new Map();
219
+ if (!Array.isArray(raw))
220
+ return { byName, byDigest };
221
+ for (const value of raw) {
222
+ const entry = rosterEntryOf(value);
223
+ if (entry === null)
224
+ continue;
225
+ if (PACKAGE_NAME_RE.test(entry.entry.packageName))
226
+ indexEntry(byName, entry.entry.packageName, entry);
227
+ for (const digest of entry.digests ?? [])
228
+ indexEntry(byDigest, digest, entry);
229
+ }
230
+ return { byName, byDigest };
231
+ }
232
+ const ROSTER = loadRoster(WRUN_PREFIX_SAFE_ROSTER);
233
+ /**
234
+ * The roster's verdict on a package identity: safe with the first entry (file order) that admits its version and,
235
+ * when the entry pins builds or sources, its module hash and its source digest; 'not-audited' when no well-formed
236
+ * entry names the package (a registry identity) or lists the draft's source digest (a draft: `sourceDigest` set,
237
+ * looked up by that digest alone, never by a name); 'version-outside-audit' when entries name it but none admits this
238
+ * version, build or source (an unknown version passes only a '*' entry, an unknown hash never passes a pinned one, a
239
+ * registry identity never passes a source-pinned one). `wasmSha256` is the sheet's `wasm_sha256`, which the host
240
+ * verifies against the module bytes before it compiles them (wrun-host.service compileModule); `sourceDigest` is a
241
+ * draft overlay's `wrunDraftRef.sourceDigest`, the compile pipeline's sha256 of the entry source's UTF-8 text, and
242
+ * null for every other overlay.
243
+ */
244
+ export function isWrunPrefixSafePackage(identity) {
245
+ const digest = typeof identity?.sourceDigest === 'string' && identity.sourceDigest !== ''
246
+ ? identity.sourceDigest.toLowerCase()
247
+ : null;
248
+ const entries = digest !== null
249
+ ? ROSTER.byDigest.get(digest)
250
+ : typeof identity?.packageName === 'string'
251
+ ? ROSTER.byName.get(identity.packageName)
252
+ : undefined;
253
+ if (!entries)
254
+ return { safe: false, reason: 'not-audited' };
255
+ const version = typeof identity.version === 'string' ? identity.version : null;
256
+ const hash = typeof identity.wasmSha256 === 'string' ? identity.wasmSha256.toLowerCase() : null;
257
+ for (const candidate of entries) {
258
+ if (!versionAdmitted(version, candidate.alternatives))
259
+ continue;
260
+ if (candidate.hashes !== null && (hash === null || !candidate.hashes.has(hash)))
261
+ continue;
262
+ if (candidate.digests !== null && (digest === null || !candidate.digests.has(digest)))
263
+ continue;
264
+ // A copy: the roster stays the file's, whatever a caller does with the entry.
265
+ const { entry } = candidate;
266
+ return {
267
+ safe: true,
268
+ entry: {
269
+ ...entry,
270
+ ...(entry.wasmSha256 ? { wasmSha256: [...entry.wasmSha256] } : {}),
271
+ ...(entry.sourceDigest ? { sourceDigest: [...entry.sourceDigest] } : {}),
272
+ },
273
+ };
274
+ }
275
+ return { safe: false, reason: 'version-outside-audit' };
276
+ }
277
+ /** The nine pane corners a snapshot handle may be pinned to (the first nine of wrun-handles.util
278
+ * WRUN_DRAWING_ANCHORS, its WRUN_LABEL_POSITIONS; mirrored so this leaf never pulls the handle ledger's graph in,
279
+ * the cohort spec pins the two together): both coordinates in pane pixels, so the picture is the record's props and
280
+ * no bar's. The edge words follow a chart axis (`top` and `bottom`: x is a bar's time; `left` and `right`: y is a
281
+ * price) and a record with no anchor sits at a bar's time and a price. */
282
+ export const WRUN_PREFIX_SNAPSHOT_ANCHORS = [
283
+ 'top_left',
284
+ 'top_center',
285
+ 'top_right',
286
+ 'middle_left',
287
+ 'middle_center',
288
+ 'middle_right',
289
+ 'bottom_left',
290
+ 'bottom_center',
291
+ 'bottom_right',
292
+ ];
293
+ const SNAPSHOT_ANCHORS = new Set(WRUN_PREFIX_SNAPSHOT_ANCHORS);
294
+ /** The one handle kind a snapshot may be: a label (text at a corner). Lines, boxes and polylines refuse. */
295
+ const SNAPSHOT_HANDLE_KIND = 'label';
296
+ /** A label handle pinned to a pane corner: a snapshot output (the proof compares it whole). */
297
+ function isSnapshotHandle(output) {
298
+ return (output.kind === 'handle' &&
299
+ output.plot === SNAPSHOT_HANDLE_KIND &&
300
+ output.anchor !== undefined &&
301
+ SNAPSHOT_ANCHORS.has(output.anchor));
302
+ }
303
+ // The plot words of a dense timestamped series, one row per bar, in the sheet's words (line, bar, histogram, area)
304
+ // and the engine's (spline, stepLine, and the band and fill shapes an area, a sheet range or a sheet fill mounts
305
+ // as), plus 'empty': the container anchor a parent keeps when its every plot sits in a child pane, one NaN row per
306
+ // bar. A union of two such row sets is a prepend.
307
+ const DENSE_SERIES_PLOTS = new Set([
308
+ 'line',
309
+ 'spline',
310
+ 'bar',
311
+ 'histogram',
312
+ 'area',
313
+ 'step',
314
+ 'stepLine',
315
+ 'deltaFillSpline',
316
+ 'fillBetween',
317
+ 'band',
318
+ 'empty',
319
+ ]);
320
+ /** The heatmap cell layouts a windowed landing merges as a prepend (the heatmap child's rows are per-bar rows). */
321
+ const PREPEND_CHILD_LAYOUTS = new Set(['book', 'grid']);
322
+ /** The batched marks children a windowed landing merges as a prepend (WRUN-BATCHED-MARKS round 2, fold 10): the
323
+ * row-backed canvas kinds whose rows are per-bar rows `[ts, ...fields]` read off the bar's own outputs, mounted
324
+ * with their kind as the layout (wrun-overlay-run `wrunPrefixMountedOutputsOf`). */
325
+ const PREPEND_BATCHED_LAYOUTS = new Set(['marks', 'spans', 'rays']);
326
+ /** A lower-pane child (`series`, wrun-run-result WrunChildOverlay): a pane of the sheet's own outputs, merged
327
+ * through the same route as the parent's rows (wrun-overlay-run mergeWrunChildOverlays), so it is judged by those
328
+ * outputs, which the sheet pass checks. Either spelling of the kind is read. */
329
+ function isSeriesPaneChild(output) {
330
+ return output.plot === 'series' || output.childLayout === 'series';
331
+ }
332
+ /** The one plot a guide mounts as: the engine's hline (wrun-run-result `role: "guide"`). */
333
+ const GUIDE_PLOT = 'hline';
334
+ const MOUNTED_KIND_WORDS = {
335
+ priceLabel: 'a price label',
336
+ cornerLabel: 'a corner label',
337
+ table: 'a table',
338
+ drawing: 'a drawing or handle',
339
+ handle: 'a handle that is not a label pinned to a pane corner',
340
+ other: 'not a dense series',
341
+ };
342
+ function mountedOffence(output) {
343
+ if (isSnapshotHandle(output))
344
+ return null;
345
+ if (output.kind === 'series') {
346
+ // A data-only column (plot '') draws nothing; the sheet pass refuses the one that does (a barcolor tint).
347
+ if (output.plot === '' || DENSE_SERIES_PLOTS.has(output.plot))
348
+ return null;
349
+ return `plot '${output.plot}' is not a dense series`;
350
+ }
351
+ // A guide's hline: its one constant value (the last finite value its run gave it), no rows of its own but the
352
+ // constant per bar a sheet fill reads. The landing rewrites its definition from the payload; the run lane's `guides`
353
+ // proof holds the prefix run's value, the mounted one and the session rows' to one another first.
354
+ if (output.kind === 'guide')
355
+ return output.plot === GUIDE_PLOT ? null : `guide '${output.plot}' is not an hline`;
356
+ if (output.kind === 'child') {
357
+ const layout = output.childLayout;
358
+ if (layout !== undefined && (PREPEND_CHILD_LAYOUTS.has(layout) || PREPEND_BATCHED_LAYOUTS.has(layout)))
359
+ return null;
360
+ if (isSeriesPaneChild(output))
361
+ return null;
362
+ return `child '${output.plot}' with layout '${output.childLayout ?? 'none'}'`;
363
+ }
364
+ return MOUNTED_KIND_WORDS[output.kind] ?? 'an unknown output kind';
365
+ }
366
+ /** Why a declared output cannot land as a prepend, null when it can. A sparse output (`omit_if_empty`), a guide
367
+ * (`role: "guide"`) and a style read from the run's last ready row (`stroke_width_by`, `show_price_display_by`) are
368
+ * admitted: a prefix run's last row is the overlap's end, not the chart's newest bar, and its result may omit what
369
+ * the mount shows, so each lands only under the run lane's landing-time proofs (the module note). A sparse guide is
370
+ * not: a page that gives it no value would carry its constant as NaN, which the guide proof refuses on every such
371
+ * page, so it only ever costs a run. */
372
+ function outputOffence(output) {
373
+ const plot = output.plot ?? 'line';
374
+ // A data-only column never mounts; the proof compares its values. A barcolor one tints the chart's candles,
375
+ // aligned by bar index, and an index moves under a prepend.
376
+ if (plot === '')
377
+ return output.barcolor ? 'tints the chart candles by bar index' : null;
378
+ if (!DENSE_SERIES_PLOTS.has(plot))
379
+ return `plot '${plot}' is not a dense series`;
380
+ if (output.displacement_bars_by !== undefined || (output.displacement_bars ?? 0) !== 0)
381
+ return 'displaced';
382
+ if (output.role === 'guide' && output.omit_if_empty)
383
+ return 'a sparse guide (its constant needs a value the page may not give)';
384
+ return null;
385
+ }
386
+ /** The cell layout a declared heatmap builds (wrun-canvases heatmapScaleRule): a grid, book cells or another
387
+ * input's cells. */
388
+ function heatmapLayoutOf(sheet, heatmap) {
389
+ if (heatmap.grid !== undefined)
390
+ return 'grid';
391
+ const source = heatmap.cells !== undefined ? sheet.inputSources?.[heatmap.cells]?.source : undefined;
392
+ return source === 'book' ? 'book' : `${source ?? 'unknown'} cells`;
393
+ }
394
+ function firstNamed(list, fallback) {
395
+ if (!Array.isArray(list) || list.length === 0)
396
+ return null;
397
+ const name = list[0]?.name;
398
+ return typeof name === 'string' && name !== '' ? name : fallback;
399
+ }
400
+ /** Why the sheet's `handles` section (one entry per enabled handle kind, its new-handle defaults) lets the run draw
401
+ * something other than a snapshot, as `<key>: <why>`; null when every kind it enables is a label whose new handles
402
+ * start at a pane corner (or it enables none). A record may move its anchor later; the mounted pass reads the
403
+ * anchor each record carries, and the proof the prefix run's. */
404
+ function handlesOffence(handles) {
405
+ if (handles === undefined)
406
+ return null;
407
+ if (typeof handles !== 'object' || handles === null || Array.isArray(handles)) {
408
+ return 'handles: drawings the run creates';
409
+ }
410
+ for (const [kind, entry] of Object.entries(handles)) {
411
+ if (kind !== SNAPSHOT_HANDLE_KIND)
412
+ return `handles.${kind}: drawings the run creates`;
413
+ const anchor = entry?.anchor;
414
+ if (typeof anchor !== 'string' || !SNAPSHOT_ANCHORS.has(anchor)) {
415
+ return `handles.${kind}: labels at a bar's time or a price, not a pane corner`;
416
+ }
417
+ }
418
+ return null;
419
+ }
420
+ /** The first declaration on the sheet that cannot land as a prepend, as `<key>: <why>`; null when none. The sheet
421
+ * is read beside the mounted list because a run may not have mounted it yet (a handle no bar drew, a strategy). */
422
+ function sheetOffence(sheet) {
423
+ // Untyped sheet keys: `strategy` (wrun-box-segment isWrunStrategySheet), `boxes` and `segments`.
424
+ const loose = sheet;
425
+ if (loose.strategy !== undefined)
426
+ return 'strategy: a strategy output';
427
+ const handles = handlesOffence(sheet.handles);
428
+ if (handles !== null)
429
+ return handles;
430
+ for (const output of sheet.outputs ?? []) {
431
+ const offence = outputOffence(output);
432
+ if (offence !== null)
433
+ return `${output.name}: ${offence}`;
434
+ }
435
+ // A range is a dense band over its two edges' rows: a sparse one (`omit_if_empty`) and one styled from the run's
436
+ // last ready row (`edge_width_by`, `show_price_display_by`) land under the same proofs as an output.
437
+ const declared = [
438
+ [sheet.renderers, 'renderers', 'a renderer (price label, corner label, table or widget)'],
439
+ [sheet.drawings, 'drawings', 'a drawing'],
440
+ [loose.boxes, 'boxes', 'a box'],
441
+ [loose.segments, 'segments', 'a segment'],
442
+ [sheet.levels, 'levels', 'docked levels'],
443
+ [sheet.panels, 'panels', 'a panel'],
444
+ [sheet.profiles, 'profiles', 'a profile'],
445
+ [sheet.matrices, 'matrices', 'a matrix'],
446
+ ];
447
+ for (const [list, fallback, what] of declared) {
448
+ const key = firstNamed(list, fallback);
449
+ if (key !== null)
450
+ return `${key}: ${what}`;
451
+ }
452
+ for (const heatmap of sheet.heatmaps ?? []) {
453
+ const layout = heatmapLayoutOf(sheet, heatmap);
454
+ if (!PREPEND_CHILD_LAYOUTS.has(layout))
455
+ return `${heatmap.name}: a heatmap over ${layout}`;
456
+ }
457
+ // The batched sections (`marks`, `spans`, `rays`) need no pass of their own: their outputs are data-only (the
458
+ // output pass above reads them) and their children prepend rows (PREPEND_BATCHED_LAYOUTS).
459
+ return null;
460
+ }
461
+ /**
462
+ * Whether every output the overlay mounts lands as an exact prepend: each mounted output a dense timestamped series
463
+ * (line, spline, bar, histogram, area, step and their fill variants), a guide's hline, a lower-pane `series` child, a
464
+ * child with cell layout 'book' or 'grid', or a batched marks child (`marks`, `spans`, `rays`); and nothing the sheet
465
+ * declares outside that cohort (guides, sparse declarations and last-row styles are in it, under the run lane's
466
+ * landing-time proofs). The one exception is a snapshot
467
+ * output, a label handle pinned to a pane corner (a sheet whose `handles` enable corner labels alone): admitted,
468
+ * and listed in `snapshotHandles` (positions in `mountedOutputs`, in order), whose payload the overlap proof must
469
+ * find equal on both runs because a landing replaces the mounted handle set whole. Unsupported answers carry the
470
+ * first offending key, mounted outputs first (in the order given), then the sheet's declarations (in sheet order),
471
+ * as `<key>: <why>`.
472
+ */
473
+ export function wrunPrefixCohort(input) {
474
+ const snapshotHandles = [];
475
+ for (const [at, output] of input.mountedOutputs.entries()) {
476
+ const offence = mountedOffence(output);
477
+ if (offence !== null)
478
+ return { supported: false, reason: `${output.key}: ${offence}` };
479
+ if (isSnapshotHandle(output))
480
+ snapshotHandles.push(at);
481
+ }
482
+ const offence = sheetOffence(input.sheet);
483
+ return offence === null ? { supported: true, snapshotHandles } : { supported: false, reason: offence };
484
+ }
@@ -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;