@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,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backoff for the missing-engine self-heal of a mounted browser-run script
|
|
3
|
+
* (`maybeSelfHealMissingLocalEngine`, live-feed.service).
|
|
4
|
+
*
|
|
5
|
+
* The heal re-runs the restore-mode addIndicator, which re-fetches every
|
|
6
|
+
* declared source and rebuilds the engine. When the engine keeps dying the
|
|
7
|
+
* heal fires again as soon as its hold elapses, so a broken script re-mounts
|
|
8
|
+
* at the flat hold forever. The ladder escalates consecutive HEAL ATTEMPTS
|
|
9
|
+
* geometrically (30s, 60s, 120s, 240s, capped at 5 minutes) and resets once
|
|
10
|
+
* the engine has demonstrably stayed alive: the missing-engine signal arrives
|
|
11
|
+
* from every live message and every poll tick while the engine is absent, so
|
|
12
|
+
* a gate that stays open for a grace period without being re-entered means
|
|
13
|
+
* the engine was present.
|
|
14
|
+
*
|
|
15
|
+
* Signals that open the gate but decline without an attempt (paused overlay,
|
|
16
|
+
* venue-door blocked script) re-arm at the BASE hold only: they never
|
|
17
|
+
* escalate, and their cheap checks keep running at the same cadence as a
|
|
18
|
+
* first attempt, so leaving the governed venue heals within one base hold.
|
|
19
|
+
*/
|
|
20
|
+
export declare const LOCAL_ENGINE_SELF_HEAL_BASE_DELAY_MS = 30000;
|
|
21
|
+
export declare const LOCAL_ENGINE_SELF_HEAL_MAX_DELAY_MS: number;
|
|
22
|
+
/** Gate left open this long past its eligibility with no signal = the engine stayed alive; the ladder resets. */
|
|
23
|
+
export declare const LOCAL_ENGINE_SELF_HEAL_RESET_GRACE_MS = 90000;
|
|
24
|
+
export interface LocalEngineSelfHealState {
|
|
25
|
+
/** Consecutive heal attempts on the current ladder. */
|
|
26
|
+
attempts: number;
|
|
27
|
+
nextEligibleAtMs: number;
|
|
28
|
+
}
|
|
29
|
+
export interface LocalEngineSelfHealAttempt {
|
|
30
|
+
state: LocalEngineSelfHealState;
|
|
31
|
+
/** 1-based ordinal of this attempt on the ladder. */
|
|
32
|
+
attempt: number;
|
|
33
|
+
/** Hold applied after this attempt. */
|
|
34
|
+
delayMs: number;
|
|
35
|
+
}
|
|
36
|
+
/** Hold after the given 1-based attempt: base doubling per attempt, capped. */
|
|
37
|
+
export declare function localEngineSelfHealDelayMs(attempt: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* Admit one missing-engine signal. Null while the current hold runs.
|
|
40
|
+
* Otherwise the state to store for this EVALUATION: re-armed at the base hold
|
|
41
|
+
* (the checks that follow may decline without an attempt), with the ladder
|
|
42
|
+
* reset when the gate sat open past the grace.
|
|
43
|
+
*/
|
|
44
|
+
export declare function openLocalEngineSelfHealGate(state: LocalEngineSelfHealState | undefined, nowMs: number): LocalEngineSelfHealState | null;
|
|
45
|
+
/** A restore-mode addIndicator actually fired: escalate the hold. */
|
|
46
|
+
export declare function recordLocalEngineSelfHealAttempt(state: LocalEngineSelfHealState, nowMs: number): LocalEngineSelfHealAttempt;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backoff for the missing-engine self-heal of a mounted browser-run script
|
|
3
|
+
* (`maybeSelfHealMissingLocalEngine`, live-feed.service).
|
|
4
|
+
*
|
|
5
|
+
* The heal re-runs the restore-mode addIndicator, which re-fetches every
|
|
6
|
+
* declared source and rebuilds the engine. When the engine keeps dying the
|
|
7
|
+
* heal fires again as soon as its hold elapses, so a broken script re-mounts
|
|
8
|
+
* at the flat hold forever. The ladder escalates consecutive HEAL ATTEMPTS
|
|
9
|
+
* geometrically (30s, 60s, 120s, 240s, capped at 5 minutes) and resets once
|
|
10
|
+
* the engine has demonstrably stayed alive: the missing-engine signal arrives
|
|
11
|
+
* from every live message and every poll tick while the engine is absent, so
|
|
12
|
+
* a gate that stays open for a grace period without being re-entered means
|
|
13
|
+
* the engine was present.
|
|
14
|
+
*
|
|
15
|
+
* Signals that open the gate but decline without an attempt (paused overlay,
|
|
16
|
+
* venue-door blocked script) re-arm at the BASE hold only: they never
|
|
17
|
+
* escalate, and their cheap checks keep running at the same cadence as a
|
|
18
|
+
* first attempt, so leaving the governed venue heals within one base hold.
|
|
19
|
+
*/
|
|
20
|
+
export const LOCAL_ENGINE_SELF_HEAL_BASE_DELAY_MS = 30_000;
|
|
21
|
+
export const LOCAL_ENGINE_SELF_HEAL_MAX_DELAY_MS = 5 * 60_000;
|
|
22
|
+
/** Gate left open this long past its eligibility with no signal = the engine stayed alive; the ladder resets. */
|
|
23
|
+
export const LOCAL_ENGINE_SELF_HEAL_RESET_GRACE_MS = 90_000;
|
|
24
|
+
/** Hold after the given 1-based attempt: base doubling per attempt, capped. */
|
|
25
|
+
export function localEngineSelfHealDelayMs(attempt) {
|
|
26
|
+
const exponent = Math.max(0, attempt - 1);
|
|
27
|
+
return Math.min(LOCAL_ENGINE_SELF_HEAL_BASE_DELAY_MS * 2 ** exponent, LOCAL_ENGINE_SELF_HEAL_MAX_DELAY_MS);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Admit one missing-engine signal. Null while the current hold runs.
|
|
31
|
+
* Otherwise the state to store for this EVALUATION: re-armed at the base hold
|
|
32
|
+
* (the checks that follow may decline without an attempt), with the ladder
|
|
33
|
+
* reset when the gate sat open past the grace.
|
|
34
|
+
*/
|
|
35
|
+
export function openLocalEngineSelfHealGate(state, nowMs) {
|
|
36
|
+
if (state && nowMs < state.nextEligibleAtMs)
|
|
37
|
+
return null;
|
|
38
|
+
const attempts = !state || nowMs - state.nextEligibleAtMs >= LOCAL_ENGINE_SELF_HEAL_RESET_GRACE_MS ? 0 : state.attempts;
|
|
39
|
+
return { attempts, nextEligibleAtMs: nowMs + LOCAL_ENGINE_SELF_HEAL_BASE_DELAY_MS };
|
|
40
|
+
}
|
|
41
|
+
/** A restore-mode addIndicator actually fired: escalate the hold. */
|
|
42
|
+
export function recordLocalEngineSelfHealAttempt(state, nowMs) {
|
|
43
|
+
const attempt = state.attempts + 1;
|
|
44
|
+
const delayMs = localEngineSelfHealDelayMs(attempt);
|
|
45
|
+
return { state: { attempts: attempt, nextEligibleAtMs: nowMs + delayMs }, attempt, delayMs };
|
|
46
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The uninitialized-engine episode (local-engine-uninit-self-heal.util): the dwell an idle engine waits out before a
|
|
3
|
+
* heal runs it, the gap that starts a new episode, and the fold of one idle signal into an episode. A pure leaf (no
|
|
4
|
+
* imports, no module state: the fold returns a new episode and its callers keep their own maps), so the wrun heal
|
|
5
|
+
* ladder (wrun-overlay-recovery.util) reads it without the kScript heal's chart store and chart instances. The old
|
|
6
|
+
* file re-exports every name.
|
|
7
|
+
*/
|
|
8
|
+
/** An engine must stay idle and uninitialized this long before the heal runs it. */
|
|
9
|
+
export declare const LOCAL_ENGINE_UNINIT_HEAL_DWELL_MS = 15000;
|
|
10
|
+
/**
|
|
11
|
+
* Signals further apart than this start a new episode: the engine ran in
|
|
12
|
+
* between. Longer than the steady poll cadence (25-35s), which is the only
|
|
13
|
+
* signal a quiet market sends.
|
|
14
|
+
*/
|
|
15
|
+
export declare const LOCAL_ENGINE_UNINIT_EPISODE_GAP_MS = 60000;
|
|
16
|
+
export interface UninitializedLocalEngineEpisode {
|
|
17
|
+
firstSeenAtMs: number;
|
|
18
|
+
lastSeenAtMs: number;
|
|
19
|
+
}
|
|
20
|
+
/** Fold one idle-uninitialized signal into the engine's episode. */
|
|
21
|
+
export declare function noteIdleUninitializedSignal(episode: UninitializedLocalEngineEpisode | undefined, nowMs: number): UninitializedLocalEngineEpisode;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The uninitialized-engine episode (local-engine-uninit-self-heal.util): the dwell an idle engine waits out before a
|
|
3
|
+
* heal runs it, the gap that starts a new episode, and the fold of one idle signal into an episode. A pure leaf (no
|
|
4
|
+
* imports, no module state: the fold returns a new episode and its callers keep their own maps), so the wrun heal
|
|
5
|
+
* ladder (wrun-overlay-recovery.util) reads it without the kScript heal's chart store and chart instances. The old
|
|
6
|
+
* file re-exports every name.
|
|
7
|
+
*/
|
|
8
|
+
/** An engine must stay idle and uninitialized this long before the heal runs it. */
|
|
9
|
+
export const LOCAL_ENGINE_UNINIT_HEAL_DWELL_MS = 15_000;
|
|
10
|
+
/**
|
|
11
|
+
* Signals further apart than this start a new episode: the engine ran in
|
|
12
|
+
* between. Longer than the steady poll cadence (25-35s), which is the only
|
|
13
|
+
* signal a quiet market sends.
|
|
14
|
+
*/
|
|
15
|
+
export const LOCAL_ENGINE_UNINIT_EPISODE_GAP_MS = 60_000;
|
|
16
|
+
/** Fold one idle-uninitialized signal into the engine's episode. */
|
|
17
|
+
export function noteIdleUninitializedSignal(episode, nowMs) {
|
|
18
|
+
if (!episode || nowMs - episode.lastSeenAtMs > LOCAL_ENGINE_UNINIT_EPISODE_GAP_MS) {
|
|
19
|
+
return { firstSeenAtMs: nowMs, lastSeenAtMs: nowMs };
|
|
20
|
+
}
|
|
21
|
+
return { firstSeenAtMs: episode.firstSeenAtMs, lastSeenAtMs: nowMs };
|
|
22
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR revalidation state for local kScript SOURCE replay-cache hits.
|
|
3
|
+
*
|
|
4
|
+
* A non-polling source acquisition served from the replay cache paints
|
|
5
|
+
* stale-but-fast; the caching contract (perf/caching.md: stale paints, fresh
|
|
6
|
+
* replaces) then owes one live re-fetch. The boot second pass cannot be that
|
|
7
|
+
* re-fetch: on a warm boot it is skipped entirely, and on any pass the cache
|
|
8
|
+
* would simply hit again. So: the acquisition MARKS the overlay pending here;
|
|
9
|
+
* after that generation's first run integrates (the overlay actually painted),
|
|
10
|
+
* the owner (data-fetching.util) runs a one-shot per-(chart, overlay) refresh
|
|
11
|
+
* over the recorded range with a generation-owned BYPASS TOKEN installed.
|
|
12
|
+
* Every source acquisition belonging to that refresh observes the token (and
|
|
13
|
+
* never consumes it); the owner clears it in `finally` only if it still owns
|
|
14
|
+
* it. Teardown clears both maps.
|
|
15
|
+
*
|
|
16
|
+
* This module is pure state so titan-charts (acquisition side) and
|
|
17
|
+
* data-fetching.util (refresh side) can share it without an import cycle.
|
|
18
|
+
*/
|
|
19
|
+
export interface PendingKScriptSourceRevalidation {
|
|
20
|
+
fromMs: number;
|
|
21
|
+
toMs: number;
|
|
22
|
+
markedAt: number;
|
|
23
|
+
/**
|
|
24
|
+
* A one-shot runner has been armed for this mark. Cleared when the runner
|
|
25
|
+
* consumes the mark OR bails on a guard without dispatching, so a later
|
|
26
|
+
* integrated run can re-arm (e.g. the overlay was pane-collapsed when the
|
|
27
|
+
* first runner fired).
|
|
28
|
+
*/
|
|
29
|
+
scheduled: boolean;
|
|
30
|
+
}
|
|
31
|
+
/** Called by the acquisition path on a non-polling replay-cache hit. */
|
|
32
|
+
export declare function markLocalKScriptSourceCacheHit(chartIndex: number, overlayId: string, fromMs: number, toMs: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Arm a one-shot runner for the mark. Returns false when there is nothing to
|
|
35
|
+
* arm or a runner is already armed (idempotent under per-run scheduling).
|
|
36
|
+
*/
|
|
37
|
+
export declare function armLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): boolean;
|
|
38
|
+
/** Runner bailed on a guard without dispatching: allow a later run to re-arm. */
|
|
39
|
+
export declare function disarmLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): void;
|
|
40
|
+
/** Consumes and returns the pending mark, if any (owner-side). */
|
|
41
|
+
export declare function takePendingLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): PendingKScriptSourceRevalidation | undefined;
|
|
42
|
+
export declare function hasPendingLocalKScriptSourceRevalidation(chartIndex: number, overlayId: string): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Install a bypass token for one overlay's revalidation refresh. Returns the
|
|
45
|
+
* token; the owner must release with the SAME token so an older generation
|
|
46
|
+
* can never clear a newer one.
|
|
47
|
+
*/
|
|
48
|
+
export declare function installLocalKScriptSourceCacheBypass(chartIndex: number, overlayId: string): symbol;
|
|
49
|
+
export declare function releaseLocalKScriptSourceCacheBypass(chartIndex: number, overlayId: string, token: symbol): void;
|
|
50
|
+
/**
|
|
51
|
+
* Install one bypass token per overlay for a whole-chart forced refresh (the
|
|
52
|
+
* full-fetch debug oracle): every listed overlay's source acquisitions reach
|
|
53
|
+
* the wire until the returned release runs. Release is token-owned per
|
|
54
|
+
* overlay, so a revalidation refresh that installed its own newer token in
|
|
55
|
+
* the meantime keeps it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function installLocalKScriptSourceCacheBypassForOverlays(chartIndex: number, overlayIds: readonly string[]): () => void;
|
|
58
|
+
/** Observed (never consumed) by every source acquisition of the overlay. */
|
|
59
|
+
export declare function shouldBypassLocalKScriptSourceReplayCache(chartIndex: number, overlayId: string): boolean;
|
|
60
|
+
/** Chart teardown / dataset replacement: drop marks and tokens for the chart (or one overlay). */
|
|
61
|
+
export declare function clearLocalKScriptSourceRevalidation(chartIndex: number, overlayId?: string): void;
|
|
62
|
+
export declare function __resetLocalKScriptSourceRevalidationForTest(): void;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR revalidation state for local kScript SOURCE replay-cache hits.
|
|
3
|
+
*
|
|
4
|
+
* A non-polling source acquisition served from the replay cache paints
|
|
5
|
+
* stale-but-fast; the caching contract (perf/caching.md: stale paints, fresh
|
|
6
|
+
* replaces) then owes one live re-fetch. The boot second pass cannot be that
|
|
7
|
+
* re-fetch: on a warm boot it is skipped entirely, and on any pass the cache
|
|
8
|
+
* would simply hit again. So: the acquisition MARKS the overlay pending here;
|
|
9
|
+
* after that generation's first run integrates (the overlay actually painted),
|
|
10
|
+
* the owner (data-fetching.util) runs a one-shot per-(chart, overlay) refresh
|
|
11
|
+
* over the recorded range with a generation-owned BYPASS TOKEN installed.
|
|
12
|
+
* Every source acquisition belonging to that refresh observes the token (and
|
|
13
|
+
* never consumes it); the owner clears it in `finally` only if it still owns
|
|
14
|
+
* it. Teardown clears both maps.
|
|
15
|
+
*
|
|
16
|
+
* This module is pure state so titan-charts (acquisition side) and
|
|
17
|
+
* data-fetching.util (refresh side) can share it without an import cycle.
|
|
18
|
+
*/
|
|
19
|
+
const pendingByOverlay = new Map();
|
|
20
|
+
const bypassTokens = new Map();
|
|
21
|
+
function overlayKey(chartIndex, overlayId) {
|
|
22
|
+
return `${chartIndex}:${overlayId}`;
|
|
23
|
+
}
|
|
24
|
+
/** Called by the acquisition path on a non-polling replay-cache hit. */
|
|
25
|
+
export function markLocalKScriptSourceCacheHit(chartIndex, overlayId, fromMs, toMs) {
|
|
26
|
+
if (!Number.isFinite(fromMs) || !Number.isFinite(toMs) || toMs <= fromMs)
|
|
27
|
+
return;
|
|
28
|
+
const key = overlayKey(chartIndex, overlayId);
|
|
29
|
+
const existing = pendingByOverlay.get(key);
|
|
30
|
+
pendingByOverlay.set(key, {
|
|
31
|
+
fromMs: existing ? Math.min(existing.fromMs, fromMs) : fromMs,
|
|
32
|
+
toMs: existing ? Math.max(existing.toMs, toMs) : toMs,
|
|
33
|
+
markedAt: Date.now(),
|
|
34
|
+
scheduled: existing?.scheduled === true,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Arm a one-shot runner for the mark. Returns false when there is nothing to
|
|
39
|
+
* arm or a runner is already armed (idempotent under per-run scheduling).
|
|
40
|
+
*/
|
|
41
|
+
export function armLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
42
|
+
const pending = pendingByOverlay.get(overlayKey(chartIndex, overlayId));
|
|
43
|
+
if (!pending || pending.scheduled)
|
|
44
|
+
return false;
|
|
45
|
+
pending.scheduled = true;
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
/** Runner bailed on a guard without dispatching: allow a later run to re-arm. */
|
|
49
|
+
export function disarmLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
50
|
+
const pending = pendingByOverlay.get(overlayKey(chartIndex, overlayId));
|
|
51
|
+
if (pending)
|
|
52
|
+
pending.scheduled = false;
|
|
53
|
+
}
|
|
54
|
+
/** Consumes and returns the pending mark, if any (owner-side). */
|
|
55
|
+
export function takePendingLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
56
|
+
const key = overlayKey(chartIndex, overlayId);
|
|
57
|
+
const pending = pendingByOverlay.get(key);
|
|
58
|
+
if (pending)
|
|
59
|
+
pendingByOverlay.delete(key);
|
|
60
|
+
return pending;
|
|
61
|
+
}
|
|
62
|
+
export function hasPendingLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
63
|
+
return pendingByOverlay.has(overlayKey(chartIndex, overlayId));
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Install a bypass token for one overlay's revalidation refresh. Returns the
|
|
67
|
+
* token; the owner must release with the SAME token so an older generation
|
|
68
|
+
* can never clear a newer one.
|
|
69
|
+
*/
|
|
70
|
+
export function installLocalKScriptSourceCacheBypass(chartIndex, overlayId) {
|
|
71
|
+
const key = overlayKey(chartIndex, overlayId);
|
|
72
|
+
const token = Symbol(key);
|
|
73
|
+
bypassTokens.set(key, token);
|
|
74
|
+
return token;
|
|
75
|
+
}
|
|
76
|
+
export function releaseLocalKScriptSourceCacheBypass(chartIndex, overlayId, token) {
|
|
77
|
+
const key = overlayKey(chartIndex, overlayId);
|
|
78
|
+
if (bypassTokens.get(key) === token)
|
|
79
|
+
bypassTokens.delete(key);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Install one bypass token per overlay for a whole-chart forced refresh (the
|
|
83
|
+
* full-fetch debug oracle): every listed overlay's source acquisitions reach
|
|
84
|
+
* the wire until the returned release runs. Release is token-owned per
|
|
85
|
+
* overlay, so a revalidation refresh that installed its own newer token in
|
|
86
|
+
* the meantime keeps it.
|
|
87
|
+
*/
|
|
88
|
+
export function installLocalKScriptSourceCacheBypassForOverlays(chartIndex, overlayIds) {
|
|
89
|
+
const owned = overlayIds.map((overlayId) => ({
|
|
90
|
+
overlayId,
|
|
91
|
+
token: installLocalKScriptSourceCacheBypass(chartIndex, overlayId),
|
|
92
|
+
}));
|
|
93
|
+
return () => {
|
|
94
|
+
for (const { overlayId, token } of owned)
|
|
95
|
+
releaseLocalKScriptSourceCacheBypass(chartIndex, overlayId, token);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** Observed (never consumed) by every source acquisition of the overlay. */
|
|
99
|
+
export function shouldBypassLocalKScriptSourceReplayCache(chartIndex, overlayId) {
|
|
100
|
+
return bypassTokens.has(overlayKey(chartIndex, overlayId));
|
|
101
|
+
}
|
|
102
|
+
/** Chart teardown / dataset replacement: drop marks and tokens for the chart (or one overlay). */
|
|
103
|
+
export function clearLocalKScriptSourceRevalidation(chartIndex, overlayId) {
|
|
104
|
+
if (overlayId !== undefined) {
|
|
105
|
+
const key = overlayKey(chartIndex, overlayId);
|
|
106
|
+
pendingByOverlay.delete(key);
|
|
107
|
+
bypassTokens.delete(key);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
const prefix = `${chartIndex}:`;
|
|
111
|
+
for (const key of [...pendingByOverlay.keys()]) {
|
|
112
|
+
if (key.startsWith(prefix))
|
|
113
|
+
pendingByOverlay.delete(key);
|
|
114
|
+
}
|
|
115
|
+
for (const key of [...bypassTokens.keys()]) {
|
|
116
|
+
if (key.startsWith(prefix))
|
|
117
|
+
bypassTokens.delete(key);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function __resetLocalKScriptSourceRevalidationForTest() {
|
|
121
|
+
pendingByOverlay.clear();
|
|
122
|
+
bypassTokens.clear();
|
|
123
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warmup depth for browser-run ("local") kScript indicators.
|
|
3
|
+
*
|
|
4
|
+
* A long-window script (a 252-bar walk-forward, a 200-bar tail estimator)
|
|
5
|
+
* prints nothing for its first N loaded bars. On a boot window of ~500
|
|
6
|
+
* candles that warmup swallows most of the visible pane: the user sees an
|
|
7
|
+
* indicator that "did not load its back portion" (field report 2026-09-02),
|
|
8
|
+
* while TradingView hides the same warmup behind a 5000-bar first load.
|
|
9
|
+
*
|
|
10
|
+
* Rather than widening the boot fetch (the declared `minimumBars` is
|
|
11
|
+
* unreliable: a script declaring 252 first printed at bar 351), this reads
|
|
12
|
+
* the OBSERVED first value of the run result and, when it lands inside the
|
|
13
|
+
* viewport, asks for one more page of older candles through the same path a
|
|
14
|
+
* user pan-back takes. One declared read joins the observed ones: a script
|
|
15
|
+
* that prints from its first loaded bar while declaring a lookback deeper
|
|
16
|
+
* than the loaded window is computing on a truncated window (an anchored
|
|
17
|
+
* calculation clamped at the oldest loaded bar), and owes a page too
|
|
18
|
+
* ('declared-depth'). Bounded: at most LOCAL_KSCRIPT_WARMUP_DEPTH_MAX_ROUNDS
|
|
19
|
+
* rounds per overlay per chart identity, never while the viewport is moving,
|
|
20
|
+
* never past the venue's left wall.
|
|
21
|
+
*
|
|
22
|
+
* Pure by construction (every input is passed in) so the decision is unit
|
|
23
|
+
* testable and the ring events publish exactly what was chosen.
|
|
24
|
+
*/
|
|
25
|
+
/** Rounds of older history one overlay may request for its warmup. */
|
|
26
|
+
export declare const LOCAL_KSCRIPT_WARMUP_DEPTH_MAX_ROUNDS = 2;
|
|
27
|
+
/**
|
|
28
|
+
* The lazy loader edge-aligns every request to whole BARS_PER_BUCKET buckets
|
|
29
|
+
* (computeEdgeAnchoredLazyRange): a 30-bar ask still prepends 250 candles. So
|
|
30
|
+
* a warmup page is 0, one bucket, or two buckets (the lazy round clamp), and
|
|
31
|
+
* `bars` in a decision is stated in loader terms.
|
|
32
|
+
*/
|
|
33
|
+
export declare const LOCAL_KSCRIPT_WARMUP_DEPTH_BUCKET_BARS = 250;
|
|
34
|
+
export declare const LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_BARS = 250;
|
|
35
|
+
export declare const LOCAL_KSCRIPT_WARMUP_DEPTH_MAX_BARS: number;
|
|
36
|
+
/** Whole loader buckets that cover a positive need: one up to a bucket, two past it (never more). */
|
|
37
|
+
export declare function warmupBucketsForNeed(needBars: number): number;
|
|
38
|
+
/**
|
|
39
|
+
* A visible warmup gap smaller than BOTH of these is left alone: a 20-bar
|
|
40
|
+
* moving-average warmup at the far left edge is what every charting product
|
|
41
|
+
* shows, and a fetch for it buys nothing the eye can see.
|
|
42
|
+
*/
|
|
43
|
+
export declare const LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_GAP_BARS = 25;
|
|
44
|
+
type LocalKScriptWarmupDepthSkipReason = 'no-rows' | 'no-viewport' | 'warmup-offscreen' | 'gap-too-small' | 'rounds-exhausted' | 'left-exhausted' | 'gesture-active'
|
|
45
|
+
/** A source of the script is still loading, degraded, or never settled: an all-NaN run is not warmup evidence. */
|
|
46
|
+
| 'sources-pending'
|
|
47
|
+
/** The script declares a lookback of 0 and simply printed nothing: an empty output is not a warmup gap. */
|
|
48
|
+
| 'zero-lookback-empty';
|
|
49
|
+
export type LocalKScriptWarmupDepthDecision = {
|
|
50
|
+
fetch: true;
|
|
51
|
+
reason: 'warmup-visible' | 'no-values-yet' | 'declared-depth';
|
|
52
|
+
/** Bars the loader will actually prepend: one or two whole buckets. */
|
|
53
|
+
bars: number;
|
|
54
|
+
/** Bars the script can use (lookback-bounded), before bucket rounding. */
|
|
55
|
+
needBars: number;
|
|
56
|
+
/** The visible gap, the all-NaN need, or (declared-depth) the bars the declaration exceeds the loaded window by. */
|
|
57
|
+
missingBars: number;
|
|
58
|
+
} | {
|
|
59
|
+
fetch: false;
|
|
60
|
+
reason: LocalKScriptWarmupDepthSkipReason;
|
|
61
|
+
};
|
|
62
|
+
export interface LocalKScriptWarmupDepthInput {
|
|
63
|
+
/** Timestamp of the first row carrying a finite value in any plotted output, null when none. */
|
|
64
|
+
firstValueTs: number | null;
|
|
65
|
+
/** Timestamp of the oldest loaded main candle, null when the chart has no rows. */
|
|
66
|
+
loadedFirstTs: number | null;
|
|
67
|
+
/**
|
|
68
|
+
* Timestamp of the newest loaded main candle, null when unknown. With
|
|
69
|
+
* loadedFirstTs it sizes the loaded window (`loadedBarsOfWindow`) against
|
|
70
|
+
* a declared lookback, and it ends the visible bars the gap floor counts
|
|
71
|
+
* (the right margin past it holds none); null disables the declared-depth
|
|
72
|
+
* reason and leaves the floor on the raw viewport end.
|
|
73
|
+
*/
|
|
74
|
+
loadedLastTs: number | null;
|
|
75
|
+
/** Start of the visible viewport in ms, null when unknown or degenerate. */
|
|
76
|
+
viewportStartTs: number | null;
|
|
77
|
+
/** End of the visible viewport in ms (the floor counts up to loadedLastTs at most); null falls back to the absolute gap floor only. */
|
|
78
|
+
viewportEndTs: number | null;
|
|
79
|
+
/** Chart interval in ms. */
|
|
80
|
+
intervalMs: number;
|
|
81
|
+
/** Warmup rounds already spent by this overlay on this chart identity. */
|
|
82
|
+
roundsUsed: number;
|
|
83
|
+
/**
|
|
84
|
+
* Rounds this identity may spend; LOCAL_KSCRIPT_WARMUP_DEPTH_MAX_ROUNDS when absent (every
|
|
85
|
+
* warm-up caller). The anchor history demand passes ceil(lookback / page) for its own key
|
|
86
|
+
* (anchor-history-demand.util), so a deep anchor is bought page by page under the same rules.
|
|
87
|
+
*/
|
|
88
|
+
maxRounds?: number;
|
|
89
|
+
/**
|
|
90
|
+
* The floor a DECLARED-DEPTH shortfall must reach (LOCAL_KSCRIPT_WARMUP_DEPTH_MIN_GAP_BARS when
|
|
91
|
+
* absent; every warm-up caller). The anchor history demand passes 1: its declaration is a padded
|
|
92
|
+
* need already, and a clamp that cut the pad (a lite cell's room, the retention wall) leaves a
|
|
93
|
+
* shortfall under the floor that the anchor still needs. The observed reasons keep their floors.
|
|
94
|
+
*/
|
|
95
|
+
minGapBars?: number;
|
|
96
|
+
/** The lazy path has latched the venue's left wall at or after the loaded start. */
|
|
97
|
+
leftExhausted: boolean;
|
|
98
|
+
/** The viewport moved within the wave's idle window. */
|
|
99
|
+
gestureActive: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* The executed script's declared lookback in bars
|
|
102
|
+
* (resolveDeclaredLookbackBars), null when unknown. Bounds the need: a
|
|
103
|
+
* script that declares 5 bars is never owed a second bucket.
|
|
104
|
+
*/
|
|
105
|
+
lookbackBars: number | null;
|
|
106
|
+
/** Every source of the engine settled for the current timeline (the proxy's sourceSettlementLedger). */
|
|
107
|
+
sourcesSettled: boolean;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Bars in the loaded main window: floor((last - first) / interval) + 1. Null
|
|
111
|
+
* when either edge is unknown, the interval is not positive, or the edges
|
|
112
|
+
* are inverted (a malformed read is unknown, never a small window).
|
|
113
|
+
*/
|
|
114
|
+
export declare function loadedBarsOfWindow(loadedFirstTs: number | null | undefined, loadedLastTs: number | null | undefined, intervalMs: number): number | null;
|
|
115
|
+
/**
|
|
116
|
+
* Decide whether to spend a warmup round. The first value must sit inside or
|
|
117
|
+
* to the right of the visible window (offscreen warmup is the normal, harmless
|
|
118
|
+
* case), and the request is sized to what the warmup still lacks, clamped to
|
|
119
|
+
* one lazy page and, when the script declares a lookback, bounded by it. An
|
|
120
|
+
* all-NaN run is evidence only after every source settled (field 2026-09-05:
|
|
121
|
+
* Volume Bubbles fired a blind 500-bar page while its volume-profile source
|
|
122
|
+
* was still downloading, and every heavy native overlay refetched the widened
|
|
123
|
+
* range). A declared lookback deeper than the loaded window, with the first
|
|
124
|
+
* value at the loaded start, is the one non-observed reason ('declared-depth',
|
|
125
|
+
* sized to the shortfall, one page at a time; a shortfall under the absolute
|
|
126
|
+
* gap floor, or the caller's `minGapBars`, is left alone like any other small gap).
|
|
127
|
+
*/
|
|
128
|
+
export declare function chooseLocalKScriptWarmupDepth(input: LocalKScriptWarmupDepthInput): LocalKScriptWarmupDepthDecision;
|
|
129
|
+
export interface WarmupOutputLike {
|
|
130
|
+
plotType?: unknown;
|
|
131
|
+
rows?: ReadonlyArray<ReadonlyArray<unknown>> | null;
|
|
132
|
+
}
|
|
133
|
+
/** First row timestamp with a finite value in any value column (rows are `[ts, ...values]`), null when none. */
|
|
134
|
+
export declare function firstFiniteTsOfRows(rows: ReadonlyArray<ReadonlyArray<unknown>> | null | undefined): number | null;
|
|
135
|
+
export interface WarmupRowsProfile {
|
|
136
|
+
/** Timestamp of the first well-formed row (finite or not): where the run's window starts, null when no rows. */
|
|
137
|
+
firstRowTs: number | null;
|
|
138
|
+
/** Timestamp of the first row carrying a finite value in any value column, null when none. */
|
|
139
|
+
firstFiniteTs: number | null;
|
|
140
|
+
/** Rows carrying at least one finite value, counted up to 2 (the line-vs-point question needs no more). */
|
|
141
|
+
finiteRows: number;
|
|
142
|
+
/** Rows whose value cells are payload objects (labels, marker tuples, tables) and never a finite number. */
|
|
143
|
+
objectRows: number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* What a dense-typed output's rows actually hold. Scans stop at the second
|
|
147
|
+
* finite row (a line is proven), so a healthy line costs the same as the
|
|
148
|
+
* plain first-finite scan; an all-NaN or object-valued output is scanned to
|
|
149
|
+
* the end, exactly as before.
|
|
150
|
+
*/
|
|
151
|
+
export declare function profileWarmupRows(rows: ReadonlyArray<ReadonlyArray<unknown>> | null | undefined): WarmupRowsProfile;
|
|
152
|
+
export type WarmupEndOfOutputs =
|
|
153
|
+
/** No dense (line-like) output at all: a marker-only script carries no warmup evidence. */
|
|
154
|
+
{
|
|
155
|
+
kind: 'no-dense-output';
|
|
156
|
+
}
|
|
157
|
+
/** Every dense output is NaN on every loaded bar. */
|
|
158
|
+
| {
|
|
159
|
+
kind: 'no-values-yet';
|
|
160
|
+
}
|
|
161
|
+
/** The latest first-value timestamp across the dense outputs: the bar the pane is complete from. */
|
|
162
|
+
| {
|
|
163
|
+
kind: 'warmup-end';
|
|
164
|
+
ts: number;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Where the pane becomes complete. Each dense output contributes the timestamp
|
|
168
|
+
* of its first finite value; the LATEST wins, because a pane with a reference
|
|
169
|
+
* line printing from bar 0 and a main line printing from bar 100 is still
|
|
170
|
+
* empty for 100 bars. Sparse outputs (markers, tables, hlines) are ignored: a
|
|
171
|
+
* signal that first fires mid-screen is not warmup.
|
|
172
|
+
*
|
|
173
|
+
* Two more shapes carry no evidence even under a line type (2026-09-13 dump):
|
|
174
|
+
* - object-valued rows (label / marker payloads under a line plot type, or an
|
|
175
|
+
* unlisted sparse type): not "all NaN", just not numbers;
|
|
176
|
+
* - a single finite row: the current-value dot a script draws with a spline
|
|
177
|
+
* (Anchored VWAP), which sits on the newest bar and can never move left, so
|
|
178
|
+
* it read as a visible warmup end and bought two pages that changed nothing.
|
|
179
|
+
* A line that genuinely printed only its newest bar is indistinguishable in
|
|
180
|
+
* one run and forgoes the page; a boot window that short is the user's pan.
|
|
181
|
+
*/
|
|
182
|
+
export declare function warmupEndOfOutputs(outputs: Iterable<WarmupOutputLike>): WarmupEndOfOutputs;
|
|
183
|
+
/**
|
|
184
|
+
* The outputs' warm-up end joined by a DECLARED one (the wrun lane: a sheet's `warmup` /
|
|
185
|
+
* `warmup_bars`, placed that many bars into the run's window): the declaration reads as one more
|
|
186
|
+
* dense output whose first value sits at `declaredEndTs`, so the LATER of the two is where the pane
|
|
187
|
+
* is complete, exactly as `warmupEndOfOutputs` takes the latest first value across the outputs. A
|
|
188
|
+
* result with no dense output (a drawings-only sheet) carries the declaration alone; an all-NaN
|
|
189
|
+
* result stays `no-values-yet` (nothing printed is the stronger read). A missing or non-finite
|
|
190
|
+
* declaration changes nothing.
|
|
191
|
+
*/
|
|
192
|
+
export declare function withDeclaredWarmupEnd(evidence: WarmupEndOfOutputs, declaredEndTs: number | null | undefined): WarmupEndOfOutputs;
|
|
193
|
+
/**
|
|
194
|
+
* Where the run's rows START across the dense outputs (the earliest first
|
|
195
|
+
* row), null when none carries rows. This is the window the engine actually
|
|
196
|
+
* computed on, which is not the chart's loaded window while a prepended page
|
|
197
|
+
* has landed on the chart but not yet reached the engine: a result judged
|
|
198
|
+
* against the chart's new start would read "unchanged first value" and
|
|
199
|
+
* freeze the identity (2026-09-14 field dump: the Anchored VWAP's first
|
|
200
|
+
* page landed at 09:00Z, the next integrated result still ran on the 11:15Z
|
|
201
|
+
* window, and the hold released on a false no-progress verdict).
|
|
202
|
+
*/
|
|
203
|
+
export declare function warmupOutputsWindowStartTs(outputs: Iterable<WarmupOutputLike>): number | null;
|
|
204
|
+
/**
|
|
205
|
+
* Declared lookback of the script version actually executed, in bars.
|
|
206
|
+
* Priority: the run result's `lookbackInfo.minimumBars` (stamped by the
|
|
207
|
+
* engine worker from the declaration pass over the executed code, so editor
|
|
208
|
+
* drafts read their own value), else the overlay settings' `lookbackInfo`
|
|
209
|
+
* (the saved contract, object or JSON string: the retention hint's read),
|
|
210
|
+
* else null. Any unparsable or non-finite shape is null (unknown), never 0:
|
|
211
|
+
* only a declared finite 0 is 0.
|
|
212
|
+
*/
|
|
213
|
+
export declare function resolveDeclaredLookbackBars(runLookbackInfo: unknown, settingsLookbackInfo: unknown): number | null;
|
|
214
|
+
export {};
|