@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,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CME licensing allows governed market data in first-party display features
|
|
3
|
+
* only: user-authored kScript scripts must not consume it, while the built-in
|
|
4
|
+
* technical scripts, the converted-script corpus and OpenMarket's own official
|
|
5
|
+
* Indicator packages (all first-party) keep working. The OPRA licence (US
|
|
6
|
+
* equity and index options, Kyle 2026-10-14) draws the same line: chart-only
|
|
7
|
+
* first-party indicators are display use, user-authored scripting waits for
|
|
8
|
+
* OPRA's confirmation. Kyle 2026-10-17 assumed that confirmation behind the
|
|
9
|
+
* `opra-user-scripts` flag: while it is lit, a user run the browser executes
|
|
10
|
+
* reads OPRA like a first-party one (`isOpraUserScriptRun`, ONE decision for
|
|
11
|
+
* the display wall, the data wall and the engine policy; the CME plane never
|
|
12
|
+
* reads it). This module is the single decider for both planes.
|
|
13
|
+
* Every run door (add, mount, protected fetch, cache paint, alerts arm,
|
|
14
|
+
* editor Run), the per-payload data guard in titan-charts dataFetch, and the
|
|
15
|
+
* engine policy descriptor consult it; nothing else may re-derive provenance
|
|
16
|
+
* or the governed set.
|
|
17
|
+
*
|
|
18
|
+
* Browser-safe AND worker-safe: zero Vue / store / i18n imports. The
|
|
19
|
+
* store-reading overlay form lives in kscript-venue-policy.store.util.ts.
|
|
20
|
+
*/
|
|
21
|
+
export { isReservedKScriptProvenanceKey, KSCRIPT_RESERVED_PROVENANCE_KEYS } from './kscript-provenance-keys.util.js';
|
|
22
|
+
/**
|
|
23
|
+
* Where a technical-script run's source came from. Everything except 'user'
|
|
24
|
+
* is first-party and may consume governed data:
|
|
25
|
+
* - 'builtin-official': no customScriptId; the control resolves inline source
|
|
26
|
+
* by subType from TECHNICAL_INDICATOR_SCRIPTS.
|
|
27
|
+
* - 'converted-official': the converted- PineScript corpus (first-party
|
|
28
|
+
* authored, open visibility).
|
|
29
|
+
* - 'official-doc': a catalog document published by the official account
|
|
30
|
+
* (source 'official' at add time; persisted subType join key on restore).
|
|
31
|
+
* - 'official-wrun': an OFFICIAL Indicator package (wrun) from the registry,
|
|
32
|
+
* browser lane or hosted lane (isOfficialWrunOverlay).
|
|
33
|
+
* - 'user': community docs, editor drafts (TEMP_SCRIPT ids), community and
|
|
34
|
+
* marketplace Indicator packages, Indicator drafts, and anything
|
|
35
|
+
* unrecognized (fail closed).
|
|
36
|
+
*/
|
|
37
|
+
export type KScriptRunProvenance = 'builtin-official' | 'converted-official' | 'official-doc' | 'official-wrun' | 'user';
|
|
38
|
+
export interface KScriptProvenanceSettingsLike {
|
|
39
|
+
customScriptId?: unknown;
|
|
40
|
+
subType?: unknown;
|
|
41
|
+
/** Hosted-lane Indicator identity {package, version} (marketplace, or a registry package on Cloud). */
|
|
42
|
+
wrunRef?: unknown;
|
|
43
|
+
/** Browser-lane registry Indicator identity {package, version, position}. */
|
|
44
|
+
wrunRegistryRef?: unknown;
|
|
45
|
+
/** Editor-built Indicator draft identity (session-only, never official). */
|
|
46
|
+
wrunDraftRef?: unknown;
|
|
47
|
+
/** Persisted breadcrumb of the doc's catalog source (stamped on settings rebuild). */
|
|
48
|
+
scriptSource?: unknown;
|
|
49
|
+
/** Older persisted breadcrumb of the same fact (the slot-charge path's key, written
|
|
50
|
+
* on the settings rebuild long before scriptSource existed). Bare legacy `source`
|
|
51
|
+
* is deliberately NOT read: it is a common user script input name. */
|
|
52
|
+
catalogSource?: unknown;
|
|
53
|
+
/** Transient add-time doc (addScript passes the fetched document through). */
|
|
54
|
+
scriptData?: {
|
|
55
|
+
source?: string;
|
|
56
|
+
} | null;
|
|
57
|
+
/** A protected script: kscript-backend runs it, never the browser. */
|
|
58
|
+
isProtectedScript?: unknown;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* THE official-Indicator predicate of the CME wall (adjudicated 2026-09-30,
|
|
62
|
+
* Kyle): OpenMarket's own Indicator packages are exempt from the wall, while
|
|
63
|
+
* community packages and editor drafts stay refused exactly like user
|
|
64
|
+
* scripts. Both walls read it through the functions below (the display wall
|
|
65
|
+
* at the add, mount and operational doors, the data wall at the per-payload
|
|
66
|
+
* dataFetch door, the protected fetch funnel and the engine descriptor), so
|
|
67
|
+
* no door re-derives "official" on its own.
|
|
68
|
+
*
|
|
69
|
+
* "Official" is the registry catalog's own verdict (isWrunOfficialPackage,
|
|
70
|
+
* the classifier the Indicators tab groups its OpenMarket rows by), asked of
|
|
71
|
+
* the package COORDINATE the record resolves its code from. That anchor is
|
|
72
|
+
* what makes the exemption safe: the coordinate is not a display name, the
|
|
73
|
+
* official scope is reserved to the platform in the registry, and the bytes
|
|
74
|
+
* that run are whatever the registry serves under that coordinate, so a
|
|
75
|
+
* record cannot claim the scope and run other code. The publisher mark rides
|
|
76
|
+
* the listing row only (neither the version doc nor the overlay record
|
|
77
|
+
* carries it), so the scope is the whole verdict here: a package the registry
|
|
78
|
+
* marks `platform` outside the official scopes lists as official in the tab
|
|
79
|
+
* and stays walled on governed venues until its scope joins
|
|
80
|
+
* WRUN_OFFICIAL_SCOPES (fail closed).
|
|
81
|
+
*
|
|
82
|
+
* Fail closed on every other shape: an editor draft (`wrunDraftRef`, or a
|
|
83
|
+
* `wrun-draft-*` id) and a temp editor run are never packages, whatever rides
|
|
84
|
+
* beside them; EVERY package identity the record carries (the browser lane's
|
|
85
|
+
* `wrunRegistryRef`, the hosted lane's `wrunRef`, or the pair a Cloud-target
|
|
86
|
+
* Indicator carries) must name an official package; a ref with no package
|
|
87
|
+
* coordinate names no code and never qualifies.
|
|
88
|
+
*/
|
|
89
|
+
export declare function isOfficialWrunOverlay(settings: KScriptProvenanceSettingsLike | null | undefined): boolean;
|
|
90
|
+
export declare function resolveKScriptRunProvenance(settings: KScriptProvenanceSettingsLike | null | undefined): KScriptRunProvenance;
|
|
91
|
+
export declare function isFirstPartyKScriptRun(settings: KScriptProvenanceSettingsLike | null | undefined): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* A user run the browser executes: not first-party (a script or Indicator draft the viewer wrote, a community
|
|
94
|
+
* document or package, anything unrecognized), and neither a hosted Cloud run nor a protected script: those run on a
|
|
95
|
+
* server lane, which reads governed data through its own gate identity (UW-PARITY H3), so a browser flag never opens
|
|
96
|
+
* a plane to them. A Cloud run is the record on the socket row source (`wrunRowSourceKindOf`), read through the
|
|
97
|
+
* migration on read (`wrunCloudRecordOf`): the wave-3 record (`wrunRunTarget: 'cloud'`, no `wrunRef`) and a record
|
|
98
|
+
* persisted before wave 3 (`wrunRef`) alike. The runs the `opra-user-scripts` flag can open the OPRA plane to; read
|
|
99
|
+
* without the flag where a door must know a decision waits on it (the flag's hydration).
|
|
100
|
+
*/
|
|
101
|
+
export declare function isOpraUserScriptCandidate(settings: KScriptProvenanceSettingsLike | null | undefined): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Whether the `opra-user-scripts` flag (Kyle 2026-10-17: the OPRA permission for user-authored scripts assumed)
|
|
104
|
+
* opens the OPRA plane to this run: a browser user run (`isOpraUserScriptCandidate`) while the flag is lit. The ONE
|
|
105
|
+
* decision every OPRA door reads, directly or through the walls below: the display wall, the data wall (the
|
|
106
|
+
* dataFetch door, the protected pre-flight, the cache paint), the engine policy, and the wrun chain decision. The
|
|
107
|
+
* CME plane never reads it. The flag is read first: while it is dark (the default) no record is read at all.
|
|
108
|
+
*/
|
|
109
|
+
export declare function isOpraUserScriptRun(settings: KScriptProvenanceSettingsLike | null | undefined): boolean;
|
|
110
|
+
/** Whether a run may consume the OPRA plane's data: every first-party run, and a user run the flag opened it to
|
|
111
|
+
* (`mayReadOpra`, the one decision the wrun run head and every source lane read too). */
|
|
112
|
+
export declare function isOpraReadableKScriptRun(settings: KScriptProvenanceSettingsLike | null | undefined): boolean;
|
|
113
|
+
/** Whether a source exchange touches a CME-governed venue (the CME-only curation and copy). */
|
|
114
|
+
export declare function payloadTouchesCmeVenue(exchange: unknown): boolean;
|
|
115
|
+
/** Whether a source exchange touches the OPRA options plane (an explicit OPRA leg on any chart included). */
|
|
116
|
+
export declare function payloadTouchesOpraVenue(exchange: unknown): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Whether a source exchange (string or the multi-exchange array form) touches
|
|
119
|
+
* a governed venue on any gate plane (CME futures, OPRA options).
|
|
120
|
+
* Deliberately NOT governed-route.util's isGovernedExchange /
|
|
121
|
+
* isGovernedReaderPayload: their array form uses .every() because that is
|
|
122
|
+
* ROUTING semantics (a mixed multi-exchange metadata query must keep the
|
|
123
|
+
* ungated reader). This is BLOCKING semantics: a mixed query with one
|
|
124
|
+
* governed leg must block, so the array form is .some().
|
|
125
|
+
*/
|
|
126
|
+
export declare function payloadTouchesGovernedVenue(exchange: unknown): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* DATA-wall door predicate: user-authored run targeting a governed venue.
|
|
129
|
+
* Still the right check for the data-plane guards (the data-fetching funnel,
|
|
130
|
+
* the cache-paint overlay form): those enforce the licensing boundary, which
|
|
131
|
+
* first-party officials legitimately pass. The OPERATIONAL doors (add, mount,
|
|
132
|
+
* teardown, resubscribe, self-heal, suite/layout/copy apply) consult
|
|
133
|
+
* isKScriptDisplayBlockedOnExchange below instead, which is a strict superset
|
|
134
|
+
* of this predicate. Per plane: a CME leg blocks every user run; an OPRA leg
|
|
135
|
+
* blocks a user run unless the `opra-user-scripts` flag opened the plane to it
|
|
136
|
+
* (`isOpraReadableKScriptRun`).
|
|
137
|
+
*/
|
|
138
|
+
export declare function isUserKScriptBlockedOnExchange(exchange: unknown, settings: KScriptProvenanceSettingsLike | null | undefined): boolean;
|
|
139
|
+
/**
|
|
140
|
+
* DISPLAY wall: whether a kScript run may mount and render on a governed
|
|
141
|
+
* venue at all. Distinct from the DATA wall (isFirstPartyKScriptRun /
|
|
142
|
+
* shouldBlockKScriptSourcePayload / buildKScriptDataAccessPolicy): the data
|
|
143
|
+
* wall answers "may this code consume governed market data" (a licensing
|
|
144
|
+
* boundary keyed on run provenance), while this predicate answers "is this
|
|
145
|
+
* indicator approved to appear on a governed chart" (product curation keyed
|
|
146
|
+
* on exact identity). A first-party official doc that is missing from the
|
|
147
|
+
* CME allow-list legitimately HOLDS governed data access yet must still be
|
|
148
|
+
* disabled on governed venues, exactly like a user script: hidden plot,
|
|
149
|
+
* standing venue message, no engine, no fetch, no live feed. This predicate
|
|
150
|
+
* therefore must never be used to grant or revoke governed DATA access; the
|
|
151
|
+
* data-plane guards keep consulting the data wall unchanged.
|
|
152
|
+
*
|
|
153
|
+
* Verdict: on a governed venue a run is venue-approved only when it is
|
|
154
|
+
* first-party AND classifyOfficialScriptForCme recognizes its exact identity
|
|
155
|
+
* (registry subType or catalog script id) as 'allowed'. Official Indicator
|
|
156
|
+
* packages (isOfficialWrunOverlay) are venue-approved as a CLASS, with no
|
|
157
|
+
* per-package list: the 2026-09-30 exemption covers every package of the
|
|
158
|
+
* official library, and a package that reads a source the venue does not
|
|
159
|
+
* serve answers through the wrun lane's own missing-data states. A PROVEN
|
|
160
|
+
* twin of a built-in (builtin-identity.util) draws there only when its
|
|
161
|
+
* built-in is proven on CME (CME_PROVEN_TWIN_BUILTIN_KEYS), the only twins
|
|
162
|
+
* the add route mounts on a governed venue; a twin of any other built-in
|
|
163
|
+
* carried there (an in-place symbol switch, a restore, a paste or copy) is
|
|
164
|
+
* blocked. User-provenance
|
|
165
|
+
* runs are never venue-approved, so this is a strict superset of
|
|
166
|
+
* isUserKScriptBlockedOnExchange. Fail-closed both ways: an unrecognized
|
|
167
|
+
* official blocks, and provenance spoofing via script-input names is already
|
|
168
|
+
* neutralized upstream by KSCRIPT_RESERVED_PROVENANCE_KEYS (a spoofed run
|
|
169
|
+
* classifies 'user' and is never approved regardless of claimed keys).
|
|
170
|
+
*
|
|
171
|
+
* OPRA (no CME leg): every first-party run is explicitly venue-approved, the
|
|
172
|
+
* built-ins, the converted corpus, the official docs and the official
|
|
173
|
+
* packages alike (chart-only display use under the OPRA licence), and every
|
|
174
|
+
* user run is blocked unless the `opra-user-scripts` flag opened the plane to
|
|
175
|
+
* it (the data wall's own per-plane verdict, so the two walls read one flag
|
|
176
|
+
* decision). The CME per-script curation is CME evidence and does not apply
|
|
177
|
+
* there; a book-reading official is refused by the options mode (OPRA has no
|
|
178
|
+
* book), not by this wall.
|
|
179
|
+
*/
|
|
180
|
+
export declare function isKScriptDisplayBlockedOnExchange(exchange: unknown, settings: KScriptProvenanceSettingsLike | null | undefined): boolean;
|
|
181
|
+
/**
|
|
182
|
+
* Per-payload decision for the titan-charts dataFetch door, evaluated AFTER
|
|
183
|
+
* placeholder resolution (the payload exchange is final there). Polling
|
|
184
|
+
* cycles deny silently with empty rows: useDataPolling warns per tick on
|
|
185
|
+
* rejections, and a policy block is a standing state, not an incident.
|
|
186
|
+
*/
|
|
187
|
+
export declare function shouldBlockKScriptSourcePayload(args: {
|
|
188
|
+
payloadExchange: unknown;
|
|
189
|
+
settings: KScriptProvenanceSettingsLike | null | undefined;
|
|
190
|
+
isPolling: boolean;
|
|
191
|
+
/** The whole source payload, when the door has it: an ask naming the OPRA plane it reads beyond its exchange
|
|
192
|
+
* (`wrunPlane: 'opra'`, a wrun lane reading a stock chart's options on the native-rows path, whose exchange
|
|
193
|
+
* is the stock's) is judged as an OPRA one, by the same decision (`isOpraReadableKScriptRun`). */
|
|
194
|
+
payload?: unknown;
|
|
195
|
+
}): 'allow' | 'deny-throw' | 'deny-silent';
|
|
196
|
+
/**
|
|
197
|
+
* Serializable policy descriptor handed to the local engine worker (functions
|
|
198
|
+
* cannot cross the structured-clone boundary). The worker converts it for the
|
|
199
|
+
* engine: first-party runs get no engine policy at all; user runs get the
|
|
200
|
+
* governed set of every gate plane as deniedExchanges once the engine pin
|
|
201
|
+
* supports it, so a user script on a crypto chart cannot pull an explicit
|
|
202
|
+
* OPRA source either, unless the `opra-user-scripts` flag opened the OPRA
|
|
203
|
+
* plane to the run (`isOpraUserScriptRun`): its set is then the CME family alone.
|
|
204
|
+
*/
|
|
205
|
+
export interface KScriptDataAccessPolicyDescriptor {
|
|
206
|
+
governedExchanges: readonly string[];
|
|
207
|
+
firstPartyRun: boolean;
|
|
208
|
+
}
|
|
209
|
+
export declare function buildKScriptDataAccessPolicy(settings: KScriptProvenanceSettingsLike | null | undefined): KScriptDataAccessPolicyDescriptor;
|
|
210
|
+
/**
|
|
211
|
+
* Cross-repo error contract: every venue-policy denial, FE-thrown or
|
|
212
|
+
* engine-thrown, embeds this literal token so the kScript error envelope
|
|
213
|
+
* classifies it VENUE_BLOCKED (deterministic, never retried).
|
|
214
|
+
*/
|
|
215
|
+
export declare const KSCRIPT_VENUE_BLOCKED_MARKER = "kscript_venue_blocked";
|
|
216
|
+
export declare function createKScriptVenueBlockedError(exchange: string): Error;
|
|
217
|
+
export declare function isKScriptVenueBlockedError(error: unknown): boolean;
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CME licensing allows governed market data in first-party display features
|
|
3
|
+
* only: user-authored kScript scripts must not consume it, while the built-in
|
|
4
|
+
* technical scripts, the converted-script corpus and OpenMarket's own official
|
|
5
|
+
* Indicator packages (all first-party) keep working. The OPRA licence (US
|
|
6
|
+
* equity and index options, Kyle 2026-10-14) draws the same line: chart-only
|
|
7
|
+
* first-party indicators are display use, user-authored scripting waits for
|
|
8
|
+
* OPRA's confirmation. Kyle 2026-10-17 assumed that confirmation behind the
|
|
9
|
+
* `opra-user-scripts` flag: while it is lit, a user run the browser executes
|
|
10
|
+
* reads OPRA like a first-party one (`isOpraUserScriptRun`, ONE decision for
|
|
11
|
+
* the display wall, the data wall and the engine policy; the CME plane never
|
|
12
|
+
* reads it). This module is the single decider for both planes.
|
|
13
|
+
* Every run door (add, mount, protected fetch, cache paint, alerts arm,
|
|
14
|
+
* editor Run), the per-payload data guard in titan-charts dataFetch, and the
|
|
15
|
+
* engine policy descriptor consult it; nothing else may re-derive provenance
|
|
16
|
+
* or the governed set.
|
|
17
|
+
*
|
|
18
|
+
* Browser-safe AND worker-safe: zero Vue / store / i18n imports. The
|
|
19
|
+
* store-reading overlay form lives in kscript-venue-policy.store.util.ts.
|
|
20
|
+
*/
|
|
21
|
+
import { CME_GOVERNED_EXCHANGES } from '../../interfaces/cme-realtime.interface.js';
|
|
22
|
+
import { OPRA_GOVERNED_EXCHANGES } from '../../interfaces/opra-realtime.interface.js';
|
|
23
|
+
import { isCmeFuturesPolicyActive } from './marketKind.util.js';
|
|
24
|
+
import { isOpraGoverned } from '../v2/gate-plane.util.js';
|
|
25
|
+
import { isConvertedScriptId } from '../../constants/scriptEditor/converted-script-id.leaf.js';
|
|
26
|
+
import { isTempScriptId } from '../scriptEditor/temp-script-id.util.js';
|
|
27
|
+
import { TECHNICAL_INDICATOR_SCRIPT_KEY_SET } from '../../constants/scriptEditor/technicalIndicatorScriptKeys.constants.js';
|
|
28
|
+
import { classifyOfficialScriptForCme, isCmeFirstPartyOfficialDocId, isCmeProvenTwinBuiltIn, } from '../../constants/scriptEditor/cme-official-scripts.constants.js';
|
|
29
|
+
// Leaf modules (no imports of their own), so this file stays worker-safe.
|
|
30
|
+
import { isWrunDraftScriptId } from '../wrun/wrun-draft-overlay.util.js';
|
|
31
|
+
import { isWrunOfficialPackage } from '../wrun/wrun-official-scope.leaf.js';
|
|
32
|
+
// Worker-safe too: it reads the twin stamp, the registry ref and the built-in keys alone.
|
|
33
|
+
import { builtinIdentityOf } from './builtin-identity.util.js';
|
|
34
|
+
// Dependency-free: the flag store hands the flag's live readers to it (no store import here).
|
|
35
|
+
import { isOpraUserScriptsFlagOn } from './opra-user-scripts-gate.util.js';
|
|
36
|
+
// Leaf module (no imports): the row source a record runs on (a Cloud record rides the socket source).
|
|
37
|
+
import { wrunRowSourceKindOf } from '../wrun/wrun-overlay-identity.util.js';
|
|
38
|
+
// Near-leaf (the identity leaf only): the migration on read of a record persisted before lane parity wave 3.
|
|
39
|
+
import { wrunCloudRecordOf } from '../wrun/wrun-cloud-record.util.js';
|
|
40
|
+
// Import-free: the one OPRA read decision every door reads (the wrun lane planners too).
|
|
41
|
+
import { mayReadOpra, payloadReadsOpraPlane } from './opra-read-access.leaf.js';
|
|
42
|
+
// The provenance keys are the pure leaf's (kscript-provenance-keys.util); their importers keep this path.
|
|
43
|
+
export { isReservedKScriptProvenanceKey, KSCRIPT_RESERVED_PROVENANCE_KEYS } from './kscript-provenance-keys.util.js';
|
|
44
|
+
/** The registry coordinate (`@scope/name`) a wrun identity ref names, or undefined. */
|
|
45
|
+
function wrunRefPackageName(ref) {
|
|
46
|
+
if (!ref || typeof ref !== 'object')
|
|
47
|
+
return undefined;
|
|
48
|
+
const packageName = ref.package;
|
|
49
|
+
return typeof packageName === 'string' && packageName.length > 0 ? packageName : undefined;
|
|
50
|
+
}
|
|
51
|
+
/** Whether the record carries ANY Indicator (wrun) identity: hosted, registry or draft. */
|
|
52
|
+
function carriesWrunIdentity(settings) {
|
|
53
|
+
return Boolean(settings.wrunRef || settings.wrunRegistryRef || settings.wrunDraftRef);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* THE official-Indicator predicate of the CME wall (adjudicated 2026-09-30,
|
|
57
|
+
* Kyle): OpenMarket's own Indicator packages are exempt from the wall, while
|
|
58
|
+
* community packages and editor drafts stay refused exactly like user
|
|
59
|
+
* scripts. Both walls read it through the functions below (the display wall
|
|
60
|
+
* at the add, mount and operational doors, the data wall at the per-payload
|
|
61
|
+
* dataFetch door, the protected fetch funnel and the engine descriptor), so
|
|
62
|
+
* no door re-derives "official" on its own.
|
|
63
|
+
*
|
|
64
|
+
* "Official" is the registry catalog's own verdict (isWrunOfficialPackage,
|
|
65
|
+
* the classifier the Indicators tab groups its OpenMarket rows by), asked of
|
|
66
|
+
* the package COORDINATE the record resolves its code from. That anchor is
|
|
67
|
+
* what makes the exemption safe: the coordinate is not a display name, the
|
|
68
|
+
* official scope is reserved to the platform in the registry, and the bytes
|
|
69
|
+
* that run are whatever the registry serves under that coordinate, so a
|
|
70
|
+
* record cannot claim the scope and run other code. The publisher mark rides
|
|
71
|
+
* the listing row only (neither the version doc nor the overlay record
|
|
72
|
+
* carries it), so the scope is the whole verdict here: a package the registry
|
|
73
|
+
* marks `platform` outside the official scopes lists as official in the tab
|
|
74
|
+
* and stays walled on governed venues until its scope joins
|
|
75
|
+
* WRUN_OFFICIAL_SCOPES (fail closed).
|
|
76
|
+
*
|
|
77
|
+
* Fail closed on every other shape: an editor draft (`wrunDraftRef`, or a
|
|
78
|
+
* `wrun-draft-*` id) and a temp editor run are never packages, whatever rides
|
|
79
|
+
* beside them; EVERY package identity the record carries (the browser lane's
|
|
80
|
+
* `wrunRegistryRef`, the hosted lane's `wrunRef`, or the pair a Cloud-target
|
|
81
|
+
* Indicator carries) must name an official package; a ref with no package
|
|
82
|
+
* coordinate names no code and never qualifies.
|
|
83
|
+
*/
|
|
84
|
+
export function isOfficialWrunOverlay(settings) {
|
|
85
|
+
if (!settings || settings.wrunDraftRef)
|
|
86
|
+
return false;
|
|
87
|
+
const customScriptId = typeof settings.customScriptId === 'string' ? settings.customScriptId : undefined;
|
|
88
|
+
if (isWrunDraftScriptId(customScriptId) || isTempScriptId(customScriptId))
|
|
89
|
+
return false;
|
|
90
|
+
const refs = [settings.wrunRegistryRef, settings.wrunRef].filter(Boolean);
|
|
91
|
+
if (refs.length === 0)
|
|
92
|
+
return false;
|
|
93
|
+
return refs.every((ref) => {
|
|
94
|
+
const packageName = wrunRefPackageName(ref);
|
|
95
|
+
return packageName !== undefined && isWrunOfficialPackage(packageName, null);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export function resolveKScriptRunProvenance(settings) {
|
|
99
|
+
if (!settings)
|
|
100
|
+
return 'builtin-official';
|
|
101
|
+
const customScriptId = typeof settings.customScriptId === 'string' ? settings.customScriptId : undefined;
|
|
102
|
+
if (isOfficialWrunOverlay(settings))
|
|
103
|
+
return 'official-wrun';
|
|
104
|
+
// Every other Indicator identity is user code, whatever breadcrumb or
|
|
105
|
+
// claimed id rides beside it: the package ref decides which code runs.
|
|
106
|
+
if (carriesWrunIdentity(settings))
|
|
107
|
+
return 'user';
|
|
108
|
+
if (isTempScriptId(customScriptId))
|
|
109
|
+
return 'user';
|
|
110
|
+
if (isConvertedScriptId(customScriptId))
|
|
111
|
+
return 'converted-official';
|
|
112
|
+
if (!customScriptId) {
|
|
113
|
+
// Builtin lane: the registry is the authority on what a builtin is. A
|
|
114
|
+
// subType that is present but NOT a registry key cannot mint first-party
|
|
115
|
+
// provenance (a spoofed or legacy-poisoned value fails closed as 'user');
|
|
116
|
+
// absent subType stays builtin-official for the inline built-in adds that
|
|
117
|
+
// never stamp one.
|
|
118
|
+
if (settings.subType === undefined || settings.subType === null)
|
|
119
|
+
return 'builtin-official';
|
|
120
|
+
return typeof settings.subType === 'string' && TECHNICAL_INDICATOR_SCRIPT_KEY_SET.has(settings.subType)
|
|
121
|
+
? 'builtin-official'
|
|
122
|
+
: 'user';
|
|
123
|
+
}
|
|
124
|
+
if (settings.scriptData?.source === 'official')
|
|
125
|
+
return 'official-doc';
|
|
126
|
+
if (settings.scriptSource === 'official')
|
|
127
|
+
return 'official-doc';
|
|
128
|
+
// catalogSource is the pre-existing persisted breadcrumb (slot-charge path);
|
|
129
|
+
// recognizing it keeps restored layouts/workspaces that predate scriptSource
|
|
130
|
+
// classifying first-party. It is reserved against input-name spoofing below.
|
|
131
|
+
if (settings.catalogSource === 'official')
|
|
132
|
+
return 'official-doc';
|
|
133
|
+
if (typeof settings.subType === 'string' && TECHNICAL_INDICATOR_SCRIPT_KEY_SET.has(settings.subType)) {
|
|
134
|
+
return 'official-doc';
|
|
135
|
+
}
|
|
136
|
+
return 'user';
|
|
137
|
+
}
|
|
138
|
+
export function isFirstPartyKScriptRun(settings) {
|
|
139
|
+
if (resolveKScriptRunProvenance(settings) !== 'user')
|
|
140
|
+
return true;
|
|
141
|
+
// First-party official docs pass by EXACT doc id even when the breadcrumb stamps are
|
|
142
|
+
// missing (add-time fetch races the settings rebuild; see isCmeFirstPartyOfficialDocId).
|
|
143
|
+
// The id is the same trust level as the persisted scriptSource breadcrumb: both live in
|
|
144
|
+
// overlay settings, and the id additionally names which doc's code the run resolves —
|
|
145
|
+
// which is why wrun runs are excluded: their code comes from the package ref (hosted,
|
|
146
|
+
// registry or draft), so a claimed customScriptId names nothing there.
|
|
147
|
+
if (settings && carriesWrunIdentity(settings))
|
|
148
|
+
return false;
|
|
149
|
+
return isCmeFirstPartyOfficialDocId(settings?.customScriptId);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* A user run the browser executes: not first-party (a script or Indicator draft the viewer wrote, a community
|
|
153
|
+
* document or package, anything unrecognized), and neither a hosted Cloud run nor a protected script: those run on a
|
|
154
|
+
* server lane, which reads governed data through its own gate identity (UW-PARITY H3), so a browser flag never opens
|
|
155
|
+
* a plane to them. A Cloud run is the record on the socket row source (`wrunRowSourceKindOf`), read through the
|
|
156
|
+
* migration on read (`wrunCloudRecordOf`): the wave-3 record (`wrunRunTarget: 'cloud'`, no `wrunRef`) and a record
|
|
157
|
+
* persisted before wave 3 (`wrunRef`) alike. The runs the `opra-user-scripts` flag can open the OPRA plane to; read
|
|
158
|
+
* without the flag where a door must know a decision waits on it (the flag's hydration).
|
|
159
|
+
*/
|
|
160
|
+
export function isOpraUserScriptCandidate(settings) {
|
|
161
|
+
if (!settings || isFirstPartyKScriptRun(settings))
|
|
162
|
+
return false;
|
|
163
|
+
if (wrunRowSourceKindOf(wrunCloudRecordOf(settings) ?? settings) === 'socket')
|
|
164
|
+
return false;
|
|
165
|
+
return settings.isProtectedScript !== true;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Whether the `opra-user-scripts` flag (Kyle 2026-10-17: the OPRA permission for user-authored scripts assumed)
|
|
169
|
+
* opens the OPRA plane to this run: a browser user run (`isOpraUserScriptCandidate`) while the flag is lit. The ONE
|
|
170
|
+
* decision every OPRA door reads, directly or through the walls below: the display wall, the data wall (the
|
|
171
|
+
* dataFetch door, the protected pre-flight, the cache paint), the engine policy, and the wrun chain decision. The
|
|
172
|
+
* CME plane never reads it. The flag is read first: while it is dark (the default) no record is read at all.
|
|
173
|
+
*/
|
|
174
|
+
export function isOpraUserScriptRun(settings) {
|
|
175
|
+
return isOpraUserScriptsFlagOn() && isOpraUserScriptCandidate(settings);
|
|
176
|
+
}
|
|
177
|
+
/** Whether a run may consume the OPRA plane's data: every first-party run, and a user run the flag opened it to
|
|
178
|
+
* (`mayReadOpra`, the one decision the wrun run head and every source lane read too). */
|
|
179
|
+
export function isOpraReadableKScriptRun(settings) {
|
|
180
|
+
return mayReadOpra({ official: isFirstPartyKScriptRun(settings), opraUserScripts: isOpraUserScriptRun(settings) });
|
|
181
|
+
}
|
|
182
|
+
/** BLOCKING semantics over a source exchange (string, or the array form with .some()). */
|
|
183
|
+
function payloadTouches(exchange, governed) {
|
|
184
|
+
if (Array.isArray(exchange))
|
|
185
|
+
return exchange.some((entry) => typeof entry === 'string' && governed(entry));
|
|
186
|
+
return typeof exchange === 'string' && governed(exchange);
|
|
187
|
+
}
|
|
188
|
+
/** Whether a source exchange touches a CME-governed venue (the CME-only curation and copy). */
|
|
189
|
+
export function payloadTouchesCmeVenue(exchange) {
|
|
190
|
+
return payloadTouches(exchange, isCmeFuturesPolicyActive);
|
|
191
|
+
}
|
|
192
|
+
/** Whether a source exchange touches the OPRA options plane (an explicit OPRA leg on any chart included). */
|
|
193
|
+
export function payloadTouchesOpraVenue(exchange) {
|
|
194
|
+
return payloadTouches(exchange, isOpraGoverned);
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Whether a source exchange (string or the multi-exchange array form) touches
|
|
198
|
+
* a governed venue on any gate plane (CME futures, OPRA options).
|
|
199
|
+
* Deliberately NOT governed-route.util's isGovernedExchange /
|
|
200
|
+
* isGovernedReaderPayload: their array form uses .every() because that is
|
|
201
|
+
* ROUTING semantics (a mixed multi-exchange metadata query must keep the
|
|
202
|
+
* ungated reader). This is BLOCKING semantics: a mixed query with one
|
|
203
|
+
* governed leg must block, so the array form is .some().
|
|
204
|
+
*/
|
|
205
|
+
export function payloadTouchesGovernedVenue(exchange) {
|
|
206
|
+
return payloadTouchesCmeVenue(exchange) || payloadTouchesOpraVenue(exchange);
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* DATA-wall door predicate: user-authored run targeting a governed venue.
|
|
210
|
+
* Still the right check for the data-plane guards (the data-fetching funnel,
|
|
211
|
+
* the cache-paint overlay form): those enforce the licensing boundary, which
|
|
212
|
+
* first-party officials legitimately pass. The OPERATIONAL doors (add, mount,
|
|
213
|
+
* teardown, resubscribe, self-heal, suite/layout/copy apply) consult
|
|
214
|
+
* isKScriptDisplayBlockedOnExchange below instead, which is a strict superset
|
|
215
|
+
* of this predicate. Per plane: a CME leg blocks every user run; an OPRA leg
|
|
216
|
+
* blocks a user run unless the `opra-user-scripts` flag opened the plane to it
|
|
217
|
+
* (`isOpraReadableKScriptRun`).
|
|
218
|
+
*/
|
|
219
|
+
export function isUserKScriptBlockedOnExchange(exchange, settings) {
|
|
220
|
+
if (payloadTouchesCmeVenue(exchange) && !isFirstPartyKScriptRun(settings))
|
|
221
|
+
return true;
|
|
222
|
+
return payloadTouchesOpraVenue(exchange) && !isOpraReadableKScriptRun(settings);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* DISPLAY wall: whether a kScript run may mount and render on a governed
|
|
226
|
+
* venue at all. Distinct from the DATA wall (isFirstPartyKScriptRun /
|
|
227
|
+
* shouldBlockKScriptSourcePayload / buildKScriptDataAccessPolicy): the data
|
|
228
|
+
* wall answers "may this code consume governed market data" (a licensing
|
|
229
|
+
* boundary keyed on run provenance), while this predicate answers "is this
|
|
230
|
+
* indicator approved to appear on a governed chart" (product curation keyed
|
|
231
|
+
* on exact identity). A first-party official doc that is missing from the
|
|
232
|
+
* CME allow-list legitimately HOLDS governed data access yet must still be
|
|
233
|
+
* disabled on governed venues, exactly like a user script: hidden plot,
|
|
234
|
+
* standing venue message, no engine, no fetch, no live feed. This predicate
|
|
235
|
+
* therefore must never be used to grant or revoke governed DATA access; the
|
|
236
|
+
* data-plane guards keep consulting the data wall unchanged.
|
|
237
|
+
*
|
|
238
|
+
* Verdict: on a governed venue a run is venue-approved only when it is
|
|
239
|
+
* first-party AND classifyOfficialScriptForCme recognizes its exact identity
|
|
240
|
+
* (registry subType or catalog script id) as 'allowed'. Official Indicator
|
|
241
|
+
* packages (isOfficialWrunOverlay) are venue-approved as a CLASS, with no
|
|
242
|
+
* per-package list: the 2026-09-30 exemption covers every package of the
|
|
243
|
+
* official library, and a package that reads a source the venue does not
|
|
244
|
+
* serve answers through the wrun lane's own missing-data states. A PROVEN
|
|
245
|
+
* twin of a built-in (builtin-identity.util) draws there only when its
|
|
246
|
+
* built-in is proven on CME (CME_PROVEN_TWIN_BUILTIN_KEYS), the only twins
|
|
247
|
+
* the add route mounts on a governed venue; a twin of any other built-in
|
|
248
|
+
* carried there (an in-place symbol switch, a restore, a paste or copy) is
|
|
249
|
+
* blocked. User-provenance
|
|
250
|
+
* runs are never venue-approved, so this is a strict superset of
|
|
251
|
+
* isUserKScriptBlockedOnExchange. Fail-closed both ways: an unrecognized
|
|
252
|
+
* official blocks, and provenance spoofing via script-input names is already
|
|
253
|
+
* neutralized upstream by KSCRIPT_RESERVED_PROVENANCE_KEYS (a spoofed run
|
|
254
|
+
* classifies 'user' and is never approved regardless of claimed keys).
|
|
255
|
+
*
|
|
256
|
+
* OPRA (no CME leg): every first-party run is explicitly venue-approved, the
|
|
257
|
+
* built-ins, the converted corpus, the official docs and the official
|
|
258
|
+
* packages alike (chart-only display use under the OPRA licence), and every
|
|
259
|
+
* user run is blocked unless the `opra-user-scripts` flag opened the plane to
|
|
260
|
+
* it (the data wall's own per-plane verdict, so the two walls read one flag
|
|
261
|
+
* decision). The CME per-script curation is CME evidence and does not apply
|
|
262
|
+
* there; a book-reading official is refused by the options mode (OPRA has no
|
|
263
|
+
* book), not by this wall.
|
|
264
|
+
*/
|
|
265
|
+
export function isKScriptDisplayBlockedOnExchange(exchange, settings) {
|
|
266
|
+
if (!payloadTouchesGovernedVenue(exchange))
|
|
267
|
+
return false;
|
|
268
|
+
if (isUserKScriptBlockedOnExchange(exchange, settings))
|
|
269
|
+
return true;
|
|
270
|
+
// Past the data wall a CME leg means a first-party run: its curation decides.
|
|
271
|
+
if (!payloadTouchesCmeVenue(exchange))
|
|
272
|
+
return false;
|
|
273
|
+
const builtin = builtinIdentityOf(settings);
|
|
274
|
+
if (builtin?.kind === 'twin')
|
|
275
|
+
return !isCmeProvenTwinBuiltIn(builtin.key);
|
|
276
|
+
if (isOfficialWrunOverlay(settings))
|
|
277
|
+
return false;
|
|
278
|
+
return (classifyOfficialScriptForCme({
|
|
279
|
+
keys: [
|
|
280
|
+
typeof settings?.subType === 'string' ? settings.subType : undefined,
|
|
281
|
+
typeof settings?.customScriptId === 'string' ? settings.customScriptId : undefined,
|
|
282
|
+
],
|
|
283
|
+
}) !== 'allowed');
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Per-payload decision for the titan-charts dataFetch door, evaluated AFTER
|
|
287
|
+
* placeholder resolution (the payload exchange is final there). Polling
|
|
288
|
+
* cycles deny silently with empty rows: useDataPolling warns per tick on
|
|
289
|
+
* rejections, and a policy block is a standing state, not an incident.
|
|
290
|
+
*/
|
|
291
|
+
export function shouldBlockKScriptSourcePayload(args) {
|
|
292
|
+
// The data wall's per-plane verdict: an OPRA source a flag-opened user run declares is served.
|
|
293
|
+
const blocked = isUserKScriptBlockedOnExchange(args.payloadExchange, args.settings) ||
|
|
294
|
+
(payloadReadsOpraPlane(args.payload) && !isOpraReadableKScriptRun(args.settings));
|
|
295
|
+
if (!blocked)
|
|
296
|
+
return 'allow';
|
|
297
|
+
return args.isPolling ? 'deny-silent' : 'deny-throw';
|
|
298
|
+
}
|
|
299
|
+
/** Every gate plane's exchanges: the set a user run is denied (the CME family and OPRA). */
|
|
300
|
+
const ENGINE_GOVERNED_EXCHANGES = Object.freeze([
|
|
301
|
+
...CME_GOVERNED_EXCHANGES,
|
|
302
|
+
...OPRA_GOVERNED_EXCHANGES,
|
|
303
|
+
]);
|
|
304
|
+
/** The CME family alone: the set a user run the `opra-user-scripts` flag opened OPRA to is denied. */
|
|
305
|
+
const ENGINE_CME_GOVERNED_EXCHANGES = Object.freeze([...CME_GOVERNED_EXCHANGES]);
|
|
306
|
+
export function buildKScriptDataAccessPolicy(settings) {
|
|
307
|
+
return {
|
|
308
|
+
governedExchanges: isOpraUserScriptRun(settings) ? ENGINE_CME_GOVERNED_EXCHANGES : ENGINE_GOVERNED_EXCHANGES,
|
|
309
|
+
firstPartyRun: isFirstPartyKScriptRun(settings),
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Cross-repo error contract: every venue-policy denial, FE-thrown or
|
|
314
|
+
* engine-thrown, embeds this literal token so the kScript error envelope
|
|
315
|
+
* classifies it VENUE_BLOCKED (deterministic, never retried).
|
|
316
|
+
*/
|
|
317
|
+
export const KSCRIPT_VENUE_BLOCKED_MARKER = 'kscript_venue_blocked';
|
|
318
|
+
export function createKScriptVenueBlockedError(exchange) {
|
|
319
|
+
return new Error(`[kScript] ${KSCRIPT_VENUE_BLOCKED_MARKER}: user scripts cannot access ${exchange} market data`);
|
|
320
|
+
}
|
|
321
|
+
export function isKScriptVenueBlockedError(error) {
|
|
322
|
+
const message = error instanceof Error ? error.message : typeof error === 'string' ? error : '';
|
|
323
|
+
return message.toLowerCase().includes(KSCRIPT_VENUE_BLOCKED_MARKER);
|
|
324
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live kScript dispatch cadence decision.
|
|
3
|
+
*
|
|
4
|
+
* The live-feed coalescer paces each local script's recompute pipeline
|
|
5
|
+
* (main-thread fold + worker run + integration) with a per-overlay minimum
|
|
6
|
+
* interval. This module owns the pure decision so it is unit-testable
|
|
7
|
+
* without the live-feed service's import graph (which needs a DOM).
|
|
8
|
+
*
|
|
9
|
+
* Tiers:
|
|
10
|
+
* - Gesture active: the interval-scaled floor (storm protection).
|
|
11
|
+
* - At rest: relax to ~4 dispatches/sec so outputs glide with the ticks, but
|
|
12
|
+
* stretch with the script's own measured drain cost (x3 EMA) so an
|
|
13
|
+
* expensive fold on weak/hot hardware self-paces toward the gesture floor
|
|
14
|
+
* instead of holding a >50% duty cycle at a "legal" cadence.
|
|
15
|
+
* - Hidden tab, hidden live pace on (`hiddenHold`, rest-cost H6 for the local
|
|
16
|
+
* kScript coalescer, H8 for wrun's live tick): no run at all (a non-finite
|
|
17
|
+
* interval). Nothing a hidden tab computes can be seen and folds are
|
|
18
|
+
* lossless (both schedulers accumulate additive points), so the scheduler
|
|
19
|
+
* holds the script, keeps folding, and the visibilitychange snap runs ONE
|
|
20
|
+
* pass on the return (a backlog bound runs one earlier).
|
|
21
|
+
* - Hidden tab, switch off (`localStorage['kiyo:live-hidden-pace'] = 'off'`)
|
|
22
|
+
* or a scheduler without the hold: floor at V2_LIVE_HIDDEN_MIN_INTERVAL_MS
|
|
23
|
+
* regardless, the behavior before the hold; the snap still erases the
|
|
24
|
+
* staleness on foregrounding.
|
|
25
|
+
*/
|
|
26
|
+
export declare const V2_TECHNICAL_SCRIPT_LIVE_UPDATE_MIN_MS = 200;
|
|
27
|
+
export declare function resolveV2LiveEffectiveMinIntervalMs(args: {
|
|
28
|
+
minIntervalMs: number;
|
|
29
|
+
drainCostEmaMs: number;
|
|
30
|
+
atRest: boolean;
|
|
31
|
+
hidden: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The hidden live pace switch (hidden-live-drain.util `isLiveHiddenPaceEnabled`): on, a hidden page holds every
|
|
34
|
+
* run. Only a scheduler that can hold passes it (the local kScript coalescer, wrun's live tick); absent, the 2 s
|
|
35
|
+
* floor.
|
|
36
|
+
*/
|
|
37
|
+
hiddenHold?: boolean;
|
|
38
|
+
}): number;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live kScript dispatch cadence decision.
|
|
3
|
+
*
|
|
4
|
+
* The live-feed coalescer paces each local script's recompute pipeline
|
|
5
|
+
* (main-thread fold + worker run + integration) with a per-overlay minimum
|
|
6
|
+
* interval. This module owns the pure decision so it is unit-testable
|
|
7
|
+
* without the live-feed service's import graph (which needs a DOM).
|
|
8
|
+
*
|
|
9
|
+
* Tiers:
|
|
10
|
+
* - Gesture active: the interval-scaled floor (storm protection).
|
|
11
|
+
* - At rest: relax to ~4 dispatches/sec so outputs glide with the ticks, but
|
|
12
|
+
* stretch with the script's own measured drain cost (x3 EMA) so an
|
|
13
|
+
* expensive fold on weak/hot hardware self-paces toward the gesture floor
|
|
14
|
+
* instead of holding a >50% duty cycle at a "legal" cadence.
|
|
15
|
+
* - Hidden tab, hidden live pace on (`hiddenHold`, rest-cost H6 for the local
|
|
16
|
+
* kScript coalescer, H8 for wrun's live tick): no run at all (a non-finite
|
|
17
|
+
* interval). Nothing a hidden tab computes can be seen and folds are
|
|
18
|
+
* lossless (both schedulers accumulate additive points), so the scheduler
|
|
19
|
+
* holds the script, keeps folding, and the visibilitychange snap runs ONE
|
|
20
|
+
* pass on the return (a backlog bound runs one earlier).
|
|
21
|
+
* - Hidden tab, switch off (`localStorage['kiyo:live-hidden-pace'] = 'off'`)
|
|
22
|
+
* or a scheduler without the hold: floor at V2_LIVE_HIDDEN_MIN_INTERVAL_MS
|
|
23
|
+
* regardless, the behavior before the hold; the snap still erases the
|
|
24
|
+
* staleness on foregrounding.
|
|
25
|
+
*/
|
|
26
|
+
export const V2_TECHNICAL_SCRIPT_LIVE_UPDATE_MIN_MS = 200;
|
|
27
|
+
const V2_LIVE_HIDDEN_MIN_INTERVAL_MS = 2_000;
|
|
28
|
+
const V2_LIVE_ADAPTIVE_COST_MULT = 3;
|
|
29
|
+
export function resolveV2LiveEffectiveMinIntervalMs(args) {
|
|
30
|
+
const { minIntervalMs, drainCostEmaMs, atRest, hidden, hiddenHold } = args;
|
|
31
|
+
if (hidden && hiddenHold)
|
|
32
|
+
return Number.POSITIVE_INFINITY;
|
|
33
|
+
const restFloorMs = Math.max(Math.min(minIntervalMs, Math.max(250, V2_TECHNICAL_SCRIPT_LIVE_UPDATE_MIN_MS)), Math.min(minIntervalMs, drainCostEmaMs * V2_LIVE_ADAPTIVE_COST_MULT));
|
|
34
|
+
if (hidden)
|
|
35
|
+
return Math.max(restFloorMs, V2_LIVE_HIDDEN_MIN_INTERVAL_MS);
|
|
36
|
+
return atRest ? restFloorMs : minIntervalMs;
|
|
37
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
interface ChartStreamIdentity {
|
|
2
|
+
exchange?: unknown;
|
|
3
|
+
symbol?: unknown;
|
|
4
|
+
normalizedSymbol?: unknown;
|
|
5
|
+
/** Continuous futures: the resolved lead contract the live channels ride. */
|
|
6
|
+
resolvedContract?: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface LiveFeedSeriesIdentity {
|
|
9
|
+
exchange?: unknown;
|
|
10
|
+
symbol?: unknown;
|
|
11
|
+
}
|
|
12
|
+
export declare function liveFeedSeriesMatchesChartStream(series: LiveFeedSeriesIdentity | undefined, metadata: ChartStreamIdentity | undefined): boolean;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a live feed frame's series is the chart's own stream (a leaf of
|
|
3
|
+
* utility/chart/liquidation-markers-settings.util.ts; P2/inventory.md section 1.1): the one name the live intake reads
|
|
4
|
+
* from the liquidation markers' settings. It reads package modules only (the exchange of a symbol, the
|
|
5
|
+
* continuous-futures alias), never the `@/helpers` barrel, whose input rules import the i18n plugin, so this leaf moves
|
|
6
|
+
* into the chart-host package with the phase 2 closure. The old module re-exports it.
|
|
7
|
+
*/
|
|
8
|
+
import { getExchangeFromSymbol } from '../../helpers/data.helpers.js';
|
|
9
|
+
import { symbolsMatchForLiveFeed } from './continuous-contracts.util.js';
|
|
10
|
+
export function liveFeedSeriesMatchesChartStream(series, metadata) {
|
|
11
|
+
if (!series || !metadata)
|
|
12
|
+
return false;
|
|
13
|
+
if (typeof series.exchange !== 'string' || typeof series.symbol !== 'string')
|
|
14
|
+
return false;
|
|
15
|
+
if (typeof metadata.exchange !== 'string' || typeof metadata.symbol !== 'string')
|
|
16
|
+
return false;
|
|
17
|
+
const chartExchange = getExchangeFromSymbol(metadata.exchange, metadata.symbol);
|
|
18
|
+
// symbolsMatchForLiveFeed adds the continuous-futures alias: frames for a
|
|
19
|
+
// continuous chart (ES1!) arrive under the resolved lead contract (ESU6).
|
|
20
|
+
return series.exchange === chartExchange && symbolsMatchForLiveFeed(metadata, series.symbol);
|
|
21
|
+
}
|