@orangecharts/wrun-chart-host 0.4.0 → 0.6.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 (331) hide show
  1. package/README.md +17 -5
  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/feature-flags.constants.js +7 -2
  5. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
  6. package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
  7. package/dist/constants/opra-compliance.constants.d.ts +19 -0
  8. package/dist/constants/opra-compliance.constants.js +19 -0
  9. package/dist/constants/replay-ladder.leaf.d.ts +30 -0
  10. package/dist/constants/replay-ladder.leaf.js +99 -0
  11. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  12. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  13. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  14. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  15. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  16. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  17. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  18. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  19. package/dist/host-env.d.ts +301 -22
  20. package/dist/host-env.js +15 -0
  21. package/dist/host-ports.types.d.ts +853 -29
  22. package/dist/index.d.ts +140 -2
  23. package/dist/index.js +140 -2
  24. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  25. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  26. package/dist/interfaces/market-event.interface.d.ts +231 -0
  27. package/dist/interfaces/market-event.interface.js +15 -0
  28. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  29. package/dist/interfaces/opra-realtime.interface.js +34 -59
  30. package/dist/interfaces/replay.interface.d.ts +285 -0
  31. package/dist/interfaces/replay.interface.js +1 -0
  32. package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
  33. package/dist/interfaces/wrun-runtime.interface.js +17 -3
  34. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  35. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  36. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  37. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  38. package/dist/market-data/billing.interface.d.ts +219 -0
  39. package/dist/market-data/billing.interface.js +58 -0
  40. package/dist/market-data/venue-governed.util.d.ts +2 -0
  41. package/dist/market-data/venue-governed.util.js +10 -0
  42. package/dist/market-data/venue.d.ts +122 -0
  43. package/dist/market-data/venue.js +1 -0
  44. package/dist/market-data/venues/index.d.ts +97 -0
  45. package/dist/market-data/venues/index.js +33 -0
  46. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  47. package/dist/market-data/venues/opra.d.ts +70 -0
  48. package/dist/market-data/venues/opra.js +74 -0
  49. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  50. package/dist/replay/replayIndicatorRows.js +117 -0
  51. package/dist/replay/replayLadder.d.ts +85 -0
  52. package/dist/replay/replayLadder.js +388 -0
  53. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  54. package/dist/utility/auth/server-clock.util.js +238 -0
  55. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  56. package/dist/utility/chart/builtin-identity.util.js +51 -0
  57. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  58. package/dist/utility/chart/cache-alignment.util.js +926 -0
  59. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  60. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  61. package/dist/utility/chart/chart-mount-epoch.util.d.ts +17 -0
  62. package/dist/utility/chart/chart-mount-epoch.util.js +61 -0
  63. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  64. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  65. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  66. package/dist/utility/chart/color-customization.leaf.js +16 -0
  67. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  68. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  69. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  70. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  71. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  72. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  73. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  74. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  75. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  76. package/dist/utility/chart/index-host-tier.util.js +118 -0
  77. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  78. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  79. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  80. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  81. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  82. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  83. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  84. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  85. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  86. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  87. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  88. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  89. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  90. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  91. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  92. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  93. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  94. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  95. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  96. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  97. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  98. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  99. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  100. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  101. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  102. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  103. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  104. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  105. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  106. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  107. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  108. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  109. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  110. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  111. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  112. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  113. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  114. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  115. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  116. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  117. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  118. package/dist/utility/chart/live-cadence.util.js +37 -0
  119. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  120. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  121. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  122. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  123. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  124. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  125. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  126. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  127. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  128. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  129. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  130. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  131. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  132. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  133. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  134. package/dist/utility/chart/mixed-mode.util.js +139 -0
  135. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  136. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  137. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  138. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  139. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  140. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  141. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  142. package/dist/utility/chart/price-precision.util.js +70 -0
  143. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  144. package/dist/utility/chart/profile-block-size.util.js +141 -0
  145. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  146. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  147. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  148. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  149. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  150. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  151. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  152. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  153. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  154. package/dist/utility/chart/titan-constants.pin.js +18 -5
  155. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  156. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  157. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  158. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  159. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  160. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  161. package/dist/utility/common/data-processing.util.d.ts +138 -0
  162. package/dist/utility/common/data-processing.util.js +346 -0
  163. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  164. package/dist/utility/common/visible-timeout.util.js +23 -8
  165. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  166. package/dist/utility/exchange-format.leaf.js +47 -0
  167. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  168. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  169. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  170. package/dist/utility/market-events/market-events.util.js +392 -0
  171. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  172. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  173. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  174. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  175. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  176. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  177. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  178. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  179. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  180. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  181. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  182. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  183. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  184. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  185. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  186. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
  187. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
  188. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  189. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  190. package/dist/utility/wrun/wrun-bar-count.util.d.ts +94 -0
  191. package/dist/utility/wrun/wrun-bar-count.util.js +274 -0
  192. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  193. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  194. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  195. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  196. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  197. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  198. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  199. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  200. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  201. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  202. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  203. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  204. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  205. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  206. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  207. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  208. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  209. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  210. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  211. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  212. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  213. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  214. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  215. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  216. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  217. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  218. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  219. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  220. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  221. package/dist/utility/wrun/wrun-host.service.d.ts +330 -0
  222. package/dist/utility/wrun/wrun-host.service.js +855 -0
  223. package/dist/utility/wrun/wrun-hover.util.d.ts +3 -0
  224. package/dist/utility/wrun/wrun-hover.util.js +25 -4
  225. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  226. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  227. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  228. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  229. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  230. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  231. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  232. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  233. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  234. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  235. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  236. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  237. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  238. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  239. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  240. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  241. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  242. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  243. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  244. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  245. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  246. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  247. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  248. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  249. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  250. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  251. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  252. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  253. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  254. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  255. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  256. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  257. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  258. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  259. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  260. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  261. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  262. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  263. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  264. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  265. package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
  266. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
  267. package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
  268. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  269. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  270. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  271. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  272. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  273. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  274. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  275. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  276. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  277. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  278. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  279. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  280. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  281. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  282. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  283. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  284. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  285. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  286. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  287. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  288. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  289. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  290. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  291. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  292. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  293. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  294. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  295. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  296. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  297. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  298. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  299. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  300. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  301. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  302. package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
  303. package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
  304. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  305. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  306. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  307. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  308. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  309. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  310. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  311. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  312. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  313. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  314. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  315. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  316. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  317. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  318. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  319. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  320. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  321. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  322. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  323. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  324. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  325. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  326. package/dist/utils/replay/replay-buffer-math.js +684 -0
  327. package/dist/workers/wrun/wrun-abi-host.d.ts +203 -0
  328. package/dist/workers/wrun/wrun-abi-host.js +1220 -0
  329. package/dist/workers/wrun/wrun-engine-handler.d.ts +20 -0
  330. package/dist/workers/wrun/wrun-engine-handler.js +380 -0
  331. package/package.json +3 -3
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The OPRA provenance of a cloud run (UW-PARITY contract opra-server-lanes 10b). The server knows what a hosted run
3
+ * read and the browser does not, so a cloud run that reads OPRA marks every frame it answers (`output.wrunOpra`,
4
+ * read by `readWrunHostedRunLevel` into the batch's and the frame's `opra`), and the chart stamps the overlay
5
+ * (`settings.metaExchange = 'OPRA'`, the field the chart read, the MCP withhold and the legend read) before any row
6
+ * the mark rides lands, exactly as it stamps a browser run's OPRA read:
7
+ *
8
+ * - a result batch with the mark is stamped through the run's own provenance writer before its rows are applied, and
9
+ * a stamp that cannot be written fails the batch (`integrateWrunRowSourceBatch`);
10
+ * - a result batch without the mark sheds the stamp once its rows replaced the overlay's, under the writer's refusal
11
+ * (a fetch door that admitted an OPRA source after the run started keeps it);
12
+ * - a live frame with the mark stamps an overlay that is not stamped yet before the frame lands, and a frame whose
13
+ * stamp cannot be written is skipped (`integrateWrunOverlayLiveFrame`); a live frame never clears the stamp.
14
+ *
15
+ * A child or nested overlay of the run is withheld with it by the chart read policy, as for a browser run.
16
+ */
17
+ /** Whether a mounted overlay's settings carry the OPRA provenance stamp. */
18
+ export declare function wrunOverlayOpraStamped(meta: {
19
+ settings?: unknown;
20
+ } | null | undefined): boolean;
21
+ /**
22
+ * Stamp the overlay a live frame with the cloud's OPRA mark lands on, when the result has not stamped it yet: both
23
+ * settings copies (`setOptionsOverlayOpraProvenance`), then read back off the mounted overlay. Answers whether the
24
+ * overlay carries the stamp now; false skips the frame (fail closed). Never clears.
25
+ */
26
+ export declare function stampWrunLiveFrameOpra(chartIndex: number, indicatorId: string, meta: {
27
+ settings?: unknown;
28
+ }): Promise<boolean>;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The OPRA provenance of a cloud run (UW-PARITY contract opra-server-lanes 10b). The server knows what a hosted run
3
+ * read and the browser does not, so a cloud run that reads OPRA marks every frame it answers (`output.wrunOpra`,
4
+ * read by `readWrunHostedRunLevel` into the batch's and the frame's `opra`), and the chart stamps the overlay
5
+ * (`settings.metaExchange = 'OPRA'`, the field the chart read, the MCP withhold and the legend read) before any row
6
+ * the mark rides lands, exactly as it stamps a browser run's OPRA read:
7
+ *
8
+ * - a result batch with the mark is stamped through the run's own provenance writer before its rows are applied, and
9
+ * a stamp that cannot be written fails the batch (`integrateWrunRowSourceBatch`);
10
+ * - a result batch without the mark sheds the stamp once its rows replaced the overlay's, under the writer's refusal
11
+ * (a fetch door that admitted an OPRA source after the run started keeps it);
12
+ * - a live frame with the mark stamps an overlay that is not stamped yet before the frame lands, and a frame whose
13
+ * stamp cannot be written is skipped (`integrateWrunOverlayLiveFrame`); a live frame never clears the stamp.
14
+ *
15
+ * A child or nested overlay of the run is withheld with it by the chart read policy, as for a browser run.
16
+ */
17
+ import { wrunChartHostEnv } from '../../host-env.js';
18
+ /** The provenance word an OPRA-stamped overlay carries (options-overlay-provenance.util `OPRA_PROVENANCE`). */
19
+ const OPRA_PROVENANCE = 'OPRA';
20
+ /** Whether a mounted overlay's settings carry the OPRA provenance stamp. */
21
+ export function wrunOverlayOpraStamped(meta) {
22
+ const settings = meta?.settings;
23
+ return (typeof settings === 'object' &&
24
+ settings !== null &&
25
+ settings.metaExchange === OPRA_PROVENANCE);
26
+ }
27
+ /**
28
+ * Stamp the overlay a live frame with the cloud's OPRA mark lands on, when the result has not stamped it yet: both
29
+ * settings copies (`setOptionsOverlayOpraProvenance`), then read back off the mounted overlay. Answers whether the
30
+ * overlay carries the stamp now; false skips the frame (fail closed). Never clears.
31
+ */
32
+ export async function stampWrunLiveFrameOpra(chartIndex, indicatorId, meta) {
33
+ if (wrunOverlayOpraStamped(meta))
34
+ return true;
35
+ try {
36
+ // The provenance writer is web's (utility/indicators/options-overlay-provenance.util), loaded at call time.
37
+ const { setOptionsOverlayOpraProvenance } = await wrunChartHostEnv().chart.loadOptionsOverlayProvenance();
38
+ setOptionsOverlayOpraProvenance(chartIndex, indicatorId, true);
39
+ }
40
+ catch (error) {
41
+ console.warn(`[wrun] the OPRA stamp of '${indicatorId}' was not written; its live frame is skipped:`, error);
42
+ return false;
43
+ }
44
+ return wrunOverlayOpraStamped(meta);
45
+ }
@@ -0,0 +1,18 @@
1
+ import type { WrunRowLaneInstance } from './sources/wrun-row-lane.types.js';
2
+ /** One coin channel to subscribe: the script source (its K control), the exchange and the coin. */
3
+ export interface WrunCoinLaneChannel {
4
+ sourceType: string;
5
+ exchange: string;
6
+ coin: string;
7
+ }
8
+ /** The script sources (upper case) every row lane fed by coin rides: the live map admits them. */
9
+ export declare function wrunCoinLaneSourceTypes(): ReadonlySet<string>;
10
+ /**
11
+ * The coin channels a live session's row lanes subscribe, one per (source, exchange, coin): each instance of a lane
12
+ * fed by coin, its acquisition the run recorded (the instance's extras when it recorded none), a governed one only at
13
+ * a real-time routed tier. `chartExchange` stands for a lane that reads no governed plane.
14
+ */
15
+ export declare function wrunRowLaneCoinChannels(context: {
16
+ rowLanes?: ReadonlyArray<WrunRowLaneInstance>;
17
+ acquisition: Readonly<Record<string, Readonly<Record<string, unknown>> | undefined>>;
18
+ }, chartExchange: string): WrunCoinLaneChannel[];
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The live channels of the row lanes fed by COIN (`WrunRowLaneDescriptor.liveByCoin`, UW-PARITY: the OPRA print
3
+ * class): one coin-scoped channel per live instance, subscribed through the lane's own K control (its script source
4
+ * names the control, `K_<SOURCE>`, which builds the channel with `formatCoinSubChannel`), beside the push lanes the
5
+ * technical-script control's wrun branch already subscribes.
6
+ *
7
+ * - A governed lane subscribes only when its read is routed REAL-TIME (the acquisition's `servedTier`, re-read by the
8
+ * run before its first ask): a delayed read serves history only, the reconcile re-asks it past the embargo.
9
+ * - The channel names the plane's exchange for a governed lane (`OPRA`) and the instance's coin (its acquisition's
10
+ * `coin`, the chart's underlying); an instance naming no coin subscribes nothing.
11
+ *
12
+ * Pure and light: reads the row-lane registry and the OPRA lane rules only.
13
+ */
14
+ import { wrunRowLaneByKey, wrunRowLanes } from './sources/row-lane-registry.js';
15
+ import { isWrunOpraLaneAcquisition, wrunOpraLaneServedTier } from './wrun-opra-lane.util.js';
16
+ /** The exchange a governed plane's coin channel names. */
17
+ const PLANE_EXCHANGE = Object.freeze({ opra: 'OPRA' });
18
+ /** The script sources (upper case) every row lane fed by coin rides: the live map admits them. */
19
+ export function wrunCoinLaneSourceTypes() {
20
+ return new Set(wrunRowLanes().flatMap((lane) => (lane.liveByCoin ? [lane.liveByCoin.scriptSource.toUpperCase()] : [])));
21
+ }
22
+ /**
23
+ * The coin channels a live session's row lanes subscribe, one per (source, exchange, coin): each instance of a lane
24
+ * fed by coin, its acquisition the run recorded (the instance's extras when it recorded none), a governed one only at
25
+ * a real-time routed tier. `chartExchange` stands for a lane that reads no governed plane.
26
+ */
27
+ export function wrunRowLaneCoinChannels(context, chartExchange) {
28
+ const channels = new Map();
29
+ for (const instance of context.rowLanes ?? []) {
30
+ const lane = wrunRowLaneByKey(instance.laneKey);
31
+ const live = lane?.liveByCoin;
32
+ if (lane === undefined || live === undefined)
33
+ continue;
34
+ const acquisition = context.acquisition[instance.key] ?? instance.extras;
35
+ if (lane.governed !== undefined) {
36
+ if (!isWrunOpraLaneAcquisition(acquisition) || wrunOpraLaneServedTier(acquisition) !== 'realtime')
37
+ continue;
38
+ }
39
+ const coin = typeof acquisition.coin === 'string' ? acquisition.coin.trim().toUpperCase() : '';
40
+ if (coin === '')
41
+ continue;
42
+ const exchange = lane.governed !== undefined ? PLANE_EXCHANGE[lane.governed] : chartExchange;
43
+ const channel = { sourceType: live.scriptSource, exchange, coin };
44
+ channels.set(`${channel.sourceType}|${exchange}|${coin}`, channel);
45
+ }
46
+ return [...channels.values()];
47
+ }
@@ -27,6 +27,7 @@
27
27
  * network legs keep their wall-clock deadlines inside them.
28
28
  */
29
29
  import { startVisibleTimeout } from '../common/visible-timeout.util.js';
30
+ import { wrunHostVisibleClock } from './wrun-host-visible-clock.util.js';
30
31
  import { WrunDeadlineError } from './wrun-registry-errors.util.js';
31
32
  /** Downloading + verifying a package from the registry (resolve, tarball). A network phase. */
32
33
  export const WRUN_DOWNLOAD_DEADLINE_MS = 45_000;
@@ -65,7 +66,7 @@ export async function withWrunDeadline(promise, ms, label, clock = 'wall') {
65
66
  const hiddenSeconds = Math.round(deadline.hiddenMs() / 1000);
66
67
  const hidden = hiddenSeconds > 0 ? ` of visible time (${hiddenSeconds}s hidden before)` : '';
67
68
  reject(new WrunDeadlineError(`${label} timed out after ${seconds}s${hidden}`));
68
- }, ms);
69
+ }, ms, wrunHostVisibleClock());
69
70
  release = () => deadline.clear();
