@orangecharts/wrun-chart-host 0.15.0 → 0.17.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 (202) hide show
  1. package/README.md +2 -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 +13 -5
  5. package/dist/constants/feature-flags.constants.js +76 -35
  6. package/dist/constants/feature-limits.constants.d.ts +72 -4
  7. package/dist/constants/feature-limits.constants.js +104 -24
  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/marketCapabilities.constants.d.ts +9 -0
  12. package/dist/constants/marketCapabilities.constants.js +39 -11
  13. package/dist/constants/typed-indicator-source.leaf.d.ts +7 -0
  14. package/dist/constants/typed-indicator-source.leaf.js +47 -0
  15. package/dist/constants/typed-session-history-venue.leaf.d.ts +7 -0
  16. package/dist/constants/typed-session-history-venue.leaf.js +9 -0
  17. package/dist/constants/typed-width-fold.leaf.d.ts +52 -0
  18. package/dist/constants/typed-width-fold.leaf.js +101 -0
  19. package/dist/constants/typed-width-source.leaf.d.ts +24 -0
  20. package/dist/constants/typed-width-source.leaf.js +126 -0
  21. package/dist/constants/typed-width.leaf.d.ts +57 -0
  22. package/dist/constants/typed-width.leaf.js +78 -0
  23. package/dist/host-env.d.ts +10 -0
  24. package/dist/host-env.js +7 -0
  25. package/dist/host-ports.types.d.ts +23 -17
  26. package/dist/index.d.ts +4 -0
  27. package/dist/index.js +4 -0
  28. package/dist/interfaces/kscript-diagnostics.interface.d.ts +35 -0
  29. package/dist/interfaces/wrun-runtime.interface.d.ts +66 -3
  30. package/dist/interfaces/wrun-runtime.interface.js +11 -0
  31. package/dist/kscript-data/controls/live-trades-merge.util.d.ts +13 -0
  32. package/dist/kscript-data/controls/live-trades-merge.util.js +16 -1
  33. package/dist/market-data/billing.interface.d.ts +12 -45
  34. package/dist/market-data/billing.interface.js +2 -2
  35. package/dist/replay/replayLadder.js +7 -4
  36. package/dist/settings-templates/footprint-rows.d.ts +6 -0
  37. package/dist/settings-templates/footprint-rows.js +6 -0
  38. package/dist/settings-templates/frvp-fields.js +14 -0
  39. package/dist/settings-templates/indicator-fields.js +36 -0
  40. package/dist/settings-templates/tool-tables.generated.js +19 -1
  41. package/dist/utility/chart/__fixtures__/live-bucket-regular-golden.json +1706 -0
  42. package/dist/utility/chart/cache-alignment.util.d.ts +42 -0
  43. package/dist/utility/chart/cache-alignment.util.js +88 -18
  44. package/dist/utility/chart/calendar-interval.util.d.ts +83 -1
  45. package/dist/utility/chart/calendar-interval.util.js +152 -4
  46. package/dist/utility/chart/candle-bar-end.util.d.ts +11 -4
  47. package/dist/utility/chart/candle-bar-end.util.js +17 -6
  48. package/dist/utility/chart/chart-time-domain.util.d.ts +3 -0
  49. package/dist/utility/chart/chart-time-domain.util.js +13 -4
  50. package/dist/utility/chart/feed-interval.util.d.ts +4 -2
  51. package/dist/utility/chart/feed-interval.util.js +5 -2
  52. package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +3 -1
  53. package/dist/utility/chart/fetch-dedupe-policy.util.js +19 -1
  54. package/dist/utility/chart/footprint-display-mode.util.d.ts +2 -0
  55. package/dist/utility/chart/footprint-display-mode.util.js +5 -0
  56. package/dist/utility/chart/governed-lanes-gate.util.d.ts +46 -0
  57. package/dist/utility/chart/governed-lanes-gate.util.js +71 -0
  58. package/dist/utility/chart/governed-lanes-reader-seat.d.ts +14 -0
  59. package/dist/utility/chart/governed-lanes-reader-seat.js +14 -0
  60. package/dist/utility/chart/history-wall.util.d.ts +13 -2
  61. package/dist/utility/chart/history-wall.util.js +11 -4
  62. package/dist/utility/chart/index-mode-admission.util.js +9 -1
  63. package/dist/utility/chart/index-mode.util.d.ts +2 -2
  64. package/dist/utility/chart/index-mode.util.js +12 -6
  65. package/dist/utility/chart/index-otc.leaf.d.ts +37 -0
  66. package/dist/utility/chart/index-otc.leaf.js +68 -0
  67. package/dist/utility/chart/interval-ladder.util.d.ts +5 -2
  68. package/dist/utility/chart/interval-ladder.util.js +44 -4
  69. package/dist/utility/chart/interval-registry.util.d.ts +22 -1
  70. package/dist/utility/chart/interval-registry.util.js +50 -2
  71. package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +32 -4
  72. package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +22 -5
  73. package/dist/utility/chart/kscript-drawing-safe-area.util.d.ts +10 -0
  74. package/dist/utility/chart/kscript-drawing-safe-area.util.js +30 -3
  75. package/dist/utility/chart/kscript-legend-entries.util.d.ts +21 -4
  76. package/dist/utility/chart/kscript-legend-entries.util.js +27 -5
  77. package/dist/utility/chart/kscript-main-grid-stages.util.js +74 -24
  78. package/dist/utility/chart/kscript-provenance-keys.util.js +6 -0
  79. package/dist/utility/chart/kscript-row-name.leaf.d.ts +13 -0
  80. package/dist/utility/chart/kscript-row-name.leaf.js +18 -0
  81. package/dist/utility/chart/kscript-venue-policy.util.d.ts +61 -26
  82. package/dist/utility/chart/kscript-venue-policy.util.js +138 -37
  83. package/dist/utility/chart/live-bucket.util.d.ts +29 -4
  84. package/dist/utility/chart/live-bucket.util.js +45 -12
  85. package/dist/utility/chart/market-session-schedule.util.d.ts +19 -0
  86. package/dist/utility/chart/market-session-schedule.util.js +2 -1
  87. package/dist/utility/chart/market-session.util.d.ts +62 -10
  88. package/dist/utility/chart/market-session.util.js +93 -13
  89. package/dist/utility/chart/marketKind.util.d.ts +11 -12
  90. package/dist/utility/chart/marketKind.util.js +45 -13
  91. package/dist/utility/chart/mixed-mode.util.d.ts +18 -0
  92. package/dist/utility/chart/om-target.util.js +6 -4
  93. package/dist/utility/chart/price-precision.util.d.ts +20 -6
  94. package/dist/utility/chart/price-precision.util.js +34 -7
  95. package/dist/utility/chart/profile-frame-window.util.d.ts +15 -0
  96. package/dist/utility/chart/profile-frame-window.util.js +12 -0
  97. package/dist/utility/chart/rth-session.util.d.ts +3 -1
  98. package/dist/utility/chart/rth-session.util.js +3 -1
  99. package/dist/utility/chart/script-source-session.util.d.ts +43 -0
  100. package/dist/utility/chart/script-source-session.util.js +61 -0
  101. package/dist/utility/chart/typed-width-grid.util.d.ts +23 -0
  102. package/dist/utility/chart/typed-width-grid.util.js +203 -0
  103. package/dist/utility/common/transformations.util.d.ts +6 -0
  104. package/dist/utility/common/transformations.util.js +28 -4
  105. package/dist/utility/market-events/market-events.util.js +3 -0
  106. package/dist/utility/number-format.util.d.ts +14 -1
  107. package/dist/utility/number-format.util.js +22 -4
  108. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +24 -1
  109. package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +115 -0
  110. package/dist/utility/v2/v2-enums.leaf.js +5 -0
  111. package/dist/utility/wrun/sources/row-lanes/dark_pool.d.ts +2 -1
  112. package/dist/utility/wrun/sources/row-lanes/dark_pool.js +4 -3
  113. package/dist/utility/wrun/wrun-batched-marks.util.d.ts +13 -3
  114. package/dist/utility/wrun/wrun-batched-marks.util.js +96 -17
  115. package/dist/utility/wrun/wrun-canvases.util.d.ts +4 -2
  116. package/dist/utility/wrun/wrun-canvases.util.js +7 -12
  117. package/dist/utility/wrun/wrun-cap-notice.util.d.ts +5 -0
  118. package/dist/utility/wrun/wrun-cap-notice.util.js +23 -0
  119. package/dist/utility/wrun/wrun-card-style.util.d.ts +1 -1
  120. package/dist/utility/wrun/wrun-card-style.util.js +2 -2
  121. package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +23 -8
  122. package/dist/utility/wrun/wrun-chart-market-facts.util.js +24 -9
  123. package/dist/utility/wrun/wrun-child-overlay-id.util.d.ts +10 -0
  124. package/dist/utility/wrun/wrun-child-overlay-id.util.js +24 -0
  125. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.d.ts +72 -0
  126. package/dist/utility/wrun/wrun-cloud-cme-stamp.util.js +151 -0
  127. package/dist/utility/wrun/wrun-cme-root-specs.util.d.ts +10 -6
  128. package/dist/utility/wrun/wrun-cme-root-specs.util.js +19 -13
  129. package/dist/utility/wrun/wrun-color-facts.util.d.ts +3 -3
  130. package/dist/utility/wrun/wrun-color-facts.util.js +8 -5
  131. package/dist/utility/wrun/wrun-colour-tone.lazy.d.ts +20 -0
  132. package/dist/utility/wrun/wrun-colour-tone.lazy.js +23 -0
  133. package/dist/utility/wrun/wrun-colour-tone.util.d.ts +14 -0
  134. package/dist/utility/wrun/wrun-colour-tone.util.js +119 -0
  135. package/dist/utility/wrun/wrun-dark-pool.util.d.ts +3 -2
  136. package/dist/utility/wrun/wrun-dark-pool.util.js +5 -4
  137. package/dist/utility/wrun/wrun-frames.d.ts +1 -1
  138. package/dist/utility/wrun/wrun-frames.js +2 -2
  139. package/dist/utility/wrun/wrun-handles.util.d.ts +1 -1
  140. package/dist/utility/wrun/wrun-handles.util.js +1 -1
  141. package/dist/utility/wrun/wrun-host.service.d.ts +32 -2
  142. package/dist/utility/wrun/wrun-host.service.js +44 -2
  143. package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +20 -0
  144. package/dist/utility/wrun/wrun-hosted-wire-caps.js +85 -2
  145. package/dist/utility/wrun/wrun-hosted-wire.util.d.ts +37 -0
  146. package/dist/utility/wrun/wrun-hosted-wire.util.js +54 -0
  147. package/dist/utility/wrun/wrun-hud-looks.util.d.ts +1 -0
  148. package/dist/utility/wrun/wrun-hud-looks.util.js +6 -11
  149. package/dist/utility/wrun/wrun-integration-route.util.d.ts +24 -0
  150. package/dist/utility/wrun/wrun-integration-route.util.js +19 -0
  151. package/dist/utility/wrun/wrun-live-intake.util.js +17 -1
  152. package/dist/utility/wrun/wrun-live-patch.util.d.ts +6 -1
  153. package/dist/utility/wrun/wrun-live-patch.util.js +10 -4
  154. package/dist/utility/wrun/wrun-live-tick.util.js +64 -5
  155. package/dist/utility/wrun/wrun-market-size-defaults.leaf.js +40 -6
  156. package/dist/utility/wrun/wrun-market-size-defaults.util.d.ts +2 -2
  157. package/dist/utility/wrun/wrun-market-size-defaults.util.js +10 -8
  158. package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +3 -0
  159. package/dist/utility/wrun/wrun-overlay-drivers.util.js +3 -0
  160. package/dist/utility/wrun/wrun-overlay-run.util.d.ts +17 -0
  161. package/dist/utility/wrun/wrun-overlay-run.util.js +318 -55
  162. package/dist/utility/wrun/wrun-panel-mount.util.d.ts +1 -1
  163. package/dist/utility/wrun/wrun-panel-mount.util.js +42 -13
  164. package/dist/utility/wrun/wrun-pin-venues.util.d.ts +3 -2
  165. package/dist/utility/wrun/wrun-pin-venues.util.js +11 -4
  166. package/dist/utility/wrun/wrun-refusal.util.d.ts +4 -0
  167. package/dist/utility/wrun/wrun-refusal.util.js +102 -13
  168. package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
  169. package/dist/utility/wrun/wrun-registry-errors.util.js +5 -3
  170. package/dist/utility/wrun/wrun-row-source-factory.js +17 -1
  171. package/dist/utility/wrun/wrun-row-source.d.ts +8 -1
  172. package/dist/utility/wrun/wrun-run-health.util.js +1 -1
  173. package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +1 -1
  174. package/dist/utility/wrun/wrun-sandbox-row-source.js +9 -0
  175. package/dist/utility/wrun/wrun-session-composition.util.d.ts +3 -2
  176. package/dist/utility/wrun/wrun-session-composition.util.js +3 -2
  177. package/dist/utility/wrun/wrun-setting-words.util.d.ts +12 -5
  178. package/dist/utility/wrun/wrun-setting-words.util.js +25 -8
  179. package/dist/utility/wrun/wrun-socket-row-source.d.ts +26 -1
  180. package/dist/utility/wrun/wrun-socket-row-source.js +125 -12
  181. package/dist/utility/wrun/wrun-source-rows.util.d.ts +3 -3
  182. package/dist/utility/wrun/wrun-source-rows.util.js +8 -7
  183. package/dist/utility/wrun/wrun-style-words.util.d.ts +31 -9
  184. package/dist/utility/wrun/wrun-style-words.util.js +46 -15
  185. package/dist/utility/wrun/wrun-trades-lane.util.js +2 -1
  186. package/dist/utility/wrun/wrun-trap-replay.util.d.ts +42 -0
  187. package/dist/utility/wrun/wrun-trap-replay.util.js +63 -0
  188. package/dist/utility/wrun/wrun-volume-profile.util.js +6 -5
  189. package/dist/utility/wrun-display-name.util.d.ts +10 -0
  190. package/dist/utility/wrun-display-name.util.js +21 -0
  191. package/dist/utils/replay/replay-buffer-math.d.ts +2 -0
  192. package/dist/utils/replay/replay-buffer-math.js +2 -0
  193. package/dist/workers/constants/socket-slots.d.ts +1 -1
  194. package/dist/workers/utils/time.worker.util.js +2 -2
  195. package/dist/workers/utils/volume-profile.worker.util.d.ts +9 -0
  196. package/dist/workers/utils/volume-profile.worker.util.js +20 -0
  197. package/dist/workers/wrun/wrun-abi-host.d.ts +3 -0
  198. package/dist/workers/wrun/wrun-abi-host.js +82 -5
  199. package/dist/workers/wrun/wrun-engine-handler.js +53 -4
  200. package/dist/workers/wrun/wrun-trap-frames.leaf.d.ts +28 -0
  201. package/dist/workers/wrun/wrun-trap-frames.leaf.js +108 -0
  202. 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';
