@orangecharts/wrun-chart-host 0.8.0 → 0.10.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 (246) hide show
  1. package/README.md +3 -1
  2. package/dist/constants/feature-flags.constants.d.ts +9 -0
  3. package/dist/constants/feature-flags.constants.js +86 -16
  4. package/dist/constants/marketCapabilities.constants.d.ts +14 -9
  5. package/dist/constants/marketCapabilities.constants.js +36 -13
  6. package/dist/constants/opra-compliance.constants.d.ts +15 -0
  7. package/dist/constants/opra-compliance.constants.js +15 -0
  8. package/dist/constants/option-venues.constants.d.ts +11 -6
  9. package/dist/constants/option-venues.constants.js +5 -2
  10. package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +26 -0
  11. package/dist/constants/scriptEditor/builtin-script-snippets.js +6 -0
  12. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.d.ts +15 -0
  13. package/dist/constants/scriptEditor/technicalIndicatorScriptKeys.constants.js +17 -0
  14. package/dist/constants/venue-presets.constants.d.ts +20 -20
  15. package/dist/constants/venue-presets.constants.js +24 -26
  16. package/dist/host-env.d.ts +39 -9
  17. package/dist/host-env.js +6 -0
  18. package/dist/host-ports.types.d.ts +108 -18
  19. package/dist/index.d.ts +14 -0
  20. package/dist/index.js +14 -0
  21. package/dist/interfaces/kscript-diagnostics.interface.d.ts +6 -0
  22. package/dist/interfaces/opra-realtime.interface.d.ts +13 -11
  23. package/dist/interfaces/opra-realtime.interface.js +10 -10
  24. package/dist/interfaces/replay.interface.d.ts +8 -0
  25. package/dist/interfaces/wrun-runtime.interface.d.ts +52 -15
  26. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +94 -14
  27. package/dist/kscript-data/controls/live-trades-merge.util.js +132 -22
  28. package/dist/kscript-data/controls/live-trades-order-gate.util.d.ts +56 -0
  29. package/dist/kscript-data/controls/live-trades-order-gate.util.js +107 -0
  30. package/dist/market-data/billing.interface.d.ts +227 -42
  31. package/dist/market-data/billing.interface.js +60 -12
  32. package/dist/market-data/venue.d.ts +88 -6
  33. package/dist/market-data/venues/cme.contract.copy.json +66 -0
  34. package/dist/market-data/venues/cme.d.ts +126 -0
  35. package/dist/market-data/venues/cme.js +133 -0
  36. package/dist/market-data/venues/index.d.ts +165 -8
  37. package/dist/market-data/venues/index.js +48 -6
  38. package/dist/market-data/venues/opra.contract.copy.json +5 -3
  39. package/dist/market-data/venues/opra.d.ts +3 -3
  40. package/dist/market-data/venues/opra.js +5 -4
  41. package/dist/replay/replayLadder.js +3 -1
  42. package/dist/settings-templates/index.js +7 -3
  43. package/dist/settings-templates/indicator-fields.d.ts +5 -4
  44. package/dist/settings-templates/indicator-fields.js +45 -6
  45. package/dist/settings-templates/tool-rules.d.ts +27 -17
  46. package/dist/settings-templates/tool-rules.js +27 -11
  47. package/dist/settings-templates/tool-tables.generated.js +91 -31
  48. package/dist/utility/chart/book-live-bucket.util.d.ts +15 -0
  49. package/dist/utility/chart/book-live-bucket.util.js +47 -0
  50. package/dist/utility/chart/crypto-index.leaf.d.ts +2 -2
  51. package/dist/utility/chart/crypto-index.leaf.js +2 -2
  52. package/dist/utility/chart/index-mode-admission.util.js +24 -3
  53. package/dist/utility/chart/index-mode.util.d.ts +5 -2
  54. package/dist/utility/chart/index-mode.util.js +23 -13
  55. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +35 -11
  56. package/dist/utility/chart/kscript-drawing-safe-area.util.js +145 -35
  57. package/dist/utility/chart/kscript-live-coalesce.util.d.ts +7 -2
  58. package/dist/utility/chart/kscript-live-coalesce.util.js +9 -3
  59. package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
  60. package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +3 -1
  61. package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +32 -2
  62. package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +45 -0
  63. package/dist/utility/chart/kscript-venue-policy.util.d.ts +53 -27
  64. package/dist/utility/chart/kscript-venue-policy.util.js +74 -32
  65. package/dist/utility/chart/market-session-schedule.util.d.ts +10 -0
  66. package/dist/utility/chart/market-session-schedule.util.js +16 -0
  67. package/dist/utility/chart/marketKind.util.d.ts +12 -10
  68. package/dist/utility/chart/marketKind.util.js +17 -7
  69. package/dist/utility/chart/om-panel-push-style.util.d.ts +7 -7
  70. package/dist/utility/chart/om-panel-push-style.util.js +17 -15
  71. package/dist/utility/chart/om-panel.util.js +6 -6
  72. package/dist/utility/chart/opra-read-access.leaf.d.ts +5 -3
  73. package/dist/utility/chart/opra-read-access.leaf.js +5 -3
  74. package/dist/utility/chart/profile-block-size.util.d.ts +16 -0
  75. package/dist/utility/chart/profile-block-size.util.js +7 -0
  76. package/dist/utility/chart/quote-perp.leaf.d.ts +17 -0
  77. package/dist/utility/chart/quote-perp.leaf.js +20 -0
  78. package/dist/utility/chart/rth-session.util.d.ts +3 -2
  79. package/dist/utility/chart/rth-session.util.js +2 -1
  80. package/dist/utility/chart/window-geometry.leaf.d.ts +8 -0
  81. package/dist/utility/chart/window-geometry.leaf.js +22 -6
  82. package/dist/utility/chart/wrun-run-result.util.d.ts +17 -0
  83. package/dist/utility/chart/wrun-run-result.util.js +145 -7
  84. package/dist/utility/common/transformations.util.d.ts +7 -0
  85. package/dist/utility/common/transformations.util.js +11 -0
  86. package/dist/utility/options/option-bar-anchor.util.d.ts +145 -0
  87. package/dist/utility/options/option-bar-anchor.util.js +340 -0
  88. package/dist/utility/options/option-venue.util.d.ts +21 -3
  89. package/dist/utility/options/option-venue.util.js +30 -3
  90. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +2 -0
  91. package/dist/utility/wrun/derived-roots.util.d.ts +213 -0
  92. package/dist/utility/wrun/derived-roots.util.js +471 -0
  93. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.d.ts +41 -6
  94. package/dist/utility/wrun/run-schedule/wrun-chart-gate-reader.util.js +89 -19
  95. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.d.ts +9 -4
  96. package/dist/utility/wrun/run-schedule/wrun-gate-reader-warm.util.js +47 -6
  97. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.d.ts +5 -3
  98. package/dist/utility/wrun/run-schedule/wrun-late-reads.util.js +6 -4
  99. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.d.ts +2 -2
  100. package/dist/utility/wrun/run-schedule/wrun-prefix-feeds.util.js +5 -1
  101. package/dist/utility/wrun/sources/lanes/option_daily.js +5 -2
  102. package/dist/utility/wrun/sources/lanes/options_flow.js +5 -2
  103. package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +64 -19
  104. package/dist/utility/wrun/sources/opra-option-lanes.util.js +105 -35
  105. package/dist/utility/wrun/sources/row-lane-registry.js +3 -2
  106. package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +2 -1
  107. package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +9 -3
  108. package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +15 -6
  109. package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +14 -0
  110. package/dist/utility/wrun/sources/row-lanes/option_prints.js +82 -13
  111. package/dist/utility/wrun/sources/row-lanes/option_strike_flow.js +17 -4
  112. package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +55 -8
  113. package/dist/utility/wrun/sources/row-lanes/option_strikes.js +95 -14
  114. package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +5 -2
  115. package/dist/utility/wrun/sources/row-lanes/option_surface.js +7 -3
  116. package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +19 -0
  117. package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +35 -14
  118. package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +70 -20
  119. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.d.ts +64 -0
  120. package/dist/utility/wrun/sources/wrun-row-lane-add-memo.util.js +89 -0
  121. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.d.ts +45 -1
  122. package/dist/utility/wrun/sources/wrun-row-lane-first-paint.util.js +114 -6
  123. package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +56 -5
  124. package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +224 -26
  125. package/dist/utility/wrun/sources/wrun-row-lanes.util.js +822 -58
  126. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +16 -3
  127. package/dist/utility/wrun/wrun-batched-marks.util.js +30 -19
  128. package/dist/utility/wrun/wrun-batched-readout.util.d.ts +37 -9
  129. package/dist/utility/wrun/wrun-batched-readout.util.js +61 -15
  130. package/dist/utility/wrun/wrun-builtin-twin.util.d.ts +12 -0
  131. package/dist/utility/wrun/wrun-builtin-twin.util.js +21 -0
  132. package/dist/utility/wrun/wrun-canvas-readout.util.d.ts +4 -0
  133. package/dist/utility/wrun/wrun-cell-capacity.leaf.d.ts +66 -0
  134. package/dist/utility/wrun/wrun-cell-capacity.leaf.js +86 -0
  135. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +192 -13
  136. package/dist/utility/wrun/wrun-chart-market-facts.util.js +437 -55
  137. package/dist/utility/wrun/wrun-color-facts.util.d.ts +19 -9
  138. package/dist/utility/wrun/wrun-color-facts.util.js +24 -14
  139. package/dist/utility/wrun/wrun-color-settings.util.d.ts +15 -4
  140. package/dist/utility/wrun/wrun-color-settings.util.js +31 -12
  141. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.d.ts +17 -0
  142. package/dist/utility/wrun/wrun-dollar-unit-port.leaf.js +9 -0
  143. package/dist/utility/wrun/wrun-download-meter.util.d.ts +107 -0
  144. package/dist/utility/wrun/wrun-download-meter.util.js +134 -0
  145. package/dist/utility/wrun/wrun-download-plan.util.d.ts +99 -0
  146. package/dist/utility/wrun/wrun-download-plan.util.js +118 -0
  147. package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +11 -3
  148. package/dist/utility/wrun/wrun-draft-legend-note.util.js +26 -4
  149. package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +6 -1
  150. package/dist/utility/wrun/wrun-draft-overlay.util.js +23 -3
  151. package/dist/utility/wrun/wrun-frames.d.ts +27 -6
  152. package/dist/utility/wrun/wrun-frames.js +78 -15
  153. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
  154. package/dist/utility/wrun/wrun-hosted-wire-caps.js +7 -0
  155. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +7 -1
  156. package/dist/utility/wrun/wrun-hosted-wire.util.js +12 -2
  157. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +51 -21
  158. package/dist/utility/wrun/wrun-hud-looks.util.js +74 -28
  159. package/dist/utility/wrun/wrun-latest-snapshot.d.ts +11 -0
  160. package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +8 -6
  161. package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +8 -6
  162. package/dist/utility/wrun/wrun-lifecycle.contract.d.ts +4 -2
  163. package/dist/utility/wrun/wrun-live-intake.util.d.ts +19 -9
  164. package/dist/utility/wrun/wrun-live-intake.util.js +213 -45
  165. package/dist/utility/wrun/wrun-live-tick.util.d.ts +4 -0
  166. package/dist/utility/wrun/wrun-live-tick.util.js +246 -49
  167. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.d.ts +53 -0
  168. package/dist/utility/wrun/wrun-market-size-contract-carry.leaf.js +162 -0
  169. package/dist/utility/wrun/wrun-market-size-defaults.leaf.d.ts +205 -48
  170. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +277 -34
  171. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +51 -7
  172. package/dist/utility/wrun/wrun-market-size-defaults.util.js +340 -56
  173. package/dist/utility/wrun/wrun-opra-lane.util.d.ts +17 -4
  174. package/dist/utility/wrun/wrun-opra-lane.util.js +6 -4
  175. package/dist/utility/wrun/wrun-option-prints.util.d.ts +41 -2
  176. package/dist/utility/wrun/wrun-option-prints.util.js +80 -13
  177. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.d.ts +31 -0
  178. package/dist/utility/wrun/wrun-option-strike-flow-forecast.util.js +119 -0
  179. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.d.ts +26 -6
  180. package/dist/utility/wrun/wrun-option-strike-flow-lane.util.js +50 -11
  181. package/dist/utility/wrun/wrun-option-strike-flow.util.d.ts +109 -19
  182. package/dist/utility/wrun/wrun-option-strike-flow.util.js +222 -61
  183. package/dist/utility/wrun/wrun-option-views.util.d.ts +96 -18
  184. package/dist/utility/wrun/wrun-option-views.util.js +246 -51
  185. package/dist/utility/wrun/wrun-options-stop.util.d.ts +2 -1
  186. package/dist/utility/wrun/wrun-options-stop.util.js +3 -2
  187. package/dist/utility/wrun/wrun-output-style.util.d.ts +6 -2
  188. package/dist/utility/wrun/wrun-output-style.util.js +20 -2
  189. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +20 -0
  190. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +31 -14
  191. package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +22 -0
  192. package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +10 -1
  193. package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +52 -4
  194. package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +7 -0
  195. package/dist/utility/wrun/wrun-overlay-recovery.util.js +25 -1
  196. package/dist/utility/wrun/wrun-overlay-result.util.d.ts +7 -1
  197. package/dist/utility/wrun/wrun-overlay-result.util.js +2 -0
  198. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +134 -37
  199. package/dist/utility/wrun/wrun-overlay-run.util.js +1118 -254
  200. package/dist/utility/wrun/wrun-pack-widths.leaf.d.ts +4 -4
  201. package/dist/utility/wrun/wrun-pack-widths.leaf.js +4 -4
  202. package/dist/utility/wrun/wrun-pack.util.d.ts +7 -3
  203. package/dist/utility/wrun/wrun-pack.util.js +20 -9
  204. package/dist/utility/wrun/wrun-pane-format.util.d.ts +2 -1
  205. package/dist/utility/wrun/wrun-pane-format.util.js +7 -3
  206. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +9 -0
  207. package/dist/utility/wrun/wrun-panel-mount.util.js +63 -13
  208. package/dist/utility/wrun/wrun-panel-style.util.d.ts +37 -24
  209. package/dist/utility/wrun/wrun-panel-style.util.js +100 -29
  210. package/dist/utility/wrun/wrun-param-map.util.d.ts +15 -11
  211. package/dist/utility/wrun/wrun-param-map.util.js +13 -5
  212. package/dist/utility/wrun/wrun-param-values.util.d.ts +21 -3
  213. package/dist/utility/wrun/wrun-param-values.util.js +6 -0
  214. package/dist/utility/wrun/wrun-pin-spelling.util.js +12 -11
  215. package/dist/utility/wrun/wrun-prefix-lanes.util.js +2 -2
  216. package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +50 -0
  217. package/dist/utility/wrun/wrun-refusal-surface.util.js +68 -0
  218. package/dist/utility/wrun/wrun-refusal.util.js +10 -1
  219. package/dist/utility/wrun/wrun-refused-latest.util.d.ts +10 -0
  220. package/dist/utility/wrun/wrun-refused-latest.util.js +12 -0
  221. package/dist/utility/wrun/wrun-row-source.d.ts +11 -0
  222. package/dist/utility/wrun/wrun-run-interval.util.d.ts +4 -2
  223. package/dist/utility/wrun/wrun-run-interval.util.js +9 -6
  224. package/dist/utility/wrun/wrun-script-inputs.util.d.ts +52 -1
  225. package/dist/utility/wrun/wrun-script-inputs.util.js +112 -4
  226. package/dist/utility/wrun/wrun-setting-words.util.d.ts +7 -3
  227. package/dist/utility/wrun/wrun-setting-words.util.js +13 -5
  228. package/dist/utility/wrun/wrun-socket-row-source.d.ts +27 -2
  229. package/dist/utility/wrun/wrun-socket-row-source.js +113 -8
  230. package/dist/utility/wrun/wrun-source-rows.util.d.ts +9 -1
  231. package/dist/utility/wrun/wrun-source-rows.util.js +108 -43
  232. package/dist/utility/wrun/wrun-style-words.util.js +6 -4
  233. package/dist/utility/wrun/wrun-table-chrome.util.d.ts +3 -2
  234. package/dist/utility/wrun/wrun-table-chrome.util.js +19 -11
  235. package/dist/utility/wrun/wrun-tape-per-order.util.d.ts +2 -0
  236. package/dist/utility/wrun/wrun-tape-per-order.util.js +26 -0
  237. package/dist/utility/wrun/wrun-tape-source.util.d.ts +126 -50
  238. package/dist/utility/wrun/wrun-tape-source.util.js +193 -68
  239. package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +7 -5
  240. package/dist/utility/wrun/wrun-volume-profile-lane.util.js +8 -6
  241. package/dist/utils/replay/replay-buffer-math.d.ts +53 -2
  242. package/dist/utils/replay/replay-buffer-math.js +227 -20
  243. package/dist/workers/utils/volume-profile.worker.util.d.ts +4 -1
  244. package/dist/workers/utils/volume-profile.worker.util.js +5 -2
  245. package/dist/workers/wrun/wrun-abi-host.js +3 -2
  246. package/package.json +5 -5
