@orangecharts/wrun-chart-host 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/README.md +23 -6
  2. package/dist/constants/exchange-names.leaf.d.ts +8 -0
  3. package/dist/constants/exchange-names.leaf.js +101 -0
  4. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
  5. package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
  6. package/dist/constants/opra-compliance.constants.d.ts +19 -0
  7. package/dist/constants/opra-compliance.constants.js +19 -0
  8. package/dist/constants/replay-ladder.leaf.d.ts +30 -0
  9. package/dist/constants/replay-ladder.leaf.js +99 -0
  10. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +133 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
  12. package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
  13. package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
  14. package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
  15. package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
  16. package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
  17. package/dist/constants/scriptEditor/execution.constants.js +14 -0
  18. package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
  19. package/dist/constants/wrun-prefix-safe.constants.js +26 -0
  20. package/dist/host-env.d.ts +321 -24
  21. package/dist/host-env.js +15 -0
  22. package/dist/host-ports.types.d.ts +857 -35
  23. package/dist/index.d.ts +149 -2
  24. package/dist/index.js +149 -2
  25. package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
  26. package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
  27. package/dist/interfaces/market-event.interface.d.ts +231 -0
  28. package/dist/interfaces/market-event.interface.js +15 -0
  29. package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
  30. package/dist/interfaces/opra-realtime.interface.js +34 -59
  31. package/dist/interfaces/replay.interface.d.ts +285 -0
  32. package/dist/interfaces/replay.interface.js +1 -0
  33. package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
  34. package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
  35. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
  36. package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
  37. package/dist/market-data/billing.interface.d.ts +219 -0
  38. package/dist/market-data/billing.interface.js +58 -0
  39. package/dist/market-data/venue-governed.util.d.ts +2 -0
  40. package/dist/market-data/venue-governed.util.js +10 -0
  41. package/dist/market-data/venue.d.ts +122 -0
  42. package/dist/market-data/venue.js +1 -0
  43. package/dist/market-data/venues/index.d.ts +97 -0
  44. package/dist/market-data/venues/index.js +33 -0
  45. package/dist/market-data/venues/opra.contract.copy.json +35 -0
  46. package/dist/market-data/venues/opra.d.ts +70 -0
  47. package/dist/market-data/venues/opra.js +74 -0
  48. package/dist/replay/replayIndicatorRows.d.ts +31 -0
  49. package/dist/replay/replayIndicatorRows.js +117 -0
  50. package/dist/replay/replayLadder.d.ts +85 -0
  51. package/dist/replay/replayLadder.js +388 -0
  52. package/dist/utility/auth/server-clock.util.d.ts +81 -0
  53. package/dist/utility/auth/server-clock.util.js +238 -0
  54. package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
  55. package/dist/utility/chart/builtin-identity.util.js +51 -0
  56. package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
  57. package/dist/utility/chart/cache-alignment.util.js +926 -0
  58. package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
  59. package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
  60. package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
  61. package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
  62. package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
  63. package/dist/utility/chart/chart-time-domain.util.js +23 -0
  64. package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
  65. package/dist/utility/chart/color-customization.leaf.js +16 -0
  66. package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
  67. package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
  68. package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
  69. package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
  70. package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
  71. package/dist/utility/chart/gesture-timing.leaf.js +29 -0
  72. package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
  73. package/dist/utility/chart/governed-contract-coin.util.js +39 -0
  74. package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
  75. package/dist/utility/chart/host-bar-placement.util.js +447 -0
  76. package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
  77. package/dist/utility/chart/index-host-tier.util.js +118 -0
  78. package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
  79. package/dist/utility/chart/index-mode-admission.util.js +67 -0
  80. package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
  81. package/dist/utility/chart/indicator-error-message.util.js +44 -0
  82. package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
  83. package/dist/utility/chart/indicator-run-interval.util.js +268 -0
  84. package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
  85. package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
  86. package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
  87. package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
  88. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
  89. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
  90. package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
  91. package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
  92. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
  93. package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
  94. package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
  95. package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
  96. package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
  97. package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
  98. package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
  99. package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
  100. package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
  101. package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
  102. package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
  103. package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
  104. package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
  105. package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
  106. package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
  107. package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
  108. package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
  109. package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
  110. package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
  111. package/dist/utility/chart/kscript-source-retention.util.js +218 -0
  112. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
  113. package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
  114. package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
  115. package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
  116. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
  117. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
  118. package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
  119. package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
  120. package/dist/utility/chart/live-cadence.util.d.ts +38 -0
  121. package/dist/utility/chart/live-cadence.util.js +37 -0
  122. package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
  123. package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
  124. package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
  125. package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
  126. package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
  127. package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
  128. package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
  129. package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
  130. package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
  131. package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
  132. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
  133. package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
  134. package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
  135. package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
  136. package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
  137. package/dist/utility/chart/mixed-mode.util.js +139 -0
  138. package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
  139. package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
  140. package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
  141. package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
  142. package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
  143. package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
  144. package/dist/utility/chart/price-precision.util.d.ts +40 -0
  145. package/dist/utility/chart/price-precision.util.js +70 -0
  146. package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
  147. package/dist/utility/chart/profile-block-size.util.js +141 -0
  148. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
  149. package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
  150. package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
  151. package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
  152. package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
  153. package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
  154. package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
  155. package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
  156. package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
  157. package/dist/utility/chart/titan-constants.pin.js +18 -5
  158. package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
  159. package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
  160. package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
  161. package/dist/utility/chart/window-geometry.leaf.js +391 -0
  162. package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
  163. package/dist/utility/chart/window-owner.leaf.js +24 -0
  164. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
  165. package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
  166. package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
  167. package/dist/utility/chart/wrun-run-result.util.js +20 -14
  168. package/dist/utility/common/data-processing.util.d.ts +138 -0
  169. package/dist/utility/common/data-processing.util.js +346 -0
  170. package/dist/utility/common/visible-timeout.util.d.ts +13 -4
  171. package/dist/utility/common/visible-timeout.util.js +23 -8
  172. package/dist/utility/exchange-format.leaf.d.ts +1 -0
  173. package/dist/utility/exchange-format.leaf.js +47 -0
  174. package/dist/utility/html-escape.leaf.d.ts +11 -0
  175. package/dist/utility/html-escape.leaf.js +20 -0
  176. package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
  177. package/dist/utility/market-events/earnings-scope.util.js +92 -0
  178. package/dist/utility/market-events/market-events.util.d.ts +147 -0
  179. package/dist/utility/market-events/market-events.util.js +392 -0
  180. package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
  181. package/dist/utility/market-events/zoned-clock.util.js +11 -0
  182. package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
  183. package/dist/utility/options/option-venue-disclosure.util.js +56 -0
  184. package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
  185. package/dist/utility/scriptEditor/package-semver.util.js +120 -0
  186. package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
  187. package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
  188. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
  189. package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
  190. package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
  191. package/dist/utility/v2/governed-tier.leaf.js +113 -0
  192. package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
  193. package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
  194. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +43 -15
  195. package/dist/utility/wrun/sources/lanes/option_daily.js +78 -20
  196. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +14 -10
  197. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +5 -4
  198. package/dist/utility/wrun/sources/lanes/series.js +2 -2
  199. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +22 -3
  200. package/dist/utility/wrun/sources/opra-option-lanes.util.js +38 -7
  201. package/dist/utility/wrun/sources/registry.js +31 -1
  202. package/dist/utility/wrun/sources/row-lane-registry.js +5 -5
  203. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +49 -0
  204. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +75 -20
  205. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +49 -0
  206. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +57 -47
  207. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +36 -4
  208. package/dist/utility/wrun/sources/row-lanes/option_surface.js +6 -12
  209. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +37 -3
  210. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +128 -2
  211. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +233 -51
  212. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +0 -8
  213. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +26 -24
  214. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +85 -104
  215. package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
  216. package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
  217. package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
  218. package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
  219. package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
  220. package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
  221. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
  222. package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
  223. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
  224. package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
  225. package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
  226. package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
  227. package/dist/utility/wrun/wrun-deadline.util.js +2 -1
  228. package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
  229. package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
  230. package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
  231. package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
  232. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
  233. package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
  234. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
  235. package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
  236. package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
  237. package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
  238. package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
  239. package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
  240. package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
  241. package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
  242. package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
  243. package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
  244. package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
  245. package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
  246. package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
  247. package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
  248. package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
  249. package/dist/utility/wrun/wrun-host.service.js +655 -0
  250. package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
  251. package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
  252. package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
  253. package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
  254. package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
  255. package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
  256. package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
  257. package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
  258. package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
  259. package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
  260. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
  261. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
  262. package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
  263. package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
  264. package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
  265. package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
  266. package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
  267. package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
  268. package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
  269. package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
  270. package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
  271. package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
  272. package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
  273. package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
  274. package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
  275. package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
  276. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +29 -10
  277. package/dist/utility/wrun/wrun-opra-stats.leaf.js +29 -10
  278. package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
  279. package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
  280. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
  281. package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
  282. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
  283. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
  284. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
  285. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
  286. package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
  287. package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
  288. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
  289. package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
  290. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
  291. package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
  292. package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
  293. package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
  294. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +392 -0
  295. package/dist/utility/wrun/wrun-panel-mount.util.js +2346 -0
  296. package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
  297. package/dist/utility/wrun/wrun-param-map.util.js +40 -47
  298. package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
  299. package/dist/utility/wrun/wrun-param-values.util.js +5 -5
  300. package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
  301. package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
  302. package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
  303. package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
  304. package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
  305. package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
  306. package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
  307. package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
  308. package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
  309. package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
  310. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
  311. package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
  312. package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
  313. package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
  314. package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
  315. package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
  316. package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
  317. package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
  318. package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
  319. package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
  320. package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
  321. package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
  322. package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
  323. package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
  324. package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
  325. package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
  326. package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
  327. package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
  328. package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
  329. package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
  330. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
  331. package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
  332. package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
  333. package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
  334. package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
  335. package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
  336. package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
  337. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
  338. package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
  339. package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
  340. package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
  341. package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
  342. package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
  343. package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
  344. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
  345. package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
  346. package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
  347. package/dist/utility/wrun/wrun-text-params.util.js +19 -30
  348. package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
  349. package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
  350. package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
  351. package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
  352. package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
  353. package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
  354. package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
  355. package/dist/utility/wrun-alert-params.leaf.js +24 -0
  356. package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
  357. package/dist/utils/replay/replay-buffer-math.js +684 -0
  358. package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
  359. package/dist/workers/wrun/wrun-abi-host.js +1201 -0
  360. package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
  361. package/dist/workers/wrun/wrun-engine-handler.js +211 -0
  362. package/package.json +3 -3