@@ -200,11 +201,13 @@ import { awaitWrunChildOverlays, mountWrunChildOverlays, prepareWrunHeatmapWindo
200
201
  import { planWrunFormingPreRoll, planWrunIntrabarLegFetch, planWrunLegFetch, wrunClampedLegDiagnostics, wrunIntrabarServedNotes, wrunLegFetchReads, WRUN_COARSER_LEG_WARMUP_CANDLES, } from './wrun-leg-fetch.util.js';
201
202
  import { barEndMs, isCalendarIntervalLabel } from '../chart/calendar-interval.util.js';
202
203
  import { wrunCandlesLowAcross, wrunCoinTapeDayAsk, wrunCoinTapeWindow, wrunHeldCoinTapePriceLow, wrunPricedCoinTape, wrunTapeReadIdentity, WRUN_TAPE_COINS_DAY_INTERVAL, WRUN_TAPE_COINS_DAY_MS, } from './wrun-tape-coins.util.js';
203
- import { normalizeTransformations, selfTransformationToken } from '../common/transformations.util.js';
204
+ import { normalizeTransformations, selfTransformationToken, transformationsTouchVenue, } from '../common/transformations.util.js';
205
+ import { checkIsIndexOtc } from '../chart/index-otc.leaf.js';
204
206
  import { resolveWrunTapeAcquisition, WRUN_TAPE_COINS_UNPRICED_CODE, WRUN_TAPE_INTERVAL_UNSUPPORTED_CODE, WRUN_TAPE_TOO_MANY_TRADES_CODE, WRUN_TAPE_VALUE_UNPROVEN_CODE, wrunTapeAcquisitionFloor, wrunTapeFloorOf, wrunTapeFloorSettingWords, wrunTapeFloorSettings, wrunTapeFloorWords, wrunTapeLaneExtras, } from './wrun-tape-source.util.js';
205
207
  import { wrunChartSession, wrunLegCandleClose, wrunPrimaryRowBounds } from './wrun-leg-close.util.js';
206
208
  import { isWrunRowSourceTransientError, wrunRowBatchDeliveredSheet, wrunRowSourceSettingsLeftBy, } from './wrun-row-source.js';
207
209
  import { wrunOverlayOpraStamped } from './wrun-cloud-opra-stamp.util.js';
210
+ import { stampWrunHostedCme, wrunBatchGovernedOf, wrunFailureGovernedOf, wrunGovernedReadsCme, wrunHostedRunReadsCme, } from './wrun-cloud-cme-stamp.util.js';
208
211
  // The run's one options market (the row lanes' planner holds the module on this graph already).
209
212
  import { decideWrunRunOptionsMarket, noteWrunRunOptionsMarket, wrunDecidedOptionsExchange, } from './derived-roots.util.js';
210
213
  import { wrunRowSourceFor } from './wrun-row-source-factory.js';
@@ -228,8 +231,9 @@ import { wrunTwinOriginalLookbackBars } from './wrun-twin-lookback.util.js';
228
231
  import { overlayWrunRunInterval, wrunSettingsForRunInterval, wrunTimeframeIsChartOrFiner, wrunTwinLookbackBars, } from './wrun-run-interval.util.js';
229
232
  import { planWrunRunIntervalRows, rememberWrunRunIntervalSession, wrunRunIntervalComputeRows, wrunRunIntervalCoverageKey, wrunRunIntervalProjectionOf, wrunRunIntervalRowsThrough, wrunRunIntervalSentRow, wrunRunIntervalSessionOf, } from './wrun-run-interval-session.util.js';
230
233
  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';
234
+ import { attachWrunLive, wrunLiveOf, wrunTrapOf, } from '../../interfaces/wrun-runtime.interface.js';
235
+ 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';
236
+ import { parkWrunTrapSeed, wrunTrapSeedOf } from './wrun-trap-replay.util.js';
233
237
  import { buildWrunOverlayRunResult, withCanvasHostFill, } from './wrun-overlay-result.util.js';
234
238
  import { applyWrunIntegrationBudgetPolicy, wrunIntegratedRowsView } from './wrun-integration-budget.util.js';
235
239
  // The result build lives in wrun-overlay-result.util (the result reader core); its importers keep this path.
@@ -523,6 +527,12 @@ export async function runWrunOverlayOnChart(target) {
523
527
  // is the output's provenance, never a permission).
524
528
  if (payloadTouchesCmeVenue(chartExchange))
525
529
  computed.cme = true;
530
+ // The same on the index and yield venue (`computed.indexOtc`): every run whose chart market, or a formula leg of
531
+ // it, is on the venue reads its candles, and the venue's licence is display only.
532
+ if (wrunTouchesIndexOtc(chartExchange) ||
533
+ transformationsTouchVenue(chartMetadata?.transformations, checkIsIndexOtc)) {
534
+ computed.indexOtc = true;
535
+ }
526
536
  // A run reading options decides its ONE options market here (derived-roots.util `decideWrunRunOptionsMarket`):
527
537
  // where the options list on OPRA (a stock, an OPRA contract, a known stock twin) or the overlay's last read was
528
538
  // OPRA's (its provenance stamp), it waits, bounded, for the `opra` flag the plane and its stop reasons are judged
@@ -565,10 +575,61 @@ export async function runWrunOverlayOnChart(target) {
565
575
  // that opens later judges the walled CME studies again (`armCmeUserScriptsRejudge`). A host that binds neither port
566
576
  // judges by the map as it stands.
567
577
  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);
578
+ // A server-lane user run (the decider's `userRunServerLaneOf`: a Cloud record), which no browser lane admits a leg
579
+ // for, and a first-party run, which reads a CME pin on any lane: both have their CME read marked from the head (the
580
+ // browser lanes mark a browser user run's as they admit its legs).
581
+ const serverLaneUser = userRunServerLaneOf(provenance) !== undefined;
582
+ const marksPinAtHead = serverLaneUser || isFirstPartyKScriptRun(provenance);
583
+ // 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
584
+ // a CME pin's flag wait and authorisation are for), and for every run whose pin is marked at the head.
585
+ const pinSheet = cmeCandidate || marksPinAtHead
586
+ ? wrunSheetWithLaneDemand(wrunSheetWithSettings(target.metadata, meta.settings), wrunChartSizeUnit(chartMetadata), meta.settings)
587
+ : undefined;
588
+ const pinExchange = typeof chartExchange === 'string' ? chartExchange : undefined;
589
+ const effectiveSheetPinsCme = pinSheet !== undefined && wrunSheetPinsCme(pinSheet, pinExchange);
590
+ const sheetPinsCme = cmeCandidate && effectiveSheetPinsCme;
591
+ // Such a run whose effective sheet pins a CME market reads CME whatever the chart (a hosted one on the server): its
592
+ // CME provenance is set from its head (`computed.cme`), before execution is asked, so every outcome of the run, a
593
+ // failure included, carries the mark (the AI boundary never opens on CME), for every author.
594
+ if (marksPinAtHead && effectiveSheetPinsCme)
595
+ computed.cme = true;
596
+ // ...and, under a lit `cme-lanes` flag, it passes the one CME decision every CME user run passes (invariant 2: the
597
+ // data wall's `isCmeReadableKScriptRun`, the `cme-user-scripts` gate with its kill switch, sign-in and the CME data
598
+ // terms) before anything is sent: no browser pin judge stands in a hosted run's way. Refused as the browser pin
599
+ // judge refuses (`pin-refused`, in the gate's words, `cmePinRefusalVariant`). Judged per pinned venue by the data
600
+ // wall (`isUserKScriptBlockedOnExchange`), so a venue the cutover never opens (GLOBEX) stays closed. While
601
+ // `cme-lanes` is dark (`cmeServerLanesOpen`) the cloud refuses the pin itself, as before.
602
+ const cmePins = serverLaneUser && effectiveSheetPinsCme && pinSheet !== undefined
603
+ ? pinSheet.inputs.flatMap((input) => {
604
+ if (!wrunSheetPinsCme({ inputs: [input], inputSources: pinSheet.inputSources }, pinExchange))
605
+ return [];
606
+ const source = pinSheet.inputSources[input.name];
607
+ const venue = typeof source?.exchange === 'string' && source.exchange !== '' ? source.exchange : 'CME';
608
+ return [{ name: input.name, venue, pin: String(source?.symbol ?? venue) }];
609
+ })
610
+ : [];
611
+ /** The pin refusal of one CME pin, in the gate's words as they read when it is raised. */
612
+ const cmePinRefusal = (pinned) => attachWrunRefusal(new Error(wrunPinVenueRefusalMessage(pinned.name, pinned.venue)), {
613
+ cls: 'pin-refused',
614
+ variant: cmePinRefusalVariant(provenance),
615
+ params: { pin: pinned.pin },
616
+ });
617
+ if (cmeServerLanesOpen()) {
618
+ const pinned = cmePins.find((entry) => isUserKScriptBlockedOnExchange(entry.venue, provenance));
619
+ if (pinned !== undefined)
620
+ throw cmePinRefusal(pinned);
621
+ }
622
+ // The CME lanes fence (governed-lanes-gate.util, 2026-11-11): a server-lane user run reading CME (on a CME chart, or
623
+ // pinning a CME market) captures it here; the `cme-lanes` flag going dark moves it, so this run's answer, in flight
624
+ // and stamped or not, never lands after the rollback (`assertWrunCmeStudyAuthCurrent`): it ends as the wall the
625
+ // decider now answers (on a CME chart the display wall the lifecycle paints, off one its pin refusal), never a blank
626
+ // pane or a live session. A browser run never captures it: the flag does not govern its lane.
627
+ if (serverLaneUser && (payloadTouchesCmeVenue(chartExchange) || cmePins.length > 0)) {
628
+ computed.cmeLanes = captureCmeLanesFence();
629
+ computed.cmeLanesClosed = () => payloadTouchesCmeVenue(chartExchange) || cmePins.length === 0
630
+ ? withCmeStudyStopSeed(new WrunVenueBlockedError(createKScriptVenueBlockedError(String(chartExchange)).message, chartExchange), target.chartIndex, target.indicatorId, chartExchange)
631
+ : cmePinRefusal(cmePins[0]);
632
+ }
572
633
  const cmeWallAhead = payloadTouchesCmeVenue(chartExchange)
573
634
  ? isKScriptDisplayBlockedOnExchange(chartExchange, provenance)
574
635
  : sheetPinsCme && !isCmeUserScriptRun(provenance);
@@ -588,11 +649,13 @@ export async function runWrunOverlayOnChart(target) {
588
649
  if (isKScriptDisplayBlockedOnExchange(candleVenue, provenance)) {
589
650
  throw withCmeStudyStopSeed(new WrunVenueBlockedError(createKScriptVenueBlockedError(String(candleVenue)).message, candleVenue), target.chartIndex, target.indicatorId, candleVenue);
590
651
  }
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)) {
652
+ // Strategy testing is no CME chart study while the `cme-lanes` cutover flag is dark (Kyle 2026-10-29): on a CME
653
+ // chart every strategy sheet is refused, an OpenMarket package's included, here at the head before the loader is
654
+ // raised, a lane is asked or the sandbox is touched (the broker feed, `wrunStrategyRunInputFor`, is never built), on
655
+ // every lane. A venue refusal held like the wall's, with its own record on the legend (`cme-wall` `strategy`: no
656
+ // wall painter stands behind it). Under a lit flag (`isCmeStrategyClosed` reads false) a strategy sheet on a CME
657
+ // chart runs through the ordinary CME study rule above: the display wall and the gate (sign-in, the CME terms).
658
+ if (wrunCmeStrategyClosedOn(chartExchange) && isWrunStrategySheet(target.metadata)) {
596
659
  throw attachWrunRefusal(new WrunStrategyVenueBlockedError(createKScriptVenueBlockedError(String(chartExchange)).message, chartExchange), WRUN_CME_STRATEGY_REFUSAL_SEED);
597
660
  }
598
661
  // The prediction-market wall (Kyle 2026-10-29: options indicators on a Polymarket chart make no sense): on a
@@ -787,6 +850,7 @@ export async function runWrunOverlayOnChart(target) {
787
850
  outputNames,
788
851
  opra: computed.opra === true,
789
852
  cme: computed.cme === true,
853
+ indexOtc: computed.indexOtc === true,
790
854
  refusalContext: refusal.ctx,
791
855
  token: refusalAttempt,
792
856
  isCurrent,
@@ -877,10 +941,15 @@ function wrunRunRejectionAsSettled(error, run) {
877
941
  dropped.cause = WRUN_SUPERSEDED_RUN_CAUSE;
878
942
  return dropped;
879
943
  }
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
944
+ /** The record seed of a strategy sheet the run head refuses on a CME chart while the `cme-lanes` flag is dark
945
+ * (`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
946
  * the market, or the works-on list). */
883
947
  const WRUN_CME_STRATEGY_REFUSAL_SEED = Object.freeze({ cls: 'cme-wall', variant: 'strategy' });
948
+ /** The strategy rule on CME (`isCmeStrategyClosed`) over the chart's exchange in either form the CME predicates read
949
+ * (a string, or the multi-exchange array, BLOCKING semantics: any closed CME leg refuses). */
950
+ function wrunCmeStrategyClosedOn(exchange) {
951
+ return (Array.isArray(exchange) ? exchange : [exchange]).some((entry) => typeof entry === 'string' && isCmeStrategyClosed(entry));
952
+ }
884
953
  /** The record seed of a sheet the run head refuses on a prediction market (`WrunPredictionMarketBlockedError`, the rule
885
954
  * wrunPredictionMarketWalls): the wall family's `prediction` variant, its way out the class's own (switch the market,
886
955
  * or the works-on list). */
@@ -920,11 +989,26 @@ function assertWrunCmeStudyAuthCurrent(computed, indicatorId) {
920
989
  if (!wrunCmeStudyAuthStands(computed)) {
921
990
  throw new WrunChartGoneError(`wrun overlay '${indicatorId}' was superseded during its run (cme-auth)`);
922
991
  }
992
+ // A server-lane CME run whose lanes went dark since its head (the CME lanes fence): its answer never lands; it ends
993
+ // as the wall the decider answers now.
994
+ if (computed.cmeLanes !== undefined && !isCmeLanesFenceCurrent(computed.cmeLanes)) {
995
+ throw (computed.cmeLanesClosed?.() ??
996
+ new WrunChartGoneError(`wrun overlay '${indicatorId}' was superseded during its run (cme-lanes)`));
997
+ }
923
998
  }
924
- /** The console provenance a run's outputs carry (`setIndicatorPrintOutputs`): its OPRA fact always, its CME fact only
925
- * when set, so an output of a run that read no CME reads exactly as before. */
999
+ /** The console provenance a run's outputs carry (`setIndicatorPrintOutputs`): its OPRA fact always, its CME and index
1000
+ * venue facts only when set, so an output of a run that read neither reads exactly as before. */
926
1001
  function wrunRunOutputProvenance(computed) {
927
- return { opra: computed.opra === true, ...(computed.cme === true ? { cme: true } : {}) };
1002
+ return {
1003
+ opra: computed.opra === true,
1004
+ ...(computed.cme === true ? { cme: true } : {}),
1005
+ ...(computed.indexOtc === true ? { indexOtc: true } : {}),
1006
+ };
1007
+ }
1008
+ /** Whether a source exchange is on the index and yield venue (index-otc.leaf `checkIsIndexOtc`), in either form the
1009
+ * run head reads (a string, or the multi-exchange array: any leg on the venue). */
1010
+ function wrunTouchesIndexOtc(exchange) {
1011
+ return (Array.isArray(exchange) ? exchange : [exchange]).some((entry) => typeof entry === 'string' && checkIsIndexOtc(entry));
928
1012
  }
929
1013
  /** Whether a venue refusal is the display wall's (its painter stamped the one standing legend message, so the run
930
1014
  * adds no record, chip or console row of its own): every `WrunVenueBlockedError` but the strategy and the
@@ -936,15 +1020,34 @@ function isWrunVenueWallPainted(error) {
936
1020
  !(error instanceof WrunPredictionMarketBlockedError) &&
937
1021
  !(error instanceof WrunLaneVenueBlockedError));
938
1022
  }
939
- /** A run's runtime trap row with the run's console provenance on it (`RuntimeDiagnostic.opra` and `.cme`): the row as
940
- * it is for a run that read neither plane. */
1023
+ /** The trap row of an editor draft run that carried a replay seed (wrun-trap-replay.util: a full run or a live start
1024
+ * that trapped in the sandbox): the seed parks under a token the row carries in `details.trap.token`, which the
1025
+ * editor's replay controller takes it by. Any other row (a published Indicator, an app layer, no seed) as it is, and
1026
+ * nothing parks for it. */
1027
+ export function wrunTrapRowWithReplayToken(trap, error, overlay) {
1028
+ const seed = wrunTrapSeedOf(error);
1029
+ const record = trap.details?.trap;
1030
+ if (seed === undefined || typeof record !== 'object' || record === null)
1031
+ return trap;
1032
+ if (trap.code !== WRUN_ABORT_DIAGNOSTIC_CODE && trap.code !== WRUN_UNREACHABLE_TRAP_CODE)
1033
+ return trap;
1034
+ if (!isWrunDraftOverlaySettings(overlay.settings) || isWrunAppLayerOverlaySettings(overlay.settings))
1035
+ return trap;
1036
+ return {
1037
+ ...trap,
1038
+ details: { ...trap.details, trap: { ...record, token: parkWrunTrapSeed(seed, overlay.indicatorId) } },
1039
+ };
1040
+ }
1041
+ /** A run's runtime trap row with the run's console provenance on it (`RuntimeDiagnostic.opra`, `.cme` and
1042
+ * `.indexOtc`): the row as it is for a run that read none of them. */
941
1043
  function wrunTrapRowWithProvenance(trap, provenance) {
942
- if (provenance.opra !== true && provenance.cme !== true)
1044
+ if (provenance.opra !== true && provenance.cme !== true && provenance.indexOtc !== true)
943
1045
  return trap;
944
1046
  return {
945
1047
  ...trap,
946
1048
  ...(provenance.opra === true ? { opra: true } : {}),
947
1049
  ...(provenance.cme === true ? { cme: true } : {}),
1050
+ ...(provenance.indexOtc === true ? { indexOtc: true } : {}),
948
1051
  };
949
1052
  }
950
1053
  /**
@@ -1052,7 +1155,10 @@ export async function surfaceWrunRunFailureOnLegend(chartIndex, indicatorId, err
1052
1155
  // The write waits on the store's module, so the rejection can outrun it: it rides the error, and the
1053
1156
  // editor's Run awaits it before it reads the row (wrunErrorFailureRowWritten). The author's abort text can
1054
1157
  // 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));
1158
+ const written = publishWrunRuntimeTrapDiagnostic(chartIndex, indicatorId, wrunTrapRowWithProvenance(wrunTrapRowWithReplayToken(trap, error, {
1159
+ indicatorId,
1160
+ settings: tc.metadata?.find((meta) => meta.id === indicatorId)?.settings,
1161
+ }), context));
1056
1162
  annotateWrunErrorFailureRow(error, written);
1057
1163
  await written;
1058
1164
  if (isCurrent())
@@ -1199,6 +1305,12 @@ function wrunPinReadsCme(market) {
1199
1305
  return false;
1200
1306
  return wrunPinMarketsOf(market.exchange ?? '', market.symbol ?? '').some((leg) => payloadTouchesCmeVenue(leg.exchange));
1201
1307
  }
1308
+ /** Whether a pin names a market on the index and yield venue (`wrunPinReadsOpra`'s twin, index-otc.leaf). */
1309
+ function wrunPinReadsIndexOtc(market) {
1310
+ if (market === undefined)
1311
+ return false;
1312
+ return wrunPinMarketsOf(market.exchange ?? '', market.symbol ?? '').some((leg) => checkIsIndexOtc(leg.exchange));
1313
+ }
1202
1314
  /**
1203
1315
  * Whether the sheet a run reads (its settings painted, its lane demand applied) pins a CME market: a secondary input's
1204
1316
  * pinned market (an ohlcv or leg-stream pin, a trades leg, a coin leg's venue) on the CME plane (`wrunPinReadsCme`), or
@@ -2130,6 +2242,20 @@ export function wrunRuntimeTrapDiagnostic(error, context = {}) {
2130
2242
  const message = error instanceof Error ? error.message : typeof error === 'string' ? error : '';
2131
2243
  if (!message)
2132
2244
  return null;
2245
+ // The ABI host's record (what failed, the phase, the bar) builds the row when the rejection carries one: the plain
2246
+ // words and the bar, the host's words kept in `details.hostMessage`. A rejection without one (a run that never
2247
+ // reached a guest call) reads its words as before, and so does a record whose words cannot be built.
2248
+ const trap = wrunTrapOf(error);
2249
+ if (trap !== undefined) {
2250
+ try {
2251
+ const row = wrunTrapRuntimeDiagnostic(trap, message, (key, params) => wrunChartHostEnv().t(key, params), context);
2252
+ if (row !== null)
2253
+ return row;
2254
+ }
2255
+ catch (translateError) {
2256
+ console.warn('[wrun] trap row words failed:', translateError);
2257
+ }
2258
+ }
2133
2259
  return wrunAbortRuntimeDiagnostic(message) ?? wrunRunFailureRuntimeDiagnostic(message, context);
2134
2260
  }
2135
2261
  async function publishWrunRuntimeTrapDiagnostic(chartIndex, indicatorId, diagnostic) {
@@ -3189,7 +3315,8 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3189
3315
  // a stock listing: wrun_pin_venue_unknown, a failed run, whether the sheet,
3190
3316
  // a default or a saved pick names it); a pin on an index venue the
3191
3317
  // gateway serves no series for to
3192
- // scripts yet (POLYGON_INDICES) is not servable, but it is no reason to
3318
+ // scripts yet (WRUN_PIN_UNSERVED_EXCHANGES: the index and yield venue)
3319
+ // is not servable, but it is no reason to
3193
3320
  // kill the run: it is SOFT-refused per input. The leg is never fetched,
3194
3321
  // never enters the live context (no reconcile asks for it), and every
3195
3322
  // input served off it reads its missing fill on every row (NaN under
@@ -3364,6 +3491,14 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
3364
3491
  if (delayed !== undefined)
3365
3492
  computed.cmeDelayed = delayed;
3366
3493
  }
3494
+ // The same for a leg on the index and yield venue (`computed.indexOtc`): a leg the run admitted reads its data, on
3495
+ // any chart. A pin there is soft-refused today (`WRUN_PIN_UNSERVED_EXCHANGES`) and never asked; the mark stands
3496
+ // ready for the day the gateway serves it.
3497
+ if (legs.some((leg) => wrunPinReadsIndexOtc(leg.market)) ||
3498
+ tradeLegLanes.some((lane) => !softRefusedTradeLegs.has(lane) && wrunPinReadsIndexOtc(wrunTradesLegOf(lane))) ||
3499
+ pinnedLaneIds.some((lane) => !softRefusedPinnedLanes.has(lane) && wrunPinReadsIndexOtc(wrunPinnedLaneOf(lane)))) {
3500
+ computed.indexOtc = true;
3501
+ }
3367
3502
  const formingBarTs = live && replay === undefined && wrunLandsLegsOnBars(legs, tradeLegLanes)
3368
3503
  ? await wrunFormingBarTsOf(target.chartIndex, clock.intervalMs, chartMetadata)
3369
3504
  : null;
@@ -5334,7 +5469,7 @@ async function prepareWrunSandboxRun(passTarget, tc, meta, refusal, computed, ow
5334
5469
  // does: the Strategy Tester's first bar is the head's), the chart interval
5335
5470
  // and the display name (contract section 2).
5336
5471
  const strategy = isWrunStrategySheet(target.metadata)
5337
- ? await wrunStrategyRunInputFor(target.chartIndex, target.title, rows, computeOhlcvRows)
5472
+ ? await wrunStrategyRunInputFor(target.chartIndex, target.title, rows, computeOhlcvRows, chartMetadata)
5338
5473
  : undefined;
5339
5474
  // A Retry or a settings run may dispatch a package the host quarantined
5340
5475
  // after a timeout (C5); every other run respects the quarantine.
@@ -6152,7 +6287,15 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
6152
6287
  const { source } = ask;
6153
6288
  // The source computes the batch (the browser lanes' preparation moves the stage to its lanes, then back).
6154
6289
  computed.stage = 'compute';
6155
- const batch = await ask.call().catch((error) => {
6290
+ const batch = await ask.call().catch(async (error) => {
6291
+ // The server's governed-plane mark on the failure (the error frame's relayed `details.wrunGoverned`, or the
6292
+ // overlay's sticky mark the socket source attached, wrun-cloud-cme-stamp.util `wrunFailureGovernedOf`, fail closed):
6293
+ // a run that read CME surfaces its failure CME-marked (`computed.cme`), and its overlay is stamped as a marked
6294
+ // success's is; a stamp that cannot be written still leaves the failure marked, so it is withheld, never raw.
6295
+ if (wrunGovernedReadsCme(wrunFailureGovernedOf(error))) {
6296
+ computed.cme = true;
6297
+ await stampWrunFailedRunCme(runTarget, tc, meta, owner, head);
6298
+ }
6156
6299
  // An ask the source merged nothing from (no reply: a laundered kick, a socket that is not open, a
6157
6300
  // failed worker) is a cause a second run gets past: the run fails with Retry, the heal ladder's
6158
6301
  // retryable class, never an empty success.
@@ -6549,6 +6692,7 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
6549
6692
  // The run's console provenance: every debug line the session's ticks and reseeds publish states it.
6550
6693
  ...(computed.opra === true ? { opraRead: true } : {}),
6551
6694
  ...(computed.cme === true ? { cmeRead: true } : {}),
6695
+ ...(computed.indexOtc === true ? { indexOtcRead: true } : {}),
6552
6696
  // The delayed CME legs its legend names: every tick and reseed names them alike.
6553
6697
  ...(computed.cmeDelayed !== undefined ? { cmeDelayed: computed.cmeDelayed } : {}),
6554
6698
  // The current paint (above): the ticks and the reseeds keep the look.
@@ -6847,6 +6991,8 @@ async function integrateWrunRunAsk(runTarget, tc, meta, refusal, computed, owner
6847
6991
  meta: mounted,
6848
6992
  metadata: sheetAtRefine,
6849
6993
  ...fill,
6994
+ // The run's own rows again: its drawings keep or replace the mounted set as the run's did.
6995
+ drawingsRun: { reason, hasGoodResult },
6850
6996
  });
6851
6997
  if (refined.childOverlays !== undefined &&
6852
6998
  !(await awaitWrunChildOverlays(chart, target.indicatorId))) {
@@ -6955,6 +7101,16 @@ const wrunSourceDiagnosticCodes = new WeakMap();
6955
7101
  * the pass took the batch), in place of the rows its last verdict wrote. A part not given keeps its rows.
6956
7102
  * Advisory, like every owned row set.
6957
7103
  */
7104
+ /** A batch's verdict with the CME row mark on each of its diagnostics (`RuntimeDiagnostic.cme`): the rows a result
7105
+ * that read CME carries (wrun-cloud-cme-stamp.util). */
7106
+ function wrunVerdictWithCmeMark(batch) {
7107
+ return {
7108
+ refusals: batch.refusals,
7109
+ ...(batch.diagnostics !== undefined
7110
+ ? { diagnostics: batch.diagnostics.map((row) => ({ ...row, cme: true })) }
7111
+ : {}),
7112
+ };
7113
+ }
6958
7114
  async function publishWrunSourceVerdict(chartIndex, indicatorId, meta, verdict, indicatorName) {
6959
7115
  const owned = new Set();
6960
7116
  const rows = [];
@@ -7250,10 +7406,32 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
7250
7406
  // The cloud read OPRA for these rows (its mark): the run's console provenance from here (`computed.opra`).
7251
7407
  if (batch.opra === true)
7252
7408
  computed.opra = true;
7409
+ // The CME twin (wrun-cloud-cme-stamp.util, the AI boundary that never opens): a result that read CME, by the head
7410
+ // mark (the chart on the CME plane, the sheet pinning a CME market) or the server's (`wrunGoverned.cme`), is
7411
+ // stamped before any row of the batch lands, whoever wrote it and whatever lane ran it; a stamp that cannot be
7412
+ // written fails the batch (fail closed). Sticky for the mount: no result sheds it.
7413
+ const readsCme = wrunHostedRunReadsCme({
7414
+ chartExchange,
7415
+ sheetPinsCme: [runTarget.metadata, batch.sheet].some((sheet) => sheet !== undefined &&
7416
+ wrunSheetPinsCme(wrunSheetWithLaneDemand(wrunSheetWithSettings(sheet, meta.settings), wrunChartSizeUnit(chartMetadata), meta.settings), chartExchange)),
7417
+ governed: wrunBatchGovernedOf(batch),
7418
+ });
7419
+ if (readsCme) {
7420
+ const owns = await wrunRunOwnsOverlayReader(chartIndex, { owner, tc, meta, marketIdentity });
7421
+ if (!(await stampWrunHostedCme(chartIndex, indicatorId, meta, owns))) {
7422
+ throw new WrunChartGoneError(`wrun overlay '${indicatorId}' left its chart before its CME provenance was stamped (superseded)`);
7423
+ }
7424
+ // The run's console provenance from here (`computed.cme`): its debug lines, its trap rows, its live session.
7425
+ computed.cme = true;
7426
+ }
7253
7427
  // The write boundary (WRUN-PANBACK-2 S1), as on the browser lane: the chart's install turn after the last await,
7254
7428
  // the gesture read again (a drag that started while the turn waited holds the batch again while the episode's
7255
7429
  // ceiling lasts), then the commit checks and the titan write with no await between them.
7256
7430
  const { heldMs, pacedMs } = await awaitWrunInstallWriteTurn(runTarget, reason, edge);
7431
+ // A CME chart study's answer lands only under the authorisation its head captured (`computed.cmeAuth`), asserted
7432
+ // in the task of the titan write as on the browser lane: a hosted answer computed before a move of the viewer's
7433
+ // access (the terms, the account, the served tier, the `cme-lanes` flag) is dropped as superseded.
7434
+ assertWrunCmeStudyAuthCurrent(computed, indicatorId);
7257
7435
  const identityLeft = wrunRunIdentityLeft(chartIndex, tc, meta, marketIdentity, readChartMetadata);
7258
7436
  const settingsStale = kScriptSettingsRevision(meta.settings) !== computed.generation;
7259
7437
  // The sheet and the params as the overlay's settings read NOW (a paint-only save restyled the
@@ -7374,7 +7552,9 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
7374
7552
  await publishWrunOwnedDiagnostics(chartIndex, indicatorId, WRUN_PIN_ROW_CODES, []);
7375
7553
  await publishWrunOwnedDiagnostics(chartIndex, indicatorId, WRUN_ROW_BUDGET_ROW_CODES, []);
7376
7554
  const indicatorName = typeof delivered.name === 'string' ? delivered.name : '';
7377
- await publishWrunSourceVerdict(chartIndex, indicatorId, meta, batch, indicatorName);
7555
+ // A result that read CME marks every row the cloud answered beside it (its execution errors can carry what the run
7556
+ // computed): every console export strips it, as the OPRA rows' mark (the socket source's).
7557
+ await publishWrunSourceVerdict(chartIndex, indicatorId, meta, readsCme ? wrunVerdictWithCmeMark(batch) : batch, indicatorName);
7378
7558
  await publishWrunCanvasNotices(chartIndex, indicatorId, runResult);
7379
7559
  // The draw calls the cloud skipped (its answer frame's `skipped`), the browser lane's one row.
7380
7560
  if (window?.partial !== true)
@@ -7476,6 +7656,7 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
7476
7656
  // The run's console provenance: every debug line the session's ticks publish states it.
7477
7657
  ...(computed.opra === true ? { opraRead: true } : {}),
7478
7658
  ...(computed.cme === true ? { cmeRead: true } : {}),
7659
+ ...(computed.indexOtc === true ? { indexOtcRead: true } : {}),
7479
7660
  carrySeed: emptyWrunInputCarry(),
7480
7661
  fedBuckets: {},
7481
7662
  pushEligible: false,
@@ -7495,11 +7676,16 @@ async function integrateWrunRowSourceBatch(asked, tc, meta, refusal, computed, o
7495
7676
  const ranSheet = batch.sheet ?? runTarget.metadata;
7496
7677
  liveTick.markWrunSourceFedLiveContext(context, {
7497
7678
  refusals: batch.refusals,
7498
- ...(batch.diagnostics !== undefined ? { diagnostics: batch.diagnostics } : {}),
7679
+ ...(batch.diagnostics !== undefined
7680
+ ? { diagnostics: readsCme ? wrunVerdictWithCmeMark(batch).diagnostics : batch.diagnostics }
7681
+ : {}),
7499
7682
  ...(session?.generation !== undefined ? { generation: session.generation } : {}),
7500
7683
  sheetFor: (refusals, settings) => wrunSheetWithSettings(wrunRowBatchDeliveredSheet(ranSheet, refusals, sectionKinds), settings),
7501
7684
  publish: (verdictMeta, verdict) => publishWrunSourceVerdict(chartIndex, indicatorId, verdictMeta, verdict, indicatorName),
7502
7685
  });
7686
+ // The source-fed live context installs under the same authorisation (the awaits since the write gave it room to
7687
+ // move): a study the lifecycle stopped meanwhile gets no live session behind it.
7688
+ assertWrunCmeStudyAuthCurrent(computed, indicatorId);
7503
7689
  setWrunOverlayLiveContext(context);
7504
7690
  // A source-fed session holds no poll lane: the live channels of the session it replaced close.
7505
7691
  openWrunPollLaneLiveChannels(context);
@@ -8252,21 +8438,20 @@ async function assertWrunTapeServedOnInterval(metadata, inputName, chartInterval
8252
8438
  input: inputName,
8253
8439
  value: chartInterval,
8254
8440
  });
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
- }
8441
+ // The record names the chart's kind (calendar, typed, finer) through the one tape seed the cloud lane reads too.
8442
+ const seed = wrunTapeIntervalSeed(chartInterval);
8443
+ if (isCalendarIntervalLabel(chartInterval))
8444
+ throw attachWrunRefusal(refused(hostWords()), seed);
8262
8445
  const { isKScriptDataRestrictedForInterval } = await import('../chart/kscript-data-interval-restriction.leaf.js');
8263
8446
  if (!isKScriptDataRestrictedForInterval('TRADES', chartInterval))
8264
8447
  return;
8448
+ // A one-second chart reads the shared host's words; any other names what the raw trade lane serves.
8449
+ const serves = seed.variant === 'typed' ? 'no typed interval' : 'no chart finer than a minute';
8265
8450
  throw attachWrunRefusal(refused(chartInterval === '1s'
8266
8451
  ? hostWords()
8267
8452
  : `${WRUN_TAPE_INTERVAL_UNSUPPORTED_CODE}: input '${inputName}' reads tape on the interval ` +
8268
8453
  `'${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 } });
8454
+ `serves ${serves}`), seed);
8270
8455
  }
8271
8456
  /** The chart interval in ms: the store's interval, else the trailing bar
8272
8457
  * spacing of the candles, else one minute. */
@@ -8675,10 +8860,8 @@ runMarket) {
8675
8860
  /** The strategy half a reseed retains: everything but the bars (rebuilt
8676
8861
  * from the chart's candles per reseed). */
8677
8862
  function wrunStrategySeedOf(strategy) {
8678
- return {
8679
- ...(strategy.intervalMs !== undefined ? { intervalMs: strategy.intervalMs } : {}),
8680
- ...(strategy.title !== undefined ? { title: strategy.title } : {}),
8681
- };
8863
+ const { bars: _bars, ...seed } = strategy;
8864
+ return seed;
8682
8865
  }
8683
8866
  /**
8684
8867
  * Subscribe the overlay's own live channels through the technical-script
@@ -9176,6 +9359,7 @@ export async function reseedWrunOverlayFromBuffers(indicatorId, reason, options
9176
9359
  await publishWrunDebugOutput(context.chartIndex, indicatorId, context.metadata, outputRows, {
9177
9360
  opra: context.opraRead === true,
9178
9361
  ...(context.cmeRead === true ? { cme: true } : {}),
9362
+ ...(context.indexOtcRead === true ? { indexOtc: true } : {}),
9179
9363
  });
9180
9364
  try {
9181
9365
  // The canvas fill (G1) for the session's market; a mirror entry that aged
@@ -9219,6 +9403,8 @@ export async function reseedWrunOverlayFromBuffers(indicatorId, reason, options
9219
9403
  ...withPriceTick(reseedHostFill.tickSize),
9220
9404
  ...withCanvasHostFill(canvasFill),
9221
9405
  ...(clamped ? { window: { fromMs: clamped.fromMs, toMs: lastRowTs, partial: true } } : {}),
9406
+ // The session's own set, the one its ticks mount: it replaces the mounted drawings (wrunRunDrawingsPlan).
9407
+ sessionRedraw: true,
9222
9408
  });
9223
9409
  // A replay lane's paint keeps to the replay's bars, in this task.
9224
9410
  if (context.replay)
@@ -9946,6 +10132,37 @@ async function wrunOptionsChainLaneExtrasFor(metadata, chartMetadata, facts, par
9946
10132
  ...wrunOptionsChainImplicitViewFields(gatewayScope),
9947
10133
  };
9948
10134
  }
10135
+ /**
10136
+ * Whether a run still owns its overlay, judged in the task that reads it by the evidence the OPRA writer reads
10137
+ * (`wrunOpraProvenanceWriter`): the mount epoch, the chart instance and the market identity (`wrunRunOwnerLeft`, the
10138
+ * main series read from the store right there) and the overlay's own mounted meta. The CME stamp of a hosted result
10139
+ * reads it (wrun-cloud-cme-stamp.util `stampWrunHostedCme`).
10140
+ */
10141
+ async function wrunRunOwnsOverlayReader(chartIndex, ownership) {
10142
+ const { useChartStore } = await wrunChartHostEnv().chart.loadChartStore();
10143
+ return () => {
10144
+ const chartMetadataNow = useChartStore().mergedAllCharts[chartIndex]?.metadata;
10145
+ if (wrunRunOwnerLeft(ownership.owner, chartMetadataNow, ownership.marketIdentity))
10146
+ return false;
10147
+ const mounted = ownership.tc.metadata;
10148
+ return !(Array.isArray(mounted) && !mounted.includes(ownership.meta));
10149
+ };
10150
+ }
10151
+ /**
10152
+ * Stamp the overlay of a hosted run whose FAILURE carried the server's CME mark (`stampWrunHostedCme`, the marked
10153
+ * success's stamp, sticky for the mount), judged by the run's own ownership. Best effort: the failure is CME-marked
10154
+ * (`computed.cme`) whatever the stamp answers, so a stamp that cannot be written never surfaces the failure raw.
10155
+ */
10156
+ async function stampWrunFailedRunCme(runTarget, tc, meta, owner, head) {
10157
+ try {
10158
+ const marketIdentity = wrunChartMarketIdentity(head.chartMetadata);
10159
+ const owns = await wrunRunOwnsOverlayReader(runTarget.chartIndex, { owner, tc, meta, marketIdentity });
10160
+ await stampWrunHostedCme(runTarget.chartIndex, runTarget.indicatorId, meta, owns);
10161
+ }
10162
+ catch (error) {
10163
+ console.warn(`[wrun] the CME stamp of failed run '${runTarget.indicatorId}' was not written:`, error);
10164
+ }
10165
+ }
9949
10166
  /**
9950
10167
  * One run's OPRA provenance writer (options-overlay-provenance.util `setOptionsOverlayOpraProvenance`, both
9951
10168
  * settings copies), its modules loaded once: `opra` true stamps, false clears. It writes only while the run still
@@ -10595,6 +10812,9 @@ async function reintegrateWrunSession(indicatorId, context, fill, current, optio
10595
10812
  ...withCanvasHostFill(fill),
10596
10813
  ...(clamped ? { window: { fromMs: clamped.fromMs, toMs: context.lastRowTs, partial: true } } : {}),
10597
10814
  ...(options.keepOverlaySettings === true ? { keepOverlaySettings: true } : {}),
10815
+ // The session's own set under the new sheet or fill, the one its ticks mount: it replaces the mounted drawings
10816
+ // (wrunRunDrawingsPlan), so a style repaint lands the new look.
10817
+ sessionRedraw: true,
10598
10818
  });
10599
10819
  if (context.replay)
10600
10820
  cutWrunReplayRowsAfterApply(tc, indicatorId);
@@ -11088,16 +11308,22 @@ export function wrunChartPriceDigits(chartIndex) {
11088
11308
  * candle is a non-finite bar, which the engine handles as such: no fills,
11089
11309
  * intents rejected and counted, equity carried), the chart interval for the
11090
11310
  * 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) {
11311
+ * the display name for `declared.title` and the chart market's point value
11312
+ * (wrunStrategyPointValue: sizes in contracts on a point-valued market).
11313
+ * The store is loaded lazily: only a strategy package needs it on this lane. */
11314
+ async function wrunStrategyRunInputFor(chartIndex, title, rows, ohlcvRows, market) {
11094
11315
  const bars = wrunStrategyBarsFor(rows, ohlcvRows);
11095
11316
  const { useChartStore } = await wrunChartHostEnv().chart.loadChartStore();
11096
11317
  const interval = useChartStore().mergedAllCharts[chartIndex]?.metadata?.interval ?? '';
11097
11318
  const declaredMs = Intervals.map_unit[interval];
11098
11319
  const trailingMs = rows.length >= 2 ? rows[rows.length - 1].ts - rows[rows.length - 2].ts : Number.NaN;
11099
11320
  const intervalMs = declaredMs ?? (Number.isFinite(trailingMs) && trailingMs > 0 ? trailingMs : undefined);
11100
- return { bars, title, ...(intervalMs !== undefined ? { intervalMs } : {}) };
11321
+ return {
11322
+ bars,
11323
+ title,
11324
+ ...(intervalMs !== undefined ? { intervalMs } : {}),
11325
+ pointValue: wrunStrategyPointValue(market),
11326
+ };
11101
11327
  }
11102
11328
  /** The broker feed for input rows: the chart's own candles joined by
11103
11329
  * timestamp (a row with no candle is a non-finite bar, which the engine
@@ -11555,13 +11781,31 @@ function wrunMountReachesBefore(meta, ts) {
11555
11781
  return reachesBefore(record.rawData ?? record.activeData ?? record.data);
11556
11782
  });
11557
11783
  }
11784
+ /** The result with no drawings of its own (`wrunRunDrawingsPlan` 'keep-mounted'): what reaches the route's renderables
11785
+ * check, the budget and the adapter, which is told `keepMountedDrawings` and leaves the mounted set alone. */
11786
+ function withoutWrunDrawings(result) {
11787
+ const kept = { ...result };
11788
+ delete kept.drawings;
11789
+ delete kept.drawingsBudget;
11790
+ return kept;
11791
+ }
11792
+ /** The RAW drawing records of the build the overlay's mounted set came from (hidden records included, never the
11793
+ * door's filtered, capped and normalized copy): the live tick's last applied build, else this lane's last applied
11794
+ * result (which a keep-mounted apply carries forward). Undefined: no build of this lane is known to stand behind the
11795
+ * mounted set. */
11796
+ function wrunShownDrawingsOf(indicatorId, meta) {
11797
+ const context = getWrunOverlayLiveContext(indicatorId);
11798
+ if (context?.repaintOwed !== true && context?.liveApplied !== undefined)
11799
+ return context.liveApplied.result.drawings;
11800
+ return wrunMountMemos.get(meta)?.lastResult?.drawings;
11801
+ }
11558
11802
  function integrateWrunRunThroughRouteOnce(options, childMount) {
11559
11803
  // The chart's price digits (WRUN-STYLE X7), read once per integrate: the
11560
11804
  // selection text and the children print with them.
11561
11805
  const priceDigits = options.priceDigits ?? wrunChartPriceDigits(options.chartIndex);
11562
11806
  // The overlay's flat param settings are what the rows were computed with
11563
11807
  // (the run's init() arguments derive from them the same way). An adoption hands the picture its session showed.
11564
- const runResult = options.prebuilt ??
11808
+ const built = options.prebuilt ??
11565
11809
  buildWrunOverlayRunResult({
11566
11810
  ...options,
11567
11811
  params: options.params ?? wrunParamValuesFromSettings(options.metadata, options.meta.settings),
@@ -11575,16 +11819,33 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11575
11819
  ...(priceDigits !== undefined ? { priceDigits } : {}),
11576
11820
  overlayId: options.overlayId ?? options.indicatorId,
11577
11821
  });
11578
- if (runResult.failureReason !== undefined)
11579
- throw new WrunIntegrationError(runResult.failureReason);
11822
+ if (built.failureReason !== undefined)
11823
+ throw new WrunIntegrationError(built.failureReason);
11580
11824
  const { tc, meta, indicatorId, projection, chartIndex } = options;
11825
+ const facts = options.integration;
11826
+ // The drawings rule (wrunRunDrawingsPlan): a partial window's drawings never replace the mounted set. Every caller
11827
+ // states its facts: the full run its route facts, a run's own refine the run's (`drawingsRun`), a redraw of the live
11828
+ // session `sessionRedraw`; a caller that states none asks a new question and replaces. 'keep-mounted' leaves the
11829
+ // mounted set alone: the adapter gets a result with no drawings and `keepMountedDrawings` on both apply routes, so
11830
+ // nothing projects, normalizes or mounts a drawing; the render-equal check and the lane's memo read the result as
11831
+ // shown (its rows, the raw records the mounted set was built from).
11832
+ const drawingsFacts = facts ?? options.drawingsRun;
11833
+ const keepMountedDrawings = wrunRunDrawingsPlan({
11834
+ partialWindow: options.window?.partial === true,
11835
+ owedFullIntegration: drawingsFacts
11836
+ ? wrunRunOwesFullIntegration(drawingsFacts.reason, drawingsFacts.hasGoodResult)
11837
+ : true,
11838
+ sessionRedraw: options.sessionRedraw === true,
11839
+ }) === 'keep-mounted';
11840
+ const runResult = keepMountedDrawings ? withoutWrunDrawings(built) : built;
11841
+ const shownDrawings = keepMountedDrawings ? wrunShownDrawingsOf(indicatorId, meta) : undefined;
11842
+ const shown = (result) => keepMountedDrawings && shownDrawings !== undefined ? { ...result, drawings: shownDrawings } : result;
11581
11843
  // The run window's bars beside the cost (the slow chip's card: "rows on N bars").
11582
11844
  if (chartIndex !== undefined) {
11583
11845
  recordKScriptPerfVolumeExtras(overlayExecutionGuardKey(chartIndex, indicatorId), {
11584
11846
  bars: options.outputRows.length,
11585
11847
  });
11586
11848
  }
11587
- const facts = options.integration;
11588
11849
  const routed = facts
11589
11850
  ? wrunIntegrationRoute({
11590
11851
  reason: facts.reason,
@@ -11594,7 +11855,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11594
11855
  settingsStale: facts.settingsStale,
11595
11856
  outputRowCount: options.outputRows.length,
11596
11857
  hasRenderables: wrunRunResultHasRenderables(runResult),
11597
- renderEqual: () => wrunRenderEqualToMount(meta, runResult, options.window),
11858
+ renderEqual: () => wrunRenderEqualToMount(meta, shown(runResult), options.window),
11598
11859
  mountedPlotSetFits: () => wrunMountedPlotSetFits(meta, runResult),
11599
11860
  })
11600
11861
  : { action: 'apply-remount' };
@@ -11609,7 +11870,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11609
11870
  ? { action: 'apply-remount' }
11610
11871
  : routed;
11611
11872
  if (route.action === 'skip')
11612
- return { runResult, route, applied: false };
11873
+ return { runResult: shown(runResult), route, applied: false };
11613
11874
  // Read before any chart mutation: a strip word off the vocabulary refuses the run by name.
11614
11875
  const stripSettings = wrunStatsStripSettings(options.metadata);
11615
11876
  applyWrunIntegrationBudget(runResult, chartIndex, indicatorId);
@@ -11642,6 +11903,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11642
11903
  meta: meta,
11643
11904
  ...projection,
11644
11905
  ...(partialSpan ? { preserveMountedRowsOutsideWindow: partialSpan } : {}),
11906
+ ...(keepMountedDrawings ? { keepMountedDrawings: true } : {}),
11645
11907
  postApply: render,
11646
11908
  });
11647
11909
  if (!integration.ok)
@@ -11687,6 +11949,7 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11687
11949
  ...projection,
11688
11950
  ignoreUnmountedOutputKeys: wrunMountMemos.get(meta)?.unmountable,
11689
11951
  mergeMountedRows: route.action === 'apply-rows-merge',
11952
+ ...(keepMountedDrawings ? { keepMountedDrawings: true } : {}),
11690
11953
  });
11691
11954
  if (!refresh.ok)
11692
11955
  throw wrunIntegrationErrorOf(refresh.diagnostics);
@@ -11706,11 +11969,11 @@ function integrateWrunRunThroughRouteOnce(options, childMount) {
11706
11969
  : withWrunOverlayExecutionMeasure(chartIndex, indicatorId, 'wrun-integrate', apply);
11707
11970
  if (applied) {
11708
11971
  const memo = wrunMountMemoOf(meta);
11709
- memo.lastResult = runResult;
11972
+ memo.lastResult = shown(runResult);
11710
11973
  memo.lastRows = meta.rawData;
11711
11974
  memo.lastWindow = runWindow === undefined ? undefined : { ...runWindow };
11712
11975
  }
11713
- return { runResult: placed, route, applied };
11976
+ return { runResult: shown(placed), route, applied };
11714
11977
  }
11715
11978
  // ---------------------------------------------------------------------------
11716
11979
  // Prefix runs (C1 v3): a pan-back page computes only the bars it added