70
71
  return;
71
72
  }
@@ -0,0 +1,39 @@
1
+ /**
2
+ * The Indicator debug channel: a wrun-2 string slot named exactly `debug`
3
+ * (sheet `string_slots[i].name === 'debug'`; code-first
4
+ * `string("debug", { max_bytes })`, written per bar from `finalize()` through
5
+ * the generated `str_debug(text)` sender) is the package's debug log, the
6
+ * Indicator counterpart of kScript's `print()`. No ABI change, no wire
7
+ * channel: the slot rides the string channel like any other and keeps every
8
+ * behavior it has today (a renderer may still name it in `cells`); this
9
+ * module is the only extra reader.
10
+ *
11
+ * `selectWrunDebugLines` is the pure selector: one line per READY row whose
12
+ * `debug` text is non-empty, oldest bar first, `<bar time as ISO 8601 UTC>
13
+ * <text>`. The drivers publish its answer after every run that produced rows
14
+ * (the full run, the reseed, the live drain) through the store's
15
+ * `setIndicatorPrintOutputs`, the kScript print() path, so the editor
16
+ * console's Output lane, its storage cap (`capPrintLinesForStorage`) and its
17
+ * truncation notice apply unchanged. Rebuilt from the run's rows every time,
18
+ * never appended: an empty answer clears the previous run's lines.
19
+ *
20
+ * Row timestamps: on the FE a `WrunOutputRow.ts` is the chart's own bar time
21
+ * in epoch MILLISECONDS (the input rows carry the candle row's `[0]`, and the
22
+ * `time.bar_open_sec` input is derived from it by `/ 1000` in
23
+ * wrun-source-rows.util), so the ISO time is `new Date(ts)`; the ABI's
24
+ * epoch-seconds convention lives inside the guest, never on these rows.
25
+ *
26
+ * Leaf module (types only) so both drivers and the specs read it without
27
+ * dragging the host or the store.
28
+ */
29
+ import type { WrunIndicatorMetadata, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
30
+ /** The declared index of the sheet's `debug` string slot, undefined when
31
+ * the package declares none (then it has no debug log). */
32
+ export declare function wrunDebugSlotIndex(metadata: Pick<WrunIndicatorMetadata, 'string_slots'>): number | undefined;
33
+ /**
34
+ * The debug lines of one run: rows in their given (oldest-first) order, ready
35
+ * rows only (`outputs === null` never wrote a slot), the `debug` slot's text
36
+ * when present and non-empty. `[]` when the sheet declares no `debug` slot
37
+ * or no row wrote one.
38
+ */
39
+ export declare function selectWrunDebugLines(metadata: Pick<WrunIndicatorMetadata, 'string_slots'>, rows: ReadonlyArray<WrunOutputRow>): string[];
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The Indicator debug channel: a wrun-2 string slot named exactly `debug`
3
+ * (sheet `string_slots[i].name === 'debug'`; code-first
4
+ * `string("debug", { max_bytes })`, written per bar from `finalize()` through
5
+ * the generated `str_debug(text)` sender) is the package's debug log, the
6
+ * Indicator counterpart of kScript's `print()`. No ABI change, no wire
7
+ * channel: the slot rides the string channel like any other and keeps every
8
+ * behavior it has today (a renderer may still name it in `cells`); this
9
+ * module is the only extra reader.
10
+ *
11
+ * `selectWrunDebugLines` is the pure selector: one line per READY row whose
12
+ * `debug` text is non-empty, oldest bar first, `<bar time as ISO 8601 UTC>
13
+ * <text>`. The drivers publish its answer after every run that produced rows
14
+ * (the full run, the reseed, the live drain) through the store's
15
+ * `setIndicatorPrintOutputs`, the kScript print() path, so the editor
16
+ * console's Output lane, its storage cap (`capPrintLinesForStorage`) and its
17
+ * truncation notice apply unchanged. Rebuilt from the run's rows every time,
18
+ * never appended: an empty answer clears the previous run's lines.
19
+ *
20
+ * Row timestamps: on the FE a `WrunOutputRow.ts` is the chart's own bar time
21
+ * in epoch MILLISECONDS (the input rows carry the candle row's `[0]`, and the
22
+ * `time.bar_open_sec` input is derived from it by `/ 1000` in
23
+ * wrun-source-rows.util), so the ISO time is `new Date(ts)`; the ABI's
24
+ * epoch-seconds convention lives inside the guest, never on these rows.
25
+ *
26
+ * Leaf module (types only) so both drivers and the specs read it without
27
+ * dragging the host or the store.
28
+ */
29
+ /** The reserved string-slot name of the Indicator debug log. */
30
+ const WRUN_DEBUG_SLOT_NAME = 'debug';
31
+ /** The declared index of the sheet's `debug` string slot, undefined when
32
+ * the package declares none (then it has no debug log). */
33
+ export function wrunDebugSlotIndex(metadata) {
34
+ return metadata.string_slots?.find((slot) => slot.name === WRUN_DEBUG_SLOT_NAME)?.index;
35
+ }
36
+ /** One console line: the bar's time as ISO 8601 UTC, a space, the text.
37
+ * A non-finite timestamp (never a chart row, but never a throw either)
38
+ * prints as its raw value. */
39
+ function formatWrunDebugLine(barTimeMs, text) {
40
+ const stamp = Number.isFinite(barTimeMs) ? new Date(barTimeMs).toISOString() : String(barTimeMs);
41
+ return `${stamp} ${text}`;
42
+ }
43
+ /**
44
+ * The debug lines of one run: rows in their given (oldest-first) order, ready
45
+ * rows only (`outputs === null` never wrote a slot), the `debug` slot's text
46
+ * when present and non-empty. `[]` when the sheet declares no `debug` slot
47
+ * or no row wrote one.
48
+ */
49
+ export function selectWrunDebugLines(metadata, rows) {
50
+ const slot = wrunDebugSlotIndex(metadata);
51
+ if (slot === undefined)
52
+ return [];
53
+ const lines = [];
54
+ for (const row of rows) {
55
+ if (row.outputs === null)
56
+ continue;
57
+ const text = row.strings?.[slot];
58
+ if (typeof text !== 'string' || text.length === 0)
59
+ continue;
60
+ lines.push(formatWrunDebugLine(row.ts, text));
61
+ }
62
+ return lines;
63
+ }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * A sheet's DECLARED warm-up, read by the chart (PINE-TV-PARITY, 2026-10-05).
3
+ *
4
+ * The kit lets a package declare the primary-bar window its values need before they settle:
5
+ * `warmup({ terms: [{ param, times }], plus, min })`, written to the sheet as `warmup`, and the
6
+ * hand-written sheet field `warmup_bars`. om's hosted runner fetches that window before the first bar
7
+ * it evaluates (packages/sdk/src/wrun-host/plan.ts, planWarmup); the chart ignored it, so a converted
8
+ * Pine with a 600-bar lookback computed on the 310 bars a fresh 1h chart holds and drew different
9
+ * levels than TradingView until a pan-back.
10
+ *
11
+ * The chart honors it through the warm-up ask the wrun lane already makes after a full run
12
+ * (`askWrunWarmupBackfillIfOwed`, wrun-overlay-run.util): the declaration places a warm-up end that
13
+ * many evaluated rows into the run's window, the decider reads it beside the plotted outputs' own
14
+ * warm-up end (`withDeclaredWarmupEnd`), and a page of older candles is asked while that end still
15
+ * lands inside the viewport, so the bars on screen get the declared window of history before them.
16
+ * The declared lookback the decider sizes with stays a proven twin's alone: a declaration never
17
+ * changes the all-NaN rules (an empty run still keeps its second page). No new fetch initiator,
18
+ * range decider or dedupe rule: the page rides `kscript-warmup-backfill` through the lazy chain, and
19
+ * the prepend's wave reruns the overlay.
20
+ *
21
+ * Bounds. The declaration is read up to WRUN_DECLARED_WARMUP_MAX_BARS; what any declaration can
22
+ * buy is the decider's own bound, the same as a kScript's declared depth: at most two rounds of at
23
+ * most 500 bars (two 250-bar loader buckets) per overlay per chart identity (market and interval),
24
+ * forgotten only by a settings save, never past the venue's left wall or the tier's history cap,
25
+ * never while the viewport moves. A sheet declaring a billion bars costs at most 1,000 bars of
26
+ * candles per identity, like one declaring 1,001.
27
+ *
28
+ * The exact warm-up stamp (`history_warmup`, round A of the warm-up program) reads through here too:
29
+ * its shape (`wrunHistoryWarmupOf`), its W (`wrunHistoryWarmupBars`: every window evaluated with the
30
+ * declaration's own arithmetic, the strict reading a running start needs, or the reason there is none)
31
+ * and the credit a hidden head the session's guest evaluated earns against the declared warm-up ask
32
+ * (`wrunDeclaredWarmupEndTs`'s `creditedBars`): the bars the head already ran are never bought again as
33
+ * visible pages.
34
+ */
35
+ import type { WrunHistoryWarmup, WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
36
+ /**
37
+ * The deepest declared warm-up the chart reads, in bars: Pine's `max_bars_back` ceiling, the
38
+ * deepest history a Pine script can reference, so no converted script declares more for a reason.
39
+ * It keeps the warm-up end's arithmetic (and its ring timestamps) bounded; the pages are bounded
40
+ * by the decider's rounds and page size, whatever the declaration.
41
+ */
42
+ export declare const WRUN_DECLARED_WARMUP_MAX_BARS = 5000;
43
+ /**
44
+ * The warm-up a sheet declares, in bars of the chart's interval, with the overlay's current param
45
+ * values (by name, wrunParamValuesFromSettings): the declared half of om's planWarmup, verbatim.
46
+ * `warmup_bars` reads as `ceil(warmup_bars) + 1`; `warmup` adds `max(min, ceil(sum(value x
47
+ * multiplier)) + plus)`, a term counting only when it names a non-text param with a finite value (a
48
+ * text setting's number is a byte count, never a bar count). The window-like-param inference
49
+ * planWarmup adds for undeclared sheets is not read: only a declaration buys history. Null when the
50
+ * sheet declares neither; clamped to WRUN_DECLARED_WARMUP_MAX_BARS.
51
+ */
52
+ export declare function wrunDeclaredWarmupBars(sheet: Pick<WrunIndicatorMetadata, 'warmup_bars' | 'warmup' | 'params'>, paramValues: Readonly<Record<string, number>>): number | null;
53
+ /**
54
+ * Where a declared warm-up of `bars` ends on the run's evaluated rows (the input rows the host hands
55
+ * the module, gap rows included when a lane restores them): the open of the row `bars` rows into
56
+ * the window (the first bar the hosted runner would evaluate), counted in rows so a gapped tape
57
+ * (sessions, weekends) is measured in bars, not clock time; past the last row it extrapolates at
58
+ * `intervalMs` (the window is that much short). `rows` are the window's LANDED rows; `creditedBars`
59
+ * are the hidden head's rows the session's guest evaluated before them (an exact warm-up session's
60
+ * running start, counted only for a head that ran under the run's settings), which the window does not
61
+ * owe again: a head covering the declaration leaves nothing owed. Null without rows, a positive count
62
+ * left owed or a finite open.
63
+ */
64
+ export declare function wrunDeclaredWarmupEndTs(rows: ReadonlyArray<{
65
+ ts: number;
66
+ }>, bars: number, intervalMs: number, creditedBars?: number): number | null;
67
+ /** The deepest exact warm-up a chart session takes (`warmup-cap` past it): a head is fetched in at most
68
+ * six pages and 1,000 bars (wrun-overlay-run.util), so a running start deeper than that is never owed. */
69
+ export declare const WRUN_HISTORY_WARMUP_MAX_BARS = 1000;
70
+ /**
71
+ * The exact warm-up stamp in its frozen shape (`history_warmup`, the kit contract D3), copied, or undefined
72
+ * for anything else: `kind` "exact" (another kind is a later round's and reads as no stamp), a `windows` list
73
+ * of the declaration's window shape (`{ terms: [{ param, multiplier }], plus?, min? }`) and a number `plus`
74
+ * when present. Strict: one malformed window makes the whole value no stamp, so a torn or foreign value never
75
+ * reads as a smaller W. The shape only: a number the kit never writes (a multiplier at or below 0, a negative
76
+ * `plus` or `min`, NaN or an infinity) reads here and is refused by `wrunHistoryWarmupNumbersRefusal`, so the
77
+ * chart names it (`warmup-cap`) and the compile pipeline stamps no such facet. Pure.
78
+ */
79
+ export declare function wrunHistoryWarmupOf(value: unknown): WrunHistoryWarmup | undefined;
80
+ /** Why an exact warm-up stamp has no W on a chart: a number the kit never writes (`warmup-cap`, the stamp's
81
+ * corroboration: a multiplier at or below 0, a negative `plus` or `min`, NaN or an infinity anywhere), or a term
82
+ * the overlay's settings cannot resolve (`warmup-unresolved`: it names no declared numeric param, a host-filled
83
+ * one, a param holding no finite value, or one holding a negative value). */
84
+ export type WrunHistoryWarmupRefusal = 'warmup-cap' | 'warmup-unresolved';
85
+ /** The W of an exact warm-up stamp, or the reason it has none. */
86
+ export type WrunHistoryWarmupBars = {
87
+ bars: number;
88
+ } | {
89
+ refusal: WrunHistoryWarmupRefusal;
90
+ };
91
+ /** `warmup-cap` when the stamp carries a number the kit's affine bound never writes (a multiplier at or below 0, a
92
+ * negative or non-finite `plus` or `min`, a non-finite multiplier): a non-positive multiplier would make a larger
93
+ * setting read as a smaller window (`{ terms: [{ param: "p", multiplier: -1 }], min: 1 }` at p = -20 is W 1 by
94
+ * the declaration's arithmetic, which skips the term), so no W is read off such a stamp at all. Undefined for a
95
+ * stamp whose every number is one the kit writes. */
96
+ export declare function wrunHistoryWarmupNumbersRefusal(warmup: WrunHistoryWarmup): 'warmup-cap' | undefined;
97
+ /**
98
+ * The W of an exact warm-up stamp with the overlay's param values (by name), or the reason it has none: the
99
+ * stamp's numbers first (`wrunHistoryWarmupNumbersRefusal`, `warmup-cap`), then each window evaluated with the
100
+ * declaration's own arithmetic (`wrunDeclaredWarmupBars` over the window alone: max(ceil(min),
101
+ * ceil(sum(value x multiplier)) + plus), whole bars, a window answering nothing counting 0), summed, plus the
102
+ * stamp's top-level `plus` rounded up; then never below the sheet's own declared warm-up (`warmup`,
103
+ * `warmup_bars`) when it declares one: the host takes max(W(history_warmup), W(warmup), warmup_bars). Stricter
104
+ * than the declaration's reading, since a short W would start a run too late rather than ask too few pages: a
105
+ * term must name a declared, non-text, non-host-filled param holding a finite value at or above 0, else
106
+ * `warmup-unresolved`. A negative value is no window the kit's bound describes (the declaration's arithmetic would
107
+ * read it as a smaller one, its window's floor); zero stays legal, the value every mode guard's selects hold at
108
+ * their default. A host-filled param (the market's tick, a chart word, a market fact) never names a window term
109
+ * (the kit refuses one), so W reads the overlay's settings alone: every reader computes the same W whatever host
110
+ * fill it holds. The cap (WRUN_HISTORY_WARMUP_MAX_BARS) is the caller's: a window past the declaration's own
111
+ * ceiling already reads as that ceiling, which is past the cap (a mode term's 1e9 multiplier reads 5,000 here).
112
+ */
113
+ export declare function wrunHistoryWarmupBars(warmup: WrunHistoryWarmup, sheet: Pick<WrunIndicatorMetadata, 'warmup_bars' | 'warmup' | 'params'>, paramValues: Readonly<Record<string, number>>): WrunHistoryWarmupBars;
@@ -0,0 +1,181 @@
1
+ /**
2
+ * The deepest declared warm-up the chart reads, in bars: Pine's `max_bars_back` ceiling, the
3
+ * deepest history a Pine script can reference, so no converted script declares more for a reason.
4
+ * It keeps the warm-up end's arithmetic (and its ring timestamps) bounded; the pages are bounded
5
+ * by the decider's rounds and page size, whatever the declaration.
6
+ */
7
+ export const WRUN_DECLARED_WARMUP_MAX_BARS = 5000;
8
+ const finitePositive = (value) => typeof value === 'number' && Number.isFinite(value) && value > 0;
9
+ /**
10
+ * The warm-up a sheet declares, in bars of the chart's interval, with the overlay's current param
11
+ * values (by name, wrunParamValuesFromSettings): the declared half of om's planWarmup, verbatim.
12
+ * `warmup_bars` reads as `ceil(warmup_bars) + 1`; `warmup` adds `max(min, ceil(sum(value x
13
+ * multiplier)) + plus)`, a term counting only when it names a non-text param with a finite value (a
14
+ * text setting's number is a byte count, never a bar count). The window-like-param inference
15
+ * planWarmup adds for undeclared sheets is not read: only a declaration buys history. Null when the
16
+ * sheet declares neither; clamped to WRUN_DECLARED_WARMUP_MAX_BARS.
17
+ */
18
+ export function wrunDeclaredWarmupBars(sheet, paramValues) {
19
+ let bars = finitePositive(sheet.warmup_bars) ? Math.ceil(sheet.warmup_bars) + 1 : null;
20
+ const params = Array.isArray(sheet.params) ? sheet.params : [];
21
+ const warmup = sheet.warmup;
22
+ if (warmup !== null && typeof warmup === 'object' && !Array.isArray(warmup)) {
23
+ const window = warmup;
24
+ let sum = 0;
25
+ for (const term of Array.isArray(window.terms) ? window.terms : []) {
26
+ const { param, multiplier } = (term ?? {});
27
+ if (typeof param !== 'string' || !finitePositive(multiplier))
28
+ continue;
29
+ const declared = params.find((candidate) => candidate?.name === param);
30
+ if (declared?.type === 'text')
31
+ continue;
32
+ const value = paramValues[param];
33
+ if (typeof value !== 'number' || !Number.isFinite(value))
34
+ continue;
35
+ sum += value * multiplier;
36
+ }
37
+ const plus = typeof window.plus === 'number' && Number.isFinite(window.plus) ? window.plus : 0;
38
+ const floor = finitePositive(window.min) ? Math.ceil(window.min) : 0;
39
+ const declaredWindow = Math.max(floor, Math.ceil(sum) + plus);
40
+ if (declaredWindow > 0)
41
+ bars = Math.max(bars ?? 0, declaredWindow);
42
+ }
43
+ if (bars === null || !(bars > 0))
44
+ return null;
45
+ // Whole bars: a hand-written sheet's fractional `plus` (the schema refuses one) never indexes a row.
46
+ return Math.min(Math.ceil(bars), WRUN_DECLARED_WARMUP_MAX_BARS);
47
+ }
48
+ /**
49
+ * Where a declared warm-up of `bars` ends on the run's evaluated rows (the input rows the host hands
50
+ * the module, gap rows included when a lane restores them): the open of the row `bars` rows into
51
+ * the window (the first bar the hosted runner would evaluate), counted in rows so a gapped tape
52
+ * (sessions, weekends) is measured in bars, not clock time; past the last row it extrapolates at
53
+ * `intervalMs` (the window is that much short). `rows` are the window's LANDED rows; `creditedBars`
54
+ * are the hidden head's rows the session's guest evaluated before them (an exact warm-up session's
55
+ * running start, counted only for a head that ran under the run's settings), which the window does not
56
+ * owe again: a head covering the declaration leaves nothing owed. Null without rows, a positive count
57
+ * left owed or a finite open.
58
+ */
59
+ export function wrunDeclaredWarmupEndTs(rows, bars, intervalMs, creditedBars = 0) {
60
+ // The hidden head's credit: the rows a session's guest evaluated before the window (a successfully run,
61
+ // settings-matching head) are bars of the declared warm-up the window no longer owes.
62
+ const credit = Number.isFinite(creditedBars) && creditedBars > 0 ? Math.floor(creditedBars) : 0;
63
+ const owed = Math.ceil(bars) - credit;
64
+ if (rows.length === 0 || !(bars > 0) || !(owed > 0) || !(intervalMs > 0))
65
+ return null;
66
+ const at = owed;
67
+ const ts = at < rows.length ? rows[at].ts : rows[rows.length - 1].ts + (at - (rows.length - 1)) * intervalMs;
68
+ return Number.isFinite(ts) ? ts : null;
69
+ }
70
+ /** The deepest exact warm-up a chart session takes (`warmup-cap` past it): a head is fetched in at most
71
+ * six pages and 1,000 bars (wrun-overlay-run.util), so a running start deeper than that is never owed. */
72
+ export const WRUN_HISTORY_WARMUP_MAX_BARS = 1000;
73
+ const isFiniteNumber = (value) => typeof value === 'number' && Number.isFinite(value);
74
+ function isPlainRecord(value) {
75
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
76
+ }
77
+ /** One window of the stamp, copied, or undefined when it is not one: a terms list of `{ param, multiplier }`
78
+ * (a non-empty param name, a number multiplier), a number `plus` and `min` when present. Whether the numbers
79
+ * are ones the kit writes is the W's question (`wrunHistoryWarmupNumbersRefusal`), never the shape's. */
80
+ function historyWarmupWindowOf(value) {
81
+ if (!isPlainRecord(value) || !Array.isArray(value.terms))
82
+ return undefined;
83
+ const terms = [];
84
+ for (const term of value.terms) {
85
+ if (!isPlainRecord(term))
86
+ return undefined;
87
+ const { param, multiplier } = term;
88
+ if (typeof param !== 'string' || param === '' || typeof multiplier !== 'number')
89
+ return undefined;
90
+ terms.push({ param, multiplier });
91
+ }
92
+ if (value.plus !== undefined && typeof value.plus !== 'number')
93
+ return undefined;
94
+ if (value.min !== undefined && typeof value.min !== 'number')
95
+ return undefined;
96
+ return {
97
+ terms,
98
+ ...(value.plus !== undefined ? { plus: value.plus } : {}),
99
+ ...(value.min !== undefined ? { min: value.min } : {}),
100
+ };
101
+ }
102
+ /**
103
+ * The exact warm-up stamp in its frozen shape (`history_warmup`, the kit contract D3), copied, or undefined
104
+ * for anything else: `kind` "exact" (another kind is a later round's and reads as no stamp), a `windows` list
105
+ * of the declaration's window shape (`{ terms: [{ param, multiplier }], plus?, min? }`) and a number `plus`
106
+ * when present. Strict: one malformed window makes the whole value no stamp, so a torn or foreign value never
107
+ * reads as a smaller W. The shape only: a number the kit never writes (a multiplier at or below 0, a negative
108
+ * `plus` or `min`, NaN or an infinity) reads here and is refused by `wrunHistoryWarmupNumbersRefusal`, so the
109
+ * chart names it (`warmup-cap`) and the compile pipeline stamps no such facet. Pure.
110
+ */
111
+ export function wrunHistoryWarmupOf(value) {
112
+ if (!isPlainRecord(value) || value.kind !== 'exact' || !Array.isArray(value.windows))
113
+ return undefined;
114
+ if (value.plus !== undefined && typeof value.plus !== 'number')
115
+ return undefined;
116
+ const windows = [];
117
+ for (const entry of value.windows) {
118
+ const window = historyWarmupWindowOf(entry);
119
+ if (window === undefined)
120
+ return undefined;
121
+ windows.push(window);
122
+ }
123
+ return { kind: 'exact', windows, ...(value.plus !== undefined ? { plus: value.plus } : {}) };
124
+ }
125
+ const soundCount = (value) => value === undefined || (isFiniteNumber(value) && value >= 0);
126
+ /** `warmup-cap` when the stamp carries a number the kit's affine bound never writes (a multiplier at or below 0, a
127
+ * negative or non-finite `plus` or `min`, a non-finite multiplier): a non-positive multiplier would make a larger
128
+ * setting read as a smaller window (`{ terms: [{ param: "p", multiplier: -1 }], min: 1 }` at p = -20 is W 1 by
129
+ * the declaration's arithmetic, which skips the term), so no W is read off such a stamp at all. Undefined for a
130
+ * stamp whose every number is one the kit writes. */
131
+ export function wrunHistoryWarmupNumbersRefusal(warmup) {
132
+ if (!soundCount(warmup.plus))
133
+ return 'warmup-cap';
134
+ for (const window of warmup.windows) {
135
+ if (!soundCount(window.plus) || !soundCount(window.min))
136
+ return 'warmup-cap';
137
+ for (const term of window.terms) {
138
+ if (!isFiniteNumber(term.multiplier) || !(term.multiplier > 0))
139
+ return 'warmup-cap';
140
+ }
141
+ }
142
+ return undefined;
143
+ }
144
+ /**
145
+ * The W of an exact warm-up stamp with the overlay's param values (by name), or the reason it has none: the
146
+ * stamp's numbers first (`wrunHistoryWarmupNumbersRefusal`, `warmup-cap`), then each window evaluated with the
147
+ * declaration's own arithmetic (`wrunDeclaredWarmupBars` over the window alone: max(ceil(min),
148
+ * ceil(sum(value x multiplier)) + plus), whole bars, a window answering nothing counting 0), summed, plus the
149
+ * stamp's top-level `plus` rounded up; then never below the sheet's own declared warm-up (`warmup`,
150
+ * `warmup_bars`) when it declares one: the host takes max(W(history_warmup), W(warmup), warmup_bars). Stricter
151
+ * than the declaration's reading, since a short W would start a run too late rather than ask too few pages: a
152
+ * term must name a declared, non-text, non-host-filled param holding a finite value at or above 0, else
153
+ * `warmup-unresolved`. A negative value is no window the kit's bound describes (the declaration's arithmetic would
154
+ * read it as a smaller one, its window's floor); zero stays legal, the value every mode guard's selects hold at
155
+ * their default. A host-filled param (the market's tick, a chart word, a market fact) never names a window term
156
+ * (the kit refuses one), so W reads the overlay's settings alone: every reader computes the same W whatever host
157
+ * fill it holds. The cap (WRUN_HISTORY_WARMUP_MAX_BARS) is the caller's: a window past the declaration's own
158
+ * ceiling already reads as that ceiling, which is past the cap (a mode term's 1e9 multiplier reads 5,000 here).
159
+ */
160
+ export function wrunHistoryWarmupBars(warmup, sheet, paramValues) {
161
+ const numbers = wrunHistoryWarmupNumbersRefusal(warmup);
162
+ if (numbers !== undefined)
163
+ return { refusal: numbers };
164
+ const params = Array.isArray(sheet.params) ? sheet.params : [];
165
+ let bars = 0;
166
+ for (const window of warmup.windows) {
167
+ for (const term of window.terms) {
168
+ const declared = params.find((candidate) => candidate?.name === term.param);
169
+ if (declared === undefined || declared.type === 'text' || declared.host_fill !== undefined) {
170
+ return { refusal: 'warmup-unresolved' };
171
+ }
172
+ const value = paramValues[term.param];
173
+ if (!isFiniteNumber(value) || value < 0)
174
+ return { refusal: 'warmup-unresolved' };
175
+ }
176
+ bars += wrunDeclaredWarmupBars({ params: sheet.params, warmup: window }, paramValues) ?? 0;
177
+ }
178
+ bars += Math.ceil(warmup.plus ?? 0);
179
+ const declared = wrunDeclaredWarmupBars(sheet, paramValues);
180
+ return { bars: declared !== null ? Math.max(bars, declared) : bars };
181
+ }
@@ -0,0 +1,43 @@
1
+ export declare function wrunDraftLegendNote(settings: unknown): string | undefined;
2
+ /**
3
+ * The served tier of the chain a run's options_chain lane read (its acquisition record), named only
4
+ * when that read was delayed: the OPRA venue's delayed line (`optionVenueDisclosure`, OPRA's delay
5
+ * notice). Undefined for a real-time read, for any other chain, or a lane the run did not read.
6
+ */
7
+ export declare function wrunChainServedTierNote(acquisition: Readonly<Record<string, unknown>> | undefined): string | undefined;
8
+ /**
9
+ * The routed tier of the OPRA source lanes a run read (their acquisitions: `wrunPlane: 'opra'` and the
10
+ * `servedTier` the ask named, wrun-opra-lane.util), named only when one rode the delayed reader, in the
11
+ * chain's own words (so `wrunWithoutLegendNote`, which reads the OPRA provenance the run stamped, strips it
12
+ * alike). Undefined when every OPRA read rode real-time, or none was made.
13
+ */
14
+ export declare function wrunOpraLanesServedTierNote(acquisitions: Iterable<unknown> | undefined): string | undefined;
15
+ /** The whole note a run's legend carries: the draft's word, then the served tier of its OPRA reads (the chain's,
16
+ * else any OPRA lane's among `acquisitions`, the run's record by lane), joined by " · "; undefined when neither
17
+ * applies. */
18
+ export declare function wrunOverlayLegendNote(settings: unknown, chainAcquisition?: Readonly<Record<string, unknown>>, acquisitions?: Readonly<Record<string, unknown>>): string | undefined;
19
+ /**
20
+ * Every wording a legend note can hold in a SAVED title that today's words do not produce: the title is
21
+ * written by the run and kept in the overlay's settings, so a title written under an older build or another
22
+ * locale keeps the words of that build and locale, while `wrunDraftLegendNote` and `wrunChainServedTierNote`
23
+ * answer in this build's words and the active locale only. Without this list such a title keeps its note in
24
+ * every inputs reader. Append, never remove: a wording leaves only when no saved title can hold it.
25
+ * - `opraTier`: the OPRA tier note as it shipped in each locale before OPRA's delay notice replaced it
26
+ * (2026-10-13 a744c0f601 to the notice): `cmeRealtimeData.exchanges.opra` then
27
+ * `symbolSelection.optionChain.servedDelayed`, `{minutes}` the figure the run named. If the notice itself
28
+ * is ever reworded (a legal event), the old notice joins this list.
29
+ * - `draft`: the draft's word (`wrun.draft.legend`) in every locale the app ships, today's and any older one.
30
+ * tests/utility/wrun/wrun-draft-legend-note.legacy-notes.spec.ts fails when a bundle's word is missing here.
31
+ */
32
+ export declare const WRUN_LEGACY_LEGEND_NOTES: {
33
+ readonly opraTier: readonly ["OPRA (US equity and index options) · Delayed {minutes} min", "OPRA(美国股票与指数期权) · 延迟 {minutes} 分钟", "OPRA(米国株式・指数オプション) · {minutes} 分遅延", "OPRA (미국 주식 및 지수 옵션) · {minutes}분 지연", "OPRA (опционы на акции и индексы США) · задержка {minutes} мин", "OPRA (US स्टॉक और इंडेक्स ऑप्शंस) · {minutes} मिनट विलंबित", "OPRA (opciones sobre acciones e índices de EE. UU.) · {minutes} min de retraso", "OPRA (ABD hisse ve endeks opsiyonları) · {minutes} dakika gecikmeli"];
34
+ readonly draft: readonly ["draft · only in this browser", "草稿 · 仅在此浏览器中", "下書き · このブラウザのみ", "초안 · 이 브라우저에서만", "черновик · только в этом браузере", "ड्राफ़्ट · केवल इस ब्राउज़र में", "borrador · solo en este navegador", "taslak · yalnızca bu tarayıcıda"];
35
+ };
36
+ /** A legend title suffix (the define's custom title, as the overlay's settings keep it) without the note
37
+ * `wrunOverlayLegendNote` appended to it, recomputed from the settings alone: the draft's word and the
38
+ * delayed tier of the OPRA chain the settings' provenance names. The run that wrote the title may have read
39
+ * that chain real-time (no tier note) or delayed, which the settings cannot tell, so the tier note is tried
40
+ * off the end first (only on settings with OPRA provenance), then the draft's word (only on a draft), each in
41
+ * today's words and in every pinned wording a saved title can hold (`WRUN_LEGACY_LEGEND_NOTES`). A suffix
42
+ * that ends with none of them is returned as it is. */
43
+ export declare function wrunWithoutLegendNote(suffix: string, settings: unknown): string;