@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,156 @@
|
|
|
1
|
+
import { hasKScriptLiveSourceSnapshotOfType, } from './kscript-live-source-identity.util.js';
|
|
2
|
+
// Live kScript source messages are increments for additive sources (buy/sell
|
|
3
|
+
// volume, liquidations, and the volume component of ohlcv trade ticks), so the
|
|
4
|
+
// per-source live coalescer must fold EVERY pending message into the merge base
|
|
5
|
+
// at drain time. Keeping only the newest message per window (the old behavior)
|
|
6
|
+
// silently discarded the volume of every clobbered message. BUY and SELL
|
|
7
|
+
// aggregations share one source type, so alternating sides alone lost most of a
|
|
8
|
+
// busy bar's volume between poll corrections, which is why the browser-run
|
|
9
|
+
// indicator read far lower volume/delta than the server-run one. Orderbook
|
|
10
|
+
// messages are full snapshots, so last-wins remains correct there.
|
|
11
|
+
// Memory guard only, sized for the holds the lane actually takes. A key's queue
|
|
12
|
+
// grows for as long as its script's window stays open: the 1s refresh gate,
|
|
13
|
+
// the pan hold, the hidden-tab floor, and a drain chain that is still awaiting
|
|
14
|
+
// the worker all keep it open (field dumps 2026-09-14: holds of 8 to 31 s at
|
|
15
|
+
// rest with up to 222 points on one key at 256). Trimming drops the OLDEST
|
|
16
|
+
// increments, which is volume the next poll has to resynchronise, so the cap
|
|
17
|
+
// must sit well above any hold a healthy session takes: 1024 covers about
|
|
18
|
+
// 50 s of the busiest BTC tape (20 buy/sell prints a second on one key). Each
|
|
19
|
+
// trim is counted on the flush ring event (`droppedPoints`).
|
|
20
|
+
export const V2_LIVE_PENDING_DATA_POINT_CAP = 1024;
|
|
21
|
+
// The hidden hold (rest-cost H6) keeps a key's window open for as long as the
|
|
22
|
+
// page stays hidden: a held script arms no timer and only folds. So that the
|
|
23
|
+
// cap above never trims a held point, a held key whose queue reaches this many
|
|
24
|
+
// points runs ONE drain at once (`coalesceSnap: 'hidden-backlog'`) and then
|
|
25
|
+
// holds again. Half the cap: the run leaves 512 points of headroom for the
|
|
26
|
+
// ticks that land while it is in flight (about 25 s of the busiest tape).
|
|
27
|
+
export const V2_LIVE_HIDDEN_BACKLOG_RUN_POINTS = 512;
|
|
28
|
+
const hiddenHoldStats = { kscriptHolds: 0, kscriptHiddenRuns: 0 };
|
|
29
|
+
export function noteLocalKScriptHiddenHold() {
|
|
30
|
+
hiddenHoldStats.kscriptHolds += 1;
|
|
31
|
+
}
|
|
32
|
+
export function noteLocalKScriptHiddenRun() {
|
|
33
|
+
hiddenHoldStats.kscriptHiddenRuns += 1;
|
|
34
|
+
}
|
|
35
|
+
export function getLocalKScriptHiddenHoldStats() {
|
|
36
|
+
return { ...hiddenHoldStats };
|
|
37
|
+
}
|
|
38
|
+
export function shouldAccumulateV2LiveDataPoints(sourceType) {
|
|
39
|
+
return !(typeof sourceType === 'string' && sourceType.toLowerCase() === 'orderbook');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The size floor a raw TRADE print must clear to fold into ANY `trades`
|
|
43
|
+
* source of an engine: the smallest declared minSize (0 when a source has
|
|
44
|
+
* none). Applied at intake, before the pending queue, so a busy feed's small
|
|
45
|
+
* prints cannot push a qualifying print out of the 1,024-message window.
|
|
46
|
+
*/
|
|
47
|
+
export function v2LiveTradesSizeFloor(snapshots) {
|
|
48
|
+
let floor = Number.POSITIVE_INFINITY;
|
|
49
|
+
let any = false;
|
|
50
|
+
for (const snapshot of snapshots ?? []) {
|
|
51
|
+
if (snapshot.sourceType !== 'trades')
|
|
52
|
+
continue;
|
|
53
|
+
any = true;
|
|
54
|
+
const minSize = Number(snapshot.payload?.minSize);
|
|
55
|
+
floor = Math.min(floor, Number.isFinite(minSize) && minSize > 0 ? minSize : 0);
|
|
56
|
+
}
|
|
57
|
+
return any && Number.isFinite(floor) ? floor : 0;
|
|
58
|
+
}
|
|
59
|
+
/** True when a raw TRADE message carries a print below `floor` (a non-print message never is). */
|
|
60
|
+
export function v2LiveTradePrintBelowFloor(data, floor) {
|
|
61
|
+
if (!(floor > 0))
|
|
62
|
+
return false;
|
|
63
|
+
const amount = Number(data?.trade?.amount);
|
|
64
|
+
return Number.isFinite(amount) && amount < floor;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* One coalesce key's pending live points, oldest first, bounded by the cap.
|
|
68
|
+
*
|
|
69
|
+
* The intake appends every point IN PLACE. The previous shape (a fresh copy
|
|
70
|
+
* of the whole queue per point) cost the busiest key a quadratic amount of
|
|
71
|
+
* copying up to the cap, per local engine (field 2026-09-26). A trim advances
|
|
72
|
+
* a head cursor instead of shifting the array, and the dead prefix is
|
|
73
|
+
* compacted once per cap trims, so a push is O(1) amortized and the array
|
|
74
|
+
* behind the queue never holds more than twice the cap.
|
|
75
|
+
*
|
|
76
|
+
* Ownership: one appender (the intake) and one consumer (the drain), never at
|
|
77
|
+
* the same time. The drain detaches its batch from the coalesce map before it
|
|
78
|
+
* reads any queue, then drains each queue exactly once; a point that arrives
|
|
79
|
+
* after the detach starts the key's next queue, for the next drain. See
|
|
80
|
+
* scheduleCoalescedV2TechnicalScriptLiveUpdate in live-feed.service.ts.
|
|
81
|
+
*/
|
|
82
|
+
export class V2LivePendingDataPointQueue {
|
|
83
|
+
cap;
|
|
84
|
+
points = [];
|
|
85
|
+
head = 0;
|
|
86
|
+
constructor(cap = V2_LIVE_PENDING_DATA_POINT_CAP) {
|
|
87
|
+
this.cap = cap;
|
|
88
|
+
}
|
|
89
|
+
get size() {
|
|
90
|
+
return this.points.length - this.head;
|
|
91
|
+
}
|
|
92
|
+
/** Appends `point`; returns 1 when the oldest point was trimmed to keep the cap, else 0. */
|
|
93
|
+
push(point) {
|
|
94
|
+
this.points.push(point);
|
|
95
|
+
if (this.points.length - this.head <= this.cap)
|
|
96
|
+
return 0;
|
|
97
|
+
this.head += 1;
|
|
98
|
+
if (this.head >= this.cap) {
|
|
99
|
+
this.points.splice(0, this.head);
|
|
100
|
+
this.head = 0;
|
|
101
|
+
}
|
|
102
|
+
return 1;
|
|
103
|
+
}
|
|
104
|
+
/** Hands the pending points (oldest first) to the caller and empties the queue. */
|
|
105
|
+
drain() {
|
|
106
|
+
const points = this.head === 0 ? this.points : this.points.slice(this.head);
|
|
107
|
+
this.points = [];
|
|
108
|
+
this.head = 0;
|
|
109
|
+
return points;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* True when a message of `sourceType` can never fold into this engine: it has
|
|
114
|
+
* initialised with a populated source cache that declares no source of that
|
|
115
|
+
* type. The router offers every subscribed symbol's messages to every local
|
|
116
|
+
* engine, so most (engine, source type) pairs it visits are foreign. The
|
|
117
|
+
* drain already skipped those without a worker round-trip (its zero-match
|
|
118
|
+
* cheap path); this is the same predicate at the intake, so a foreign type
|
|
119
|
+
* never queues a point or arms a drain. Anything less certain still queues
|
|
120
|
+
* (an uninitialised engine, an empty cache, a declared type whose variants
|
|
121
|
+
* reject the message's identity): those keep the drain's bootstrap and
|
|
122
|
+
* deep-lookup paths.
|
|
123
|
+
*/
|
|
124
|
+
export function isV2LiveSourceTypeForeignToEngine(engine, cachedSnapshots, sourceType) {
|
|
125
|
+
return (engine.hasInitialized === true &&
|
|
126
|
+
Array.isArray(cachedSnapshots) &&
|
|
127
|
+
cachedSnapshots.length > 0 &&
|
|
128
|
+
!hasKScriptLiveSourceSnapshotOfType(cachedSnapshots, sourceType));
|
|
129
|
+
}
|
|
130
|
+
// The router offers every subscribed symbol's messages to every engine, so the
|
|
131
|
+
// per-engine accumulation MUST segregate by series identity: the drain resolves
|
|
132
|
+
// its merge target from the newest message's identity, then folds every queued
|
|
133
|
+
// point into those rows. One shared per-type queue let another chart's trade
|
|
134
|
+
// aggs ride along and merge into this source's bars (a foreign close becomes
|
|
135
|
+
// the bar's high/low through the max/min ratchet), or, with a foreign newest
|
|
136
|
+
// message, fail the lookup and drop the genuine increments queued behind it.
|
|
137
|
+
export function v2LiveSeriesIdentityKey(exchange, symbol) {
|
|
138
|
+
return `${exchange ?? ''}|${symbol ?? ''}`;
|
|
139
|
+
}
|
|
140
|
+
// Safety net behind the identity-keyed queue: any point that still reaches a
|
|
141
|
+
// fold with a different series identity must not touch these rows. Points
|
|
142
|
+
// without a series stay; some payload shapes carry none.
|
|
143
|
+
export function filterV2LiveDataPointsBySeries(points, expectedExchange, expectedSymbol) {
|
|
144
|
+
return points.filter((point) => {
|
|
145
|
+
const series = point?.series;
|
|
146
|
+
if (!series || typeof series !== 'object')
|
|
147
|
+
return true;
|
|
148
|
+
const pointExchange = typeof series.exchange === 'string' ? series.exchange : undefined;
|
|
149
|
+
const pointSymbol = typeof series.symbol === 'string' ? series.symbol : undefined;
|
|
150
|
+
if (pointExchange && expectedExchange && pointExchange !== expectedExchange)
|
|
151
|
+
return false;
|
|
152
|
+
if (pointSymbol && expectedSymbol && pointSymbol !== expectedSymbol)
|
|
153
|
+
return false;
|
|
154
|
+
return true;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** At rest, live-source refresh engine runs drain at most once per this. */
|
|
2
|
+
export declare const LOCAL_KSCRIPT_LIVE_SOURCE_REST_REFRESH_MIN_INTERVAL_MS = 1000;
|
|
3
|
+
export declare function __setLocalKScriptLiveRestPaceClockForTests(fn: (() => number) | null): void;
|
|
4
|
+
/** Runtime kill switch; session-scoped, defaults to enabled. */
|
|
5
|
+
export declare function setLocalKScriptLiveRestPaceDisabled(disabled: boolean): void;
|
|
6
|
+
export declare function isLocalKScriptLiveRestPaceDisabled(): boolean;
|
|
7
|
+
export type LocalKScriptLiveRestPaceAdmitReason = 'disabled' | 'not-at-rest' | 'floor-open';
|
|
8
|
+
export type LocalKScriptLiveRestPaceDecision = {
|
|
9
|
+
admit: true;
|
|
10
|
+
reason: LocalKScriptLiveRestPaceAdmitReason;
|
|
11
|
+
} | {
|
|
12
|
+
admit: false;
|
|
13
|
+
retryInMs: number;
|
|
14
|
+
msSinceLastRun: number;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* Drain-admission decision. Pure read: it never stamps (the caller stamps at
|
|
18
|
+
* actual dispatch via noteLocalKScriptLiveRestPacedRun), so a deferred drain
|
|
19
|
+
* re-deciding at its re-armed timer cannot push the floor out.
|
|
20
|
+
*/
|
|
21
|
+
export declare function decideLocalKScriptLiveRestPacedDrain(args: {
|
|
22
|
+
chartIndex: number;
|
|
23
|
+
indicatorId: string;
|
|
24
|
+
/** Milliseconds since the chart's last viewport motion; Infinity when it never moved. */
|
|
25
|
+
msSinceViewportMotion: number;
|
|
26
|
+
}): LocalKScriptLiveRestPaceDecision;
|
|
27
|
+
/**
|
|
28
|
+
* Stamp an actually-dispatched engine run for this overlay. Called at the
|
|
29
|
+
* coalescer's dispatch point for EVERY run (gesture-time included), and also
|
|
30
|
+
* while the kill switch is off so re-enabling resumes from the last real run.
|
|
31
|
+
*/
|
|
32
|
+
export declare function noteLocalKScriptLiveRestPacedRun(chartIndex: number, indicatorId: string): void;
|
|
33
|
+
export declare function clearAllLocalKScriptLiveRestPaceForTests(): void;
|
|
34
|
+
export declare function __getLocalKScriptLiveRestPaceStampCountForTests(): number;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REST-PACING FLOOR for the local kScript live-source refresh lane.
|
|
3
|
+
*
|
|
4
|
+
* Field evidence (production dump, 2026-07-27, a container-native v2 script
|
|
5
|
+
* subscribed to buy_sell_volume + volume_profile + orderbook + ohlcv): in a
|
|
6
|
+
* 13.7s at-rest capture the live coalescer was a pass-through (308 schedules,
|
|
7
|
+
* 308 drains, up to 28 drains/second), driving 92 full engine re-runs (~7/s,
|
|
8
|
+
* 170-225ms each for that script) and 80 metadata callbacks, of which ~25
|
|
9
|
+
* survived the byte-identical fingerprint gate and repainted the whole scene
|
|
10
|
+
* (~2 visible repaints/second of band-fill flicker). The structural gap: the
|
|
11
|
+
* per-overlay coalescer state is DELETED once a drain leaves nothing pending,
|
|
12
|
+
* so the next tick recreates it with lastStartedAt 0 and dispatches with zero
|
|
13
|
+
* delay. Gestures are protected by the pan-hold and the settle-hold; AT REST
|
|
14
|
+
* nothing paced the drain.
|
|
15
|
+
*
|
|
16
|
+
* This module is that pacer. Keyed per overlay (chartIndex|indicatorId), the
|
|
17
|
+
* coalescer's drain admission consults it before dispatching an engine run
|
|
18
|
+
* while the viewport is at rest (motion clock quiet for at least the lane's
|
|
19
|
+
* idle window, the same LOCAL_TECHNICAL_SCRIPT_LIVE_APPLY_VIEWPORT_IDLE_MS
|
|
20
|
+
* threshold the paint-suppression path uses):
|
|
21
|
+
*
|
|
22
|
+
* - The first drain after at least
|
|
23
|
+
* LOCAL_KSCRIPT_LIVE_SOURCE_REST_REFRESH_MIN_INTERVAL_MS of quiet admits
|
|
24
|
+
* immediately, so a lone tick gains zero latency.
|
|
25
|
+
* - A drain inside the floor is deferred: the caller re-arms its own timer for
|
|
26
|
+
* the returned remainder while source messages keep folding into the
|
|
27
|
+
* coalescer's pending state (source-row merges stay per tick and lossless,
|
|
28
|
+
* ONLY the engine run + apply are paced), so exactly ONE drain runs at floor
|
|
29
|
+
* expiry with the newest merged state, latest wins.
|
|
30
|
+
* - Below the idle window the admission always passes: gestures are owned by
|
|
31
|
+
* the existing drain pan-hold and the settle-hold, and their semantics must
|
|
32
|
+
* not change. Every dispatched run stamps the floor clock (gesture-time runs
|
|
33
|
+
* included) so the first at-rest drain after a gesture cannot stack onto a
|
|
34
|
+
* run that just happened.
|
|
35
|
+
*
|
|
36
|
+
* The floor never touches WHAT is applied, only WHEN the engine re-runs: the
|
|
37
|
+
* single-owner supersession contract (the settle-hold drops coalescer live-lane
|
|
38
|
+
* pendings) and the live lane's no-maxWaitMs rule live downstream of this
|
|
39
|
+
* admission and are unaffected.
|
|
40
|
+
*
|
|
41
|
+
* Kill switch: setLocalKScriptLiveRestPaceDisabled(true), or from a console
|
|
42
|
+
* __disableKiyoKScriptLiveRestPace() / __enableKiyoKScriptLiveRestPace(),
|
|
43
|
+
* restores the pre-floor admission (every scheduled drain dispatches).
|
|
44
|
+
*
|
|
45
|
+
* Dependency-light on purpose (node specs import this directly), mirroring
|
|
46
|
+
* kscript-live-settle-hold.util: no service imports, injected clock.
|
|
47
|
+
*/
|
|
48
|
+
import { LOCAL_TECHNICAL_SCRIPT_LIVE_APPLY_VIEWPORT_IDLE_MS } from './local-technical-script-live-apply-coalescer.util.js';
|
|
49
|
+
/** At rest, live-source refresh engine runs drain at most once per this. */
|
|
50
|
+
export const LOCAL_KSCRIPT_LIVE_SOURCE_REST_REFRESH_MIN_INTERVAL_MS = 1_000;
|
|
51
|
+
// Stamp-map bound. Entries are plain timestamps (no timers, no callbacks), so
|
|
52
|
+
// no teardown wiring is owed: a stale stamp can only defer a same-id overlay
|
|
53
|
+
// re-added within one floor interval of its last run by less than that
|
|
54
|
+
// interval. The cap just keeps pathological indicator-id churn from minting
|
|
55
|
+
// immortal entries; eviction is oldest-stamped-first via Map insertion order
|
|
56
|
+
// (noteLocalKScriptLiveRestPacedRun re-inserts on every stamp).
|
|
57
|
+
const LOCAL_KSCRIPT_LIVE_REST_PACE_MAX_KEYS = 512;
|
|
58
|
+
const lastRunAtByKey = new Map();
|
|
59
|
+
let restPaceDisabled = false;
|
|
60
|
+
let nowFn = () => Date.now();
|
|
61
|
+
export function __setLocalKScriptLiveRestPaceClockForTests(fn) {
|
|
62
|
+
nowFn = fn ?? (() => Date.now());
|
|
63
|
+
}
|
|
64
|
+
function paceKey(chartIndex, indicatorId) {
|
|
65
|
+
return `${chartIndex}:${indicatorId}`;
|
|
66
|
+
}
|
|
67
|
+
/** Runtime kill switch; session-scoped, defaults to enabled. */
|
|
68
|
+
export function setLocalKScriptLiveRestPaceDisabled(disabled) {
|
|
69
|
+
restPaceDisabled = disabled === true;
|
|
70
|
+
}
|
|
71
|
+
export function isLocalKScriptLiveRestPaceDisabled() {
|
|
72
|
+
return restPaceDisabled;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Drain-admission decision. Pure read: it never stamps (the caller stamps at
|
|
76
|
+
* actual dispatch via noteLocalKScriptLiveRestPacedRun), so a deferred drain
|
|
77
|
+
* re-deciding at its re-armed timer cannot push the floor out.
|
|
78
|
+
*/
|
|
79
|
+
export function decideLocalKScriptLiveRestPacedDrain(args) {
|
|
80
|
+
if (restPaceDisabled)
|
|
81
|
+
return { admit: true, reason: 'disabled' };
|
|
82
|
+
// Written as a negated >= so a NaN input fails open to the pre-floor
|
|
83
|
+
// behavior instead of deferring a gesture-time drain.
|
|
84
|
+
if (!(args.msSinceViewportMotion >= LOCAL_TECHNICAL_SCRIPT_LIVE_APPLY_VIEWPORT_IDLE_MS)) {
|
|
85
|
+
return { admit: true, reason: 'not-at-rest' };
|
|
86
|
+
}
|
|
87
|
+
const lastRunAt = lastRunAtByKey.get(paceKey(args.chartIndex, args.indicatorId));
|
|
88
|
+
if (lastRunAt === undefined)
|
|
89
|
+
return { admit: true, reason: 'floor-open' };
|
|
90
|
+
const msSinceLastRun = nowFn() - lastRunAt;
|
|
91
|
+
if (msSinceLastRun >= LOCAL_KSCRIPT_LIVE_SOURCE_REST_REFRESH_MIN_INTERVAL_MS) {
|
|
92
|
+
return { admit: true, reason: 'floor-open' };
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
admit: false,
|
|
96
|
+
retryInMs: Math.min(LOCAL_KSCRIPT_LIVE_SOURCE_REST_REFRESH_MIN_INTERVAL_MS, Math.max(1, Math.ceil(LOCAL_KSCRIPT_LIVE_SOURCE_REST_REFRESH_MIN_INTERVAL_MS - msSinceLastRun))),
|
|
97
|
+
msSinceLastRun: Math.max(0, Math.round(msSinceLastRun)),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Stamp an actually-dispatched engine run for this overlay. Called at the
|
|
102
|
+
* coalescer's dispatch point for EVERY run (gesture-time included), and also
|
|
103
|
+
* while the kill switch is off so re-enabling resumes from the last real run.
|
|
104
|
+
*/
|
|
105
|
+
export function noteLocalKScriptLiveRestPacedRun(chartIndex, indicatorId) {
|
|
106
|
+
const key = paceKey(chartIndex, indicatorId);
|
|
107
|
+
if (lastRunAtByKey.has(key)) {
|
|
108
|
+
lastRunAtByKey.delete(key);
|
|
109
|
+
}
|
|
110
|
+
else if (lastRunAtByKey.size >= LOCAL_KSCRIPT_LIVE_REST_PACE_MAX_KEYS) {
|
|
111
|
+
const oldest = lastRunAtByKey.keys().next().value;
|
|
112
|
+
if (oldest !== undefined)
|
|
113
|
+
lastRunAtByKey.delete(oldest);
|
|
114
|
+
}
|
|
115
|
+
lastRunAtByKey.set(key, nowFn());
|
|
116
|
+
}
|
|
117
|
+
export function clearAllLocalKScriptLiveRestPaceForTests() {
|
|
118
|
+
lastRunAtByKey.clear();
|
|
119
|
+
restPaceDisabled = false;
|
|
120
|
+
}
|
|
121
|
+
export function __getLocalKScriptLiveRestPaceStampCountForTests() {
|
|
122
|
+
return lastRunAtByKey.size;
|
|
123
|
+
}
|
|
124
|
+
if (typeof window !== 'undefined') {
|
|
125
|
+
const win = window;
|
|
126
|
+
win.__disableKiyoKScriptLiveRestPace = () => {
|
|
127
|
+
setLocalKScriptLiveRestPaceDisabled(true);
|
|
128
|
+
return 'Kiyo kScript live-source rest-pacing floor DISABLED (drains dispatch per schedule)';
|
|
129
|
+
};
|
|
130
|
+
win.__enableKiyoKScriptLiveRestPace = () => {
|
|
131
|
+
setLocalKScriptLiveRestPaceDisabled(false);
|
|
132
|
+
return `Kiyo kScript live-source rest-pacing floor ENABLED (${LOCAL_KSCRIPT_LIVE_SOURCE_REST_REFRESH_MIN_INTERVAL_MS}ms at rest)`;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kScript live-source identity resolution: ONE authority for turning a source
|
|
3
|
+
* payload's symbol/exchange into the concrete identity it operates as.
|
|
4
|
+
*
|
|
5
|
+
* A v2 script-engine source payload may carry the literal placeholder strings
|
|
6
|
+
* `currentSymbol` / `currentExchange` instead of a concrete identity: the
|
|
7
|
+
* engine stores string-form declarations verbatim (`symbol="currentSymbol"`,
|
|
8
|
+
* the common form in v2-era community scripts and older saved CVD scripts),
|
|
9
|
+
* and only identifier-form declarations resolve at declaration time. Every
|
|
10
|
+
* consumer of these payloads must therefore resolve the placeholders against
|
|
11
|
+
* the chart identity before using them:
|
|
12
|
+
*
|
|
13
|
+
* - the engine dataFetch bridge (store/chart.ts) resolves them before fetching,
|
|
14
|
+
* - the live-feed subscription map (indicators/controls/technical-script)
|
|
15
|
+
* resolves them before subscribing, via resolveKScriptSourceIdentityValue,
|
|
16
|
+
* - the LIVE MESSAGE MATCH (services/live-feed.service.ts) resolves them here,
|
|
17
|
+
* via findAllMatchingKScriptLiveSourceSnapshots.
|
|
18
|
+
*
|
|
19
|
+
* The subscription and the match MUST share this resolver: the subscription
|
|
20
|
+
* decides which identity's messages arrive, the match decides whether they are
|
|
21
|
+
* accepted. When the two normalize differently (the 2026-07-26 field defect:
|
|
22
|
+
* the match compared the RAW payload strings), every message the subscription
|
|
23
|
+
* itself requested is rejected as `missing-source` forever, the indicator only
|
|
24
|
+
* advances on the ~30s source poll, and nothing can heal the loop because the
|
|
25
|
+
* declared-source gate forecloses the deeper lookups.
|
|
26
|
+
*/
|
|
27
|
+
export declare const KSCRIPT_CURRENT_SYMBOL_SENTINEL = "currentSymbol";
|
|
28
|
+
export declare const KSCRIPT_CURRENT_EXCHANGE_SENTINEL = "currentExchange";
|
|
29
|
+
/**
|
|
30
|
+
* Resolve one payload identity value. Placeholder strings resolve to the chart
|
|
31
|
+
* fallback (either placeholder is accepted for either field, mirroring the
|
|
32
|
+
* historical subscription resolver); empty/non-string values resolve to
|
|
33
|
+
* undefined (identity not pinned by the payload).
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveKScriptSourceIdentityValue(value: unknown, fallback: string | undefined): string | undefined;
|
|
36
|
+
export type KScriptLiveSourceIdentityContext = {
|
|
37
|
+
incomingExchange?: string;
|
|
38
|
+
incomingSymbol?: string;
|
|
39
|
+
chartMetadata?: {
|
|
40
|
+
exchange?: string;
|
|
41
|
+
symbol?: string;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* The chart symbol, set by the router ONLY when the incoming frame is the
|
|
45
|
+
* chart's own resolved lead contract (NQZ6 for an NQ1! chart,
|
|
46
|
+
* symbolsMatchForLiveFeed). A source resolved to the continuous root accepts
|
|
47
|
+
* that frame too; a source pinned to the concrete contract keeps matching
|
|
48
|
+
* the frame's own symbol. Never a rewrite of the frame: pinned-contract
|
|
49
|
+
* sources, the coalesce key and the ring keep the wire identity.
|
|
50
|
+
*/
|
|
51
|
+
leadAliasSymbol?: string;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Does a source payload's (resolved) identity accept a live message with the
|
|
55
|
+
* given series identity? Permissive on both sides: a payload that pins no
|
|
56
|
+
* symbol/exchange accepts any message (legacy behavior), and a missing
|
|
57
|
+
* incoming identity falls back to the chart identity.
|
|
58
|
+
*/
|
|
59
|
+
export declare function matchKScriptLiveSourcePayloadIdentity(payload: unknown, context: KScriptLiveSourceIdentityContext): boolean;
|
|
60
|
+
export type KScriptLiveSourceSnapshotLike = {
|
|
61
|
+
sourceName?: string;
|
|
62
|
+
sourceType?: string;
|
|
63
|
+
payload?: unknown;
|
|
64
|
+
data?: unknown[][];
|
|
65
|
+
};
|
|
66
|
+
export type KScriptLiveSourceMatch<T extends KScriptLiveSourceSnapshotLike> = T & {
|
|
67
|
+
sourceNames?: string | string[];
|
|
68
|
+
data: unknown[][];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Select every cached/worker source snapshot a live message can feed. One live
|
|
72
|
+
* message can feed SEVERAL mounted variants of the same source type (e.g.
|
|
73
|
+
* buy_sell_volume in coin AND currency=USD): matching only the first starves
|
|
74
|
+
* the others until the next historical refetch, freezing their forming bar at
|
|
75
|
+
* the zero-fill. Identity comparison goes through the shared resolver above so
|
|
76
|
+
* placeholder-carrying payloads match the messages their own subscription
|
|
77
|
+
* requested.
|
|
78
|
+
*/
|
|
79
|
+
export declare function findAllMatchingKScriptLiveSourceSnapshots<T extends KScriptLiveSourceSnapshotLike>(args: {
|
|
80
|
+
snapshots: T[] | undefined;
|
|
81
|
+
sourceType: string;
|
|
82
|
+
incomingExchange?: string;
|
|
83
|
+
incomingSymbol?: string;
|
|
84
|
+
chartMetadata?: {
|
|
85
|
+
exchange?: string;
|
|
86
|
+
symbol?: string;
|
|
87
|
+
};
|
|
88
|
+
leadAliasSymbol?: string;
|
|
89
|
+
includeData?: boolean;
|
|
90
|
+
}): KScriptLiveSourceMatch<T>[];
|
|
91
|
+
/**
|
|
92
|
+
* Whether the engine declares the source type at all (any identity). Splits
|
|
93
|
+
* the zero-match skip into its two honest reasons: `missing-source` (type not
|
|
94
|
+
* declared here, the routine cross-engine fan-out case) vs
|
|
95
|
+
* `source-identity-mismatch` (declared, but every variant rejected the
|
|
96
|
+
* message's series identity, the "lost" class a dump must surface).
|
|
97
|
+
*/
|
|
98
|
+
export declare function hasKScriptLiveSourceSnapshotOfType(snapshots: KScriptLiveSourceSnapshotLike[] | undefined, sourceType: string): boolean;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kScript live-source identity resolution: ONE authority for turning a source
|
|
3
|
+
* payload's symbol/exchange into the concrete identity it operates as.
|
|
4
|
+
*
|
|
5
|
+
* A v2 script-engine source payload may carry the literal placeholder strings
|
|
6
|
+
* `currentSymbol` / `currentExchange` instead of a concrete identity: the
|
|
7
|
+
* engine stores string-form declarations verbatim (`symbol="currentSymbol"`,
|
|
8
|
+
* the common form in v2-era community scripts and older saved CVD scripts),
|
|
9
|
+
* and only identifier-form declarations resolve at declaration time. Every
|
|
10
|
+
* consumer of these payloads must therefore resolve the placeholders against
|
|
11
|
+
* the chart identity before using them:
|
|
12
|
+
*
|
|
13
|
+
* - the engine dataFetch bridge (store/chart.ts) resolves them before fetching,
|
|
14
|
+
* - the live-feed subscription map (indicators/controls/technical-script)
|
|
15
|
+
* resolves them before subscribing, via resolveKScriptSourceIdentityValue,
|
|
16
|
+
* - the LIVE MESSAGE MATCH (services/live-feed.service.ts) resolves them here,
|
|
17
|
+
* via findAllMatchingKScriptLiveSourceSnapshots.
|
|
18
|
+
*
|
|
19
|
+
* The subscription and the match MUST share this resolver: the subscription
|
|
20
|
+
* decides which identity's messages arrive, the match decides whether they are
|
|
21
|
+
* accepted. When the two normalize differently (the 2026-07-26 field defect:
|
|
22
|
+
* the match compared the RAW payload strings), every message the subscription
|
|
23
|
+
* itself requested is rejected as `missing-source` forever, the indicator only
|
|
24
|
+
* advances on the ~30s source poll, and nothing can heal the loop because the
|
|
25
|
+
* declared-source gate forecloses the deeper lookups.
|
|
26
|
+
*/
|
|
27
|
+
export const KSCRIPT_CURRENT_SYMBOL_SENTINEL = 'currentSymbol';
|
|
28
|
+
export const KSCRIPT_CURRENT_EXCHANGE_SENTINEL = 'currentExchange';
|
|
29
|
+
/**
|
|
30
|
+
* Resolve one payload identity value. Placeholder strings resolve to the chart
|
|
31
|
+
* fallback (either placeholder is accepted for either field, mirroring the
|
|
32
|
+
* historical subscription resolver); empty/non-string values resolve to
|
|
33
|
+
* undefined (identity not pinned by the payload).
|
|
34
|
+
*/
|
|
35
|
+
export function resolveKScriptSourceIdentityValue(value, fallback) {
|
|
36
|
+
if (value === KSCRIPT_CURRENT_EXCHANGE_SENTINEL || value === KSCRIPT_CURRENT_SYMBOL_SENTINEL)
|
|
37
|
+
return fallback;
|
|
38
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Does a source payload's (resolved) identity accept a live message with the
|
|
42
|
+
* given series identity? Permissive on both sides: a payload that pins no
|
|
43
|
+
* symbol/exchange accepts any message (legacy behavior), and a missing
|
|
44
|
+
* incoming identity falls back to the chart identity.
|
|
45
|
+
*/
|
|
46
|
+
export function matchKScriptLiveSourcePayloadIdentity(payload, context) {
|
|
47
|
+
if (!payload || typeof payload !== 'object')
|
|
48
|
+
return true;
|
|
49
|
+
const record = payload;
|
|
50
|
+
const rawSymbol = record.symbol ?? record.sourceSymbol;
|
|
51
|
+
const rawExchange = record.exchange ?? record.sourceExchange;
|
|
52
|
+
// A placeholder PINS the identity to the chart's own series. When the chart
|
|
53
|
+
// identity is momentarily unknown (workspace switch/teardown window while
|
|
54
|
+
// the router still fans messages out), the pin is unsatisfiable and the
|
|
55
|
+
// message must be REJECTED, never accepted: fail-open here is the foreign-
|
|
56
|
+
// batch corruption class (a foreign close ratcheting a bar's high/low,
|
|
57
|
+
// permanent until refetch) that the raw-string comparison used to block by
|
|
58
|
+
// accident (review P3).
|
|
59
|
+
const symbolIsPlaceholder = rawSymbol === KSCRIPT_CURRENT_SYMBOL_SENTINEL || rawSymbol === KSCRIPT_CURRENT_EXCHANGE_SENTINEL;
|
|
60
|
+
const exchangeIsPlaceholder = rawExchange === KSCRIPT_CURRENT_EXCHANGE_SENTINEL || rawExchange === KSCRIPT_CURRENT_SYMBOL_SENTINEL;
|
|
61
|
+
if (symbolIsPlaceholder && !context.chartMetadata?.symbol)
|
|
62
|
+
return false;
|
|
63
|
+
if (exchangeIsPlaceholder && !context.chartMetadata?.exchange)
|
|
64
|
+
return false;
|
|
65
|
+
const sourceSymbol = resolveKScriptSourceIdentityValue(rawSymbol, context.chartMetadata?.symbol);
|
|
66
|
+
const sourceExchange = resolveKScriptSourceIdentityValue(rawExchange, context.chartMetadata?.exchange);
|
|
67
|
+
const expectedSymbol = context.incomingSymbol ?? context.chartMetadata?.symbol;
|
|
68
|
+
const expectedExchange = context.incomingExchange ?? context.chartMetadata?.exchange;
|
|
69
|
+
if (sourceSymbol &&
|
|
70
|
+
expectedSymbol &&
|
|
71
|
+
sourceSymbol !== expectedSymbol &&
|
|
72
|
+
!(context.leadAliasSymbol !== undefined && sourceSymbol === context.leadAliasSymbol)) {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
if (sourceExchange && expectedExchange && sourceExchange !== expectedExchange)
|
|
76
|
+
return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Select every cached/worker source snapshot a live message can feed. One live
|
|
81
|
+
* message can feed SEVERAL mounted variants of the same source type (e.g.
|
|
82
|
+
* buy_sell_volume in coin AND currency=USD): matching only the first starves
|
|
83
|
+
* the others until the next historical refetch, freezing their forming bar at
|
|
84
|
+
* the zero-fill. Identity comparison goes through the shared resolver above so
|
|
85
|
+
* placeholder-carrying payloads match the messages their own subscription
|
|
86
|
+
* requested.
|
|
87
|
+
*/
|
|
88
|
+
export function findAllMatchingKScriptLiveSourceSnapshots(args) {
|
|
89
|
+
const { snapshots, sourceType, incomingExchange, incomingSymbol, chartMetadata, leadAliasSymbol, includeData = true, } = args;
|
|
90
|
+
if (!Array.isArray(snapshots))
|
|
91
|
+
return [];
|
|
92
|
+
return snapshots
|
|
93
|
+
.filter((candidate) => {
|
|
94
|
+
if (candidate.sourceType !== sourceType)
|
|
95
|
+
return false;
|
|
96
|
+
return matchKScriptLiveSourcePayloadIdentity(candidate.payload, {
|
|
97
|
+
incomingExchange,
|
|
98
|
+
incomingSymbol,
|
|
99
|
+
chartMetadata,
|
|
100
|
+
leadAliasSymbol,
|
|
101
|
+
});
|
|
102
|
+
})
|
|
103
|
+
.filter((source) => Boolean(source.sourceName))
|
|
104
|
+
.map((source) => ({
|
|
105
|
+
...source,
|
|
106
|
+
sourceNames: source.sourceName,
|
|
107
|
+
data: includeData && Array.isArray(source.data) ? source.data : [],
|
|
108
|
+
}));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Whether the engine declares the source type at all (any identity). Splits
|
|
112
|
+
* the zero-match skip into its two honest reasons: `missing-source` (type not
|
|
113
|
+
* declared here, the routine cross-engine fan-out case) vs
|
|
114
|
+
* `source-identity-mismatch` (declared, but every variant rejected the
|
|
115
|
+
* message's series identity, the "lost" class a dump must surface).
|
|
116
|
+
*/
|
|
117
|
+
export function hasKScriptLiveSourceSnapshotOfType(snapshots, sourceType) {
|
|
118
|
+
return Array.isArray(snapshots)
|
|
119
|
+
? snapshots.some((snapshot) => snapshot.sourceType === sourceType && Boolean(snapshot.sourceName))
|
|
120
|
+
: false;
|
|
121
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export interface KScriptMountedOutputDescriptor {
|
|
2
|
+
key?: string;
|
|
3
|
+
plotType?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface KScriptIncomingLiveRefreshOutput {
|
|
6
|
+
key: string;
|
|
7
|
+
output: Record<string, unknown>;
|
|
8
|
+
descriptor: KScriptMountedOutputDescriptor;
|
|
9
|
+
rows?: unknown[][];
|
|
10
|
+
}
|
|
11
|
+
export declare function outputRows(output: unknown): unknown[][] | undefined;
|
|
12
|
+
export declare function outputDescriptor(output: unknown, fallbackKey?: string, options?: {
|
|
13
|
+
includeId?: boolean;
|
|
14
|
+
}): KScriptMountedOutputDescriptor;
|
|
15
|
+
export declare function runResultOutputEntries(runResult: unknown): Array<[string, Record<string, unknown>]>;
|
|
16
|
+
export declare function buildIncomingLiveRefreshOutputs(runResult: unknown): KScriptIncomingLiveRefreshOutput[];
|
|
17
|
+
export declare function findIncomingLiveRefreshOutput(outputByKey: Map<string, KScriptIncomingLiveRefreshOutput>, mountedOutput: Record<string, unknown>, options?: {
|
|
18
|
+
includeId?: boolean;
|
|
19
|
+
}): KScriptIncomingLiveRefreshOutput | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Incoming outputs (keys) the mounted-rows fast path cannot patch: no mounted
|
|
22
|
+
* row (parent or nested) matches their key / plot type, so a rows refresh would
|
|
23
|
+
* drop them. The local-run route treats a non-empty answer as plot-set growth
|
|
24
|
+
* and takes the remount (the field case: an order-book script whose fill
|
|
25
|
+
* plots only appear once the degraded book source lands). Same matching as
|
|
26
|
+
* the refresh plan, so the answer is exactly "what the plan would drop".
|
|
27
|
+
*/
|
|
28
|
+
export declare function kscriptRunResultOutputsWithoutMountedRow(meta: Record<string, unknown>, runResult: unknown): string[];
|
|
29
|
+
/**
|
|
30
|
+
* The prepared outputs of a run result no mounted row matches (container and
|
|
31
|
+
* known-unmountable keys aside): the plot-set GROWTH a range refresh cannot
|
|
32
|
+
* merge. Judged against the mount, never against the previous result: the
|
|
33
|
+
* engine's live tick posts only the outputs that changed, so the last
|
|
34
|
+
* integrated result is not the plot set (2026-09-14 field dump: one page
|
|
35
|
+
* remount per reload from that comparison).
|
|
36
|
+
*/
|
|
37
|
+
export declare function mountedPlotSetGrowth(meta: Record<string, unknown>, runResult: unknown, ignoreOutputKeys?: ReadonlySet<string>): string[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether a run result fits the MOUNTED plot set: none of its outputs lacks a
|
|
40
|
+
* mounted row (mountedPlotSetGrowth), and a result carrying no plot outputs
|
|
41
|
+
* fits a mount carrying no plots (drawings-only scripts). Growth only: a
|
|
42
|
+
* mounted plot the run stopped carrying (an hline a script prints on some
|
|
43
|
+
* windows only) keeps its rows through a merge exactly as it does through a
|
|
44
|
+
* live tick, and a script whose only plot is a known-unmountable anchor line
|
|
45
|
+
* (drawings-only scripts) has nothing to grow. Requiring every mounted plot
|
|
46
|
+
* in the result remounted both on every page (2026-09-14 05:26 dump).
|
|
47
|
+
*/
|
|
48
|
+
export declare function mountedPlotSetMatchesRunResult(meta: Record<string, unknown>, runResult: unknown, ignoreOutputKeys?: ReadonlySet<string>): boolean;
|