@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,121 @@
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
+ import { wrunRegistryRefOf, wrunRegistrySlugFor } from './wrun-overlay-identity.util.js';
30
+ /** `wrun-<package>-<version>` with every non-alphanumeric run collapsed to `-`,
31
+ * byte-identical to tharamine's wrunCustomScriptSlug. Lossy on purpose (the
32
+ * registry's publish door refuses colliding coordinates). */
33
+ export function wrunCustomScriptSlug(packageId, version) {
34
+ return `wrun-${`${packageId}-${version}`.replace(/[^a-zA-Z0-9]+/g, '-')}`;
35
+ }
36
+ function isRecord(value) {
37
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
38
+ }
39
+ function hasPackageName(ref) {
40
+ return isRecord(ref) && typeof ref.package === 'string' && ref.package !== '';
41
+ }
42
+ /** A sheet's chart placement, the registry loader's `packagePosition` read loosely (a record's persisted
43
+ * copy may be trimmed or malformed, a cloud batch's sheet is the cloud's): a declared `overlay` wins; a
44
+ * strategy homes on price; a plotted, non-inset output on the `overlay` panel homes on price; otherwise
45
+ * the primary output's panel decides. */
46
+ export function wrunSheetPositionOf(sheet) {
47
+ const read = sheet ?? {};
48
+ if (read.overlay === 'offchart')
49
+ return 'offchart';
50
+ if (read.overlay === 'onchart')
51
+ return 'onchart';
52
+ if (read.strategy !== undefined)
53
+ return 'onchart';
54
+ const outputs = Array.isArray(read.outputs)
55
+ ? read.outputs
56
+ : [];
57
+ if (outputs.some((output) => output?.plot !== '' && output?.plot !== 'inset' && output?.panel === 'overlay')) {
58
+ return 'onchart';
59
+ }
60
+ return outputs[0]?.panel === 'lower' ? 'offchart' : 'onchart';
61
+ }
62
+ /**
63
+ * A record persisted for the protected pipeline before lane parity wave 3, read as the cloud record
64
+ * it is (the migration on read): its wire identity becomes the registry identity (a marketplace mount
65
+ * carried none; one it carried stays, its pane side kept), the slug is the registry's, the row source
66
+ * the cloud's, and the protected flag goes. Every other key rides as persisted. The pane side is the
67
+ * one the record carried, else its persisted sheet's (wrunSheetPositionOf); a record with neither (a
68
+ * marketplace mount) leaves it undecided, so the control mounts it on the price pane and the first
69
+ * batch's delivered sheet decides it, instead of a side guessed here being persisted for good. What
70
+ * else a registry identity naming the same tuple carried (the source mode a mount with the version doc
71
+ * in hand stamped, read by wrunOverlayEditable) stays: a cloud row persisted during the rollout carries
72
+ * `wrunRef` too (wrun-cloud-row-compat.util), and one that reaches the chart past the store's entry (a
73
+ * collab add, a paste) is read here. Undefined for a record that carries no wire identity (nothing to
74
+ * read again).
75
+ */
76
+ export function wrunCloudRecordOf(settings) {
77
+ if (!isRecord(settings))
78
+ return undefined;
79
+ const { isProtectedScript: _protected, wrunRef, ...record } = settings;
80
+ if (!hasPackageName(wrunRef))
81
+ return undefined;
82
+ const packageName = wrunRef.package;
83
+ const version = typeof wrunRef.version === 'string' ? wrunRef.version : '';
84
+ const kept = isRecord(record.wrunRegistryRef) ? record.wrunRegistryRef : undefined;
85
+ const position = kept?.position === 'onchart' || kept?.position === 'offchart'
86
+ ? kept.position
87
+ : isRecord(record.wrunSheet)
88
+ ? wrunSheetPositionOf(record.wrunSheet)
89
+ : undefined;
90
+ const facts = kept?.package === packageName && kept.version === version ? { ...kept } : {};
91
+ delete facts.position;
92
+ return {
93
+ ...record,
94
+ customScriptId: wrunRegistrySlugFor(packageName, version),
95
+ wrunRegistryRef: { ...facts, package: packageName, version, ...(position ? { position } : {}) },
96
+ wrunRunTarget: 'cloud',
97
+ };
98
+ }
99
+ /**
100
+ * The settings the protected payload builder reads for a cloud record (the socket row source's default
101
+ * transport builds the createScript payload through the technical-script control): the wire identity
102
+ * (`wrunRef`) and the capability's slug (wrunCustomScriptSlug, the `scriptId` tharamine binds the tuple
103
+ * to) from the registry identity, and the protected discriminator the builder keys its wire on. With
104
+ * the sheet the source runs, its params ride as `wrunSheet` too: the socket worker's session identity
105
+ * reads a param's `style` there (wrun-style-row-rule `wrunStyleTierSheetOf`, lane parity C6), so an om
106
+ * style knob stays paint-only on the cloud as in the browser. Never persisted, never written on the
107
+ * record. A record without a pinned registry identity passes through.
108
+ */
109
+ export function wrunSocketPayloadSettings(settings, sheet) {
110
+ const ref = wrunRegistryRefOf(settings);
111
+ if (ref === undefined || ref.version === '')
112
+ return settings;
113
+ const tuple = { package: ref.package, version: ref.version };
114
+ return {
115
+ ...settings,
116
+ isProtectedScript: true,
117
+ customScriptId: wrunCustomScriptSlug(tuple.package, tuple.version),
118
+ wrunRef: tuple,
119
+ ...(Array.isArray(sheet?.params) ? { wrunSheet: { params: sheet.params } } : {}),
120
+ };
121
+ }
@@ -79,7 +79,7 @@
79
79
  * any other number, a width or an opacity, is no colour and stays), so a
