@orangecharts/wrun-chart-host 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (322) hide show
  1. package/README.md +15 -4
  2. package/dist/constants/exchange-names.leaf.d.ts +8 -0
  3. package/dist/constants/exchange-names.leaf.js +101 -0
  4. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
  5. package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +19 -0
  7. package/dist/constants/opra-compliance.constants.js +19 -0
  8. package/dist/constants/replay-ladder.leaf.d.ts +30 -0
  9. package/dist/constants/replay-ladder.leaf.js +99 -0
  10. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  11. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  12. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  13. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  14. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  15. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  16. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  17. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  18. package/dist/host-env.d.ts +313 -18
  19. package/dist/host-env.js +15 -0
  20. package/dist/host-ports.types.d.ts +853 -16
  21. package/dist/index.d.ts +139 -2
  22. package/dist/index.js +139 -2
  23. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  24. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  25. package/dist/interfaces/market-event.interface.d.ts +231 -0
  26. package/dist/interfaces/market-event.interface.js +15 -0
  27. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  28. package/dist/interfaces/opra-realtime.interface.js +34 -59
  29. package/dist/interfaces/replay.interface.d.ts +285 -0
  30. package/dist/interfaces/replay.interface.js +1 -0
  31. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  32. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  33. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  34. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  35. package/dist/market-data/billing.interface.d.ts +219 -0
  36. package/dist/market-data/billing.interface.js +58 -0
  37. package/dist/market-data/venue-governed.util.d.ts +2 -0
  38. package/dist/market-data/venue-governed.util.js +10 -0
  39. package/dist/market-data/venue.d.ts +122 -0
  40. package/dist/market-data/venue.js +1 -0
  41. package/dist/market-data/venues/index.d.ts +97 -0
  42. package/dist/market-data/venues/index.js +33 -0
  43. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  44. package/dist/market-data/venues/opra.d.ts +70 -0
  45. package/dist/market-data/venues/opra.js +74 -0
  46. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  47. package/dist/replay/replayIndicatorRows.js +117 -0
  48. package/dist/replay/replayLadder.d.ts +85 -0
  49. package/dist/replay/replayLadder.js +388 -0
  50. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  51. package/dist/utility/auth/server-clock.util.js +238 -0
  52. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  53. package/dist/utility/chart/builtin-identity.util.js +51 -0
  54. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  55. package/dist/utility/chart/cache-alignment.util.js +926 -0
  56. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  57. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  58. package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
  59. package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
  60. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  61. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  62. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  63. package/dist/utility/chart/color-customization.leaf.js +16 -0
  64. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  65. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  66. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  67. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  68. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  69. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  70. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  71. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  72. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  73. package/dist/utility/chart/index-host-tier.util.js +118 -0
  74. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  75. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  76. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  77. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  78. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  79. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  80. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  81. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  82. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  83. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  84. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  85. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  86. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  87. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  88. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  89. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  90. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  91. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  92. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  93. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  94. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  95. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  96. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  97. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  98. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  99. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  100. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  101. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  102. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  103. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  104. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  105. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  106. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  107. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  108. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  109. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  110. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  111. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  112. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  113. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  114. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  115. package/dist/utility/chart/live-cadence.util.js +37 -0
  116. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  117. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  118. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  119. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  120. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  121. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  122. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  123. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  124. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  125. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  126. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  127. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  128. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  129. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  130. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  131. package/dist/utility/chart/mixed-mode.util.js +139 -0
  132. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  133. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  134. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  135. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  136. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  137. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  138. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  139. package/dist/utility/chart/price-precision.util.js +70 -0
  140. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  141. package/dist/utility/chart/profile-block-size.util.js +141 -0
  142. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  143. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  144. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  145. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  146. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  147. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  148. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  149. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  150. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  151. package/dist/utility/chart/titan-constants.pin.js +18 -5
  152. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  153. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  154. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  155. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  156. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  157. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  158. package/dist/utility/common/data-processing.util.d.ts +138 -0
  159. package/dist/utility/common/data-processing.util.js +346 -0
  160. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  161. package/dist/utility/common/visible-timeout.util.js +23 -8
  162. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  163. package/dist/utility/exchange-format.leaf.js +47 -0
  164. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  165. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  166. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  167. package/dist/utility/market-events/market-events.util.js +392 -0
  168. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  169. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  170. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  171. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  172. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  173. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  174. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  175. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  176. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  177. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  178. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  179. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  180. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  181. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  182. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  183. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
  184. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
  185. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  186. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  187. package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
  188. package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
  189. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  190. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  191. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  192. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  193. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  194. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  195. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  196. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  197. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  198. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  199. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  200. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  201. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  202. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  203. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  204. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  205. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  206. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  207. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  208. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  209. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  210. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  211. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  212. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  213. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  214. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  215. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  216. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  217. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  218. package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
  219. package/dist/utility/wrun/wrun-host.service.js +655 -0
  220. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  221. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  222. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  223. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  224. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  225. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  226. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  227. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  228. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  229. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  230. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  231. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  232. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  233. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  234. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  235. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  236. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  237. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  238. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  239. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  240. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  241. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  242. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  243. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  244. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  245. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  246. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  247. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  248. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  249. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  250. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  251. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  252. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  253. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  254. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  255. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  256. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  257. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  258. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  259. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  260. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
  261. package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
  262. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  263. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  264. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  265. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  266. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  267. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  268. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  269. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  270. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  271. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  272. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  273. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  274. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  275. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  276. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  277. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  278. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  279. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  280. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  281. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  282. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  283. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  284. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  285. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  286. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  287. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  288. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  289. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  290. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  291. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  292. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  293. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  294. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  295. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  296. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  297. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  298. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  299. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  300. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  301. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  302. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  303. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  304. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  305. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  306. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  307. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  308. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  309. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  310. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  311. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  312. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  313. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  314. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  315. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  316. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  317. package/dist/utils/replay/replay-buffer-math.js +684 -0
  318. package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
  319. package/dist/workers/wrun/wrun-abi-host.js +1201 -0
  320. package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
  321. package/dist/workers/wrun/wrun-engine-handler.js +211 -0
  322. package/package.json +3 -3
