@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,51 @@
1
+ /**
2
+ * kScript packages semver grammar — a pure, DOM-free mirror of the backend's
3
+ * `PACKAGE_PUBLISH_SEMVER_RE` (plan task E2, landed + frozen on the Phase-1
4
+ * head). The seal zod on tharamine is the ENFORCEMENT point; the FE mirrors the
5
+ * exact grammar for pre-submit UX and renders any server 422 verbatim.
6
+ *
7
+ * Grammar: strict `x.y.z` with no leading zeros, an OPTIONAL prerelease
8
+ * (`-rc.1`), and NO build metadata. `+build` is rejected at every enforcement
9
+ * boundary because `parseSemver` drops build from the compare tuple, so
10
+ * `1.0.0+a` and `1.0.0+b` would collide to one logical version yet index as two
11
+ * rows with a nondeterministic `latest`.
12
+ *
13
+ * Do NOT reuse KSCRIPT_LIB_VERSION_RE (`^\d+\.\d+\.\d+$`) — it rejects the
14
+ * prerelease packages allow and tolerates leading zeros this grammar forbids.
15
+ */
16
+ /** Full package-publish semver: no leading zeros, optional prerelease, no build. */
17
+ export declare const KSCRIPT_PACKAGE_SEMVER_RE: RegExp;
18
+ /** True iff the string is an accepted package-publish version. */
19
+ export declare function isValidPackageSemver(version: string): boolean;
20
+ /**
21
+ * True iff the string is a well-formed semver whose ONLY defect is a `+build`
22
+ * suffix — lets the version input show the dedicated "build metadata is not
23
+ * accepted" hint instead of the generic "not a valid version" message.
24
+ */
25
+ export declare function hasBuildMetadata(version: string): boolean;
26
+ interface IParsedSemver {
27
+ major: number;
28
+ minor: number;
29
+ patch: number;
30
+ /** Dot-separated prerelease identifiers; empty ⇒ a release (higher precedence). */
31
+ prerelease: string[];
32
+ }
33
+ /** Parse an accepted package semver into its compare tuple; null when invalid.
34
+ * Build metadata is intentionally NOT represented (it never affects ordering). */
35
+ export declare function parseSemver(version: string): IParsedSemver | null;
36
+ /**
37
+ * Semver precedence compare with prerelease rules (SemVer §11). Returns <0 when
38
+ * `a` precedes `b`, 0 when equal, >0 when `a` follows `b`. An UNPARSEABLE input
39
+ * sorts lowest (deterministic, never throws), so a stray value can't reorder a
40
+ * real ledger.
41
+ */
42
+ export declare function compareSemver(a: string, b: string): number;
43
+ /**
44
+ * The obvious next version to prefill: the patch bump of `latest` (dropping any
45
+ * prerelease so `1.2.3-rc.1` suggests `1.2.3`, not `1.2.4`). No latest (fresh
46
+ * ledger) ⇒ `1.0.0`. Never called against an `importing` envelope — real
47
+ * registry history may already be higher, so the caller suppresses the
48
+ * suggestion there (plan int-M8 / F3).
49
+ */
50
+ export declare function nextPatch(latest?: string | null): string;
51
+ export {};
@@ -0,0 +1,120 @@
1
+ /**
2
+ * kScript packages semver grammar — a pure, DOM-free mirror of the backend's
3
+ * `PACKAGE_PUBLISH_SEMVER_RE` (plan task E2, landed + frozen on the Phase-1
4
+ * head). The seal zod on tharamine is the ENFORCEMENT point; the FE mirrors the
5
+ * exact grammar for pre-submit UX and renders any server 422 verbatim.
6
+ *
7
+ * Grammar: strict `x.y.z` with no leading zeros, an OPTIONAL prerelease
8
+ * (`-rc.1`), and NO build metadata. `+build` is rejected at every enforcement
9
+ * boundary because `parseSemver` drops build from the compare tuple, so
10
+ * `1.0.0+a` and `1.0.0+b` would collide to one logical version yet index as two
11
+ * rows with a nondeterministic `latest`.
12
+ *
13
+ * Do NOT reuse KSCRIPT_LIB_VERSION_RE (`^\d+\.\d+\.\d+$`) — it rejects the
14
+ * prerelease packages allow and tolerates leading zeros this grammar forbids.
15
+ */
16
+ /** Full package-publish semver: no leading zeros, optional prerelease, no build. */
17
+ export const KSCRIPT_PACKAGE_SEMVER_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
18
+ /** A core-or-prerelease-or-BUILD semver — used only to distinguish "has build
19
+ * metadata" from "malformed" so the UI can show the specific `+build` hint. */
20
+ const SEMVER_WITH_BUILD_RE = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
21
+ /** True iff the string is an accepted package-publish version. */
22
+ export function isValidPackageSemver(version) {
23
+ return KSCRIPT_PACKAGE_SEMVER_RE.test(version.trim());
24
+ }
25
+ /**
26
+ * True iff the string is a well-formed semver whose ONLY defect is a `+build`
27
+ * suffix — lets the version input show the dedicated "build metadata is not
28
+ * accepted" hint instead of the generic "not a valid version" message.
29
+ */
30
+ export function hasBuildMetadata(version) {
31
+ const v = version.trim();
32
+ if (isValidPackageSemver(v))
33
+ return false;
34
+ return v.includes('+') && SEMVER_WITH_BUILD_RE.test(v);
35
+ }
36
+ /** Parse an accepted package semver into its compare tuple; null when invalid.
37
+ * Build metadata is intentionally NOT represented (it never affects ordering). */
38
+ export function parseSemver(version) {
39
+ const v = version.trim();
40
+ const match = KSCRIPT_PACKAGE_SEMVER_RE.exec(v);
41
+ if (!match)
42
+ return null;
43
+ return {
44
+ major: Number(match[1]),
45
+ minor: Number(match[2]),
46
+ patch: Number(match[3]),
47
+ prerelease: match[4] ? match[4].split('.') : [],
48
+ };
49
+ }
50
+ function comparePrerelease(a, b) {
51
+ // A release (no prerelease) outranks any prerelease of the same core.
52
+ if (a.length === 0 && b.length === 0)
53
+ return 0;
54
+ if (a.length === 0)
55
+ return 1;
56
+ if (b.length === 0)
57
+ return -1;
58
+ const len = Math.min(a.length, b.length);
59
+ for (let i = 0; i < len; i++) {
60
+ const ai = a[i];
61
+ const bi = b[i];
62
+ const aNum = /^\d+$/.test(ai);
63
+ const bNum = /^\d+$/.test(bi);
64
+ if (aNum && bNum) {
65
+ const diff = Number(ai) - Number(bi);
66
+ if (diff !== 0)
67
+ return diff < 0 ? -1 : 1;
68
+ }
69
+ else if (aNum !== bNum) {
70
+ // Numeric identifiers always have LOWER precedence than alphanumeric ones.
71
+ return aNum ? -1 : 1;
72
+ }
73
+ else if (ai !== bi) {
74
+ return ai < bi ? -1 : 1;
75
+ }
76
+ }
77
+ // The shorter set has lower precedence when all preceding identifiers match.
78
+ return a.length === b.length ? 0 : a.length < b.length ? -1 : 1;
79
+ }
80
+ /**
81
+ * Semver precedence compare with prerelease rules (SemVer §11). Returns <0 when
82
+ * `a` precedes `b`, 0 when equal, >0 when `a` follows `b`. An UNPARSEABLE input
83
+ * sorts lowest (deterministic, never throws), so a stray value can't reorder a
84
+ * real ledger.
85
+ */
86
+ export function compareSemver(a, b) {
87
+ const pa = parseSemver(a);
88
+ const pb = parseSemver(b);
89
+ if (!pa && !pb)
90
+ return 0;
91
+ if (!pa)
92
+ return -1;
93
+ if (!pb)
94
+ return 1;
95
+ if (pa.major !== pb.major)
96
+ return pa.major - pb.major;
97
+ if (pa.minor !== pb.minor)
98
+ return pa.minor - pb.minor;
99
+ if (pa.patch !== pb.patch)
100
+ return pa.patch - pb.patch;
101
+ return comparePrerelease(pa.prerelease, pb.prerelease);
102
+ }
103
+ /**
104
+ * The obvious next version to prefill: the patch bump of `latest` (dropping any
105
+ * prerelease so `1.2.3-rc.1` suggests `1.2.3`, not `1.2.4`). No latest (fresh
106
+ * ledger) ⇒ `1.0.0`. Never called against an `importing` envelope — real
107
+ * registry history may already be higher, so the caller suppresses the
108
+ * suggestion there (plan int-M8 / F3).
109
+ */
110
+ export function nextPatch(latest) {
111
+ if (!latest)
112
+ return '1.0.0';
113
+ const parsed = parseSemver(latest);
114
+ if (!parsed)
115
+ return '1.0.0';
116
+ // A prerelease of x.y.z releases AS x.y.z; a release bumps the patch.
117
+ if (parsed.prerelease.length > 0)
118
+ return `${parsed.major}.${parsed.minor}.${parsed.patch}`;
119
+ return `${parsed.major}.${parsed.minor}.${parsed.patch + 1}`;
120
+ }
@@ -0,0 +1,18 @@
1
+ export type KScriptRunState = 'unsaved-draft' | 'unsaved-edits';
2
+ export interface TempScriptOverlayLike {
3
+ settings?: {
4
+ customScriptId?: unknown;
5
+ };
6
+ }
7
+ export interface TempScriptWorkspaceLike<TOverlay extends TempScriptOverlayLike = TempScriptOverlayLike> {
8
+ onchart?: TOverlay[];
9
+ offchart?: TOverlay[];
10
+ multiCharts?: {
11
+ workspaces?: TempScriptWorkspaceLike<TOverlay>[];
12
+ };
13
+ }
14
+ export declare function tempScriptIdForDraft(tabId: string): string;
15
+ export declare function isTempScriptId(scriptId: unknown): boolean;
16
+ export declare function stripTempScriptOverlays<TOverlay extends TempScriptOverlayLike>(overlays: TOverlay[] | undefined): TOverlay[];
17
+ export declare function stripTempScriptOverlaysFromWorkspace<TWorkspace extends TempScriptWorkspaceLike>(workspace: TWorkspace): TWorkspace;
18
+ export declare function isKScriptRunState(value: unknown): value is KScriptRunState;
@@ -0,0 +1,25 @@
1
+ const TEMP_SCRIPT_ID = 'TEMP_SCRIPT';
2
+ const TEMP_SCRIPT_ID_PREFIX = `${TEMP_SCRIPT_ID}:`;
3
+ export function tempScriptIdForDraft(tabId) {
4
+ return tabId ? `${TEMP_SCRIPT_ID_PREFIX}${tabId}` : TEMP_SCRIPT_ID;
5
+ }
6
+ export function isTempScriptId(scriptId) {
7
+ return typeof scriptId === 'string' && (scriptId === TEMP_SCRIPT_ID || scriptId.startsWith(TEMP_SCRIPT_ID_PREFIX));
8
+ }
9
+ function isTempScriptOverlay(overlay) {
10
+ return isTempScriptId(overlay?.settings?.customScriptId);
11
+ }
12
+ export function stripTempScriptOverlays(overlays) {
13
+ return (overlays ?? []).filter((overlay) => !isTempScriptOverlay(overlay));
14
+ }
15
+ export function stripTempScriptOverlaysFromWorkspace(workspace) {
16
+ workspace.onchart = stripTempScriptOverlays(workspace.onchart);
17
+ workspace.offchart = stripTempScriptOverlays(workspace.offchart);
18
+ for (const subWorkspace of workspace.multiCharts?.workspaces ?? []) {
19
+ stripTempScriptOverlaysFromWorkspace(subWorkspace);
20
+ }
21
+ return workspace;
22
+ }
23
+ export function isKScriptRunState(value) {
24
+ return value === 'unsaved-draft' || value === 'unsaved-edits';
25
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * The markets request a list of exchange-symbol pairs asks the catalog with (a leaf of services/v2.service.ts;
3
+ * P2/inventory.md section 1.1): the wrun executor's foreign pin catalog builds its request with it. Pure, its one import
4
+ * is the protocol package (a chart-host peer), so it moves into the chart-host package with the phase 2 closure; the V2
5
+ * service imports and re-exports it.
6
+ */
7
+ import { type GetMarketsRequest } from '@orangecharts/orange-v2-pb-common';
8
+ /**
9
+ * Build a Partial<GetMarketsRequest> from an array of {exchange, rawSymbol/normalizedSymbol} pairs.
10
+ * Use this when callers think in terms of symbols rather than raw GetMarketsRequest fields.
11
+ *
12
+ * @param symbols - Array of exchange-symbol pairs (use normalizedSymbol for exchanges like Hyperliquid)
13
+ * @param types - Type strings (e.g., ['TRADE', 'TICKER_AGG'])
14
+ * @param fields - Additional GetMarketsRequest fields (pageSize, pageOffset, symbolFilter, etc.)
15
+ */
16
+ export declare function buildMarketsRequestFromSymbols(symbols: Array<{
17
+ exchange: string;
18
+ rawSymbol?: string;
19
+ normalizedSymbol?: string;
20
+ }>, types: string[], fields?: Partial<Omit<GetMarketsRequest, 'type' | 'seriesFilters' | 'exchange'>>): Partial<GetMarketsRequest>;
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The markets request a list of exchange-symbol pairs asks the catalog with (a leaf of services/v2.service.ts;
3
+ * P2/inventory.md section 1.1): the wrun executor's foreign pin catalog builds its request with it. Pure, its one import
4
+ * is the protocol package (a chart-host peer), so it moves into the chart-host package with the phase 2 closure; the V2
5
+ * service imports and re-exports it.
6
+ */
7
+ import { Exchange, Type } from '@orangecharts/orange-v2-pb-common';
8
+ function groupSymbolsByExchange(symbols) {
9
+ const grouped = new Map();
10
+ for (const { exchange, rawSymbol, normalizedSymbol } of symbols) {
11
+ if (!grouped.has(exchange)) {
12
+ grouped.set(exchange, { rawSymbols: [], normalizedSymbols: [] });
13
+ }
14
+ const group = grouped.get(exchange);
15
+ if (normalizedSymbol && normalizedSymbol.trim() !== '') {
16
+ group.normalizedSymbols.push(normalizedSymbol);
17
+ }
18
+ else if (rawSymbol && rawSymbol.trim() !== '') {
19
+ group.rawSymbols.push(rawSymbol);
20
+ }
21
+ }
22
+ return grouped;
23
+ }
24
+ function buildSeriesFilters(grouped) {
25
+ const filters = [];
26
+ for (const [exchangeStr, group] of grouped.entries()) {
27
+ const exchangeId = Exchange[exchangeStr];
28
+ if (!exchangeId) {
29
+ console.warn(`Unknown exchange: ${exchangeStr}`);
30
+ continue;
31
+ }
32
+ const filter = {
33
+ exchanges: [exchangeId],
34
+ rawSymbols: group.rawSymbols.length > 0 ? group.rawSymbols : [],
35
+ normalizedSymbols: group.normalizedSymbols.length > 0 ? group.normalizedSymbols : [],
36
+ };
37
+ filters.push(filter);
38
+ }
39
+ return filters;
40
+ }
41
+ /**
42
+ * Build a Partial<GetMarketsRequest> from an array of {exchange, rawSymbol/normalizedSymbol} pairs.
43
+ * Use this when callers think in terms of symbols rather than raw GetMarketsRequest fields.
44
+ *
45
+ * @param symbols - Array of exchange-symbol pairs (use normalizedSymbol for exchanges like Hyperliquid)
46
+ * @param types - Type strings (e.g., ['TRADE', 'TICKER_AGG'])
47
+ * @param fields - Additional GetMarketsRequest fields (pageSize, pageOffset, symbolFilter, etc.)
48
+ */
49
+ export function buildMarketsRequestFromSymbols(symbols, types, fields) {
50
+ const marketsRequest = {
51
+ type: types.map((type) => Type[type]),
52
+ ...fields,
53
+ };
54
+ if (symbols.length === 0) {
55
+ return marketsRequest;
56
+ }
57
+ const grouped = groupSymbolsByExchange(symbols);
58
+ // Single exchange with no symbols → request all markets on that exchange.
59
+ const firstGroup = Array.from(grouped.values())[0];
60
+ const isExchangeOnly = grouped.size === 1 && firstGroup.rawSymbols.length === 0 && firstGroup.normalizedSymbols.length === 0;
61
+ if (isExchangeOnly) {
62
+ const exchangeStr = Array.from(grouped.keys())[0];
63
+ const exchangeId = Exchange[exchangeStr];
64
+ if (!exchangeId) {
65
+ console.warn(`Unknown exchange: ${exchangeStr}`);
66
+ return marketsRequest;
67
+ }
68
+ marketsRequest.exchange = [exchangeId];
69
+ // For POLYMARKET, use rawSymbol from symbols array as symbolFilter if available
70
+ if (exchangeStr === 'POLYMARKET' && symbols.length > 0) {
71
+ const rawSymbol = symbols[0].rawSymbol;
72
+ if (rawSymbol && rawSymbol !== '' && !marketsRequest.symbolFilter) {
73
+ marketsRequest.symbolFilter = rawSymbol;
74
+ }
75
+ }
76
+ }
77
+ else {
78
+ marketsRequest.seriesFilters = buildSeriesFilters(grouped);
79
+ }
80
+ return marketsRequest;
81
+ }
@@ -0,0 +1,103 @@
1
+ /**
2
+ * The governed tier rules (a leaf of utility/v2/governed-route.util.ts; P2/inventory.md section 1.1): which slot and
3
+ * which delay a governed exchange's data rides for a served access, the names the live tick and the executor read. They
4
+ * read package modules only (the CME cache context, the socket slots, the gate planes), so this leaf moves into the
5
+ * chart-host package with the phase 2 closure; the old module re-exports its public names and imports back the ones it
6
+ * still uses.
7
+ */
8
+ import type { CmeServedAccess } from '../../interfaces/cme-realtime.interface.js';
9
+ import { type LivefeedSlotId, type ReaderSlotId, type WsSlotId } from '../../workers/constants/socket-slots.js';
10
+ /**
11
+ * What a caller is asking for, transport-agnostic. `candles` = all StreamPoints
12
+ * reader traffic (OHLCV, indicators, heatmap); `metadata` = the one-shot reader
13
+ * wrappers (reference data, always the delayed reader); `optionSummary` = a
14
+ * quoted option chain summary (market data, so it rides the served-access tier
15
+ * like candles); `trades`/`book` = live-feed streams. Reader kinds ride the
16
+ * plane's reader tier slot, feed kinds its live-feed tier slot (one socket
17
+ * carries both trades and book); the realtime/delayed variant comes from served
18
+ * access.
19
+ */
20
+ export type DataKind = 'candles' | 'metadata' | 'optionSummary' | 'trades' | 'book';
21
+ export declare function isReaderKind(kind: DataKind): boolean;
22
+ /**
23
+ * Realtime served, but capped at top-of-book (the p1 plan). That lane REJECTS an
24
+ * over-request ("depth exceeds plan cap") rather than clamping it; the delayed
25
+ * lane is never capped.
26
+ */
27
+ export declare function isRealtimeDepthCapped(access: CmeServedAccess | undefined): boolean;
28
+ /**
29
+ * True when a request targets ONE gate plane exclusively (CME or OPRA). Read from
30
+ * the RAW payload exchange: a string, a pb-common enum id, or an array of either.
31
+ *
32
+ * `.every` (not `.some`) is load-bearing: a cross-exchange metadata query (e.g.
33
+ * categories over 30 exchanges that happen to include CME) must keep the ungated
34
+ * reader, and a request spanning two planes rides neither. False for a refused
35
+ * request too; callers that must tell refused from public read
36
+ * `classifyGateRequestPlane` (or `resolveCmeRoute`'s `refused` transport).
37
+ */
38
+ export declare function isGovernedExchange(exchange: unknown): boolean;
39
+ /**
40
+ * The gate slot for a governed request, or `null` when no single plane governs
41
+ * it (public, or refused: the worker reads the refusal through
42
+ * {@link planGovernedReaderRequest}, the main thread through
43
+ * {@link resolveCmeRoute}). The plane comes from the request's own exchange
44
+ * (`classifyGateRequestPlane`), the tier from served access. Slot-only, no guest
45
+ * gating: the worker send path uses this; guest handling is main-thread, in
46
+ * {@link resolveCmeRoute}.
47
+ *
48
+ * `wantsDepth` is the mixed-tier (R5b) axis: a full-depth book request on a
49
+ * realtime-L1-capped (p1) exchange routes to the DELAYED slot — delayed depth
50
+ * is never capped, while the realtime socket would silently serve one level.
51
+ * It defaults TRUE for the `book` kind as fail-safety: a call site that
52
+ * forgets to classify can never strand a full book on the capped socket; the
53
+ * one consumer that genuinely wants realtime top-of-book opts in with
54
+ * `wantsDepth: false`. Non-book kinds never route by depth.
55
+ */
56
+ export declare function resolveGovernedSlot(exchange: unknown, kind: 'candles' | 'metadata' | 'optionSummary', access?: CmeServedAccess, wantsDepth?: boolean): ReaderSlotId | null;
57
+ export declare function resolveGovernedSlot(exchange: unknown, kind: 'trades' | 'book', access?: CmeServedAccess, wantsDepth?: boolean): LivefeedSlotId | null;
58
+ export declare function resolveGovernedSlot(exchange: unknown, kind: DataKind, access?: CmeServedAccess, wantsDepth?: boolean): WsSlotId | null;
59
+ /**
60
+ * The reader tier a quoted option chain summary of a governed exchange rides now, on this thread's
61
+ * served-access mirror: the tier of the slot {@link resolveGovernedSlot} picks for the `optionSummary`
62
+ * kind, so the worker's chain store and the main thread's wrun chain lane name the tier the routing
63
+ * uses. Delayed for an exchange no gate governs, and until the gate confirms real-time.
64
+ */
65
+ export declare function governedOptionSummaryTier(exchange: string | undefined | null): 'realtime' | 'delayed';
66
+ /**
67
+ * The reader tier a governed market-data read (StreamPoints: a print, a per-contract or a flow aggregate,
68
+ * a strike or a surface series) of an exchange rides now, on this thread's served-access mirror: the tier of
69
+ * the slot {@link resolveGovernedSlot} picks for the `candles` kind, the one the worker routes StreamPoints by.
70
+ * A wrun lane that reads such a series names this tier in its acquisition and its legend note. Delayed for
71
+ * an exchange no gate governs, and until the gate confirms real-time.
72
+ */
73
+ export declare function governedMarketDataTier(exchange: string | undefined | null): 'realtime' | 'delayed';
74
+ /**
75
+ * Extra seconds subtracted from a bounded window's end, on TOP of the delay.
76
+ *
77
+ * Since 2026-07-28 the gate no longer refuses a delayed window that reaches
78
+ * inside the embargo: it clamps the window to end at `now - delay`
79
+ * (cme-entitlement-service `clampDelayedWindow`). The margin stays for the
80
+ * boundary bucket: the reader serves the bucket holding the window end WHOLE,
81
+ * so a window ending at `now - delay` would ship up to one 1m bar of data
82
+ * younger than the delay. Ending `margin` behind it keeps that 1m boundary
83
+ * bucket older than the delay, even with a client clock running less than a
84
+ * minute ahead of the gate.
85
+ *
86
+ * The cost is the delayed SEAM: history ends `delay + margin` behind now while
87
+ * the delayed feed starts `delay` behind it, so on intervals finer than the
88
+ * margin whole candles in between are missing until they exit the embargo.
89
+ * Seam polling fills them (`delayedSeamPollWindowMs`). Shrink the margin only
90
+ * once the gate cuts its boundary buckets at the window end.
91
+ */
92
+ export declare const CME_DELAYED_EMBARGO_MARGIN_SECONDS = 120;
93
+ /**
94
+ * The delay the delayed lane is serving for this account: the tier frame's
95
+ * reported `delay_seconds` where available, else the exchange's plane default
96
+ * (`delayedDefaultSecondsFor`: CME 600 s, OPRA 900 s; an absent exchange keeps
97
+ * CME's, the shape every caller had before a second plane). Only the delayed
98
+ * variant of the union carries `delaySeconds`. A mixed-tier p1 account
99
+ * (realtime ticks, L1-capped) routes its DEPTH requests to the delayed lane
100
+ * while its timing is 'realtime', so that path always takes the nominal
101
+ * fallback, which is exactly why the margin above is not optional.
102
+ */
103
+ export declare function servedDelaySecondsForAccess(access: CmeServedAccess | undefined, exchange?: unknown): number;
@@ -0,0 +1,113 @@
1
+ import { cmeServedAccessForExchange } from '../chart/cme-cache-context.util.js';
2
+ import { delayedDefaultSecondsFor, governedPlaneOf } from './gate-plane.util.js';
3
+ import { gateSlotForTier, SOCKET_SLOTS, } from '../../workers/constants/socket-slots.js';
4
+ export function isReaderKind(kind) {
5
+ return kind === 'candles' || kind === 'metadata' || kind === 'optionSummary';
6
+ }
7
+ /** Realtime iff a socket serving this exchange has said so; unknown is delayed-safe. */
8
+ function isRealtimeServed(access) {
9
+ return access?.status === 'known' && access.timing === 'realtime';
10
+ }
11
+ /**
12
+ * Realtime served, but capped at top-of-book (the p1 plan). That lane REJECTS an
13
+ * over-request ("depth exceeds plan cap") rather than clamping it; the delayed
14
+ * lane is never capped.
15
+ */
16
+ export function isRealtimeDepthCapped(access) {
17
+ return access?.status === 'known' && access.timing === 'realtime' && access.depth === 'l1';
18
+ }
19
+ /**
20
+ * True when a request targets ONE gate plane exclusively (CME or OPRA). Read from
21
+ * the RAW payload exchange: a string, a pb-common enum id, or an array of either.
22
+ *
23
+ * `.every` (not `.some`) is load-bearing: a cross-exchange metadata query (e.g.
24
+ * categories over 30 exchanges that happen to include CME) must keep the ungated
25
+ * reader, and a request spanning two planes rides neither. False for a refused
26
+ * request too; callers that must tell refused from public read
27
+ * `classifyGateRequestPlane` (or `resolveCmeRoute`'s `refused` transport).
28
+ */
29
+ export function isGovernedExchange(exchange) {
30
+ return governedPlaneOf(exchange) !== null;
31
+ }
32
+ export function resolveGovernedSlot(exchange, kind, access, wantsDepth = kind === 'book') {
33
+ const plane = governedPlaneOf(exchange);
34
+ if (plane === null)
35
+ return null;
36
+ // Path-based tier (contract C1): route by the exchange's served access.
37
+ // Realtime-served rides `/live/*`; unknown or delayed rides `/delayed/*` (safe
38
+ // for free+, and a delayed socket's tier frame still reveals the full
39
+ // entitlement map). Mixed-tier (R5b): a depth-wanting request on a
40
+ // realtime-but-L1-capped exchange rides `/delayed/*` for the uncapped book
41
+ // while ticks stay realtime — the caller holds both sockets at once.
42
+ const realtime = isRealtimeServed(access);
43
+ const delayed = !realtime || (wantsDepth && isRealtimeDepthCapped(access));
44
+ // Metadata one-shots (StreamMarkets / RawSymbols / BlockSizes) are reference
45
+ // data — symbol lists and block sizes, not time-series market data. They are
46
+ // tier-agnostic and signature-only, so they always ride the delayed reader
47
+ // regardless of entitlement; only market data earns the realtime path. An
48
+ // option chain SUMMARY carries quotes, so it is market data (`optionSummary`).
49
+ if (kind === 'metadata')
50
+ return gateSlotForTier(plane.provider, 'reader', 'delayed');
51
+ const tier = delayed ? 'delayed' : 'realtime';
52
+ return isReaderKind(kind)
53
+ ? gateSlotForTier(plane.provider, 'reader', tier)
54
+ : gateSlotForTier(plane.provider, 'livefeed', tier);
55
+ }
56
+ /**
57
+ * The reader tier a quoted option chain summary of a governed exchange rides now, on this thread's
58
+ * served-access mirror: the tier of the slot {@link resolveGovernedSlot} picks for the `optionSummary`
59
+ * kind, so the worker's chain store and the main thread's wrun chain lane name the tier the routing
60
+ * uses. Delayed for an exchange no gate governs, and until the gate confirms real-time.
61
+ */
62
+ export function governedOptionSummaryTier(exchange) {
63
+ if (!exchange)
64
+ return 'delayed';
65
+ const slot = resolveGovernedSlot(exchange, 'optionSummary', cmeServedAccessForExchange(exchange));
66
+ return slot !== null && SOCKET_SLOTS[slot].tier === 'realtime' ? 'realtime' : 'delayed';
67
+ }
68
+ /**
69
+ * The reader tier a governed market-data read (StreamPoints: a print, a per-contract or a flow aggregate,
70
+ * a strike or a surface series) of an exchange rides now, on this thread's served-access mirror: the tier of
71
+ * the slot {@link resolveGovernedSlot} picks for the `candles` kind, the one the worker routes StreamPoints by.
72
+ * A wrun lane that reads such a series names this tier in its acquisition and its legend note. Delayed for
73
+ * an exchange no gate governs, and until the gate confirms real-time.
74
+ */
75
+ export function governedMarketDataTier(exchange) {
76
+ if (!exchange)
77
+ return 'delayed';
78
+ const slot = resolveGovernedSlot(exchange, 'candles', cmeServedAccessForExchange(exchange));
79
+ return slot !== null && SOCKET_SLOTS[slot].tier === 'realtime' ? 'realtime' : 'delayed';
80
+ }
81
+ /**
82
+ * Extra seconds subtracted from a bounded window's end, on TOP of the delay.
83
+ *
84
+ * Since 2026-07-28 the gate no longer refuses a delayed window that reaches
85
+ * inside the embargo: it clamps the window to end at `now - delay`
86
+ * (cme-entitlement-service `clampDelayedWindow`). The margin stays for the
87
+ * boundary bucket: the reader serves the bucket holding the window end WHOLE,
88
+ * so a window ending at `now - delay` would ship up to one 1m bar of data
89
+ * younger than the delay. Ending `margin` behind it keeps that 1m boundary
90
+ * bucket older than the delay, even with a client clock running less than a
91
+ * minute ahead of the gate.
92
+ *
93
+ * The cost is the delayed SEAM: history ends `delay + margin` behind now while
94
+ * the delayed feed starts `delay` behind it, so on intervals finer than the
95
+ * margin whole candles in between are missing until they exit the embargo.
96
+ * Seam polling fills them (`delayedSeamPollWindowMs`). Shrink the margin only
97
+ * once the gate cuts its boundary buckets at the window end.
98
+ */
99
+ export const CME_DELAYED_EMBARGO_MARGIN_SECONDS = 120;
100
+ /**
101
+ * The delay the delayed lane is serving for this account: the tier frame's
102
+ * reported `delay_seconds` where available, else the exchange's plane default
103
+ * (`delayedDefaultSecondsFor`: CME 600 s, OPRA 900 s; an absent exchange keeps
104
+ * CME's, the shape every caller had before a second plane). Only the delayed
105
+ * variant of the union carries `delaySeconds`. A mixed-tier p1 account
106
+ * (realtime ticks, L1-capped) routes its DEPTH requests to the delayed lane
107
+ * while its timing is 'realtime', so that path always takes the nominal
108
+ * fallback, which is exactly why the margin above is not optional.
109
+ */
110
+ export function servedDelaySecondsForAccess(access, exchange) {
111
+ return ((access?.status === 'known' && access.timing === 'delayed' ? access.delaySeconds : undefined) ??
112
+ delayedDefaultSecondsFor(exchange));
113
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The watchlist import's markets request shape (a leaf of utility/watchlist/import/import-resolution.util.ts;
3
+ * P2/inventory.md section 1.1): the timeout of one markets request and the types it asks for, which the wrun executor's
4
+ * foreign pin catalog asks with. Constants only, no imports, so it moves into the chart-host package with the phase 2
5
+ * closure; the import resolution module imports and re-exports both. The type list stays a `const` read-only array
6
+ * over a literal, never written (the phase 2 leaf-state guard's immutable form).
7
+ */
8
+ export declare const IMPORT_REQUEST_TIMEOUT_MS = 20000;
9
+ /** The types the poll asks for: a priced row of any venue answers on one of them. */
10
+ export declare const IMPORT_MARKET_TYPES: readonly string[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The watchlist import's markets request shape (a leaf of utility/watchlist/import/import-resolution.util.ts;
3
+ * P2/inventory.md section 1.1): the timeout of one markets request and the types it asks for, which the wrun executor's
4
+ * foreign pin catalog asks with. Constants only, no imports, so it moves into the chart-host package with the phase 2
5
+ * closure; the import resolution module imports and re-exports both. The type list stays a `const` read-only array
6
+ * over a literal, never written (the phase 2 leaf-state guard's immutable form).
7
+ */
8
+ export const IMPORT_REQUEST_TIMEOUT_MS = 20_000;
9
+ /** The types the poll asks for: a priced row of any venue answers on one of them. */
10
+ export const IMPORT_MARKET_TYPES = ['TICKER_AGG', 'TRADE'];
@@ -285,8 +285,8 @@ export async function fetchWrunSeriesRows(ask) {
285
285
  export function subscribeWrunSeriesLive(ask, sink) {
286
286
  let closed = false;
287
287
  let channel;
288
- void wrunChartHostEnv()
289
- .run.loadSeriesStream()
288
+ // The series stream is a package module since 0.5.0 (the host's `run.loadSeriesStream` retired).
289
+ void import('../../wrun-series-stream.util.js')
290
290
  .then(({ openWrunSeriesStream }) => openWrunSeriesStream(ask, sink))
291
291
  .then((opened) => {
292
292
  if (closed)
@@ -24,10 +24,10 @@
24
24
  * live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. ONE book per input (D11),
25
25
  * named in the acquisition (`stateBook`) unless it is the underlying's own series; the worker keeps its contracts.
26
26
  * - Knobs (acquisition facets): `expiries` ("all", "nearest:N" or "0dte", the chain's market's own trade date) and
27
- * `strike_window_pct` (above 0, at most 100), `book` (`auto` or one series name); `max_cells` is required (the static
28
- * plan) and a block over it refuses the run, never truncated. A market pin and the knobs of the other options classes
29
- * are refused by name (`venue` among them until om's kit declares it for this class: the chain is `auto`'s, the one
30
- * `options_chain`'s `auto` reads on the same chart).
27
+ * `strike_window_pct` (above 0, at most 100), `book` (`auto` or one series name), `venue` (kit 0.87.0: the chain
28
+ * the one venue decision names for the word, in `options_chain`'s words; absent reads `auto`, the chain
29
+ * `options_chain`'s `auto` reads on the same chart); `max_cells` is required (the static plan) and a block over it
30
+ * refuses the run, never truncated. A market pin and the knobs of the other options classes are refused by name.
31
31
  *
32
32
  * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
33
33
  */
@@ -24,10 +24,10 @@
24
24
  * live session rebuilds once the lead rolls: `acquisitionMoved`), none on a crypto chain. ONE book per input (D11),
25
25
  * named in the acquisition (`stateBook`) unless it is the underlying's own series; the worker keeps its contracts.
26
26
  * - Knobs (acquisition facets): `expiries` ("all", "nearest:N" or "0dte", the chain's market's own trade date) and
27
- * `strike_window_pct` (above 0, at most 100), `book` (`auto` or one series name); `max_cells` is required (the static
28
- * plan) and a block over it refuses the run, never truncated. A market pin and the knobs of the other options classes
29
- * are refused by name (`venue` among them until om's kit declares it for this class: the chain is `auto`'s, the one
30
- * `options_chain`'s `auto` reads on the same chart).
27
+ * `strike_window_pct` (above 0, at most 100), `book` (`auto` or one series name), `venue` (kit 0.87.0: the chain
28
+ * the one venue decision names for the word, in `options_chain`'s words; absent reads `auto`, the chain
29
+ * `options_chain`'s `auto` reads on the same chart); `max_cells` is required (the static plan) and a block over it
30
+ * refuses the run, never truncated. A market pin and the knobs of the other options classes are refused by name.
31
31
  *
32
32
  * LIGHT at module load: the chain resolver's directory, listing and lead reads run inside `identity` and `facets`.
33
33
  */
@@ -40,9 +40,8 @@ export const WRUN_OPTION_CONTRACT_STATE_WIDTH = 13;
40
40
  export const WRUN_OPTION_MARKET_PINNED_CODE = 'wrun_option_market_pinned';
41
41
  /** The payload field an instance names its chain's exchange in (its plane follows it). */
42
42
  export const WRUN_OPTION_CONTRACT_STATE_EXCHANGE_FIELD = 'stateExchange';
43
- /** The knobs of the other options classes, each refused here by name. */
43
+ /** The knobs of the other options classes, each refused here by name (`venue` is this class's own since kit 0.87.0). */
44
44
  const STRAY_KNOBS = [
45
- ['venue', "'options_chain', 'option_strikes', 'option_surface', 'options_oi' and 'options_volume'"],
46
45
  ['history', "'tape' and 'option_prints' celled"],
47
46
  ['min_size', "'tape' celled"],
48
47
  ['min_premium', "'option_prints' celled"],