@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,73 @@
1
+ import type { WrunRunReason } from './wrun-lifecycle.contract.js';
2
+ import { type WrunRefusal, type WrunRefusalAttemptToken, type WrunRefusalOverlayTarget } from './wrun-refusal.util.js';
3
+ /** Load the chart instances once (shared by every caller; a failed load is retried). Every async
4
+ * entry point awaits it before `resolveWrunRefusalTarget`, which reads them synchronously. */
5
+ export declare function ensureWrunRefusalChartSide(): Promise<void>;
6
+ /**
7
+ * The overlay's cell now: the target itself while its chart still holds the overlay, else the cell
8
+ * that holds it after a move, else null (removed, chart gone). Null too before the chart instances
9
+ * loaded (`ensureWrunRefusalChartSide`).
10
+ */
11
+ export declare function resolveWrunRefusalTarget(t: WrunRefusalOverlayTarget): WrunRefusalOverlayTarget | null;
12
+ /** The overlay's live settings (its engine meta), or undefined when it is not mounted. */
13
+ export declare function wrunRefusalTargetSettings(t: WrunRefusalOverlayTarget): Record<string, unknown> | undefined;
14
+ export declare function emitWrunRefusalChange(chartIndex: number): void;
15
+ export declare function onWrunRefusalChange(fn: (chartIndex: number) => void): () => void;
16
+ /**
17
+ * Project a record for its owner: the legend (the higher of the overlay's run and tick verdicts),
18
+ * the change event, and a toast when `notify` is true AND the record is paused. `isCurrent` and the
19
+ * target are re-checked after every await; false when the projection went stale or the overlay is
20
+ * gone. A record whose cause is transient waits out the overlay's grace instead (true: it stands for
21
+ * its owner as a shown one does, so a later retraction of the owner reaches it).
22
+ */
23
+ export declare function projectWrunRefusal(target: WrunRefusalOverlayTarget, r: WrunRefusal, opts: {
24
+ owner: 'run' | 'tick';
25
+ notify: boolean;
26
+ isCurrent: () => boolean;
27
+ }): Promise<boolean>;
28
+ export declare function wrunRefusalRetractionCount(target: WrunRefusalOverlayTarget): number;
29
+ export declare function retractWrunRefusal(target: WrunRefusalOverlayTarget, owner: 'run' | 'tick' | 'all'): Promise<void>;
30
+ /**
31
+ * The origin of an executor request's attempt: `user` for the requests a person made (retry, a
32
+ * settings save), `system` for everything the chart starts on its own (resume, the range and
33
+ * source-recovery reruns, heals, theme, live rebuilds). `switch` is system too: it is the reason
34
+ * every refetch gives (a wake resync, an identity heal, a collaborator's apply, as much as the
35
+ * person's own symbol change), and the legend carries the refusal either way. An `initial`
36
+ * request keeps the loader's live token (a user add, or a restore that is `system`), so it
37
+ * reads that token's origin.
38
+ */
39
+ export declare function wrunRefusalAttemptOrigin(reason: WrunRunReason, loaderToken: WrunRefusalAttemptToken | null): 'user' | 'system';
40
+ /** Open an attempt (the loader at mount request time, the executor per request). Re-opening a key
41
+ * supersedes the earlier token. */
42
+ export declare function openWrunRefusalAttempt(chartIndex: number, indicatorId: string, attempt: {
43
+ origin: 'user' | 'system';
44
+ reason: WrunRunReason | 'mount';
45
+ }): WrunRefusalAttemptToken;
46
+ /** The overlay's live token, or null (none opened, or closed). */
47
+ export declare function liveWrunRefusalAttempt(chartIndex: number, indicatorId: string): WrunRefusalAttemptToken | null;
48
+ /** The token's attempt now: wrun_failure_shown's builder runs later. */
49
+ export declare function wrunRefusalAttemptFacts(token: WrunRefusalAttemptToken | null): {
50
+ id: string;
51
+ origin: "user" | "system";
52
+ reason: WrunRunReason | "mount" | undefined;
53
+ openedAt: number | undefined;
54
+ } | null;
55
+ /** True once per live user-origin token; never for `system`, a superseded or a closed token. */
56
+ export declare function claimWrunRefusalNotice(token: WrunRefusalAttemptToken | null): boolean;
57
+ /**
58
+ * The request that carried the token ended (the cloud lane, data-fetching: the protected full run it
59
+ * was handed to answered it, applied or failed, after its refusal terminal claimed any notice, or a
60
+ * later request superseded or cancelled that run; the browser executor keeps its own answered mark):
61
+ * claimable no more, so no refusal of a later run, the chart's own or a collaborator's, notices it.
62
+ * A newer attempt on the key is left alone.
63
+ */
64
+ export declare function concludeWrunRefusalAttempt(token: WrunRefusalAttemptToken | null): void;
65
+ /** Close the token IF it still names the live generation. */
66
+ export declare function closeWrunRefusalAttempt(token: WrunRefusalAttemptToken): void;
67
+ /** Teardown: the overlay's attempt goes, whatever its generation, and so do its verdicts and the
68
+ * records waiting out its grace, whose load signal comes down (a later tenant of the same id
69
+ * starts clean). */
70
+ export declare function closeWrunRefusalAttempts(chartIndex: number, indicatorId: string): void;
71
+ /** Test hook: forget every verdict, token, listener, waiting record and grace, and the loaded chart
72
+ * side. */
73
+ export declare function __resetWrunRefusalSurfaceForTests(): void;
@@ -0,0 +1,380 @@
1
+ import { applyWrunInertLegendState, clearWrunInertLegendState } from './wrun-inert-legend.util.js';
2
+ import { compareWrunRefusals, } from './wrun-refusal.util.js';
3
+ import { isWrunTransientFailureCause } from './wrun-failure-cause.js';
4
+ import { __resetWrunTransientGraceForTests, endWrunTransientGrace, holdWrunTransientRefusal, } from './wrun-transient-rerun.util.js';
5
+ import { wrunChartHostEnv } from '../../host-env.js';
6
+ let chartReader;
7
+ let chartReaderLoad;
8
+ /** Load the chart instances once (shared by every caller; a failed load is retried). Every async
9
+ * entry point awaits it before `resolveWrunRefusalTarget`, which reads them synchronously. */
10
+ export function ensureWrunRefusalChartSide() {
11
+ if (chartReader)
12
+ return Promise.resolve();
13
+ chartReaderLoad ??= wrunChartHostEnv()
14
+ .chart.loadTitanCharts()
15
+ .then((module) => {
16
+ chartReader = { getTC: module.getTC, getTCGroup: module.getTCGroup };
17
+ })
18
+ .catch((error) => {
19
+ chartReaderLoad = undefined;
20
+ throw error;
21
+ });
22
+ return chartReaderLoad;
23
+ }
24
+ function overlayMetaOf(tc, indicatorId) {
25
+ const metadata = tc?.metadata;
26
+ if (!Array.isArray(metadata))
27
+ return undefined;
28
+ return metadata.find((meta) => meta?.id === indicatorId);
29
+ }
30
+ /**
31
+ * The overlay's cell now: the target itself while its chart still holds the overlay, else the cell
32
+ * that holds it after a move, else null (removed, chart gone). Null too before the chart instances
33
+ * loaded (`ensureWrunRefusalChartSide`).
34
+ */
35
+ export function resolveWrunRefusalTarget(t) {
36
+ const reader = chartReader;
37
+ if (!reader) {
38
+ void ensureWrunRefusalChartSide().catch(() => undefined);
39
+ return null;
40
+ }
41
+ if (overlayMetaOf(reader.getTC(t.chartIndex), t.indicatorId)) {
42
+ return { chartIndex: t.chartIndex, indicatorId: t.indicatorId };
43
+ }
44
+ const group = reader.getTCGroup();
45
+ for (let chartIndex = 0; chartIndex < group.length; chartIndex++) {
46
+ if (chartIndex !== t.chartIndex && overlayMetaOf(group[chartIndex], t.indicatorId)) {
47
+ return { chartIndex, indicatorId: t.indicatorId };
48
+ }
49
+ }
50
+ return null;
51
+ }
52
+ /** The overlay's live settings (its engine meta), or undefined when it is not mounted. */
53
+ export function wrunRefusalTargetSettings(t) {
54
+ const meta = overlayMetaOf(chartReader?.getTC(t.chartIndex), t.indicatorId);
55
+ return meta?.settings && typeof meta.settings === 'object' ? meta.settings : undefined;
56
+ }
57
+ // ---------------------------------------------------------------------------
58
+ // Change events
59
+ // ---------------------------------------------------------------------------
60
+ const changeListeners = new Set();
61
+ export function emitWrunRefusalChange(chartIndex) {
62
+ for (const listener of [...changeListeners]) {
63
+ try {
64
+ listener(chartIndex);
65
+ }
66
+ catch {
67
+ // A listener's throw never breaks the projection that emitted.
68
+ }
69
+ }
70
+ }
71
+ export function onWrunRefusalChange(fn) {
72
+ changeListeners.add(fn);
73
+ return () => {
74
+ changeListeners.delete(fn);
75
+ };
76
+ }
77
+ const verdicts = new Map();
78
+ function overlayKey(t) {
79
+ return `${t.chartIndex}:${t.indicatorId}`;
80
+ }
81
+ function topVerdict(owned) {
82
+ const { run, tick } = owned;
83
+ if (run && tick) {
84
+ return compareWrunRefusals(tick, run) < 0 ? { owner: 'tick', refusal: tick } : { owner: 'run', refusal: run };
85
+ }
86
+ if (run)
87
+ return { owner: 'run', refusal: run };
88
+ if (tick)
89
+ return { owner: 'tick', refusal: tick };
90
+ return undefined;
91
+ }
92
+ /** Write the top verdict onto the legend; true when a write happened. */
93
+ function writeTop(tc, t, owned) {
94
+ const top = topVerdict(owned);
95
+ if (!top)
96
+ return clearWrunInertLegendState(tc, t.indicatorId);
97
+ const state = { kind: 'refusal', refusal: top.refusal, owner: top.owner };
98
+ const wrote = applyWrunInertLegendState(tc, t.indicatorId, state);
99
+ // A record the chip now shows (wrun_failure_shown drops a note).
100
+ if (wrote)
101
+ wrunChartHostEnv().diagnostics.reportFailureShown({
102
+ surface: 'legend',
103
+ tc,
104
+ indicatorId: t.indicatorId,
105
+ attempt: liveAttemptFacts(t),
106
+ state,
107
+ });
108
+ return wrote;
109
+ }
110
+ const liveAttemptFacts = (t) => wrunRefusalAttemptFacts(liveWrunRefusalAttempt(t.chartIndex, t.indicatorId));
111
+ /**
112
+ * Project a record for its owner: the legend (the higher of the overlay's run and tick verdicts),
113
+ * the change event, and a toast when `notify` is true AND the record is paused. `isCurrent` and the
114
+ * target are re-checked after every await; false when the projection went stale or the overlay is
115
+ * gone. A record whose cause is transient waits out the overlay's grace instead (true: it stands for
116
+ * its owner as a shown one does, so a later retraction of the owner reaches it).
117
+ */
118
+ export async function projectWrunRefusal(target, r, opts) {
119
+ if (!opts.isCurrent())
120
+ return false;
121
+ try {
122
+ await ensureWrunRefusalChartSide();
123
+ }
124
+ catch {
125
+ return false;
126
+ }
127
+ if (!opts.isCurrent())
128
+ return false;
129
+ const resolved = resolveWrunRefusalTarget(target);
130
+ if (!resolved)
131
+ return false;
132
+ if (isWrunTransientRefusal(r) && waitOutWrunTransientGrace(resolved, r, opts))
133
+ return true;
134
+ // A record that shows now takes the place of the owner's record still waiting out a grace.
135
+ settleWaitingWrunRefusal(resolved, opts.owner, 'superseded');
136
+ const key = overlayKey(resolved);
137
+ const owned = { ...verdicts.get(key), [opts.owner]: r };
138
+ verdicts.set(key, owned);
139
+ const tc = chartReader?.getTC(resolved.chartIndex);
140
+ if (tc)
141
+ writeTop(tc, resolved, owned);
142
+ emitWrunRefusalChange(resolved.chartIndex);
143
+ if (opts.notify && r.severity === 'paused') {
144
+ const actions = await wrunChartHostEnv().ui.loadWrunRefusalActions();
145
+ if (!opts.isCurrent())
146
+ return false;
147
+ const again = resolveWrunRefusalTarget(resolved);
148
+ if (!again)
149
+ return false;
150
+ actions.toastWrunRefusal(r, again);
151
+ wrunChartHostEnv().diagnostics.reportFailureShown({
152
+ surface: 'toast',
153
+ tc: chartReader?.getTC(again.chartIndex),
154
+ indicatorId: again.indicatorId,
155
+ attempt: liveAttemptFacts(again),
156
+ state: { kind: 'refusal', refusal: r, owner: opts.owner },
157
+ });
158
+ }
159
+ return true;
160
+ }
161
+ // ---------------------------------------------------------------------------
162
+ // The transient grace (CLOUD-RUN-ROBUST C5)
163
+ // ---------------------------------------------------------------------------
164
+ const OWNERS = ['run', 'tick'];
165
+ /** Per overlay key, each owner's latest record waiting out the grace. */
166
+ const waiting = new Map();
167
+ /** The record's failure cause (contract C1, frozen at `telemetry.cause`), read structurally: a
168
+ * record carries one once the raiser stamped it, and a record without one shows as before. */
169
+ function wrunRefusalCauseOf(r) {
170
+ const telemetry = r.telemetry;
171
+ if (telemetry === null || typeof telemetry !== 'object')
172
+ return undefined;
173
+ const cause = telemetry.cause;
174
+ return typeof cause === 'string' ? cause : undefined;
175
+ }
176
+ function isWrunTransientRefusal(r) {
177
+ return isWrunTransientFailureCause(wrunRefusalCauseOf(r));
178
+ }
179
+ /** Hold a transient record inside the overlay's grace: true when it waits, false when it shows now
180
+ * (the overlay's grace ran out and it has not painted since). The owner's latest record waits, and
181
+ * a toast an earlier record of the grace owed goes with it. */
182
+ function waitOutWrunTransientGrace(resolved, r, opts) {
183
+ const key = overlayKey(resolved);
184
+ if (!holdWrunTransientRefusal(resolved, () => showWaitingWrunRefusals(key)))
185
+ return false;
186
+ const owned = waiting.get(key);
187
+ const notify = opts.notify || owned?.[opts.owner]?.notify === true;
188
+ waiting.set(key, {
189
+ ...owned,
190
+ [opts.owner]: { target: resolved, refusal: r, notify, isCurrent: opts.isCurrent },
191
+ });
192
+ return true;
193
+ }
194
+ /** The owner's waiting record goes (`all`: every owner's); with none left for the overlay its grace
195
+ * ends: `painted` (a retraction, which ends the failure streak too) or `superseded` (a record that
196
+ * shows at once). */
197
+ function settleWaitingWrunRefusal(resolved, owner, why) {
198
+ const key = overlayKey(resolved);
199
+ const owned = waiting.get(key);
200
+ if (owned && owner !== 'all') {
201
+ const rest = { ...owned };
202
+ delete rest[owner];
203
+ if (rest.run || rest.tick) {
204
+ waiting.set(key, rest);
205
+ return;
206
+ }
207
+ }
208
+ waiting.delete(key);
209
+ endWrunTransientGrace(resolved, why);
210
+ }
211
+ /**
212
+ * The grace's deadline ended it without a paint: each record still waiting goes through the one
213
+ * projection now, which shows it at once (the grace marked the overlay spent before this runs), so
214
+ * it shows exactly as it would have shown at once (the legend, its wrun_failure_shown, a paused
215
+ * record's toast) while the run or tick that raised it still owns the overlay. A record a newer run
216
+ * superseded meanwhile is dropped by that same check: that run's own outcome speaks for the overlay.
217
+ */
218
+ function showWaitingWrunRefusals(key) {
219
+ const owned = waiting.get(key);
220
+ waiting.delete(key);
221
+ for (const owner of OWNERS) {
222
+ const record = owned?.[owner];
223
+ if (!record)
224
+ continue;
225
+ const { target, refusal, notify, isCurrent } = record;
226
+ void projectWrunRefusal(target, refusal, { owner, notify, isCurrent }).catch((error) => {
227
+ console.warn(`[wrun] the refusal of '${target.indicatorId}' was not shown after its grace:`, error);
228
+ });
229
+ }
230
+ }
231
+ /**
232
+ * Retract an owner's verdict: `run` (also clears a run's legacy source-error state), `tick`, or
233
+ * `all` (a full run or reseed success: every earlier verdict goes). A remaining verdict of the
234
+ * other owner shows again; with none, the writer's chip clears.
235
+ */
236
+ /** How many times an overlay's verdicts were retracted (any owner): a memo that skipped a
237
+ * repeat of the same record (the live tick's) is stale once a retraction happened in between,
238
+ * because the note it skipped re-raising is gone. */
239
+ const retractions = new Map();
240
+ export function wrunRefusalRetractionCount(target) {
241
+ return retractions.get(overlayKey(resolveWrunRefusalTarget(target) ?? target)) ?? 0;
242
+ }
243
+ export async function retractWrunRefusal(target, owner) {
244
+ try {
245
+ await ensureWrunRefusalChartSide();
246
+ }
247
+ catch {
248
+ return;
249
+ }
250
+ const resolved = resolveWrunRefusalTarget(target) ?? target;
251
+ const key = overlayKey(resolved);
252
+ retractions.set(key, (retractions.get(key) ?? 0) + 1);
253
+ // A record of the owner still waiting out its grace goes with the verdict it would have been: the
254
+ // retraction is the paint the grace waited for (or a verdict of another kind taking the slot), so
255
+ // it never shows, and the grace ends once none waits.
256
+ settleWaitingWrunRefusal(resolved, owner, 'painted');
257
+ const before = verdicts.get(key);
258
+ let after;
259
+ if (owner !== 'all' && before) {
260
+ after = { ...before };
261
+ delete after[owner];
262
+ if (!after.run && !after.tick)
263
+ after = undefined;
264
+ }
265
+ if (after)
266
+ verdicts.set(key, after);
267
+ else
268
+ verdicts.delete(key);
269
+ const tc = chartReader?.getTC(resolved.chartIndex);
270
+ if (!tc)
271
+ return;
272
+ let changed = false;
273
+ if (after) {
274
+ changed = writeTop(tc, resolved, after);
275
+ }
276
+ else if (owner !== 'tick' || before?.tick) {
277
+ // A tick retract with no tick verdict leaves the shown state alone: it is not a tick's.
278
+ changed = clearWrunInertLegendState(tc, resolved.indicatorId);
279
+ }
280
+ if (changed)
281
+ emitWrunRefusalChange(resolved.chartIndex);
282
+ }
283
+ const attempts = new Map();
284
+ let attemptGeneration = 0;
285
+ function attemptKey(chartIndex, indicatorId) {
286
+ return `${chartIndex}:${indicatorId}`;
287
+ }
288
+ /** Requests a person made: a Retry, a settings save, a market switch. */
289
+ const USER_REASONS = new Set(['retry', 'settings']);
290
+ /**
291
+ * The origin of an executor request's attempt: `user` for the requests a person made (retry, a
292
+ * settings save), `system` for everything the chart starts on its own (resume, the range and
293
+ * source-recovery reruns, heals, theme, live rebuilds). `switch` is system too: it is the reason
294
+ * every refetch gives (a wake resync, an identity heal, a collaborator's apply, as much as the
295
+ * person's own symbol change), and the legend carries the refusal either way. An `initial`
296
+ * request keeps the loader's live token (a user add, or a restore that is `system`), so it
297
+ * reads that token's origin.
298
+ */
299
+ export function wrunRefusalAttemptOrigin(reason, loaderToken) {
300
+ if (reason === 'initial')
301
+ return loaderToken?.origin === 'user' ? 'user' : 'system';
302
+ return USER_REASONS.has(reason) ? 'user' : 'system';
303
+ }
304
+ /** Open an attempt (the loader at mount request time, the executor per request). Re-opening a key
305
+ * supersedes the earlier token. */
306
+ export function openWrunRefusalAttempt(chartIndex, indicatorId, attempt) {
307
+ const key = attemptKey(chartIndex, indicatorId);
308
+ const generation = ++attemptGeneration;
309
+ const openedAt = performance.now();
310
+ attempts.set(key, { generation, origin: attempt.origin, reason: attempt.reason, claimed: false, openedAt });
311
+ return { key, generation, origin: attempt.origin };
312
+ }
313
+ /** The overlay's live token, or null (none opened, or closed). */
314
+ export function liveWrunRefusalAttempt(chartIndex, indicatorId) {
315
+ const key = attemptKey(chartIndex, indicatorId);
316
+ const record = attempts.get(key);
317
+ return record ? { key, generation: record.generation, origin: record.origin } : null;
318
+ }
319
+ /** The token's attempt now: wrun_failure_shown's builder runs later. */
320
+ export function wrunRefusalAttemptFacts(token) {
321
+ if (!token)
322
+ return null;
323
+ const record = attempts.get(token.key);
324
+ const live = record?.generation === token.generation ? record : undefined;
325
+ const id = `${token.key}#${token.generation}`;
326
+ return { id, origin: token.origin, reason: live?.reason, openedAt: live?.openedAt };
327
+ }
328
+ /** True once per live user-origin token; never for `system`, a superseded or a closed token. */
329
+ export function claimWrunRefusalNotice(token) {
330
+ if (!token || token.origin !== 'user')
331
+ return false;
332
+ const record = attempts.get(token.key);
333
+ if (!record || record.generation !== token.generation || record.origin !== 'user' || record.claimed)
334
+ return false;
335
+ record.claimed = true;
336
+ return true;
337
+ }
338
+ /**
339
+ * The request that carried the token ended (the cloud lane, data-fetching: the protected full run it
340
+ * was handed to answered it, applied or failed, after its refusal terminal claimed any notice, or a
341
+ * later request superseded or cancelled that run; the browser executor keeps its own answered mark):
342
+ * claimable no more, so no refusal of a later run, the chart's own or a collaborator's, notices it.
343
+ * A newer attempt on the key is left alone.
344
+ */
345
+ export function concludeWrunRefusalAttempt(token) {
346
+ if (!token)
347
+ return;
348
+ const record = attempts.get(token.key);
349
+ if (record && record.generation === token.generation)
350
+ record.claimed = true;
351
+ }
352
+ /** Close the token IF it still names the live generation. */
353
+ export function closeWrunRefusalAttempt(token) {
354
+ const record = attempts.get(token.key);
355
+ if (record && record.generation === token.generation)
356
+ attempts.delete(token.key);
357
+ }
358
+ /** Teardown: the overlay's attempt goes, whatever its generation, and so do its verdicts and the
359
+ * records waiting out its grace, whose load signal comes down (a later tenant of the same id
360
+ * starts clean). */
361
+ export function closeWrunRefusalAttempts(chartIndex, indicatorId) {
362
+ const target = { chartIndex, indicatorId };
363
+ attempts.delete(attemptKey(chartIndex, indicatorId));
364
+ verdicts.delete(overlayKey(target));
365
+ waiting.delete(overlayKey(target));
366
+ endWrunTransientGrace(target, 'teardown');
367
+ }
368
+ /** Test hook: forget every verdict, token, listener, waiting record and grace, and the loaded chart
369
+ * side. */
370
+ export function __resetWrunRefusalSurfaceForTests() {
371
+ retractions.clear();
372
+ verdicts.clear();
373
+ waiting.clear();
374
+ __resetWrunTransientGraceForTests();
375
+ attempts.clear();
376
+ attemptGeneration = 0;
377
+ changeListeners.clear();
378
+ chartReader = undefined;
379
+ chartReaderLoad = undefined;
380
+ }
@@ -0,0 +1,15 @@
1
+ import { type WrunRefusal } from './wrun-refusal.util.js';
2
+ /** The card's one sentence (also the chip's tooltip). */
3
+ export declare function wrunRefusalSentence(r: WrunRefusal): string;
4
+ /** The card's line under the sentence: the first line of the raiser's own words for a run-failed
5
+ * record whose sentence cannot name the cause, else ''. */
6
+ export declare function wrunRefusalDetail(r: WrunRefusal): string;
7
+ /** The chip's short label. */
8
+ export declare function wrunRefusalChipLabel(r: WrunRefusal): string;
9
+ /** The OUT's button label. */
10
+ export declare function wrunRefusalOutLabel(r: WrunRefusal): string;
11
+ /** "paused" for a refusal that drew nothing; a note has no word. */
12
+ export declare function wrunRefusalSeverityWord(r: WrunRefusal): string;
13
+ /** What Copy details puts on the clipboard: the name, the sentence, the OUT label, then the
14
+ * raiser's technical text, one per line (an empty part is left out). */
15
+ export declare function wrunRefusalCopyText(r: WrunRefusal): string;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * A refusal's words on the main thread (contract C3): every accessor reads `wrunRefusalTexts`
3
+ * (the ONE text path, `wrun-refusal.util.ts`) with the host's locale (`wrunChartHostEnv().t`, the
4
+ * app's i18n singleton on web, plural choice included), at call time, so the active locale always
5
+ * answers. A worker-reachable module renders through `wrunRefusalTexts` with
6
+ * its injected `translate` instead of importing this one.
7
+ */
8
+ import { wrunChartHostEnv } from '../../host-env.js';
9
+ import { wrunRefusalTexts } from './wrun-refusal.util.js';
10
+ function translate(key, params, plural) {
11
+ const named = (params ?? {});
12
+ return wrunChartHostEnv().t(key, named, plural);
13
+ }
14
+ /** The card's one sentence (also the chip's tooltip). */
15
+ export function wrunRefusalSentence(r) {
16
+ return wrunRefusalTexts(r, translate).sentence;
17
+ }
18
+ /** The card's line under the sentence: the first line of the raiser's own words for a run-failed
19
+ * record whose sentence cannot name the cause, else ''. */
20
+ export function wrunRefusalDetail(r) {
21
+ return wrunRefusalTexts(r, translate).detail;
22
+ }
23
+ /** The chip's short label. */
24
+ export function wrunRefusalChipLabel(r) {
25
+ return wrunRefusalTexts(r, translate).chip;
26
+ }
27
+ /** The OUT's button label. */
28
+ export function wrunRefusalOutLabel(r) {
29
+ return wrunRefusalTexts(r, translate).outLabel;
30
+ }
31
+ /** "paused" for a refusal that drew nothing; a note has no word. */
32
+ export function wrunRefusalSeverityWord(r) {
33
+ return wrunRefusalTexts(r, translate).severityWord;
34
+ }
35
+ /** What Copy details puts on the clipboard: the name, the sentence, the OUT label, then the
36
+ * raiser's technical text, one per line (an empty part is left out). */
37
+ export function wrunRefusalCopyText(r) {
38
+ const texts = wrunRefusalTexts(r, translate);
39
+ return [r.indicatorName, texts.sentence, texts.outLabel, r.details].filter((part) => part.length > 0).join('\n');
40
+ }
@@ -0,0 +1,139 @@
1
+ /**
2
+ * The replay lane of a browser-run wrun overlay (WRUN-PARITY-REST B1, D1b
3
+ * row 17 Phase 2): in market replay the overlay draws up to the playhead and
4
+ * advances bar by bar, the contract a kScript built-in follows there
5
+ * (replayIndicators: computed over the replay window from its warm-up head,
6
+ * rows revealed through the cutoff, the bucket before the playhead's, so the
7
+ * forming bar never shows).
8
+ *
9
+ * - Open (the replay prepare, a mid-replay add, a re-anchor): one full run
10
+ * through the executor with the reason 'replay' (wrun-overlay-run.util)
11
+ * over the replay's completed bars through the cutoff, from the head the
12
+ * kScript replay window warms up from (`resolveLocalTechnicalScriptReplayRange`,
13
+ * resolved by the replay module; the candles before the chart's first bar
14
+ * ride the K_OHLCV lane the kScript engine fetches them on), its secondary
15
+ * lanes, legs and run bars fetched through the window's end. The run
16
+ * installs the overlay's session as a replay session (`replay: true`).
17
+ * - Reveal (every reveal, seek and scrub frame of the session): past the
18
+ * session's newest bar, the incremental tail over the newly completed bars
19
+ * (the live tick's compute, `advanceWrunReplaySession`); back, the mounted
20
+ * rows are cut at the new cutoff at once and the session reseeds over the
21
+ * bars through it (the reseed machinery, no fetch); a moved head (a
22
+ * pan-back page), a window end passed, or a session the worker lost
23
+ * reopens. Reveals coalesce, latest wins, one step at a time.
24
+ * - Every integrate of a replay session ends, in the same task, with the
25
+ * mounted rows cut to the replay's bars (wrun-replay-rows.util, at
26
+ * `wrunReplayPaintCutoffOf`).
27
+ * - Close (exit, the re-anchor clear, dispose, an overlay teardown): the
28
+ * replay session ends; the exit rebuild reruns the overlay live.
29
+ * - Either row source (WRUN-PARITY-PLAN C7, plan row 8): the replay run is the
30
+ * own run's pass whichever source answers its rows. A session whose rows a
31
+ * row source answers (the socket row source's historical session: no live
32
+ * feed, its window through the cutoff) carries that source on its record
33
+ * (`rowSource`): a step forward asks it for the newly completed bars and
34
+ * integrates them through the live tick's integrate half
35
+ * (`integrateWrunOverlayLiveFrame`), cut to the playhead like every other
36
+ * replay integrate, so a Protected heatmap mounts its canvas up to the
37
+ * playhead; a step back cuts at once and reopens (the cloud answers a new
38
+ * historical session through the new cutoff). A session without one is the
39
+ * browser lane's worker session, stepped as above.
40
+ *
41
+ * Import graph as in the lifecycle door (which re-exports the entries): the
42
+ * chart through the host's loader (`chart.loadTitanCharts`), the run util, the
43
+ * live tick, the row builder and the row cut by `await import()` beside the
44
+ * executor's ports (`chart.loadExecutorPorts`), inside the async paths.
45
+ */
46
+ import type { WrunCellRows } from './wrun-canvases.util.js';
47
+ import type { WrunRunWindow } from './wrun-lifecycle.contract.js';
48
+ import type { WrunRowSource } from './wrun-row-source.js';
49
+ import { type WrunOverlayLiveContext } from './wrun-overlay-drivers.util.js';
50
+ /** The replay window a lane computes over, epoch ms: `fromMs` is the head the
51
+ * kScript replay window warms up from, `toMs` the end its lanes are fetched
52
+ * through (the replay's forward runway). */
53
+ export type WrunReplayWindow = Pick<WrunRunWindow, 'fromMs' | 'toMs'>;
54
+ /** What a replay run computes over (`wrunReplayRunPlanOf`). */
55
+ export interface WrunReplayRunPlan {
56
+ /** The lane opening this run: a run whose lane closed or reopened meanwhile is superseded. */
57
+ generation: number;
58
+ fromMs: number;
59
+ toMs: number;
60
+ /** The newest completed bar the run computes through. */
61
+ cutoffTs: number;
62
+ }
63
+ /** What a replay run installed, kept beside its session (`noteWrunReplayRun`). */
64
+ export interface WrunReplayRunRecord {
65
+ generation: number;
66
+ /** The newest completed bar the session computed through. */
67
+ cutoffTs: number;
68
+ /** The chart's first bar the session computed over (a pan-back page moves it). */
69
+ firstChartTs: number;
70
+ /** The chart interval, the step from the cutoff to the forming bar. */
71
+ chartIntervalMs: number;
72
+ /** The end the run's lanes, legs and run bars were fetched through. */
73
+ coveredThroughTs: number;
74
+ /** The run fetched something that ends at `coveredThroughTs` (a lane, a
75
+ * leg, the run bars): a cutoff past it reopens the session. */
76
+ needsWindow: boolean;
77
+ /** The K_OHLCV warm-up candles before the chart's first bar (a reseed rebuilds over them). */
78
+ headRows: ReadonlyArray<ArrayLike<number>>;
79
+ /** A run at another interval: its run bars through the window's end, the
80
+ * forming one included as fetched; each step folds the forming bar from
81
+ * the completed chart bars instead (`wrunReplayRunBars`). */
82
+ runBars?: ReadonlyArray<ArrayLike<number>>;
83
+ /** The row source answering this session's rows (the socket row source's
84
+ * historical session): each step asks it, never a worker session. */
85
+ rowSource?: WrunReplayRowSourceStep;
86
+ }
87
+ /** How a replay lane steps a session a row source answers. */
88
+ export interface WrunReplayRowSourceStep {
89
+ /** The session's source: a step forward asks it for the newly completed bars. */
90
+ source: Pick<WrunRowSource, 'range'>;
91
+ /** The cell rows the source holds, as the price canvases read them, with the chart's candles. */
92
+ cellRowsOf: (ohlcvRows: ReadonlyArray<ArrayLike<number>>) => WrunCellRows;
93
+ }
94
+ /**
95
+ * Open (or reopen) the overlay's replay lane at `cutoffTs` over `window`.
96
+ * Synchronous `false` when the id has no wrun driver (the replay module keeps
97
+ * its blank). Otherwise a promise that never rejects: true once the replay
98
+ * run painted, false when a hold (paused, tripped, gated, venue) refused it,
99
+ * the run failed, or the lane closed meanwhile; the replay module then blanks
100
+ * the overlay and lists it hidden.
101
+ */
102
+ export declare function openWrunOverlayReplayLane(chartIndex: number, indicatorId: string, window: WrunReplayWindow, cutoffTs: number): Promise<boolean> | false;
103
+ /** Reveal through `cutoffTs` (the replay's newest completed bar). A no-op
104
+ * without a lane on this chart; a held lane only keeps the cutoff. */
105
+ export declare function revealWrunOverlayReplayLane(chartIndex: number, indicatorId: string, cutoffTs: number): void;
106
+ /** The replay's forward runway grew: the lane's window becomes `window` (the
107
+ * kScript lane's range for it, its head under the 5k clamp), and a session
108
+ * whose lanes end at the old window reopens over the new one, ahead of the
109
+ * playhead (the kScript lane re-inits its engine over the extended range the
110
+ * same way). */
111
+ export declare function extendWrunOverlayReplayLane(chartIndex: number, indicatorId: string, window: WrunReplayWindow): void;
112
+ /** Close the overlay's replay lane: its replay session ends (exit, the
113
+ * re-anchor clear, dispose). The overlay's rows stay as painted. */
114
+ export declare function closeWrunOverlayReplayLane(indicatorId: string): void;
115
+ /** Resume while the chart replays (the store's one recovery path, through the
116
+ * door's `resumeWrunOverlay`): a lane a hold left dormant, or one whose
117
+ * session a Pause ended, reopens at its newest cutoff. Undefined when the
118
+ * overlay has no such lane (the door's own rerun follows). */
119
+ export declare function resumeWrunOverlayReplayLane(chartIndex: number, indicatorId: string): Promise<boolean> | undefined;
120
+ /** Whether the overlay has a replay lane (opening, open, or held dormant). */
121
+ export declare function hasWrunOverlayReplayLane(indicatorId: string): boolean;
122
+ /** What a replay run of this overlay computes over: the lane's window and
123
+ * its newest cutoff, which the run's paint is cut at. Undefined without an
124
+ * opening lane on this chart while it replays (the run is superseded). */
125
+ export declare function wrunReplayRunPlanOf(chartIndex: number, indicatorId: string): WrunReplayRunPlan | undefined;
126
+ /** Whether the lane a replay run computes for is still the one opening on a
127
+ * replaying chart (else the run is superseded and paints nothing). */
128
+ export declare function isWrunReplayRunCurrent(chartIndex: number, indicatorId: string, generation: number): boolean;
129
+ /** The replay run installed `context` as the lane's session (called right
130
+ * after the context install, under the run's session lock). */
131
+ export declare function noteWrunReplayRun(context: WrunOverlayLiveContext, record: WrunReplayRunRecord): void;
132
+ /** The record of a replay session (undefined for a live one). */
133
+ export declare function wrunReplayRunRecordOf(context: object | undefined): WrunReplayRunRecord | undefined;
134
+ /** The cutoff a replay session's paint keeps to (the run or step in
135
+ * progress), read by the integrates of a replay session in their own task
136
+ * (wrun-replay-rows.util `cutWrunReplayRowsAfterApply`). Undefined without a lane. */
137
+ export declare function wrunReplayPaintCutoffOf(indicatorId: string): number | undefined;
138
+ /** Drops every lane (the specs). */
139
+ export declare function __resetWrunReplayLanesForTests(): void;