@@ -0,0 +1,444 @@
1
+ /**
2
+ * The browser lane's row source (WRUN-PARITY-PLAN contract C7, unit U13): `SandboxWrunRowSource` implements
3
+ * `WrunRowSource` over today's browser lanes, so the own run's pass asks a source for rows and reads the batch.
4
+ *
5
+ * - `create` raises the overlay's load signals, asks the pass's lanes (`WrunSandboxHost.prepare`: the chart's sources
6
+ * resolved through wrun-source-rows.util.ts, the tape plan's settings included, into the engine worker's request),
7
+ * runs the module in the engine worker over the window and answers a `WrunRowBatch` in the hosted wire's shape:
8
+ * the module's rows, the canvases' cells (`grids`), the frames, the handles and the sheet.
9
+ * - `range` answers another window of the same session; `changeSettings` re-runs the session's own window with the
10
+ * patched record (a `null` drops the value), the same session, never a new source.
11
+ * - `frames` is the session's live stream: the live tick's hook (`emitWrunSandboxRowFrame`) hands its frames to the
12
+ * listener the pass subscribed. Subscribing is also the pass's word that the batch landed (below).
13
+ * - `teardown` releases the session: the engine worker's live session this source opened (its generation only), the
14
+ * overlay's session lock and every load signal still raised.
15
+ *
16
+ * The source charges no render size of its own: the run-result builder's budget (wrun-render-select.util
17
+ * `createWrunRenderBudget`, one counter over the selection, the frame consumers, the handles and the strategy) is the
18
+ * browser lane's one accounting of the `chart-browser` profile's `caps.renderBytes`, and its refusal carries the kit's
19
+ * code (`wrun_render_result_too_large`) as the cloud's does (plan row 15). The browser profile refuses no family, so a
20
+ * batch carries no refusal.
21
+ *
22
+ * The landing protocol. A run that opens the overlay's live session (`plan.live`: its window reaches the chart's
23
+ * newest bar) holds the overlay's session lock from right before the session opens until the pass took the session:
24
+ * a tick or a reseed never interleaves with the start, the integrate and the context install, as when the pass held
25
+ * the lock itself. The pass takes the session by subscribing to `frames` once the batch is integrated; `teardown`
26
+ * releases it instead (a failed integrate, or a page that opened no session). The load signals a call raised stay up
27
+ * until then too, so the legend loader and the store's kScript loading flag cover the whole pass (data-loading rule
28
+ * 2: the source raises and lowers, the chokepoint derives what shows; rule 3: lowered on success, failure, abort and
29
+ * the deadline alike). A call made after the session was taken, that opens no session, lands with its answer.
30
+ *
31
+ * The source keeps no fetch registry of its own: its lanes ask through `dataFetch`, the coverage planner's in-flight
32
+ * registry and dedupe table.
33
+ */
34
+ import { ensureWrunChartHostSharedHost, wrunChartHostEnv } from '../../host-env.js';
35
+ import { KSCRIPT_STALLED_CODE } from '../../constants/scriptEditor/execution.constants.js';
36
+ import { wrunHandlesOf } from './wrun-handles.util.js';
37
+ import { getWrunBrowserHost } from './wrun-host.service.js';
38
+ import { claimWrunRunLoading, releaseWrunLoading } from './wrun-loading-owner.util.js';
39
+ import { nextWrunOverlayLiveGeneration, onWrunOverlayLiveTeardown, withWrunOverlaySessionLock, } from './wrun-overlay-drivers.util.js';
40
+ import { wrunFramesOf } from './wrun-pack.util.js';
41
+ import { WrunChartGoneError } from './wrun-registry-errors.util.js';
42
+ /** Whether a run's overlay is still on the chart that ran it: the index still holds the same engine, and that engine
43
+ * still holds the same meta (a removal takes the meta off; a remount under the same id is a new meta that its own run
44
+ * publishes for, the same identity `placeWrunResultTables` follows). */
45
+ export function isWrunRunMountOnChart(chartIndex, mount) {
46
+ if (wrunChartHostEnv().chart.instance(chartIndex) !== mount.tc)
47
+ return false;
48
+ const metadata = mount.tc?.metadata;
49
+ return Array.isArray(metadata) && metadata.includes(mount.meta);
50
+ }
51
+ /**
52
+ * Raise a run's load signals, in the vocabulary a cloud run's fetch speaks: the legend loader (`tc.updateLoadState`,
53
+ * the overlay's legend spinner, the affordance kScript overlays show) and the store's kScript loading flag through
54
+ * its single chokepoint (`setKScriptLoadingIndicator`), whose watchdog adds the "Still loading" chip after 20 s and
55
+ * force-lowers a run still going at 75 s with the "Loading stopped" chip: the same chips at the same thresholds on
56
+ * both lanes. Every full run rides it (the add-time initial run, rehydrate, the settings-save recompute, a prefix run,
57
+ * the lazy-wave pan-back rerun dispatched through the drivers' single-flight executor); the live forming-bar tick lane
58
+ * bypasses it and stays loader-free.
59
+ *
60
+ * The legend lower is instance-guarded like the chart's other owners (a chart rebuilt at this index mid-run keeps its
61
+ * own load state). The flag, keyed by the overlay, has one owner across its raisers (wrun-loading-owner.util): a run
62
+ * claims it when it is down or an earlier run holds it (a replacement's run takes it over), leaves a restored
63
+ * record's or a settings-apply cycle's to them, and lowers it only while it still owns it, so a replacement's run or
64
+ * restore that took it over keeps it. A run whose mount is gone before it raises (the chart rebuilt at the index, the
65
+ * record mounted again) computes for nothing on the chart and claims nothing. The store is advisory: one that cannot
66
+ * load (or a partial double) leaves the legend loader as the run's only signal. The lower also takes back the
67
+ * "Loading stopped" chip of a forced lower the run outlived (its verdict replaces it, as a cloud run's result does).
68
+ */
69
+ export async function raiseWrunSandboxLoading(chartIndex, indicatorId, mount) {
70
+ const { tc } = mount;
71
+ tc.updateLoadState?.(indicatorId, true);
72
+ const loadingStore = await wrunChartHostEnv()
73
+ .chart.loadChartStore()
74
+ .then(({ useChartStore }) => useChartStore())
75
+ .catch(() => null);
76
+ let loadingGeneration;
77
+ try {
78
+ if (loadingStore && isWrunRunMountOnChart(chartIndex, mount)) {
79
+ loadingGeneration = claimWrunRunLoading(chartIndex, indicatorId, loadingStore.kscriptLoadingIndicators?.[chartIndex]?.[indicatorId] === true);
80
+ if (loadingGeneration !== undefined)
81
+ loadingStore.setKScriptLoadingIndicator(chartIndex, indicatorId, true);
82
+ }
83
+ }
84
+ catch {
85
+ // A partial store double: the legend loader alone.
86
+ }
87
+ let lowered = false;
88
+ return {
89
+ lower: () => {
90
+ if (lowered)
91
+ return;
92
+ lowered = true;
93
+ const chartStands = wrunChartHostEnv().chart.instance(chartIndex) === tc;
94
+ if (chartStands)
95
+ tc.updateLoadState?.(indicatorId, false);
96
+ try {
97
+ if (loadingStore && releaseWrunLoading(chartIndex, indicatorId, loadingGeneration)) {
98
+ loadingStore.setKScriptLoadingIndicator(chartIndex, indicatorId, false);
99
+ }
100
+ if (loadingStore && chartStands) {
101
+ const rows = loadingStore.getIndicatorDiagnostics(indicatorId, chartIndex);
102
+ const kept = rows.filter((row) => row.code !== KSCRIPT_STALLED_CODE);
103
+ if (kept.length !== rows.length) {
104
+ loadingStore.setIndicatorDiagnostics(chartIndex, indicatorId, kept, { notify: false });
105
+ }
106
+ }
107
+ }
108
+ catch {
109
+ // Advisory like the raise: never a second failure over the run's own outcome.
110
+ }
111
+ },
112
+ };
113
+ }
114
+ /** The canvas classes whose cells ride the wire's `grids` (the kit's shaper: book and volume_profile as `cells`,
115
+ * intrabar as `intrabar`). */
116
+ const WRUN_GRID_CELL_CLASSES = new Set(['book', 'volume_profile', 'intrabar']);
117
+ const wrunBatchCellRows = new WeakMap();
118
+ /** The canvases' cells of a sandbox batch in the browser's own lanes (book, profile and intrabar rows as the price
119
+ * canvases read them), the same blocks the batch's `grids` spell for the wire; undefined for a batch that carries
120
+ * none. */
121
+ export function wrunRowBatchCellRows(batch) {
122
+ return wrunBatchCellRows.get(batch);
123
+ }
124
+ /** The wire's `grids` of a sandbox run: one entry per book, volume_profile or intrabar input a canvas names in
125
+ * `cells`, its rows `[ts, ...block]` off the input rows the module read (the kit shaper's own spelling). */
126
+ function wrunSandboxCellGrids(sheet, inputs) {
127
+ const names = [];
128
+ for (const canvas of [...(sheet.heatmaps ?? []), ...(sheet.profiles ?? [])]) {
129
+ if (canvas.cells !== undefined && !names.includes(canvas.cells))
130
+ names.push(canvas.cells);
131
+ }
132
+ const widths = wrunChartHostEnv().sharedHost().WRUN_HOST_CELL_TUPLE_WIDTHS;
133
+ const grids = [];
134
+ for (const name of names) {
135
+ const input = sheet.inputs.find((entry) => entry.name === name);
136
+ const source = Object.hasOwn(sheet.inputSources, name) ? sheet.inputSources[name]?.source : undefined;
137
+ if (input === undefined || source === undefined || !WRUN_GRID_CELL_CLASSES.has(source))
138
+ continue;
139
+ const width = widths[source];
140
+ if (width === undefined)
141
+ continue;
142
+ const rows = [];
143
+ for (const row of inputs) {
144
+ const block = row.cellBlocks?.get(input.index);
145
+ if (block !== undefined)
146
+ rows.push([row.ts, ...block]);
147
+ }
148
+ grids.push((source === 'intrabar'
149
+ ? { kind: 'intrabar', input: name, width, rows }
150
+ : { kind: 'cells', input: name, class: source, width, rows }));
151
+ }
152
+ return grids;
153
+ }
154
+ /**
155
+ * One batch of the sandbox (a create, a range, a patch or a live frame) in the hosted wire's shape, with no refusal
156
+ * (the browser profile refuses no family; the run-result builder's budget charges the render size). `rows` is the
157
+ * module's own array; `window` and `asOfMs` read off it. `grids` are derived from the input rows on their first
158
+ * read: the browser's canvases read the same blocks in their own lanes (`wrunRowBatchCellRows`), so a run whose batch
159
+ * nobody spells pays no copy of its cells. The shared host must be loaded (every sandbox run loads it first).
160
+ */
161
+ export function wrunSandboxRowBatchOf(input) {
162
+ const { sheet, rows, inputs } = input;
163
+ const first = rows[0];
164
+ const last = rows[rows.length - 1];
165
+ const window = first !== undefined && last !== undefined ? { fromMs: first.ts, toMs: last.ts } : { ...input.window };
166
+ const frames = wrunFramesOf(rows);
167
+ const handles = wrunHandlesOf(rows);
168
+ let grids;
169
+ const batch = {
170
+ window,
171
+ asOfMs: last !== undefined ? last.ts : window.toMs,
172
+ rows: rows,
173
+ get grids() {
174
+ grids ??= wrunSandboxCellGrids(sheet, inputs);
175
+ return grids;
176
+ },
177
+ frames,
178
+ handles: handles,
179
+ refusals: [],
180
+ ...(input.withSheet ? { sheet } : {}),
181
+ };
182
+ if (input.cellRows !== undefined)
183
+ wrunBatchCellRows.set(batch, input.cellRows);
184
+ return batch;
185
+ }
186
+ /** The record with a patch applied: the changed flat values over a copy, `null` dropping a value (C5). */
187
+ function wrunPatchedRecord(record, patch) {
188
+ const merged = (base, changes) => {
189
+ const next = { ...base };
190
+ for (const [key, value] of Object.entries(changes)) {
191
+ if (value === null)
192
+ delete next[key];
193
+ else
194
+ next[key] = value;
195
+ }
196
+ return next;
197
+ };
198
+ return {
199
+ sheet: record.sheet,
200
+ settings: merged(record.settings, patch.settings),
201
+ hostFill: patch.hostFill !== undefined ? merged(record.hostFill, patch.hostFill) : record.hostFill,
202
+ };
203
+ }
204
+ /** The sessions whose frames a pass took, by overlay: the live tick's hook reaches the current one. */
205
+ const wrunSandboxFrameSessions = new Map();
206
+ let wrunSandboxFrameTeardownBound = false;
207
+ /** An overlay's teardown or suspension ends its session's frames (the drivers' teardown hook, bound at the first
208
+ * subscription so the source adds nothing to a chart that never takes a session). */
209
+ function bindWrunSandboxFrameTeardown() {
210
+ if (wrunSandboxFrameTeardownBound)
211
+ return;
212
+ wrunSandboxFrameTeardownBound = true;
213
+ onWrunOverlayLiveTeardown((indicatorId) => {
214
+ wrunSandboxFrameSessions.delete(indicatorId);
215
+ });
216
+ }
217
+ /**
218
+ * The live tick's hook (C7; U14 and U15 wire it): hand one frame of an overlay's sandbox session (built with
219
+ * `wrunSandboxRowBatchOf`) to the listener the pass subscribed. False when no pass took the
220
+ * overlay's session: the tick then integrates its own frame, today's path.
221
+ */
222
+ export function emitWrunSandboxRowFrame(indicatorId, frame) {
223
+ const session = wrunSandboxFrameSessions.get(indicatorId);
224
+ if (session === undefined)
225
+ return false;
226
+ session.listener(frame);
227
+ return true;
228
+ }
229
+ /** Specs only: forget every taken session. */
230
+ export function __resetWrunSandboxRowSourcesForTests() {
231
+ wrunSandboxFrameSessions.clear();
232
+ }
233
+ export class SandboxWrunRowSource {
234
+ host;
235
+ frames;
236
+ identity;
237
+ record;
238
+ window;
239
+ /** The engine worker's live session this source opened last (its generation). */
240
+ opened;
241
+ /** Releases the session lock the last live open holds until the pass takes the session. */
242
+ landing;
243
+ /** The load signals of calls whose batch has not landed yet. */
244
+ holds = new Set();
245
+ listener;
246
+ taken = false;
247
+ torn = false;
248
+ constructor(host) {
249
+ this.host = host;
250
+ this.frames = { subscribe: (listener) => this.subscribe(listener) };
251
+ }
252
+ create(identity, record, window) {
253
+ this.identity = identity;
254
+ this.record = record;
255
+ this.window = window;
256
+ return this.compute(window, record, true);
257
+ }
258
+ range(window) {
259
+ return this.compute(window, this.created().record, false);
260
+ }
261
+ changeSettings(patch) {
262
+ const { record, window } = this.created();
263
+ const patched = wrunPatchedRecord(record, patch);
264
+ this.record = patched;
265
+ return this.compute(window, patched, false);
266
+ }
267
+ teardown() {
268
+ if (this.torn)
269
+ return;
270
+ this.torn = true;
271
+ this.listener = undefined;
272
+ const indicatorId = this.identity?.indicatorId;
273
+ if (indicatorId !== undefined && wrunSandboxFrameSessions.get(indicatorId)?.owner === this) {
274
+ wrunSandboxFrameSessions.delete(indicatorId);
275
+ }
276
+ // That generation only, never the key: a newer owner may hold the key by now. Ended under the lock a live open
277
+ // still holds, before the lock goes.
278
+ if (indicatorId !== undefined && this.opened !== undefined) {
279
+ getWrunBrowserHost().endLiveSeries(indicatorId, this.opened.epoch);
280
+ }
281
+ this.opened = undefined;
282
+ this.land();
283
+ }
284
+ /** The pass took the session: its frames flow to `listener`, the session lock goes and the load signals lower. */
285
+ subscribe(listener) {
286
+ this.listener = listener;
287
+ this.taken = true;
288
+ const indicatorId = this.identity?.indicatorId;
289
+ if (indicatorId !== undefined && !this.torn) {
290
+ bindWrunSandboxFrameTeardown();
291
+ wrunSandboxFrameSessions.set(indicatorId, { owner: this, listener });
292
+ }
293
+ this.land();
294
+ return () => {
295
+ if (this.listener !== listener)
296
+ return;
297
+ this.listener = undefined;
298
+ if (indicatorId !== undefined && wrunSandboxFrameSessions.get(indicatorId)?.owner === this) {
299
+ wrunSandboxFrameSessions.delete(indicatorId);
300
+ }
301
+ };
302
+ }
303
+ /** Every call's batch landed: the load signals still up lower, and a live open's session lock goes. */
304
+ land() {
305
+ for (const hold of this.holds)
306
+ hold.lower();
307
+ this.holds.clear();
308
+ const release = this.landing;
309
+ this.landing = undefined;
310
+ release?.();
311
+ }
312
+ lowerHold(hold) {
313
+ hold.lower();
314
+ this.holds.delete(hold);
315
+ }
316
+ created() {
317
+ if (this.identity === undefined || this.record === undefined || this.window === undefined) {
318
+ throw new Error('a wrun row source answers a range or a settings change only after its create');
319
+ }
320
+ return { identity: this.identity, record: this.record, window: this.window };
321
+ }
322
+ assertStanding(indicatorId) {
323
+ if (this.torn)
324
+ throw new WrunChartGoneError(`wrun overlay '${indicatorId}': its row source was released (superseded)`);
325
+ }
326
+ async compute(window, record, withSheet) {
327
+ const { identity } = this.created();
328
+ const { chartIndex, indicatorId } = identity;
329
+ this.assertStanding(indicatorId);
330
+ const hold = await raiseWrunSandboxLoading(chartIndex, indicatorId, this.host.mount);
331
+ this.holds.add(hold);
332
+ // The session lock this call's live open holds (released by the landing, or below on a failure).
333
+ let release;
334
+ let epoch;
335
+ try {
336
+ this.assertStanding(indicatorId);
337
+ const plan = await this.host.prepare(window, record);
338
+ this.assertStanding(indicatorId);
339
+ let rows;
340
+ if (plan.live) {
341
+ ({ rows, release } = await this.openLive(indicatorId, plan));
342
+ epoch = plan.epoch;
343
+ }
344
+ else {
345
+ await plan.admit();
346
+ rows = await this.runCold(plan.request);
347
+ }
348
+ this.assertStanding(indicatorId);
349
+ await this.host.answered?.(rows);
350
+ const hostLoading = ensureWrunChartHostSharedHost();
351
+ if (hostLoading)
352
+ await hostLoading;
353
+ const batch = wrunSandboxRowBatchOf({
354
+ sheet: plan.request.metadata,
355
+ rows,
356
+ inputs: plan.request.rows,
357
+ window,
358
+ ...(plan.cellRows !== undefined ? { cellRows: plan.cellRows } : {}),
359
+ withSheet,
360
+ });
361
+ this.assertStanding(indicatorId);
362
+ if (!plan.live && this.taken)
363
+ this.lowerHold(hold);
364
+ return batch;
365
+ }
366
+ catch (error) {
367
+ // A session this call opened is ended (that generation only) while its lock is still held, then the lock goes.
368
+ if (epoch !== undefined && this.opened?.epoch === epoch) {
369
+ getWrunBrowserHost().endLiveSeries(indicatorId, epoch);
370
+ this.opened = undefined;
371
+ }
372
+ if (release !== undefined) {
373
+ if (this.landing === release)
374
+ this.landing = undefined;
375
+ release();
376
+ }
377
+ this.lowerHold(hold);
378
+ throw error;
379
+ }
380
+ }
381
+ /** A page short of the live edge: the module runs cold over the window, no live session. */
382
+ runCold(request) {
383
+ return getWrunBrowserHost().runSeries({
384
+ module: request.module,
385
+ metadata: request.metadata,
386
+ rows: request.rows,
387
+ initArgs: request.initArgs,
388
+ ...(request.textParams !== undefined ? { textParams: request.textParams } : {}),
389
+ strategy: request.strategy,
390
+ ...(request.overrideQuarantine ? { overrideQuarantine: request.overrideQuarantine } : {}),
391
+ });
392
+ }
393
+ /**
394
+ * Open the overlay's live session under its session lock and answer the module's rows with the lock still held:
395
+ * the pass's admit (paused meanwhile, the chart's owner left) right before the session is replaced, the generation
396
+ * bumped BEFORE the start so the worker session opens under the epoch the live context will carry. A start that
397
+ * fails ends the session it opened (that generation only, the previous context's next drain then finds no session
398
+ * and reseeds) and lets the lock go. On success the lock stays held until the landing (`land`) or a failure of the
399
+ * call (`compute`) releases it.
400
+ */
401
+ openLive(indicatorId, plan) {
402
+ const { request } = plan;
403
+ return new Promise((resolve, reject) => {
404
+ void withWrunOverlaySessionLock(indicatorId, async () => {
405
+ let epoch;
406
+ let rows;
407
+ try {
408
+ await plan.admit();
409
+ epoch = nextWrunOverlayLiveGeneration(indicatorId);
410
+ plan.epoch = epoch;
411
+ this.opened = { epoch };
412
+ this.taken = false;
413
+ rows = await getWrunBrowserHost().startLiveSeries({
414
+ sessionKey: indicatorId,
415
+ module: request.module,
416
+ metadata: request.metadata,
417
+ rows: request.rows,
418
+ initArgs: request.initArgs,
419
+ ...(request.textParams !== undefined ? { textParams: request.textParams } : {}),
420
+ strategy: request.strategy,
421
+ epoch,
422
+ ...(request.overrideQuarantine ? { overrideQuarantine: request.overrideQuarantine } : {}),
423
+ });
424
+ }
425
+ catch (error) {
426
+ if (epoch !== undefined) {
427
+ getWrunBrowserHost().endLiveSeries(indicatorId, epoch);
428
+ if (this.opened?.epoch === epoch)
429
+ this.opened = undefined;
430
+ }
431
+ reject(error);
432
+ return;
433
+ }
434
+ let release = () => undefined;
435
+ const landed = new Promise((done) => {
436
+ release = done;
437
+ });
438
+ this.landing = release;
439
+ resolve({ rows, release });
440
+ await landed;
441
+ });
442
+ });
443
+ }
444
+ }
@@ -1910,10 +1910,10 @@ export { wrunTwinComputeInputNames } from './wrun-twin-compute-inputs.util.js';
1910
1910
  * empty text keeps the token). Undefined keeps the literal token, the