@@ -80,6 +80,7 @@ import { type WrunRefusalAttemptToken } from './wrun-refusal.util.js';
80
80
  import type { WrunIndicatorMetadata, WrunModuleHandle, WrunOutputRow } from '../../interfaces/wrun-runtime.interface.js';
81
81
  import type { WrunCandleGroup, WrunFillPair } from '../chart/wrun-run-result.util.js';
82
82
  import type { WrunLaneAcquisition, WrunLiveLane } from './wrun-live-intake.util.js';
83
+ import type { WrunOpraServedReceipt } from './wrun-opra-lane.util.js';
83
84
  import type { WrunPollLaneInstance } from './sources/wrun-poll-lane.types.js';
84
85
  import type { WrunRowLaneInstance } from './sources/wrun-row-lane.types.js';
85
86
  import type { WrunLiveApplied } from './wrun-live-patch.util.js';
@@ -156,6 +157,15 @@ export interface WrunOverlayLiveContext {
156
157
  * an arm of the same identity; a save leaves the previous context until the rerun installs its
157
158
  * own. Absent on contexts stored before this field existed and on a draft: never sent. */
158
159
  computeIdentity?: string;
160
+ /** The registry version the installing run executed (its target's `version`): a session fallback
161
+ * (pinForThisSession) may run an older version than the row's saved pin, which `computeIdentity`
162
+ * cannot tell, so the workspace switch's stand-in capture (kscript-standin-switch.util) stores the
163
+ * shown picture only under the pin this session ran. Absent for a lane with no registry version. */
164
+ version?: string;
165
+ /** The settings revision the run computed with (`computed.generation`, C1: a compute-relevant save bumps it, a
166
+ * style save never): the switch's stand-in capture stores the shown picture only while the row still carries it,
167
+ * since a save moves the row at once and the session shows the previous computation until the rerun lands. */
168
+ settingsRevision?: number;
159
169
  /** An editor draft (isWrunDraftOverlaySettings): the run seam raised its run-health
160
170
  * verdict (wrun-run-health.util) and the live session keeps it honest. */
161
171
  draft: boolean;
@@ -255,6 +265,9 @@ export interface WrunOverlayLiveContext {
255
265
  * Absent when the package reads no row-lane class. */
256
266
  rowLanes?: WrunRowLaneInstance[];
257
267
  rowLaneRows?: Record<string, ReadonlyArray<ReadonlyArray<unknown>>>;
268
+ /** Row lanes drawing their first-paint slice alone, by the slice's first bar (ms), until the fill's run: no prefix
269
+ * page stands on them, no reconcile lands rows before that bar. */
270
+ rowLaneFilling?: Readonly<Record<string, number>>;
258
271
  /** The pinned legs this package declares (absent or empty when it pins
259
272
  * none) and their candle buffers, keyed by the leg's fetch key: a PERIOD
260
273
  * leg holds the CLOSED candles the full run fetched at the leg's
@@ -297,6 +310,13 @@ export interface WrunOverlayLiveContext {
297
310
  /** Per lane, the SAME payload object the history fetch used (units, quote,
298
311
  * ladder identity), so a live fold lands in the history lane's units. */
299
312
  acquisition: Partial<Record<WrunLiveLane, WrunLaneAcquisition>>;
313
+ /** A Cloud session's: the receipt of the OPRA rows its newest answer was computed from (contract
314
+ * opra-server-lanes C4), the tier its legend's served word names on every tick; absent when the session reads no
315
+ * OPRA, or its newest answer named no tier (no word then, never the account's tier). */
316
+ cloudOpraServed?: WrunOpraServedReceipt;
317
+ /** The session reads OPRA data (the console provenance of the run that installed it, `computed.opra`; a cloud
318
+ * frame carrying the OPRA mark raises it): every debug line its ticks and reseeds publish states it. */
319
+ opraRead?: true;
300
320
  /** The carry-forward state after every input row strictly before
301
321
  * `lastRowTs` (the seed the tail builder resumes from): the forward-fill
302
322
  * scalars, the forming buckets and the pinned legs' confirmed cursors. */
@@ -1,11 +1,12 @@
1
1
  /**
2
- * The boot graph's side of the wrun overlay lifecycle door and the live tick lane
3
- * (`wrun-lifecycle-runtime.util`, behind a dynamic import). Every trigger that lives in the
4
- * pre-candle graph calls them through here: the chart store's pause and resume, the pan wave in
5
- * titan-charts, the history-range, switch and wake triggers in data-fetching, the pane budget
6
- * lift, the legend Retry, the workspace poll and the live feed. The door, its recovery ladders,
7
- * the replay lane, the live tick and the run pass then evaluate with the first wrun loader, not
8
- * with the chart (docs/features/kscript/wrun/wrun-browser-runtime.md, "Lifecycle door").
2
+ * The boot graph's side of the wrun overlay lifecycle door, the live tick lane and the live intake's
3
+ * market rule and gap mark (`wrun-lifecycle-runtime.util`, behind a dynamic import). Every trigger
4
+ * that lives in the pre-candle graph calls them through here: the chart store's pause and resume,
5
+ * the pan wave in titan-charts, the history-range, switch and wake triggers in data-fetching, the
6
+ * pane budget lift, the legend Retry, the workspace poll and the live feed. The door, its recovery
7
+ * ladders, the replay lane, the live tick, the live intake (with the row builder and the source
8
+ * lanes it reads) and the run pass then evaluate with the first wrun loader, not with the chart
9
+ * (docs/features/kscript/wrun/wrun-browser-runtime.md, "Lifecycle door" and "Boot doors").
9
10
  *
10
11
  * Each entry keeps the door's contract:
11
12
  * - The runtime in hand: the call goes straight to it in the same turn, so the answer and every
@@ -13,19 +14,28 @@
13
14
  * their static import) before they register a driver, so this is the path for every driver id.
14
15
  * - No runtime yet: "not mine" from the same Map reads the door makes (`hasWrunOverlayDriver`,
15
16
  * `hasWrunOverlayLiveContext`), with the door's own answer (false, 'no-driver', 'not-wrun',
16
- * undefined, a resolved promise) and no import. A flag-off session and every kScript overlay
17
- * stay on this path, and nothing wrun loads.
18
- * - A driver before the runtime (a registrant that skipped the bind): the runtime loads and the
19
- * call runs once, when it lands. The synchronous answer is the one the door gives for the same
20
- * Map state ('queued' for the heal, whose tail decides; 'gap-marked' or 'healing' for the wake;
21
- * true for the pause; a promise for the reruns and the resume), and a load that fails resolves
22
- * like the door, which never rejects. Ring `wrun-lifecycle-runtime-late` names the entry.
17
+ * undefined, a resolved promise; admitted and no mark for the intake's two) and no import. A
18
+ * flag-off session and every kScript overlay stay on this path, and nothing wrun loads.
19
+ * - A driver or a live session before the runtime (a registrant that skipped the bind): the runtime
20
+ * loads and the call runs once, when it lands. The synchronous answer is the one the door gives
21
+ * for the same Map state ('queued' for the heal, whose tail decides; 'gap-marked' or 'healing' for
22
+ * the wake; true for the pause; a promise for the reruns and the resume), and a load that fails
23
+ * resolves like the door, which never rejects. The market rule only loads it and answers false,
24
+ * never true: the tick arms a drain and heals a held session for a frame before its own market
25
+ * check, so a frame nothing judged is not admitted (the session's next reconcile repairs it). Ring
26
+ * `wrun-lifecycle-runtime-late` names the entry.
27
+ *
28
+ * The intake's two entries take fixed parameters: the market rule runs per live frame per overlay
29
+ * with a session. A live session exists only after the run pass, which imports the intake and comes
30
+ * with a loader (tests/utility/wrun/wrun-overlay-lifecycle.live-context.spec.ts).
23
31
  */
24
32
  import type { WrunHealVerdict } from './wrun-lifecycle.contract.js';
25
33
  export type WrunLifecycleRuntime = typeof import('./wrun-lifecycle-runtime.util.js');
26
34
  /** An entry's parameters, exactly the runtime's: each entry forwards the arguments it received,
27
35
  * so the call the door sees is the trigger's own. */
28
36
  type EntryArgs<K extends keyof WrunLifecycleRuntime> = Parameters<WrunLifecycleRuntime[K]>;
37
+ type WrunLiveFrameSeries = EntryArgs<'wrunLiveFrameMarketAdmitted'>[1];
38
+ type WrunLiveGapReason = EntryArgs<'markWrunLiveGap'>[1];
29
39
  /** Hand the runtime over in the same turn: a loader calls this with its static import of
30
40
  * `wrun-lifecycle-runtime.util` before it registers a driver. */
31
41
  export declare function bindWrunLifecycleRuntime(loaded: WrunLifecycleRuntime): void;
@@ -45,6 +55,13 @@ export declare function pauseWrunOverlay(...args: EntryArgs<'pauseWrunOverlay'>)
45
55
  export declare function resumeWrunOverlay(...args: EntryArgs<'resumeWrunOverlay'>): Promise<void> | undefined;
46
56
  /** `scheduleWrunOverlayLiveTick` (the live tick lane): nothing without the overlay's live session. */
47
57
  export declare function scheduleWrunOverlayLiveTick(...args: EntryArgs<'scheduleWrunOverlayLiveTick'>): void;
58
+ /** `wrunLiveFrameMarketAdmitted` (the live intake's market rule, before the live feed hands a frame to the tick
59
+ * lane): true without the overlay's live session, as the intake answers. Late, false: the runtime loads, and the
60
+ * frames after it lands are judged by the intake. */
61
+ export declare function wrunLiveFrameMarketAdmitted(indicatorId: string, series: WrunLiveFrameSeries): boolean;
62
+ /** `markWrunLiveGap` (the live intake's reconcile mark, the workspace poll's poll-due): nothing without the overlay's
63
+ * live session, as the intake does. Late, the gap is marked when the runtime lands. */
64
+ export declare function markWrunLiveGap(indicatorId: string, reason: WrunLiveGapReason): void;
48
65
  /** `feedWrunRideBookRows` (the live tick lane): false when nothing was queued. */
49
66
  export declare function feedWrunRideBookRows(...args: EntryArgs<'feedWrunRideBookRows'>): boolean;
50
67
  export {};
@@ -119,6 +119,28 @@ export function scheduleWrunOverlayLiveTick(...args) {
119
119
  return;
120
120
  void whenLoaded('live-tick', indicatorId, (loaded) => loaded.scheduleWrunOverlayLiveTick(...args));
121
121
  }
122
+ /** `wrunLiveFrameMarketAdmitted` (the live intake's market rule, before the live feed hands a frame to the tick
123
+ * lane): true without the overlay's live session, as the intake answers. Late, false: the runtime loads, and the
124
+ * frames after it lands are judged by the intake. */
125
+ export function wrunLiveFrameMarketAdmitted(indicatorId, series) {
126
+ if (runtime)
127
+ return runtime.wrunLiveFrameMarketAdmitted(indicatorId, series);
128
+ if (!hasWrunOverlayLiveContext(indicatorId))
129
+ return true;
130
+ void whenLoaded('market-admitted', indicatorId, () => undefined);
131
+ return false;
132
+ }
133
+ /** `markWrunLiveGap` (the live intake's reconcile mark, the workspace poll's poll-due): nothing without the overlay's
134
+ * live session, as the intake does. Late, the gap is marked when the runtime lands. */
135
+ export function markWrunLiveGap(indicatorId, reason) {
136
+ if (runtime) {
137
+ runtime.markWrunLiveGap(indicatorId, reason);
138
+ return;
139
+ }
140
+ if (!hasWrunOverlayLiveContext(indicatorId))
141
+ return;
142
+ void whenLoaded('live-gap', indicatorId, (loaded) => loaded.markWrunLiveGap(indicatorId, reason));
143
+ }
122
144
  /** `feedWrunRideBookRows` (the live tick lane): false when nothing was queued. */
123
145
  export function feedWrunRideBookRows(...args) {
124
146
  if (runtime)
@@ -29,6 +29,15 @@
29
29
  * paints, fresh replaces"): the kScript runner's arm, take, bypass-token and
30
30
  * restore rules under the wrun id.
31
31
  *
32
+ * A chart that holds a wrun overlay publishes its chrome safe-area insets to
33
+ * the engine (DW06) while the overlay stands: the engine places records by
34
+ * them that the drawing safe area never sees (a docked matrix's header, a
35
+ * note label flagged for the chrome), on charts with no HUD, corner group or
36
+ * `safeArea` card. Each integrated run holds the chart's one chrome tracker
37
+ * for the overlay (`holdChartChromeSafeArea`, the tracker the drawings door
38
+ * and the HUD layer share), and the overlay's teardown lets go of it; a pause
39
+ * keeps it, since the paused picture stays.
40
+ *
32
41
  * The recovery ladders (heal, source rungs, casualty window) live in
33
42
  * wrun-overlay-recovery.util; the door re-exports the hold and the heal.
34
43
  * Import graph as in the drivers registry: the chart store and titan-charts are
@@ -114,5 +123,5 @@ export declare function resyncWrunOverlayAfterWake(chartIndex: number, indicator
114
123
  * without a driver.
115
124
  */
116
125
  export declare function withWrunOverlayExecutionMeasure<T>(chartIndex: number, indicatorId: string, reason: string, run: () => T): T;
117
- /** Clears the door's state and the recovery ladders' state. */
126
+ /** Clears the door's state (the chrome holds let go) and the recovery ladders' state. */
118
127
  export declare function __resetWrunOverlayLifecycleForTests(): void;
@@ -6,6 +6,7 @@ import { resolveLocalTechnicalScriptLazyRefreshRange, } from '../chart/local-tec
6
6
  import { overlayExecutionGuardKey } from '../chart/overlay-execution-guard-key.leaf.js';
7
7
  import { armLocalKScriptSourceRevalidation, clearLocalKScriptSourceRevalidation, disarmLocalKScriptSourceRevalidation, hasPendingLocalKScriptSourceRevalidation, installLocalKScriptSourceCacheBypass, markLocalKScriptSourceCacheHit, releaseLocalKScriptSourceCacheBypass, takePendingLocalKScriptSourceRevalidation, } from '../chart/local-kscript-source-revalidation.util.js';
8
8
  import { getChartDataFetchGeneration } from '../chart/chart-data-fetch-generation.util.js';
9
+ import { holdChartChromeSafeArea, releaseChartChromeSafeArea, } from '../chart/kscript-drawing-safe-area.util.js';
9
10
  import { isRealChartTimeRangeMs } from '../chart/chart-time-domain.util.js';
10
11
  import { ohlcvRowsHaveFiniteClose } from '../chart/ohlcv-row-readiness.util.js';
11
12
  import { wrunChartHostEnv } from '../../host-env.js';
@@ -426,12 +427,55 @@ async function runWrunSourceRevalidation(chartIndex, indicatorId, armedGeneratio
426
427
  }
427
428
  }
428
429
  // ---------------------------------------------------------------------------
430
+ // The chart chrome a wrun overlay's chart publishes (DW06)
431
+ // ---------------------------------------------------------------------------
432
+ // Per overlay: the chart engine its chrome hold is on.
433
+ const chromeHolds = new Map();
434
+ /**
435
+ * After an integrated run: the overlay's chart keeps its chrome insets
436
+ * reaching the engine. Every run holds again (a second hold of an id is no
437
+ * change), so a tracker that stopped with its pane DOM starts again with the
438
+ * next run; a chart replaced at the index takes the hold from the old engine.
439
+ * Never throws: the run it follows already landed.
440
+ */
441
+ function holdWrunChartChrome(indicatorId, chartIndex) {
442
+ if (!hasWrunOverlayDriver(indicatorId))
443
+ return;
444
+ try {
445
+ const tc = wrunChartHostEnv().chart.instance(chartIndex);
446
+ if (!tc)
447
+ return;
448
+ const held = chromeHolds.get(indicatorId);
449
+ if (held !== undefined && held !== tc)
450
+ releaseChartChromeSafeArea(held, indicatorId);
451
+ chromeHolds.set(indicatorId, tc);
452
+ holdChartChromeSafeArea(tc, indicatorId);
453
+ }
454
+ catch (error) {
455
+ console.warn('[wrun] could not hold the chart chrome for', indicatorId, error);
456
+ }
457
+ }
458
+ /** The overlay left its chart: its chrome hold goes (the chart's last hold sends the engine null insets). */
459
+ function releaseWrunChartChrome(indicatorId) {
460
+ const held = chromeHolds.get(indicatorId);
461
+ if (held === undefined)
462
+ return;
463
+ chromeHolds.delete(indicatorId);
464
+ releaseChartChromeSafeArea(held, indicatorId);
465
+ }
466
+ /** The door's one success hook: the chrome hold, then the SWR revalidation the run may owe. */
467
+ function onWrunComputeSucceeded(indicatorId, chartIndex) {
468
+ holdWrunChartChrome(indicatorId, chartIndex);
469
+ maybeScheduleWrunSourceRevalidation(indicatorId, chartIndex);
470
+ }
471
+ // ---------------------------------------------------------------------------
429
472
  // Teardown, registrations, test seam
430
473
  // ---------------------------------------------------------------------------
431
474
  /** Everything the door holds for one overlay goes with it, the SWR marks and
432
475
  * token under its id included (data-loading rule 3). A live-session suspend
433
- * runs the same hooks; the next integrated run marks and arms again. */
434
- function dropWrunLifecycleState(indicatorId) {
476
+ * runs the same hooks; the next integrated run marks and arms again. The
477
+ * chrome hold is the overlay's, not the session's: a suspend keeps it. */
478
+ function dropWrunLifecycleState(indicatorId, cause) {
435
479
  const timer = revalidationTimers.get(indicatorId);
436
480
  if (timer !== undefined)
437
481
  clearTimeout(timer);
@@ -440,12 +484,14 @@ function dropWrunLifecycleState(indicatorId) {
440
484
  revalidationCharts.delete(indicatorId);
441
485
  if (chartIndex !== undefined)
442
486
  clearLocalKScriptSourceRevalidation(chartIndex, indicatorId);
487
+ if (cause !== 'suspend')
488
+ releaseWrunChartChrome(indicatorId);
443
489
  }
444
490
  // Registered at import like the live intake and the tick lane. Specs that mock
445
491
  // the drivers util partially have no hook registry (reading a missing export of
446
492
  // a mocked module throws), so the registration is skipped there.
447
493
  try {
448
- onWrunOverlayComputeSucceeded(maybeScheduleWrunSourceRevalidation);
494
+ onWrunOverlayComputeSucceeded(onWrunComputeSucceeded);
449
495
  }
450
496
  catch {
451
497
  // partial module mock (specs)
@@ -456,11 +502,13 @@ try {
456
502
  catch {
457
503
  // partial module mock (specs)
458
504
  }
459
- /** Clears the door's state and the recovery ladders' state. */
505
+ /** Clears the door's state (the chrome holds let go) and the recovery ladders' state. */
460
506
  export function __resetWrunOverlayLifecycleForTests() {
461
507
  for (const timer of revalidationTimers.values())
462
508
  clearTimeout(timer);
463
509
  revalidationTimers.clear();
464
510
  revalidationCharts.clear();
511
+ for (const indicatorId of [...chromeHolds.keys()])
512
+ releaseWrunChartChrome(indicatorId);
465
513
  __resetWrunOverlayRecoveryForTests();
466
514
  }
@@ -88,6 +88,13 @@ export declare function healWrunOverlayIfIdle(chartIndex: number, indicatorId: s
88
88
  * read is still out (run-schedule/wrun-late-reads.util) the ladder never asks
89
89
  * it again: the rung runs the moment the reads answer (their rows adopted),
90
90
  * and a rung that comes due first waits for them (their read joined).
91
+ * A lane that drew its first-paint slice alone (cause `filling`: the rest of
92
+ * its window is its late read) rides the same ladder: its rung runs when that
93
+ * read answers, adopts it, and spends no attempt when it adopts fills alone
94
+ * (`runWrunSourceRung`). An arm of fills alone comes from a run that landed
95
+ * every other lane, so it ends the episode it ran in (as such a run retires
96
+ * it) and starts a fresh one: an exhausted or terminal episode never strands a
97
+ * fill.
91
98
  */
92
99
  export declare function armWrunSourceRecovery(chartIndex: number, indicatorId: string, degraded: ReadonlyArray<WrunDegradedLane>): void;
93
100
  /** Drop one overlay's source ladder: every lane landed ('recovered'), a user
@@ -521,6 +521,13 @@ const settledRuns = new Map();
521
521
  * read is still out (run-schedule/wrun-late-reads.util) the ladder never asks
522
522
  * it again: the rung runs the moment the reads answer (their rows adopted),
523
523
  * and a rung that comes due first waits for them (their read joined).
524
+ * A lane that drew its first-paint slice alone (cause `filling`: the rest of
525
+ * its window is its late read) rides the same ladder: its rung runs when that
526
+ * read answers, adopts it, and spends no attempt when it adopts fills alone
527
+ * (`runWrunSourceRung`). An arm of fills alone comes from a run that landed
528
+ * every other lane, so it ends the episode it ran in (as such a run retires
529
+ * it) and starts a fresh one: an exhausted or terminal episode never strands a
530
+ * fill.
524
531
  */
525
532
  export function armWrunSourceRecovery(chartIndex, indicatorId, degraded) {
526
533
  if (!hasWrunOverlayDriver(indicatorId))
@@ -543,9 +550,17 @@ export function armWrunSourceRecovery(chartIndex, indicatorId, degraded) {
543
550
  waitingOnReads: false,
544
551
  unwatch: undefined,
545
552
  episode: wrunSourceRecoveryEpisodeOf(chartIndex, indicatorId),
553
+ fillRung: false,
546
554
  };
547
555
  sourceRecoveries.set(indicatorId, recovery);
548
556
  }
557
+ const fillsAlone = retryable.every((lane) => lane.cause === 'filling');
558
+ if (fillsAlone && (recovery.step > 0 || recovery.terminal)) {
559
+ recovery.step = 0;
560
+ recovery.terminal = false;
561
+ recovery.episode = wrunSourceRecoveryEpisodeOf(chartIndex, indicatorId);
562
+ }
563
+ recovery.fillRung = fillsAlone;
549
564
  recovery.chartIndex = chartIndex;
550
565
  recovery.lanes = new Map(retryable.map((lane) => [lane.lane, lane]));
551
566
  recovery.armedAtSettle = settledRuns.get(indicatorId) ?? 0;
@@ -713,12 +728,21 @@ async function runWrunSourceRung(indicatorId, recovery) {
713
728
  scheduleWrunSourceRung(indicatorId, recovery, true);
714
729
  return;
715
730
  }
716
- recovery.step += 1;
731
+ // A rung that adopts planned fills alone (its arm's lanes all drew their first-paint slice alone, and every one's read
732
+ // answered with rows) answers no failure: it spends none of the episode's attempts, so a first paint never shortens
733
+ // the ladder a real degrade gets. The arm's one rung: a rung after it (its run failed, or did not arm again) counts,
734
+ // so the ladder stays bounded.
735
+ const lanes = [...recovery.lanes.keys()];
736
+ const fillOnly = recovery.fillRung && wrunLateReadsAnswered(indicatorId, lanes).length === lanes.length;
737
+ recovery.fillRung = false;
738
+ if (!fillOnly)
739
+ recovery.step += 1;
717
740
  ring('wrun-source-recovery-rung', {
718
741
  chartIndex: recovery.chartIndex,
719
742
  indicatorId,
720
743
  attempt: recovery.step,
721
744
  lanes: [...recovery.lanes.keys()],
745
+ ...(fillOnly ? { fill: true } : {}),
722
746
  });
723
747
  // The rung answers an attempt of its episode's origin and reason (`episode`), so the record it ends on names the
724
748
  // episode that started the ladder.
@@ -43,6 +43,12 @@ export interface WrunOverlayResultOptions {
43
43
  * `visible_by` does not list it mounts nothing, nor the stats rows drawn
44
44
  * from it (wrunRowVisibleHere). Absent reads 0, the unknown unit. */
45
45
  sizeUnit?: number;
46
+ /** The chart market's dollar unit (wrunMarketDollarUnit when proven: the US
47
+ * dollars one price unit times one size unit is worth; NQ 20, 1 on crypto),
48
+ * read beside the size unit by every build (wrun-overlay-run.util
49
+ * `wrunResultMarketUnits`): the batched marks children's `units` caption and
50
+ * hover divide a record's dollar value by it. Absent: none is proven. */
51
+ valuePerUnit?: number;
46
52
  /** WRUN-STYLE (g6): the run's celled source rows the price canvases
47
53
  * (heatmaps, footprints, TPO letters, time-anchored profiles) draw from. */
48
54
  cellRows?: WrunCellRows;
@@ -107,7 +113,7 @@ export declare const WRUN_RESULT_CAPTURE_LIMIT = 8;
107
113
  * of trades behind it, more than a rig's process holds (2026-10-17: the TIP corpus run died at 4 GB on the eighth
108
114
  * package). A key added to the options must be added here, or the type below fails to compile.
109
115
  */
110
- export declare const WRUN_OVERLAY_RESULT_OPTION_KEYS: readonly ["metadata", "outputRows", "title", "params", "texts", "position", "axis", "colors", "fills", "candles", "chartNames", "runTimeline", "priceDigits", "sizeUnit", "cellRows", "canvasTailRows", "batchedTailFromTs", "intervalMs", "exchange", "priceTick", "overlayId", "tpoBlockSize", "legendNote"];
116
+ export declare const WRUN_OVERLAY_RESULT_OPTION_KEYS: readonly ["metadata", "outputRows", "title", "params", "texts", "position", "axis", "colors", "fills", "candles", "chartNames", "runTimeline", "priceDigits", "sizeUnit", "valuePerUnit", "cellRows", "canvasTailRows", "batchedTailFromTs", "intervalMs", "exchange", "priceTick", "overlayId", "tpoBlockSize", "legendNote"];
111
117
  /**
112
118
  * Record one build on a corpus lane's page (`globalThis.__omRig === true` and the store `__wrunResultCapture` the lane
113
119
  * created before the app loaded) under `__wrunResultCapture[<overlay id, else the title>]`, newest last, the last
@@ -64,6 +64,7 @@ export function buildWrunOverlayRunResult(options) {
64
64
  ...(options.cellRows !== undefined ? { cellRows: options.cellRows } : {}),
65
65
  ...(options.canvasTailRows !== undefined ? { canvasTailRows: options.canvasTailRows } : {}),
66
66
  ...(options.batchedTailFromTs !== undefined ? { batchedTailFromTs: options.batchedTailFromTs } : {}),
67
+ ...(options.valuePerUnit !== undefined ? { valuePerUnit: options.valuePerUnit } : {}),
67
68
  ...(options.intervalMs !== undefined ? { intervalMs: options.intervalMs } : {}),
68
69
  ...(options.exchange !== undefined ? { exchange: options.exchange } : {}),
69
70
  ...(options.priceTick !== undefined ? { priceTick: options.priceTick } : {}),
@@ -166,6 +167,7 @@ export const WRUN_OVERLAY_RESULT_OPTION_KEYS = [
166
167
  'runTimeline',
167
168
  'priceDigits',
168
169
  'sizeUnit',
170
+ 'valuePerUnit',
169
171
  'cellRows',
170
172
  'canvasTailRows',
171
173
  'batchedTailFromTs',