@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
@@ -29,11 +29,22 @@
29
29
  * - `details` keeps the raiser's technical text for Copy details; a run-failed `generic` or `code`
30
30
  * record also shows its first line under the sentence (`wrunRefusalDetailOf`), since its sentence
31
31
  * cannot name the cause.
32
+ * - What produced the failure is one closed word (`wrunFailureCauseOf`, the set in wrun-failure-cause),
33
+ * which the record carries at `telemetry.cause` when it is not `none`: the transient grace reads it
34
+ * there, and the three failure events (`feature:failed`, `wrun_lane_mount`, `wrun_failure_shown`)
35
+ * name the cause the record names.
32
36
  */
33
37
  import { Intervals } from '../../constants/interval.constants.js';
34
38
  import { isCalendarIntervalLabel } from '../chart/calendar-interval.util.js';
35
- import { WRUN_KIT_REFUSAL_STAGES, WRUN_NO_CANDLES_CODE, wrunFrameRefusalOf, wrunKitRefusalStageOf, wrunServerAnswerOfText, } from './wrun-hosted-wire-caps.js';
36
- import { WrunDeadlineError, WrunNoBarsError, WrunQuarantinedError, WrunSourceDataUnavailableError, WrunWorkerPoisonError, } from './wrun-registry-errors.util.js';
39
+ import { isWrunFailureCause, isWrunTransientFailureCause, wrunServerFailureCause, } from './wrun-failure-cause.js';
40
+ import { WRUN_KIT_REFUSAL_STAGES, WRUN_NO_CANDLES_CODE, wrunFrameRefusalOf, wrunKitRefusalStageOf, wrunServerAnswerOfText, wrunServerAnswerVerdict, } from './wrun-hosted-wire-caps.js';
41
+ import { WrunDeadlineError, WrunIntegrationError, WrunNoBarsError, WrunProvenTwinDeclinedError, WrunQuarantinedError, WrunRegistryAddRefusedError, WrunRegistryHostedOnlyError, WrunSourceDataUnavailableError, WrunWorkerPoisonError, } from './wrun-registry-errors.util.js';
42
+ /** Every stop reason, closed: the class spec walks it, and a reason without a variant row fails it. */
43
+ export const WRUN_OPTIONS_STOP_REASONS = Object.freeze([
44
+ 'session-elsewhere',
45
+ 'chart-kind',
46
+ 'flag-off',
47
+ ]);
37
48
  /** Every class, in the C2 precedence order (paused before note decides first). */
