@orangecharts/wrun-chart-host 0.4.0 → 0.6.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.
- package/README.md +17 -5
- package/dist/constants/exchange-names.leaf.d.ts +8 -0
- package/dist/constants/exchange-names.leaf.js +101 -0
- package/dist/constants/feature-flags.constants.js +7 -2
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
- package/dist/constants/opra-compliance.constants.d.ts +19 -0
- package/dist/constants/opra-compliance.constants.js +19 -0
- package/dist/constants/replay-ladder.leaf.d.ts +30 -0
- package/dist/constants/replay-ladder.leaf.js +99 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
- package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
- package/dist/constants/scriptEditor/execution.constants.js +14 -0
- package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
- package/dist/constants/wrun-prefix-safe.constants.js +26 -0
- package/dist/host-env.d.ts +301 -22
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +853 -29
- package/dist/index.d.ts +140 -2
- package/dist/index.js +140 -2
- package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
- package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
- package/dist/interfaces/market-event.interface.d.ts +231 -0
- package/dist/interfaces/market-event.interface.js +15 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
- package/dist/interfaces/opra-realtime.interface.js +34 -59
- package/dist/interfaces/replay.interface.d.ts +285 -0
- package/dist/interfaces/replay.interface.js +1 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
- package/dist/interfaces/wrun-runtime.interface.js +17 -3
- package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
- package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
- package/dist/market-data/billing.interface.d.ts +219 -0
- package/dist/market-data/billing.interface.js +58 -0
- package/dist/market-data/venue-governed.util.d.ts +2 -0
- package/dist/market-data/venue-governed.util.js +10 -0
- package/dist/market-data/venue.d.ts +122 -0
- package/dist/market-data/venue.js +1 -0
- package/dist/market-data/venues/index.d.ts +97 -0
- package/dist/market-data/venues/index.js +33 -0
- package/dist/market-data/venues/opra.contract.copy.json +35 -0
- package/dist/market-data/venues/opra.d.ts +70 -0
- package/dist/market-data/venues/opra.js +74 -0
- package/dist/replay/replayIndicatorRows.d.ts +31 -0
- package/dist/replay/replayIndicatorRows.js +117 -0
- package/dist/replay/replayLadder.d.ts +85 -0
- package/dist/replay/replayLadder.js +388 -0
- package/dist/utility/auth/server-clock.util.d.ts +81 -0
- package/dist/utility/auth/server-clock.util.js +238 -0
- package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
- package/dist/utility/chart/builtin-identity.util.js +51 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
- package/dist/utility/chart/cache-alignment.util.js +926 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +17 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +61 -0
- package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
- package/dist/utility/chart/chart-time-domain.util.js +23 -0
- package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
- package/dist/utility/chart/color-customization.leaf.js +16 -0
- package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
- package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
- package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
- package/dist/utility/chart/gesture-timing.leaf.js +29 -0
- package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
- package/dist/utility/chart/governed-contract-coin.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
- package/dist/utility/chart/host-bar-placement.util.js +447 -0
- package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
- package/dist/utility/chart/index-host-tier.util.js +118 -0
- package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
- package/dist/utility/chart/index-mode-admission.util.js +67 -0
- package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
- package/dist/utility/chart/indicator-error-message.util.js +44 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
- package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
- package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
- package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
- package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
- package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
- package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
- package/dist/utility/chart/kscript-source-retention.util.js +218 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
- package/dist/utility/chart/live-cadence.util.d.ts +38 -0
- package/dist/utility/chart/live-cadence.util.js +37 -0
- package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
- package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
- package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
- package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
- package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
- package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
- package/dist/utility/chart/mixed-mode.util.js +139 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
- package/dist/utility/chart/price-precision.util.d.ts +40 -0
- package/dist/utility/chart/price-precision.util.js +70 -0
- package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
- package/dist/utility/chart/profile-block-size.util.js +141 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
- package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
- package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
- package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
- package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
- package/dist/utility/chart/titan-constants.pin.js +18 -5
- package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
- package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
- package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
- package/dist/utility/chart/wrun-run-result.util.js +20 -14
- package/dist/utility/common/data-processing.util.d.ts +138 -0
- package/dist/utility/common/data-processing.util.js +346 -0
- package/dist/utility/common/visible-timeout.util.d.ts +13 -4
- package/dist/utility/common/visible-timeout.util.js +23 -8
- package/dist/utility/exchange-format.leaf.d.ts +1 -0
- package/dist/utility/exchange-format.leaf.js +47 -0
- package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
- package/dist/utility/market-events/earnings-scope.util.js +92 -0
- package/dist/utility/market-events/market-events.util.d.ts +147 -0
- package/dist/utility/market-events/market-events.util.js +392 -0
- package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
- package/dist/utility/market-events/zoned-clock.util.js +11 -0
- package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
- package/dist/utility/options/option-venue-disclosure.util.js +56 -0
- package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
- package/dist/utility/scriptEditor/package-semver.util.js +120 -0
- package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
- package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
- package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
- package/dist/utility/v2/governed-tier.leaf.js +113 -0
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
- package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
- package/dist/utility/wrun/sources/lanes/series.js +2 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
- package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
- package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-bar-count.util.js +274 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
- package/dist/utility/wrun/wrun-deadline.util.js +2 -1
- package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
- package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
- package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
- package/dist/utility/wrun/wrun-host.service.d.ts +330 -0
- package/dist/utility/wrun/wrun-host.service.js +855 -0
- package/dist/utility/wrun/wrun-hover.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-hover.util.js +25 -4
- package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
- package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
- package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
- package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
- package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
- package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
- package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
- package/dist/utility/wrun/wrun-param-map.util.js +40 -47
- package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-param-values.util.js +5 -5
- package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
- package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
- package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
- package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
- package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
- package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
- package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
- package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
- package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
- package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
- package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
- package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
- package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
- package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
- package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
- package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
- package/dist/utility/wrun/wrun-text-params.util.js +19 -30
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
- package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
- package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
- package/dist/utility/wrun-alert-params.leaf.js +24 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
- package/dist/utils/replay/replay-buffer-math.js +684 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +203 -0
- package/dist/workers/wrun/wrun-abi-host.js +1220 -0
- package/dist/workers/wrun/wrun-engine-handler.d.ts +20 -0
- package/dist/workers/wrun/wrun-engine-handler.js +380 -0
- package/package.json +3 -3
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import { getWrunOverlayLiveContext, hasWrunOverlayDriver, isWrunOverlayRerunInFlight, onWrunOverlayLiveTeardown, onWrunOverlayRunSettled, rerunWrunOverlayForChartWave, suspendWrunOverlayLiveSession, } from './wrun-overlay-drivers.util.js';
|
|
2
|
+
import { wrunOverlayHold } from './wrun-overlay-recovery.util.js';
|
|
3
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
4
|
+
const lanes = new Map();
|
|
5
|
+
const records = new WeakMap();
|
|
6
|
+
let laneGenerations = 0;
|
|
7
|
+
function ring(event, details) {
|
|
8
|
+
if (wrunChartHostEnv().diagnostics.debugEnabled())
|
|
9
|
+
wrunChartHostEnv().diagnostics.debug(event, details);
|
|
10
|
+
}
|
|
11
|
+
let stepSide;
|
|
12
|
+
/** The modules a step runs on, loaded on first use and shared; a failed load is retried. */
|
|
13
|
+
function loadWrunReplayStepSide() {
|
|
14
|
+
stepSide ??= Promise.all([
|
|
15
|
+
wrunChartHostEnv().chart.loadTitanCharts(),
|
|
16
|
+
import('./wrun-overlay-run.util.js'),
|
|
17
|
+
import('./wrun-live-tick.util.js'),
|
|
18
|
+
import('./wrun-source-rows.util.js'),
|
|
19
|
+
import('./wrun-run-interval-session.util.js'),
|
|
20
|
+
import('./wrun-replay-rows.util.js'),
|
|
21
|
+
wrunChartHostEnv().chart.loadExecutorPorts(),
|
|
22
|
+
]).catch((error) => {
|
|
23
|
+
stepSide = undefined;
|
|
24
|
+
throw error;
|
|
25
|
+
});
|
|
26
|
+
return stepSide;
|
|
27
|
+
}
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
// The replay module's entries (through the lifecycle door)
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
/**
|
|
32
|
+
* Open (or reopen) the overlay's replay lane at `cutoffTs` over `window`.
|
|
33
|
+
* Synchronous `false` when the id has no wrun driver (the replay module keeps
|
|
34
|
+
* its blank). Otherwise a promise that never rejects: true once the replay
|
|
35
|
+
* run painted, false when a hold (paused, tripped, gated, venue) refused it,
|
|
36
|
+
* the run failed, or the lane closed meanwhile; the replay module then blanks
|
|
37
|
+
* the overlay and lists it hidden.
|
|
38
|
+
*/
|
|
39
|
+
export function openWrunOverlayReplayLane(chartIndex, indicatorId, window, cutoffTs) {
|
|
40
|
+
if (!hasWrunOverlayDriver(indicatorId))
|
|
41
|
+
return false;
|
|
42
|
+
closeWrunReplayLaneState(lanes.get(indicatorId));
|
|
43
|
+
const lane = {
|
|
44
|
+
chartIndex,
|
|
45
|
+
indicatorId,
|
|
46
|
+
generation: 0,
|
|
47
|
+
window: { fromMs: window.fromMs, toMs: window.toMs },
|
|
48
|
+
cutoffTs,
|
|
49
|
+
paintCutoffTs: cutoffTs,
|
|
50
|
+
phase: 'opening',
|
|
51
|
+
everOpen: false,
|
|
52
|
+
draining: false,
|
|
53
|
+
drainAgain: false,
|
|
54
|
+
reopenOwed: false,
|
|
55
|
+
};
|
|
56
|
+
lanes.set(indicatorId, lane);
|
|
57
|
+
return runWrunReplayOpen(lane);
|
|
58
|
+
}
|
|
59
|
+
/** Reveal through `cutoffTs` (the replay's newest completed bar). A no-op
|
|
60
|
+
* without a lane on this chart; a held lane only keeps the cutoff. */
|
|
61
|
+
export function revealWrunOverlayReplayLane(chartIndex, indicatorId, cutoffTs) {
|
|
62
|
+
const lane = lanes.get(indicatorId);
|
|
63
|
+
if (!lane || lane.chartIndex !== chartIndex || lane.phase === 'closed' || !Number.isFinite(cutoffTs))
|
|
64
|
+
return;
|
|
65
|
+
lane.cutoffTs = cutoffTs;
|
|
66
|
+
// A tick inside the same bar reveals nothing new (the session's cutoff stands).
|
|
67
|
+
if (lane.phase === 'open' && (lane.draining || replayRecordOf(lane)?.cutoffTs !== cutoffTs)) {
|
|
68
|
+
void drainWrunReplayLane(lane);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** The replay's forward runway grew: the lane's window becomes `window` (the
|
|
72
|
+
* kScript lane's range for it, its head under the 5k clamp), and a session
|
|
73
|
+
* whose lanes end at the old window reopens over the new one, ahead of the
|
|
74
|
+
* playhead (the kScript lane re-inits its engine over the extended range the
|
|
75
|
+
* same way). */
|
|
76
|
+
export function extendWrunOverlayReplayLane(chartIndex, indicatorId, window) {
|
|
77
|
+
const lane = lanes.get(indicatorId);
|
|
78
|
+
if (!lane || lane.chartIndex !== chartIndex || lane.phase === 'closed' || !(window.toMs > lane.window.toMs))
|
|
79
|
+
return;
|
|
80
|
+
lane.window = { fromMs: window.fromMs, toMs: window.toMs };
|
|
81
|
+
const record = replayRecordOf(lane);
|
|
82
|
+
if (lane.phase === 'open' && record?.needsWindow && record.coveredThroughTs < window.toMs) {
|
|
83
|
+
void drainWrunReplayLane(lane, true);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Close the overlay's replay lane: its replay session ends (exit, the
|
|
87
|
+
* re-anchor clear, dispose). The overlay's rows stay as painted. */
|
|
88
|
+
export function closeWrunOverlayReplayLane(indicatorId) {
|
|
89
|
+
closeWrunReplayLaneState(lanes.get(indicatorId));
|
|
90
|
+
}
|
|
91
|
+
/** Resume while the chart replays (the store's one recovery path, through the
|
|
92
|
+
* door's `resumeWrunOverlay`): a lane a hold left dormant, or one whose
|
|
93
|
+
* session a Pause ended, reopens at its newest cutoff. Undefined when the
|
|
94
|
+
* overlay has no such lane (the door's own rerun follows). */
|
|
95
|
+
export function resumeWrunOverlayReplayLane(chartIndex, indicatorId) {
|
|
96
|
+
const lane = lanes.get(indicatorId);
|
|
97
|
+
if (!lane || lane.chartIndex !== chartIndex || !wrunChartHostEnv().chart.isReplaying(chartIndex))
|
|
98
|
+
return undefined;
|
|
99
|
+
if (lane.phase === 'held' || (lane.phase === 'open' && replaySessionOf(lane) === undefined)) {
|
|
100
|
+
return runWrunReplayOpen(lane);
|
|
101
|
+
}
|
|
102
|
+
return undefined;
|
|
103
|
+
}
|
|
104
|
+
/** Whether the overlay has a replay lane (opening, open, or held dormant). */
|
|
105
|
+
export function hasWrunOverlayReplayLane(indicatorId) {
|
|
106
|
+
const lane = lanes.get(indicatorId);
|
|
107
|
+
return lane !== undefined && lane.phase !== 'closed';
|
|
108
|
+
}
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
// The run's entries
|
|
111
|
+
// ---------------------------------------------------------------------------
|
|
112
|
+
/** What a replay run of this overlay computes over: the lane's window and
|
|
113
|
+
* its newest cutoff, which the run's paint is cut at. Undefined without an
|
|
114
|
+
* opening lane on this chart while it replays (the run is superseded). */
|
|
115
|
+
export function wrunReplayRunPlanOf(chartIndex, indicatorId) {
|
|
116
|
+
const lane = lanes.get(indicatorId);
|
|
117
|
+
if (!lane ||
|
|
118
|
+
lane.chartIndex !== chartIndex ||
|
|
119
|
+
lane.phase !== 'opening' ||
|
|
120
|
+
!wrunChartHostEnv().chart.isReplaying(chartIndex)) {
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
lane.paintCutoffTs = lane.cutoffTs;
|
|
124
|
+
lane.planReadGeneration = lane.generation;
|
|
125
|
+
return { generation: lane.generation, fromMs: lane.window.fromMs, toMs: lane.window.toMs, cutoffTs: lane.cutoffTs };
|
|
126
|
+
}
|
|
127
|
+
/** Whether the lane a replay run computes for is still the one opening on a
|
|
128
|
+
* replaying chart (else the run is superseded and paints nothing). */
|
|
129
|
+
export function isWrunReplayRunCurrent(chartIndex, indicatorId, generation) {
|
|
130
|
+
const lane = lanes.get(indicatorId);
|
|
131
|
+
return (lane !== undefined &&
|
|
132
|
+
lane.chartIndex === chartIndex &&
|
|
133
|
+
lane.generation === generation &&
|
|
134
|
+
lane.phase === 'opening' &&
|
|
135
|
+
wrunChartHostEnv().chart.isReplaying(chartIndex));
|
|
136
|
+
}
|
|
137
|
+
/** The replay run installed `context` as the lane's session (called right
|
|
138
|
+
* after the context install, under the run's session lock). */
|
|
139
|
+
export function noteWrunReplayRun(context, record) {
|
|
140
|
+
records.set(context, record);
|
|
141
|
+
}
|
|
142
|
+
/** The record of a replay session (undefined for a live one). */
|
|
143
|
+
export function wrunReplayRunRecordOf(context) {
|
|
144
|
+
return context === undefined ? undefined : records.get(context);
|
|
145
|
+
}
|
|
146
|
+
/** The cutoff a replay session's paint keeps to (the run or step in
|
|
147
|
+
* progress), read by the integrates of a replay session in their own task
|
|
148
|
+
* (wrun-replay-rows.util `cutWrunReplayRowsAfterApply`). Undefined without a lane. */
|
|
149
|
+
export function wrunReplayPaintCutoffOf(indicatorId) {
|
|
150
|
+
const lane = lanes.get(indicatorId);
|
|
151
|
+
return lane && lane.phase !== 'closed' ? lane.paintCutoffTs : undefined;
|
|
152
|
+
}
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
// Open, steps, close
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
function isWrunReplayLaneCurrent(lane) {
|
|
157
|
+
return (lanes.get(lane.indicatorId) === lane &&
|
|
158
|
+
lane.phase !== 'closed' &&
|
|
159
|
+
wrunChartHostEnv().chart.isReplaying(lane.chartIndex));
|
|
160
|
+
}
|
|
161
|
+
/** The lane's session: the overlay's context when it is a replay session
|
|
162
|
+
* this lane's current generation installed. */
|
|
163
|
+
function replaySessionOf(lane) {
|
|
164
|
+
const context = getWrunOverlayLiveContext(lane.indicatorId);
|
|
165
|
+
if (!context?.replay || context.chartIndex !== lane.chartIndex)
|
|
166
|
+
return undefined;
|
|
167
|
+
return records.get(context)?.generation === lane.generation ? context : undefined;
|
|
168
|
+
}
|
|
169
|
+
function replayRecordOf(lane) {
|
|
170
|
+
const context = replaySessionOf(lane);
|
|
171
|
+
return context ? records.get(context) : undefined;
|
|
172
|
+
}
|
|
173
|
+
function closeWrunReplayLaneState(lane) {
|
|
174
|
+
if (!lane || lane.phase === 'closed')
|
|
175
|
+
return;
|
|
176
|
+
lane.phase = 'closed';
|
|
177
|
+
if (lanes.get(lane.indicatorId) === lane)
|
|
178
|
+
lanes.delete(lane.indicatorId);
|
|
179
|
+
lane.settleOpen?.(false);
|
|
180
|
+
lane.settleOpen = undefined;
|
|
181
|
+
// A replay session ends with its lane (one a reopen replaced included); a
|
|
182
|
+
// live one (a lane that never opened) stays.
|
|
183
|
+
const context = getWrunOverlayLiveContext(lane.indicatorId);
|
|
184
|
+
if (context?.replay && context.chartIndex === lane.chartIndex)
|
|
185
|
+
suspendWrunOverlayLiveSession(lane.indicatorId);
|
|
186
|
+
ring('wrun-replay-lane-closed', { chartIndex: lane.chartIndex, indicatorId: lane.indicatorId });
|
|
187
|
+
}
|
|
188
|
+
/** A lane that painted and then could not reopen takes its rows off the
|
|
189
|
+
* chart (they would stand still past a playhead moving back): it closes, or
|
|
190
|
+
* goes dormant on a hold (`held`), when Resume brings it back. */
|
|
191
|
+
async function failWrunReplayLane(lane, held = false) {
|
|
192
|
+
const everOpen = lane.everOpen;
|
|
193
|
+
if (held && everOpen) {
|
|
194
|
+
lane.phase = 'held';
|
|
195
|
+
lane.settleOpen?.(false);
|
|
196
|
+
lane.settleOpen = undefined;
|
|
197
|
+
}
|
|
198
|
+
else {
|
|
199
|
+
closeWrunReplayLaneState(lane);
|
|
200
|
+
}
|
|
201
|
+
if (!everOpen)
|
|
202
|
+
return;
|
|
203
|
+
try {
|
|
204
|
+
const [{ getTC }, , , , , replayRows] = await loadWrunReplayStepSide();
|
|
205
|
+
if (lanes.has(lane.indicatorId) && lanes.get(lane.indicatorId) !== lane)
|
|
206
|
+
return;
|
|
207
|
+
if (lane.phase !== 'held' && lane.phase !== 'closed')
|
|
208
|
+
return;
|
|
209
|
+
replayRows.cutWrunReplayRows(getTC(lane.chartIndex), lane.indicatorId, Number.NEGATIVE_INFINITY);
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
console.warn(`[wrun] replay lane blank failed for '${lane.indicatorId}':`, error);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* One replay run through the executor (it merges with a run in flight, and
|
|
217
|
+
* 'replay' outranks every queued reason), settled by the run that read this
|
|
218
|
+
* open's plan (a replay run in flight for an earlier lane settles first and
|
|
219
|
+
* is passed over), or by the lane closing. The hold first: an overlay paused,
|
|
220
|
+
* tripped, gated or behind the venue wall is not laned.
|
|
221
|
+
*/
|
|
222
|
+
async function runWrunReplayOpen(lane) {
|
|
223
|
+
lane.generation = ++laneGenerations;
|
|
224
|
+
lane.phase = 'opening';
|
|
225
|
+
const generation = lane.generation;
|
|
226
|
+
const superseded = () => lanes.get(lane.indicatorId) !== lane || lane.generation !== generation || lane.phase === 'closed';
|
|
227
|
+
try {
|
|
228
|
+
const hold = await wrunOverlayHold(lane.chartIndex, lane.indicatorId, 'replay');
|
|
229
|
+
if (superseded())
|
|
230
|
+
return false;
|
|
231
|
+
if (hold !== null) {
|
|
232
|
+
ring('wrun-replay-lane-held', { chartIndex: lane.chartIndex, indicatorId: lane.indicatorId, hold });
|
|
233
|
+
await failWrunReplayLane(lane, hold === 'paused' || hold === 'tripped');
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
const ran = await new Promise((resolve) => {
|
|
237
|
+
let settled = false;
|
|
238
|
+
const settle = (ok) => {
|
|
239
|
+
if (settled)
|
|
240
|
+
return;
|
|
241
|
+
settled = true;
|
|
242
|
+
stop();
|
|
243
|
+
if (lane.settleOpen === settle)
|
|
244
|
+
lane.settleOpen = undefined;
|
|
245
|
+
resolve(ok);
|
|
246
|
+
};
|
|
247
|
+
const stop = onWrunOverlayRunSettled((event) => {
|
|
248
|
+
if (event.indicatorId !== lane.indicatorId || event.reason !== 'replay')
|
|
249
|
+
return;
|
|
250
|
+
if (lane.planReadGeneration === generation) {
|
|
251
|
+
settle(event.ok && replaySessionOf(lane) !== undefined);
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
// A replay run that never read this plan: the executor's follow-up is
|
|
255
|
+
// this open's run when one is queued, else none is coming.
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
if (lane.planReadGeneration !== generation && !isWrunOverlayRerunInFlight(lane.indicatorId))
|
|
258
|
+
settle(false);
|
|
259
|
+
}, 0);
|
|
260
|
+
});
|
|
261
|
+
lane.settleOpen = settle;
|
|
262
|
+
if (rerunWrunOverlayForChartWave(lane.indicatorId, { reason: 'replay' }) === undefined)
|
|
263
|
+
settle(false);
|
|
264
|
+
});
|
|
265
|
+
if (superseded())
|
|
266
|
+
return false;
|
|
267
|
+
if (!ran) {
|
|
268
|
+
ring('wrun-replay-lane-failed', { chartIndex: lane.chartIndex, indicatorId: lane.indicatorId });
|
|
269
|
+
await failWrunReplayLane(lane);
|
|
270
|
+
return false;
|
|
271
|
+
}
|
|
272
|
+
lane.phase = 'open';
|
|
273
|
+
lane.everOpen = true;
|
|
274
|
+
ring('wrun-replay-lane-open', {
|
|
275
|
+
chartIndex: lane.chartIndex,
|
|
276
|
+
indicatorId: lane.indicatorId,
|
|
277
|
+
cutoffTs: replayRecordOf(lane)?.cutoffTs,
|
|
278
|
+
fromMs: lane.window.fromMs,
|
|
279
|
+
toMs: lane.window.toMs,
|
|
280
|
+
});
|
|
281
|
+
// A reveal that landed during the run catches up now.
|
|
282
|
+
if (replayRecordOf(lane)?.cutoffTs !== lane.cutoffTs)
|
|
283
|
+
void drainWrunReplayLane(lane);
|
|
284
|
+
return true;
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
console.warn(`[wrun] replay lane open failed for '${lane.indicatorId}':`, error);
|
|
288
|
+
if (!superseded())
|
|
289
|
+
await failWrunReplayLane(lane);
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
/** One step (or reopen) at a time per lane, latest cutoff wins. */
|
|
294
|
+
async function drainWrunReplayLane(lane, reopen = false) {
|
|
295
|
+
if (reopen)
|
|
296
|
+
lane.reopenOwed = true;
|
|
297
|
+
if (lane.draining) {
|
|
298
|
+
lane.drainAgain = true;
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
lane.draining = true;
|
|
302
|
+
try {
|
|
303
|
+
do {
|
|
304
|
+
lane.drainAgain = false;
|
|
305
|
+
if (lane.reopenOwed) {
|
|
306
|
+
lane.reopenOwed = false;
|
|
307
|
+
await runWrunReplayOpen(lane);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
await stepWrunReplayLane(lane);
|
|
311
|
+
}
|
|
312
|
+
} while ((lane.drainAgain || lane.reopenOwed) && lane.phase === 'open' && lanes.get(lane.indicatorId) === lane);
|
|
313
|
+
}
|
|
314
|
+
catch (error) {
|
|
315
|
+
console.warn(`[wrun] replay step failed for '${lane.indicatorId}':`, error);
|
|
316
|
+
}
|
|
317
|
+
finally {
|
|
318
|
+
lane.draining = false;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Whether the lane's session reads as one no step may extend (`liveSuspended`): a hold, or a session known lost
|
|
323
|
+
* (`liveSuspendedBy: 'reopen-failed'`: the kScript socket's reconnect or sweep took the cloud's instance, or a create
|
|
324
|
+
* replaced it). The step then reopens the whole replay window instead of a tail or a page on it: a page asked of an
|
|
325
|
+
* instance the worker no longer has is answered as a create over that page alone.
|
|
326
|
+
*/
|
|
327
|
+
function wrunReplaySessionReopens(lane, context, target) {
|
|
328
|
+
if (!context.liveSuspended)
|
|
329
|
+
return false;
|
|
330
|
+
ring('wrun-replay-lane-reopen', {
|
|
331
|
+
chartIndex: lane.chartIndex,
|
|
332
|
+
indicatorId: lane.indicatorId,
|
|
333
|
+
cause: context.liveSuspendedBy === 'reopen-failed' ? 'session-lost' : 'session-held',
|
|
334
|
+
target,
|
|
335
|
+
});
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* One step to the newest cutoff. Forward past the session's newest bar: the
|
|
340
|
+
* incremental tail over the newly completed bars. Back: the rows past the new
|
|
341
|
+
* cutoff are cut at once, then the session reseeds over the bars through it
|
|
342
|
+
* (its side outputs follow the bars, not the bars the session saw before).
|
|
343
|
+
* Anything the session cannot extend (a moved head, the lanes' window
|
|
344
|
+
* passed, a session the worker lost, a refused tail) reopens the lane. The
|
|
345
|
+
* session's truth is read again right before the step pages or computes
|
|
346
|
+
* (`wrunReplaySessionReopens`): a socket status landing while the step loaded
|
|
347
|
+
* reopens it too.
|
|
348
|
+
*/
|
|
349
|
+
async function stepWrunReplayLane(lane) {
|
|
350
|
+
if (!isWrunReplayLaneCurrent(lane) || lane.phase !== 'open')
|
|
351
|
+
return;
|
|
352
|
+
const target = lane.cutoffTs;
|
|
353
|
+
const context = replaySessionOf(lane);
|
|
354
|
+
const record = context ? records.get(context) : undefined;
|
|
355
|
+
if (!context || !record || wrunReplaySessionReopens(lane, context, target)) {
|
|
356
|
+
await runWrunReplayOpen(lane);
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
if (target === record.cutoffTs)
|
|
360
|
+
return;
|
|
361
|
+
const [{ getTC }, runUtil, liveTick, sourceRows, runIntervalSession, replayRows] = await loadWrunReplayStepSide();
|
|
362
|
+
if (!isWrunReplayLaneCurrent(lane) || replaySessionOf(lane) !== context)
|
|
363
|
+
return;
|
|
364
|
+
if (wrunReplaySessionReopens(lane, context, target)) {
|
|
365
|
+
await runWrunReplayOpen(lane);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const tc = getTC(lane.chartIndex);
|
|
369
|
+
if (!tc)
|
|
370
|
+
return;
|
|
371
|
+
const chartRows = sourceRows.wrunChartCandleRows(tc);
|
|
372
|
+
// The completed bars through the cutoff, the chart's missing bars inside them kept.
|
|
373
|
+
const replayed = sourceRows.wrunChartCandleRowsWithin(chartRows, Number.NEGATIVE_INFINITY, target);
|
|
374
|
+
if (replayed.length === 0)
|
|
375
|
+
return;
|
|
376
|
+
if (replayed[0][0] !== record.firstChartTs ||
|
|
377
|
+
(record.needsWindow && target + record.chartIntervalMs > record.coveredThroughTs)) {
|
|
378
|
+
ring('wrun-replay-lane-reopen', {
|
|
379
|
+
chartIndex: lane.chartIndex,
|
|
380
|
+
indicatorId: lane.indicatorId,
|
|
381
|
+
cause: replayed[0][0] !== record.firstChartTs ? 'head-moved' : 'window-passed',
|
|
382
|
+
target,
|
|
383
|
+
});
|
|
384
|
+
await runWrunReplayOpen(lane);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
lane.paintCutoffTs = target;
|
|
388
|
+
if (record.rowSource !== undefined) {
|
|
389
|
+
await stepWrunReplayRowSource(lane, context, record, record.rowSource, target, tc, liveTick, replayRows);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const runSession = runIntervalSession.wrunRunIntervalSessionOf(context);
|
|
393
|
+
let ohlcvRows;
|
|
394
|
+
if (runSession && record.runBars) {
|
|
395
|
+
// The run bars as of the cutoff: the closed ones as fetched, the forming
|
|
396
|
+
// one folded from the completed chart bars in its bucket.
|
|
397
|
+
runSession.rows = runUtil.wrunReplayRunBars(record.runBars, replayed, target, runSession.run.intervalMs, record.chartIntervalMs);
|
|
398
|
+
ohlcvRows = runIntervalSession.wrunRunIntervalComputeRows(runSession.run, runSession.rows, target + record.chartIntervalMs);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
ohlcvRows = sourceRows.wrunChartCandleRowsAfterHead(record.headRows, replayed);
|
|
402
|
+
}
|
|
403
|
+
if (ohlcvRows.length === 0)
|
|
404
|
+
return;
|
|
405
|
+
let outcome;
|
|
406
|
+
if (target < record.cutoffTs) {
|
|
407
|
+
// Nothing past the new cutoff stays drawn while the session reseeds: the
|
|
408
|
+
// rows are cut now, the drawings and the HUD values the newer bars made
|
|
409
|
+
// go until the reseed paints the ones the bars through it make.
|
|
410
|
+
replayRows.cutWrunReplayRows(tc, lane.indicatorId, target);
|
|
411
|
+
tc.updateDrawings?.(lane.indicatorId, []);
|
|
412
|
+
wrunChartHostEnv().chart.clearLatestValues(lane.chartIndex, lane.indicatorId);
|
|
413
|
+
outcome = 'reseed';
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
outcome = await liveTick.advanceWrunReplaySession(lane.indicatorId, ohlcvRows);
|
|
417
|
+
}
|
|
418
|
+
if (outcome === 'reseed') {
|
|
419
|
+
outcome = await runUtil.reseedWrunOverlayFromBuffers(lane.indicatorId, 'replay-seek', {
|
|
420
|
+
ohlcvRows,
|
|
421
|
+
eligible: () => isWrunReplayLaneCurrent(lane) && replaySessionOf(lane) === context,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
if (!isWrunReplayLaneCurrent(lane) || replaySessionOf(lane) !== context)
|
|
425
|
+
return;
|
|
426
|
+
if (outcome === 'advanced' || outcome === 'reseeded') {
|
|
427
|
+
record.cutoffTs = target;
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
ring('wrun-replay-lane-reopen', {
|
|
431
|
+
chartIndex: lane.chartIndex,
|
|
432
|
+
indicatorId: lane.indicatorId,
|
|
433
|
+
cause: outcome,
|
|
434
|
+
target,
|
|
435
|
+
});
|
|
436
|
+
await runWrunReplayOpen(lane);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* One step of a session a row source answers. Forward: the source answers the
|
|
440
|
+
* newly completed bars (`range`, through the cutoff), and the live tick's
|
|
441
|
+
* integrate half merges and paints them (cut to the playhead after the apply)
|
|
442
|
+
* with the chart's candles through the cutoff, the bars the browser lane's
|
|
443
|
+
* step reads, so the price canvases never take the forming bar. Back: the
|
|
444
|
+
* rows past the new cutoff are cut at once and the lane reopens (the
|
|
445
|
+
* session's snapshots are the cloud's as of its newest bar, so the bars
|
|
446
|
+
* through the new cutoff are asked again). A step that cannot integrate
|
|
447
|
+
* reopens the lane, and so does one whose session the socket lost while its
|
|
448
|
+
* page was out.
|
|
449
|
+
*/
|
|
450
|
+
async function stepWrunReplayRowSource(lane, context, record, step, target, tc, liveTick, replayRows) {
|
|
451
|
+
if (target < record.cutoffTs) {
|
|
452
|
+
replayRows.cutWrunReplayRows(tc, lane.indicatorId, target);
|
|
453
|
+
tc.updateDrawings?.(lane.indicatorId, []);
|
|
454
|
+
wrunChartHostEnv().chart.clearLatestValues(lane.chartIndex, lane.indicatorId);
|
|
455
|
+
ring('wrun-replay-lane-reopen', {
|
|
456
|
+
chartIndex: lane.chartIndex,
|
|
457
|
+
indicatorId: lane.indicatorId,
|
|
458
|
+
cause: 'row-source-back',
|
|
459
|
+
target,
|
|
460
|
+
});
|
|
461
|
+
await runWrunReplayOpen(lane);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
let outcome = 'failed';
|
|
465
|
+
try {
|
|
466
|
+
const batch = await step.source.range({ fromMs: record.cutoffTs + record.chartIntervalMs, toMs: target });
|
|
467
|
+
if (!isWrunReplayLaneCurrent(lane) || replaySessionOf(lane) !== context)
|
|
468
|
+
return;
|
|
469
|
+
// A session the socket lost while the page was out takes nothing from its answer (the worker may have computed
|
|
470
|
+
// that page alone, as a create over it): the lane reopens.
|
|
471
|
+
outcome = context.liveSuspended
|
|
472
|
+
? 'session-lost'
|
|
473
|
+
: await liveTick.integrateWrunOverlayLiveFrame(lane.indicatorId, batch, step.cellRowsOf, target);
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
console.warn(`[wrun] replay row source step failed for '${lane.indicatorId}':`, error);
|
|
477
|
+
}
|
|
478
|
+
if (!isWrunReplayLaneCurrent(lane) || replaySessionOf(lane) !== context)
|
|
479
|
+
return;
|
|
480
|
+
if (outcome === 'applied') {
|
|
481
|
+
record.cutoffTs = target;
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
ring('wrun-replay-lane-reopen', {
|
|
485
|
+
chartIndex: lane.chartIndex,
|
|
486
|
+
indicatorId: lane.indicatorId,
|
|
487
|
+
cause: `row-source-${outcome}`,
|
|
488
|
+
target,
|
|
489
|
+
});
|
|
490
|
+
await runWrunReplayOpen(lane);
|
|
491
|
+
}
|
|
492
|
+
// The lane goes with its overlay: a teardown (the overlay leaves, the chart
|
|
493
|
+
// rebuilds) closes it. Specs that mock the drivers util partially have no
|
|
494
|
+
// hook registry, so the registration is skipped there.
|
|
495
|
+
try {
|
|
496
|
+
onWrunOverlayLiveTeardown((indicatorId, cause) => {
|
|
497
|
+
if (cause !== 'teardown')
|
|
498
|
+
return;
|
|
499
|
+
const lane = lanes.get(indicatorId);
|
|
500
|
+
if (!lane || lane.phase === 'closed')
|
|
501
|
+
return;
|
|
502
|
+
lane.phase = 'closed';
|
|
503
|
+
lanes.delete(indicatorId);
|
|
504
|
+
lane.settleOpen?.(false);
|
|
505
|
+
lane.settleOpen = undefined;
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
catch {
|
|
509
|
+
// partial module mock (specs)
|
|
510
|
+
}
|
|
511
|
+
/** Drops every lane (the specs). */
|
|
512
|
+
export function __resetWrunReplayLanesForTests() {
|
|
513
|
+
for (const lane of lanes.values()) {
|
|
514
|
+
lane.phase = 'closed';
|
|
515
|
+
lane.settleOpen?.(false);
|
|
516
|
+
}
|
|
517
|
+
lanes.clear();
|
|
518
|
+
laneGenerations = 0;
|
|
519
|
+
stepSide = undefined;
|
|
520
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Keep a wrun overlay's mounted rows (the parent, its nested plots, its
|
|
3
|
+
* series child panes and their nested plots) to the replay's bars: from the
|
|
4
|
+
* chart's first bar through `cutoffTs`. A cut claims full damage and flushes
|
|
5
|
+
* one paint (the integration's rule for a wholesale row change). The legends
|
|
6
|
+
* then read the rows now mounted, through titan's own hover-aware pass (the
|
|
7
|
+
* one its live write path runs, which the kScript replay lane's writes ride):
|
|
8
|
+
* a legend shows the last row it was handed, so an integrate's rows never
|
|
9
|
+
* stand in for the replay's. `keepUntimedSideOutputs` keeps a side output's
|
|
10
|
+
* singleton row, which only the run that computed it through `cutoffTs` may
|
|
11
|
+
* ask for (cutWrunReplayRowsAfterApply); the blank of a held or failed lane
|
|
12
|
+
* and a backward step's cut take it off. True when anything was cut.
|
|
13
|
+
*/
|
|
14
|
+
export declare function cutWrunReplayRows(tc: unknown, indicatorId: string, cutoffTs: number, options?: {
|
|
15
|
+
keepUntimedSideOutputs?: boolean;
|
|
16
|
+
}): boolean;
|
|
17
|
+
/** The cut an integrate of a replay session owes, at its lane's paint cutoff
|
|
18
|
+
* (the run or step in progress). That run computed a side output's singleton
|
|
19
|
+
* through the cutoff, so the cut keeps it. A no-op without a lane. True when
|
|
20
|
+
* anything was cut. */
|
|
21
|
+
export declare function cutWrunReplayRowsAfterApply(tc: unknown, indicatorId: string): boolean;
|