@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,184 @@
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 type { WrunChartHandle } from '../../host-ports.types.js';
35
+ import type { WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
36
+ import type { WrunCellRows } from './wrun-canvases.util.js';
37
+ import { type WrunStrategyRunInput } from './wrun-host.service.js';
38
+ import { type WrunInputRow } from './wrun-pack.util.js';
39
+ import type { WrunRowBatch, WrunRowFrame, WrunRowFrameStream, WrunRowSource, WrunRowSourceIdentity, WrunRowSourcePatch, WrunRowSourceRecord, WrunRowWindow } from './wrun-row-source.js';
40
+ /** The chart engine a run computes for (the pass's `getTC` read at its head). */
41
+ type WrunSandboxChart = WrunChartHandle;
42
+ /** The engine and the overlay meta a run computes for and integrates into. */
43
+ export interface WrunSandboxMount {
44
+ tc: WrunSandboxChart;
45
+ meta: Record<string, unknown>;
46
+ }
47
+ /** Whether a run's overlay is still on the chart that ran it: the index still holds the same engine, and that engine
48
+ * 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
49
+ * publishes for, the same identity `placeWrunResultTables` follows). */
50
+ export declare function isWrunRunMountOnChart(chartIndex: number, mount: {
51
+ tc: unknown;
52
+ meta: unknown;
53
+ }): boolean;
54
+ /** The load signals one call raised: `lower` takes them down (idempotent). */
55
+ export interface WrunSandboxLoadHold {
56
+ lower(): void;
57
+ }
58
+ /**
59
+ * Raise a run's load signals, in the vocabulary a cloud run's fetch speaks: the legend loader (`tc.updateLoadState`,
60
+ * the overlay's legend spinner, the affordance kScript overlays show) and the store's kScript loading flag through
61
+ * its single chokepoint (`setKScriptLoadingIndicator`), whose watchdog adds the "Still loading" chip after 20 s and
62
+ * force-lowers a run still going at 75 s with the "Loading stopped" chip: the same chips at the same thresholds on
63
+ * both lanes. Every full run rides it (the add-time initial run, rehydrate, the settings-save recompute, a prefix run,
64
+ * the lazy-wave pan-back rerun dispatched through the drivers' single-flight executor); the live forming-bar tick lane
65
+ * bypasses it and stays loader-free.
66
+ *
67
+ * The legend lower is instance-guarded like the chart's other owners (a chart rebuilt at this index mid-run keeps its
68
+ * own load state). The flag, keyed by the overlay, has one owner across its raisers (wrun-loading-owner.util): a run
69
+ * claims it when it is down or an earlier run holds it (a replacement's run takes it over), leaves a restored
70
+ * 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
71
+ * restore that took it over keeps it. A run whose mount is gone before it raises (the chart rebuilt at the index, the
72
+ * record mounted again) computes for nothing on the chart and claims nothing. The store is advisory: one that cannot
73
+ * load (or a partial double) leaves the legend loader as the run's only signal. The lower also takes back the
74
+ * "Loading stopped" chip of a forced lower the run outlived (its verdict replaces it, as a cloud run's result does).
75
+ */
76
+ export declare function raiseWrunSandboxLoading(chartIndex: number, indicatorId: string, mount: WrunSandboxMount): Promise<WrunSandboxLoadHold>;
77
+ /** What a sandbox batch is built from: the sheet the module ran, its rows (the module's own array, its frames,
78
+ * handles and strategy riding on it) and the aligned input rows it read. */
79
+ export interface WrunSandboxBatchInput {
80
+ sheet: WrunIndicatorMetadata;
81
+ rows: WrunOutputRow[];
82
+ inputs: readonly WrunInputRow[];
83
+ /** The window asked for: the batch's window when the run answered no row. */
84
+ window: WrunRowWindow;
85
+ /** The canvases' cells in the browser's own lanes (the run's source rows), beside the wire's `grids`. */
86
+ cellRows?: WrunCellRows;
87
+ /** A create's batch carries the sheet it ran. */
88
+ withSheet: boolean;
89
+ }
90
+ /** The canvases' cells of a sandbox batch in the browser's own lanes (book, profile and intrabar rows as the price
91
+ * canvases read them), the same blocks the batch's `grids` spell for the wire; undefined for a batch that carries
92
+ * none. */
93
+ export declare function wrunRowBatchCellRows(batch: WrunRowBatch): WrunCellRows | undefined;
94
+ /**
95
+ * One batch of the sandbox (a create, a range, a patch or a live frame) in the hosted wire's shape, with no refusal
96
+ * (the browser profile refuses no family; the run-result builder's budget charges the render size). `rows` is the
97
+ * module's own array; `window` and `asOfMs` read off it. `grids` are derived from the input rows on their first
98
+ * read: the browser's canvases read the same blocks in their own lanes (`wrunRowBatchCellRows`), so a run whose batch
99
+ * nobody spells pays no copy of its cells. The shared host must be loaded (every sandbox run loads it first).
100
+ */
101
+ export declare function wrunSandboxRowBatchOf(input: WrunSandboxBatchInput): WrunRowBatch;
102
+ /** The engine worker's request one window resolves to (`WrunBrowserHost.runSeries` / `startLiveSeries`). */
103
+ export interface WrunSandboxRunRequest {
104
+ module: WebAssembly.Module;
105
+ metadata: WrunIndicatorMetadata;
106
+ rows: readonly WrunInputRow[];
107
+ initArgs: readonly number[];
108
+ textParams?: Readonly<Record<number, Uint8Array>>;
109
+ strategy?: WrunStrategyRunInput;
110
+ /** A Retry or a settings run dispatches a package the host quarantined (C5). */
111
+ overrideQuarantine?: boolean;
112
+ }
113
+ /** One window of the browser lane resolved through its lanes: what the engine worker computes. */
114
+ export interface WrunSandboxPlan {
115
+ /** The run opens the overlay's live forming-bar session (its window reaches the chart's newest bar). */
116
+ live: boolean;
117
+ request: WrunSandboxRunRequest;
118
+ /** The pass's last word before the module runs, under the session lock on a live run (a pause, the chart owner):
119
+ * throws to stand the run down. */
120
+ admit(): Promise<void>;
121
+ /** The canvases' cells in the browser's own lanes, carried on the batch. */
122
+ cellRows?: WrunCellRows;
123
+ /** Stamped by the source when the run opens the live session: the generation the session opened under (the
124
+ * session epoch; the live context carries it). */
125
+ epoch?: number;
126
+ }
127
+ /** What a sandbox source needs from the pass that drives it: the mount it raises the load signals on, and the
128
+ * browser lane's lanes, resolving a window's sources (wrun-source-rows.util.ts) into the engine worker's request. */
129
+ export interface WrunSandboxHost {
130
+ mount: WrunSandboxMount;
131
+ prepare(window: WrunRowWindow, record: WrunRowSourceRecord): Promise<WrunSandboxPlan>;
132
+ /** The module answered, before its result is built: the run's debug lines reach the editor console now, so a result
133
+ * the builder refuses still shows the lines that explain it. */
134
+ answered?(rows: WrunOutputRow[]): Promise<void> | void;
135
+ }
136
+ /**
137
+ * The live tick's hook (C7; U14 and U15 wire it): hand one frame of an overlay's sandbox session (built with
138
+ * `wrunSandboxRowBatchOf`) to the listener the pass subscribed. False when no pass took the
139
+ * overlay's session: the tick then integrates its own frame, today's path.
140
+ */
141
+ export declare function emitWrunSandboxRowFrame(indicatorId: string, frame: WrunRowFrame): boolean;
142
+ /** Specs only: forget every taken session. */
143
+ export declare function __resetWrunSandboxRowSourcesForTests(): void;
144
+ export declare class SandboxWrunRowSource implements WrunRowSource {
145
+ private readonly host;
146
+ readonly frames: WrunRowFrameStream;
147
+ private identity;
148
+ private record;
149
+ private window;
150
+ /** The engine worker's live session this source opened last (its generation). */
151
+ private opened;
152
+ /** Releases the session lock the last live open holds until the pass takes the session. */
153
+ private landing;
154
+ /** The load signals of calls whose batch has not landed yet. */
155
+ private readonly holds;
156
+ private listener;
157
+ private taken;
158
+ private torn;
159
+ constructor(host: WrunSandboxHost);
160
+ create(identity: WrunRowSourceIdentity, record: WrunRowSourceRecord, window: WrunRowWindow): Promise<WrunRowBatch>;
161
+ range(window: WrunRowWindow): Promise<WrunRowBatch>;
162
+ changeSettings(patch: WrunRowSourcePatch): Promise<WrunRowBatch>;
163
+ teardown(): void;
164
+ /** The pass took the session: its frames flow to `listener`, the session lock goes and the load signals lower. */
165
+ private subscribe;
166
+ /** Every call's batch landed: the load signals still up lower, and a live open's session lock goes. */
167
+ private land;
168
+ private lowerHold;
169
+ private created;
170
+ private assertStanding;
171
+ private compute;
172
+ /** A page short of the live edge: the module runs cold over the window, no live session. */
173
+ private runCold;
174
+ /**
175
+ * Open the overlay's live session under its session lock and answer the module's rows with the lock still held:
176
+ * the pass's admit (paused meanwhile, the chart's owner left) right before the session is replaced, the generation
177
+ * bumped BEFORE the start so the worker session opens under the epoch the live context will carry. A start that
178
+ * fails ends the session it opened (that generation only, the previous context's next drain then finds no session
179
+ * and reseeds) and lets the lock go. On success the lock stays held until the landing (`land`) or a failure of the
180
+ * call (`compute`) releases it.
181
+ */
182
+ private openLive;
183
+ }
184
+ export {};
@@ -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);