@orangecharts/wrun-chart-host 0.2.0 → 0.3.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 (320) hide show
  1. package/README.md +14 -6
  2. package/dist/constants/common.constants.d.ts +15 -0
  3. package/dist/constants/common.constants.js +23 -0
  4. package/dist/constants/data-source.constants.d.ts +1 -0
  5. package/dist/constants/data-source.constants.js +1 -0
  6. package/dist/constants/economic.constants.d.ts +39 -0
  7. package/dist/constants/economic.constants.js +77 -0
  8. package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
  9. package/dist/constants/etf-covered-coins.constants.js +9 -0
  10. package/dist/constants/feature-flags.constants.d.ts +60 -0
  11. package/dist/constants/feature-flags.constants.js +308 -0
  12. package/dist/constants/feature-limits.constants.d.ts +134 -0
  13. package/dist/constants/feature-limits.constants.js +155 -0
  14. package/dist/constants/marketCapabilities.constants.d.ts +87 -0
  15. package/dist/constants/marketCapabilities.constants.js +213 -0
  16. package/dist/constants/option-venues.constants.d.ts +100 -0
  17. package/dist/constants/option-venues.constants.js +167 -0
  18. package/dist/constants/overlay-data.constants.d.ts +53 -0
  19. package/dist/constants/overlay-data.constants.js +80 -0
  20. package/dist/constants/pane-grid.constants.d.ts +15 -0
  21. package/dist/constants/pane-grid.constants.js +17 -0
  22. package/dist/constants/venue-presets.constants.d.ts +10 -0
  23. package/dist/constants/venue-presets.constants.js +22 -0
  24. package/dist/enums/chart.enum.d.ts +68 -0
  25. package/dist/enums/chart.enum.js +70 -0
  26. package/dist/helpers/data.helpers.d.ts +2 -0
  27. package/dist/helpers/data.helpers.js +14 -0
  28. package/dist/host-env.d.ts +161 -5
  29. package/dist/host-ports.types.d.ts +446 -0
  30. package/dist/host-ports.types.js +1 -0
  31. package/dist/index.d.ts +128 -0
  32. package/dist/index.js +128 -0
  33. package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
  34. package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
  35. package/dist/interfaces/asset-venue.interface.d.ts +91 -0
  36. package/dist/interfaces/asset-venue.interface.js +1 -0
  37. package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
  38. package/dist/interfaces/cancel-reason.interface.js +2 -0
  39. package/dist/interfaces/catalog-display.interface.d.ts +3 -0
  40. package/dist/interfaces/catalog-display.interface.js +1 -0
  41. package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
  42. package/dist/interfaces/cme-realtime.interface.js +46 -0
  43. package/dist/interfaces/feed.interface.d.ts +80 -0
  44. package/dist/interfaces/feed.interface.js +7 -0
  45. package/dist/interfaces/market-kind.interface.d.ts +8 -0
  46. package/dist/interfaces/market-kind.interface.js +1 -0
  47. package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
  48. package/dist/interfaces/opra-realtime.interface.js +105 -0
  49. package/dist/interfaces/option-instrument.interface.d.ts +32 -0
  50. package/dist/interfaces/option-instrument.interface.js +1 -0
  51. package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
  52. package/dist/interfaces/options-chain-scope.interface.js +7 -0
  53. package/dist/interfaces/prediction-market.interface.d.ts +88 -0
  54. package/dist/interfaces/prediction-market.interface.js +8 -0
  55. package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
  56. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
  57. package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
  58. package/dist/settings-templates/frvp-fields.d.ts +27 -0
  59. package/dist/settings-templates/frvp-fields.js +108 -0
  60. package/dist/settings-templates/index.d.ts +119 -0
  61. package/dist/settings-templates/index.js +442 -0
  62. package/dist/settings-templates/indicator-fields.d.ts +56 -0
  63. package/dist/settings-templates/indicator-fields.js +793 -0
  64. package/dist/settings-templates/tool-rules.d.ts +59 -0
  65. package/dist/settings-templates/tool-rules.js +49 -0
  66. package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
  67. package/dist/settings-templates/tool-tables.generated.js +1668 -0
  68. package/dist/utility/blk-market.util.d.ts +5 -0
  69. package/dist/utility/blk-market.util.js +12 -0
  70. package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
  71. package/dist/utility/chart/chart-load-phase.util.js +78 -0
  72. package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
  73. package/dist/utility/chart/cme-cache-context.util.js +166 -0
  74. package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
  75. package/dist/utility/chart/cme-session-bucket.util.js +343 -0
  76. package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
  77. package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
  78. package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
  79. package/dist/utility/chart/continuous-contracts.util.js +374 -0
  80. package/dist/utility/chart/feed-interval.util.d.ts +119 -0
  81. package/dist/utility/chart/feed-interval.util.js +321 -0
  82. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
  83. package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
  84. package/dist/utility/chart/footprint-band.util.d.ts +76 -0
  85. package/dist/utility/chart/footprint-band.util.js +205 -0
  86. package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
  87. package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
  88. package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
  89. package/dist/utility/chart/formula-calendar.util.js +59 -0
  90. package/dist/utility/chart/history-wall.util.d.ts +67 -0
  91. package/dist/utility/chart/history-wall.util.js +87 -0
  92. package/dist/utility/chart/index-mode.util.d.ts +66 -0
  93. package/dist/utility/chart/index-mode.util.js +360 -0
  94. package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
  95. package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
  96. package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
  97. package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
  98. package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
  99. package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
  100. package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
  101. package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
  102. package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
  103. package/dist/utility/chart/indicator-inflight-registry.util.js +254 -0
  104. package/dist/utility/chart/interval-registry.util.d.ts +23 -0
  105. package/dist/utility/chart/interval-registry.util.js +83 -0
  106. package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
  107. package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
  108. package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
  109. package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
  110. package/dist/utility/chart/live-bucket.util.d.ts +66 -0
  111. package/dist/utility/chart/live-bucket.util.js +165 -0
  112. package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
  113. package/dist/utility/chart/market-session-schedule.util.js +337 -0
  114. package/dist/utility/chart/marketKind.util.d.ts +181 -0
  115. package/dist/utility/chart/marketKind.util.js +371 -0
  116. package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
  117. package/dist/utility/chart/opra-read-access.leaf.js +25 -0
  118. package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
  119. package/dist/utility/chart/prediction-identity.util.js +236 -0
  120. package/dist/utility/chart/rth-session.util.d.ts +352 -0
  121. package/dist/utility/chart/rth-session.util.js +926 -0
  122. package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
  123. package/dist/utility/chart/titan-constants.pin.js +50 -0
  124. package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
  125. package/dist/utility/chart/us-equities-session.util.js +251 -0
  126. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
  127. package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
  128. package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
  129. package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
  130. package/dist/utility/common/safe-math-eval.d.ts +18 -0
  131. package/dist/utility/common/safe-math-eval.js +160 -0
  132. package/dist/utility/common/time.util.d.ts +134 -0
  133. package/dist/utility/common/time.util.js +428 -0
  134. package/dist/utility/common/transformations.util.d.ts +126 -0
  135. package/dist/utility/common/transformations.util.js +711 -0
  136. package/dist/utility/common/visible-timeout.util.d.ts +17 -0
  137. package/dist/utility/common/visible-timeout.util.js +75 -0
  138. package/dist/utility/exchange-normalization.util.d.ts +8 -0
  139. package/dist/utility/exchange-normalization.util.js +32 -0
  140. package/dist/utility/intl-locale.util.d.ts +2 -0
  141. package/dist/utility/intl-locale.util.js +28 -0
  142. package/dist/utility/number-format.util.d.ts +14 -1
  143. package/dist/utility/number-format.util.js +50 -19
  144. package/dist/utility/options/option-symbol.util.d.ts +28 -0
  145. package/dist/utility/options/option-symbol.util.js +176 -0
  146. package/dist/utility/options/option-trade-units.util.d.ts +190 -0
  147. package/dist/utility/options/option-trade-units.util.js +283 -0
  148. package/dist/utility/options/option-venue.util.d.ts +75 -0
  149. package/dist/utility/options/option-venue.util.js +85 -0
  150. package/dist/utility/pool-symbol.leaf.d.ts +34 -0
  151. package/dist/utility/pool-symbol.leaf.js +95 -0
  152. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
  153. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
  154. package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
  155. package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
  156. package/dist/utility/v2/gate-plane.util.d.ts +58 -0
  157. package/dist/utility/v2/gate-plane.util.js +99 -0
  158. package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
  159. package/dist/utility/v2/gate-session-latch.util.js +34 -0
  160. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
  161. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
  162. package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
  163. package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
  164. package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
  165. package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
  166. package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
  167. package/dist/utility/wrun/sources/lanes/economic.js +79 -0
  168. package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
  169. package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
  170. package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
  171. package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
  172. package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
  173. package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
  174. package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
  175. package/dist/utility/wrun/sources/lanes/index.js +32 -0
  176. package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
  177. package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
  178. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
  179. package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
  180. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
  181. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
  182. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
  183. package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
  184. package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
  185. package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
  186. package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
  187. package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
  188. package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
  189. package/dist/utility/wrun/sources/lanes/series.js +321 -0
  190. package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
  191. package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
  192. package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
  193. package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
  194. package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
  195. package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
  196. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
  197. package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
  198. package/dist/utility/wrun/sources/registry.d.ts +21 -0
  199. package/dist/utility/wrun/sources/registry.js +207 -0
  200. package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
  201. package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
  202. package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
  203. package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
  204. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
  205. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
  206. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
  207. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
  208. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
  209. package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
  210. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
  211. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
  212. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
  213. package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
  214. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
  215. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
  216. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
  217. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
  218. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
  219. package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
  220. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
  221. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
  222. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
  223. package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
  224. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
  225. package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
  226. package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
  227. package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
  228. package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
  229. package/dist/utility/wrun/wrun-deadline.util.js +82 -0
  230. package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
  231. package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
  232. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
  233. package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
  234. package/dist/utility/wrun/wrun-frames.d.ts +20 -1
  235. package/dist/utility/wrun/wrun-frames.js +103 -49
  236. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  237. package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
  238. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
  239. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
  240. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
  241. package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
  242. package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
  243. package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
  244. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
  245. package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
  246. package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
  247. package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
  248. package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
  249. package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
  250. package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
  251. package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
  252. package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
  253. package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
  254. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
  255. package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
  256. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
  257. package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
  258. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
  259. package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
  260. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
  261. package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
  262. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
  263. package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
  264. package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
  265. package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
  266. package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
  267. package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
  268. package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
  269. package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
  270. package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
  271. package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
  272. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
  273. package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
  274. package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
  275. package/dist/utility/wrun/wrun-param-map.util.js +581 -0
  276. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
  277. package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
  278. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
  279. package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
  280. package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
  281. package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
  282. package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
  283. package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
  284. package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
  285. package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
  286. package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
  287. package/dist/utility/wrun/wrun-refusal.util.js +69 -2
  288. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
  289. package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
  290. package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
  291. package/dist/utility/wrun/wrun-row-source.js +75 -0
  292. package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
  293. package/dist/utility/wrun/wrun-run-health.util.js +273 -0
  294. package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
  295. package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
  296. package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
  297. package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
  298. package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
  299. package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
  300. package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
  301. package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
  302. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
  303. package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
  304. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
  305. package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
  306. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
  307. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
  308. package/dist/utility/wrun-display-name.util.d.ts +33 -0
  309. package/dist/utility/wrun-display-name.util.js +64 -0
  310. package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
  311. package/dist/workers/constants/kscript-transport-codes.js +15 -0
  312. package/dist/workers/constants/socket-slots.d.ts +574 -0
  313. package/dist/workers/constants/socket-slots.js +539 -0
  314. package/dist/workers/utils/number.worker.util.d.ts +5 -0
  315. package/dist/workers/utils/number.worker.util.js +10 -0
  316. package/dist/workers/utils/time.worker.util.d.ts +12 -0
  317. package/dist/workers/utils/time.worker.util.js +24 -0
  318. package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
  319. package/dist/workers/utils/volume-profile.worker.util.js +631 -0
  320. package/package.json +10 -4