1911
1911
  * chart's own rule for a falsy kScript value (0, a toggle off); an om
1912
1912
  * style knob (no run value) keeps it too. Every inserted value is LITERAL
1913
- * legend text (wrunLegendLiteral: the HTML specials and `$` as entities),
1914
- * because titan writes the suffix through innerHTML after its own `$token`
1915
- * pass over the raw settings; the template's own characters stay as the
1916
- * author wrote them. */
1913
+ * legend text (wrunLegendLiteral: its own characters, each `$` kept out of
1914
+ * the `$token` pass titan runs over the raw settings before it shows the
1915
+ * suffix as text); the template's own characters stay as the author wrote
1916
+ * them. */
1917
1917
  function renderWrunParamTitleValue(param, value, text) {
1918
1918
  const rendered = renderWrunParamTitleWords(param, value, text);
1919
1919
  return rendered === undefined ? undefined : wrunLegendLiteral(rendered);
@@ -0,0 +1,86 @@
1
+ import type { WrunFeedStreamEvent } from '../../host-ports.types.js';
2
+ import type { WrunPollLaneId, WrunPollLaneLiveAsk, WrunPollLaneLiveSink, WrunPollLaneLiveSubscription } from './sources/wrun-poll-lane.types.js';
3
+ import { type WrunOverlayLiveContext } from './wrun-overlay-drivers.util.js';
4
+ /** A declaration change re-plans an overlay at most this often (a stream head ahead of the plan's
5
+ * read must never loop reruns): within it, the change drops the channel and reconciles only. */
6
+ export declare const WRUN_POLL_LANE_REPLAN_MIN_MS = 60000;
7
+ /** The live tick registers its drain scheduler here at import, so a channel's rows wake the drain
8
+ * (this module never imports the tick). */
9
+ export declare function setWrunPollLaneLiveDrainRequester(fn: ((indicatorId: string) => void) | null): void;
10
+ /** Close every live channel the overlay holds (the teardown hook's; idempotent). */
11
+ export declare function closeWrunPollLaneLiveChannels(indicatorId: string): void;
12
+ /**
13
+ * Open the live channels of a session the run pass just installed (`context`, already the
14
+ * overlay's live context): one per planned instance whose lane names `live`. The replaced
15
+ * session's channel of the same instance on the same grid carries over (no reopen: the stream
16
+ * keeps its connection, and the fresh buffers already hold what it delivered); its other channels
17
+ * close. Idempotent for the same context; a replay session, or one planning no such lane, opens
18
+ * none. A channel that fails to open leaves the poll its path.
19
+ */
20
+ export declare function openWrunPollLaneLiveChannels(context: WrunOverlayLiveContext): void;
21
+ /**
22
+ * Fold a poll lane's live rows (`[bucket_ts, ...columns]` on the grid's bar opens, levels) into its
23
+ * buffer: a bucket the buffer holds has its row REPLACED, a new bucket is inserted in order, a row
24
+ * equal to the held one touches nothing; never a second row for one bucket, never an increment.
25
+ * Returns the new buffer and the touched buckets (ascending), null when nothing moved. Never
26
+ * mutates its inputs.
27
+ */
28
+ export declare function foldWrunPollLaneLiveRows(rows: readonly ArrayLike<number>[] | undefined, live: readonly ArrayLike<number>[]): {
29
+ rows: ArrayLike<number>[];
30
+ touched: number[];
31
+ } | null;
32
+ /**
33
+ * The live tick's drain of a session's channel rows (beside the push intake's): every instance's
34
+ * queued rows folded into its buffer (`foldWrunPollLaneLiveRows`, a new array under a new record:
35
+ * the tail builder and a reseed read the context's own), no fed mark. Returns the oldest bucket they
36
+ * revised before the session's newest row (a committed bar, owed the late reseed, also stamped on
37
+ * the context's `dirtyFromTs`), else null. Nothing for a context the channels do not feed.
38
+ */
39
+ export declare function drainWrunPollLaneLiveRows(context: WrunOverlayLiveContext): number | null;
40
+ /** Whether the lane instance owes a read its live channel cannot stand for (a span it skipped, a
41
+ * join that may have missed readings: `stale`): true until a reconcile answers past the watermark
42
+ * the span rolled its coverage back to. The routine poll asks it then, whatever the channel says. */
43
+ export declare function wrunPollLaneLiveOwed(context: WrunOverlayLiveContext, lane: WrunPollLaneId): boolean;
44
+ /** Whether the lane instance's live channel carries it for this session right now: a routine poll
45
+ * waits while it does (`wrunPollLaneRecheckDue`). False for a session that opened none. */
46
+ export declare function wrunPollLaneLiveUp(context: WrunOverlayLiveContext, lane: WrunPollLaneId): boolean;
47
+ /** The rows a session's channels queued and no drain folded yet (diagnostics and specs). */
48
+ export declare function wrunPollLaneLiveQueued(indicatorId: string): number;
49
+ /** Close every session's channels, drop their queues and the re-plan clock (specs only). */
50
+ export declare function __resetWrunPollLaneLiveForTests(): void;
51
+ /** The lane's key in a reading's values: the feed's first value key (the relay's default for a
52
+ * bars read, the column the lane's fetch reads). */
53
+ export declare const WRUN_SERIES_READING_COLUMN = 0;
54
+ /** Whether a stream reading stands for its bucket: a feed combining by `last` (the default, and the
55
+ * rule of a head that names none, whose bars carry no `combined`), never by another rule (a slot's
56
+ * level is not its bucket's sum, mean, first, max or min). */
57
+ export declare function wrunSeriesStreamCarries(extras: Readonly<Record<string, unknown>>): boolean;
58
+ /** A stream reading as the lane's row on a grid of `intervalMs`: `[bucket_ts_ms, value]`, the
59
+ * value the lane's key (position 0), or null for a state or null cell or an unusable stamp. */
60
+ export declare function wrunSeriesReadingRow(reading: Pick<Extract<WrunFeedStreamEvent, {
61
+ kind: 'reading';
62
+ }>, 'ts' | 'values'>, intervalMs: number): [number, number] | null;
63
+ /**
64
+ * The series lane's live channel for one instance (the lane's `live.subscribe` loads this module
65
+ * and calls it): the feed's stream through the seam, imported here, so nothing of the stream
66
+ * client loads before a session reads a feed. A ref that is no feed address, a feed combining by
67
+ * another rule than `last`, and a stream switched off (`feedStreamEnabled`) answer a channel that
68
+ * is never up without subscribing.
69
+ *
70
+ * Beside the readings (the module doc), the channel guards what it folds:
71
+ * - The declaration: its baseline is the head the session's `plan` judged
72
+ * (`wrunSeriesPlannedHead`; without one, the first head the stream sends). A newer plan of the
73
+ * feed on this grid answering other facts, or a stream `head` of a newer version (a changed rule,
74
+ * cadence, grain or exact interval), ends the channel before any further reading (never up, its
75
+ * readings dropped) and re-plans the session (`replan`): the plan judges the new declaration, and
76
+ * a rule other than `last` keeps the feed on the poll.
77
+ * - A skipped span: a reading landing more than one slot (the larger of the chart interval and the
78
+ * cadence) after the newest bucket the lane holds may follow rows the stream never sent (its
79
+ * sampler keeps the newest row per interval, its catch-up the newest 2,000): the span from the
80
+ * bucket after that one is owed to a reconcile (`stale`), and the reading still folds.
81
+ * - A late join: on the channel's first `up`, when the newest reading the feed is known to hold
82
+ * (its readings and heads, or the tab's newest head of the feed) is after the newest bucket the
83
+ * lane held at open, the readings between the lane's fetch and its subscribe may be missing (a
84
+ * feed another subscriber carried replays no catch-up): that bucket on is owed (`stale`).
85
+ */
86
+ export declare function openWrunSeriesStream(ask: WrunPollLaneLiveAsk, sink: WrunPollLaneLiveSink): Promise<WrunPollLaneLiveSubscription>;