@@ -347,12 +347,13 @@ import { Intervals } from '../../constants/interval.constants.js';
347
347
  import { barEndMs, calendarBarStartMs, calendarLongestBarMs, calendarMonthsOfMs, isCalendarIntervalMs, } from '../chart/calendar-interval.util.js';
348
348
  import { WRUN_PINNED_INTERVALS, wrunPinnedIntervalOf } from './wrun-pinned-interval.util.js';
349
349
  import { realMainRows } from '../chart/indicator-gap-detector.util.js';
350
+ import { placeRowsInHostBars } from '../chart/host-bar-placement.util.js';
350
351
  import { findMonday } from '../chart/titan-constants.pin.js';
351
352
  import { wrunBarSessionFactsResolver, } from '../chart/wrun-bar-session-facts.util.js';
352
353
  import { wrunSettingRefusedMessage } from '../scriptEditor/wrun-runtime-diagnostics.leaf.js';
353
354
  import { attachWrunRefusal, wrunPinFinerSeed } from './wrun-refusal.util.js';
354
355
  import { planWrunRowLaneInputs, wrunRowLaneCellRows } from './sources/wrun-row-lanes.util.js';
355
- import { wrunTradesLaneOf, wrunTradesLegLaneOf } from './wrun-trades-lane.util.js';
356
+ import { wrunTradesLaneOf, wrunTradesLegLaneOf, wrunTradesLegOf } from './wrun-trades-lane.util.js';
356
357
  import { planWrunPollLaneInputs } from './sources/wrun-poll-lanes.util.js';
