@orangecharts/wrun-chart-host 0.1.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 (337) hide show
  1. package/README.md +39 -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 +131 -0
  32. package/dist/index.js +131 -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/om-panel.util.js +6 -0
  117. package/dist/utility/chart/om-widget.util.d.ts +4 -0
  118. package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
  119. package/dist/utility/chart/opra-read-access.leaf.js +25 -0
  120. package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
  121. package/dist/utility/chart/prediction-identity.util.js +236 -0
  122. package/dist/utility/chart/rth-session.util.d.ts +352 -0
  123. package/dist/utility/chart/rth-session.util.js +926 -0
  124. package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
  125. package/dist/utility/chart/titan-constants.pin.js +50 -0
  126. package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
  127. package/dist/utility/chart/us-equities-session.util.js +251 -0
  128. package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +100 -0
  129. package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
  130. package/dist/utility/chart/wrun-run-result.util.js +10 -0
  131. package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
  132. package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
  133. package/dist/utility/common/safe-math-eval.d.ts +18 -0
  134. package/dist/utility/common/safe-math-eval.js +160 -0
  135. package/dist/utility/common/time.util.d.ts +134 -0
  136. package/dist/utility/common/time.util.js +428 -0
  137. package/dist/utility/common/transformations.util.d.ts +126 -0
  138. package/dist/utility/common/transformations.util.js +711 -0
  139. package/dist/utility/common/visible-timeout.util.d.ts +17 -0
  140. package/dist/utility/common/visible-timeout.util.js +75 -0
  141. package/dist/utility/exchange-normalization.util.d.ts +8 -0
  142. package/dist/utility/exchange-normalization.util.js +32 -0
  143. package/dist/utility/intl-locale.util.d.ts +2 -0
  144. package/dist/utility/intl-locale.util.js +28 -0
  145. package/dist/utility/number-format.util.d.ts +14 -1
  146. package/dist/utility/number-format.util.js +50 -19
  147. package/dist/utility/options/option-symbol.util.d.ts +28 -0
  148. package/dist/utility/options/option-symbol.util.js +176 -0
  149. package/dist/utility/options/option-trade-units.util.d.ts +190 -0
  150. package/dist/utility/options/option-trade-units.util.js +283 -0
  151. package/dist/utility/options/option-venue.util.d.ts +75 -0
  152. package/dist/utility/options/option-venue.util.js +85 -0
  153. package/dist/utility/pool-symbol.leaf.d.ts +34 -0
  154. package/dist/utility/pool-symbol.leaf.js +95 -0
  155. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
  156. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
  157. package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
  158. package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
  159. package/dist/utility/v2/gate-plane.util.d.ts +58 -0
  160. package/dist/utility/v2/gate-plane.util.js +99 -0
  161. package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
  162. package/dist/utility/v2/gate-session-latch.util.js +34 -0
  163. package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
  164. package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
  165. package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
  166. package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
  167. package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
  168. package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
  169. package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
  170. package/dist/utility/wrun/sources/lanes/economic.js +79 -0
  171. package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
  172. package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
  173. package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
  174. package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
  175. package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
  176. package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
  177. package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
  178. package/dist/utility/wrun/sources/lanes/index.js +32 -0
  179. package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
  180. package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
  181. package/dist/utility/wrun/sources/lanes/option_daily.d.ts +30 -0
  182. package/dist/utility/wrun/sources/lanes/option_daily.js +53 -0
  183. package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +23 -0
  184. package/dist/utility/wrun/sources/lanes/option_stats_10m.js +20 -0
  185. package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
  186. package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
  187. package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
  188. package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
  189. package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
  190. package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
  191. package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
  192. package/dist/utility/wrun/sources/lanes/series.js +321 -0
  193. package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
  194. package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
  195. package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
  196. package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
  197. package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
  198. package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
  199. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +196 -0
  200. package/dist/utility/wrun/sources/opra-option-lanes.util.js +446 -0
  201. package/dist/utility/wrun/sources/registry.d.ts +21 -0
  202. package/dist/utility/wrun/sources/registry.js +207 -0
  203. package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
  204. package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
  205. package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
  206. package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
  207. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
  208. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
  209. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +6 -0
  210. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +70 -0
  211. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
  212. package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
  213. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +13 -0
  214. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +137 -0
  215. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +38 -0
  216. package/dist/utility/wrun/sources/row-lanes/option_surface.js +150 -0
  217. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +275 -0
  218. package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
  219. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +224 -0
  220. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +394 -0
  221. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +283 -0
  222. package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
  223. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +205 -0
  224. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +469 -0
  225. package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
  226. package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
  227. package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
  228. package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
  229. package/dist/utility/wrun/wrun-color-settings.util.js +1 -1
  230. package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
  231. package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
  232. package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
  233. package/dist/utility/wrun/wrun-deadline.util.js +82 -0
  234. package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
  235. package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
  236. package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
  237. package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
  238. package/dist/utility/wrun/wrun-failure-cause.d.ts +39 -0
  239. package/dist/utility/wrun/wrun-failure-cause.js +94 -0
  240. package/dist/utility/wrun/wrun-frames.d.ts +28 -3
  241. package/dist/utility/wrun/wrun-frames.js +132 -52
  242. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +167 -4
  243. package/dist/utility/wrun/wrun-hosted-wire-caps.js +47 -2
  244. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +5 -2
  245. package/dist/utility/wrun/wrun-hosted-wire.util.js +4 -2
  246. package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
  247. package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
  248. package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
  249. package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
  250. package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
  251. package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
  252. package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
  253. package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
  254. package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
  255. package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
  256. package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
  257. package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
  258. package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
  259. package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
  260. package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
  261. package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
  262. package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
  263. package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
  264. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
  265. package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
  266. package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +30 -0
  267. package/dist/utility/wrun/wrun-opra-stats.leaf.js +96 -0
  268. package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
  269. package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
  270. package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
  271. package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
  272. package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
  273. package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
  274. package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
  275. package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
  276. package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
  277. package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
  278. package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
  279. package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
  280. package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
  281. package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
  282. package/dist/utility/wrun/wrun-pack.util.d.ts +6 -2
  283. package/dist/utility/wrun/wrun-pack.util.js +13 -3
  284. package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
  285. package/dist/utility/wrun/wrun-param-map.util.js +581 -0
  286. package/dist/utility/wrun/wrun-param-values.util.d.ts +8 -0
  287. package/dist/utility/wrun/wrun-param-values.util.js +8 -0
  288. package/dist/utility/wrun/wrun-pin-spelling.util.d.ts +149 -0
  289. package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
  290. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
  291. package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
  292. package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
  293. package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -0
  294. package/dist/utility/wrun/wrun-present-bits.util.d.ts +37 -0
  295. package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
  296. package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
  297. package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
  298. package/dist/utility/wrun/wrun-refusal.util.d.ts +95 -7
  299. package/dist/utility/wrun/wrun-refusal.util.js +314 -18
  300. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
  301. package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
  302. package/dist/utility/wrun/wrun-render-select.util.js +1 -0
  303. package/dist/utility/wrun/wrun-row-market.util.d.ts +29 -0
  304. package/dist/utility/wrun/wrun-row-market.util.js +92 -0
  305. package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
  306. package/dist/utility/wrun/wrun-row-source.js +75 -0
  307. package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
  308. package/dist/utility/wrun/wrun-run-health.util.js +273 -0
  309. package/dist/utility/wrun/wrun-socket-row-source.d.ts +439 -0
  310. package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
  311. package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
  312. package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
  313. package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
  314. package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
  315. package/dist/utility/wrun/wrun-symbol-code.util.d.ts +32 -0
  316. package/dist/utility/wrun/wrun-symbol-code.util.js +56 -0
  317. package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
  318. package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
  319. package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
  320. package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
  321. package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
  322. package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
  323. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
  324. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
  325. package/dist/utility/wrun-display-name.util.d.ts +33 -0
  326. package/dist/utility/wrun-display-name.util.js +64 -0
  327. package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
  328. package/dist/workers/constants/kscript-transport-codes.js +15 -0
  329. package/dist/workers/constants/socket-slots.d.ts +574 -0
  330. package/dist/workers/constants/socket-slots.js +539 -0
  331. package/dist/workers/utils/number.worker.util.d.ts +5 -0
  332. package/dist/workers/utils/number.worker.util.js +10 -0
  333. package/dist/workers/utils/time.worker.util.d.ts +12 -0
  334. package/dist/workers/utils/time.worker.util.js +24 -0
  335. package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
  336. package/dist/workers/utils/volume-profile.worker.util.js +631 -0
  337. package/package.json +10 -4
