@orangecharts/wrun-chart-host 0.15.0 → 0.16.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 (175) hide show
  1. package/README.md +1 -0
  2. package/dist/constants/economic.constants.d.ts +2 -0
  3. package/dist/constants/economic.constants.js +2 -0
  4. package/dist/constants/feature-flags.constants.d.ts +10 -0
  5. package/dist/constants/feature-flags.constants.js +52 -4
  6. package/dist/constants/feature-limits.constants.d.ts +72 -4
  7. package/dist/constants/feature-limits.constants.js +98 -20
  8. package/dist/constants/interval.constants.js +5 -0
  9. package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +12 -0
  10. package/dist/constants/kscript-data-interval-restrictions.constants.js +14 -0
  11. package/dist/constants/typed-width-fold.leaf.d.ts +50 -0
  12. package/dist/constants/typed-width-fold.leaf.js +99 -0
  13. package/dist/constants/typed-width-source.leaf.d.ts +24 -0
  14. package/dist/constants/typed-width-source.leaf.js +126 -0
  15. package/dist/constants/typed-width.leaf.d.ts +57 -0
  16. package/dist/constants/typed-width.leaf.js +78 -0
  17. package/dist/host-env.d.ts +10 -0
  18. package/dist/host-env.js +7 -0
  19. package/dist/host-ports.types.d.ts +11 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/index.js +3 -0
  22. package/dist/interfaces/kscript-diagnostics.interface.d.ts +28 -0
  23. package/dist/interfaces/wrun-runtime.interface.d.ts +63 -3
  24. package/dist/interfaces/wrun-runtime.interface.js +11 -0
  25. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +13 -0
  26. package/dist/kscript-data/controls/live-trades-merge.util.js +16 -1
  27. package/dist/market-data/billing.interface.d.ts +12 -45
  28. package/dist/market-data/billing.interface.js +2 -2
  29. package/dist/replay/replayLadder.js +7 -4
  30. package/dist/settings-templates/footprint-rows.d.ts +6 -0
  31. package/dist/settings-templates/footprint-rows.js +6 -0
  32. package/dist/settings-templates/frvp-fields.js +14 -0
  33. package/dist/settings-templates/indicator-fields.js +31 -0
  34. package/dist/settings-templates/tool-tables.generated.js +19 -1
  35. package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
  36. package/dist/utility/chart/cache-alignment.util.d.ts +42 -0
  37. package/dist/utility/chart/cache-alignment.util.js +88 -18
  38. package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
  39. package/dist/utility/chart/calendar-interval.util.js +152 -4
  40. package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
  41. package/dist/utility/chart/candle-bar-end.util.js +17 -6
  42. package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
  43. package/dist/utility/chart/chart-time-domain.util.js +13 -4
  44. package/dist/utility/chart/feed-interval.util.d.ts +4 -2
  45. package/dist/utility/chart/feed-interval.util.js +5 -2
  46. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
  47. package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
  48. package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
  49. package/dist/utility/chart/footprint-display-mode.util.js +5 -0
  50. package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
  51. package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
  52. package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
  53. package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
  54. package/dist/utility/chart/history-wall.util.d.ts +13 -2
  55. package/dist/utility/chart/history-wall.util.js +11 -4
  56. package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
  57. package/dist/utility/chart/interval-ladder.util.js +44 -4
  58. package/dist/utility/chart/interval-registry.util.d.ts +22 -1
  59. package/dist/utility/chart/interval-registry.util.js +50 -2
  60. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
  61. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
  62. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
  63. package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
  64. package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
  65. package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
  66. package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
  67. package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
  68. package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
  69. package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
  70. package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
  71. package/dist/utility/chart/live-bucket.util.d.ts +29 -4
  72. package/dist/utility/chart/live-bucket.util.js +45 -12
  73. package/dist/utility/chart/market-session.util.d.ts +62 -10
  74. package/dist/utility/chart/market-session.util.js +93 -13
  75. package/dist/utility/chart/marketKind.util.d.ts +1 -7
  76. package/dist/utility/chart/marketKind.util.js +6 -8
  77. package/dist/utility/chart/mixed-mode.util.d.ts +17 -0
  78. package/dist/utility/chart/om-target.util.js +6 -4
  79. package/dist/utility/chart/price-precision.util.d.ts +20 -6
  80. package/dist/utility/chart/price-precision.util.js +34 -7
  81. package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
  82. package/dist/utility/chart/profile-frame-window.util.js +12 -0
  83. package/dist/utility/chart/rth-session.util.d.ts +3 -1
  84. package/dist/utility/chart/rth-session.util.js +3 -1
  85. package/dist/utility/chart/script-source-session.util.d.ts +43 -0
  86. package/dist/utility/chart/script-source-session.util.js +61 -0
  87. package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
  88. package/dist/utility/chart/typed-width-grid.util.js +203 -0
  89. package/dist/utility/common/transformations.util.d.ts +6 -0
  90. package/dist/utility/common/transformations.util.js +28 -4
  91. package/dist/utility/number-format.util.d.ts +14 -1
  92. package/dist/utility/number-format.util.js +22 -4
  93. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
  94. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +113 -0
  95. package/dist/utility/v2/v2-enums.leaf.js +3 -0
  96. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +9 -3
  97. package/dist/utility/wrun/wrun-batched-marks.util.js +65 -17
  98. package/dist/utility/wrun/wrun-canvases.util.d.ts +4 -2
  99. package/dist/utility/wrun/wrun-canvases.util.js +7 -12
  100. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
  101. package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
  102. package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
  103. package/dist/utility/wrun/wrun-card-style.util.js +2 -2
  104. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +8 -0
  105. package/dist/utility/wrun/wrun-chart-market-facts.util.js +13 -1
  106. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
  107. package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
  108. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
  109. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
  110. package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
  111. package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
  112. package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
  113. package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
  114. package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
  115. package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
  116. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
  117. package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
  118. package/dist/utility/wrun/wrun-frames.d.ts +1 -1
  119. package/dist/utility/wrun/wrun-frames.js +2 -2
  120. package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
  121. package/dist/utility/wrun/wrun-handles.util.js +1 -1
  122. package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
  123. package/dist/utility/wrun/wrun-host.service.js +44 -2
  124. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
  125. package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
  126. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
  127. package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
  128. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
  129. package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
  130. package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
  131. package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
  132. package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
  133. package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
  134. package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
  135. package/dist/utility/wrun/wrun-live-tick.util.js +59 -4
  136. package/dist/utility/wrun/wrun-overlay-drivers.util.js +3 -0
  137. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +15 -0
  138. package/dist/utility/wrun/wrun-overlay-run.util.js +274 -47
  139. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +1 -1
  140. package/dist/utility/wrun/wrun-panel-mount.util.js +42 -13
  141. package/dist/utility/wrun/wrun-pin-venues.util.js +5 -1
  142. package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
  143. package/dist/utility/wrun/wrun-refusal.util.js +102 -13
  144. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  145. package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
  146. package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
  147. package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
  148. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
  149. package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
  150. package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
  151. package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
  152. package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
  153. package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
  154. package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
  155. package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
  156. package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
  157. package/dist/utility/wrun/wrun-style-words.util.js +46 -15
  158. package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
  159. package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
  160. package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
  161. package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
  162. package/dist/utility/wrun-display-name.util.d.ts +10 -0
  163. package/dist/utility/wrun-display-name.util.js +21 -0
  164. package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
  165. package/dist/utils/replay/replay-buffer-math.js +2 -0
  166. package/dist/workers/constants/socket-slots.d.ts +1 -1
  167. package/dist/workers/utils/time.worker.util.js +2 -2
  168. package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
  169. package/dist/workers/utils/volume-profile.worker.util.js +20 -0
  170. package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
  171. package/dist/workers/wrun/wrun-abi-host.js +82 -5
  172. package/dist/workers/wrun/wrun-engine-handler.js +53 -4
  173. package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
  174. package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
  175. package/package.json +11 -11