80
80
  * colour param bound through `style_targets` and a `colors` row paint either.
81
81
  */
82
- import { isEqual } from 'lodash-es';
82
+ import isEqual from 'lodash-es/isEqual.js';
83
83
  import { HEATMAP_SENSITIVITY_MAX, HEATMAP_SENSITIVITY_MIN } from '../indicators/heatmap-sensitivity.util.js';
84
84
  import { WRUN_SOURCE_FIELD_WORDS, wrunInputGateOn } from './wrun-market-facts.util.js';
85
85
  import { wrunParamValuesFromSettings } from './wrun-param-values.util.js';
@@ -0,0 +1,95 @@
1
+ export declare const WRUN_DAILY_LANE_DAY_MS: any;
2
+ /** The lane's own interval on every chart (an `Intervals.map_unit` key). */
3
+ export declare const WRUN_DAILY_LANE_INTERVAL_KEY = "1d";
4
+ /** What a chart bar reads off the day rows: see the module doc. */
5
+ export type WrunDailyLanding = 'sum' | 'last';
6
+ /** The UTC day (midnight, ms) a ts belongs to. */
7
+ export declare function wrunDailyLaneDayStart(ts: number): number;
8
+ /**
9
+ * The raw observation a daily column brings to the chart row opening at `ts` on a grid of
10
+ * `intervalMs`, off the lane rows indexed by day (`byDay` maps a day start to its row).
11
+ * Intraday or daily grid, either landing: the day's value on the first bar of its day only (a
12
+ * later bar of the day reads NaN, for the input's `missing` policy to fill): the bar opening
13
+ * inside the day's first interval, or the one whose predecessor on the chart (`previousBarTs`)
14
+ * belongs to an earlier day (see the module doc). A grid coarser than a day: `sum` adds the
15
+ * days that open inside the bar, `last` reads the newest of them that reported; NaN when none
16
+ * did. The bar's days end where the next chart bar opens (`nextBarTs`), else at its calendar
17
+ * end (`candleBarEndMs`), so a month bar holds its own month and nothing of the next.
18
+ */
19
+ export declare function wrunDailyLaneObservation(byDay: ReadonlyMap<number, ArrayLike<number>>, column: number, ts: number, intervalMs: number, landing: WrunDailyLanding, previousBarTs?: number, nextBarTs?: number, nowMs?: number): number;
20
+ /**
21
+ * The newest finite value of a daily column at or before the chart row opening at `ts` (its
22
+ * own day on an intraday or daily grid, its last day on a coarser one: the day before the next
23
+ * chart bar opens, `nextBarTs`, else before its calendar end, `candleBarEndMs`), off the lane's
24
+ * FULL rows (ascending): what a `last` landing reads under the `carry` policy on a bar that
25
+ * brings no observation of its own. NaN when no row at or before that day reported the column.
26
+ * A binary search to the day, then back over the rows that did not report the column.
27
+ */
28
+ export declare function wrunDailyLaneAsOf(rows: ReadonlyArray<ArrayLike<number>>, column: number, ts: number, intervalMs: number, nextBarTs?: number, nowMs?: number): number;
29
+ /**
30
+ * What a daily column offers the chart row opening at `ts` BEFORE the input's `missing` policy
31
+ * is applied: the row's own observation (`wrunDailyLaneObservation` over `byDay`, the window's
32
+ * day index) and, for a `last` landing whose input rides the `carry` policy (`carries`), the
33
+ * newest value at or before the row when it brings none of its own (`wrunDailyLaneAsOf` over
34
+ * `rows`, the lane's full rows). A `sum` landing and the `nan` / `zero` policies read the own
35
+ * observation alone. A pure function of the rows, the bar, its neighbors on the chart
36
+ * (`previousBarTs`, `nextBarTs`) and the build's clock (`nowMs`, the forming bar's reach), so a
37
+ * tail build reads what the full build read.
38
+ */
39
+ export declare function wrunDailyLaneRead(byDay: ReadonlyMap<number, ArrayLike<number>>, rows: ReadonlyArray<ArrayLike<number>>, column: number, ts: number, intervalMs: number, landing: WrunDailyLanding, carries: boolean, previousBarTs?: number, nextBarTs?: number, nowMs?: number): number;
40
+ /**
41
+ * Whether two versions of a daily lane's rows stand the same at the head of a window whose
42
+ * first day is `firstDayTs`: for every column, the newest finite value BEFORE that day is the
43
+ * same in both. That value is all a session reads of the rows older than its window
44
+ * (`wrunDailyLaneAsOf` hands it to a `last` landing's bars under `carry` until a day of the
45
+ * window reports); a change among the rows behind it reaches no bar. `same` is the caller's
46
+ * notion of two finite values that did not change.
47
+ */
48
+ export declare function wrunDailyLaneHeadEqual(before: ReadonlyArray<ArrayLike<unknown>>, after: ReadonlyArray<ArrayLike<unknown>>, firstDayTs: number, same?: (a: number, b: number) => boolean): boolean;
49
+ /**
50
+ * Index day rows by their UTC day, only those at or after the day `fromTs` belongs to, walking
51
+ * back from the end (lanes are ascending): a tail opening mid-day still reads its own day's
52
+ * row. The LAST row of a day wins, as in a forward walk.
53
+ */
54
+ export declare function indexWrunDailyLaneTail<T extends ArrayLike<unknown>>(rows: ReadonlyArray<T> | undefined, fromTs: number): Map<number, T>;
55
+ /**
56
+ * Where a daily lane's fetch window opens for a chart window opening at `fromTs`: the day the
57
+ * first row belongs to (a chart opening mid-day still reads its own day's row), `lookbackDays`
58
+ * days earlier when a `last` lane reads the observation standing at the window's head (a
59
+ * series reported weekly or monthly has none inside a short intraday window). The full run
60
+ * opens there for the chart window.
61
+ */
62
+ export declare function wrunDailyLaneFetchFrom(fromTs: number, lookbackDays?: number): number;
63
+ /**
64
+ * Where a daily lane's full-run fetch window closes for a chart whose last bar opens at
65
+ * `lastBarTs` on a grid of `intervalMs`. An intraday or daily chart closes it at that open, as
66
+ * every lane does: the fetch is inclusive of its last source bar (`dataFetch` pads one source
67
+ * interval, a day), which is the day the bar opens in. A bar coarser than a day holds more days
68
+ * than that one, so the window closes at the bar's END (`candleBarEndMs`): the days of the
69
+ * forming week, month, quarter or year after its open are asked too. Closing at the open made a
70
+ * `last` landing read a stale value on the forming bar (and a `sum` landing miss its later days)
71
+ * until the first live reconcile, which already asks through the forming bar's end. The end of a
72
+ * forming bar lies in the future: `dataFetch` turns the window into a period and neither clamps
73
+ * nor refuses it, and a window that does not move with the clock keeps the request identity
74
+ * stable through the bar.
75
+ */
76
+ export declare function wrunDailyLaneFetchTo(lastBarTs: number, intervalMs: number, nowMs?: number): number;
77
+ /**
78
+ * Where a daily lane's live RECONCILE closes on a chart of `intervalMs` whose chart-bar window
79
+ * closes at `toTs`: there, or on a chart coarser than a day the day after the clock's day when
80
+ * `toTs` has passed (the forming bar of a session grid reaches through today, and its days must
81
+ * be asked: a 3-day equity bar opened Friday still forms on Tuesday while the window closed on
82
+ * Monday). On a contiguous grid the window always closes ahead of the clock.
83
+ */
84
+ export declare function wrunDailyLaneReconcileTo(toTs: number, intervalMs: number, nowMs: number): number;
85
+ /**
86
+ * Where a daily lane's live RECONCILE opens (its ask, and its answer's authority) for the
87
+ * chart-bar window opening at `fromTs`, in a session whose first row is `sessionFirstRowTs`:
88
+ * where a full run would open for that window (its day, `lookbackDays` earlier: the
89
+ * publication-lag horizon), but never before the session's own full run opened
90
+ * (`fullRunLookbackDays` before the first row's day; a lane whose full run reaches less far
91
+ * back than its reconcile, as the ETF lane's does, names it). A reconcile reaching past the
92
+ * rows the full run fetched (a chart shorter than the lookback, a session shorter than the
93
+ * reconcile tail) would install days no bar of the session reads and report them as revised.
94
+ */
95
+ export declare function wrunDailyLaneReconcileFrom(fromTs: number, sessionFirstRowTs: number, lookbackDays?: number, fullRunLookbackDays?: number): number;
@@ -0,0 +1,297 @@
1
+ /**
2
+ * A DAILY series on the chart grid: the rules every lane whose rows are one per UTC day shares,
3
+ * whatever the chart's interval. `etf_flow` (wrun-etf-flow-lane.util) and the daily joins of the
4
+ * poll-lane registry (`sources/`, `join: { kind: 'daily', ... }`) read them from here.
5
+ *
6
+ * Rows are `[dayTs, ...columns]`, ascending, stamped inside their UTC day (the gateway stamps
7
+ * 00:00 UTC of the day). Two landings decide what a chart bar brings:
8
+ *
9
+ * - `sum` (flows: `etf_flow`): the day's value lands on the FIRST bar of its day; the later
10
+ * bars of that day bring no observation of their own and follow the input's `missing` policy
11
+ * (`carry` repeats the value across the day, `nan` and `zero` leave a one-bar spike); a daily
12
+ * chart joins row for row; a bar coarser than a day SUMS the days that open inside it.
13
+ * - `last` (levels: a premium rate, a balance, a published observation): the same first-bar
14
+ * landing on an intraday or daily chart, and a bar coarser than a day reads its LAST day that
15
+ * reported. Under the default `carry` policy a bar with no observation of its own reads the
16
+ * newest value at or before its day (`wrunDailyLaneAsOf`), straight off the lane rows: the
17
+ * window's first bars read the day they open inside (or the last observation before the
18
+ * window, when the lane fetched one), and a day whose first bar the chart does not hold (a
19
+ * session gap) still reaches the bars after it. `nan` and `zero` keep the one-bar landing.
20
+ *
21
+ * The lane asks its own DAY interval on every chart (`WRUN_DAILY_LANE_INTERVAL_KEY`: the
22
+ * gateway serves these series at DAY, and `dataFetch` judges the restriction table at that
23
+ * interval), over a window opened at the first row's day (`wrunDailyLaneFetchFrom`; a `last`
24
+ * lane may reach further back for the observation standing at the window's head) and closed at
25
+ * the last bar's open, or at its END on a chart coarser than a day (`wrunDailyLaneFetchTo`: the
26
+ * forming week or month holds days after its open). A live reconcile re-asks from where the
27
+ * full run would open for its own chart-bar window (`wrunDailyLaneReconcileFrom`, the same
28
+ * lookback), never before the session's full run did: a day row is stamped at its midnight,
29
+ * before the chart-bar window it revises, and a row is often published after its stamp date (a
30
+ * daily rate prints the next business day, a monthly series weeks later), so the lookback is
31
+ * the publication-lag horizon. A changed or backdated day is detected over that whole window,
32
+ * as far as a bar can read it: a day of the session by its own row, the rows before the
33
+ * session's first day through the one value standing at its head (`wrunDailyLaneHeadEqual`).
34
+ *
35
+ * The day's FIRST bar is the bar opening inside the day's first interval (a chart whose days
36
+ * open at midnight), or the first bar the chart HOLDS in that day: the one whose predecessor on
37
+ * the chart belongs to an earlier day. A stock session opens at 13:30 UTC, a forex week on
38
+ * Sunday evening, a thin pool prints when it trades, and any chart may miss its midnight bar;
39
+ * the row builder hands the bar before each row (`previousBarTs`), so the landing is a function
40
+ * of the chart's rows and a tail build reads what the full build read. The first row of the
41
+ * chart window has no bar before it and lands by the first rule alone (a window opening
42
+ * mid-day does not take the day's value).
43
+ *
44
+ * A bar coarser than a day ends where the next one opens: the next chart row when the row
45
+ * builder holds it (`nextBarTs`), else its calendar end (`candleBarEndMs`, the chart's own
46
+ * rule: a week is a fixed length, a month, quarter or year bar follows the calendar; the
47
+ * chart's `intervalMs` for those is an average, 30.4375 days a month, so `ts + intervalMs`
48
+ * would run a February into March). The next row matters on a session grid: a 3-day equity
49
+ * bar holds three TRADING days (Thursday, Friday, Monday) and the next bar opens on Tuesday,
50
+ * so its calendar end (Sunday) would drop Monday's observation. The forming bar has no next
51
+ * row: it takes its calendar end, or the day after the clock's day when that end has passed
52
+ * (`nowMs`: the forming Friday bar of that grid still forms on Tuesday, so Monday's and
53
+ * Tuesday's days are its own, and the fetch windows reach the same day, `wrunDailyLaneFetchTo`
54
+ * and `wrunDailyLaneReconcileTo`). A contiguous grid's forming bar always ends ahead of the
55
+ * clock, so nothing changes there.
56
+ *
57
+ * Pure: no store, no chart instance. Every function is total over malformed rows (a non-finite
58
+ * stamp or cell is no observation).
59
+ */
60
+ import { Intervals } from '../../constants/interval.constants.js';
61
+ import { candleBarEndMs } from '../chart/candle-bar-end.util.js';
62
+ export const WRUN_DAILY_LANE_DAY_MS = Intervals.DAY;
63
+ /** The lane's own interval on every chart (an `Intervals.map_unit` key). */
64
+ export const WRUN_DAILY_LANE_INTERVAL_KEY = '1d';
65
+ /** The UTC day (midnight, ms) a ts belongs to. */
66
+ export function wrunDailyLaneDayStart(ts) {
67
+ return Math.floor(ts / WRUN_DAILY_LANE_DAY_MS) * WRUN_DAILY_LANE_DAY_MS;
68
+ }
69
+ /** One row's cell as a number; an absent cell (null, undefined) is no observation, never 0. */
70
+ function dailyCell(row, column) {
71
+ const cell = row?.[column];
72
+ return cell === null || cell === undefined ? Number.NaN : Number(cell);
73
+ }
74
+ /**
75
+ * The raw observation a daily column brings to the chart row opening at `ts` on a grid of
76
+ * `intervalMs`, off the lane rows indexed by day (`byDay` maps a day start to its row).
77
+ * Intraday or daily grid, either landing: the day's value on the first bar of its day only (a
78
+ * later bar of the day reads NaN, for the input's `missing` policy to fill): the bar opening
79
+ * inside the day's first interval, or the one whose predecessor on the chart (`previousBarTs`)
80
+ * belongs to an earlier day (see the module doc). A grid coarser than a day: `sum` adds the
81
+ * days that open inside the bar, `last` reads the newest of them that reported; NaN when none
82
+ * did. The bar's days end where the next chart bar opens (`nextBarTs`), else at its calendar
83
+ * end (`candleBarEndMs`), so a month bar holds its own month and nothing of the next.
84
+ */
85
+ export function wrunDailyLaneObservation(byDay, column, ts, intervalMs, landing, previousBarTs, nextBarTs, nowMs) {
86
+ if (!Number.isFinite(ts) || !(intervalMs > 0))
87
+ return Number.NaN;
88
+ if (intervalMs > WRUN_DAILY_LANE_DAY_MS) {
89
+ const endTs = wrunDailyLaneBarEnd(ts, intervalMs, nextBarTs, nowMs);
90
+ let firstDay = wrunDailyLaneDayStart(ts);
91
+ if (firstDay < ts)
92
+ firstDay += WRUN_DAILY_LANE_DAY_MS;
93
+ if (landing === 'last') {
94
+ for (let day = wrunDailyLaneDayStart(endTs - 1); day >= firstDay; day -= WRUN_DAILY_LANE_DAY_MS) {
95
+ const value = dailyCell(byDay.get(day), column);
96
+ if (Number.isFinite(value))
97
+ return value;
98
+ }
99
+ return Number.NaN;
100
+ }
101
+ let sum = Number.NaN;
102
+ for (let day = firstDay; day < endTs; day += WRUN_DAILY_LANE_DAY_MS) {
103
+ const value = dailyCell(byDay.get(day), column);
104
+ if (Number.isFinite(value))
105
+ sum = Number.isFinite(sum) ? sum + value : value;
106
+ }
107
+ return sum;
108
+ }
109
+ const day = wrunDailyLaneDayStart(ts);
110
+ const opensDay = ts - day < intervalMs ||
111
+ (previousBarTs !== undefined && Number.isFinite(previousBarTs) && wrunDailyLaneDayStart(previousBarTs) < day);
112
+ if (!opensDay)
113
+ return Number.NaN;
114
+ return dailyCell(byDay.get(day), column);
115
+ }
116
+ /** The day after the one `nowMs` belongs to (midnight, ms); undefined without a finite clock. */
117
+ function dayAfterNow(nowMs) {
118
+ if (nowMs === undefined || !Number.isFinite(nowMs))
119
+ return undefined;
120
+ return wrunDailyLaneDayStart(nowMs) + WRUN_DAILY_LANE_DAY_MS;
121
+ }
122
+ /** Where a bar coarser than a day ends: the next chart bar's open when known, else the bar's
123
+ * calendar end, or the day after the clock's day when that end has passed (the forming bar of
124
+ * a session grid, the module doc). A next bar at or before the open is no bound. */
125
+ function wrunDailyLaneBarEnd(ts, intervalMs, nextBarTs, nowMs) {
126
+ if (nextBarTs !== undefined && Number.isFinite(nextBarTs) && nextBarTs > ts)
127
+ return nextBarTs;
128
+ const calendarEnd = candleBarEndMs(ts, intervalMs);
129
+ const tomorrow = dayAfterNow(nowMs);
130
+ return tomorrow !== undefined && tomorrow > calendarEnd ? tomorrow : calendarEnd;
131
+ }
132
+ /**
133
+ * The newest finite value of a daily column at or before the chart row opening at `ts` (its
134
+ * own day on an intraday or daily grid, its last day on a coarser one: the day before the next
135
+ * chart bar opens, `nextBarTs`, else before its calendar end, `candleBarEndMs`), off the lane's
136
+ * FULL rows (ascending): what a `last` landing reads under the `carry` policy on a bar that
137
+ * brings no observation of its own. NaN when no row at or before that day reported the column.
138
+ * A binary search to the day, then back over the rows that did not report the column.
139
+ */
140
+ export function wrunDailyLaneAsOf(rows, column, ts, intervalMs, nextBarTs, nowMs) {
141
+ if (!Number.isFinite(ts) || !(intervalMs > 0))
142
+ return Number.NaN;
143
+ const lastDay = wrunDailyLaneDayStart(intervalMs > WRUN_DAILY_LANE_DAY_MS ? wrunDailyLaneBarEnd(ts, intervalMs, nextBarTs, nowMs) - 1 : ts);
144
+ const endTs = lastDay + WRUN_DAILY_LANE_DAY_MS;
145
+ let low = 0;
146
+ let high = rows.length;
147
+ while (low < high) {
148
+ const mid = (low + high) >>> 1;
149
+ if (Number(rows[mid][0]) < endTs)
150
+ low = mid + 1;
151
+ else
152
+ high = mid;
153
+ }
154
+ for (let at = low - 1; at >= 0; at -= 1) {
155
+ const value = dailyCell(rows[at], column);
156
+ if (Number.isFinite(value))
157
+ return value;
158
+ }
159
+ return Number.NaN;
160
+ }
161
+ /**
162
+ * What a daily column offers the chart row opening at `ts` BEFORE the input's `missing` policy
163
+ * is applied: the row's own observation (`wrunDailyLaneObservation` over `byDay`, the window's
164
+ * day index) and, for a `last` landing whose input rides the `carry` policy (`carries`), the
165
+ * newest value at or before the row when it brings none of its own (`wrunDailyLaneAsOf` over
166
+ * `rows`, the lane's full rows). A `sum` landing and the `nan` / `zero` policies read the own
167
+ * observation alone. A pure function of the rows, the bar, its neighbors on the chart
168
+ * (`previousBarTs`, `nextBarTs`) and the build's clock (`nowMs`, the forming bar's reach), so a
169
+ * tail build reads what the full build read.
170
+ */
171
+ export function wrunDailyLaneRead(byDay, rows, column, ts, intervalMs, landing, carries, previousBarTs, nextBarTs, nowMs) {
172
+ const own = wrunDailyLaneObservation(byDay, column, ts, intervalMs, landing, previousBarTs, nextBarTs, nowMs);
173
+ if (Number.isFinite(own) || landing !== 'last' || !carries)
174
+ return own;
175
+ return wrunDailyLaneAsOf(rows, column, ts, intervalMs, nextBarTs, nowMs);
176
+ }
177
+ /**
178
+ * Whether two versions of a daily lane's rows stand the same at the head of a window whose
179
+ * first day is `firstDayTs`: for every column, the newest finite value BEFORE that day is the
180
+ * same in both. That value is all a session reads of the rows older than its window
181
+ * (`wrunDailyLaneAsOf` hands it to a `last` landing's bars under `carry` until a day of the
182
+ * window reports); a change among the rows behind it reaches no bar. `same` is the caller's
183
+ * notion of two finite values that did not change.
184
+ */
185
+ export function wrunDailyLaneHeadEqual(before, after, firstDayTs, same = (a, b) => a === b) {
186
+ const was = dailyLaneHead(before, firstDayTs);
187
+ const now = dailyLaneHead(after, firstDayTs);
188
+ for (let column = 1; column < Math.max(was.length, now.length); column += 1) {
189
+ const a = was[column];
190
+ const b = now[column];
191
+ if (a === undefined && b === undefined)
192
+ continue;
193
+ if (a === undefined || b === undefined || !same(a, b))
194
+ return false;
195
+ }
196
+ return true;
197
+ }
198
+ /** The newest finite value of every column among the rows stamped before `firstDayTs`, by
199
+ * column index (a column no such row reported stays undefined). */
200
+ function dailyLaneHead(rows, firstDayTs) {
201
+ const head = [];
202
+ for (let at = rows.length - 1; at >= 0; at -= 1) {
203
+ const row = rows[at];
204
+ const ts = Number(row[0]);
205
+ if (!Number.isFinite(ts) || ts >= firstDayTs)
206
+ continue;
207
+ for (let column = 1; column < row.length; column += 1) {
208
+ if (head[column] !== undefined)
209
+ continue;
210
+ const value = dailyCell(row, column);
211
+ if (Number.isFinite(value))
212
+ head[column] = value;
213
+ }
214
+ }
215
+ return head;
216
+ }
217
+ /**
218
+ * Index day rows by their UTC day, only those at or after the day `fromTs` belongs to, walking
219
+ * back from the end (lanes are ascending): a tail opening mid-day still reads its own day's
220
+ * row. The LAST row of a day wins, as in a forward walk.
221
+ */
222
+ export function indexWrunDailyLaneTail(rows, fromTs) {
223
+ const byDay = new Map();
224
+ if (!rows)
225
+ return byDay;
226
+ const fromDay = wrunDailyLaneDayStart(fromTs);
227
+ for (let at = rows.length - 1; at >= 0; at -= 1) {
228
+ const row = rows[at];
229
+ const ts = Number(row[0]);
230
+ if (!Number.isFinite(ts))
231
+ continue;
232
+ const day = wrunDailyLaneDayStart(ts);
233
+ if (day < fromDay)
234
+ break;
235
+ if (!byDay.has(day))
236
+ byDay.set(day, row);
237
+ }
238
+ return byDay;
239
+ }
240
+ /**
241
+ * Where a daily lane's fetch window opens for a chart window opening at `fromTs`: the day the
242
+ * first row belongs to (a chart opening mid-day still reads its own day's row), `lookbackDays`
243
+ * days earlier when a `last` lane reads the observation standing at the window's head (a
244
+ * series reported weekly or monthly has none inside a short intraday window). The full run
245
+ * opens there for the chart window.
246
+ */
247
+ export function wrunDailyLaneFetchFrom(fromTs, lookbackDays = 0) {
248
+ const days = Number.isFinite(lookbackDays) && lookbackDays > 0 ? Math.floor(lookbackDays) : 0;
249
+ return wrunDailyLaneDayStart(fromTs) - days * WRUN_DAILY_LANE_DAY_MS;
250
+ }
251
+ /**
252
+ * Where a daily lane's full-run fetch window closes for a chart whose last bar opens at
253
+ * `lastBarTs` on a grid of `intervalMs`. An intraday or daily chart closes it at that open, as
254
+ * every lane does: the fetch is inclusive of its last source bar (`dataFetch` pads one source
255
+ * interval, a day), which is the day the bar opens in. A bar coarser than a day holds more days
256
+ * than that one, so the window closes at the bar's END (`candleBarEndMs`): the days of the
257
+ * forming week, month, quarter or year after its open are asked too. Closing at the open made a
258
+ * `last` landing read a stale value on the forming bar (and a `sum` landing miss its later days)
259
+ * until the first live reconcile, which already asks through the forming bar's end. The end of a
260
+ * forming bar lies in the future: `dataFetch` turns the window into a period and neither clamps
261
+ * nor refuses it, and a window that does not move with the clock keeps the request identity
262
+ * stable through the bar.
263
+ */
264
+ export function wrunDailyLaneFetchTo(lastBarTs, intervalMs, nowMs) {
265
+ if (!Number.isFinite(lastBarTs) || !(intervalMs > WRUN_DAILY_LANE_DAY_MS))
266
+ return lastBarTs;
267
+ return wrunDailyLaneBarEnd(lastBarTs, intervalMs, undefined, nowMs);
268
+ }
269
+ /**
270
+ * Where a daily lane's live RECONCILE closes on a chart of `intervalMs` whose chart-bar window
271
+ * closes at `toTs`: there, or on a chart coarser than a day the day after the clock's day when
272
+ * `toTs` has passed (the forming bar of a session grid reaches through today, and its days must
273
+ * be asked: a 3-day equity bar opened Friday still forms on Tuesday while the window closed on
274
+ * Monday). On a contiguous grid the window always closes ahead of the clock.
275
+ */
276
+ export function wrunDailyLaneReconcileTo(toTs, intervalMs, nowMs) {
277
+ if (!Number.isFinite(toTs) || !(intervalMs > WRUN_DAILY_LANE_DAY_MS))
278
+ return toTs;
279
+ const tomorrow = dayAfterNow(nowMs);
280
+ return tomorrow !== undefined && tomorrow > toTs ? tomorrow : toTs;
281
+ }
282
+ /**
283
+ * Where a daily lane's live RECONCILE opens (its ask, and its answer's authority) for the
284
+ * chart-bar window opening at `fromTs`, in a session whose first row is `sessionFirstRowTs`:
285
+ * where a full run would open for that window (its day, `lookbackDays` earlier: the
286
+ * publication-lag horizon), but never before the session's own full run opened
287
+ * (`fullRunLookbackDays` before the first row's day; a lane whose full run reaches less far
288
+ * back than its reconcile, as the ETF lane's does, names it). A reconcile reaching past the
289
+ * rows the full run fetched (a chart shorter than the lookback, a session shorter than the
290
+ * reconcile tail) would install days no bar of the session reads and report them as revised.
291
+ */
292
+ export function wrunDailyLaneReconcileFrom(fromTs, sessionFirstRowTs, lookbackDays = 0, fullRunLookbackDays = lookbackDays) {
293
+ const from = wrunDailyLaneFetchFrom(fromTs, lookbackDays);
294
+ if (!Number.isFinite(sessionFirstRowTs))
295
+ return from;
296
+ return Math.max(from, wrunDailyLaneFetchFrom(sessionFirstRowTs, fullRunLookbackDays));
297
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Deadline wrapper for the WRUN add/run chain.
3
+ *
4
+ * The registry add path (ported-row click, add-by-name, registry row,
5
+ * rehydrate) awaits work with no intrinsic bound: network fetches, the chart
6
+ * store's mount pipeline, and the kScript source fetch lanes (a V2 stream only
7
+ * settles when the wire answers). Any one of them hanging left the UI pinned
8
+ * in its in-flight state forever ("Checking availability..." with no outcome,
9
+ * the shipped wrun-tab hang). Every await on that chain now races a deadline:
10
+ * the underlying work is not cancelled (fetches and mounts are not idempotent
11
+ * to abort), but the CALLER always settles, so the row always leaves its
12
+ * checking state with a user-visible outcome.
13
+ *
14
+ * Deadlines are ceilings against "forever", not latency budgets: each is far
15
+ * above the lane's healthy worst case (mount was observed taking ~25s when
16
+ * metadata RPCs ride their own 30s timeouts), so a trip means genuinely hung
17
+ * work, and the error message names the phase that hung.
18
+ *
19
+ * Two clocks, one per kind of phase. A NETWORK phase (the registry resolve and
20
+ * download, a source fetch) is answered whether or not anyone looks, so it
21
+ * counts wall time: a hidden tab whose reply never comes still times out. An
22
+ * APPLY phase (the mount, the first run up to its commit) is work a hidden tab
23
+ * holds back (the candle commit and the apply wait for a visible frame), so it
24
+ * counts visible time (visible-timeout.util): a chart restored in a background
25
+ * tab never reads "Did not load in time" nor records a `timeout`, and a stall
26
+ * the user watches still trips after the same budget. The apply phases' own
27
+ * network legs keep their wall-clock deadlines inside them.
28
+ */
29
+ /** The clock a deadline counts on: `wall` for a network phase, `visible` for an apply phase. */
30
+ export type WrunDeadlineClock = 'wall' | 'visible';
31
+ /** Downloading + verifying a package from the registry (resolve, tarball). A network phase. */
32
+ export declare const WRUN_DOWNLOAD_DEADLINE_MS = 45000;
33
+ /** The one LATENCY budget here: the resolve of a built-in's proven twin
34
+ * (option A, wrun-proven-twin-add.util). That Add has the shipped template
35
+ * to fall back on, so a registry that accepts the connection and never
36
+ * answers holds the click a few seconds, never the download ceiling above;
37
+ * the resolve keeps running in its memo, so a later click finds it. */
38
+ export declare const WRUN_TWIN_RESOLVE_DEADLINE_MS = 4000;
39
+ /** Mounting the overlay through chartStore.addIndicator. An apply phase (visible time). */
40
+ export declare const WRUN_MOUNT_DEADLINE_MS = 60000;
41
+ /** One full compute pass (source fetches + sandbox run + integration). An
42
+ * apply phase (visible time): its source fetches carry their own wall-clock
43
+ * deadline below. */
44
+ export declare const WRUN_RUN_DEADLINE_MS = 90000;
45
+ /** One kScript source fetch lane inside the run (book/trades/oi/vp/liq/
46
+ * funding/iv/skew). A network phase. */
47
+ export declare const WRUN_SOURCE_FETCH_DEADLINE_MS = 45000;
48
+ /** Await `promise`, but reject with a labeled WrunDeadlineError if it has not
49
+ * settled within `ms` on `clock` (wall time unless the phase is an apply
50
+ * phase). The losing promise is left running with its eventual rejection
51
+ * marked handled (no unhandled-rejection noise). */
52
+ export declare function withWrunDeadline<T>(promise: Promise<T>, ms: number, label: string, clock?: WrunDeadlineClock): Promise<T>;