38
49
  export const WRUN_REFUSAL_CLASSES = Object.freeze([
39
50
  'cme-wall',
@@ -41,6 +52,7 @@ export const WRUN_REFUSAL_CLASSES = Object.freeze([
41
52
  'not-added',
42
53
  'pin-refused',
43
54
  'no-options',
55
+ 'options-stopped',
44
56
  'coin-outside-feed',
45
57
  'interval-unserved',
46
58
  'feed-missing',
@@ -72,6 +84,8 @@ export const WRUN_REFUSAL_EVENT_MARKET_KEY = 'wrun.refusal.market.event';
72
84
  export const WRUN_REFUSAL_FEED_KEYS = Object.freeze({
73
85
  ohlcv: 'wrun.refusal.feed.ohlcv',
74
86
  candles: 'wrun.refusal.feed.candles',
87
+ oi_candles: 'wrun.refusal.feed.oiCandles',
88
+ volume_profile_candles: 'wrun.refusal.feed.volumeProfileCandles',
75
89
  intrabar: 'wrun.refusal.feed.intrabar',
76
90
  odds: 'wrun.refusal.feed.odds',
77
91
  time: 'wrun.refusal.feed.time',
@@ -98,18 +112,41 @@ export const WRUN_REFUSAL_FEED_KEYS = Object.freeze({
98
112
  long_short_ratio: 'wrun.refusal.feed.longShortRatio',
99
113
  options_oi: 'wrun.refusal.feed.optionsOi',
100
114
  options_volume: 'wrun.refusal.feed.optionsVolume',
115
+ options_flow: 'wrun.refusal.feed.optionsFlow',
116
+ option_daily: 'wrun.refusal.feed.optionDaily',
117
+ option_stats_10m: 'wrun.refusal.feed.optionStats10m',
101
118
  token_supply: 'wrun.refusal.feed.tokenSupply',
102
119
  treasury_balance: 'wrun.refusal.feed.treasuryBalance',
103
120
  volatility_index: 'wrun.refusal.feed.volatilityIndex',
104
121
  series: 'wrun.refusal.feed.series',
105
122
  });
123
+ /** The feed words a source-lane descriptor names for itself (a row lane's `feedWords`, keyed by its lane key),
124
+ * registered by its registry at load (`registerWrunRefusalFeedKeys`), so a new lane needs no row above. */
125
+ let laneFeedKeys = Object.freeze({});
126
+ /** Replace the descriptor-registered feed words (the row-lane registry's, at load and in its spec hook). A
127
+ * word the table above holds keeps the table's key. */
128
+ export function registerWrunRefusalFeedKeys(keys) {
129
+ laneFeedKeys = Object.freeze({ ...keys });
130
+ }
106
131
  /** The full literal key of a feed's words, or undefined for a word that names no feed. */
107
132
  export function wrunRefusalFeedKey(feed) {
108
- return typeof feed === 'string' && Object.prototype.hasOwnProperty.call(WRUN_REFUSAL_FEED_KEYS, feed)
109
- ? WRUN_REFUSAL_FEED_KEYS[feed]
110
- : undefined;
133
+ if (typeof feed !== 'string')
134
+ return undefined;
135
+ if (Object.prototype.hasOwnProperty.call(WRUN_REFUSAL_FEED_KEYS, feed))
136
+ return WRUN_REFUSAL_FEED_KEYS[feed];
137
+ return Object.prototype.hasOwnProperty.call(laneFeedKeys, feed) ? laneFeedKeys[feed] : undefined;
111
138
  }
112
139
  const row = (sentence, chip, params, extra) => ({ sentence, chip, params, ...extra });
140
+ /**
141
+ * The `options-stopped` rows: ONE row per stop reason, typed by the reason word, so a reason without its own chip is
142
+ * a type error here and a failure of the class spec (tests/utility/wrun/wrun-options-stop.class.spec.ts). Each
143
+ * chip names the reason; none falls back to the generic "did not load" words.
144
+ */
145
+ const OPTIONS_STOPPED_VARIANTS = {
146
+ 'session-elsewhere': row('wrun.refusal.sentence.optionsSessionElsewhere', 'wrun.refusal.chip.optionsSessionElsewhere', ['name']),
147
+ 'chart-kind': row('wrun.refusal.sentence.optionsChartKind', 'wrun.refusal.chip.optionsChartKind', ['name']),
148
+ 'flag-off': row('wrun.refusal.sentence.optionsNotOnAccount', 'wrun.refusal.chip.optionsNotOnAccount', ['name']),
149
+ };
113
150
  /** The C2 table. Keys are full literals (the boot scanner harvests them). */
114
151
  const VARIANTS = {
115
152
  'legs-empty': {
@@ -130,6 +167,12 @@ const VARIANTS = {
130
167
  'market-note': row('wrun.refusal.sentence.feedMissingNote', 'wrun.refusal.chip.feedMissing', ['feed', 'market'], {
131
168
  severity: 'note',
132
169
  }),
170
+ // A lane reading a backend type the installed protocol package does not name yet (`protocol-pending:<TYPE>`,
171
+ // wrun-protocol-pending.util), refused before any fetch: the app itself lacks the feed, whatever the market.
172
+ 'protocol-pending': row('wrun.refusal.sentence.feedProtocolPending', 'wrun.refusal.chip.feedProtocolPending', ['feed'], { severity: 'paused' }),
173
+ // A series the data plane samples for a configured list of underlyings only, the chart's not among them (a lane's
174
+ // answer refused by name, wrun-lane-refusal.leaf `not-in-10m-universe`): a note when the run draws around it.
175
+ 'not-sampled': row('wrun.refusal.sentence.feedNotSampled', 'wrun.refusal.chip.feedNotSampled', ['feed', 'coin']),
133
176
  },
134
177
  'no-options': {
135
178
  venue: row('wrun.refusal.sentence.noOptionsVenue', 'wrun.refusal.chip.noOptions', ['venue', 'coin'], {
@@ -174,6 +217,9 @@ const VARIANTS = {
174
217
  // The cloud's upstream market-data read failed (the error envelope's DATA_UNAVAILABLE, read off a socket frame by
175
218
  // wrunSocketAskFailure): no feed to name, so the envelope's own words and chip, the ones a protected script shows.
176
219
  'market-data': row('kscript.errors.DATA_UNAVAILABLE', 'kscript.legend.labels.DATA_UNAVAILABLE', []),
220
+ // A read the data source keeps switched off for now (a lane's answer refused by name, wrun-lane-refusal.leaf: the
221
+ // OPTION_PRINT_AGG flow scope reads before their switch turns on); a later Retry may bring it.
222
+ 'switched-off': row('wrun.refusal.sentence.feedSwitchedOff', 'wrun.refusal.chip.feedSwitchedOff', ['feed']),
177
223
  },
178
224
  waiting: {
179
225
  default: row('wrun.refusal.sentence.waiting', 'wrun.refusal.chip.waiting', [], { severity: 'note' }),
@@ -284,7 +330,31 @@ const VARIANTS = {
284
330
  severity: 'note',
285
331
  }),
286
332
  },
333
+ // An options lane stopped for a reason the gate, the plane router or the flag check knows.
334
+ 'options-stopped': OPTIONS_STOPPED_VARIANTS,
287
335
  };
336
+ /**
337
+ * The seed of an options lane's stop (the one mapping from a stop reason to its record): the class is
338
+ * `options-stopped` and the variant is the reason itself, so every reason reads its own chip. The way out is the
339
+ * one that works for the reason: take the session back (`session-elsewhere`, on the plane `plane` names, OPRA when
340
+ * absent), the markets the Indicator works on (`chart-kind`, `flag-off`). `severity`: a note when the run drew
341
+ * around the lane, paused when nothing could be drawn.
342
+ */
343
+ export function wrunOptionsStopSeed(reason, opts = {}) {
344
+ const severity = opts.severity !== undefined ? { severity: opts.severity } : {};
345
+ switch (reason) {
346
+ case 'session-elsewhere':
347
+ return {
348
+ cls: 'options-stopped',
349
+ variant: reason,
350
+ out: { kind: 'take-session', plane: opts.plane ?? 'opra' },
351
+ ...severity,
352
+ };
353
+ case 'chart-kind':
354
+ case 'flag-off':
355
+ return { cls: 'options-stopped', variant: reason, out: { kind: 'works-on' }, ...severity };
356
+ }
357
+ }
288
358
  /** The variants of a class, in C2 order (the spec walks every one). */
289
359
  export function wrunRefusalVariants(cls) {
290
360
  return Object.keys(VARIANTS[cls] ?? {});
@@ -332,6 +402,8 @@ function canonicalOut(value) {
332
402
  return typeof value.line === 'number' && Number.isInteger(value.line) && value.line > 0
333
403
  ? { kind: 'go-to-line', line: value.line }
334
404
  : undefined;
405
+ case 'take-session':
406
+ return value.plane === 'cme' || value.plane === 'opra' ? { kind: 'take-session', plane: value.plane } : undefined;
335
407
  case 'works-on':
336
408
  case 'open-settings':
337
409
  case 'retry':
@@ -384,9 +456,18 @@ function canonicalTelemetry(value) {
384
456
  ...(value.unknownCode === true ? { unknownCode: true } : {}),
385
457
  };
386
458
  }
387
- /** Equal records give equal strings: a fixed key order, the params sorted by key, the telemetry last. */
459
+ /** A record's own telemetry in canonical form (`WrunRefusalRecordTelemetry`): its cause when it is a word of the
460
+ * closed set other than `none`, else none at all. */
461
+ function canonicalRecordTelemetry(value) {
462
+ if (!isRecordObject(value))
463
+ return undefined;
464
+ return isWrunFailureCause(value.cause) && value.cause !== 'none' ? { cause: value.cause } : undefined;
465
+ }
466
+ /** Equal records give equal strings: a fixed key order, the params sorted by key, the telemetry last (the join
467
+ * keys, then the record's own cause). */
388
468
  export function serializeWrunRefusal(r) {
389
469
  const market = canonicalMarket(r.market);
470
+ const telemetry = canonicalRecordTelemetry(r.telemetry);
390
471
  return JSON.stringify({
391
472
  v: 1,
392
473
  cls: r.cls,
@@ -398,6 +479,7 @@ export function serializeWrunRefusal(r) {
398
479
  out: canonicalOut(r.out) ?? { kind: 'retry' },
399
480
  details: r.details,
400
481
  ...canonicalTelemetry(r),
482
+ ...(telemetry ? { telemetry } : {}),
401
483
  });
402
484
  }
403
485
  /** The record a value holds (its canonical string, or the object itself), or null for anything
@@ -430,6 +512,7 @@ export function parseWrunRefusal(value) {
430
512
  if (!market)
431
513
  return null;
432
514
  }
515
+ const telemetry = canonicalRecordTelemetry(candidate.telemetry);
433
516
  return {
434
517
  v: 1,
435
518
  cls: candidate.cls,
@@ -441,6 +524,7 @@ export function parseWrunRefusal(value) {
441
524
  out,
442
525
  details: candidate.details,
443
526
  ...canonicalTelemetry(candidate),
527
+ ...(telemetry ? { telemetry } : {}),
444
528
  };
445
529
  }
446
530
  /** C2 precedence: paused before note, then the class order, then the canonical string (a total
@@ -496,22 +580,35 @@ export function wrunRefusalOf(error) {
496
580
  }
497
581
  const TELEMETRY_KEY = 'wrunRefusalTelemetry';
498
582
  /** Stamp what the raiser knows of the answer on the error it throws (the cloud lane's transport: the ask's socket
499
- * stamp, the run attempt, a foreign supersede); the record `wrunRefusalFor` completes carries it. Merged over an
500
- * earlier stamp. A non-object throwable is returned as it is. */
583
+ * stamp, the run attempt, a foreign supersede; a raiser that knows the failure's cause, its word); the record
584
+ * `wrunRefusalFor` completes carries it. Merged over an earlier stamp. A non-object throwable is returned as it is:
585
+ * a raiser wraps one first (`new Error(String(value), { cause: value })`) so the stamp can ride it. */
501
586
  export function stampWrunRefusalTelemetry(error, telemetry) {
502
587
  if (!error || typeof error !== 'object')
503
588
  return error;
504
589
  const held = error[TELEMETRY_KEY];
505
- defineHidden(error, TELEMETRY_KEY, canonicalTelemetry({ ...(isRecordObject(held) ? held : {}), ...telemetry }));
590
+ const merged = { ...(isRecordObject(held) ? held : {}), ...telemetry };
591
+ defineHidden(error, TELEMETRY_KEY, {
592
+ ...canonicalTelemetry(merged),
593
+ ...(isWrunFailureCause(merged.cause) ? { cause: merged.cause } : {}),
594
+ });
506
595
  return error;
507
596
  }
508
- /** The telemetry a raiser stamped on an error (stampWrunRefusalTelemetry), or none. */
597
+ /** The telemetry a raiser stamped on an error (stampWrunRefusalTelemetry): its join keys, or none. The stamped cause
598
+ * is read by `wrunFailureCauseOf` alone. */
509
599
  export function wrunRefusalTelemetryOf(error) {
510
600
  if (!error || typeof error !== 'object')
511
601
  return {};
512
602
  const held = error[TELEMETRY_KEY];
513
603
  return isRecordObject(held) ? canonicalTelemetry(held) : {};
514
604
  }
605
+ /** The cause a raiser stamped on an error (stampWrunRefusalTelemetry), or undefined. */
606
+ function stampedFailureCauseOf(error) {
607
+ if (!error || typeof error !== 'object')
608
+ return undefined;
609
+ const held = error[TELEMETRY_KEY];
610
+ return isRecordObject(held) && isWrunFailureCause(held.cause) ? held.cause : undefined;
611
+ }
515
612
  // ---------------------------------------------------------------------------
516
613
  // The editable rule
517
614
  // ---------------------------------------------------------------------------
@@ -833,8 +930,19 @@ function tpoLetterSeed(letterMinutes, bars, ctx) {
833
930
  return { cls: 'interval-unserved', variant: 'at-most', params: { interval, chartInterval: bars } };
834
931
  }
835
932
  /** Leg classes: an unseeded refusal of theirs names a pinned market the message alone does not
836
- * give, so it keeps the generic words rather than name the chart's market wrongly. */
837
- const LEG_CLASSES = new Set(['ohlcv', 'candles', 'intrabar', 'odds', 'time']);
933
+ * give, so it keeps the generic words rather than name the chart's market wrongly. Every leg stream
934
+ * class is one (`candles`, `oi_candles`, `volume_profile_candles`: hand-copied from the web app's
935
+ * wrun-leg-stream-classes.ts, which the package cannot import; the web spec pins the copy). */
936
+ export const WRUN_REFUSAL_LEG_CLASSES = new Set([
937
+ 'ohlcv',
938
+ 'candles',
939
+ 'oi_candles',
940
+ 'volume_profile_candles',
941
+ 'intrabar',
942
+ 'odds',
943
+ 'time',
944
+ ]);
945
+ const LEG_CLASSES = WRUN_REFUSAL_LEG_CLASSES;
838
946
  /** The lane word of an unseeded "data is unavailable" refusal (`the <lane> source lane`), when it
839
947
  * names a feed of the chart's own market. */
840
948
  function laneFeedOf(message) {
@@ -916,8 +1024,11 @@ const HOST_RULE_RE = /\bWRUN (?:(?:string|frame) slot \d+ write of \d+ bytes|(?:
916
1024
  const NETWORK_FAILURE_RE = /\b(?:Failed to fetch|NetworkError|Load failed|network error|dynamically imported module|Importing a module script failed|ChunkLoadError)\b/i;
917
1025
  /** The failures a second run can get past: the shared sandbox died under the run (its holder's own
918
1026
  * timeout is the run deadline's record) or dropped its live session, a package quarantined on its
919
- * first timeout (the heal waits that one out too), a dropped connection. Every other cause is a
920
- * function of the code, the data and the settings: the planner and the sandbox fail the same way. */
1027
+ * first timeout (the heal waits that one out too), a dropped connection, and any failure whose cause
1028
+ * is transient (wrun-failure-cause: a socket that dropped, an abort the ask did not cause, our
1029
+ * worker's failed request), so a record the transient grace held back shows with Retry. Every other
1030
+ * cause is a function of the code, the data and the settings: the planner and the sandbox fail the
1031
+ * same way. */
921
1032
  function isTransientRunFailure(error, message) {
922
1033
  if (error instanceof WrunWorkerPoisonError)
923
1034
  return true;
@@ -925,7 +1036,7 @@ function isTransientRunFailure(error, message) {
925
1036
  return true;
926
1037
  if (error instanceof WrunQuarantinedError)
927
1038
  return error.reason === 'timeout' && error.strikes === 1;
928
- return NETWORK_FAILURE_RE.test(message);
1039
+ return NETWORK_FAILURE_RE.test(message) || isWrunTransientFailureCause(unrecordedFailureCauseOf(error));
929
1040
  }
930
1041
  /** The first non-empty line of a text, trimmed with its runs of spaces collapsed. */
931
1042
  function firstLineOf(text) {
@@ -957,6 +1068,9 @@ function variantFor(seed, ctx) {
957
1068
  return declared;
958
1069
  if (declared === 'market-paused' || declared === 'market-note')
959
1070
  return declared;
1071
+ // The app's own lack of the feed, or the data plane's list of sampled underlyings: no market fact moves either.
1072
+ if (declared === 'protocol-pending' || declared === 'not-sampled')
1073
+ return declared;
960
1074
  if (declared === undefined && !cryptoChart)
961
1075
  return 'crypto-only';
962
1076
  return seed.severity === 'note' ? 'market-note' : 'market-paused';
@@ -987,6 +1101,10 @@ function variantFor(seed, ctx) {
987
1101
  return declared !== undefined && variantSpec('not-added', declared) ? declared : 'gate';
988
1102
  case 'run-failed':
989
1103
  return declared !== undefined && variantSpec('run-failed', declared) ? declared : 'generic';
1104
+ // The variant IS the stop reason: there is no default reason to guess. An unknown word renders the generic words
1105
+ // (`renderSpec`), which the class spec forbids for every reason the lanes emit.
1106
+ case 'options-stopped':
1107
+ return declared ?? '';
990
1108
  default:
991
1109
  return 'default';
992
1110
  }
@@ -1094,6 +1212,11 @@ function defaultOut(cls, variant, ctx, params) {
1094
1212
  // The same code, data and settings fail the same way (a transient cause seeds its own Retry):
1095
1213
  // the source when it opens, else the report.
1096
1214
  return ctx.editable ? { kind: 'open-editor' } : { kind: 'report' };
1215
+ // The way out each stop reason's seed names (`wrunOptionsStopSeed`), for a seed that named none.
1216
+ case 'options-stopped':
1217
+ if (variant === 'session-elsewhere')
1218
+ return { kind: 'take-session', plane: 'opra' };
1219
+ return { kind: 'works-on' };
1097
1220
  }
1098
1221
  }
1099
1222
  /** A seed's own OUT, held to the flags: Open in editor only for an openable source, Open the
@@ -1113,7 +1236,7 @@ function defaultSeverity(cls) {
1113
1236
  ? 'note'
1114
1237
  : 'paused';
1115
1238
  }
1116
- function buildRecord(seed, ctx, details, telemetry = {}) {
1239
+ function buildRecord(seed, ctx, details, telemetry = {}, cause = 'none') {
1117
1240
  const cls = seed.cls;
1118
1241
  const variant = variantFor(seed, ctx);
1119
1242
  const spec = variantSpec(cls, variant) ?? RUN_FAILED_GENERIC;
@@ -1132,6 +1255,8 @@ function buildRecord(seed, ctx, details, telemetry = {}) {
1132
1255
  out,
1133
1256
  details,
1134
1257
  ...telemetry,
1258
+ // A typed verdict's record carries no cause: it serializes as it did before the cause existed.
1259
+ ...(cause !== 'none' ? { telemetry: { cause } } : {}),
1135
1260
  };
1136
1261
  // A feed with no words cannot be named: the generic words, the class's way out kept.
1137
1262
  if (spec.params.includes('feed') && wrunRefusalFeedKey(params.feed) === undefined) {
@@ -1159,7 +1284,8 @@ export function wrunRefusalSeedFor(error, ctx) {
1159
1284
  * an unseeded `WrunSourceDataUnavailableError` -> service-no-answer; else run-failed. A server answer
1160
1285
  * reads through the one answer table first (wrun-hosted-wire-caps): a superseded create's answer is the
1161
1286
  * `session-lost` note, one a second ask may pass keeps Retry. The record carries the raiser's telemetry
1162
- * (stampWrunRefusalTelemetry) and `unknownCode` for a code the table has no row for.
1287
+ * (stampWrunRefusalTelemetry), `unknownCode` for a code the table has no row for, and the failure's cause
1288
+ * (`wrunFailureCauseOf`) at `telemetry.cause` when it is not `none`.
1163
1289
  */
1164
1290
  export function wrunRefusalFor(errorOrSeed, ctx) {
1165
1291
  let details = '';
@@ -1171,7 +1297,7 @@ export function wrunRefusalFor(errorOrSeed, ctx) {
1171
1297
  const telemetry = wrunRefusalTelemetryOf(errorOrSeed);
1172
1298
  if (wrunServerAnswerOfText(details)?.unknownCode === true)
1173
1299
  telemetry.unknownCode = true;
1174
- return buildRecord(seedOfError(errorOrSeed, ctx), ctx, details, telemetry);
1300
+ return buildRecord(seedOfError(errorOrSeed, ctx), ctx, details, telemetry, unrecordedFailureCauseOf(errorOrSeed));
1175
1301
  }
1176
1302
  catch {
1177
1303
  return {
@@ -1186,6 +1312,174 @@ export function wrunRefusalFor(errorOrSeed, ctx) {
1186
1312
  };
1187
1313
  }
1188
1314
  }
1315
+ // ---------------------------------------------------------------------------
1316
+ // The failure cause (CLOUD-RUN-ROBUST C1, wrun-failure-cause)
1317
+ // ---------------------------------------------------------------------------
1318
+ /**
1319
+ * The kScript socket's failure codes and the run capability's denial, by the cause each names: the codes the socket
1320
+ * worker leaves a failure with (src/workers/constants/kscript-transport-codes.ts, mirrored here because the package
1321
+ * never reads the app's worker constants; tests/utility/wrun/wrun-failure-cause.util.spec.ts holds the mirror to them
1322
+ * code for code). A failure carries its code at the head of its message (or on its `code`), never a sentence: only
1323
+ * that head is read.
1324
+ */
1325
+ export const WRUN_TRANSPORT_CODE_CAUSES = Object.freeze({
1326
+ KSCRIPT_TRANSPORT_DISCONNECTED: 'connection-lost',
1327
+ KSCRIPT_TRANSPORT_DIAL_FAILED: 'dial-failed',
1328
+ KSCRIPT_TRANSPORT_STALE: 'socket-stale',
1329
+ KSCRIPT_WORKER_RESTARTED: 'worker-restarted',
1330
+ KSCRIPT_CAPABILITY_UNAVAILABLE: 'capability-unavailable',
1331
+ KSCRIPT_CAPABILITY_DENIED: 'access-denied',
1332
+ });
1333
+ /** The code a failure's message leads with: an upper-case word the rest does not continue. */
1334
+ const LEADING_FAILURE_CODE = /^([A-Z][A-Z0-9_]*)(?![A-Za-z0-9_])/;
1335
+ /** The protected worker control's words for a failure that carried none (kscript-protected.worker): a fixed literal
1336
+ * of our own worker, read whole, never a pattern. The kScript backend did not process the ask. */
1337
+ const KSCRIPT_REQUEST_FAILED = 'Failed to process KScript request';
1338
+ /** The module words of NETWORK_FAILURE_RE: a lazily loaded chunk that did not arrive. */
1339
+ const CHUNK_LOAD_FAILURE_RE = /\b(?:dynamically imported module|Importing a module script failed|ChunkLoadError)\b/i;
1340
+ /** The lane's typed errors whose own type says what failed (a refusal of a gate, the market or the data, the run
1341
+ * deadline, the adapter, a quarantined or hosted-only package, a declined twin): their cause is `none`. */
1342
+ const TYPED_VERDICT_ERRORS = [
1343
+ WrunRegistryAddRefusedError,
1344
+ WrunNoBarsError,
1345
+ WrunDeadlineError,
1346
+ WrunIntegrationError,
1347
+ WrunQuarantinedError,
1348
+ WrunRegistryHostedOnlyError,
1349
+ WrunProvenTwinDeclinedError,
1350
+ ];
1351
+ /** The context the stable codes read with no chart in hand (the cause reads only whether a code names a refusal). */
1352
+ const NO_CONTEXT = { indicatorName: '', editable: false, hasSettings: false };
1353
+ function errorNameOf(error) {
1354
+ return isRecordObject(error) && typeof error.name === 'string' ? error.name : undefined;
1355
+ }
1356
+ /** The cause of a server answer: a superseded create's answer is `superseded`, any other the row that read it. */
1357
+ function serverAnswerCauseOf(answer) {
1358
+ if (answer === undefined)
1359
+ return undefined;
1360
+ return answer.verdict === 'stale' ? 'superseded' : wrunServerFailureCause(answer.row);
1361
+ }
1362
+ /** The cause of the socket row source's whole-run refusal (its `WrunSocketRefusalError`, read by name): a reply the
1363
+ * chart cannot read, another chart's or tab's supersede, else the server's answer by its frame (the refusal's
1364
+ * message), else by its code through the same table. */
1365
+ function socketRefusalCauseOf(error) {
1366
+ const refusal = socketRefusalOf(error);
1367
+ if (refusal === undefined)
1368
+ return 'other';
1369
+ if (refusal.code === WRUN_LEGACY_RESULT_CODE)
1370
+ return 'reply-unreadable';
1371
+ if (refusal.code === WRUN_SESSION_LOST_CODE)
1372
+ return 'superseded';
1373
+ return (serverAnswerCauseOf(wrunServerAnswerOfText(messageOf(error)) ??
1374
+ wrunServerAnswerVerdict({ details: { wrunRefusal: refusal } }) ??
1375
+ wrunServerAnswerVerdict({ code: refusal.code })) ?? wrunServerFailureCause('unknown-code'));
1376
+ }
1377
+ /** The cause a failure's own type names, read by its name (the socket row source's errors stay out of this module's
1378
+ * graph, and a module duplicate under test still matches), else undefined. */
1379
+ function namedFailureCauseOf(error) {
1380
+ switch (errorNameOf(error)) {
1381
+ case 'WrunRowSourceTransientError': {
1382
+ // The socket row source's transient reasons are causes of the closed set, word for word.
1383
+ const reason = error.reason;
1384
+ return isWrunFailureCause(reason) ? reason : undefined;
1385
+ }
1386
+ case 'WrunSocketRowSourceStopped':
1387
+ return 'superseded';
1388
+ case 'WrunChartGoneError':
1389
+ // A run the overlay's own newer intent superseded is rewrapped as the quiet chart-gone stop with that cause.
1390
+ return error.cause === 'superseded' ? 'superseded' : 'chart-gone';
1391
+ case 'WrunSocketAccessDeniedError':
1392
+ return 'access-denied';
1393
+ case 'SessionExpiredError':
1394
+ // The login lapsed before the run could take its permission: terminal until the person signs in again.
1395
+ return 'session-expired';
1396
+ case 'WrunSocketReplyUnreadable':
1397
+ return 'reply-unreadable';
1398
+ case 'WrunSocketRefusalError':
1399
+ return socketRefusalCauseOf(error);
1400
+ case 'WrunWorkerPoisonError':
1401
+ case 'WrunLiveSessionLostError':
1402
+ return 'worker-dead';
1403
+ case 'AbortError':
1404
+ // An abort that reached a failure: one the ask's own signal did not cause (its own stop never fails a run).
1405
+ return 'aborted';
1406
+ default:
1407
+ return undefined;
1408
+ }
1409
+ }
1410
+ /** The cause a kScript socket code names: the failure's `code`, else the code its message leads with. */
1411
+ function transportCodeCauseOf(error, message) {
1412
+ const carried = isRecordObject(error) ? error.code : undefined;
1413
+ const code = typeof carried === 'string' && Object.hasOwn(WRUN_TRANSPORT_CODE_CAUSES, carried)
1414
+ ? carried
1415
+ : LEADING_FAILURE_CODE.exec(message)?.[1];
1416
+ return code !== undefined && Object.hasOwn(WRUN_TRANSPORT_CODE_CAUSES, code)
1417
+ ? WRUN_TRANSPORT_CODE_CAUSES[code]
1418
+ : undefined;
1419
+ }
1420
+ /** A failure that already says what it is: a typed error of the lane, a refusal seed its raiser attached, a bare seed,
1421
+ * a stable code of the browser lane, the Indicator's own code stopping (the engine's trap, the host's rules). */
1422
+ function isTypedVerdict(error, message) {
1423
+ if (TYPED_VERDICT_ERRORS.some((type) => error instanceof type))
1424
+ return true;
1425
+ if (wrunRefusalSeedOf(error) !== undefined)
1426
+ return true;
1427
+ if (!(error instanceof Error) && validSeed(error) !== undefined)
1428
+ return true;
1429
+ if (seedFromCodes(message, NO_CONTEXT) !== undefined)
1430
+ return true;
1431
+ return ENGINE_TRAP_RE.test(firstLineOf(message)) || HOST_RULE_RE.test(message);
1432
+ }
1433
+ /**
1434
+ * Why a failure happened, as one word of the closed set (wrun-failure-cause): what produced it, beside the attempt
1435
+ * reason and the refusal class that say what kind of failure it was. Read in this order:
1436
+ * 1. the cause of the record annotated on the failure (`refusal.telemetry.cause`; a record without one says `none`),
1437
+ * so the three events of one failure (`feature:failed`, `wrun_lane_mount`, `wrun_failure_shown`) name the cause
1438
+ * its record names;
1439
+ * 2. a cause its raiser stamped (`stampWrunRefusalTelemetry`);
1440
+ * 3. its own type, by name (the socket row source's transient reasons, a stopped or unreadable ask, a denied
1441
+ * capability, the cloud's whole-run refusal, a dead sandbox, an abort its ask's signal did not cause), the kScript
1442
+ * socket's codes (`WRUN_TRANSPORT_CODE_CAUSES`) and our worker's one fixed literal (`backend-unavailable`);
1443
+ * 4. the server's answer through the one answer table: `server:<row>`, a superseded create's answer `superseded`;
1444
+ * 5. a dropped connection under the run: a lazy chunk (`chunk-load`) or a fetch (`network`);
1445
+ * 6. `none` for a typed verdict (`isTypedVerdict`), else `other`.
1446
+ * Closed words only, never the message. Never throws.
1447
+ */
1448
+ export function wrunFailureCauseOf(error) {
1449
+ try {
1450
+ const record = wrunRefusalOf(error);
1451
+ if (record !== undefined)
1452
+ return record.telemetry?.cause ?? 'none';
1453
+ }
1454
+ catch {
1455
+ return 'other';
1456
+ }
1457
+ return unrecordedFailureCauseOf(error);
1458
+ }
1459
+ /** Steps 2 to 6 of `wrunFailureCauseOf`: the cause of a failure no record decided yet (`wrunRefusalFor` writes it
1460
+ * into the record it completes). Never throws. */
1461
+ function unrecordedFailureCauseOf(error) {
1462
+ try {
1463
+ const stamped = stampedFailureCauseOf(error);
1464
+ if (stamped !== undefined)
1465
+ return stamped;
1466
+ const message = messageOf(error);
1467
+ const named = namedFailureCauseOf(error) ?? transportCodeCauseOf(error, message);
1468
+ if (named !== undefined)
1469
+ return named;
1470
+ if (message === KSCRIPT_REQUEST_FAILED)
1471
+ return 'backend-unavailable';
1472
+ const answered = serverAnswerCauseOf(wrunServerAnswerOfText(message));
1473
+ if (answered !== undefined)
1474
+ return answered;
1475
+ if (NETWORK_FAILURE_RE.test(message))
1476
+ return CHUNK_LOAD_FAILURE_RE.test(message) ? 'chunk-load' : 'network';
1477
+ return isTypedVerdict(error, message) ? 'none' : 'other';
1478
+ }
1479
+ catch {
1480
+ return 'other';
1481
+ }
1482
+ }
1189
1483
  function outLabelOf(out, t) {
1190
1484
  switch (out.kind) {
1191
1485
  case 'switch-market':
@@ -1212,6 +1506,8 @@ function outLabelOf(out, t) {
1212
1506
  return t('wrunReport.legend.report');
1213
1507
  case 'reload':
1214
1508
  return t('dialogs.loadingTimeout.reloadApp');
1509
+ case 'take-session':
1510
+ return t('wrun.refusal.out.takeSession');
1215
1511
  }
1216
1512
  }
1217
1513
  /** The longest detail line a surface shows. */
@@ -17,23 +17,10 @@ export declare class WrunRegistryAddRefusedError extends Error {
17
17
  constructor(message?: string);
18
18
  }
19
19
  export declare function isWrunRegistryAddRefusedError(error: unknown): error is WrunRegistryAddRefusedError;
20
- /** Thrown by the add chokepoint (wrun-registry-catalog.util
21
- * addWrunRegistryPackage) for an official PORT (a package the twins join
22
- * names) while the native indicators are off for the viewer
23
- * (`wrun-native-indicators`, wrun-twins.util isWrunOfficialPackageLit):
24
- * nothing resolves and nothing mounts. No door offers a port then (the
25
- * OpenMarket group lists the built-ins and the originals, super search drops
26
- * the port rows), so only a stale link or a leftover door reaches here; it
27
- * subclasses the add refusal so no caller stacks a "failed to add" toast over
28
- * a row the viewer was never offered. An ORIGINAL never meets it: it rides
29
- * the Indicators section alone (WRUN-MARKET-SESSIONS C4). */
30
- export declare class WrunNativeIndicatorsOffError extends WrunRegistryAddRefusedError {
31
- constructor(packageName: string);
32
- }
33
20
  /** Why the proven route of a built-in's twin declined before anything mounted:
34
21
  * the registry answered the pinned ask with another version, or the resolve
35
22
  * failed (unreachable, past its deadline, unknown, the pin yanked or never
36
- * published, the section gone dark). */
23
+ * published). */
37
24
  export type WrunProvenTwinDeclineReason = 'pin-mismatch' | 'resolve-failed';
38
25
  /** Thrown by the proven route of a built-in's twin (option A,
39
26
  * wrun-proven-twin-add.util) when it declined BEFORE anything mounted: the
@@ -21,22 +21,6 @@ export class WrunRegistryAddRefusedError extends Error {
21
21
  export function isWrunRegistryAddRefusedError(error) {
22
22
  return error instanceof WrunRegistryAddRefusedError;
23
23
  }
24
- /** Thrown by the add chokepoint (wrun-registry-catalog.util
25
- * addWrunRegistryPackage) for an official PORT (a package the twins join
26
- * names) while the native indicators are off for the viewer
27
- * (`wrun-native-indicators`, wrun-twins.util isWrunOfficialPackageLit):
28
- * nothing resolves and nothing mounts. No door offers a port then (the
29
- * OpenMarket group lists the built-ins and the originals, super search drops
30
- * the port rows), so only a stale link or a leftover door reaches here; it
31
- * subclasses the add refusal so no caller stacks a "failed to add" toast over
32
- * a row the viewer was never offered. An ORIGINAL never meets it: it rides
33
- * the Indicators section alone (WRUN-MARKET-SESSIONS C4). */
34
- export class WrunNativeIndicatorsOffError extends WrunRegistryAddRefusedError {
35
- constructor(packageName) {
36
- super(`'${packageName}' is an official Indicator, and the native indicators are off for this account`);
37
- this.name = 'WrunNativeIndicatorsOffError';
38
- }
39
- }
40
24
  /** Thrown by the proven route of a built-in's twin (option A,
41
25
  * wrun-proven-twin-add.util) when it declined BEFORE anything mounted: the
42
26
  * chart is untouched, and the caller adds the built-in's shipped template
@@ -775,6 +775,7 @@ memo) {
775
775
  ? {
776
776
  title: wrunFrameTitle(frame) ?? declaredTitle(drawing.title) ?? drawing.name,
777
777
  lines: frame.lines,
778
+ ...(frame.markets !== undefined ? { markets: frame.markets } : {}),
778
779
  ...(anchor !== undefined ? { anchor } : {}),
779
780
  ...(offset !== undefined ? { offset: [...offset] } : {}),
780
781
  ...(z !== undefined ? { z } : {}),
@@ -0,0 +1,29 @@
1
+ /** The longest option root a contract names (the OSI root field). */
2
+ export declare const WRUN_ROW_MARKET_ROOT_MAX_CHARS = 6;
3
+ /** A contract's strike stays below this (eight digits of thousandths). */
4
+ export declare const WRUN_ROW_MARKET_STRIKE_LIMIT = 100000;
5
+ export declare const WRUN_ROW_MARKET_MESSAGE = "a market is null, { \"contract\": [root_code, expiry_ms, side_cp, strike] } or { \"ticker\": code }";
6
+ export declare const WRUN_ROW_MARKET_CONTRACT_MESSAGE = "a contract is [root_code, expiry_ms, side_cp, strike]: the option root's symbol code (1 to 6 characters), the expiry in epoch milliseconds, +1 for a call or -1 for a put, and a strike above 0 and below 100000";
7
+ export declare const WRUN_ROW_MARKET_TICKER_MESSAGE = "a ticker is a symbol code of 1 to 10 characters";
8
+ /** The two market forms a row or a line names. */
9
+ export type WrunRowMarket = {
10
+ contract: [rootCode: number, expiryMs: number, sideCp: number, strike: number];
11
+ } | {
12
+ ticker: number;
13
+ };
14
+ /** One non-null entry's refusal (its path below the entry and the kit's words), or null when it
15
+ * names a market. */
16
+ export declare function wrunRowMarketIssue(value: unknown): {
17
+ path: string[];
18
+ message: string;
19
+ } | null;
20
+ /** The refusal when `markets` and the rows it names differ in length (the kit's words). */
21
+ export declare function wrunRowMarketsLengthMessage(noun: 'row' | 'line', count: number): string;
22
+ /** A frame's `markets`, checked against its row or line count: the list as written (each entry a
23
+ * copy), or the refusal as `[path, message]` (the path below the frame). */
24
+ export declare function parseWrunRowMarkets(value: unknown, noun: 'row' | 'line', count: number): {
25
+ markets: (WrunRowMarket | null)[];
26
+ } | {
27
+ path: (string | number)[];
28
+ message: string;
29
+ };