@@ -86,7 +86,7 @@ import { isStocksTapeGoverned } from '../v2/stocks-governed.util.js';
86
86
  import { noteWrunGatePlaneStopped, noteWrunGatePlanesRead } from './wrun-gate-plane-readers.util.js';
87
87
  import { wrunGateLatchedThunks, wrunLaneGatePlanes, wrunLaneGateStopOf, wrunSessionStopPlaneOf, } from './wrun-options-stop.util.js';
88
88
  import { annotateWrunRunFailedIdentity, noteWrunRunRetained, wrunRunIdentityOf } from './wrun-cap-notice.util.js';
89
- import { wrunIntegrationRoute } from './wrun-integration-route.util.js';
89
+ import { wrunIntegrationRoute, wrunRunDrawingsPlan, wrunRunOwesFullIntegration, } from './wrun-integration-route.util.js';
90
90
  import { placeWrunTablesOnChart } from './wrun-table-chrome.util.js';
91
91
  import { projectKScriptRunResultOntoChartBars } from '../chart/kscript-run-interval-projection.util.js';
92
92
  import { runBarSpan } from '../chart/indicator-run-interval.util.js';
@@ -148,14 +148,14 @@ import { WRUN_PINNED_LANE_SPECS, isWrunPinnedLaneId, wrunPinnedLaneExtras, wrunP
148
148
  import { WRUN_LEG_STREAM_CLASSES, isWrunLegStreamClass, wrunLegStreamPayloadWords } from './wrun-leg-stream-classes.js';
149
149
  import { isWrunTradesLegLane, planWrunTradeLegAsk, WRUN_TRADES_LANES, wrunLegPlacementLeadMs, wrunLegStraddlesChartBars, wrunLegVenueOf, wrunTradesLegOf, } from './wrun-trades-lane.util.js';
150
150
  import { substituteWrunChartNames, wrunChartContextHostFill, wrunChartIntervalMsOf, } from './wrun-chart-context.util.js';
151
- import { forgetWrunMarketReadFailures, warmWrunMarketDollarFacts, warmWrunMarketFacts, wrunChartSizeUnit, wrunLaneDemandNeedsDirectory, wrunMarketDollarReadFailure, wrunMarketDollarUnit, wrunMarketReadMark, wrunMarketFactsFor, wrunMarketFactsNeedDirectory, wrunReadsDollarMultiplier, wrunReadsMarketFacts, wrunCoinLegsOf, wrunCoinLegVenues, wrunSheetWithCoinLegs, wrunSheetWithLaneCurrencies, wrunSheetWithLaneDemand, wrunSheetWithLaneGate, WRUN_DOLLAR_MULTIPLIER_FILL, WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE, } from './wrun-chart-market-facts.util.js';
151
+ import { forgetWrunMarketReadFailures, warmWrunMarketDollarFacts, warmWrunMarketFacts, wrunChartSizeUnit, wrunLaneDemandNeedsDirectory, wrunMarketDollarReadFailure, wrunMarketDollarUnit, wrunMarketReadMark, wrunMarketFactsFor, wrunMarketFactsNeedDirectory, wrunReadsDollarMultiplier, wrunReadsMarketFacts, wrunStrategyPointValue, wrunCoinLegsOf, wrunCoinLegVenues, wrunSheetWithCoinLegs, wrunSheetWithLaneCurrencies, wrunSheetWithLaneDemand, wrunSheetWithLaneGate, WRUN_DOLLAR_MULTIPLIER_FILL, WRUN_DOLLAR_MULTIPLIER_UNPROVEN_CODE, } from './wrun-chart-market-facts.util.js';
152
152
  import { wrunFollowsCoin, wrunInputGateOn, wrunRowVisibleHere } from './wrun-market-facts.util.js';
153
153
  import { wrunRowsKeepingMarketDefaults } from './wrun-market-size-defaults.leaf.js';
154
154
  import { reconcileWrunMarketSizeDefaults } from './wrun-market-size-defaults.util.js';
155
155
  import { rememberWrunSessionChartNames, resolveWrunChartNames, wrunSessionChartNamesOf, } from './wrun-chart-context-names.util.js';
156
156
  import { assertWrunBrowserSources, getWrunBrowserHost, } from './wrun-host.service.js';
157
157
  import { applyWrunInertLegendState } from './wrun-inert-legend.util.js';
158
- import { annotateWrunErrorRefusal, attachWrunRefusal, serializeWrunRefusal, stampWrunRefusalTelemetry, wrunAuthorRuleSeed, wrunLeftOutRefusalSeed, wrunOptionsStopSeed, wrunOverlayEditable, wrunRefusalFor, wrunRefusalOf, wrunRefusalSeedFor, wrunRefusalSeedOf, WRUN_REFUSAL_EVENT_MARKET_KEY, } from './wrun-refusal.util.js';
158
+ import { annotateWrunErrorRefusal, attachWrunRefusal, serializeWrunRefusal, stampWrunRefusalTelemetry, wrunAuthorRuleSeed, wrunLeftOutRefusalSeed, wrunOptionsStopSeed, wrunOverlayEditable, wrunRefusalFor, wrunRefusalOf, wrunRefusalSeedFor, wrunRefusalSeedOf, wrunTapeIntervalSeed, WRUN_REFUSAL_EVENT_MARKET_KEY, } from './wrun-refusal.util.js';
159
159
  import { claimWrunRefusalNotice, emitWrunRefusalChange, liveWrunRefusalAttempt, projectWrunRefusal, retractWrunRefusal, } from './wrun-refusal-surface.util.js';
160
160
  import { WRUN_ETF_COVERED_COINS, wrunInputDrawsWithoutLane, wrunInputReadsFillOverEmptyLane, wrunInputRequirements, wrunPredictionMarketWalledInput, wrunRunMarketReadOfFetchType, wrunSheetReadsRunMarket, wrunUnservedLanes, } from './wrun-input-requirements.leaf.js';
161
161
  import { getWrunOverlayMetadata, rememberWrunOverlayMetadata } from './wrun-overlay-metadata.util.js';
@@ -189,9 +189,10 @@ import { getMarketKind } from '../chart/marketKind.util.js';
189
189
  import { isCmeGoverned } from '../chart/cme-realtime.util.js';
190
190
  import { wrunBarSessionFactsResolver, wrunBarVenueOf } from '../chart/wrun-bar-session-facts.util.js';
191
191
  import { wrunPresentIsPartial } from './wrun-present-bits.util.js';
192
- import { assertWrunPinnedLegVenues, partitionWrunLegsByVenue, wrunLegFetchedRowReaders, wrunLegRidesNativeRows, wrunPinMarketsOf, wrunPinnedLegRefusalOf, wrunPinVenueVerdict, } from './wrun-pin-venues.util.js';
192
+ import { assertWrunPinnedLegVenues, partitionWrunLegsByVenue, wrunLegFetchedRowReaders, wrunLegRidesNativeRows, wrunPinMarketsOf, wrunPinnedLegRefusalOf, wrunPinVenueRefusalMessage, wrunPinVenueVerdict, } from './wrun-pin-venues.util.js';
193
+ import { captureCmeLanesFence, isCmeLanesFenceCurrent } from '../chart/governed-lanes-gate.util.js';
193
194
  import { annotateWrunErrorFailureRow, annotateWrunErrorIndicatorId, isWrunOverlayPausedError, isWrunQuarantinedError, isWrunWorkerPoisonError, WrunChartGoneError, WrunDeadlineError, WrunIntegrationError, WrunLaneVenueBlockedError, WrunNoBarsError, WrunOverlayPausedError, WrunPredictionMarketBlockedError, WrunSourceDataUnavailableError, WrunStrategyVenueBlockedError, WrunVenueBlockedError, } from './wrun-registry-errors.util.js';
194
- import { cmePinRefusalVariant, createKScriptVenueBlockedError, isCmeChartStudyRun, isCmeReadableKScriptRun, isCmeUserScriptCandidate, isCmeUserScriptRun, isKScriptDisplayBlockedOnExchange, isOfficialWrunOverlay, isOpraUserScriptCandidate, isOpraUserScriptRun, payloadTouchesCmeVenue, payloadTouchesOpraVenue, } from '../chart/kscript-venue-policy.util.js';
195
+ import { cmePinRefusalVariant, cmeServerLanesOpen, createKScriptVenueBlockedError, isFirstPartyKScriptRun, isUserKScriptBlockedOnExchange, userRunServerLaneOf, isCmeChartStudyRun, isCmeReadableKScriptRun, isCmeUserScriptCandidate, isCmeStrategyClosed, isCmeUserScriptRun, isKScriptDisplayBlockedOnExchange, isOfficialWrunOverlay, isOpraUserScriptCandidate, isOpraUserScriptRun, payloadTouchesCmeVenue, payloadTouchesOpraVenue, } from '../chart/kscript-venue-policy.util.js';
195
196
  import { planeReadFactsOf } from '../chart/opra-read-access.leaf.js';
196
197
  import { isOpraUserScriptsFlagOn } from '../chart/opra-user-scripts-gate.util.js';
197
198
  import { captureCmeStudyAuth, cmeStudyStopReason, isCmeStudyAuthCurrent, isCmeUserScriptsFlagOn, } from '../chart/cme-user-scripts-gate.util.js';
@@ -205,6 +206,7 @@ import { resolveWrunTapeAcquisition, WRUN_TAPE_COINS_UNPRICED_CODE, WRUN_TAPE_IN
205
206
  import { wrunChartSession, wrunLegCandleClose, wrunPrimaryRowBounds } from './wrun-leg-close.util.js';
206
207
  import { isWrunRowSourceTransientError, wrunRowBatchDeliveredSheet, wrunRowSourceSettingsLeftBy, } from './wrun-row-source.js';
207
208
  import { wrunOverlayOpraStamped } from './wrun-cloud-opra-stamp.util.js';
209
+ import { stampWrunHostedCme, wrunBatchGovernedOf, wrunFailureGovernedOf, wrunGovernedReadsCme, wrunHostedRunReadsCme, } from './wrun-cloud-cme-stamp.util.js';
208
210
  // The run's one options market (the row lanes' planner holds the module on this graph already).
209
211
  import { decideWrunRunOptionsMarket, noteWrunRunOptionsMarket, wrunDecidedOptionsExchange, } from './derived-roots.util.js';
210
212
  import { wrunRowSourceFor } from './wrun-row-source-factory.js';
@@ -228,8 +230,9 @@ import { wrunTwinOriginalLookbackBars } from './wrun-twin-lookback.util.js';
228
230
  import { overlayWrunRunInterval, wrunSettingsForRunInterval, wrunTimeframeIsChartOrFiner, wrunTwinLookbackBars, } from './wrun-run-interval.util.js';
229
231
  import { planWrunRunIntervalRows, rememberWrunRunIntervalSession, wrunRunIntervalComputeRows, wrunRunIntervalCoverageKey, wrunRunIntervalProjectionOf, wrunRunIntervalRowsThrough, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
230
232
  import { isWrunBandedBookSource } from './wrun-book-bands.leaf.js';
231
- import { attachWrunLive, wrunLiveOf, } from '../../interfaces/wrun-runtime.interface.js';
232
- import { normalizeRuntimeDiagnostics, shouldNoticeWrunRefusal, WRUN_RUN_FAILURE_ROW_CODES, WRUN_RUN_TIMEOUT_CODE, wrunAbortRuntimeDiagnostic, wrunRunFailureRuntimeDiagnostic, } from '../scriptEditor/wrun-runtime-diagnostics.leaf.js';
233
+ import { attachWrunLive, wrunLiveOf, wrunTrapOf, } from '../../interfaces/wrun-runtime.interface.js';
234
+ import { normalizeRuntimeDiagnostics, shouldNoticeWrunRefusal, WRUN_RUN_FAILURE_ROW_CODES, WRUN_RUN_TIMEOUT_CODE, WRUN_ABORT_DIAGNOSTIC_CODE, WRUN_UNREACHABLE_TRAP_CODE, wrunAbortRuntimeDiagnostic, wrunRunFailureRuntimeDiagnostic, wrunTrapRuntimeDiagnostic, } from '../scriptEditor/wrun-runtime-diagnostics.leaf.js';
235
+ import { parkWrunTrapSeed, wrunTrapSeedOf } from './wrun-trap-replay.util.js';
233
236
  import { buildWrunOverlayRunResult, withCanvasHostFill, } from './wrun-overlay-result.util.js';
234
237
  import { applyWrunIntegrationBudgetPolicy, wrunIntegratedRowsView } from './wrun-integration-budget.util.js';
235
238
  // The result build lives in wrun-overlay-result.util (the result reader core); its importers keep this path.
@@ -565,10 +568,61 @@ export async function runWrunOverlayOnChart(target) {
565
568
  // that opens later judges the walled CME studies again (`armCmeUserScriptsRejudge`). A host that binds neither port
566
569
  // judges by the map as it stands.
567
570
  const cmeCandidate = isCmeUserScriptCandidate(provenance);
568
- // The sheet as the prediction wall reads it pins a CME market: read for a browser user run alone, the runs a CME
569
- // pin's flag wait and authorisation are for (an OpenMarket package reads CME as first-party).
570
- const sheetPinsCme = cmeCandidate &&
571
- wrunSheetPinsCme(wrunSheetWithLaneDemand(wrunSheetWithSettings(target.metadata, meta.settings), wrunChartSizeUnit(chartMetadata), meta.settings), typeof chartExchange === 'string' ? chartExchange : undefined);
571
+ // A server-lane user run (the decider's `userRunServerLaneOf`: a Cloud record), which no browser lane admits a leg
572
+ // for, and a first-party run, which reads a CME pin on any lane: both have their CME read marked from the head (the
573
+ // browser lanes mark a browser user run's as they admit its legs).
574
+ const serverLaneUser = userRunServerLaneOf(provenance) !== undefined;
575
+ const marksPinAtHead = serverLaneUser || isFirstPartyKScriptRun(provenance);
576
+ // The sheet as the prediction wall reads it pins a CME market: read for a user run the gate may open CME to (the runs
577
+ // a CME pin's flag wait and authorisation are for), and for every run whose pin is marked at the head.
578
+ const pinSheet = cmeCandidate || marksPinAtHead
579
+ ? wrunSheetWithLaneDemand(wrunSheetWithSettings(target.metadata, meta.settings), wrunChartSizeUnit(chartMetadata), meta.settings)
580
+ : undefined;
581
+ const pinExchange = typeof chartExchange === 'string' ? chartExchange : undefined;
582
+ const effectiveSheetPinsCme = pinSheet !== undefined && wrunSheetPinsCme(pinSheet, pinExchange);
583
+ const sheetPinsCme = cmeCandidate && effectiveSheetPinsCme;
584
+ // Such a run whose effective sheet pins a CME market reads CME whatever the chart (a hosted one on the server): its
585
+ // CME provenance is set from its head (`computed.cme`), before execution is asked, so every outcome of the run, a
586
+ // failure included, carries the mark (the AI boundary never opens on CME), for every author.
587
+ if (marksPinAtHead && effectiveSheetPinsCme)
588
+ computed.cme = true;
589
+ // ...and, under a lit `cme-lanes` flag, it passes the one CME decision every CME user run passes (invariant 2: the
590
+ // data wall's `isCmeReadableKScriptRun`, the `cme-user-scripts` gate with its kill switch, sign-in and the CME data
591
+ // terms) before anything is sent: no browser pin judge stands in a hosted run's way. Refused as the browser pin
592
+ // judge refuses (`pin-refused`, in the gate's words, `cmePinRefusalVariant`). Judged per pinned venue by the data
593
+ // wall (`isUserKScriptBlockedOnExchange`), so a venue the cutover never opens (GLOBEX) stays closed. While
594
+ // `cme-lanes` is dark (`cmeServerLanesOpen`) the cloud refuses the pin itself, as before.
595
+ const cmePins = serverLaneUser && effectiveSheetPinsCme && pinSheet !== undefined
596
+ ? pinSheet.inputs.flatMap((input) => {
597
+ if (!wrunSheetPinsCme({ inputs: [input], inputSources: pinSheet.inputSources }, pinExchange))
598
+ return [];
599
+ const source = pinSheet.inputSources[input.name];
600
+ const venue = typeof source?.exchange === 'string' && source.exchange !== '' ? source.exchange : 'CME';
601
+ return [{ name: input.name, venue, pin: String(source?.symbol ?? venue) }];
602
+ })
603
+ : [];
604
+ /** The pin refusal of one CME pin, in the gate's words as they read when it is raised. */
605
+ const cmePinRefusal = (pinned) => attachWrunRefusal(new Error(wrunPinVenueRefusalMessage(pinned.name, pinned.venue)), {
606
+ cls: 'pin-refused',
607
+ variant: cmePinRefusalVariant(provenance),
608
+ params: { pin: pinned.pin },
609
+ });
610
+ if (cmeServerLanesOpen()) {
611
+ const pinned = cmePins.find((entry) => isUserKScriptBlockedOnExchange(entry.venue, provenance));
612
+ if (pinned !== undefined)
613
+ throw cmePinRefusal(pinned);
614
+ }
615
+ // The CME lanes fence (governed-lanes-gate.util, 2026-11-11): a server-lane user run reading CME (on a CME chart, or
616
+ // pinning a CME market) captures it here; the `cme-lanes` flag going dark moves it, so this run's answer, in flight
617
+ // and stamped or not, never lands after the rollback (`assertWrunCmeStudyAuthCurrent`): it ends as the wall the
618
+ // decider now answers (on a CME chart the display wall the lifecycle paints, off one its pin refusal), never a blank
619
+ // pane or a live session. A browser run never captures it: the flag does not govern its lane.
620
+ if (serverLaneUser && (payloadTouchesCmeVenue(chartExchange) || cmePins.length > 0)) {
621
+ computed.cmeLanes = captureCmeLanesFence();
622
+ computed.cmeLanesClosed = () => payloadTouchesCmeVenue(chartExchange) || cmePins.length === 0
623
+ ? withCmeStudyStopSeed(new WrunVenueBlockedError(createKScriptVenueBlockedError(String(chartExchange)).message, chartExchange), target.chartIndex, target.indicatorId, chartExchange)
624
+ : cmePinRefusal(cmePins[0]);
625
+ }
572
626
  const cmeWallAhead = payloadTouchesCmeVenue(chartExchange)
573
627
  ? isKScriptDisplayBlockedOnExchange(chartExchange, provenance)
574
628
  : sheetPinsCme && !isCmeUserScriptRun(provenance);
@@ -588,11 +642,13 @@ export async function runWrunOverlayOnChart(target) {
588
642
  if (isKScriptDisplayBlockedOnExchange(candleVenue, provenance)) {
589
643
  throw withCmeStudyStopSeed(new WrunVenueBlockedError(createKScriptVenueBlockedError(String(candleVenue)).message, candleVenue), target.chartIndex, target.indicatorId, candleVenue);
590
644
  }
591
- // Strategy testing is no CME chart study (Kyle 2026-10-29): on a CME chart every strategy sheet is refused, an
592
- // OpenMarket package's included, here at the head before the loader is raised, a lane is asked or the sandbox is
593
- // touched (the broker feed, `wrunStrategyRunInputFor`, is never built), on every lane. A venue refusal held like
594
- // the wall's, with its own record on the legend (`cme-wall` `strategy`: no wall painter stands behind it).
595
- if (payloadTouchesCmeVenue(chartExchange) && isWrunStrategySheet(target.metadata)) {
645
+ // Strategy testing is no CME chart study while the `cme-lanes` cutover flag is dark (Kyle 2026-10-29): on a CME
646
+ // chart every strategy sheet is refused, an OpenMarket package's included, here at the head before the loader is
647
+ // raised, a lane is asked or the sandbox is touched (the broker feed, `wrunStrategyRunInputFor`, is never built), on
648
+ // every lane. A venue refusal held like the wall's, with its own record on the legend (`cme-wall` `strategy`: no
649
+ // wall painter stands behind it). Under a lit flag (`isCmeStrategyClosed` reads false) a strategy sheet on a CME
650
+ // chart runs through the ordinary CME study rule above: the display wall and the gate (sign-in, the CME terms).
651
+ if (wrunCmeStrategyClosedOn(chartExchange) && isWrunStrategySheet(target.metadata)) {
596
652
  throw attachWrunRefusal(new WrunStrategyVenueBlockedError(createKScriptVenueBlockedError(String(chartExchange)).message, chartExchange), WRUN_CME_STRATEGY_REFUSAL_SEED);
597
653
  }
598
654
  // The prediction-market wall (Kyle 2026-10-29: options indicators on a Polymarket chart make no sense): on a
@@ -877,10 +933,15 @@ function wrunRunRejectionAsSettled(error, run) {
877
933
  dropped.cause = WRUN_SUPERSEDED_RUN_CAUSE;
878
934
  return dropped;
879
935
  }
880
- /** The record seed of a strategy sheet the run head refuses on a CME chart (`WrunStrategyVenueBlockedError`): the CME
881
- * wall's `strategy` variant ("Strategy testing isn't available on CME markets"), its way out the class's own (switch
936
+ /** The record seed of a strategy sheet the run head refuses on a CME chart while the `cme-lanes` flag is dark
937
+ * (`isCmeStrategyClosed`, `WrunStrategyVenueBlockedError`): the CME wall's `strategy` variant ("Strategy testing isn't available on CME markets"), its way out the class's own (switch
882
938
  * the market, or the works-on list). */
883
939
  const WRUN_CME_STRATEGY_REFUSAL_SEED = Object.freeze({ cls: 'cme-wall', variant: 'strategy' });
940
+ /** The strategy rule on CME (`isCmeStrategyClosed`) over the chart's exchange in either form the CME predicates read
941
+ * (a string, or the multi-exchange array, BLOCKING semantics: any closed CME leg refuses). */
942
+ function wrunCmeStrategyClosedOn(exchange) {
943
+ return (Array.isArray(exchange) ? exchange : [exchange]).some((entry) => typeof entry === 'string' && isCmeStrategyClosed(entry));
944
+ }
884
945
  /** The record seed of a sheet the run head refuses on a prediction market (`WrunPredictionMarketBlockedError`, the rule
885
946
  * wrunPredictionMarketWalls): the wall family's `prediction` variant, its way out the class's own (switch the market,
886
947
  * or the works-on list). */
@@ -920,6 +981,12 @@ function assertWrunCmeStudyAuthCurrent(computed, indicatorId) {
920
981
  if (!wrunCmeStudyAuthStands(computed)) {
921
982
  throw new WrunChartGoneError(`wrun overlay '${indicatorId}' was superseded during its run (cme-auth)`);
922
983
  }
984
+ // A server-lane CME run whose lanes went dark since its head (the CME lanes fence): its answer never lands; it ends
985
+ // as the wall the decider answers now.
986
+ if (computed.cmeLanes !== undefined && !isCmeLanesFenceCurrent(computed.cmeLanes)) {
987
+ throw (computed.cmeLanesClosed?.() ??
988
+ new WrunChartGoneError(`wrun overlay '${indicatorId}' was superseded during its run (cme-lanes)`));
989
+ }
923
990
  }
924
991
  /** The console provenance a run's outputs carry (`setIndicatorPrintOutputs`): its OPRA fact always, its CME fact only
925
992
  * when set, so an output of a run that read no CME reads exactly as before. */
@@ -936,6 +1003,24 @@ function isWrunVenueWallPainted(error) {
936
1003
  !(error instanceof WrunPredictionMarketBlockedError) &&
937
1004
  !(error instanceof WrunLaneVenueBlockedError));
938
1005
  }
1006
+ /** The trap row of an editor draft run that carried a replay seed (wrun-trap-replay.util: a full run or a live start
1007
+ * that trapped in the sandbox): the seed parks under a token the row carries in `details.trap.token`, which the
1008
+ * editor's replay controller takes it by. Any other row (a published Indicator, an app layer, no seed) as it is, and
1009
+ * nothing parks for it. */
1010
+ export function wrunTrapRowWithReplayToken(trap, error, overlay) {
1011
+ const seed = wrunTrapSeedOf(error);
1012
+ const record = trap.details?.trap;
1013
+ if (seed === undefined || typeof record !== 'object' || record === null)
1014
+ return trap;
1015
+ if (trap.code !== WRUN_ABORT_DIAGNOSTIC_CODE && trap.code !== WRUN_UNREACHABLE_TRAP_CODE)
1016
+ return trap;
1017
+ if (!isWrunDraftOverlaySettings(overlay.settings) || isWrunAppLayerOverlaySettings(overlay.settings))
1018
+ return trap;
1019
+ return {
1020
+ ...trap,
1021
+ details: { ...trap.details, trap: { ...record, token: parkWrunTrapSeed(seed, overlay.indicatorId) } },
1022
+ };
1023
+ }
939
1024
  /** A run's runtime trap row with the run's console provenance on it (`RuntimeDiagnostic.opra` and `.cme`): the row as
940
1025
  * it is for a run that read neither plane. */
941
1026
  function wrunTrapRowWithProvenance(trap, provenance) {
@@ -1052,7 +1137,10 @@ export async function surfaceWrunRunFailureOnLegend(chartIndex, indicatorId, err
1052
1137
  // The write waits on the store's module, so the rejection can outrun it: it rides the error, and the
1053
1138
  // editor's Run awaits it before it reads the row (wrunErrorFailureRowWritten). The author's abort text can
1054
1139
  // carry what the run computed: a run over OPRA or CME data marks the row (every console export strips it).
1055
- const written = publishWrunRuntimeTrapDiagnostic(chartIndex, indicatorId, wrunTrapRowWithProvenance(trap, context));
1140
+ const written = publishWrunRuntimeTrapDiagnostic(chartIndex, indicatorId, wrunTrapRowWithProvenance(wrunTrapRowWithReplayToken(trap, error, {
1141
+ indicatorId,
1142
+ settings: tc.metadata?.find((meta) => meta.id === indicatorId)?.settings,
1143
+ }), context));
1056
1144
  annotateWrunErrorFailureRow(error, written);
1057
1145
  await written;
1058
1146
  if (isCurrent())
@@ -2130,6 +2218,20 @@ export function wrunRuntimeTrapDiagnostic(error, context = {}) {
2130
2218
  const message = error instanceof Error ? error.message : typeof error === 'string' ? error : '';
2131
2219
  if (!message)
2132
2220
  return null;
2221
+ // The ABI host's record (what failed, the phase, the bar) builds the row when the rejection carries one: the plain
2222
+ // words and the bar, the host's words kept in `details.hostMessage`. A rejection without one (a run that never
2223
+ // reached a guest call) reads its words as before, and so does a record whose words cannot be built.
2224
+ const trap = wrunTrapOf(error);
2225
+ if (trap !== undefined) {
2226
+ try {
2227
+ const row = wrunTrapRuntimeDiagnostic(trap, message, (key, params) => wrunChartHostEnv().t(key, params), context);
2228
+ if (row !== null)
2229
+ return row;
2230
+ }
2231
+ catch (translateError) {
2232
+ console.warn('[wrun] trap row words failed:', translateError);
2233
+ }
2234
+ }
2133
2235
  return wrunAbortRuntimeDiagnostic(message) ?? wrunRunFailureRuntimeDiagnostic(message, context);
2134
2236
  }
2135
2237
  async function publishWrunRuntimeTrapDiagnostic(chartIndex, indicatorId, diagnostic) {
@@ -5334,7 +5436,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
5334
5436
  // does: the Strategy Tester's first bar is the head's), the chart interval
5335
5437
  // and the display name (contract section 2).
5336
5438
  const strategy = isWrunStrategySheet(target.metadata)
5337
- ? await wrunStrategyRunInputFor(target.chartIndex, target.title, rows, computeOhlcvRows)
5439
+ ? await wrunStrategyRunInputFor(target.chartIndex, target.title, rows, computeOhlcvRows, chartMetadata)
5338
5440
  : undefined;
5339
5441
  // A Retry or a settings run may dispatch a package the host quarantined
5340
5442
  // after a timeout (C5); every other run respects the quarantine.
@@ -6152,7 +6254,15 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
6152
6254
  const { source } = ask;
6153
6255
  // The source computes the batch (the browser lanes' preparation moves the stage to its lanes, then back).
6154
6256
  computed.stage = 'compute';
6155
- const batch = await ask.call().catch((error) => {
6257
+ const batch = await ask.call().catch(async (error) => {
6258
+ // The server's governed-plane mark on the failure (the error frame's relayed `details.wrunGoverned`, or the
6259
+ // overlay's sticky mark the socket source attached, wrun-cloud-cme-stamp.util `wrunFailureGovernedOf`, fail closed):
6260
+ // a run that read CME surfaces its failure CME-marked (`computed.cme`), and its overlay is stamped as a marked
6261
+ // success's is; a stamp that cannot be written still leaves the failure marked, so it is withheld, never raw.
6262
+ if (wrunGovernedReadsCme(wrunFailureGovernedOf(error))) {
6263
+ computed.cme = true;
6264
+ await stampWrunFailedRunCme(runTarget, tc, meta, owner, head);
6265
+ }
6156
6266
  // An ask the source merged nothing from (no reply: a laundered kick, a socket that is not open, a
6157
6267
  // failed worker) is a cause a second run gets past: the run fails with Retry, the heal ladder's
6158
6268
  // retryable class, never an empty success.
@@ -6847,6 +6957,8 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
6847
6957
  meta: mounted,
6848
6958
  metadata: sheetAtRefine,
6849
6959
  ...fill,
6960
+ // The run's own rows again: its drawings keep or replace the mounted set as the run's did.
6961
+ drawingsRun: { reason, hasGoodResult },
6850
6962
  });
6851
6963
  if (refined.childOverlays !== undefined &&
6852
6964
  !(await awaitWrunChildOverlays(chart, target.indicatorId))) {
@@ -6955,6 +7067,16 @@ const wrunSourceDiagnosticCodes = new WeakMap();
6955
7067
  * the pass took the batch), in place of the rows its last verdict wrote. A part not given keeps its rows.
6956
7068
  * Advisory, like every owned row set.
6957
7069
  */
7070
+ /** A batch's verdict with the CME row mark on each of its diagnostics (`RuntimeDiagnostic.cme`): the rows a result
7071
+ * that read CME carries (wrun-cloud-cme-stamp.util). */
7072
+ function wrunVerdictWithCmeMark(batch) {
7073
+ return {
7074
+ refusals: batch.refusals,
7075
+ ...(batch.diagnostics !== undefined
7076
+ ? { diagnostics: batch.diagnostics.map((row) => ({ ...row, cme: true })) }
7077
+ : {}),
7078
+ };
7079
+ }
6958
7080
  async function publishWrunSourceVerdict(chartIndex, indicatorId, meta, verdict, indicatorName) {
6959
7081
  const owned = new Set();
6960
7082
  const rows = [];
@@ -7250,10 +7372,32 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
7250
7372
  // The cloud read OPRA for these rows (its mark): the run's console provenance from here (`computed.opra`).
7251
7373
  if (batch.opra === true)
7252
7374
  computed.opra = true;
7375
+ // The CME twin (wrun-cloud-cme-stamp.util, the AI boundary that never opens): a result that read CME, by the head
7376
+ // mark (the chart on the CME plane, the sheet pinning a CME market) or the server's (`wrunGoverned.cme`), is
7377
+ // stamped before any row of the batch lands, whoever wrote it and whatever lane ran it; a stamp that cannot be
7378
+ // written fails the batch (fail closed). Sticky for the mount: no result sheds it.
7379
+ const readsCme = wrunHostedRunReadsCme({
7380
+ chartExchange,
7381
+ sheetPinsCme: [runTarget.metadata, batch.sheet].some((sheet) => sheet !== undefined &&
7382
+ wrunSheetPinsCme(wrunSheetWithLaneDemand(wrunSheetWithSettings(sheet, meta.settings), wrunChartSizeUnit(chartMetadata), meta.settings), chartExchange)),
7383
+ governed: wrunBatchGovernedOf(batch),
7384
+ });
7385
+ if (readsCme) {
7386
+ const owns = await wrunRunOwnsOverlayReader(chartIndex, { owner, tc, meta, marketIdentity });
7387
+ if (!(await stampWrunHostedCme(chartIndex, indicatorId, meta, owns))) {
7388
+ throw new WrunChartGoneError(`wrun overlay '${indicatorId}' left its chart before its CME provenance was stamped (superseded)`);
7389
+ }
7390
+ // The run's console provenance from here (`computed.cme`): its debug lines, its trap rows, its live session.
7391
+ computed.cme = true;
7392
+ }
7253
7393
  // The write boundary (WRUN-PANBACK-2 S1), as on the browser lane: the chart's install turn after the last await,
7254
7394
  // the gesture read again (a drag that started while the turn waited holds the batch again while the episode's
7255
7395
  // ceiling lasts), then the commit checks and the titan write with no await between them.
7256
7396
  const { heldMs, pacedMs } = await awaitWrunInstallWriteTurn(runTarget, reason, edge);
7397
+ // A CME chart study's answer lands only under the authorisation its head captured (`computed.cmeAuth`), asserted
7398
+ // in the task of the titan write as on the browser lane: a hosted answer computed before a move of the viewer's
7399
+ // access (the terms, the account, the served tier, the `cme-lanes` flag) is dropped as superseded.
7400
+ assertWrunCmeStudyAuthCurrent(computed, indicatorId);
7257
7401
  const identityLeft = wrunRunIdentityLeft(chartIndex, tc, meta, marketIdentity, readChartMetadata);
7258
7402
  const settingsStale = kScriptSettingsRevision(meta.settings) !== computed.generation;
7259
7403
  // The sheet and the params as the overlay's settings read NOW (a paint-only save restyled the
@@ -7374,7 +7518,9 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
7374
7518
  await publishWrunOwnedDiagnostics(chartIndex, indicatorId, WRUN_PIN_ROW_CODES, []);
7375
7519
  await publishWrunOwnedDiagnostics(chartIndex, indicatorId, WRUN_ROW_BUDGET_ROW_CODES, []);
7376
7520
  const indicatorName = typeof delivered.name === 'string' ? delivered.name : '';
7377
- await publishWrunSourceVerdict(chartIndex, indicatorId, meta, batch, indicatorName);
7521
+ // A result that read CME marks every row the cloud answered beside it (its execution errors can carry what the run
7522
+ // computed): every console export strips it, as the OPRA rows' mark (the socket source's).
7523
+ await publishWrunSourceVerdict(chartIndex, indicatorId, meta, readsCme ? wrunVerdictWithCmeMark(batch) : batch, indicatorName);
7378
7524
  await publishWrunCanvasNotices(chartIndex, indicatorId, runResult);
7379
7525
  // The draw calls the cloud skipped (its answer frame's `skipped`), the browser lane's one row.
7380
7526
  if (window?.partial !== true)
@@ -7495,11 +7641,16 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
7495
7641
  const ranSheet = batch.sheet ?? runTarget.metadata;
7496
7642
  liveTick.markWrunSourceFedLiveContext(context, {
7497
7643
  refusals: batch.refusals,
7498
- ...(batch.diagnostics !== undefined ? { diagnostics: batch.diagnostics } : {}),
7644
+ ...(batch.diagnostics !== undefined
7645
+ ? { diagnostics: readsCme ? wrunVerdictWithCmeMark(batch).diagnostics : batch.diagnostics }
7646
+ : {}),
7499
7647
  ...(session?.generation !== undefined ? { generation: session.generation } : {}),
7500
7648
  sheetFor: (refusals, settings) => wrunSheetWithSettings(wrunRowBatchDeliveredSheet(ranSheet, refusals, sectionKinds), settings),
7501
7649
  publish: (verdictMeta, verdict) => publishWrunSourceVerdict(chartIndex, indicatorId, verdictMeta, verdict, indicatorName),
7502
7650
  });
7651
+ // The source-fed live context installs under the same authorisation (the awaits since the write gave it room to
7652
+ // move): a study the lifecycle stopped meanwhile gets no live session behind it.
7653
+ assertWrunCmeStudyAuthCurrent(computed, indicatorId);
7503
7654
  setWrunOverlayLiveContext(context);
7504
7655
  // A source-fed session holds no poll lane: the live channels of the session it replaced close.
7505
7656
  openWrunPollLaneLiveChannels(context);
@@ -8252,21 +8403,20 @@ async function assertWrunTapeServedOnInterval(metadata, inputName, chartInterval
8252
8403
  input: inputName,
8253
8404
  value: chartInterval,
8254
8405
  });
8255
- if (isCalendarIntervalLabel(chartInterval)) {
8256
- throw attachWrunRefusal(refused(hostWords()), {
8257
- cls: 'interval-unserved',
8258
- variant: 'coarse',
8259
- params: { feed: 'tape', interval: '1M', chartInterval },
8260
- });
8261
- }
8406
+ // The record names the chart's kind (calendar, typed, finer) through the one tape seed the cloud lane reads too.
8407
+ const seed = wrunTapeIntervalSeed(chartInterval);
8408
+ if (isCalendarIntervalLabel(chartInterval))
8409
+ throw attachWrunRefusal(refused(hostWords()), seed);
8262
8410
  const { isKScriptDataRestrictedForInterval } = await import('../chart/kscript-data-interval-restriction.leaf.js');
8263
8411
  if (!isKScriptDataRestrictedForInterval('TRADES', chartInterval))
8264
8412
  return;
8413
+ // A one-second chart reads the shared host's words; any other names what the raw trade lane serves.
8414
+ const serves = seed.variant === 'typed' ? 'no typed interval' : 'no chart finer than a minute';
8265
8415
  throw attachWrunRefusal(refused(chartInterval === '1s'
8266
8416
  ? hostWords()
8267
8417
  : `${WRUN_TAPE_INTERVAL_UNSUPPORTED_CODE}: input '${inputName}' reads tape on the interval ` +
8268
8418
  `'${chartInterval}', which the chart's browser lane does not serve: the raw trade lane (K_TRADES) ` +
8269
- 'serves no chart finer than a minute'), { cls: 'interval-unserved', variant: 'fine', params: { feed: 'tape', interval: '1m', chartInterval } });
8419
+ `serves ${serves}`), seed);
8270
8420
  }
8271
8421
  /** The chart interval in ms: the store's interval, else the trailing bar
8272
8422
  * spacing of the candles, else one minute. */
@@ -8675,10 +8825,8 @@ runMarket) {
8675
8825
  /** The strategy half a reseed retains: everything but the bars (rebuilt
8676
8826
  * from the chart's candles per reseed). */
8677
8827
  function wrunStrategySeedOf(strategy) {
8678
- return {
8679
- ...(strategy.intervalMs !== undefined ? { intervalMs: strategy.intervalMs } : {}),
8680
- ...(strategy.title !== undefined ? { title: strategy.title } : {}),
8681
- };
8828
+ const { bars: _bars, ...seed } = strategy;
8829
+ return seed;
8682
8830
  }
8683
8831
  /**
8684
8832
  * Subscribe the overlay's own live channels through the technical-script
@@ -9219,6 +9367,8 @@ export async function reseedWrunOverlayFromBuffers(indicatorId, reason, options
9219
9367
  ...withPriceTick(reseedHostFill.tickSize),
9220
9368
  ...withCanvasHostFill(canvasFill),
9221
9369
  ...(clamped ? { window: { fromMs: clamped.fromMs, toMs: lastRowTs, partial: true } } : {}),
9370
+ // The session's own set, the one its ticks mount: it replaces the mounted drawings (wrunRunDrawingsPlan).
9371
+ sessionRedraw: true,
9222
9372
  });
9223
9373
  // A replay lane's paint keeps to the replay's bars, in this task.
9224
9374
  if (context.replay)
@@ -9946,6 +10096,37 @@ async function wrunOptionsChainLaneExtrasFor(metadata, chartMetadata, facts, par
9946
10096
  ...wrunOptionsChainImplicitViewFields(gatewayScope),
9947
10097
  };
9948
10098
  }
10099
+ /**
10100
+ * Whether a run still owns its overlay, judged in the task that reads it by the evidence the OPRA writer reads
10101
+ * (`wrunOpraProvenanceWriter`): the mount epoch, the chart instance and the market identity (`wrunRunOwnerLeft`, the
10102
+ * main series read from the store right there) and the overlay's own mounted meta. The CME stamp of a hosted result
10103
+ * reads it (wrun-cloud-cme-stamp.util `stampWrunHostedCme`).
10104
+ */
10105
+ async function wrunRunOwnsOverlayReader(chartIndex, ownership) {
10106
+ const { useChartStore } = await wrunChartHostEnv().chart.loadChartStore();
10107
+ return () => {
10108
+ const chartMetadataNow = useChartStore().mergedAllCharts[chartIndex]?.metadata;
10109
+ if (wrunRunOwnerLeft(ownership.owner, chartMetadataNow, ownership.marketIdentity))
10110
+ return false;
10111
+ const mounted = ownership.tc.metadata;
10112
+ return !(Array.isArray(mounted) && !mounted.includes(ownership.meta));
10113
+ };
10114
+ }
10115
+ /**
10116
+ * Stamp the overlay of a hosted run whose FAILURE carried the server's CME mark (`stampWrunHostedCme`, the marked
10117
+ * success's stamp, sticky for the mount), judged by the run's own ownership. Best effort: the failure is CME-marked
10118
+ * (`computed.cme`) whatever the stamp answers, so a stamp that cannot be written never surfaces the failure raw.
10119
+ */
10120
+ async function stampWrunFailedRunCme(runTarget, tc, meta, owner, head) {
10121
+ try {
10122
+ const marketIdentity = wrunChartMarketIdentity(head.chartMetadata);
10123
+ const owns = await wrunRunOwnsOverlayReader(runTarget.chartIndex, { owner, tc, meta, marketIdentity });
10124
+ await stampWrunHostedCme(runTarget.chartIndex, runTarget.indicatorId, meta, owns);
10125
+ }
10126
+ catch (error) {
10127
+ console.warn(`[wrun] the CME stamp of failed run '${runTarget.indicatorId}' was not written:`, error);
10128
+ }
10129
+ }
9949
10130
  /**
9950
10131
  * One run's OPRA provenance writer (options-overlay-provenance.util `setOptionsOverlayOpraProvenance`, both
9951
10132
  * settings copies), its modules loaded once: `opra` true stamps, false clears. It writes only while the run still
@@ -10595,6 +10776,9 @@ async function reintegrateWrunSession(indicatorId, context, fill, current, optio
10595
10776
  ...withCanvasHostFill(fill),
10596
10777
  ...(clamped ? { window: { fromMs: clamped.fromMs, toMs: context.lastRowTs, partial: true } } : {}),
10597
10778
  ...(options.keepOverlaySettings === true ? { keepOverlaySettings: true } : {}),
10779
+ // The session's own set under the new sheet or fill, the one its ticks mount: it replaces the mounted drawings
10780
+ // (wrunRunDrawingsPlan), so a style repaint lands the new look.
10781
+ sessionRedraw: true,
10598
10782
  });
10599
10783
  if (context.replay)
10600
10784
  cutWrunReplayRowsAfterApply(tc, indicatorId);
@@ -11088,16 +11272,22 @@ export function wrunChartPriceDigits(chartIndex) {
11088
11272
  * candle is a non-finite bar, which the engine handles as such: no fills,
11089
11273
  * intents rejected and counted, equity carried), the chart interval for the
11090
11274
  * annualized stats (the store's interval, else the trailing bar spacing),
11091
- * and the display name for `declared.title`. The store is loaded lazily:
11092
- * only a strategy package needs it on this lane. */
11093
- async function wrunStrategyRunInputFor(chartIndex, title, rows, ohlcvRows) {
11275
+ * the display name for `declared.title` and the chart market's point value
11276
+ * (wrunStrategyPointValue: sizes in contracts on a point-valued market).
11277
+ * The store is loaded lazily: only a strategy package needs it on this lane. */
11278
+ async function wrunStrategyRunInputFor(chartIndex, title, rows, ohlcvRows, market) {
11094
11279
  const bars = wrunStrategyBarsFor(rows, ohlcvRows);
11095
11280
  const { useChartStore } = await wrunChartHostEnv().chart.loadChartStore();
11096
11281
  const interval = useChartStore().mergedAllCharts[chartIndex]?.metadata?.interval ?? '';
11097
11282
  const declaredMs = Intervals.map_unit[interval];
11098
11283
  const trailingMs = rows.length >= 2 ? rows[rows.length - 1].ts - rows[rows.length - 2].ts : Number.NaN;
11099
11284
  const intervalMs = declaredMs ?? (Number.isFinite(trailingMs) && trailingMs > 0 ? trailingMs : undefined);
11100
- return { bars, title, ...(intervalMs !== undefined ? { intervalMs } : {}) };
11285
+ return {
11286
+ bars,
11287
+ title,
11288
+ ...(intervalMs !== undefined ? { intervalMs } : {}),
11289
+ pointValue: wrunStrategyPointValue(market),
11290
+ };
11101
11291
  }
11102
11292
  /** The broker feed for input rows: the chart's own candles joined by
11103
11293
  * timestamp (a row with no candle is a non-finite bar, which the engine
@@ -11555,13 +11745,31 @@ function wrunMountReachesBefore(meta, ts) {
11555
11745
  return reachesBefore(record.rawData ?? record.activeData ?? record.data);
11556
11746
  });
11557
11747
  }
11748
+ /** The result with no drawings of its own (`wrunRunDrawingsPlan` 'keep-mounted'): what reaches the route's renderables
11749
+ * check, the budget and the adapter, which is told `keepMountedDrawings` and leaves the mounted set alone. */
11750
+ function withoutWrunDrawings(result) {
11751
+ const kept = { ...result };
11752
+ delete kept.drawings;
11753
+ delete kept.drawingsBudget;
11754
+ return kept;
11755
+ }
11756
+ /** The RAW drawing records of the build the overlay's mounted set came from (hidden records included, never the
11757
+ * door's filtered, capped and normalized copy): the live tick's last applied build, else this lane's last applied
11758
+ * result (which a keep-mounted apply carries forward). Undefined: no build of this lane is known to stand behind the
11759
+ * mounted set. */
11760
+ function wrunShownDrawingsOf(indicatorId, meta) {
11761
+ const context = getWrunOverlayLiveContext(indicatorId);
11762
+ if (context?.repaintOwed !== true && context?.liveApplied !== undefined)
11763
+ return context.liveApplied.result.drawings;
11764
+ return wrunMountMemos.get(meta)?.lastResult?.drawings;
11765
+ }
11558
11766
  function integrateWrunRunThroughRouteOnce(options, childMount) {
11559
11767
  // The chart's price digits (WRUN-STYLE X7), read once per integrate: the
11560
11768
  // selection text and the children print with them.
11561
11769
  const priceDigits = options.priceDigits ?? wrunChartPriceDigits(options.chartIndex);
11562
11770
  // The overlay's flat param settings are what the rows were computed with
11563
11771
  // (the run's init() arguments derive from them the same way). An adoption hands the picture its session showed.
11564
- const runResult = options.prebuilt ??
11772
+ const built = options.prebuilt ??
11565
11773
  buildWrunOverlayRunResult({
11566
11774
  ...options,
11567
11775
  params: options.params ?? wrunParamValuesFromSettings(options.metadata, options.meta.settings),
@@ -11575,16 +11783,33 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11575
11783
  ...(priceDigits !== undefined ? { priceDigits } : {}),
11576
11784
  overlayId: options.overlayId ?? options.indicatorId,
11577
11785
  });
11578
- if (runResult.failureReason !== undefined)
11579
- throw new WrunIntegrationError(runResult.failureReason);
11786
+ if (built.failureReason !== undefined)
11787
+ throw new WrunIntegrationError(built.failureReason);
11580
11788
  const { tc, meta, indicatorId, projection, chartIndex } = options;
11789
+ const facts = options.integration;
11790
+ // The drawings rule (wrunRunDrawingsPlan): a partial window's drawings never replace the mounted set. Every caller
11791
+ // states its facts: the full run its route facts, a run's own refine the run's (`drawingsRun`), a redraw of the live
11792
+ // session `sessionRedraw`; a caller that states none asks a new question and replaces. 'keep-mounted' leaves the
11793
+ // mounted set alone: the adapter gets a result with no drawings and `keepMountedDrawings` on both apply routes, so
11794
+ // nothing projects, normalizes or mounts a drawing; the render-equal check and the lane's memo read the result as
11795
+ // shown (its rows, the raw records the mounted set was built from).
11796
+ const drawingsFacts = facts ?? options.drawingsRun;
11797
+ const keepMountedDrawings = wrunRunDrawingsPlan({
11798
+ partialWindow: options.window?.partial === true,
11799
+ owedFullIntegration: drawingsFacts
11800
+ ? wrunRunOwesFullIntegration(drawingsFacts.reason, drawingsFacts.hasGoodResult)
11801
+ : true,
11802
+ sessionRedraw: options.sessionRedraw === true,
11803
+ }) === 'keep-mounted';
11804
+ const runResult = keepMountedDrawings ? withoutWrunDrawings(built) : built;
11805
+ const shownDrawings = keepMountedDrawings ? wrunShownDrawingsOf(indicatorId, meta) : undefined;
11806
+ const shown = (result) => keepMountedDrawings && shownDrawings !== undefined ? { ...result, drawings: shownDrawings } : result;
11581
11807
  // The run window's bars beside the cost (the slow chip's card: "rows on N bars").
11582
11808
  if (chartIndex !== undefined) {
11583
11809
  recordKScriptPerfVolumeExtras(overlayExecutionGuardKey(chartIndex, indicatorId), {
11584
11810
  bars: options.outputRows.length,
11585
11811
  });
11586
11812
  }
11587
- const facts = options.integration;
11588
11813
  const routed = facts
11589
11814
  ? wrunIntegrationRoute({
11590
11815
  reason: facts.reason,
@@ -11594,7 +11819,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11594
11819
  settingsStale: facts.settingsStale,
11595
11820
  outputRowCount: options.outputRows.length,
11596
11821
  hasRenderables: wrunRunResultHasRenderables(runResult),
11597
- renderEqual: () => wrunRenderEqualToMount(meta, runResult, options.window),
11822
+ renderEqual: () => wrunRenderEqualToMount(meta, shown(runResult), options.window),
11598
11823
  mountedPlotSetFits: () => wrunMountedPlotSetFits(meta, runResult),
11599
11824
  })
11600
11825
  : { action: 'apply-remount' };
@@ -11609,7 +11834,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11609
11834
  ? { action: 'apply-remount' }
11610
11835
  : routed;
11611
11836
  if (route.action === 'skip')
11612
- return { runResult, route, applied: false };
11837
+ return { runResult: shown(runResult), route, applied: false };
11613
11838
  // Read before any chart mutation: a strip word off the vocabulary refuses the run by name.
11614
11839
  const stripSettings = wrunStatsStripSettings(options.metadata);
11615
11840
  applyWrunIntegrationBudget(runResult, chartIndex, indicatorId);
@@ -11642,6 +11867,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11642
11867
  meta: meta,
11643
11868
  ...projection,
11644
11869
  ...(partialSpan ? { preserveMountedRowsOutsideWindow: partialSpan } : {}),
11870
+ ...(keepMountedDrawings ? { keepMountedDrawings: true } : {}),
11645
11871
  postApply: render,
11646
11872
  });
11647
11873
  if (!integration.ok)
@@ -11687,6 +11913,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11687
11913
  ...projection,
11688
11914
  ignoreUnmountedOutputKeys: wrunMountMemos.get(meta)?.unmountable,
11689
11915
  mergeMountedRows: route.action === 'apply-rows-merge',
11916
+ ...(keepMountedDrawings ? { keepMountedDrawings: true } : {}),
11690
11917
  });
11691
11918
  if (!refresh.ok)
11692
11919
  throw wrunIntegrationErrorOf(refresh.diagnostics);
@@ -11706,11 +11933,11 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11706
11933
  : withWrunOverlayExecutionMeasure(chartIndex, indicatorId, 'wrun-integrate', apply);
11707
11934
  if (applied) {
11708
11935
  const memo = wrunMountMemoOf(meta);
11709
- memo.lastResult = runResult;
11936
+ memo.lastResult = shown(runResult);
11710
11937
  memo.lastRows = meta.rawData;
11711
11938
  memo.lastWindow = runWindow === undefined ? undefined : { ...runWindow };
11712
11939
  }
11713
- return { runResult: placed, route, applied };
11940
+ return { runResult: shown(placed), route, applied };
11714
11941
  }
11715
11942
  // ---------------------------------------------------------------------------
11716
11943
  // Prefix runs (C1 v3): a pan-back page computes only the bars it added
@@ -144,7 +144,7 @@ export interface WrunMountCell {
144
144
  * window's weights, or a normal cell's remembered pane heights (the heights its reader dragged, so a remounted
145
145
  * pane comes back at them). The mount keeps it for the retranslate, and a child it names keeps its pane when only
146
146
  * its height moved (the host owns that height). Absent: a window plans from the run's children, a normal cell
147
- * keeps the shared heights. */
147
+ * takes the heights remembered on the owner's row (rememberedChildPaneHeights), else the shared heights. */
148
148
  planned?: ReadonlyMap<string, number>;
149
149
  }
150
150
  /**