@@ -0,0 +1,911 @@
1
+ /**
2
+ * Chart rows -> WRUN input rows: maps each declared input (via
3
+ * `metadata.inputSources`) onto the per-source rows the chart's kScript lane
4
+ * already fetches, producing the positional scalar block plus cell blocks on
5
+ * the PRIMARY (ohlcv) grid.
6
+ *
7
+ * The rows are built by the shared wrun host (`planWrunRun` and
8
+ * `alignWrunRows` under the chart-browser profile, through the seam
9
+ * wrun-shared-host.ts): this module keeps the browser's lanes, its planners
10
+ * and their refusals in the browser's words, and answers the host's plan
11
+ * with the rows each lane and leg fetched (`wrunHostRunOf`). The contract
12
+ * below is the lanes' and the host's rows over them (contract Amendment 11:
13
+ * the chart app's own reads, the program decisions where they differ: a
14
+ * carry input's leading gap abstains the row, absent from the output; nan
15
+ * and zero read their fill on every bar, the leading ones included; a nan or
16
+ * zero primary rides the dense grid at the chart's phase, save a candle
17
+ * class's, which walks the chart's candles (a bucket with no trade is no
18
+ * bar); book cells are sorted with zero-size levels kept).
19
+ *
20
+ * Served source classes in the browser lane:
21
+ * - `ohlcv` fields (open/high/low/close/volume; `time` in ms) off the chart's
22
+ * candle rows `[ts, o, h, l, c, v]`, and the four blends (hl2, hlc3,
23
+ * ohlc4, hlcc4: wrunSourceBlend, the kit's arithmetic and NaN rule) of the
24
+ * candle each read is served: the chart's row, a pinned leg's candle (the
25
+ * folded candle of an interval pin), a foreign market's grid row, the
26
+ * folded candle of a forming view.
27
+ * - `time` with field `bar_open_sec` (the primary bar open in epoch seconds),
28
+ * `trade_date` or `session` (the bar's market facts, contract C3:
29
+ * wrun-bar-session-facts.util over `sources.venue`, the chart's market
30
+ * and bar interval; refused by name without one). Any other time field
31
+ * refuses.
32
+ * - `trades` with field `volume` and a `side` facet ('BUY' | 'SELL'), off the
33
+ * kScript buy_sell_volume lane rows `[ts, buy, sell]`, exact-joined onto
34
+ * the primary grid under the declared missing policy.
35
+ * - `oi` fields (open/high/low/close) off the kScript open_interest lane rows
36
+ * `[ts, o, h, l, c]`, exact-joined the same way.
37
+ * - `liquidations` with field `liquidations`, off the kScript K_LIQUIDATIONS
38
+ * lane rows `[ts, buyLiquidations, sellLiquidations]`
39
+ * (`liquidations.worker.ts` parse, sides zero-filled). The scalar follows
40
+ * the om runtime's frozen liquidations contract: `side` absent serves the
41
+ * per-bar TOTAL (buy + sell), `side: 'BUY' | 'SELL'` serves that side's
42
+ * column, any other side refuses by name. The series is naturally sparse,
43
+ * so ports pair it with `missing: 'nan'` (the footprint family does).
44
+ * - `funding` with field `rate_close`, off the kScript K_FUNDING_RATE lane
45
+ * rows `[ts, value]` (`k-funding-rate.worker.ts` parse). The FE lane
46
+ * serves ONE column, the close rate scaled to percent (rateClose * 100),
47
+ * so `rate_close` is the only servable field here and its unit is the FE
48
+ * engine's percent, NOT the om daemon's raw rate (the browser parity
49
+ * target is the FE kScript engine over these same rows); the om class's
50
+ * other fields (rate_open/high/low, predicted_*) refuse by name.
51
+ * - `implied_volatility` with field `implied_volatility` and a REQUIRED
52
+ * `tenor`, off the K_DERIBIT_IMPLIED_VOLATILITY lane rows `[ts, <one
53
+ * column per distinct declared tenor>]` in declaration order
54
+ * (`planWrunOptionSummaryLane`, wrun-option-summary-lane.util: the run
55
+ * pass asks exactly the declared tenors); the plan gives each input its
56
+ * column. Served: ONE_W, ONE_M, TWO_M, THREE_M, SIX_M; ONE_D, THREE_D
57
+ * and ONE_Y (no series on the gateway), a missing or unknown tenor and a
58
+ * wrong field refuse by name, before any row here and before any fetch
59
+ * in the run pass.
60
+ * - `skew` with field `skew`, a REQUIRED `tenor` and an optional `delta`
61
+ * (5, 15, 25 or 35; absent reads 25), off the K_SKEW lane rows under the
62
+ * same plan: a column per distinct (delta, tenor) pair, one K ask per
63
+ * delta zipped by timestamp (`zipWrunOptionSummaryRows`); a delta outside
64
+ * the four refuses by name before any row and before any fetch.
65
+ * - `etf_flow` with field `flow_usd` and a REQUIRED `fund` (an ETF ticker,
66
+ * or `all` for the sum over the chart coin's funds), off the kScript
67
+ * K_ETF_FLOW lane asked at DAY on every chart and zipped per declared fund
68
+ * word into `etfFlowRows` `[dayTs, ...columns]` (`wrun-etf-flow-lane.util`
69
+ * owns the contract: the coin comes from the chart market and refuses by
70
+ * name when it has no listed spot ETFs, a ticker the coin does not list
71
+ * refuses by name). A DAILY series: on an intraday chart the day's value
72
+ * lands on the FIRST bar of its day and the day's later bars follow the
73
+ * `missing` policy; a daily chart joins row for row; a coarser chart sums
74
+ * the days inside each bar. Needs the clock (the chart interval).
75
+ * - `book` (celled): the kScript orderbook lane's rows
76
+ * (`k-orderbook.worker.ts` parse: `[ts, bidPrice, bidSize, ...][askPrice,
77
+ * -askSize, ...]` with ask sizes NEGATIVE and asks sorted descending by
78
+ * price) become the ABI's `[price, abs(size), side]` tuples through the
79
+ * shared host's one cell adapter (the kScript row dialect), side +1 for a
80
+ * positive stored size / -1 for a negative one or a negated zero, in the
81
+ * shared order every host serves (a program decision): bids descending,
82
+ * then asks ascending, zero-size levels kept. A module ported against the
83
+ * lane's stored order (asks descending, walked positionally) reads another
84
+ * book here than the kScript engine does over the same rows. A primary
85
+ * bar with no book observation exact-joins as
86
+ * a PRESENT EMPTY block with a NaN placeholder in the scalar slot; celled
87
+ * inputs never gate readiness.
88
+ * - `volume_profile` (celled): the kScript K_VOLUME_PROFILE lane's
89
+ * array-celled rows (`k-volume-profile-agg.worker.ts` parse: `[ts,
90
+ * [priceLow, priceHigh, buyVolume, sellVolume], ...]` with buckets in
91
+ * stored ascending-price order) flatten into the ABI's contract-1
92
+ * 4-tuples [low, high, buy, sell] IN THE ROW'S OWN BUCKET ORDER. Unlike
93
+ * the om daemon's lane (which reconstructs low = high = price from the
94
+ * flat wire triplets), the FE lane serves REAL bucket bounds: the browser
95
+ * lane replays what the FE kScript engine sees, so the bounds survive.
96
+ * Missing observations exact-join as PRESENT EMPTY blocks, same as book.
97
+ * - `trade_volume_by_size` (celled): the K_TRADE_VOLUME_BY_SIZE lane's
98
+ * dense per-bar rows (`k-trade-volume-by-size.worker.ts`: `[ts, [bucketId,
99
+ * buyVolUsd, sellVolUsd, buyCount, sellCount], ...]`, one cell per USD
100
+ * order-size bucket that traded in the bar, ascending by bucket; a quiet
101
+ * bar is `[ts]`) flatten into the kit's 5-tuples `[bucket, buy_usd,
102
+ * sell_usd, buy_count, sell_count]` (`WRUN_TRADE_VOLUME_BY_SIZE_TUPLE_WIDTH`;
103
+ * bucket 1..7 = 0 to 1K, 1K to 10K, 10K to 100K, 100K to 500K, 500K to
104
+ * 1M, 1M to 10M, 10M and up; volumes USD notional, counts trades) IN THE
105
+ * ROW'S OWN BUCKET ORDER. Exact-joined on the primary grid: a quiet bar
106
+ * and a bar the lane holds no row for are PRESENT EMPTY blocks, like the
107
+ * profile. Own market only (the chart's symbol and exchange), a POLL lane
108
+ * (no live channel: the reconcile re-asks it).
109
+ * - `options_chain` (celled): the K_OPTIONS_CHAIN lane's snapshot rows
110
+ * `[stampTs, [strike, expiry_ms, side, oi, gamma, delta, mark_iv,
111
+ * underlying, multiplier, vega], ...]` (one tuple per listed contract, side +1
112
+ * call / -1 put; `wrun-options-chain.util.ts`). The hosts serve the LATEST
113
+ * chain, not a history of chains: the newest row's tuples become the LIVE
114
+ * primary row's block (the last chart row), every other row a PRESENT
115
+ * EMPTY block, and a package reads the chain on `bar.isLast()`. The
116
+ * input's `expiries` knob ("all" | "nearest:N") is applied here per input,
117
+ * so one lane feeds every chain input of a package; the `venue` knob is
118
+ * decided by the run lane before the fetch. A chain over `max_cells`
119
+ * refuses by name where the host builds the live row's block
120
+ * (`wrun_cell_block_too_large`, never truncated).
121
+ * - `tape` (celled): the K_TRADES large lane's rows (`k-trades.worker.ts`:
122
+ * `[barTs, [offsetMs, price, size, side], ...]`, the prints of the bar at or
123
+ * above the acquisition's `min_size`, history from TRADE_LARGE sorted by
124
+ * offset, live prints folded in arrival order by `live-trades-merge.util.ts`)
125
+ * become the ABI's `[offsetMs, price, size, side]` 4-tuples through the
126
+ * shared host's cell adapter, side +1 for a buy and -1 for a sell, in the
127
+ * row's own order, the plan's floor kept (the host plans the tape ask with
128
+ * `min_size` resolved from the run's settings, `sources.settings`, the floor
129
+ * the lane's acquisition was asked at). A primary bar with no row (before the
130
+ * served history, a quiet bar, a live-edge tape) is a PRESENT EMPTY block; a
131
+ * bar over the input's `max_cells` refuses by name where the rows are packed
132
+ * (`wrun_cell_block_too_large`, never truncated). The facets (`min_size`,
133
+ * `history`) are resolved and refused before any fetch by
134
+ * `wrun-tape-source.util.ts`, in the browser's own words.
135
+ * - `odds` (Polymarket): a pinned candle leg on the synthesized market
136
+ * `{ exchange: 'POLYMARKET', symbol: <condition id, lower-cased> }`, the
137
+ * rows the run pass fetches through the chart's K_OHLCV lane (gapfilled,
138
+ * polled live; `leg.odds` tells it apart), whose close IS the YES
139
+ * probability, 0..1, never scaled. Without an interval (or with the
140
+ * chart's own) it is a GRID leg exact-joined onto the chart grid under
141
+ * the missing policy; a coarser whole-multiple interval is a PERIOD leg
142
+ * with the `confirmed` and `is_new_period` views only. The field defaults
143
+ * to close; `outcome: 'NO'` (close only) reads `1 - close` for observed
144
+ * and carried values, a `nan` or `zero` fill staying as filled. A grid
145
+ * leg may carry ONE seed row before the first chart row (the market's
146
+ * last observation before the window, prepended by the run pass for a
147
+ * thin market): it seeds the carry of a wire that holds nothing yet, never
148
+ * overrides a `nan` / `zero` fill, and never resets a carried value when a
149
+ * live reconcile re-asks the leg without it. YES and
150
+ * NO inputs on one market share one leg. The odds input may be the
151
+ * PRIMARY (index 0), as in every kit starter: the row axis stays the
152
+ * chart's own candles either way (the hosted lane's "odds primary filled
153
+ * onto the chart grid"). Refused by name before any fetch, each with its
154
+ * stable code: the kit template's placeholder id
155
+ * (`wrun_odds_placeholder_market`), a `binding` or no `symbol`
156
+ * (`wrun_odds_binding_unsupported`: the chart has no market picker yet),
157
+ * an `exchange` (`wrun_odds_exchange_implicit`), a symbol that is not a
158
+ * condition id (`wrun_odds_symbol`), an outcome other than YES | NO or NO
159
+ * off close (`wrun_odds_outcome`), a `forming` view
160
+ * (`wrun_odds_forming_unsupported`), a chart interval under a minute
161
+ * (`wrun_odds_chart_1s`: prediction venues are blocked on seconds).
162
+ * - every class of the POLL-LANE REGISTRY (`sources/registry.ts`: one
163
+ * descriptor file per source, discovered by glob, none listed here): a
164
+ * scalar read off the lane instance the run pass planned the input into
165
+ * (`pollLanes`, `pollLaneRows`), by the lane's own join. A `bar` join
166
+ * exact-joins the bar under the missing policy like every scalar lane; a
167
+ * daily join lands day rows by the daily-lane rules (wrun-daily-lane.util:
168
+ * `sum` or `last`, needs the clock). The static plan
169
+ * (`planWrunPollLaneInputs`) refuses a celled input and a field no lane
170
+ * serves by name before any row. A `series` input (a published feed, the
171
+ * `series` lane) is planned as the kit's own series wire, so the shared
172
+ * host serves it only under the run's feed capability and seeds a carry
173
+ * from the lane's bar before the window (align rule e).
174
+ * - every class of the ROW-LANE REGISTRY (`sources/row-lane-registry.ts`:
175
+ * one celled descriptor per class, discovered by glob, none listed here):
176
+ * each input's blocks read off the instance the run pass planned it into
177
+ * (`rowLanes`, `rowLaneRows`: host-bar rows `[barOpen, ...tuples]` the run
178
+ * landed on the chart's grid), the lane's exact tuples through its
179
+ * per-input projection, exact-joined on the chart's bars (a bar with no
180
+ * row a PRESENT EMPTY block); a `latest` lane's newest row is the LIVE
181
+ * row's block, every other row an empty one (the options chain's rule).
182
+ * The shared host plans such an input as a celled stand-in and the browser
183
+ * answers it (`WRUN_ROWS_CELL_LANE_STAND_IN`): the class and its width ride
184
+ * the descriptor, so a lane serves before the kit names its class.
185
+ *
186
+ * Any other class refuses by name (fail closed), matching the daemon's
187
+ * serving-gate behavior for unserved classes.
188
+ *
189
+ * Scalar missingness honors the declared `missing` policy: absent = 'carry'
190
+ * (the latest eligible value forward-fills; until every carry input has a
191
+ * first value the row abstains, absent from the rows), 'nan' delivers NaN,
192
+ * 'zero' delivers 0 on bars that bring no observation of their own, the
193
+ * leading ones included. A nan or zero PRIMARY of a candle class (ohlcv,
194
+ * odds) walks the chart's candles on every chart, as a carry primary does:
195
+ * a candle bucket with no trade is no bar (the chart draws none, the tab's
196
+ * kScript lane serves a candle-only script none, and a NaN bar there holds
197
+ * a recursive output at NaN from the first hole on: the RSI twin on KRAKEN
198
+ * XRP/USD 1d, 2026-10-15). A nan or zero primary of any other class rides
199
+ * the host's dense grid: one row per bar open at the chart's phase from the
200
+ * first chart row through the last, a tradeless bar included; on a venue
201
+ * whose chart gives empty time no row (its gap policy is `never`: the CME
202
+ * family's daily break and weekends, a US listing's nights, forex weekends),
203
+ * a calendar chart or a daily-landed lane it walks the chart's rows instead,
204
+ * the rows the kScript lane reads (`wrunNeedsChartPrimary`). A package that
205
+ * reads another lane on the chart's timeline also runs each interior missing
206
+ * bar of the chart (a tradeless bucket between two candles) as a row, as the
207
+ * tab's kScript lane runs it for a script with another source
208
+ * (`wrunPrimaryRows`).
209
+ *
210
+ * Pinned inputs (the G4 multi-timeframe contract, round 3: the full
211
+ * version). An `ohlcv` input pinning an interval COARSER than the chart's,
212
+ * on the chart's own market or on ANOTHER market (`symbol` / `exchange`,
213
+ * any market the chart lane can fetch), is served off its own PERIOD leg:
214
+ * the candles fetched at that interval for the leg market and handed in as
215
+ * `pinnedCandleRows[fetchKey]` (`planWrunPinnedLegs` names the legs;
216
+ * `wrunPinnedLegFetchKey` is market + interval, the backend's
217
+ * `wrunFetchKey`). Four views, all derived HERE at alignment time, never
218
+ * by the module (`WrunInputSource.view`):
219
+ * - `confirmed` (absent = this): the latest leg candle `c` with
220
+ * `c.ts + L <= min(now, ts + P)` (P the chart span, L the leg span, `now`
221
+ * the evaluation clock), carried forward under the missing policy, NaN
222
+ * before the first one; the as-of close rule the backend, the daemon and
223
+ * the alerts engine apply. Gates readiness like any scalar.
224
+ * - `forming`: the running aggregate of the row's own leg bucket (a WEEK
225
+ * bucket is the Monday-anchored week, `findMonday`, the main path's
226
+ * rule; every other span is `floor(ts / L) * L`) up to and including the
227
+ * row (open = the first open, high = max, low = min, close = the latest
228
+ * close, volume = sum, time = the bucket open in ms); the declared field
229
+ * picks the component. An own-market leg folds the PRIMARY rows; a
230
+ * foreign leg folds the leg market's rows at the CHART interval, its GRID
231
+ * leg (a second fetch key `<market>|<chartInterval>`, the forming candle
232
+ * kept, tick-merged from that market's candle feed). Never gates
233
+ * readiness (no missing policy).
234
+ * - `is_new_period`: 1.0 on a DELIVERED row whose held confirmed candle
235
+ * differs from the candle held on the previously delivered row (the first
236
+ * delivered row reads 1 when any candle is held), else 0.0; 0 on the live
237
+ * forming row until it closes. A delivered row is one no carry-policy
238
+ * scalar input withholds by its leading gap (the hosts' readiness
239
+ * abstention: an abstained row is absent from the rows). On a pin
240
+ * EQUAL to the chart's interval every chart bar is a new period of its
241
+ * own interval: the view reads 1 on every row, no leg (`own_period`).
242
+ * - `offset` N: the candle the confirmed cursor held N candles before its
243
+ * current one (the leg history paragraph below); never gates readiness.
244
+ * A foreign `ohlcv` pin WITHOUT an interval (or with the chart's own) is a
245
+ * grid leg read row for row: the leg market's rows at the chart interval,
246
+ * exact-joined by timestamp under the missing policy (the forming row reads
247
+ * that market's forming candle), no view.
248
+ *
249
+ * Typed-feed interval pins (own market, the served typed classes
250
+ * `funding.rate_close` and the `oi` fields) bucket the lane's own rows by
251
+ * the clock, no extra fetch. An observation is a row with a finite
252
+ * component: a row without one is a gap fill, which the om daemon drops
253
+ * before any fold. A bucket's value: `funding` reads the LAST observation
254
+ * inside it (rate_close); `oi` folds PER COMPONENT like an ohlcv forming
255
+ * bucket (open = the first real observation's open, high = max high, low =
256
+ * min low, close = the last close; a NaN component is skipped).
257
+ * `confirmed` = the value of the HELD bucket: the latest
258
+ * bucket closed by the row's bound (bucket end <= min(now, ts + P), the
259
+ * ONE as-of row-close rule ohlcv legs use), the value carried across the
260
+ * rows that hold it, a held EMPTY bucket reading the missing policy
261
+ * (`carry` forward-fills the previous bucket's value, `nan` reads NaN,
262
+ * `zero` reads 0), NaN before the first held bucket; `forming` = the
263
+ * bucket value of the row's own bucket over the observations up to and
264
+ * including the row, NaN when none yet; `is_new_period` = 1 on the
265
+ * delivered row whose held bucket differs from the previous delivered
266
+ * row's (a bucket close fires it with or without an observation). A bucket
267
+ * that opened before the loaded window's head is partial and never held
268
+ * (the never-partial rule).
269
+ *
270
+ * Intrabar cells (`intrabar`, the fifth celled class on the wrun-2 cell
271
+ * channel; the chart's own market or one pinned with `symbol` AND `exchange`,
272
+ * finer bars folded as cells onto each chart row): `inputSources.m1 = { source:
273
+ * "intrabar", interval: "MINUTE" }` on a celled input `{ cellType: "array",
274
+ * max_cells: 60 }`. The leg is fetched at `L` over the chart window
275
+ * (`intrabarRows[fetchKey]`, `wrunIntrabarLegFetchKey`, keyed by market) and
276
+ * each row's block is the shared host's leg core slice (`WrunIntrabarSlicer`): every
277
+ * CLOSED leg candle `c` with `ts <= c.ts < ts + P`, ascending, as `[offset_ms,
278
+ * open, high, low, close, volume]` tuples, `offset_ms` = the candle's open minus
279
+ * the row's open (kScript's ltf(): each candle in the row holding its open, so a
280
+ * leg the grid does not divide straddles rows and an equal or coarser leg brings
281
+ * at most one candle to a row); a covered row with no candle is a PRESENT EMPTY
282
+ * block, a row the leg's coverage does not reach a MISSING block (no entry),
283
+ * never a partial one; never truncated (over `max_cells` the pack layer refuses,
284
+ * `wrun_cell_block_too_large`). The shape refusals fire first (a knob the class
285
+ * does not take, a scalar input, index 0 `wrun_intrabar_primary`, no interval
286
+ * `wrun_intrabar_interval_required`, one half of a market pin), then the leg
287
+ * core's plan-time check (`wrunCelledLegCheck`, the om words): a span off the
288
+ * vocabulary (`wrun_intrabar_leg_off_grid`), `max_cells` below the most candles
289
+ * a row holds (`wrun_intrabar_ratio_over_cap`). No chart refuses a leg for its
290
+ * span against the chart's: kScript declares ltf() statically and refuses only a
291
+ * read, which its originals guard by the chart interval. Readiness never gates
292
+ * (the celled rule); the scalar slot reads NaN.
293
+ *
294
+ * Leg history (WRUN-TIMEFRAMES, the shared host's leg core):
295
+ * view `offset` reads the candle the confirmed cursor held N candles back
296
+ * (`WrunOffsetRing`, a typed feed's closed buckets with an observation); the
297
+ * `candles` class streams a leg's closed candles (`WrunCandleStream`: the
298
+ * backlog on the first delivered row, then the candles admitted since, an
299
+ * undelivered row an empty block that hands its candles on, a leg without a
300
+ * closed candle a missing block), each row admitting by its own close (a
301
+ * month, quarter or year row's calendar end, never the chart's average span),
302
+ * on a leg of its own at the chart's interval (never the market's grid leg);
303
+ * a `candles` input read with view "forming" carries the leg's LIVE candle
304
+ * instead (`WrunLiveCandle`: one tuple on the row whose bar holds now, the
305
+ * venue's running candle as the leg's own fetch served it, an empty block on
306
+ * every other row, a missing block when the fetch holds no readable row),
307
+ * read from the stream's own leg fetch and never beside `bars`; one read with
308
+ * view "forming_open" carries, on EVERY row, the open of the leg candle holding
309
+ * it (`WrunFormingOpen`: one tuple [offset, open, NaN, NaN, NaN, NaN] off the
310
+ * same fetch's closed and live candles, the live candle's rows included, an
311
+ * empty block on a row no candle holds), never beside `bars` either;
312
+ * `bars` deepens a leg's fetch (the run pass); an own-market `forming` view
313
+ * folds its head bucket whole from `formingPreRoll`. The carry keeps the rings
314
+ * and each stream's resume point, so the tail build resumes them exactly
315
+ * (docs/features/kscript/wrun/wrun-browser-runtime.md, "Leg history").
316
+ *
317
+ * The builders take a `clock: { intervalMs, nowMs }` whenever a leg or a
318
+ * typed pin exists and refuse to guess without one (an open-stamped coarse
319
+ * leg is exactly the lookahead leak the clock prevents). Refused by name
320
+ * before any fetch: a market pin on anything but a secondary `ohlcv` input
321
+ * (typed feeds, cells and `time` follow the chart's own market; the primary
322
+ * input follows the chart's market; an `odds` input is the exception, it
323
+ * pins its own Polymarket market, primary included), a finer pin, a leg that is not a whole
324
+ * multiple of the chart interval (7 days for WEEK), a pin on a celled,
325
+ * `time`, trades, liquidations, implied_volatility or skew input, an
326
+ * interval pin on the primary input (index 0), an interval the vocabulary
327
+ * does not know, a view without a coarser pin, a `forming` view above WEEK,
328
+ * a `forming` view whose primary input is bindable, pinned to another
329
+ * market or not an ohlcv feed. An own-market interval pin EQUAL to the
330
+ * chart's is a no-op (the chart's own rows, as before).
331
+ *
332
+ * Contract A rules every host shares: the confirmed cursor advances on
333
+ * EVERY primary row, before any input is read, and `is_new_period` compares
334
+ * the held candle between DELIVERED rows only, so no input order can move
335
+ * the period-change signal and a late-observed carry input moves it to the
336
+ * first delivered row; the forming fold tracks validity PER COMPONENT (a
337
+ * NaN in one ohlcv column never discards the others); a bucket is never
338
+ * shipped partial: a row whose bucket the fold source's first row does not
339
+ * reach from its first primary slot (an own-market fold's pre-roll rows when
340
+ * the run pass fetched them, else the first loaded row) folds to NaN (except
341
+ * `time`, the bucket open itself) until a pan-back loads the rest, and the
342
+ * tail build gives the same answer.
343
+ */
344
+ import { type WrunPinnedInterval } from './wrun-pinned-interval.util.js';
345
+ import { type WrunBarVenue } from '../chart/wrun-bar-session-facts.util.js';
346
+ import type { WrunIndicatorMetadata, WrunInputSource, WrunInputView, WrunMetadataParam } from '../../interfaces/wrun-runtime.interface.js';
347
+ import type { WrunInputCarry as WrunHostInputCarry, WrunLegRowBounds } from '@orangecharts/indicator-kit/host';
348
+ import type { WrunPollLaneInstance } from './sources/wrun-poll-lane.types.js';
349
+ import type { WrunRowLaneInstance } from './sources/wrun-row-lane.types.js';
350
+ import { type WrunSourceBlendField } from './wrun-market-facts.util.js';
351
+ import type { WrunInputRow } from './wrun-pack.util.js';
352
+ import { type WrunLegStreamLane } from './wrun-leg-stream-classes.js';
353
+ /** True for the derived ohlcv fields, the blends hl2 / hlc3 / ohlc4 / hlcc4
354
+ * (the `param.source` menu's words no candle stores, WRUN-GAPS-1005): any
355
+ * ohlcv input may read one, as its declared field, a source default or a
356
+ * pick. Every host derives it from the candle it serves the input. */
357
+ export declare function isWrunDerivedOhlcvField(field: unknown): field is WrunSourceBlendField;
358
+ /**
359
+ * The chart's candle rows as the wrun lane's PRIMARY grid: `metadata[0].rawData`
360
+ * minus the chart's own marker rows (2026-09-30), with the interior ones
361
+ * recorded as missing bars (2026-10-05).
362
+ *
363
+ * On a gap-detecting market (crypto) the main series holds one client-made
364
+ * marker row per bucket that never traded (titan `insertSyntheticGaps` and
365
+ * the live-tick bridge: `[ts, NaN, NaN, NaN, NaN]`, flagged in the
366
+ * index-aligned `syntheticFlags`) so the time axis stays uniform. A marker is
367
+ * dropped by its flag, or by a non-finite close when it arrived without one;
368
+ * a chart without markers (dense, or a session-bound venue whose grid is
369
+ * sparse by nature) returns its rows untouched. Every read of the chart's
370
+ * candles in the lane (the full run, the reseed, the tick plan and its
371
+ * evaluated tail) goes through here, so the session and the plan see one set
372
+ * of traded candles.
373
+ *
374
+ * Whether a package computes over the gaps follows from its declared inputs,
375
+ * not the caller: one that reads another lane on the chart's timeline gets a
376
+ * row at each recorded gap, as the tab's kScript lane keeps the markers for a
377
+ * script with another source; a candle-only one gets the traded candles
378
+ * alone whatever its primary's missing policy, as the tab serves a
379
+ * candle-only script (`wrunPrimaryRows`): a nan or zero candle primary never
380
+ * rides the shared host's dense grid, which would lay a NaN bar at every gap
381
+ * (`wrunNeedsChartPrimary`). Markers before the first traded candle or after
382
+ * the forming one are not gaps.
383
+ */
384
+ export declare function wrunChartCandleRows(tc: {
385
+ metadata?: ReadonlyArray<{
386
+ rawData?: unknown;
387
+ syntheticFlags?: ArrayLike<number> | null;
388
+ }>;
389
+ } | null | undefined): number[][];
390
+ /**
391
+ * Why `rows` are not the chart's candles at `intervalMs`, or null when they are. An interval switch
392
+ * replaces the main series in steps (the cached paint, then the resident commit), so a run planned
393
+ * between them reads the previous interval's bars under the new interval: it then asks its warm-up
394
+ * on the new clock over the old bars, and the host refuses the mixed phases it is handed
395
+ * (`wrun_densify_mixed_phase`, "Could not draw" over the stand-in; the 2026-10-15 tap-storm rig,
396
+ * three of four 300 ms storms, Ichimoku Cloud and EMA). The full run asks this before it plans and
397
+ * waits for the next chart trigger instead (`WrunNoBarsError`), as for no rows at all.
398
+ *
399
+ * Judged on the newest rows alone (a chart holds one interval at a time):
400
+ * - `mixed-phase`: the rows open on three or more phases of the interval (4h bars on a 1d chart
401
+ * open on six); a DST shift moves a session-bound venue's bars by one phase, never two;
402
+ * - `coarser`: every spacing between the newest rows is at least two and a half intervals (1d
403
+ * bars on a 4h chart); a session-bound venue's overnight or weekend gap is one spacing among
404
+ * several, never all of them.
405
+ * A calendar interval (1M, 3M, 6M, 1Y) opens on the 1st of a month at no fixed phase, a non-time
406
+ * interval has no grid, and a chart of fewer rows than the check reads (a new listing, a spec's
407
+ * three-row chart) leaves nothing to judge: all pass.
408
+ */
409
+ export declare function wrunChartRowsOffIntervalGrid(rows: ReadonlyArray<ArrayLike<number>>, intervalMs: number): 'mixed-phase' | 'coarser' | null;
410
+ /**
411
+ * The rows of a `wrunChartCandleRows` array from `fromMs` through `toMs`, with its recorded
412
+ * missing bars strictly between the first and the last row kept: a clamped run window (the full
413
+ * run's and the reseed's, wrun-overlay-run.util) computes over its slice of the chart's candles
414
+ * and runs the gaps inside it as a run over the whole chart does. A plain `filter` would drop
415
+ * them, since the gaps ride the identity of the array.
416
+ */
417
+ export declare function wrunChartCandleRowsWithin(rows: number[][], fromMs: number, toMs?: number): number[][];
418
+ /**
419
+ * Candles stamped before a `wrunChartCandleRows` array's first row (a replay window's head,
420
+ * fetched on the K_OHLCV lane) joined ahead of it, with its recorded missing bars kept: they sit
421
+ * strictly between two of its rows, so they stay interior to the joined rows. A spread would
422
+ * drop them, since the gaps ride the identity of the array. No head returns the rows themselves.
423
+ */
424
+ export declare function wrunChartCandleRowsAfterHead<Row extends ArrayLike<number>>(head: ReadonlyArray<Row>, rows: Row[]): Row[];
425
+ /** The missing bars a `wrunChartCandleRows` array recorded strictly between its rows (ascending opens), read by the
426
+ * run budget's walk (wrun-run-retained.util); none for rows without markers. */
427
+ export declare function wrunChartGapBarsOf(rows: ReadonlyArray<ArrayLike<number>>): readonly number[];
428
+ /** The source class an input demands a lane for: its own, or none for an input the run's sheet on
429
+ * the chart's market left undemanded (wrunSheetWithLaneDemand: its needed_by leaves the market out). */
430
+ export declare function wrunDemandedSourceClass(source: Pick<WrunInputSource, 'source' | 'undemanded'> | undefined): string | undefined;
431
+ /**
432
+ * The row builder's lane an input reads: its source class, except a `trades`
433
+ * input, which reads the trades lane of its quote (wrun-trades-lane.util,
434
+ * C1.4): the dollar lane `trades_usd` (rows `buySellVolumeUsdRows`) for
435
+ * `currency: "USD"`, the coin lane `trades` (the chart's own buy/sell lane)
436
+ * otherwise, and a trades input pinned to one whole market its quote's leg lane
437
+ * there (kit 0.77.0, `trades@BYBIT|BTCUSDT`); none for an undemanded input
438
+ * (wrunDemandedSourceClass) or a half pin (refused by name). The one rule the
439
+ * full run's lane fetches, the live intake and the reconcile share.
440
+ */
441
+ export declare function wrunSourceLane(source: Pick<WrunInputSource, 'source' | 'currency' | 'undemanded' | 'symbol' | 'exchange' | 'follow'> | undefined): string | undefined;
442
+ /** Every lane a sheet's inputs read (wrunSourceLane), declaration order kept. */
443
+ export declare function wrunDeclaredSourceLanes(metadata: Pick<WrunIndicatorMetadata, 'inputs' | 'inputSources'>): Set<string>;
444
+ export interface WrunChartSourceRows {
445
+ /** Primary candle rows, ms timestamps: [ts, open, high, low, close, volume]. */
446
+ ohlcvRows: ReadonlyArray<ArrayLike<number>>;
447
+ /** kScript orderbook lane rows (see module doc); optional when no book
448
+ * input is declared. */
449
+ bookRows?: ReadonlyArray<ArrayLike<number>>;
450
+ /** kScript buy_sell_volume lane rows [ts, buy, sell]; optional when no
451
+ * `trades` input is declared. In coins: the lane every trades input
452
+ * reads unless it asks `currency: "USD"`. */
453
+ buySellVolumeRows?: ReadonlyArray<ArrayLike<number>>;
454
+ /** The same lane asked in dollars (the payload's `currency: "USD"`, the
455
+ * kScript source `buy_sell_volume(..., currency="USD")`), [ts, buy, sell]:
456
+ * read by the trades inputs that ask `currency: "USD"` (wrunSourceLane
457
+ * `trades_usd`); optional when none does. */
458
+ buySellVolumeUsdRows?: ReadonlyArray<ArrayLike<number>>;
459
+ /** The trades leg lanes (kit 0.77.0) by leg lane id, [ts, buy, sell] on the leg's market; a leg
460
+ * never asked holds none (its inputs read their fill). */
461
+ tradeLegRows?: Readonly<Record<string, ReadonlyArray<ArrayLike<number>>>>;
462
+ /** kScript open_interest lane rows [ts, open, high, low, close]; optional
463
+ * when no `oi` input is declared. */
464
+ openInterestRows?: ReadonlyArray<ArrayLike<number>>;
465
+ /** kScript K_VOLUME_PROFILE lane rows [ts, [lo, hi, buy, sell], ...]
466
+ * (array-celled, see module doc); optional when no `volume_profile`
467
+ * input is declared. */
468
+ volumeProfileRows?: ReadonlyArray<ReadonlyArray<unknown>>;
469
+ /** K_TRADE_VOLUME_BY_SIZE lane rows [ts, [bucketId, buyVolUsd, sellVolUsd,
470
+ * buyCount, sellCount], ...] (array-celled, dense per bar, see module
471
+ * doc); optional when no `trade_volume_by_size` input is declared. */
472
+ tradeVolumeBySizeRows?: ReadonlyArray<ReadonlyArray<unknown>>;
473
+ /** K_TRADES large-lane rows [barTs, [offsetMs, price, size, side], ...] (array-celled, see
474
+ * module doc); optional when no `tape` input is declared. An empty array is a live-edge tape
475
+ * (history "0"): every bar reads a present empty block until the live fold adds its prints. */
476
+ tapeRows?: ReadonlyArray<ReadonlyArray<unknown>>;
477
+ /** The run's settings by param name: the plan reads the params a tape input's `min_size` names,
478
+ * so its tape ask carries the floor the lane was asked at (`wrunTapeFloorSettings`: the full
479
+ * run's acquisition floor, or a live build's session floor). Absent: every such param at its
480
+ * declared default. */
481
+ settings?: Readonly<Record<string, unknown>>;
482
+ /** K_OPTIONS_CHAIN lane rows [stampTs, [10-tuple], ...] (see module doc);
483
+ * optional when no `options_chain` input is declared. */
484
+ optionsChainRows?: ReadonlyArray<ReadonlyArray<unknown>>;
485
+ /** kScript K_LIQUIDATIONS lane rows [ts, buyLiquidations,
486
+ * sellLiquidations]; optional when no `liquidations` input is declared. */
487
+ liquidationRows?: ReadonlyArray<ArrayLike<number>>;
488
+ /** kScript K_FUNDING_RATE lane rows [ts, ratePercent]; optional when no
489
+ * `funding` input is declared. */
490
+ fundingRateRows?: ReadonlyArray<ArrayLike<number>>;
491
+ /** K_DERIBIT_IMPLIED_VOLATILITY lane rows [ts, ...one column per distinct
492
+ * declared tenor, in declaration order] (`planWrunOptionSummaryLane`);
493
+ * optional when no `implied_volatility` input is declared. */
494
+ impliedVolatilityRows?: ReadonlyArray<ArrayLike<number>>;
495
+ /** K_SKEW lane rows [ts, ...one column per distinct declared (delta,
496
+ * tenor) pair, in declaration order] (the same plan, the per-delta asks
497
+ * zipped by timestamp); optional when no `skew` input is declared. */
498
+ skewRows?: ReadonlyArray<ArrayLike<number>>;
499
+ /** The etf_flow lane rows [dayTs, ...one column per declared fund word]
500
+ * (`zipWrunEtfFlowRows`, day-stamped at 00:00 UTC, USD); optional when no
501
+ * `etf_flow` input is declared. */
502
+ etfFlowRows?: ReadonlyArray<ArrayLike<number>>;
503
+ /** The registry poll lanes (`sources/`): the lane instances the run pass
504
+ * planned (which inputs read which instance) and each instance's rows,
505
+ * keyed by the instance key, ascending by ts (`[ts, ...columns]` at the
506
+ * chart's bar opens for a `bar` join, one row per UTC day for a daily
507
+ * one). Optional when no input reads a registry class; an input the
508
+ * caller planned no instance for reads an empty lane. */
509
+ pollLanes?: ReadonlyArray<WrunPollLaneInstance>;
510
+ pollLaneRows?: Readonly<Record<string, ReadonlyArray<ArrayLike<number>>>>;
511
+ /** The row lanes (`sources/row-lane-registry.ts`): the instances the run
512
+ * pass planned (which celled inputs read which instance) and each
513
+ * instance's host-bar rows `[barOpen, tuple, tuple, ...]`, ascending, keyed
514
+ * by the instance key. Optional when no input reads a row-lane class; an
515
+ * input the caller planned no instance for reads an empty lane. */
516
+ rowLanes?: ReadonlyArray<WrunRowLaneInstance>;
517
+ rowLaneRows?: Readonly<Record<string, ReadonlyArray<ReadonlyArray<unknown>>>>;
518
+ /** Pinned legs: the candle rows [ts, o, h, l, c, v] (ms) fetched for the
519
+ * leg market, ascending, keyed by `wrunPinnedLegFetchKey` (market +
520
+ * interval; a `candles` leg at the chart's interval by
521
+ * `wrunCandlesLegFetchKey`); optional when no input pins a leg. A PERIOD leg (the leg's
522
+ * own interval) holds CLOSED candles only: a candle still forming at
523
+ * fetch time never enters its rows (the run pass drops it). A GRID leg
524
+ * (a foreign market at the CHART interval, `kind: 'grid'`) keeps its
525
+ * forming candle: it is the fold source of a foreign `forming` view and
526
+ * the exact-join source of an equal-interval foreign pin. An odds grid
527
+ * leg (`odds: true`) may hold ONE seed row stamped before the first
528
+ * chart row, the market's last observation before the window; it seeds
529
+ * the carry of the leg's wires and is never joined as a chart row. */
530
+ pinnedCandleRows?: Readonly<Record<string, ReadonlyArray<ArrayLike<number>>>>;
531
+ /** The candles a PERIOD leg's fetch answered that had not closed by the
532
+ * fetch's clock (the venue's running candle; a tiled fetch may repeat its
533
+ * open, the later row the newer), in the fetch's order, keyed like
534
+ * `pinnedCandleRows`: the rows that buffer never holds, kept for a
535
+ * `candles` input read with view "forming" (`WrunLiveCandle` reads them
536
+ * beside the leg's newest closed candle) or "forming_open"
537
+ * (`WrunFormingOpen` reads them beside every closed candle: the running
538
+ * candle's open holds its rows). Present only for a leg such an input
539
+ * reads; replaced whole by every answer of the leg's fetch. */
540
+ pinnedLiveCandleRows?: Readonly<Record<string, ReadonlyArray<ArrayLike<number>>>>;
541
+ /** Intrabar legs: the finer candle rows [ts, o, h, l, c, v] (ms) fetched
542
+ * at the leg's interval for the chart's market over the chart window,
543
+ * ascending, keyed by `wrunIntrabarLegFetchKey`; CLOSED finer bars only
544
+ * (the run pass and the reconcile drop the forming one). */
545
+ intrabarRows?: Readonly<Record<string, ReadonlyArray<ArrayLike<number>>>>;
546
+ /** The chart's session (`wrunChartSession`, wrun-leg-close.util): the market the shared host's
547
+ * session calendar answers the run's clock for (`wrunSessionClock` over the run's plan, the rule
548
+ * the cloud's clock runs too). From it the aligner takes the bounds of the chart's own CME
549
+ * session rows (a daily row labelled by its trade date opens at the 17:00 Chicago open the
550
+ * evening before and closes at the next), the candle closes of every leg whose venue closes a
551
+ * bar off its open plus the span (the CME lattice's, a 3d group closing at the next group's
552
+ * 17:00 Chicago open; a US listing's with its session on a regular-session chart) and the opens
553
+ * of the CME daily, 3d and weekly candles stamped at their trade date. Every reader of a row's
554
+ * bounds or a leg's candle takes them: the confirmed cursor (and so `is_new_period` and the
555
+ * offset ring), the carry's held candle, a typed leg's held bucket, a grid leg's readable bar,
556
+ * the `candles` stream, the live candle and the intrabar slicer. Absent, a row spans
557
+ * [label, label + P) and a candle trades from its stamp and closes at its open plus the span; a
558
+ * calendar row (1M 3M 6M 1Y) runs to its calendar end on every market either way
559
+ * (`wrunCalendarRowBounds`). */
560
+ session?: WrunChartSession;
561
+ /** The primary rows BEFORE the window's first row that an own-market `forming` view folds
562
+ * into the head's leg bucket (the om daemon's pre-roll: its primary fetch reaches back to
563
+ * the head bucket's start, `wrunLegFetchStart` reading "forming"), asked from `fromTs` at
564
+ * the primary interval: [ts, o, h, l, c, v] rows strictly before the first row, ascending,
565
+ * never shipped as rows. Absent when the run pass fetched none (no own-market forming view,
566
+ * a head on its bucket's open, an index-mode chart, a bucket opening behind the gateway's
567
+ * wall, a failed ask): the head bucket then folds from the loaded rows alone and reads NaN
568
+ * until a pan-back (the never-partial rule). */
569
+ formingPreRoll?: {
570
+ fromTs: number;
571
+ rows: ReadonlyArray<ArrayLike<number>>;
572
+ };
573
+ /** The chart's series (exchange, symbol and bar interval) the
574
+ * `time.trade_date` and `time.session` inputs read their facts for
575
+ * (contract C3, never the chart's RTH/extended mode); required when
576
+ * either is declared. */
577
+ venue?: WrunBarVenue;
578
+ }
579
+ /** The chart's market as the shared host's session calendar reads it (`WrunChartSourceRows.session`). */
580
+ export interface WrunChartSession {
581
+ /** The chart's exchange: the venue of its own rows and of every leg that names none. */
582
+ exchange?: string;
583
+ /** The session the chart fetches a US listing's candles on, always stated
584
+ * (`wrunChartSessionType`): 'extended' only while the chart runs its extended session. */
585
+ sessionType: 'regular' | 'extended';
586
+ }
587
+ /** A calendar row's bounds (1M 3M 6M 1Y, on every market): from its label to its calendar end
588
+ * (February 2026 from Feb 1 to Mar 1, never the average month's Mar 3 10:30); undefined at a fixed
589
+ * span. The chart's own row rule: the clock carries it to every reader of a row's bounds, the
590
+ * `candles` stream's included. */
591
+ export declare function wrunCalendarRowBounds(intervalMs: number): WrunLegRowBounds | undefined;
592
+ /** The evaluation clock the as-of alignment of a pinned leg needs: the
593
+ * chart's own bar span (a row's close is `ts + intervalMs`; on a month,
594
+ * quarter or year grid the span is an average and a row closes at its
595
+ * calendar end, `candleBarEndMs`, which the candles stream reads; a CME
596
+ * session row's bounds come from the sources' `session`) and the captured
597
+ * wall clock (the backend's `WrunAlignClock`). */
598
+ export interface WrunAlignClock {
599
+ intervalMs: number;
600
+ nowMs: number;
601
+ }
602
+ /** The typed-feed classes an own-market interval pin buckets by the clock
603
+ * (no extra fetch: the lane's own rows). */
604
+ export declare const WRUN_TYPED_PINNED_SOURCES: ReadonlySet<string>;
605
+ /** The intrabar cell tuple `[offset_ms, open, high, low, close, volume]`
606
+ * (f64 cells per finer bar): the shared host's `WRUN_HOST_CELL_TUPLE_WIDTHS.intrabar`,
607
+ * the width the packer packs (pinned by wrun-source-words.kit-mirror.spec.ts). */
608
+ export declare const WRUN_INTRABAR_TUPLE_WIDTH = 6;
609
+ /** The trade_volume_by_size cell tuple `[bucket, buy_usd, sell_usd,
610
+ * buy_count, sell_count]` (f64 cells per USD order-size bucket): the shared
611
+ * host's `WRUN_HOST_CELL_TUPLE_WIDTHS.trade_volume_by_size`, the width the packer
612
+ * packs (pinned by wrun-source-words.kit-mirror.spec.ts). */
613
+ export declare const WRUN_TRADE_VOLUME_BY_SIZE_TUPLE_WIDTH = 5;
614
+ /** Odds legs ride the Polymarket venue: the exchange is implicit on every
615
+ * host (an explicit one refuses) and the market is its condition id. */
616
+ export declare const WRUN_ODDS_EXCHANGE = "POLYMARKET";
617
+ /** An intrabar leg's fetch identity: the market (the chart's own through the
618
+ * fetch placeholders, or a pinned `symbol` + `exchange`) at the finer
619
+ * interval. */
620
+ export declare function wrunIntrabarLegFetchKey(intervalKey: string, market?: WrunPinnedMarket): string;
621
+ export { wrunPinnedIntervalOf, type WrunPinnedInterval } from './wrun-pinned-interval.util.js';
622
+ /** The chart's spelling of an interval span (an `Intervals.map_unit` key),
623
+ * else the span in ms with a unit (a spelling `dataFetch` ignores, so a
624
+ * grid leg's fetch falls back to the chart's own interval either way). */
625
+ export declare function wrunChartIntervalKeyOf(intervalMs: number): string;
626
+ /** A pinned leg's fetch identity: the market (the chart's own when
627
+ * unpinned, so the fetch payload's placeholders) and the leg interval, the
628
+ * backend's `wrunFetchKey(exchange, symbol, intervalLiteral)` shape. An
629
+ * odds leg ends in `|odds`: the same market at the same interval is a
630
+ * DIFFERENT buffer fetched as odds (gapfilled, seeded, poll-only) than as
631
+ * a plain candle leg, so the key decides the mode, never the order the
632
+ * inputs were declared in. */
633
+ export declare function wrunPinnedLegFetchKey(source: Pick<WrunInputSource, 'symbol' | 'exchange'>, intervalKey: string, odds?: boolean): string;
634
+ /** A pinned leg's market: the pinned symbol/exchange (either part may be
635
+ * absent: it resolves to the chart's own through the fetch placeholders). */
636
+ export interface WrunPinnedMarket {
637
+ symbol?: string;
638
+ exchange?: string;
639
+ }
640
+ /** One pinned leg: the candles one fetch serves to every input pinned to
641
+ * that market + interval. */
642
+ export interface WrunPinnedLeg {
643
+ fetchKey: string;
644
+ /** The chart's spelling of the leg interval (an `Intervals.map_unit` key). */
645
+ intervalKey: string;
646
+ legMs: number;
647
+ /** The inputs served off this leg, by index, ascending. */
648
+ inputIndexes: number[];
649
+ /** Absent = a PERIOD leg: CLOSED candles at the leg's own interval (the
650
+ * confirmed cursor and `is_new_period`). `'grid'`: a foreign market's
651
+ * rows at the CHART interval (the fold source of that market's `forming`
652
+ * views, the exact-join source of an equal-interval foreign pin), the
653
+ * forming candle kept, tick-merged from the market's candle feed.
654
+ * `'intrabar'`: the chart market's FINER candles (closed only) served as
655
+ * cells onto each chart row (`intrabarRows`, fetch-only, refreshed at
656
+ * every finer close). */
657
+ kind?: 'grid' | 'intrabar';
658
+ /** The leg market when pinned (a foreign leg); absent = the chart's own
659
+ * market (the fetch placeholders). */
660
+ market?: WrunPinnedMarket;
661
+ /** Grid legs only: the widest `forming` span the leg's rows fold into,
662
+ * so the run pass opens the fetch at that bucket's open (never a partial
663
+ * first bucket). Absent for an exact-join-only grid leg. */
664
+ foldSpanMs?: number;
665
+ /** Set on every leg an `odds` input plans (grid or period): `market` is
666
+ * `{ exchange: 'POLYMARKET', symbol: <condition id, lower-cased> }`, the
667
+ * rows' close is the YES probability, and `fetchKey` ends in `|odds`, so
668
+ * an ohlcv pin on the same market at the same interval is a separate leg
669
+ * whatever the declaration order. The run pass fetches such a leg
670
+ * through the K_OHLCV lane with gapfill and polls it live (no push
671
+ * admission); it reads `odds` and `market` alone. */
672
+ odds?: true;
673
+ /** Set on the leg of a lane stream input (`oi_candles`, `volume_profile_candles`): a PERIOD leg whose
674
+ * rows are its class's lane at the leg's interval (the open-interest candles `[ts, o, h, l, c]`, the
675
+ * volume-profile rows `[ts, [low, high, buy, sell], ...]`, ms), never the market's price candles. The
676
+ * class and the lane words its fetch carries (`currency`, `ticksPerBar`) ride the fetch key, so a
677
+ * candle leg and every distinct lane identity on the same market and interval is a leg of its own.
678
+ * Absent: a candle leg (the chart's candle lane). */
679
+ stream?: WrunLegStreamLane;
680
+ }
681
+ /** The fetch-key suffix a leg rides under a caller's prefix: the interval
682
+ * alone for an own-market period leg (the round-2 shape), the market
683
+ * appended for a foreign leg, `grid-` / `intrabar-` prefixed by kind,
684
+ * `-odds` appended for an odds leg (its own lane beside a plain candle
685
+ * leg on the same market). */
686
+ export declare function wrunPinnedLegFetchSuffix(leg: Pick<WrunPinnedLeg, 'intervalKey' | 'kind' | 'market' | 'odds' | 'stream'>): string;
687
+ /** A wire's projection of the raw observation: `no_complement` reads
688
+ * `1 - value`, the NO outcome of an odds leg (the hosted lane's per-wire
689
+ * transform). */
690
+ export type WrunWireTransform = 'no_complement';
691
+ /** One input served off a pin, by kind:
692
+ * - `period`: the confirmed, is_new_period or offset view of a candle leg
693
+ * (the period leg's cursor; `offset` reads the candle the cursor held
694
+ * that many candles before its current one, the shared host's
695
+ * `WrunOffsetRing`), an odds leg's confirmed and offset values projected
696
+ * by `transform`;
697
+ * - `forming`: the running aggregate of the row's leg bucket, folded from
698
+ * the primary rows (own market) or from the market's grid leg (foreign);
699
+ * - `grid`: an equal-interval foreign pin (an odds market always is one),
700
+ * the grid leg's row for the row's ts under the missing policy,
701
+ * projected by `transform`;
702
+ * - `typed`: an own-market typed feed (funding, oi) bucketed by the clock
703
+ * (`offset`: the closed bucket held that many buckets before the current
704
+ * one);
705
+ * - `candles`: a leg STREAM (wrun-leg-stream-classes: `candles`, `oi_candles`,
706
+ * `volume_profile_candles`), the leg's CLOSED candles as a cell stream (the
707
+ * shared host's leg stream, `WrunCandleStream`: the backlog on the first
708
+ * delivered row, then the candles admitted since), on a leg finer than,
709
+ * equal to or coarser than the chart, the chart's own market or a pinned
710
+ * one; a lane stream's leg carries `stream` (its class and lane words: the
711
+ * open-interest or volume-profile lane at the leg's interval). A `candles`
712
+ * input read with view "forming" (`forming`) carries the leg's live candle
713
+ * on the live row instead (the shared host's `WrunLiveCandle`); read with
714
+ * view "forming_open" (`formingOpen`), on every row the open of the leg
715
+ * candle holding it (the shared host's `WrunFormingOpen`); a lane stream
716
+ * takes no view;
717
+ * - `intrabar`: the finer candles inside each row as cells (the shared host's
718
+ * `WrunIntrabarSlicer`), the chart's own market or a pinned one;
719
+ * - `own_period`: an `is_new_period` view on a pin EQUAL to the chart's
720
+ * interval, on any class or market: every chart bar is a new period of
721
+ * its own interval, so the input reads 1 on every row (no leg, no
722
+ * cursor, no delivery gate). */
723
+ export type WrunPinnedWire = {
724
+ kind: 'own_period';
725
+ inputIndex: number;
726
+ source: WrunInputSource;
727
+ } | {
728
+ kind: 'period';
729
+ inputIndex: number;
730
+ source: WrunInputSource;
731
+ view: 'confirmed' | 'is_new_period' | 'offset';
732
+ /** View `offset` only: the leg candles back from the confirmed one (1..500). */
733
+ offset?: number;
734
+ column: number;
735
+ /** A blend field (hl2, hlc3, ohlc4, hlcc4): the blend of the leg candle; `column` is NaN. */
736
+ blend?: WrunSourceBlendField;
737
+ leg: WrunPinnedLeg;
738
+ transform?: WrunWireTransform;
739
+ } | {
740
+ kind: 'forming';
741
+ inputIndex: number;
742
+ source: WrunInputSource;
743
+ field: string;
744
+ column: number;
745
+ /** A blend field: the blend of the bucket's folded candle (each of its open, high, low and
746
+ * close folded by its own rule); `column` is NaN. */
747
+ blend?: WrunSourceBlendField;
748
+ legMs: number;
749
+ leg: WrunPinnedLeg;
750
+ gridLeg?: WrunPinnedLeg;
751
+ } | {
752
+ kind: 'grid';
753
+ inputIndex: number;
754
+ source: WrunInputSource;
755
+ column: number;
756
+ /** A blend field: the blend of the grid row's candle; `column` is NaN. */
757
+ blend?: WrunSourceBlendField;
758
+ gridLeg: WrunPinnedLeg;
759
+ transform?: WrunWireTransform;
760
+ } | {
761
+ kind: 'intrabar';
762
+ inputIndex: number;
763
+ source: WrunInputSource;
764
+ leg: WrunPinnedLeg;
765
+ /** The plan-time check's answer (`wrunCelledLegCheck`): the most leg candles one row holds. */
766
+ minCells: number;
767
+ } | {
768
+ kind: 'candles';
769
+ inputIndex: number;
770
+ source: WrunInputSource;
771
+ leg: WrunPinnedLeg;
772
+ /** The sheet's `bars`: the backlog depth counted back from the leg bucket holding now. */
773
+ bars?: number;
774
+ /** View "forming": the input carries the leg's live candle on the live row (the shared host's
775
+ * `WrunLiveCandle`), never the stream of closed candles. */
776
+ forming?: true;
777
+ /** View "forming_open": the input carries, on every row, the open of the leg candle holding
778
+ * it (the shared host's `WrunFormingOpen`), never the stream of closed candles. */
779
+ formingOpen?: true;
780
+ /** The plan-time check's answer (`wrunCelledLegCheck`): the least max_cells a contiguous run needs. */
781
+ minCells: number;
782
+ } | {
783
+ kind: 'typed';
784
+ inputIndex: number;
785
+ source: WrunInputSource;
786
+ view: WrunInputView;
787
+ /** The declared field (the oi fold's component) and its lane column. */
788
+ field: string;
789
+ column: number;
790
+ lane: 'funding' | 'oi';
791
+ /** `typed|<class>|<interval>`: the held-bucket key (`heldTs`), never a fetch key. */
792
+ legKey: string;
793
+ legMs: number;
794
+ /** View `offset` only: the closed buckets back from the held one (1..500). */
795
+ offset?: number;
796
+ };
797
+ /**
798
+ * Classify every declared pin against the chart BEFORE any fetch: the legs
799
+ * a run must fetch (one per market + interval: period legs at the pinned
800
+ * interval, grid legs at the chart's for foreign markets), refusing by name
801
+ * every pin the browser lane cannot serve. Typed-feed pins plan no leg
802
+ * (they bucket the lane's own rows). `chartIntervalMs` is required whenever
803
+ * an input pins a market or an interval (nothing can be classified without
804
+ * it). Pure: the same call inside the row builders decides the wires.
805
+ */
806
+ export declare function planWrunPinnedLegs(metadata: WrunIndicatorMetadata, chartIntervalMs: number | undefined): WrunPinnedLeg[];
807
+ /** A `candles` leg's fetch identity. Coarser or finer than the chart it is the period leg's key on
808
+ * its market and interval, so a confirmed or offset view there shares its one fetch (closed
809
+ * candles either way). At the chart's own interval that key is the market's GRID leg (the
810
+ * forming candle kept, fed live, asked from the window's head), so the stream keys a leg of its
811
+ * own (`|candles`): neither role reads the other's fetch, whatever the declaration order. */
812
+ export declare function wrunCandlesLegFetchKey(market: WrunPinnedMarket | undefined, interval: WrunPinnedInterval, chartIntervalMs: number): string;
813
+ /** A lane stream leg's fetch identity (`oi_candles`, `volume_profile_candles`): the market's candle-leg key at the
814
+ * leg's interval, then the class and its lane words (`wrunLegStreamKeyWords`), so it is never a candle leg's key,
815
+ * at the chart's own interval included, and two inputs with the same class, market, interval and lane words share
816
+ * one fetch. */
817
+ export declare function wrunLaneStreamLegFetchKey(market: WrunPinnedMarket | undefined, interval: WrunPinnedInterval, lane: WrunLegStreamLane): string;
818
+ /** The legs a run must fetch AND the per-input wires the row builders read
819
+ * (`planWrunPinnedLegs` is the legs half); exported for specs. */
820
+ export declare function planWrunPinnedWires(metadata: WrunIndicatorMetadata, chartIntervalMs: number | undefined): {
821
+ legs: WrunPinnedLeg[];
822
+ wires: Map<number, WrunPinnedWire>;
823
+ };
824
+ /** A leg bucket's open: the Monday-anchored week for a WEEK leg (the main
825
+ * path's `findMonday`, never the epoch week), the calendar bar at a month,
826
+ * quarter, half-year or year length (the chart's own rows on a calendar
827
+ * chart: an epoch floor of the average month put March 10 at March 2 21:00,
828
+ * no row's open), `floor(ts / L) * L` for every other span. Exported for the
829
+ * run pass (a grid leg's fetch opens at the first row's fold bucket) and the
830
+ * live tick (the chart row a revised candle reaches). */
831
+ export declare function wrunFormingBucketStart(ts: number, legMs: number): number;
832
+ /** Whether this chart reads published feeds: the Feeds flag (LIVE-SERIES P4), the one switch
833
+ * behind the feed capability the run advertises (`wrunBrowserRunWireCaps`) and the `series` lane's
834
+ * plan. Read per build through the host (`user.isFeatureOn`), as the flag map lands after boot; with no
835
+ * flag store up (a spec, a worker) the read throws and it reads none. */
836
+ export declare function wrunBrowserReadsFeeds(): boolean;
837
+ /**
838
+ * The wire capabilities the browser run advertises to the shared host's planner (the chart-browser
839
+ * profile's `wireCaps`): the kit's feed capability (the host entry's `WRUN_FEED_HOST_CAP`, read off
840
+ * the loaded shared host like every host constant this file reads) while the Feeds flag is on
841
+ * (LIVE-SERIES P4: the chart then reads feeds, through the `series` poll lane), else none. Under it
842
+ * the chart profile serves the `series` class; without it the plan refuses a series input
843
+ * `wrun_source_unsupported`. Never the hosted run's caps: the socket's own
844
+ * (`wrunAdvertisedWireCaps`) leave it out, the cloud advertises its feed cap itself. The shared host
845
+ * must be loaded first (`wrunChartHostEnv().loadSharedHost()`) whenever the flag is on.
846
+ */
847
+ export declare function wrunBrowserRunWireCaps(): string[];
848
+ /**
849
+ * The state the aligner holds between builds (the shared host's `WrunInputCarry`): the newest row
850
+ * folded in, each carry input's newest finite value, each forming fold's bucket, each leg's
851
+ * admitted and held candle, the offset rings and each candles stream's resume point. The tail
852
+ * builder resumes from it; `advanceWrunInputCarry` moves it past closed rows to exactly the state
853
+ * the full build holds after them.
854
+ */
855
+ export type WrunInputCarry = WrunHostInputCarry;
856
+ /** The empty seed: the state before any row (a tail from it equals the full build). */
857
+ export declare function emptyWrunInputCarry(): WrunInputCarry;
858
+ /**
859
+ * Build the per-bar input rows for a package over the chart's source rows: the shared host's
860
+ * aligner (`alignWrunRows` under the chart-browser profile) over the browser's own rows
861
+ * (`wrunHostRunOf`). The row axis is the chart's candles; a row a carry input's leading gap
862
+ * abstains is absent (the program's decision 1). A nan or zero primary of a candle class walks the
863
+ * chart's candles on every chart: a bucket with no trade is no bar, and a dense NaN bar there
864
+ * would hold a recursive output at NaN from the first hole on, where the tab's kScript lane serves
865
+ * a candle-only script the traded candles alone. A nan or zero primary of any other class rides the
866
+ * dense grid at the chart's phase (the decision's dense primary grid), save on a calendar chart, a
867
+ * session venue or a daily-landed lane, where it walks the chart's own rows too
868
+ * (`wrunNeedsChartPrimary`). `clock` is required when any input pins a leg, a typed feed or a daily
869
+ * lane (the as-of alignment), and carries the chart's exact interval: a calendar chart is known by
870
+ * it.
871
+ */
872
+ export declare function buildWrunInputRows(metadata: WrunIndicatorMetadata, sources: WrunChartSourceRows, clock?: WrunAlignClock): WrunInputRow[];
873
+ /**
874
+ * The TAIL of the full build: the input rows for every primary bar at or after `fromTs`, resumed
875
+ * from `carrySeed` (the state after every bar strictly before `fromTs`, see
876
+ * `advanceWrunInputCarry`); equal, row for row, to `buildWrunInputRows(...).filter(row => row.ts
877
+ * >= fromTs)` (the host's `alignWrunTailRows`).
878
+ */
879
+ export declare function buildWrunInputTailRows(metadata: WrunIndicatorMetadata, sources: WrunChartSourceRows, fromTs: number, carrySeed: WrunInputCarry, clock?: WrunAlignClock): WrunInputRow[];
880
+ /**
881
+ * Advance a carry seed over CLOSED input rows (rows the session committed) to exactly the state the
882
+ * full build holds after them (the host's `advanceWrunCarry`: the aligner's own pass replayed
883
+ * through the last closed row over the same rows and clock; with no rows handed in, a plan that
884
+ * reads no leg advances from the rows' carry values alone). Returns a NEW carry; the seed is never
885
+ * mutated.
886
+ */
887
+ export declare function advanceWrunInputCarry(metadata: WrunIndicatorMetadata, seed: WrunInputCarry, closedRows: readonly WrunInputRow[], sources?: Partial<WrunChartSourceRows>, clock?: WrunAlignClock): WrunInputCarry;
888
+ /** init()'s positional argument block: declared param defaults overlaid with
889
+ * any user-provided values by param name (wrunParamValuesFromSettings reads
890
+ * them off the overlay's settings, a colour as its packed number). Every
891
+ * param keeps its declared position; an om style knob holds its slot as a 0
892
+ * placeholder and never reaches the module (the om runtime's own layout:
893
+ * `metadata.params.map((p) => resolvedParams[p.name] ?? 0)` over the
894
+ * non-style params), so its string default never becomes an argument.
895
+ * Each setting passes the param value rule the om daemon runs
896
+ * (the shared host's wrunParamValueRefusal: finite, within min and max, a
897
+ * whole number for an int, one of a choice's options; a declared step is
898
+ * only the stepper's increment, never a grid the value must sit on) or the
899
+ * run is refused by the setting's name before init(), where a kScript
900
+ * built-in refuses the same setting at input(). A host-filled slot holds the
901
+ * host's number and a text setting's its byte count, so neither is a setting
902
+ * the rule reads. */
903
+ export declare function buildWrunInitArgs(metadata: WrunIndicatorMetadata, overrides?: Readonly<Record<string, number>>): number[];
904
+ /**
905
+ * The run's param value rule as a test of saved settings by param name, the shared host loaded
906
+ * first: whether `params` refuse a setting's value the way buildWrunInitArgs refuses it before
907
+ * init(). A draft's carried value the rule refuses would refuse every run of the new build, so the
908
+ * mount drops it (wrun-draft-settings.util wrunCarriedSettingsPatch). Only a finite number is a
909
+ * run value the rule reads; a name no param holds is no param setting.
910
+ */
911
+ export declare function loadWrunParamRefusalTest(params: ReadonlyArray<WrunMetadataParam>): Promise<(name: string, value: unknown) => boolean>;