357
358
  import { planWrunEtfFlowColumns } from './wrun-etf-flow-lane.util.js';
358
359
  import { planWrunOptionSummaryLane } from './wrun-option-summary-lane.util.js';
@@ -682,6 +683,14 @@ export function wrunPinnedLegFetchKey(source, intervalKey, odds = false) {
682
683
  const key = `pinned|${source.exchange ?? 'currentExchange'}|${source.symbol ?? 'currentSymbol'}|${intervalKey}`;
683
684
  return odds ? `${key}|odds` : key;
684
685
  }
686
+ /** The tier each grid leg asked at a tier rides (`WrunPinnedLeg.tierMs`), by fetch key: `pinnedLegTierMs`. */
687
+ export function wrunPinnedLegTierMs(legs) {
688
+ const tiers = {};
689
+ for (const leg of legs ?? [])
690
+ if (leg.tierMs !== undefined && leg.tierMs > 0)
691
+ tiers[leg.fetchKey] = leg.tierMs;
692
+ return tiers;
693
+ }
685
694
  /** The fetch-key suffix a leg rides under a caller's prefix: the interval
686
695
  * alone for an own-market period leg (the round-2 shape), the market
687
696
  * appended for a foreign leg, `grid-` / `intrabar-` prefixed by kind,
@@ -696,6 +705,227 @@ export function wrunPinnedLegFetchSuffix(leg) {
696
705
  const stream = leg.stream !== undefined ? `-${wrunLegStreamKeyWords(leg.stream).replace(/\|/g, '-')}` : '';
697
706
  return `${kind}${leg.intervalKey}${market}${leg.odds === true ? '-odds' : ''}${stream}`;
698
707
  }
708
+ /**
709
+ * How one chart bar merges the rows of a leg on another bar grid that land in it (`placeRowsInHostBars`), by the
710
+ * leg's row shape: OHLC rows open on the first, span the extremes, close on the last and sum the volume
711
+ * (`candle`); additive rows sum (`flow`); celled rows keep the bar's last row whole (`level`: the flow merge sums
712
+ * numeric columns and has no cell merge). One entry per row class the source layer knows: a class without one
713
+ * fails the typecheck, and wrun-source-rows.grid-legs.spec.ts holds the table to the stream classes and the trades
714
+ * lanes.
715
+ */
716
+ export const WRUN_LEG_ROW_HOST_MERGE = Object.freeze({
717
+ ohlcv: 'candle',
718
+ odds: 'candle',
719
+ oi_candles: 'candle',
720
+ volume_profile_candles: 'level',
721
+ trades: 'flow',
722
+ trades_usd: 'flow',
723
+ });
724
+ /** A pinned leg's row class (`WRUN_LEG_ROW_HOST_MERGE`). */
725
+ export function wrunLegRowClassOf(leg) {
726
+ return leg.stream?.class ?? (leg.odds === true ? 'odds' : 'ohlcv');
727
+ }
728
+ /**
729
+ * The rows each pinned wire's reader is handed (`wrunHostRunOf`): `host-bars` for a reader the shared host joins on
730
+ * the chart's own rows by timestamp (its exact cursor: a grid leg read row for row), so the leg's rows are first
731
+ * placed in the chart bars that hold them (`wrunLegRowsOnHostBars`), and a leg on another bar grid (a 24/7
732
+ * market's :00 hours under a stock's 09:30-anchored bars) lands; `native` for a reader that meets the chart's rows
733
+ * by a candle's close or its bucket (the confirmed cursor, the forming fold, the candles stream, the intrabar
734
+ * slicer) and reads the leg's own rows; `none` for a wire that reads no leg. A wire kind without an entry fails the
735
+ * typecheck: a new reader says which rows it joins before it reads one.
736
+ */
737
+ export const WRUN_PINNED_WIRE_ROWS = Object.freeze({
738
+ own_period: 'none',
739
+ period: 'native',
740
+ forming: 'native',
741
+ grid: 'host-bars',
742
+ intrabar: 'native',
743
+ candles: 'native',
744
+ typed: 'none',
745
+ });
746
+ /** The interval (ms) a lane's acquisition was asked at (its `interval` word, the payload field the K control asks
747
+ * by), undefined when it names none: a trades leg's tier (`WrunChartSourceRows.tradeLegIntervals`). */
748
+ export function wrunLaneAcquisitionIntervalMs(acquisition) {
749
+ const word = acquisition?.interval;
750
+ const ms = typeof word === 'string' ? Intervals.map_unit[word] : undefined;
751
+ return typeof ms === 'number' && ms > 0 ? ms : undefined;
752
+ }
753
+ /** Each trades leg lane's row interval (ms) by its acquisition (`wrunLaneAcquisitionIntervalMs`: the tier its ask
754
+ * named, else the interval the fetch stamped on it): `WrunChartSourceRows.tradeLegIntervals`. */
755
+ export function wrunTradeLegIntervals(acquisition) {
756
+ const intervals = {};
757
+ for (const [lane, record] of Object.entries(acquisition)) {
758
+ if (wrunTradesLegOf(lane) === undefined)
759
+ continue;
760
+ const ms = wrunLaneAcquisitionIntervalMs(record);
761
+ if (ms !== undefined)
762
+ intervals[lane] = ms;
763
+ }
764
+ return intervals;
765
+ }
766
+ /** The backend's cache bucket, in rows of the asked interval: one wire ask of a tiered lane holds at most this many
767
+ * (`wrunWireRowPieces`), the overlays' tiered asks' rule. */
768
+ export const WRUN_WIRE_PIECE_ROWS = 250;
769
+ /**
770
+ * `[fromMs, toMs)` as the wire asks of a lane asked at `rowMs` (a trades leg's tier finer than the chart's bars),
771
+ * sized in the rows the wire returns: one piece when the span holds at most `WRUN_WIRE_PIECE_ROWS` rows, else
772
+ * ascending pieces of at most that many, each inner edge on the tier's bucket grid (a multiple of
773
+ * `WRUN_WIRE_PIECE_ROWS * rowMs` from the epoch, so a piece is one backend cache bucket), the first and last
774
+ * partial and the span never widened. A 12h stock chart's window is about a year: at 30m that is 17,520 rows of a
775
+ * 24/7 venue, and asked whole the gateway fails it.
776
+ */
777
+ export function wrunWireRowPieces(fromMs, toMs, rowMs) {
778
+ const bucketMs = WRUN_WIRE_PIECE_ROWS * rowMs;
779
+ if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || !(rowMs > 0) || toMs - fromMs <= bucketMs) {
780
+ return [{ fromMs, toMs }];
781
+ }
782
+ const pieces = [];
783
+ for (let at = fromMs; at < toMs;) {
784
+ const edge = Math.min(toMs, Math.floor(at / bucketMs) * bucketMs + bucketMs);
785
+ pieces.push({ fromMs: at, toMs: edge });
786
+ at = edge;
787
+ }
788
+ return pieces;
789
+ }
790
+ /** Pieces of one window on the wire at once (`wrunAskWirePieces`): the kScript source chunks' three. */
791
+ const WRUN_WIRE_PIECES_IN_FLIGHT = 3;
792
+ /**
793
+ * Whether the chart's fetch answered an ask whole, by the verdict it reports (`onSourceVerdict`): a genuine
794
+ * end-of-stream over the whole window (`complete`), or a row-cache hit (that cache keeps only such answers). A
795
+ * synthetic completion (a kicked session, a connection that could not open), a trimmed or refused window, and an ask
796
+ * that reported no verdict at all are not whole: their rows (none, or the ones collected so far) look like data.
797
+ */
798
+ export function wrunSourceVerdictWhole(verdict) {
799
+ return verdict !== undefined && (verdict.complete || verdict.source === 'row-cache');
800
+ }
801
+ /** A window asked in pieces whose piece the chart's fetch did not answer whole (`wrunAskWirePieces`): nothing of the
802
+ * window commits, since that piece's missing rows would read as quiet bars, and to a reconcile as absence. */
803
+ export class WrunWirePiecesIncomplete extends Error {
804
+ fromMs;
805
+ toMs;
806
+ constructor(fromMs, toMs) {
807
+ super(`the window's piece [${new Date(fromMs).toISOString()}, ${new Date(toMs).toISOString()}) was not answered whole`);
808
+ this.name = 'WrunWirePiecesIncomplete';
809
+ this.fromMs = fromMs;
810
+ this.toMs = toMs;
811
+ }
812
+ }
813
+ /**
814
+ * A window's rows asked in its pieces (`wrunWireRowPieces`), newest first (the bars at the chart's right edge, as the
815
+ * overlays' tiered families run) and at most three on the wire at once, as one ascending answer: a row two pieces
816
+ * both answer (the fetch pads a piece's end by one row) is kept once, the later piece's. The pieces are one family
817
+ * with one commit: a piece that fails, or that the fetch did not answer whole (`WrunWirePiecesIncomplete`), fails the
818
+ * whole ask and no further piece is asked, since a window missing a piece reads that piece's bars as quiet (and a
819
+ * reconcile reads them as absence, dropping rows it holds). One piece is the one ask's answer as it came: no piece
820
+ * of it can be missing in the middle. `abandoned` (the lane's budget ran out, its run no longer waits on it) asks no
821
+ * further piece; the pieces already out finish into the fetch's cache.
822
+ */
823
+ export async function wrunAskWirePieces(pieces, ask, abandoned) {
824
+ const stopIfAbandoned = () => {
825
+ if (abandoned?.aborted)
826
+ throw abandoned.reason ?? new Error('the window was abandoned');
827
+ };
828
+ if (pieces.length === 1) {
829
+ stopIfAbandoned();
830
+ return [...(await ask(pieces[0].fromMs, pieces[0].toMs)).rows];
831
+ }
832
+ const answers = [];
833
+ const newestFirst = pieces.map((_, at) => at).reverse();
834
+ let next = 0;
835
+ let failed = false;
836
+ const lane = async () => {
837
+ while (!failed && next < newestFirst.length) {
838
+ const at = newestFirst[next];
839
+ next += 1;
840
+ try {
841
+ stopIfAbandoned();
842
+ const answer = await ask(pieces[at].fromMs, pieces[at].toMs);
843
+ if (!answer.whole)
844
+ throw new WrunWirePiecesIncomplete(pieces[at].fromMs, pieces[at].toMs);
845
+ answers[at] = answer.rows;
846
+ }
847
+ catch (error) {
848
+ failed = true;
849
+ throw error;
850
+ }
851
+ }
852
+ };
853
+ await Promise.all(Array.from({ length: Math.min(WRUN_WIRE_PIECES_IN_FLIGHT, pieces.length) }, lane));
854
+ const byTs = new Map();
855
+ for (const answer of answers)
856
+ for (const row of answer)
857
+ byTs.set(Number(row[0]), row);
858
+ return [...byTs.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
859
+ }
860
+ /**
861
+ * The chart bar a grid leg's row stamped `rowTs` lands in, for one row and with no forming bar
862
+ * (`wrunLegRowsOnHostBars`'s rule for a closed row): its own stamp when that opens a chart bar, else the bar
863
+ * holding its last instant (by its open on a calendar span); null when no bar holds it (off the chart's
864
+ * session). `barOf` is the chart's bucket function at its own interval (`hostBucketResolverFor` over its bar
865
+ * grid). The live session reads it to tell which committed bar a revised leg row reaches.
866
+ */
867
+ export function wrunLegRowHostBar(rowTs, legMs, barOf) {
868
+ if (!Number.isFinite(rowTs))
869
+ return null;
870
+ const open = barOf(rowTs);
871
+ if (open === rowTs || !(legMs > 0) || isCalendarIntervalMs(legMs))
872
+ return open;
873
+ return barOf(rowTs + legMs - 1);
874
+ }
875
+ /** The index of the first of ascending `values` above `ms` (`values.length` when none is). */
876
+ function firstValueAbove(values, ms) {
877
+ let low = 0;
878
+ let high = values.length;
879
+ while (low < high) {
880
+ const mid = (low + high) >>> 1;
881
+ if (values[mid] <= ms)
882
+ low = mid + 1;
883
+ else
884
+ high = mid;
885
+ }
886
+ return low;
887
+ }
888
+ /**
889
+ * A grid leg's rows as the shared host's exact cursor reads them (`WRUN_PINNED_WIRE_ROWS`): each row in the chart
890
+ * bar holding its LAST instant (`placeRowsInHostBars` over the leg's own span, merged by the leg's row shape,
891
+ * `WRUN_LEG_ROW_HOST_MERGE`), so a leg on another bar grid lands on the chart's bars with no look-ahead. A closed
892
+ * chart bar holds only the rows that closed inside it: a 24/7 hour [14:00, 15:00) New York lands in a stock's 14:30
893
+ * bar and the 15:30 stub holds the [15:00, 16:00) hour; a stock's [13:30Z, 14:30Z) hour lands in a 24/7 chart's
894
+ * 14:00Z bar. A row still forming past the chart's newest bar lands in the bar holding its open when that bar is
895
+ * the chart's forming one (`formingBarTs`, a live chart's), else nowhere. A leg on the chart's own grid comes back
896
+ * as the same rows (the same array when every row is on a chart bar's open). The rows that closed before the first
897
+ * chart bar stay in front as they are: no bar holds them, and the last of them is the seed an odds leg carries a
898
+ * wire with before its first observation. A calendar span has no fixed length to find a row's last instant with:
899
+ * such a row lands in the bar holding its open.
900
+ *
901
+ * `afterTs` (a tail build's or a carry advance's carry `throughTs`): the pass reads the rows after it alone, so
902
+ * only the bars after it are landed, from the rows that can reach them (a live tick never lands the whole
903
+ * window again).
904
+ */
905
+ export function wrunLegRowsOnHostBars(rows, host, leg, afterTs) {
906
+ const { opens, intervalMs } = host;
907
+ if (rows.length === 0 || opens.length === 0 || !(intervalMs > 0))
908
+ return rows;
909
+ const spanMs = leg.legMs > 0 && !isCalendarIntervalMs(leg.legMs) ? leg.legMs : undefined;
910
+ // A row reaches the bar opening at `open` when its last instant does: stamped after `open - span`.
911
+ const reach = spanMs ?? 1;
912
+ let lead = 0;
913
+ while (lead < rows.length && wrunRowTs(rows[lead]) <= opens[0] - reach)
914
+ lead += 1;
915
+ const from = afterTs === undefined || !Number.isFinite(afterTs) ? 0 : firstValueAbove(opens, afterTs);
916
+ if (from >= opens.length)
917
+ return rows.slice(0, lead);
918
+ let placedFrom = lead;
919
+ if (from > 0) {
920
+ const floor = Math.max(opens[from] - reach, opens[from - 1]);
921
+ placedFrom = Math.max(lead, wrunLastRowAtOrBefore(rows, floor) + 1);
922
+ }
923
+ const placed = placeRowsInHostBars((placedFrom === 0 ? rows : rows.slice(placedFrom)), { mainRows: (from === 0 ? opens : opens.slice(from)).map((open) => [open]), intervalMs, venue: host.barGrid }, WRUN_LEG_ROW_HOST_MERGE[leg.rowClass], undefined, spanMs === undefined ? undefined : { rowSpanMs: spanMs, formingBarTs: host.formingBarTs ?? null });
924
+ if (lead === 0 && placedFrom === 0 && placed.length === rows.length && placed.every((row, at) => row === rows[at])) {
925
+ return rows;
926
+ }
927
+ return lead === 0 ? placed : [...rows.slice(0, lead), ...placed];
928
+ }
699
929
  const WRUN_INPUT_VIEWS = new Set([
700
930
  'confirmed',
701
931
  'forming',
@@ -2196,6 +2426,54 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
2196
2426
  }
2197
2427
  return rows;
2198
2428
  };
2429
+ // The chart's bars a grid leg lands on: the rows the shared host evaluates (the chart's own, or the dense grid
2430
+ // a nan or zero primary rides, every bar of the chart's phase), on the chart's bar grid.
2431
+ let hostBars;
2432
+ const hostBarGrid = () => {
2433
+ if (hostBars === undefined) {
2434
+ const primary = planned.wires[0];
2435
+ const dense = primary?.kind === 'scalar' && primary.densify === true && primary.unserved !== true;
2436
+ const opens = [];
2437
+ if (dense)
2438
+ for (let open = firstTs; open <= lastTs; open += intervalMs)
2439
+ opens.push(open);
2440
+ hostBars = {
2441
+ opens: dense ? opens : gridTs,
2442
+ intervalMs,
2443
+ barGrid: sources.venue?.barGrid ?? null,
2444
+ formingBarTs: sources.formingBarTs ?? null,
2445
+ };
2446
+ }
2447
+ return hostBars;
2448
+ };
2449
+ // A leg's rows in the chart bars holding them, for the readers that join the chart's rows by timestamp
2450
+ // (`WRUN_PINNED_WIRE_ROWS`); a tail lands the bars after its carry alone.
2451
+ const hostBarLegRows = new Map();
2452
+ const pinnedRowsOf = (kind, leg) => {
2453
+ if (WRUN_PINNED_WIRE_ROWS[kind] !== 'host-bars')
2454
+ return legRowsOf(leg);
2455
+ let rows = hostBarLegRows.get(leg.fetchKey);
2456
+ if (rows === undefined) {
2457
+ rows = wrunLegRowsOnHostBars(legRowsOf(leg), hostBarGrid(), { legMs: sources.pinnedLegTierMs?.[leg.fetchKey] ?? leg.legMs, rowClass: wrunLegRowClassOf(leg) }, cellsAfterTs);
2458
+ hostBarLegRows.set(leg.fetchKey, rows);
2459
+ }
2460
+ return rows;
2461
+ };
2462
+ // The foreign forming folds by input: each reads its grid leg's own rows on a key of its own, apart from a grid
2463
+ // read of the same market (the same ask), which reads them landed on the chart's bars.
2464
+ const foldKeys = new Map();
2465
+ // A trades leg's rows (its market's buy and sell volume at its own tier, on its own grid), landed on the chart's
2466
+ // bars and summed per bar, as the join reads them: the history and the live fold ride the leg's grid alike.
2467
+ const tradeLegLanded = new Map();
2468
+ const tradeLegRowsOf = (lane) => {
2469
+ let rows = tradeLegLanded.get(lane);
2470
+ if (rows === undefined) {
2471
+ const leg = wrunTradesLegOf(lane);
2472
+ rows = wrunLegRowsOnHostBars(sources.tradeLegRows?.[lane] ?? [], hostBarGrid(), { legMs: sources.tradeLegIntervals?.[lane] ?? intervalMs, rowClass: leg?.lane ?? 'trades' }, cellsAfterTs);
2473
+ tradeLegLanded.set(lane, rows);
2474
+ }
2475
+ return rows;
2476
+ };
2199
2477
  // An intrabar leg's candles as this build reads them: past the carry (`cellsAfterTs`) a tail
2200
2478
  // reads blocks only from the bounds of the carry's own row on (later rows open no earlier), so
2201
2479
  // the candles from there on, behind the newest candle closed by now that opens before them (the
@@ -2277,14 +2555,17 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
2277
2555
  softRefused.add(wire.inputIndex);
2278
2556
  switch (pinned.kind) {
2279
2557
  case 'period':
2280
- offer(key, legRowsOf(pinned.leg));
2558
+ offer(key, pinnedRowsOf(pinned.kind, pinned.leg));
2281
2559
  break;
2282
2560
  case 'grid':
2283
- offer(key, legRowsOf(pinned.gridLeg));
2561
+ offer(key, pinnedRowsOf(pinned.kind, pinned.gridLeg));
2284
2562
  break;
2285
2563
  case 'forming':
2286
- if (pinned.gridLeg !== undefined)
2287
- offer(key, legRowsOf(pinned.gridLeg));
2564
+ if (pinned.gridLeg !== undefined) {
2565
+ const fold = `${key}|fold`;
2566
+ foldKeys.set(wire.inputIndex, fold);
2567
+ offer(fold, pinnedRowsOf(pinned.kind, pinned.gridLeg));
2568
+ }
2288
2569
  break;
2289
2570
  case 'typed':
2290
2571
  offer(key, pinned.lane === 'funding' ? sources.fundingRateRows : sources.openInterestRows);
@@ -2304,11 +2585,11 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
2304
2585
  // reader): the leg's lane rows adapted once, by the stream's own ask (its span and facets).
2305
2586
  if (!cellAnswers.has(own)) {
2306
2587
  const ask = askByKey.get(key);
2307
- cellAnswers.set(own, ask === undefined ? [] : wrunLegStreamCellRows(host, ask, legRowsOf(pinned.leg)));
2588
+ cellAnswers.set(own, ask === undefined ? [] : wrunLegStreamCellRows(host, ask, pinnedRowsOf(pinned.kind, pinned.leg)));
2308
2589
  }
2309
2590
  break;
2310
2591
  }
2311
- offer(own, pinned.kind === 'intrabar' ? intrabarRowsOf(pinned.leg, closeMs) : legRowsOf(pinned.leg));
2592
+ offer(own, pinned.kind === 'intrabar' ? intrabarRowsOf(pinned.leg, closeMs) : pinnedRowsOf(pinned.kind, pinned.leg));
2312
2593
  break;
2313
2594
  }
