@orangecharts/wrun-chart-host 0.3.0 → 0.5.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 +23 -6
- package/dist/constants/exchange-names.leaf.d.ts +8 -0
- package/dist/constants/exchange-names.leaf.js +101 -0
- 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/builtin-script-snippets.d.ts +133 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -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 +321 -24
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +857 -35
- package/dist/index.d.ts +149 -2
- package/dist/index.js +149 -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/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 +5 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +29 -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/date-labelled-interval.leaf.d.ts +15 -0
- package/dist/utility/chart/date-labelled-interval.leaf.js +19 -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/indicator-run-interval.util.d.ts +130 -0
- package/dist/utility/chart/indicator-run-interval.util.js +268 -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/window-geometry.leaf.d.ts +119 -0
- package/dist/utility/chart/window-geometry.leaf.js +391 -0
- package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
- package/dist/utility/chart/window-owner.leaf.js +24 -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/html-escape.leaf.d.ts +11 -0
- package/dist/utility/html-escape.leaf.js +20 -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/option_daily.d.ts +43 -15
- package/dist/utility/wrun/sources/lanes/option_daily.js +78 -20
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +14 -10
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +5 -4
- package/dist/utility/wrun/sources/lanes/series.js +2 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +22 -3
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +38 -7
- package/dist/utility/wrun/sources/registry.js +31 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +5 -5
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +49 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +75 -20
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +49 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +57 -47
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +36 -4
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +6 -12
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +37 -3
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +128 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +233 -51
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +0 -8
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +26 -24
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +85 -104
- 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 +83 -0
- package/dist/utility/wrun/wrun-bar-count.util.js +259 -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 +266 -0
- package/dist/utility/wrun/wrun-host.service.js +655 -0
- 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-opra-stats.leaf.d.ts +29 -10
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +29 -10
- 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-panel-mount.lazy.d.ts +10 -0
- package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +392 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +2346 -0
- 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-pause-dim.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
- package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
- package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
- 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-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-projection.types.d.ts +14 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -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-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 +190 -0
- package/dist/workers/wrun/wrun-abi-host.js +1201 -0
- package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
- package/dist/workers/wrun/wrun-engine-handler.js +211 -0
- package/package.json +3 -3
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import { getWrunOverlayLiveContext, hasWrunOverlayDriver, hasWrunOverlayLiveContext, isWrunOverlayRerunInFlight, onWrunOverlayComputeSucceeded, onWrunOverlayLiveTeardown, dropWrunOverlayPrefixRequest, planWrunOverlayPrefixRequest, rerunWrunOverlayForChartWave, suspendWrunOverlayLiveSession, } from './wrun-overlay-drivers.util.js';
|
|
2
|
+
import { markWrunLiveGap } from './wrun-live-intake.util.js';
|
|
3
|
+
import { dimWrunOverlayForPause } from './wrun-pause-dim.util.js';
|
|
4
|
+
import { __resetWrunOverlayRecoveryForTests, healWrunOverlayIfIdle, resetWrunOverlayHealLadder, retireWrunSourceRecovery, wrunOverlayHold, } from './wrun-overlay-recovery.util.js';
|
|
5
|
+
import { resolveLocalTechnicalScriptLazyRefreshRange, } from '../chart/local-technical-script-range.leaf.js';
|
|
6
|
+
import { overlayExecutionGuardKey } from '../chart/overlay-execution-guard-key.leaf.js';
|
|
7
|
+
import { armLocalKScriptSourceRevalidation, clearLocalKScriptSourceRevalidation, disarmLocalKScriptSourceRevalidation, hasPendingLocalKScriptSourceRevalidation, installLocalKScriptSourceCacheBypass, markLocalKScriptSourceCacheHit, releaseLocalKScriptSourceCacheBypass, takePendingLocalKScriptSourceRevalidation, } from '../chart/local-kscript-source-revalidation.util.js';
|
|
8
|
+
import { getChartDataFetchGeneration } from '../chart/chart-data-fetch-generation.util.js';
|
|
9
|
+
import { isRealChartTimeRangeMs } from '../chart/chart-time-domain.util.js';
|
|
10
|
+
import { ohlcvRowsHaveFiniteClose } from '../chart/ohlcv-row-readiness.util.js';
|
|
11
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
12
|
+
import { resumeWrunOverlayReplayLane } from './wrun-replay-lane.util.js';
|
|
13
|
+
export { healWrunOverlayIfIdle, wrunOverlayHold } from './wrun-overlay-recovery.util.js';
|
|
14
|
+
// The replay lane (market replay follows the playhead): the replay module's door.
|
|
15
|
+
export { closeWrunOverlayReplayLane, extendWrunOverlayReplayLane, hasWrunOverlayReplayLane, openWrunOverlayReplayLane, revealWrunOverlayReplayLane, } from './wrun-replay-lane.util.js';
|
|
16
|
+
/** The kScript runner's delay between an integrated cache-served run and its
|
|
17
|
+
* owed revalidation (data-fetching.util KSCRIPT_SOURCE_REVALIDATION_DELAY_MS). */
|
|
18
|
+
const WRUN_SOURCE_REVALIDATION_DELAY_MS = 1_500;
|
|
19
|
+
/** The pause reason a run head's hold stamps on a tripped overlay. */
|
|
20
|
+
const WRUN_RUN_HOLD_PAUSE_REASON = 'wrun-run';
|
|
21
|
+
function ring(event, details) {
|
|
22
|
+
if (wrunChartHostEnv().diagnostics.debugEnabled())
|
|
23
|
+
wrunChartHostEnv().diagnostics.debug(event, details);
|
|
24
|
+
}
|
|
25
|
+
let chartSide;
|
|
26
|
+
/** The chart store and titan-charts, loaded on first use through the host's
|
|
27
|
+
* loaders (never at import) and shared by concurrent doors; a failed load is
|
|
28
|
+
* retried. */
|
|
29
|
+
function loadWrunChartSide() {
|
|
30
|
+
chartSide ??= Promise.all([
|
|
31
|
+
wrunChartHostEnv().chart.loadChartStore(),
|
|
32
|
+
wrunChartHostEnv().chart.loadTitanCharts(),
|
|
33
|
+
]).catch((error) => {
|
|
34
|
+
chartSide = undefined;
|
|
35
|
+
throw error;
|
|
36
|
+
});
|
|
37
|
+
return chartSide;
|
|
38
|
+
}
|
|
39
|
+
function finitePositive(value) {
|
|
40
|
+
const n = Number(value);
|
|
41
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
42
|
+
}
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// The rerun door
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
/**
|
|
47
|
+
* THE rerun door. Synchronous `false` when the id has no wrun driver (the
|
|
48
|
+
* caller keeps its kScript line). Otherwise a promise that never rejects: a
|
|
49
|
+
* held run re-stamps the pause for 'paused' or 'tripped' (the kScript guarded
|
|
50
|
+
* refresh's rule), logs `wrun-rerun-held` and resolves; a 'lazy-range-refresh'
|
|
51
|
+
* with a demand span gets the clamped window; then the executor runs it.
|
|
52
|
+
*/
|
|
53
|
+
export function requestWrunOverlayRerun(chartIndex, indicatorId, reason, options) {
|
|
54
|
+
if (!hasWrunOverlayDriver(indicatorId))
|
|
55
|
+
return false;
|
|
56
|
+
return dispatchWrunOverlayRerun(chartIndex, indicatorId, reason, options).then(() => undefined);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Chart-wide form for the sites that loop a chart's overlays: the driver ids
|
|
60
|
+
* among `tc.metadata` (narrowed by `options.ids`), each through the door,
|
|
61
|
+
* settled together. Resolves at once, with no await, when no id has a driver.
|
|
62
|
+
*/
|
|
63
|
+
export function requestWrunOverlayRerunsForChart(chartIndex, tc, reason, options) {
|
|
64
|
+
const ids = [];
|
|
65
|
+
const metadata = tc?.metadata;
|
|
66
|
+
if (Array.isArray(metadata)) {
|
|
67
|
+
for (const meta of metadata) {
|
|
68
|
+
const id = meta?.id;
|
|
69
|
+
if (typeof id !== 'string' || ids.includes(id))
|
|
70
|
+
continue;
|
|
71
|
+
if (options?.ids && !options.ids.has(id))
|
|
72
|
+
continue;
|
|
73
|
+
if (hasWrunOverlayDriver(id))
|
|
74
|
+
ids.push(id);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (ids.length === 0)
|
|
78
|
+
return Promise.resolve();
|
|
79
|
+
const requestOptions = { demandSpan: options?.demandSpan, intervalMs: options?.intervalMs };
|
|
80
|
+
return Promise.allSettled(ids.map((id) => requestWrunOverlayRerun(chartIndex, id, reason, requestOptions) || Promise.resolve())).then(() => undefined);
|
|
81
|
+
}
|
|
82
|
+
async function dispatchWrunOverlayRerun(chartIndex, indicatorId, reason, options = {}) {
|
|
83
|
+
// A pan wave over a live session that only gained older bars is planned as a prefix run (C1 v3)
|
|
84
|
+
// before anything here awaits: from this moment the session's owner is pending over the page, so
|
|
85
|
+
// a live tick meeting the page in front of the session leaves it to this wave instead of handing
|
|
86
|
+
// off a whole rebuild. Every way out below that queues no run settles the plan again.
|
|
87
|
+
const prefix = reason === 'lazy-range-refresh' ? planWrunPrefixRequestSafely(chartIndex, indicatorId) : undefined;
|
|
88
|
+
const unplan = (why) => {
|
|
89
|
+
if (prefix)
|
|
90
|
+
dropWrunPrefixRequestSafely(chartIndex, indicatorId, prefix, why);
|
|
91
|
+
};
|
|
92
|
+
try {
|
|
93
|
+
// The candidate window first: the hold compares it with a failed run's identity (the
|
|
94
|
+
// deterministic latch). A wave with no replay range still answers its hold before it skips.
|
|
95
|
+
const resolved = reason === 'lazy-range-refresh' && options.demandSpan
|
|
96
|
+
? await resolveWrunLazyRefreshWindow(chartIndex, options.demandSpan, options.intervalMs)
|
|
97
|
+
: undefined;
|
|
98
|
+
const hold = await wrunOverlayHold(chartIndex, indicatorId, reason, resolved ? { window: resolved } : {});
|
|
99
|
+
if (hold !== null) {
|
|
100
|
+
unplan('held');
|
|
101
|
+
if (hold === 'paused' || hold === 'tripped')
|
|
102
|
+
await restampWrunOverlayPause(chartIndex, indicatorId, reason);
|
|
103
|
+
ring('wrun-rerun-held', { chartIndex, indicatorId, reason, hold });
|
|
104
|
+
return 'held';
|
|
105
|
+
}
|
|
106
|
+
if (resolved === null) {
|
|
107
|
+
unplan('no-replay-range');
|
|
108
|
+
ring('wrun-rerun-skipped', { chartIndex, indicatorId, reason, cause: 'no-replay-range' });
|
|
109
|
+
return 'skipped';
|
|
110
|
+
}
|
|
111
|
+
// A session its run budget clamped keeps the newest bars that fit (WRUN-MARKS-CONTRACT design 5): a page that
|
|
112
|
+
// starts before its first row would be evicted from the old end, so it is neither computed nor mounted, and the
|
|
113
|
+
// bars of the page inside the session are the session's already.
|
|
114
|
+
if (resolved?.partial === true && wrunPageBeforeRetainedRange(chartIndex, indicatorId, resolved)) {
|
|
115
|
+
unplan('outside-retained-range');
|
|
116
|
+
ring('wrun-rerun-skipped', { chartIndex, indicatorId, reason, cause: 'outside-retained-range' });
|
|
117
|
+
return 'skipped';
|
|
118
|
+
}
|
|
119
|
+
const window = resolved;
|
|
120
|
+
const work = rerunWrunOverlayForChartWave(indicatorId, {
|
|
121
|
+
reason,
|
|
122
|
+
...(window ? { window } : {}),
|
|
123
|
+
...(options.origin ? { origin: options.origin } : {}),
|
|
124
|
+
...(prefix ? { prefix } : {}),
|
|
125
|
+
});
|
|
126
|
+
if (!work) {
|
|
127
|
+
unplan('not-run');
|
|
128
|
+
return 'skipped';
|
|
129
|
+
}
|
|
130
|
+
// The executor keeps the last good result on a failure; the door never rejects.
|
|
131
|
+
await work.catch(() => undefined);
|
|
132
|
+
return 'ran';
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
unplan('door-failed');
|
|
136
|
+
console.warn(`[wrun] lifecycle door failed for '${indicatorId}' (${reason}):`, error);
|
|
137
|
+
return 'skipped';
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** Whether a page's window starts before the retained range of the overlay's live session on this chart (design 5:
|
|
141
|
+
* a session its run budget clamped, `retained`). */
|
|
142
|
+
function wrunPageBeforeRetainedRange(chartIndex, indicatorId, window) {
|
|
143
|
+
const context = getWrunOverlayLiveContext(indicatorId);
|
|
144
|
+
return (context !== undefined &&
|
|
145
|
+
context.chartIndex === chartIndex &&
|
|
146
|
+
context.retained !== undefined &&
|
|
147
|
+
window.fromMs < context.firstRowTs);
|
|
148
|
+
}
|
|
149
|
+
/** The registry's prefix plan for a pan wave, undefined when the registry has none to give: a
|
|
150
|
+
* spec's partial mock of the registry leaves the export out (reading a missing export of a mocked
|
|
151
|
+
* module throws), and a planner that throws never stops the wave. */
|
|
152
|
+
function planWrunPrefixRequestSafely(chartIndex, indicatorId) {
|
|
153
|
+
try {
|
|
154
|
+
return planWrunOverlayPrefixRequest(chartIndex, indicatorId);
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/** Settle a plan the door queued no run for (its owner no longer pending), tolerating the same
|
|
161
|
+
* partial mocks. */
|
|
162
|
+
function dropWrunPrefixRequestSafely(chartIndex, indicatorId, prefix, why) {
|
|
163
|
+
try {
|
|
164
|
+
dropWrunOverlayPrefixRequest(chartIndex, indicatorId, prefix, why);
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// partial module mock (specs)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** The kScript guarded refresh's re-stamp: a held run keeps the overlay
|
|
171
|
+
* paused. A tripped one becomes paused through the store with the
|
|
172
|
+
* trigger's reason (its first pause: record, row and banner); an overlay
|
|
173
|
+
* already paused only keeps its flag and its lifecycle door closed, never a
|
|
174
|
+
* second row or banner (a pause is never rewritten by a later trigger). */
|
|
175
|
+
async function restampWrunOverlayPause(chartIndex, indicatorId, reason) {
|
|
176
|
+
try {
|
|
177
|
+
const [{ useChartStore }] = await loadWrunChartSide();
|
|
178
|
+
const chartStore = useChartStore();
|
|
179
|
+
if (!chartStore.isKScriptOverlayPaused(chartIndex, indicatorId)) {
|
|
180
|
+
chartStore.pauseOverlay(chartIndex, indicatorId, reason);
|
|
181
|
+
}
|
|
182
|
+
// Idempotent: a session the pause already ended is not ended again.
|
|
183
|
+
if (hasWrunOverlayLiveContext(indicatorId))
|
|
184
|
+
pauseWrunOverlay(chartIndex, indicatorId);
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
console.warn(`[wrun] pause re-stamp failed for '${indicatorId}':`, error);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The pan wave's window, as the kScript wave computes its engine refresh: the
|
|
192
|
+
* loaded range is the chart's main rows (real timestamps, some finite close),
|
|
193
|
+
* the range comes from the shared decider, and a range with no bars or with
|
|
194
|
+
* main rows not ready inside it skips. `partial` = narrower than the loaded
|
|
195
|
+
* range by more than a bar on either side (the wave's partial-replay rule).
|
|
196
|
+
*/
|
|
197
|
+
async function resolveWrunLazyRefreshWindow(chartIndex, demandSpan, intervalMs) {
|
|
198
|
+
const [, { getTC }] = await loadWrunChartSide();
|
|
199
|
+
const tc = getTC(chartIndex);
|
|
200
|
+
const rows = tc?.metadata?.[0]?.rawData;
|
|
201
|
+
if (!Array.isArray(rows) || rows.length === 0)
|
|
202
|
+
return null;
|
|
203
|
+
const startMs = Number(rows[0]?.[0]);
|
|
204
|
+
const endMs = Number(rows[rows.length - 1]?.[0]);
|
|
205
|
+
if (!isRealChartTimeRangeMs(startMs, endMs) || !ohlcvRowsHaveFiniteClose(rows, startMs, endMs))
|
|
206
|
+
return null;
|
|
207
|
+
const interval = finitePositive(intervalMs) ?? finitePositive(tc?.interval);
|
|
208
|
+
if (interval === null)
|
|
209
|
+
return null;
|
|
210
|
+
const range = resolveLocalTechnicalScriptLazyRefreshRange(demandSpan, { startMs, endMs }, interval);
|
|
211
|
+
if (range.replayBars <= 0)
|
|
212
|
+
return null;
|
|
213
|
+
if (!ohlcvRowsHaveFiniteClose(rows, range.fromMs, range.toMs))
|
|
214
|
+
return null;
|
|
215
|
+
const partial = range.fromMs > startMs + interval || range.toMs < endMs - interval;
|
|
216
|
+
return { fromMs: range.fromMs, toMs: range.toMs, partial };
|
|
217
|
+
}
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
// Pause, resume, wake, measure
|
|
220
|
+
// ---------------------------------------------------------------------------
|
|
221
|
+
/**
|
|
222
|
+
* The run head's check (unit R): 'paused' or 'tripped' when the run must not
|
|
223
|
+
* start, else null. A tripped overlay that is not paused yet is paused here,
|
|
224
|
+
* as the kScript wave does at its own hold. Null without a driver, without
|
|
225
|
+
* loading the store.
|
|
226
|
+
*/
|
|
227
|
+
export async function isWrunOverlayHeldForRun(chartIndex, indicatorId) {
|
|
228
|
+
if (!hasWrunOverlayDriver(indicatorId))
|
|
229
|
+
return null;
|
|
230
|
+
const [{ useChartStore }] = await loadWrunChartSide();
|
|
231
|
+
const chartStore = useChartStore();
|
|
232
|
+
if (chartStore.isKScriptOverlayPaused(chartIndex, indicatorId))
|
|
233
|
+
return 'paused';
|
|
234
|
+
if (!wrunChartHostEnv().chart.isOverlayTripped(overlayExecutionGuardKey(chartIndex, indicatorId)))
|
|
235
|
+
return null;
|
|
236
|
+
chartStore.pauseOverlay(chartIndex, indicatorId, WRUN_RUN_HOLD_PAUSE_REASON);
|
|
237
|
+
return 'tripped';
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Pause the browser-run side of an overlay (the store's `pauseOverlay` calls
|
|
241
|
+
* this for a driver id after its own flag, record, row and banner): the live
|
|
242
|
+
* session is suspended (nothing queues or computes while paused) and the
|
|
243
|
+
* HUD's latest values go. The picture stays (pause = frozen computation and
|
|
244
|
+
* frozen content): the children the run mounted for this parent keep their
|
|
245
|
+
* rows and the heatmaps among them dim (wrun-pause-dim.util, the store dims
|
|
246
|
+
* what is mounted now), and a child mount the run started before the pause
|
|
247
|
+
* landed dims once it settles (and takes a paint-cost pause's suspension).
|
|
248
|
+
* Resume undims, reruns and remounts. True when a driver exists.
|
|
249
|
+
*/
|
|
250
|
+
export function pauseWrunOverlay(chartIndex, indicatorId) {
|
|
251
|
+
if (!hasWrunOverlayDriver(indicatorId))
|
|
252
|
+
return false;
|
|
253
|
+
suspendWrunOverlayLiveSession(indicatorId);
|
|
254
|
+
wrunChartHostEnv().chart.clearLatestValues(chartIndex, indicatorId);
|
|
255
|
+
ring('wrun-overlay-paused', { chartIndex, indicatorId });
|
|
256
|
+
// The mount's host ports load beside it (chart.loadPanelMountPorts): a mount it awaits reads them.
|
|
257
|
+
void Promise.all([
|
|
258
|
+
loadWrunChartSide(),
|
|
259
|
+
import('./wrun-panel-mount.util.js'),
|
|
260
|
+
wrunChartHostEnv().chart.loadPanelMountPorts(),
|
|
261
|
+
])
|
|
262
|
+
.then(async ([[{ useChartStore }, { getTC }], { awaitWrunChildOverlays }]) => {
|
|
263
|
+
const tc = getTC(chartIndex);
|
|
264
|
+
if (!tc)
|
|
265
|
+
return;
|
|
266
|
+
await awaitWrunChildOverlays(tc, indicatorId).catch(() => false);
|
|
267
|
+
// A Resume that landed meanwhile owns the children again; a chart
|
|
268
|
+
// rebuilt at the index is not the one this pause dimmed.
|
|
269
|
+
if (!useChartStore().isKScriptOverlayPaused(chartIndex, indicatorId) || getTC(chartIndex) !== tc)
|
|
270
|
+
return;
|
|
271
|
+
dimWrunOverlayForPause(tc, indicatorId);
|
|
272
|
+
// A paint-cost pause's suspension reaches the children that mount settled too.
|
|
273
|
+
wrunChartHostEnv().chart.reapplyPausedOverlayPaint(tc, indicatorId);
|
|
274
|
+
})
|
|
275
|
+
.catch((error) => {
|
|
276
|
+
console.warn(`[wrun] pause could not dim the children of '${indicatorId}':`, error);
|
|
277
|
+
});
|
|
278
|
+
return true;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Resume a paused overlay (the store's one recovery path, after it reset the
|
|
282
|
+
* guard and cleared the flag): the heal ladder and the source rung start
|
|
283
|
+
* over, and the door reruns it with 'resume' (the run reinstalls the live
|
|
284
|
+
* session and remounts the children); while the chart replays, its replay
|
|
285
|
+
* lane reopens instead. Undefined without a driver.
|
|
286
|
+
*/
|
|
287
|
+
export function resumeWrunOverlay(chartIndex, indicatorId) {
|
|
288
|
+
if (!hasWrunOverlayDriver(indicatorId))
|
|
289
|
+
return undefined;
|
|
290
|
+
resetWrunOverlayHealLadder(indicatorId);
|
|
291
|
+
retireWrunSourceRecovery(indicatorId, 'rebuild');
|
|
292
|
+
// While the chart replays, the replay lane the Pause left blank reopens.
|
|
293
|
+
const replayReopen = resumeWrunOverlayReplayLane(chartIndex, indicatorId);
|
|
294
|
+
if (replayReopen)
|
|
295
|
+
return replayReopen.then(() => undefined);
|
|
296
|
+
return requestWrunOverlayRerun(chartIndex, indicatorId, 'resume') || undefined;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The wake half of the recovery: a live session gets a 'wake' gap mark (its
|
|
300
|
+
* tick reconciles or rebuilds); a driver without one (a first run that failed
|
|
301
|
+
* or never finished) goes to the heal ladder; anything else is not wrun and
|
|
302
|
+
* the caller's kScript line runs.
|
|
303
|
+
*/
|
|
304
|
+
export function resyncWrunOverlayAfterWake(chartIndex, indicatorId) {
|
|
305
|
+
if (hasWrunOverlayLiveContext(indicatorId)) {
|
|
306
|
+
markWrunLiveGap(indicatorId, 'wake');
|
|
307
|
+
return 'gap-marked';
|
|
308
|
+
}
|
|
309
|
+
if (hasWrunOverlayDriver(indicatorId)) {
|
|
310
|
+
healWrunOverlayIfIdle(chartIndex, indicatorId, 'wake');
|
|
311
|
+
return 'healing';
|
|
312
|
+
}
|
|
313
|
+
return 'not-wrun';
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* The kScript guarded-call shape for a wrun main-thread apply (the full run's
|
|
317
|
+
* integrate, the tick's apply): the execution guard measures the synchronous
|
|
318
|
+
* slice for its breaker, and a tripped measurement pauses the overlay through
|
|
319
|
+
* the store (which suspends the wrun side itself). The measure records no perf
|
|
320
|
+
* tracker sample (`sample: false`): the host build that wraps this apply
|
|
321
|
+
* records the one sample per update (recordWrunHostBuildMs). A plain call
|
|
322
|
+
* without a driver.
|
|
323
|
+
*/
|
|
324
|
+
export function withWrunOverlayExecutionMeasure(chartIndex, indicatorId, reason, run) {
|
|
325
|
+
if (!hasWrunOverlayDriver(indicatorId))
|
|
326
|
+
return run();
|
|
327
|
+
const guardKey = overlayExecutionGuardKey(chartIndex, indicatorId);
|
|
328
|
+
const startedAt = wrunChartHostEnv().chart.startOverlayMeasure();
|
|
329
|
+
try {
|
|
330
|
+
return run();
|
|
331
|
+
}
|
|
332
|
+
finally {
|
|
333
|
+
// The live tick's apply is a live apply (the breaker's 60 s window counts it); a full run's integrate is not.
|
|
334
|
+
if (wrunChartHostEnv().chart.endOverlayMeasure(guardKey, startedAt, {
|
|
335
|
+
sample: false,
|
|
336
|
+
live: reason === 'wrun-live-tick',
|
|
337
|
+
}).tripped) {
|
|
338
|
+
void restampWrunOverlayPause(chartIndex, indicatorId, reason);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// ---------------------------------------------------------------------------
|
|
343
|
+
// SWR revalidation of cache-served lanes
|
|
344
|
+
// ---------------------------------------------------------------------------
|
|
345
|
+
// Per overlay: the armed one-shot (with the chart and data generation it was
|
|
346
|
+
// armed under) and the chart its marks live under, for the teardown clear.
|
|
347
|
+
const revalidationTimers = new Map();
|
|
348
|
+
const revalidationCharts = new Map();
|
|
349
|
+
/**
|
|
350
|
+
* After an integrated wrun run: when any of its lanes was served from the
|
|
351
|
+
* replay cache (the shared acquisition marked the overlay), arm the one-shot
|
|
352
|
+
* revalidation the SWR contract owes, once per mark. Replay drops the mark
|
|
353
|
+
* (replay owns its own data plane). The kScript scheduler's rules verbatim
|
|
354
|
+
* (data-fetching.util maybeScheduleLocalKScriptSourceRevalidation).
|
|
355
|
+
*/
|
|
356
|
+
function maybeScheduleWrunSourceRevalidation(indicatorId, chartIndex) {
|
|
357
|
+
if (!hasWrunOverlayDriver(indicatorId))
|
|
358
|
+
return;
|
|
359
|
+
revalidationCharts.set(indicatorId, chartIndex);
|
|
360
|
+
if (!hasPendingLocalKScriptSourceRevalidation(chartIndex, indicatorId))
|
|
361
|
+
return;
|
|
362
|
+
if (wrunChartHostEnv().chart.isReplaying(chartIndex)) {
|
|
363
|
+
clearLocalKScriptSourceRevalidation(chartIndex, indicatorId);
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (!armLocalKScriptSourceRevalidation(chartIndex, indicatorId))
|
|
367
|
+
return;
|
|
368
|
+
const armedGeneration = getChartDataFetchGeneration(chartIndex);
|
|
369
|
+
const previous = revalidationTimers.get(indicatorId);
|
|
370
|
+
if (previous !== undefined)
|
|
371
|
+
clearTimeout(previous);
|
|
372
|
+
revalidationTimers.set(indicatorId, setTimeout(() => {
|
|
373
|
+
revalidationTimers.delete(indicatorId);
|
|
374
|
+
void runWrunSourceRevalidation(chartIndex, indicatorId, armedGeneration).catch((error) => {
|
|
375
|
+
disarmLocalKScriptSourceRevalidation(chartIndex, indicatorId);
|
|
376
|
+
console.error('Error revalidating wrun source cache:', indicatorId, error);
|
|
377
|
+
});
|
|
378
|
+
}, WRUN_SOURCE_REVALIDATION_DELAY_MS));
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* The owed revalidation: guards run before the mark is taken (an
|
|
382
|
+
* undispatchable moment disarms so the next integrated run re-arms); the
|
|
383
|
+
* mark is taken, the per-overlay bypass token installed so every lane of the
|
|
384
|
+
* run reaches the wire, the run goes through the door ('loaded-range-refresh'),
|
|
385
|
+
* the token is released in finally, and the mark is restored when the door
|
|
386
|
+
* held or skipped the run.
|
|
387
|
+
*/
|
|
388
|
+
async function runWrunSourceRevalidation(chartIndex, indicatorId, armedGeneration) {
|
|
389
|
+
const bail = () => disarmLocalKScriptSourceRevalidation(chartIndex, indicatorId);
|
|
390
|
+
// A switch or teardown since arming replaced the dataset the mark belongs to.
|
|
391
|
+
if (getChartDataFetchGeneration(chartIndex) !== armedGeneration)
|
|
392
|
+
return bail();
|
|
393
|
+
if (!hasWrunOverlayDriver(indicatorId) || wrunChartHostEnv().chart.isReplaying(chartIndex))
|
|
394
|
+
return bail();
|
|
395
|
+
// A run in flight started without the token: its success re-arms.
|
|
396
|
+
if (isWrunOverlayRerunInFlight(indicatorId))
|
|
397
|
+
return bail();
|
|
398
|
+
const pending = takePendingLocalKScriptSourceRevalidation(chartIndex, indicatorId);
|
|
399
|
+
if (!pending)
|
|
400
|
+
return;
|
|
401
|
+
const restoreMark = () => {
|
|
402
|
+
markLocalKScriptSourceCacheHit(chartIndex, indicatorId, pending.fromMs, pending.toMs);
|
|
403
|
+
disarmLocalKScriptSourceRevalidation(chartIndex, indicatorId);
|
|
404
|
+
};
|
|
405
|
+
const token = installLocalKScriptSourceCacheBypass(chartIndex, indicatorId);
|
|
406
|
+
ring('wrun-source-revalidation-start', {
|
|
407
|
+
chartIndex,
|
|
408
|
+
indicatorId,
|
|
409
|
+
fromMs: pending.fromMs,
|
|
410
|
+
toMs: pending.toMs,
|
|
411
|
+
markedAt: pending.markedAt,
|
|
412
|
+
});
|
|
413
|
+
try {
|
|
414
|
+
const outcome = await dispatchWrunOverlayRerun(chartIndex, indicatorId, 'loaded-range-refresh');
|
|
415
|
+
if (outcome !== 'ran') {
|
|
416
|
+
restoreMark();
|
|
417
|
+
ring('wrun-source-revalidation-restored', { chartIndex, indicatorId, outcome });
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
catch (error) {
|
|
421
|
+
restoreMark();
|
|
422
|
+
throw error;
|
|
423
|
+
}
|
|
424
|
+
finally {
|
|
425
|
+
releaseLocalKScriptSourceCacheBypass(chartIndex, indicatorId, token);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// ---------------------------------------------------------------------------
|
|
429
|
+
// Teardown, registrations, test seam
|
|
430
|
+
// ---------------------------------------------------------------------------
|
|
431
|
+
/** Everything the door holds for one overlay goes with it, the SWR marks and
|
|
432
|
+
* token under its id included (data-loading rule 3). A live-session suspend
|
|
433
|
+
* runs the same hooks; the next integrated run marks and arms again. */
|
|
434
|
+
function dropWrunLifecycleState(indicatorId) {
|
|
435
|
+
const timer = revalidationTimers.get(indicatorId);
|
|
436
|
+
if (timer !== undefined)
|
|
437
|
+
clearTimeout(timer);
|
|
438
|
+
revalidationTimers.delete(indicatorId);
|
|
439
|
+
const chartIndex = revalidationCharts.get(indicatorId) ?? getWrunOverlayLiveContext(indicatorId)?.chartIndex;
|
|
440
|
+
revalidationCharts.delete(indicatorId);
|
|
441
|
+
if (chartIndex !== undefined)
|
|
442
|
+
clearLocalKScriptSourceRevalidation(chartIndex, indicatorId);
|
|
443
|
+
}
|
|
444
|
+
// Registered at import like the live intake and the tick lane. Specs that mock
|
|
445
|
+
// the drivers util partially have no hook registry (reading a missing export of
|
|
446
|
+
// a mocked module throws), so the registration is skipped there.
|
|
447
|
+
try {
|
|
448
|
+
onWrunOverlayComputeSucceeded(maybeScheduleWrunSourceRevalidation);
|
|
449
|
+
}
|
|
450
|
+
catch {
|
|
451
|
+
// partial module mock (specs)
|
|
452
|
+
}
|
|
453
|
+
try {
|
|
454
|
+
onWrunOverlayLiveTeardown(dropWrunLifecycleState);
|
|
455
|
+
}
|
|
456
|
+
catch {
|
|
457
|
+
// partial module mock (specs)
|
|
458
|
+
}
|
|
459
|
+
/** Clears the door's state and the recovery ladders' state. */
|
|
460
|
+
export function __resetWrunOverlayLifecycleForTests() {
|
|
461
|
+
for (const timer of revalidationTimers.values())
|
|
462
|
+
clearTimeout(timer);
|
|
463
|
+
revalidationTimers.clear();
|
|
464
|
+
revalidationCharts.clear();
|
|
465
|
+
__resetWrunOverlayRecoveryForTests();
|
|
466
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metadata sheet of each mounted Indicator overlay, by overlay id: the
|
|
3
|
+
* ONE place the settings dialog (the layout, presets, outputs for the Style
|
|
4
|
+
* page), the legend and the HUD read a mounted overlay's sheet from, on
|
|
5
|
+
* every lane (a browser-run registry package, an editor draft, a dev
|
|
6
|
+
* fixture, a hosted Cloud run).
|
|
7
|
+
*
|
|
8
|
+
* The loaders remember the sheet at their mount site (the registry loader
|
|
9
|
+
* where it registers the chart-lifecycle driver, which the add, draft and
|
|
10
|
+
* rehydrate paths all pass; the dev loader at its mount; the catalog's
|
|
11
|
+
* hosted mount). A read falls back to the live run context's sheet
|
|
12
|
+
* (getWrunOverlayLiveContext), which the run pass installs after every
|
|
13
|
+
* successful live run, so an overlay restored by the workspace before any
|
|
14
|
+
* loader bound it still answers once it has computed.
|
|
15
|
+
*
|
|
16
|
+
* Remembering a sheet also records the overlay's paint flags
|
|
17
|
+
* (overlay-paint-flags.util; WRUN-STYLE DW21, DW35, TH-theme-tokens): the
|
|
18
|
+
* contrast-guard opt-out, the handle stacking word and whether the sheet can
|
|
19
|
+
* carry theme colour tokens, which the paint doors read by overlay id on
|
|
20
|
+
* every lane (the flags ride the remembered sheet, so hosted runs are
|
|
21
|
+
* covered too).
|
|
22
|
+
*
|
|
23
|
+
* The memory clears with the overlay: the chart store's remove path tears
|
|
24
|
+
* every overlay down through teardownWrunOverlay (a no-op for non-wrun
|
|
25
|
+
* overlays), whose synchronous teardown hooks run this module's forget. A
|
|
26
|
+
* Pause ends only the live session (suspendWrunOverlayLiveSession runs the
|
|
27
|
+
* same hooks with cause 'suspend'): the overlay stays on the chart, so its
|
|
28
|
+
* sheet stays for the dialog, the legend and the HUD.
|
|
29
|
+
*/
|
|
30
|
+
import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
|
|
31
|
+
/**
|
|
32
|
+
* True when the sheet can carry a theme colour token (TH-theme-tokens): a
|
|
33
|
+
* `theme.` word anywhere in its JSON, or a surface whose colours only arrive
|
|
34
|
+
* at run time and may spell one then: runtime handles (the ledger's wire
|
|
35
|
+
* emits `theme.<t>`), frames (ladder, feed and card frame colour strings) or
|
|
36
|
+
* a `*_packed_by` key (a packed output may hold the token sentinel). A sheet
|
|
37
|
+
* without any of them never needs the token walk, so its paint pass stays
|
|
38
|
+
* byte-identical to today's.
|
|
39
|
+
*/
|
|
40
|
+
export declare function wrunSheetUsesThemeTokens(metadata: WrunIndicatorMetadata | null | undefined): boolean;
|
|
41
|
+
export declare function rememberWrunOverlayMetadata(indicatorId: string, metadata: WrunIndicatorMetadata): void;
|
|
42
|
+
export declare function forgetWrunOverlayMetadata(indicatorId: string): void;
|
|
43
|
+
/** The remembered sheet, else the live context's (undefined before either). */
|
|
44
|
+
export declare function getWrunOverlayMetadata(indicatorId: string): WrunIndicatorMetadata | undefined;
|
|
45
|
+
export declare function __resetWrunOverlayMetadataForTests(): void;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The metadata sheet of each mounted Indicator overlay, by overlay id: the
|
|
3
|
+
* ONE place the settings dialog (the layout, presets, outputs for the Style
|
|
4
|
+
* page), the legend and the HUD read a mounted overlay's sheet from, on
|
|
5
|
+
* every lane (a browser-run registry package, an editor draft, a dev
|
|
6
|
+
* fixture, a hosted Cloud run).
|
|
7
|
+
*
|
|
8
|
+
* The loaders remember the sheet at their mount site (the registry loader
|
|
9
|
+
* where it registers the chart-lifecycle driver, which the add, draft and
|
|
10
|
+
* rehydrate paths all pass; the dev loader at its mount; the catalog's
|
|
11
|
+
* hosted mount). A read falls back to the live run context's sheet
|
|
12
|
+
* (getWrunOverlayLiveContext), which the run pass installs after every
|
|
13
|
+
* successful live run, so an overlay restored by the workspace before any
|
|
14
|
+
* loader bound it still answers once it has computed.
|
|
15
|
+
*
|
|
16
|
+
* Remembering a sheet also records the overlay's paint flags
|
|
17
|
+
* (overlay-paint-flags.util; WRUN-STYLE DW21, DW35, TH-theme-tokens): the
|
|
18
|
+
* contrast-guard opt-out, the handle stacking word and whether the sheet can
|
|
19
|
+
* carry theme colour tokens, which the paint doors read by overlay id on
|
|
20
|
+
* every lane (the flags ride the remembered sheet, so hosted runs are
|
|
21
|
+
* covered too).
|
|
22
|
+
*
|
|
23
|
+
* The memory clears with the overlay: the chart store's remove path tears
|
|
24
|
+
* every overlay down through teardownWrunOverlay (a no-op for non-wrun
|
|
25
|
+
* overlays), whose synchronous teardown hooks run this module's forget. A
|
|
26
|
+
* Pause ends only the live session (suspendWrunOverlayLiveSession runs the
|
|
27
|
+
* same hooks with cause 'suspend'): the overlay stays on the chart, so its
|
|
28
|
+
* sheet stays for the dialog, the legend and the HUD.
|
|
29
|
+
*/
|
|
30
|
+
import { __resetOverlayPaintFlagsForTests, clearOverlayPaintFlags, setOverlayPaintFlags, } from '../chart/overlay-paint-flags.util.js';
|
|
31
|
+
import { getWrunOverlayLiveContext, onWrunOverlayLiveTeardown } from './wrun-overlay-drivers.util.js';
|
|
32
|
+
import { primeWrunLegendHover } from './wrun-legend-hover.lazy.js';
|
|
33
|
+
import { notifyWrunSheetRemembered } from './wrun-sheet-remembered.util.js';
|
|
34
|
+
const remembered = new Map();
|
|
35
|
+
function isNonEmptyRecord(value) {
|
|
36
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* True when the sheet can carry a theme colour token (TH-theme-tokens): a
|
|
40
|
+
* `theme.` word anywhere in its JSON, or a surface whose colours only arrive
|
|
41
|
+
* at run time and may spell one then: runtime handles (the ledger's wire
|
|
42
|
+
* emits `theme.<t>`), frames (ladder, feed and card frame colour strings) or
|
|
43
|
+
* a `*_packed_by` key (a packed output may hold the token sentinel). A sheet
|
|
44
|
+
* without any of them never needs the token walk, so its paint pass stays
|
|
45
|
+
* byte-identical to today's.
|
|
46
|
+
*/
|
|
47
|
+
export function wrunSheetUsesThemeTokens(metadata) {
|
|
48
|
+
if (metadata === null || typeof metadata !== 'object')
|
|
49
|
+
return false;
|
|
50
|
+
if (isNonEmptyRecord(metadata.handles))
|
|
51
|
+
return true;
|
|
52
|
+
if (Array.isArray(metadata.frames) && metadata.frames.length > 0)
|
|
53
|
+
return true;
|
|
54
|
+
let json;
|
|
55
|
+
try {
|
|
56
|
+
json = JSON.stringify(metadata) ?? '';
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
// a sheet that does not serialise (a cycle in a test double) is read as token-free
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
return json.includes('"theme.') || json.includes('_packed_by"');
|
|
63
|
+
}
|
|
64
|
+
export function rememberWrunOverlayMetadata(indicatorId, metadata) {
|
|
65
|
+
remembered.set(indicatorId, metadata);
|
|
66
|
+
setOverlayPaintFlags(indicatorId, {
|
|
67
|
+
themeTokens: wrunSheetUsesThemeTokens(metadata),
|
|
68
|
+
contrastGuard: metadata?.contrast_guard !== false,
|
|
69
|
+
stackHandles: metadata?.stack_handles === true,
|
|
70
|
+
});
|
|
71
|
+
// The hover surfaces answer for remembered sheets only: the first one loads them for the panes
|
|
72
|
+
// waiting at their door (wrun-legend-hover.lazy.ts; a no-op once a loader bound them).
|
|
73
|
+
primeWrunLegendHover();
|
|
74
|
+
// Its `time` params are readable from here on: the anchor history demand re-reads (wrun-sheet-remembered.util).
|
|
75
|
+
notifyWrunSheetRemembered(indicatorId);
|
|
76
|
+
}
|
|
77
|
+
export function forgetWrunOverlayMetadata(indicatorId) {
|
|
78
|
+
remembered.delete(indicatorId);
|
|
79
|
+
clearOverlayPaintFlags(indicatorId);
|
|
80
|
+
}
|
|
81
|
+
/** The remembered sheet, else the live context's (undefined before either). */
|
|
82
|
+
export function getWrunOverlayMetadata(indicatorId) {
|
|
83
|
+
const sheet = remembered.get(indicatorId);
|
|
84
|
+
if (sheet !== undefined)
|
|
85
|
+
return sheet;
|
|
86
|
+
try {
|
|
87
|
+
return getWrunOverlayLiveContext(indicatorId)?.metadata;
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// partial module mock (specs): no live-context registry to fall back to
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export function __resetWrunOverlayMetadataForTests() {
|
|
95
|
+
remembered.clear();
|
|
96
|
+
__resetOverlayPaintFlagsForTests();
|
|
97
|
+
}
|
|
98
|
+
// Registered at import like the live intake and the tick lane (the drivers
|
|
99
|
+
// module keeps hooks across its test reset). Specs that mock the drivers
|
|
100
|
+
// util partially have no hook registry (under vitest, reading a missing
|
|
101
|
+
// export of a mocked module throws at access time, and this module loads on
|
|
102
|
+
// every loader's graph), so the registration is skipped there rather than
|
|
103
|
+
// failing the import. Production always has the export.
|
|
104
|
+
try {
|
|
105
|
+
onWrunOverlayLiveTeardown((indicatorId, cause) => {
|
|
106
|
+
if (cause !== 'suspend')
|
|
107
|
+
forgetWrunOverlayMetadata(indicatorId);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// partial module mock (specs); nothing to forget there
|
|
112
|
+
}
|