@@ -0,0 +1,469 @@
1
+ import { wrunRowLaneByKey, wrunRowLaneOfClass, wrunRowLanes } from './row-lane-registry.js';
2
+ import { stableJson, wrunOpraPlaneStopDetail } from './wrun-poll-lanes.util.js';
3
+ import { refuseWrunPollInput } from './wrun-poll-lane.types.js';
4
+ import { WRUN_ROW_LANE_ID_PREFIX, wrunLaneChainPlaneOf, } from './wrun-row-lane.types.js';
5
+ import { assertWrunOpraLaneReadable, wrunOpraLanePayloadFields } from '../wrun-opra-lane.util.js';
6
+ import { wrunOptionsStopSeed } from '../wrun-refusal.util.js';
7
+ import { wrunPartialMarkerTuple, wrunPresentIsPartial, wrunTuplesMarkedPartial } from '../wrun-present-bits.util.js';
8
+ import { wrunCellRowsWithPartialBars, wrunHostGridAsks, wrunHostGridFallbackAsks, wrunHostGridFetchTo, wrunLandCellRowsOnHostBars, } from '../wrun-tier-grid.util.js';
9
+ /**
10
+ * The static plan: every input whose class a row lane serves, in declaration order, with its lane. Refused by
11
+ * name: a scalar input (a row lane serves cell blocks) and a celled one with no `max_cells` (the bound its blocks
12
+ * are packed under). Empty when the sheet reads no row-lane class.
13
+ */
14
+ export function planWrunRowLaneInputs(metadata) {
15
+ const planned = [];
16
+ if (wrunRowLanes().length === 0)
17
+ return planned;
18
+ const inputs = [...metadata.inputs].sort((a, b) => a.index - b.index);
19
+ for (const input of inputs) {
20
+ const source = metadata.inputSources[input.name];
21
+ if (!source)
22
+ continue;
23
+ const lane = wrunRowLaneOfClass(source.source);
24
+ if (lane === undefined)
25
+ continue;
26
+ if (input.cellType !== 'array') {
27
+ throw new Error(`WRUN ${metadata.id}: input '${input.name}' (${source.source}) is not celled: declare cellType "array" with max_cells`);
28
+ }
29
+ const maxCells = input.max_cells;
30
+ if (typeof maxCells !== 'number' || !Number.isInteger(maxCells) || maxCells < 1) {
31
+ throw new Error(`WRUN ${metadata.id}: input '${input.name}' (${source.source}) declares no max_cells: a celled input names the most tuples a bar may hold`);
32
+ }
33
+ planned.push({ inputIndex: input.index, inputName: input.name, source, lane, maxCells });
34
+ }
35
+ return planned;
36
+ }
37
+ /** The id of the instance `extras` names: `row:<laneKey>` when the ask carries no extras, else the extras'
38
+ * canonical text appended (equal asks are ONE instance whatever their field order). */
39
+ export function wrunRowLaneInstanceKey(laneKey, extras) {
40
+ const named = Object.keys(extras).some((key) => extras[key] !== undefined);
41
+ return `${WRUN_ROW_LANE_ID_PREFIX}${laneKey}${named ? stableJson(extras) : ''}`;
42
+ }
43
+ /** Why a row lane is not served on a chart, as its refusal says it. */
44
+ function wrunRowLaneUnadmittedReason(lane) {
45
+ return lane.governed === 'opra'
46
+ ? "is not served on this chart: it reads US options data, which a US stock or ETF chart (its underlying's options) and an OPRA option contract chart serve"
47
+ : "is not served on this chart: it reads the chart's own market, and a stock, forex, commodity or DEX chart serves candles and time";
48
+ }
49
+ /**
50
+ * The run's plan against the chart, before any fetch, every input of a row-lane class in declaration order (the
51
+ * first refusal by name wins):
52
+ * 0. an input the market leaves undemanded (its `needed_by` leaves the market out, wrunSheetWithLaneDemand) is planned
53
+ * nowhere: no wall, no admission, no acquisition, no note; the row builder reads its empty block on every bar;
54
+ * 1. the OPRA wall: an input of a `governed: 'opra'` lane is refused for a run that may not read OPRA
55
+ * (`opra-official-only:<class>`, `mayReadOpra` over `run`; absent reads closed);
56
+ * 2. the admission: a governed OPRA lane is served where the chart's options ride the OPRA plane
57
+ * (`isOpraPlaneExchange`) and nowhere else; a chain lane on every chart (its identity or facets refuse a chart
58
+ * with no chain by name); any other lane wherever the chart is not index-mode. On a chart
59
+ * that does not serve it an input declaring `missing: "empty"` is dropped (its blocks read EMPTY, a note names
60
+ * the feed) and any other refuses by name, seeded feed-missing (paused); a governed lane off the plane for a known
61
+ * reason (`opraPlaneStop`: the `opra` flag dark, an index chart) says that reason instead (`options-stopped`,
62
+ * the note and the refusal alike). A governed lane declaring
63
+ * `offPlane: 'empty'` is the exception off its plane: no wall, no refusal and no note, its identity, facets and
64
+ * acquisition rule judged as anywhere, and then no instance (every input reads its empty block);
65
+ * 3. the lane's identity, once per lane (the first admitted input's context names a refusal), then the input's
66
+ * facets (awaited, in declaration order); the instance is the identity and the facets together. A lane with
67
+ * `acquisitions: 'one'` refuses a second input whose acquisition differs (one fetch, one live fold per package).
68
+ * A chain lane's instance then meets its own plane's wall (`wrunRowLaneChainPlane`): the OPRA wall (met before the
69
+ * chain is resolved on a chart whose options ride the OPRA plane), or the CME display wall (OpenMarket's own
70
+ * packages only); a plain chain (a crypto venue) none.
71
+ */
72
+ export async function planWrunRowLanes(metadata, chart, run) {
73
+ const instances = new Map();
74
+ const missing = new Map();
75
+ const identities = new Map();
76
+ const firstOf = new Map();
77
+ const indexMode = chart.isIndexModeExchange?.(chart.exchange) === true;
78
+ const cryptoVenue = chart.isCryptoVenueExchange?.(chart.exchange);
79
+ const opraPlane = chart.isOpraPlaneExchange?.(chart.exchange) === true;
80
+ // Off the plane, the known reason the chart is off it (the flag, the router), read once.
81
+ const opraStop = opraPlane ? undefined : chart.opraPlaneStop?.(chart.exchange);
82
+ for (const planned of planWrunRowLaneInputs(metadata)) {
83
+ if (planned.source.undemanded === true)
84
+ continue;
85
+ const { lane } = planned;
86
+ const ctx = {
87
+ coin: chart.coin,
88
+ exchange: chart.exchange,
89
+ symbol: chart.symbol,
90
+ ...(chart.category !== undefined ? { category: chart.category } : {}),
91
+ intervalMs: chart.intervalMs,
92
+ inputName: planned.inputName,
93
+ sourceClass: lane.sourceClass,
94
+ indexMode,
95
+ cryptoVenue,
96
+ official: run?.official === true,
97
+ opraUserScripts: run?.opraUserScripts === true,
98
+ };
99
+ // A governed lane that reads empty off its plane (`offPlane`) meets no wall there: nothing it reads is OPRA's.
100
+ const emptyOffPlane = lane.governed === 'opra' && lane.offPlane === 'empty' && !opraPlane;
101
+ // A chain lane meets the OPRA wall before its chain is resolved where the chart's options ride the OPRA plane
102
+ // (every chain it reads there is OPRA's), and is admitted on every chart.
103
+ const chainLane = lane.chain !== undefined;
104
+ if ((lane.governed === 'opra' && !emptyOffPlane) || (chainLane && opraPlane))
105
+ assertWrunOpraLaneReadable(run, ctx);
106
+ const admitted = chainLane || emptyOffPlane || (lane.governed === 'opra' ? opraPlane : !indexMode);
107
+ if (!admitted) {
108
+ // A governed lane on a chart whose options DO list on OPRA is off the plane for a known reason (the flag, the
109
+ // router): the note and the refusal say that reason, never "this market has no such feed".
110
+ const stop = lane.governed === 'opra' ? opraStop : undefined;
111
+ const reason = stop !== undefined ? wrunOpraPlaneStopDetail(stop) : wrunRowLaneUnadmittedReason(lane);
112
+ if (planned.source.missing === 'empty') {
113
+ const details = `Input '${ctx.inputName}' (${ctx.sourceClass}) ${reason}; it declares missing: "empty", so it reads an empty block on every bar`;
114
+ const entry = missing.get(lane.laneKey);
115
+ if (entry === undefined) {
116
+ missing.set(lane.laneKey, {
117
+ inputNames: [planned.inputName],
118
+ feed: lane.laneKey,
119
+ variant: cryptoVenue === false ? 'crypto-only' : 'market',
120
+ details,
121
+ ...(stop !== undefined ? { stop } : {}),
122
+ });
123
+ }
124
+ else {
125
+ entry.inputNames.push(planned.inputName);
126
+ entry.details = `${entry.details}\n${details}`;
127
+ }
128
+ continue;
129
+ }
130
+ refuseWrunPollInput(ctx, reason, stop !== undefined
131
+ ? wrunOptionsStopSeed(stop, { severity: 'paused' })
132
+ : {
133
+ cls: 'feed-missing',
134
+ variant: cryptoVenue === false ? 'crypto-only' : 'market-paused',
135
+ params: { feed: lane.laneKey },
136
+ severity: 'paused',
137
+ });
138
+ }
139
+ let identity = identities.get(lane.laneKey);
140
+ if (identity === undefined) {
141
+ identity = definedFields(await lane.identity?.(ctx));
142
+ identities.set(lane.laneKey, identity);
143
+ }
144
+ const extras = { ...identity, ...definedFields(await lane.facets?.(planned.source, ctx)) };
145
+ // A chain instance meets its own plane's wall, by the exchange its chain lists on.
146
+ if (chainLane)
147
+ assertWrunRowChainPlaneReadable(lane, extras, run, ctx);
148
+ const key = wrunRowLaneInstanceKey(lane.laneKey, extras);
149
+ const first = firstOf.get(lane.laneKey);
150
+ if (lane.acquisitions === 'one' && first !== undefined && first.key !== key) {
151
+ throw new Error(`WRUN ${metadata.id}: input '${planned.inputName}' (${lane.sourceClass}) asks another acquisition than input ` +
152
+ `'${first.inputName}': the browser lane serves one ${lane.sourceClass} acquisition per package`);
153
+ }
154
+ if (first === undefined)
155
+ firstOf.set(lane.laneKey, { key, inputName: planned.inputName });
156
+ // Off its plane such a lane plans no instance: the row builder reads the input's empty block on every bar.
157
+ if (emptyOffPlane)
158
+ continue;
159
+ let instance = instances.get(key);
160
+ if (instance === undefined) {
161
+ instance = { key, sourceClass: lane.sourceClass, laneKey: lane.laneKey, extras, inputIndexes: [] };
162
+ instances.set(key, instance);
163
+ }
164
+ instance.inputIndexes.push(planned.inputIndex);
165
+ }
166
+ return { lanes: [...instances.values()], missingFeeds: [...missing.values()] };
167
+ }
168
+ function definedFields(fields) {
169
+ const out = {};
170
+ for (const [key, value] of Object.entries(fields ?? {}))
171
+ if (value !== undefined)
172
+ out[key] = value;
173
+ return out;
174
+ }
175
+ /** The record seed of the CME display wall on a chain lane's CME instance (the display wall's own record). */
176
+ const WRUN_CME_WALL_SEED = Object.freeze({ cls: 'cme-wall' });
177
+ /** A chain instance against its own plane's wall (`planWrunRowLanes` step 3): an OPRA chain the OPRA wall
178
+ * (`mayReadOpra`), a CME chain the CME display wall (OpenMarket's own packages only, the run door's rule on a CME
179
+ * chart, kscript-venue-policy.util; the `opra-user-scripts` flag never opens it), a plain chain none. */
180
+ function assertWrunRowChainPlaneReadable(lane, extras, run, ctx) {
181
+ const plane = wrunRowLaneChainPlane(lane, extras);
182
+ if (plane === 'opra')
183
+ assertWrunOpraLaneReadable(run, ctx);
184
+ if (plane === 'cme' && run?.official !== true) {
185
+ refuseWrunPollInput(ctx, `reads CME options data (${wrunRowLaneChainExchange(lane, extras)}), which is open to OpenMarket's own ` +
186
+ 'Indicators only: a package you wrote or added from the community cannot read it yet', WRUN_CME_WALL_SEED);
187
+ }
188
+ }
189
+ /** The exchange a chain-lane instance's chain lists on (the payload field its `chain` names); '' for any other lane
190
+ * or a payload naming none. */
191
+ export function wrunRowLaneChainExchange(lane, extras) {
192
+ const exchange = lane.chain === undefined ? undefined : extras[lane.chain.exchangeField];
193
+ return typeof exchange === 'string' ? exchange : '';
194
+ }
195
+ /** The plane a chain-lane instance reads, by its chain's exchange (`wrunLaneChainPlaneOf`); undefined for any other
196
+ * lane (its plane, if any, is its descriptor's `governed`). */
197
+ export function wrunRowLaneChainPlane(lane, extras) {
198
+ return lane.chain === undefined ? undefined : wrunLaneChainPlaneOf(wrunRowLaneChainExchange(lane, extras));
199
+ }
200
+ /** Whether one row-lane instance reads the OPRA plane (the provenance stamp follows it): every instance of a governed
201
+ * lane, a chain lane's whose chain lists on OPRA. */
202
+ export function wrunRowLaneInstanceReadsOpra(lane, extras) {
203
+ return lane.governed === 'opra' || wrunRowLaneChainPlane(lane, extras) === 'opra';
204
+ }
205
+ /** The governed exchange a chain-lane instance reads beside its chart's own market (the exchange its served access,
206
+ * and so its delayed window, is read under): its chain's when a gate governs it (OPRA, a CME Group exchange); null
207
+ * for a plain chain and for any other lane. */
208
+ export function wrunRowLaneChainGovernedExchange(lane, extras) {
209
+ const plane = wrunRowLaneChainPlane(lane, extras);
210
+ return plane === 'opra' || plane === 'cme' ? wrunRowLaneChainExchange(lane, extras) : null;
211
+ }
212
+ /** The first row-lane instance of a session whose acquisition moved since the run planned it (its lane's
213
+ * `acquisitionMoved` over the run's record of it, else over the instance's payload), or undefined: the live tick
214
+ * rebuilds the session then. */
215
+ export function wrunRowLaneMovedInstance(instances, acquisition) {
216
+ for (const instance of instances ?? []) {
217
+ const moved = wrunRowLaneByKey(instance.laneKey)?.acquisitionMoved;
218
+ if (moved !== undefined && moved(acquisition[instance.key] ?? instance.extras))
219
+ return instance.key;
220
+ }
221
+ return undefined;
222
+ }
223
+ /**
224
+ * A chain instance's ask (the full run's and the reconcile's, re-read on every ask): its payload with the fields its
225
+ * plane names beside it. An OPRA chain names the plane and its routed tier (`wrunOpraLanePayloadFields`: Door C judges
226
+ * it an OPRA ask, the legend names a delayed tier); a CME chain its routed tier alone (`servedTier`, so no source cache
227
+ * serves one tier's rows to the other; the chart's own badge names the delay); a plain chain (a crypto venue) nothing.
228
+ * Any other lane's payload as it is. `tierOf` is the routing's rule (governed-route.util `governedMarketDataTier`),
229
+ * handed in so this module stays off the routing graph, and asked only for a governed exchange: it answers delayed
230
+ * for any exchange no gate governs.
231
+ */
232
+ export function wrunRowLaneChainAsk(lane, extras, tierOf) {
233
+ const plane = wrunRowLaneChainPlane(lane, extras);
234
+ if (plane !== 'opra' && plane !== 'cme')
235
+ return extras;
236
+ const servedTier = tierOf(wrunRowLaneChainExchange(lane, extras));
237
+ return plane === 'opra' ? { ...extras, ...wrunOpraLanePayloadFields(servedTier) } : { ...extras, servedTier };
238
+ }
239
+ /** How an empty answer reads for a lane: quiet (present EMPTY blocks) or degrading (a state lane's). */
240
+ export function wrunRowLaneEmptyAnswer(lane) {
241
+ return lane.emptyAnswer ?? (lane.landing.kind === 'flow' ? 'quiet' : 'degrades');
242
+ }
243
+ /** Whether an instance must answer rows: its lane degrades on an empty answer and some input reading it does not
244
+ * declare `missing: "empty"` (a celled input's fill over an empty lane, the honest-picture rule). */
245
+ export function wrunRowLaneRequired(metadata, instance) {
246
+ const lane = wrunRowLaneByKey(instance.laneKey);
247
+ if (lane === undefined || wrunRowLaneEmptyAnswer(lane) === 'quiet')
248
+ return false;
249
+ return metadata.inputs.some((input) => instance.inputIndexes.includes(input.index) && metadata.inputSources[input.name]?.missing !== 'empty');
250
+ }
251
+ /** The fetch options a row lane's asks carry: the native-rows path for a governed lane and a chain lane (their rows
252
+ * are their plane's or their chain's, never the chart market's, an index-mode one included), none otherwise. */
253
+ export function wrunRowLaneFetchOptions(lane) {
254
+ return lane.governed !== undefined || lane.chain !== undefined ? { nativeRows: true } : undefined;
255
+ }
256
+ /** The payload field a tiered ask names its backend tier in (`landing.tiers`, the tier's key). */
257
+ export const WRUN_ROW_LANE_TIER_FIELD = 'tier';
258
+ /**
259
+ * A row lane's rows over a chart window `[barOpens[0], last bar's end)`: a flow or snapshot lane's asks under the
260
+ * tier rule and the lane's `tierChoice` (one per run of bars on a tier, the tier's key as `tier` in the ask's
261
+ * extras), cut to its horizon and its row budget, each answer landed on the host bars (`wrunLandCellRowsOnHostBars`,
262
+ * the lane's own `fold` when it has one), a snapshot's bar its tier answered nothing for asked again one tier coarser
263
+ * where one fits and retains it when the lane's `coarserWhenEmpty` says so of the acquisition (D12), and the bars no
264
+ * tier retains (or the budget left out) marked partial (bit 14, a marker tuple when empty); a `latest` lane asked
265
+ * once over `fallback`, its rows as they come. `ask` is the caller's fetch (the full run's, a reconcile's). Ascending,
266
+ * one row per host bar.
267
+ */
268
+ export async function fetchWrunRowLaneRows(lane, extras, window, fallback, ask) {
269
+ const landing = lane.landing;
270
+ if (landing.kind === 'latest')
271
+ return (await ask(extras, fallback.fromTs, fallback.toTs)).map((row) => [...row]);
272
+ const { asks, partialBars } = wrunRowLaneAsksWithinRowBudget(wrunRowLaneAsksWithinHorizon(wrunHostGridAsks({
273
+ tiers: landing.tiers,
274
+ barOpens: window.barOpens,
275
+ intervalMs: window.intervalMs,
276
+ nowMs: window.nowMs,
277
+ choice: landing.tierChoice,
278
+ }), window, lane.horizon?.(extras, window.nowMs)), window, lane.rowBudget);
279
+ const fold = landing.fold;
280
+ const askAndLand = async (gridAsk) => {
281
+ const askExtras = gridAsk.tier === undefined ? extras : { ...extras, [WRUN_ROW_LANE_TIER_FIELD]: gridAsk.tier.key };
282
+ const rows = await ask(askExtras, gridAsk.fromMs, gridAsk.toMs);
283
+ return wrunLandCellRowsOnHostBars(rows, landing.kind, { intervalMs: window.intervalMs, barGrid: window.barGrid, tierMs: gridAsk.tier?.ms, nowMs: window.nowMs }, fold === undefined ? undefined : (group) => fold(group, askExtras));
284
+ };
285
+ const byBar = new Map();
286
+ for (const landed of await Promise.all(asks.map(askAndLand))) {
287
+ for (const row of landed)
288
+ byBar.set(Number(row[0]), row);
289
+ }
290
+ // D12: a snapshot's bar its tier answered nothing for reads the next coarser tier that fits and retains it, for an
291
+ // acquisition its lane says so of (`coarserWhenEmpty`: a CME surface's daily bar whose 5m tier holds no session
292
+ // yet reads its settlement DAY row, never nothing); a fallback row fills only a bar still empty.
293
+ if (landing.kind === 'snapshot' && landing.tiers !== undefined && landing.coarserWhenEmpty?.(extras) === true) {
294
+ for (let pending = asks;;) {
295
+ const fallback = wrunHostGridFallbackAsks({
296
+ tiers: landing.tiers,
297
+ asks: pending,
298
+ barOpens: window.barOpens,
299
+ landedBars: new Set(byBar.keys()),
300
+ intervalMs: window.intervalMs,
301
+ nowMs: window.nowMs,
302
+ });
303
+ if (fallback.length === 0)
304
+ break;
305
+ for (const landed of await Promise.all(fallback.map(askAndLand))) {
306
+ for (const row of landed)
307
+ if (!byBar.has(Number(row[0])))
308
+ byBar.set(Number(row[0]), row);
309
+ }
310
+ pending = fallback;
311
+ }
312
+ }
313
+ const landed = [...byBar.entries()].sort((a, b) => a[0] - b[0]).map(([, row]) => row);
314
+ // A class with no `present` mask marks nothing: a partial bar asked nothing and reads an empty block.
315
+ return lane.presentMask === false ? landed : wrunCellRowsWithPartialBars(landed, partialBars, lane.width);
316
+ }
317
+ /**
318
+ * A host-grid ask plan cut to a lane's horizon for one acquisition (`WrunRowLaneHorizon`): every window bar that
319
+ * opens before `completeFromMs` joins the partial bars, and the asks start at the first bar that ends after
320
+ * `servedFromMs` (an ask wholly before it is dropped). No horizon: the plan as the tier rule made it.
321
+ */
322
+ export function wrunRowLaneAsksWithinHorizon(plan, window, horizon) {
323
+ if (horizon === undefined)
324
+ return plan;
325
+ const servedFrom = finiteOrUndefined(horizon.servedFromMs);
326
+ const completeFrom = finiteOrUndefined(horizon.completeFromMs) ?? servedFrom;
327
+ const partial = new Set(plan.partialBars);
328
+ if (completeFrom !== undefined)
329
+ for (const open of window.barOpens)
330
+ if (open < completeFrom)
331
+ partial.add(open);
332
+ let asks = plan.asks;
333
+ if (servedFrom !== undefined) {
334
+ const firstServed = window.barOpens.find((open) => wrunHostGridFetchTo(open, window.intervalMs) > servedFrom);
335
+ asks =
336
+ firstServed === undefined
337
+ ? []
338
+ : plan.asks.flatMap((gridAsk) => {
339
+ const fromMs = Math.max(gridAsk.fromMs, firstServed);
340
+ return fromMs < gridAsk.toMs ? [{ ...gridAsk, fromMs }] : [];
341
+ });
342
+ }
343
+ return { asks, partialBars: [...partial].sort((a, b) => a - b) };
344
+ }
345
+ /**
346
+ * A host-grid ask plan cut to a lane's row budget (`WrunRowLaneRowBudget`), before any fetch: walking the asked bars
347
+ * from the newest, each at its ask's tier, it keeps the bars whose projected rows still fit `maxRows`; every older
348
+ * asked bar joins the partial bars and the asks start at the oldest kept bar's open (a bar is read whole or not at
349
+ * all). A bar whose own projection passes the cap stops the walk there. No budget, or every bar fitting: the plan
350
+ * as it came.
351
+ */
352
+ export function wrunRowLaneAsksWithinRowBudget(plan, window, budget) {
353
+ if (budget === undefined || plan.asks.length === 0)
354
+ return plan;
355
+ const asked = [];
356
+ for (const ask of plan.asks) {
357
+ for (const openMs of window.barOpens) {
358
+ if (openMs < ask.fromMs || openMs >= ask.toMs)
359
+ continue;
360
+ asked.push({ openMs, endMs: wrunHostGridFetchTo(openMs, window.intervalMs), tier: ask.tier });
361
+ }
362
+ }
363
+ asked.sort((a, b) => b.openMs - a.openMs);
364
+ let rows = 0;
365
+ let keptFrom = Number.POSITIVE_INFINITY;
366
+ for (const bar of asked) {
367
+ const projected = budget.barRows(bar, window.nowMs);
368
+ rows += Number.isFinite(projected) && projected > 0 ? projected : 0;
369
+ if (rows > budget.maxRows)
370
+ break;
371
+ keptFrom = bar.openMs;
372
+ }
373
+ const cut = asked.filter((bar) => bar.openMs < keptFrom).map((bar) => bar.openMs);
374
+ if (cut.length === 0)
375
+ return plan;
376
+ return {
377
+ asks: plan.asks.flatMap((ask) => {
378
+ const fromMs = Math.max(ask.fromMs, keptFrom);
379
+ return fromMs < ask.toMs ? [{ ...ask, fromMs }] : [];
380
+ }),
381
+ partialBars: [...new Set([...plan.partialBars, ...cut])].sort((a, b) => a - b),
382
+ };
383
+ }
384
+ function finiteOrUndefined(value) {
385
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
386
+ }
387
+ /** The ask shape a lane's own `fetch` takes, over a window. */
388
+ export function wrunRowLaneOwnAsk(extras, fromTs, toTs, intervalMs) {
389
+ return { extras, fromTs, toTs, intervalMs };
390
+ }
391
+ /** One member of a NaN-tolerant tuple, om's own reading (wrun-host cells.ts `strikeMember`): a finite number as it
392
+ * is, a non-empty numeric string read, anything else (null, a missing member, an infinity, other text) NaN. */
393
+ function wrunCellMember(member) {
394
+ const value = typeof member === 'number'
395
+ ? member
396
+ : typeof member === 'string' && member.trim() !== ''
397
+ ? Number(member)
398
+ : Number.NaN;
399
+ return Number.isFinite(value) ? value : Number.NaN;
400
+ }
401
+ /** A row's tuples as the host's exact adapter reads them: arrays of exactly `width` numbers, finite in every column
402
+ * (the kit's rule for an exact class: any other tuple is dropped whole), or, for a lane naming its `finiteColumns`,
403
+ * finite in those columns while any other column that is not a finite number reads NaN (om's adapter for such a
404
+ * class: a null, a missing member or an infinity is NaN, never 0). */
405
+ function exactTuples(row, lane) {
406
+ const { width, finiteColumns } = lane;
407
+ const tuples = [];
408
+ for (let at = 1; at < row.length; at += 1) {
409
+ const cell = row[at];
410
+ if (!Array.isArray(cell) || cell.length !== width)
411
+ continue;
412
+ if (finiteColumns === undefined) {
413
+ const tuple = cell.map(Number);
414
+ if (tuple.every((value) => Number.isFinite(value)))
415
+ tuples.push(tuple);
416
+ continue;
417
+ }
418
+ const tuple = cell.map(wrunCellMember);
419
+ if (finiteColumns.every((column) => Number.isFinite(tuple[column])))
420
+ tuples.push(tuple);
421
+ }
422
+ return tuples;
423
+ }
424
+ /**
425
+ * One bar's block through an input's projection (`cells`; absent: the tuples as they are), its PARTIAL status kept
426
+ * (bit 14 of the `present` mask, the last column): when any of the bar's tuples says partial (a bar no fitting tier
427
+ * retains, or the marker tuple of one that holds none), every tuple the projection keeps or rebuilds carries bit 14,
428
+ * and a block the projection empties reads the marker tuple, so a package never reads missing history as a quiet bar.
429
+ * A class with no `present` mask (`presentMask: false`) is projected as it is: its last column is a value.
430
+ */
431
+ function wrunProjectedBlock(lane, tuples, input) {
432
+ const projected = lane.cells ? lane.cells(tuples, input) : tuples;
433
+ if (lane.presentMask === false)
434
+ return projected;
435
+ if (!tuples.some((tuple) => wrunPresentIsPartial(tuple[tuple.length - 1])))
436
+ return projected;
437
+ return projected.length > 0 ? wrunTuplesMarkedPartial(projected, lane.width) : [wrunPartialMarkerTuple(lane.width)];
438
+ }
439
+ /**
440
+ * One input's cell blocks from its lane's host-bar rows (`[barOpen, ...tuples]`), as the shared host's aligner
441
+ * reads them (`{ ts, cells }`, the tuples flattened): each row's exact tuples (`width` finite numbers), through the
442
+ * lane's per-input projection (`cells`), on the row's own stamp (the aligner exact-joins it on the chart's grid; a
443
+ * bar the lane holds no row for reads a present EMPTY block). A PARTIAL bar stays partial through the projection
444
+ * (`wrunProjectedBlock`). A `latest` lane's newest row lands on the LIVE row alone (`liveTs`, the chart's last row;
445
+ * the options chain's rule) whatever its stamp, every other row reading an empty block. `afterTs` (a tail build's
446
+ * carry) keeps the rows stamped after it, except a `latest` lane's newest.
447
+ */
448
+ export function wrunRowLaneCellRows(lane, rows, input, opts = {}) {
449
+ const project = (tuples) => wrunProjectedBlock(lane, tuples, input).flatMap((tuple) => [...tuple]);
450
+ if (lane.landing.kind === 'latest') {
451
+ if (opts.liveTs === undefined || !Number.isFinite(opts.liveTs))
452
+ return [];
453
+ let newest;
454
+ for (const row of rows) {
455
+ const ts = Number(row[0]);
456
+ if (Number.isFinite(ts) && (newest === undefined || ts > Number(newest[0])))
457
+ newest = row;
458
+ }
459
+ return newest === undefined ? [] : [{ ts: opts.liveTs, cells: project(exactTuples(newest, lane)) }];
460
+ }
461
+ const out = [];
462
+ for (const row of rows) {
463
+ const ts = Number(row[0]);
464
+ if (!Number.isFinite(ts) || (opts.afterTs !== undefined && ts <= opts.afterTs))
465
+ continue;
466
+ out.push({ ts, cells: project(exactTuples(row, lane)) });
467
+ }
468
+ return out;
469
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The leaf half of the browser lane's served source classes: the classes the row builder serves
3
+ * through its own branches, the rule that names a poll lane's file after its source class, and
4
+ * the unserved-source predicate over a served set handed in.
5
+ *
6
+ * A LEAF on purpose: no imports, erasable TypeScript only. `scripts/wrun-kit-templates.mjs` runs
7
+ * this file under plain Node (type stripping) to precompute each kit starter's chart verdict, so
8
+ * nothing here may reach `@/` aliases, `import.meta.glob` or any other bundler feature. The
9
+ * app-side module is `wrun-browser-sources.ts`, which adds the classes of the poll-lane registry
10
+ * (`sources/registry.ts`, discovered by glob); the Node script adds the same classes by listing
11
+ * the registry's lane folder, which works because a lane FILE is named after the source class
12
+ * it serves (`wrunPollLaneClassOfFile`, the one definition of that rule: the registry refuses a
13
+ * lane file whose lanes declare another class).
14
+ */
15
+ /** The classes the row builder (`wrun-source-rows.util.ts`) serves through its own dispatch
16
+ * branches (a scalar, a celled or a pinned-leg one; `odds` plans a Polymarket candle leg). A
17
+ * served class may still refuse by name at run on its own terms (an odds starter's placeholder
18
+ * market, `funding` serving `rate_close` alone): those limits stay with the row builder. */
19
+ export declare const WRUN_BROWSER_BUILTIN_SOURCE_CLASSES: readonly string[];
20
+ /** The source class a poll-lane file serves: its base name (`lanes/volatility_index.ts` serves
21
+ * `volatility_index`). Undefined for anything that is not a lane file (another extension, a
22
+ * declaration file, a name outside the class spelling), which both readers skip. */
23
+ export declare function wrunPollLaneClassOfFile(fileName: string): string | undefined;
24
+ /** The input source classes of a derived sheet outside `served`, deduplicated, in declaration
25
+ * order. */
26
+ export declare function wrunUnservedSourcesAmong(inputSources: Readonly<Record<string, {
27
+ source?: unknown;
28
+ } | undefined>> | undefined, served: ReadonlySet<string>): string[];
@@ -0,0 +1,66 @@
1
+ /**
2
+ * The leaf half of the browser lane's served source classes: the classes the row builder serves
3
+ * through its own branches, the rule that names a poll lane's file after its source class, and
4
+ * the unserved-source predicate over a served set handed in.
5
+ *
6
+ * A LEAF on purpose: no imports, erasable TypeScript only. `scripts/wrun-kit-templates.mjs` runs
7
+ * this file under plain Node (type stripping) to precompute each kit starter's chart verdict, so
8
+ * nothing here may reach `@/` aliases, `import.meta.glob` or any other bundler feature. The
9
+ * app-side module is `wrun-browser-sources.ts`, which adds the classes of the poll-lane registry
10
+ * (`sources/registry.ts`, discovered by glob); the Node script adds the same classes by listing
11
+ * the registry's lane folder, which works because a lane FILE is named after the source class
12
+ * it serves (`wrunPollLaneClassOfFile`, the one definition of that rule: the registry refuses a
13
+ * lane file whose lanes declare another class).
14
+ */
15
+ /** The classes the row builder (`wrun-source-rows.util.ts`) serves through its own dispatch
16
+ * branches (a scalar, a celled or a pinned-leg one; `odds` plans a Polymarket candle leg). A
17
+ * served class may still refuse by name at run on its own terms (an odds starter's placeholder
18
+ * market, `funding` serving `rate_close` alone): those limits stay with the row builder. */
19
+ export const WRUN_BROWSER_BUILTIN_SOURCE_CLASSES = [
20
+ 'ohlcv',
21
+ 'odds',
22
+ 'time',
23
+ 'trades',
24
+ 'oi',
25
+ 'liquidations',
26
+ 'funding',
27
+ 'implied_volatility',
28
+ 'skew',
29
+ // Daily spot-ETF flows by fund over the chart's K_ETF_FLOW lane (wrun-etf-flow-lane.util).
30
+ 'etf_flow',
31
+ 'volume_profile',
32
+ 'book',
33
+ 'intrabar',
34
+ // A leg's closed candles as a cell stream (the shared host's leg core WrunCandleStream), and the two lane
35
+ // streams on the same delivery rules: a leg's open-interest candles and its closed candles' volume-profile rows
36
+ // (hand-copied from wrun-leg-stream-classes.ts, which this leaf cannot import; its spec pins the copy).
37
+ 'candles',
38
+ 'oi_candles',
39
+ 'volume_profile_candles',
40
+ 'options_chain',
41
+ // USD order-size bucketed flow per bar over the chart's K_TRADE_VOLUME_BY_SIZE lane (celled).
42
+ 'trade_volume_by_size',
43
+ // The raw prints per bar over the K_TRADES lane (celled): history from TRADE_LARGE, live from
44
+ // the raw TRADE channel (wrun-tape-source.util).
45
+ 'tape',
46
+ ];
47
+ /** The source class a poll-lane file serves: its base name (`lanes/volatility_index.ts` serves
48
+ * `volatility_index`). Undefined for anything that is not a lane file (another extension, a
49
+ * declaration file, a name outside the class spelling), which both readers skip. */
50
+ export function wrunPollLaneClassOfFile(fileName) {
51
+ const match = /(?:^|[\\/])([a-z][a-z0-9_]*)\.ts$/.exec(fileName);
52
+ return match ? match[1] : undefined;
53
+ }
54
+ /** The input source classes of a derived sheet outside `served`, deduplicated, in declaration
55
+ * order. */
56
+ export function wrunUnservedSourcesAmong(inputSources, served) {
57
+ const unserved = [];
58
+ for (const source of Object.values(inputSources ?? {})) {
59
+ const sourceClass = source?.source;
60
+ if (typeof sourceClass !== 'string' || served.has(sourceClass))
61
+ continue;
62
+ if (!unserved.includes(sourceClass))
63
+ unserved.push(sourceClass);
64
+ }
65
+ return unserved;
66
+ }
@@ -0,0 +1,65 @@
1
+ /**
2
+ * The cloud record of a registry Indicator across the lane line (WRUN-PARITY-PLAN U15, U16).
3
+ *
4
+ * A cloud Indicator is the registry record the browser lane mounts (the registry loader builds both
5
+ * through one mount, its rows through the browser lane's own `buildWrunScriptInputs` over the full
6
+ * sheet), with its row source chosen by one field: `wrunRunTarget: 'cloud'` selects the socket row
7
+ * source (wrun-row-source-factory.ts). No protected flag and no wire identity ride the record, so no
8
+ * protected-kScript branch ever reads it. This leaf holds the reads that still cross the line:
9
+ *
10
+ * - `wrunCloudRecordOf`, the migration on read: a record persisted for the protected pipeline before
11
+ * lane parity wave 3 (the protected flag and the wire identity `wrunRef`; a marketplace mount
12
+ * carries `wrunRef` alone) is read as the cloud record it is: the engine copy and the document row
13
+ * take that shape at its first read (the registry loader's `adoptWrunHostedRecord`). During the
14
+ * rollout the PERSISTED row keeps the protected flag, the capability slug and `wrunRef` beside
15
+ * that shape, so a build from before wave 3 (production while INT soaks, a revert) still runs it
16
+ * hosted: the egress projection (wrun-cloud-row-compat.util), removed once every deployment reads
17
+ * `wrunRunTarget`, whose inverse takes them off again where the store installs a document.
18
+ * - `wrunSocketPayloadSettings`, the payload view: the socket row source's default transport builds
19
+ * its createScript payload through the one protected payload builder (the technical-script
20
+ * control), which reads the wire identity and the protected discriminator off this view, never off
21
+ * the record.
22
+ * - `wrunCustomScriptSlug`, the capability's slug for a tuple.
23
+ * - `wrunSheetPositionOf`, the pane side a sheet declares (the registry loader's `packagePosition`
24
+ * read loosely), for a sheet the loader did not download (a persisted copy, a cloud batch's).
25
+ *
26
+ * A near-leaf (the identity leaf only), so the loader, the factory and the catalog read one
27
+ * definition.
28
+ */
29
+ /** `wrun-<package>-<version>` with every non-alphanumeric run collapsed to `-`,
30
+ * byte-identical to tharamine's wrunCustomScriptSlug. Lossy on purpose (the
31
+ * registry's publish door refuses colliding coordinates). */
32
+ export declare function wrunCustomScriptSlug(packageId: string, version: string): string;
33
+ /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
34
+ * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
35
+ * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
36
+ * the primary output's panel decides. */
37
+ export declare function wrunSheetPositionOf(sheet: unknown): 'onchart' | 'offchart';
38
+ /**
39
+ * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
40
+ * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
41
+ * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
42
+ * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
43
+ * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
44
+ * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
45
+ * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
46
+ * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
47
+ * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
48
+ * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
49
+ * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
50
+ * read again).
51
+ */
52
+ export declare function wrunCloudRecordOf(settings: unknown): Record<string, unknown> | undefined;
53
+ /**
54
+ * The settings the protected payload builder reads for a cloud record (the socket row source's default
55
+ * transport builds the createScript payload through the technical-script control): the wire identity
56
+ * (`wrunRef`) and the capability's slug (wrunCustomScriptSlug, the `scriptId` tharamine binds the tuple
57
+ * to) from the registry identity, and the protected discriminator the builder keys its wire on. With
58
+ * the sheet the source runs, its params ride as `wrunSheet` too: the socket worker's session identity
59
+ * reads a param's `style` there (wrun-style-row-rule `wrunStyleTierSheetOf`, lane parity C6), so an om
60
+ * style knob stays paint-only on the cloud as in the browser. Never persisted, never written on the
61
+ * record. A record without a pinned registry identity passes through.
62
+ */
63
+ export declare function wrunSocketPayloadSettings(settings: Record<string, unknown>, sheet?: {
64
+ params?: unknown;
65
+ }): Record<string, unknown>;