2314
2595
  default:
@@ -2347,7 +2628,9 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
2347
2628
  ? sources.buySellVolumeUsdRows
2348
2629
  : lane === 'trades'
2349
2630
  ? sources.buySellVolumeRows
2350
- : ((lane === undefined ? undefined : sources.tradeLegRows?.[lane]) ?? []));
2631
+ : lane === undefined
2632
+ ? []
2633
+ : tradeLegRowsOf(lane));
2351
2634
  columns.set(wire.inputIndex, source.side === 'SELL' ? 2 : 1);
2352
2635
  // A pin on a venue not served to scripts yet is never asked: its fill, as a candle pin's.
2353
2636
  if (source.exchange !== undefined && wrunPinVenueVerdict(source.exchange) === 'unserved') {
@@ -2418,6 +2701,9 @@ function wrunHostRunOf(metadata, sources, clock, cellsAfterTs) {
2418
2701
  if (undemanded.has(wire.inputIndex - shift) && wire.ownPeriod !== true) {
2419
2702
  return { ...wire, unserved: true };
2420
2703
  }
2704
+ const fold = foldKeys.get(wire.inputIndex);
2705
+ if (fold !== undefined)
2706
+ return { ...wire, fetchKey: fold };
2421
2707
  const lane = laneWires.get(wire.inputIndex);
2422
2708
  if (lane !== undefined) {
2423
2709
  // The lane read: the lane's rows, its column, its join (the stand-in's ask is never read; a
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The stats strip's look on a wrun sheet (om `stats_strip`: `grading`,
3
+ * `label_side`, `theme`, in the words of the shared host's WRUN_STATS_STRIP_WORDS)
4
+ * as the overlay settings titan's strip reads. The strip reads three
5
+ * Display settings off the overlay by name, `statsGrading`, `statsLabelSide`
6
+ * and `statsTheme` (titan statsStripRenderer.ts, through normalizeGradingBasis,
7
+ * resolveStatsLabelSide and normalizeStatsTheme), which a kScript overlay
8
+ * holds as the Bar Statistics template's Display inputs, each its option
9
+ * label. A sheet paints its strip keys through `style_targets` from a select
10
+ * (`style_values` over the words), so the sheet as the settings paint it
11
+ * (wrunSheetWithSettings) holds the current look, and the full run stamps it
12
+ * on the overlay under those three names, in the template's labels: a twin's
13
+ * strip reads exactly what its built-in's reads.
14
+ */
15
+ import { type WrunSharedHostModule } from '../../host-env.js';
16
+ import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
17
+ /** A key of the strip's look: the kit's `WrunStatsStripKey`, read off the shared host the env hands. */
18
+ type WrunStatsStripKey = keyof WrunSharedHostModule['WRUN_STATS_STRIP_WORDS'];
19
+ /** The overlay setting titan's strip reads for each sheet key. */
20
+ export declare const WRUN_STATS_STRIP_SETTING_KEYS: Readonly<Record<WrunStatsStripKey, string>>;
21
+ /** Each word as the Bar Statistics template's option label (its Display
22
+ * inputs' options, in the words' order): the string the built-in's overlay
23
+ * holds and titan's normalizers read. */
24
+ export declare const WRUN_STATS_STRIP_SETTING_LABELS: {
25
+ readonly [K in WrunStatsStripKey]: Readonly<Record<WrunSharedHostModule['WRUN_STATS_STRIP_WORDS'][K][number], string>>;
26
+ };
27
+ /**
28
+ * The strip settings a sheet paints: one titan setting per key its
29
+ * `stats_strip` holds, in the template's label. Undefined when the sheet
30
+ * declares no strip look (nothing is stamped, the strip keeps its own
31
+ * defaults). A key holding anything but one of its words, or an unknown key,
32
+ * refuses by name (the om sheet check's rule, held at the host too).
33
+ */
34
+ export declare function wrunStatsStripSettings(sheet: Pick<WrunIndicatorMetadata, 'id' | 'stats_strip'>): Record<string, string> | undefined;
35
+ /**
36
+ * Whether a sheet's whole look is a stats strip: every renderer a `stats_row` (at least one), and
37
+ * every output data-only (`plot: ""`), so the strip is all the chart draws of it (a mark, a label
38
+ * or a plotted line beside the rows makes another look). Two twin rules read it. The palette:
39
+ * titan's strip reads the overlay palette (`settings.colors`) as its "Candle colors" theme pair,
40
+ * so such a sheet's palette is the theme's, as on the built-in's template, never its colour
41
+ * settings, which paint their own rows through their style targets (wrun-overlay-run.util
42
+ * syncWrunRunOverlayPalette). The legend: such a twin prints its built-in's one readout off the
43
+ * container row, the strip's first row, as the template does (the technical-script control).
44
+ */
45
+ export declare function wrunSheetDrawsOnlyStatsStrip(sheet: Pick<WrunIndicatorMetadata, 'outputs' | 'renderers'>): boolean;
46
+ export {};
@@ -0,0 +1,87 @@
1
+ /**
2
+ * The stats strip's look on a wrun sheet (om `stats_strip`: `grading`,
3
+ * `label_side`, `theme`, in the words of the shared host's WRUN_STATS_STRIP_WORDS)
4
+ * as the overlay settings titan's strip reads. The strip reads three
5
+ * Display settings off the overlay by name, `statsGrading`, `statsLabelSide`
6
+ * and `statsTheme` (titan statsStripRenderer.ts, through normalizeGradingBasis,
7
+ * resolveStatsLabelSide and normalizeStatsTheme), which a kScript overlay
8
+ * holds as the Bar Statistics template's Display inputs, each its option
9
+ * label. A sheet paints its strip keys through `style_targets` from a select
10
+ * (`style_values` over the words), so the sheet as the settings paint it
11
+ * (wrunSheetWithSettings) holds the current look, and the full run stamps it
12
+ * on the overlay under those three names, in the template's labels: a twin's
13
+ * strip reads exactly what its built-in's reads.
14
+ */
15
+ import { wrunChartHostEnv } from '../../host-env.js';
16
+ /** The overlay setting titan's strip reads for each sheet key. */
17
+ export const WRUN_STATS_STRIP_SETTING_KEYS = {
18
+ grading: 'statsGrading',
19
+ label_side: 'statsLabelSide',
20
+ theme: 'statsTheme',
21
+ };
22
+ /** Each word as the Bar Statistics template's option label (its Display
23
+ * inputs' options, in the words' order): the string the built-in's overlay
24
+ * holds and titan's normalizers read. */
25
+ export const WRUN_STATS_STRIP_SETTING_LABELS = {
26
+ grading: { rolling: 'Rolling', daily: 'Daily', weekly: 'Weekly', visible: 'Visible range', whole: 'Whole chart' },
27
+ label_side: { left: 'Left', right: 'Right' },
28
+ theme: {
29
+ candle: 'Candle colors',
30
+ teal_rose: 'Teal / Rose',
31
+ viridis: 'Viridis',
32
+ inferno: 'Inferno',
33
+ blue_red: 'Blue / Red',
34
+ mono: 'Monochrome',
35
+ },
36
+ };
37
+ const KEYS = Object.keys(WRUN_STATS_STRIP_SETTING_KEYS);
38
+ /**
39
+ * The strip settings a sheet paints: one titan setting per key its
40
+ * `stats_strip` holds, in the template's label. Undefined when the sheet
41
+ * declares no strip look (nothing is stamped, the strip keeps its own
42
+ * defaults). A key holding anything but one of its words, or an unknown key,
43
+ * refuses by name (the om sheet check's rule, held at the host too).
44
+ */
45
+ export function wrunStatsStripSettings(sheet) {
46
+ const strip = sheet.stats_strip;
47
+ if (strip === undefined)
48
+ return undefined;
49
+ if (typeof strip !== 'object' || strip === null || Array.isArray(strip)) {
50
+ throw new Error(`WRUN ${sheet.id}: stats_strip must be an object of ${KEYS.join(', ')}`);
51
+ }
52
+ const settings = {};
53
+ for (const [key, word] of Object.entries(strip)) {
54
+ if (word === undefined)
55
+ continue;
56
+ if (!KEYS.includes(key)) {
57
+ throw new Error(`WRUN ${sheet.id}: stats_strip takes ${KEYS.join(', ')}, not '${key}'`);
58
+ }
59
+ const stripKey = key;
60
+ const labels = WRUN_STATS_STRIP_SETTING_LABELS[stripKey];
61
+ const label = typeof word === 'string' && Object.hasOwn(labels, word) ? labels[word] : undefined;
62
+ if (label === undefined) {
63
+ throw new Error(`WRUN ${sheet.id}: stats_strip ${stripKey} must be one of ${wrunChartHostEnv().sharedHost().WRUN_STATS_STRIP_WORDS[stripKey].join(', ')}, ` +
64
+ `got ${JSON.stringify(word)}`);
65
+ }
66
+ settings[WRUN_STATS_STRIP_SETTING_KEYS[stripKey]] = label;
67
+ }
68
+ return settings;
69
+ }
70
+ /**
71
+ * Whether a sheet's whole look is a stats strip: every renderer a `stats_row` (at least one), and
72
+ * every output data-only (`plot: ""`), so the strip is all the chart draws of it (a mark, a label
73
+ * or a plotted line beside the rows makes another look). Two twin rules read it. The palette:
74
+ * titan's strip reads the overlay palette (`settings.colors`) as its "Candle colors" theme pair,
75
+ * so such a sheet's palette is the theme's, as on the built-in's template, never its colour
76
+ * settings, which paint their own rows through their style targets (wrun-overlay-run.util
77
+ * syncWrunRunOverlayPalette). The legend: such a twin prints its built-in's one readout off the
78
+ * container row, the strip's first row, as the template does (the technical-script control).
79
+ */
80
+ export function wrunSheetDrawsOnlyStatsStrip(sheet) {
81
+ const renderers = Array.isArray(sheet.renderers) ? sheet.renderers : [];
82
+ const outputs = Array.isArray(sheet.outputs) ? sheet.outputs : [];
83
+ const isRecord = (value) => typeof value === 'object' && value !== null;
84
+ return (renderers.length > 0 &&
85
+ renderers.every((renderer) => isRecord(renderer) && renderer.kind === 'stats_row') &&
86
+ outputs.every((output) => isRecord(output) && output.plot === ''));
87
+ }