@orangecharts/wrun-chart-host 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -5
- package/dist/constants/exchange-names.leaf.d.ts +8 -0
- package/dist/constants/exchange-names.leaf.js +101 -0
- package/dist/constants/feature-flags.constants.js +7 -2
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
- package/dist/constants/opra-compliance.constants.d.ts +19 -0
- package/dist/constants/opra-compliance.constants.js +19 -0
- package/dist/constants/replay-ladder.leaf.d.ts +30 -0
- package/dist/constants/replay-ladder.leaf.js +99 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
- package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
- package/dist/constants/scriptEditor/execution.constants.js +14 -0
- package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
- package/dist/constants/wrun-prefix-safe.constants.js +26 -0
- package/dist/host-env.d.ts +301 -22
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +853 -29
- package/dist/index.d.ts +140 -2
- package/dist/index.js +140 -2
- package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
- package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
- package/dist/interfaces/market-event.interface.d.ts +231 -0
- package/dist/interfaces/market-event.interface.js +15 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
- package/dist/interfaces/opra-realtime.interface.js +34 -59
- package/dist/interfaces/replay.interface.d.ts +285 -0
- package/dist/interfaces/replay.interface.js +1 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +88 -13
- package/dist/interfaces/wrun-runtime.interface.js +17 -3
- package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
- package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
- package/dist/market-data/billing.interface.d.ts +219 -0
- package/dist/market-data/billing.interface.js +58 -0
- package/dist/market-data/venue-governed.util.d.ts +2 -0
- package/dist/market-data/venue-governed.util.js +10 -0
- package/dist/market-data/venue.d.ts +122 -0
- package/dist/market-data/venue.js +1 -0
- package/dist/market-data/venues/index.d.ts +97 -0
- package/dist/market-data/venues/index.js +33 -0
- package/dist/market-data/venues/opra.contract.copy.json +35 -0
- package/dist/market-data/venues/opra.d.ts +70 -0
- package/dist/market-data/venues/opra.js +74 -0
- package/dist/replay/replayIndicatorRows.d.ts +31 -0
- package/dist/replay/replayIndicatorRows.js +117 -0
- package/dist/replay/replayLadder.d.ts +85 -0
- package/dist/replay/replayLadder.js +388 -0
- package/dist/utility/auth/server-clock.util.d.ts +81 -0
- package/dist/utility/auth/server-clock.util.js +238 -0
- package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
- package/dist/utility/chart/builtin-identity.util.js +51 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
- package/dist/utility/chart/cache-alignment.util.js +926 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +17 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +61 -0
- package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
- package/dist/utility/chart/chart-time-domain.util.js +23 -0
- package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
- package/dist/utility/chart/color-customization.leaf.js +16 -0
- package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
- package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
- package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
- package/dist/utility/chart/gesture-timing.leaf.js +29 -0
- package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
- package/dist/utility/chart/governed-contract-coin.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
- package/dist/utility/chart/host-bar-placement.util.js +447 -0
- package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
- package/dist/utility/chart/index-host-tier.util.js +118 -0
- package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
- package/dist/utility/chart/index-mode-admission.util.js +67 -0
- package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
- package/dist/utility/chart/indicator-error-message.util.js +44 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
- package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
- package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
- package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
- package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
- package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
- package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
- package/dist/utility/chart/kscript-source-retention.util.js +218 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
- package/dist/utility/chart/live-cadence.util.d.ts +38 -0
- package/dist/utility/chart/live-cadence.util.js +37 -0
- package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
- package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
- package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
- package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
- package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
- package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
- package/dist/utility/chart/mixed-mode.util.js +139 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
- package/dist/utility/chart/price-precision.util.d.ts +40 -0
- package/dist/utility/chart/price-precision.util.js +70 -0
- package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
- package/dist/utility/chart/profile-block-size.util.js +141 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
- package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
- package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
- package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
- package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
- package/dist/utility/chart/titan-constants.pin.js +18 -5
- package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
- package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
- package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
- package/dist/utility/chart/wrun-run-result.util.js +20 -14
- package/dist/utility/common/data-processing.util.d.ts +138 -0
- package/dist/utility/common/data-processing.util.js +346 -0
- package/dist/utility/common/visible-timeout.util.d.ts +13 -4
- package/dist/utility/common/visible-timeout.util.js +23 -8
- package/dist/utility/exchange-format.leaf.d.ts +1 -0
- package/dist/utility/exchange-format.leaf.js +47 -0
- package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
- package/dist/utility/market-events/earnings-scope.util.js +92 -0
- package/dist/utility/market-events/market-events.util.d.ts +147 -0
- package/dist/utility/market-events/market-events.util.js +392 -0
- package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
- package/dist/utility/market-events/zoned-clock.util.js +11 -0
- package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
- package/dist/utility/options/option-venue-disclosure.util.js +56 -0
- package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
- package/dist/utility/scriptEditor/package-semver.util.js +120 -0
- package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
- package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
- package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
- package/dist/utility/v2/governed-tier.leaf.js +113 -0
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
- package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
- package/dist/utility/wrun/sources/lanes/series.js +2 -2
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +4 -4
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +5 -6
- package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
- package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-bar-count.util.js +274 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
- package/dist/utility/wrun/wrun-deadline.util.js +2 -1
- package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
- package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
- package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
- package/dist/utility/wrun/wrun-host.service.d.ts +330 -0
- package/dist/utility/wrun/wrun-host.service.js +855 -0
- package/dist/utility/wrun/wrun-hover.util.d.ts +3 -0
- package/dist/utility/wrun/wrun-hover.util.js +25 -4
- package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
- package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
- package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
- package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
- package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
- package/dist/utility/wrun/wrun-pack.util.d.ts +2 -1
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +24 -9
- package/dist/utility/wrun/wrun-panel-mount.util.js +138 -43
- package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
- package/dist/utility/wrun/wrun-param-map.util.js +40 -47
- package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-param-values.util.js +5 -5
- package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
- package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +5 -3
- package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
- package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
- package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
- package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
- package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
- package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
- package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
- package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
- package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
- package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
- package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
- package/dist/utility/wrun/wrun-sha256.leaf.d.ts +13 -0
- package/dist/utility/wrun/wrun-sha256.leaf.js +84 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
- package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
- package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
- package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
- package/dist/utility/wrun/wrun-text-params.util.js +19 -30
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
- package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
- package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
- package/dist/utility/wrun-alert-params.leaf.js +24 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
- package/dist/utils/replay/replay-buffer-math.js +684 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +203 -0
- package/dist/workers/wrun/wrun-abi-host.js +1220 -0
- package/dist/workers/wrun/wrun-engine-handler.d.ts +20 -0
- package/dist/workers/wrun/wrun-engine-handler.js +380 -0
- package/package.json +3 -3
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apply-skip fingerprint for local kScript live refreshes.
|
|
3
|
+
*
|
|
4
|
+
* Fast intervals re-run every mounted script at the live coalescer floor
|
|
5
|
+
* (~1s each on 1m); most re-runs produce byte-identical output, yet each one
|
|
6
|
+
* paid a wholesale row apply plus a full repaint. The engine re-run itself is
|
|
7
|
+
* untouched (long-window scripts must recompute from history); this
|
|
8
|
+
* fingerprint only lets the APPLY step recognize "nothing changed" and skip
|
|
9
|
+
* the redundant integration + paint.
|
|
10
|
+
*
|
|
11
|
+
* Safety contract:
|
|
12
|
+
* - `null` means "cannot fingerprint" and the caller MUST apply (fail open).
|
|
13
|
+
* Returned for shapes this hash does not fully cover, so a skip can never
|
|
14
|
+
* hide a visual change it did not hash.
|
|
15
|
+
* - The hash covers every pixel-affecting surface of a run result: main rows,
|
|
16
|
+
* every plot output's rows, engine-side colors, drawings, and tables.
|
|
17
|
+
* Diagnostics/prints are NOT covered on purpose — the caller keeps
|
|
18
|
+
* updating those channels even when it skips the apply.
|
|
19
|
+
* - A browser-run (wrun) result's live tick compares the whole result with the
|
|
20
|
+
* one it last applied instead (wrun-live-patch.util `diffWrunLiveResults`),
|
|
21
|
+
* which also names the bar its rows first changed on.
|
|
22
|
+
*/
|
|
23
|
+
const FNV_OFFSET = 0x811c9dc5;
|
|
24
|
+
// Shared scratch view so double bits mix without per-cell allocation.
|
|
25
|
+
const F64 = new Float64Array(1);
|
|
26
|
+
const U32 = new Uint32Array(F64.buffer);
|
|
27
|
+
const DRAWINGS_JSON_CAP = 200;
|
|
28
|
+
const TABLES_JSON_CAP = 64;
|
|
29
|
+
// No class fields: this module rides into the kScript worker's ENTRY chunk, and a
|
|
30
|
+
// lowered field puts the bundler's defineProperty helper there for the lazy engine
|
|
31
|
+
// chunk to import back, which WebKit answers by evaluating the entry twice
|
|
32
|
+
// (scripts/worker-entry-reimport-guard.ts).
|
|
33
|
+
class Fnv {
|
|
34
|
+
constructor() {
|
|
35
|
+
this.h = FNV_OFFSET;
|
|
36
|
+
}
|
|
37
|
+
num(v) {
|
|
38
|
+
F64[0] = v;
|
|
39
|
+
this.h = ((this.h ^ U32[0]) * 16777619) >>> 0;
|
|
40
|
+
this.h = ((this.h ^ U32[1]) * 16777619) >>> 0;
|
|
41
|
+
}
|
|
42
|
+
str(s) {
|
|
43
|
+
for (let i = 0; i < s.length; i++)
|
|
44
|
+
this.h = ((this.h ^ s.charCodeAt(i)) * 16777619) >>> 0;
|
|
45
|
+
this.h = ((this.h ^ 0xff) * 16777619) >>> 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/** Hash one rows array; returns false when a cell shape is not covered. */
|
|
49
|
+
function mixRows(f, rows) {
|
|
50
|
+
if (rows == null) {
|
|
51
|
+
f.str('∅');
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
if (!Array.isArray(rows))
|
|
55
|
+
return false;
|
|
56
|
+
f.num(rows.length);
|
|
57
|
+
for (const row of rows) {
|
|
58
|
+
if (!Array.isArray(row))
|
|
59
|
+
return false;
|
|
60
|
+
f.num(row.length);
|
|
61
|
+
for (const cell of row) {
|
|
62
|
+
if (typeof cell === 'number')
|
|
63
|
+
f.num(cell);
|
|
64
|
+
else if (typeof cell === 'string')
|
|
65
|
+
f.str(cell);
|
|
66
|
+
else if (cell == null)
|
|
67
|
+
f.str('·');
|
|
68
|
+
else if (Array.isArray(cell)) {
|
|
69
|
+
// Nested numeric cells (footprint-style buckets). Anything deeper
|
|
70
|
+
// than one numeric/string level is not covered.
|
|
71
|
+
f.num(cell.length);
|
|
72
|
+
for (const inner of cell) {
|
|
73
|
+
if (typeof inner === 'number')
|
|
74
|
+
f.num(inner);
|
|
75
|
+
else if (typeof inner === 'string')
|
|
76
|
+
f.str(inner);
|
|
77
|
+
else
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
export function fingerprintKScriptRunResultForApplySkip(runResult, projection) {
|
|
88
|
+
const out = runResult;
|
|
89
|
+
if (!out || typeof out !== 'object')
|
|
90
|
+
return null;
|
|
91
|
+
const f = new Fnv();
|
|
92
|
+
try {
|
|
93
|
+
if (!mixRows(f, out.data))
|
|
94
|
+
return null;
|
|
95
|
+
const outputs = out.outputs;
|
|
96
|
+
if (outputs != null) {
|
|
97
|
+
if (typeof outputs !== 'object')
|
|
98
|
+
return null;
|
|
99
|
+
for (const key of Object.keys(outputs).sort()) {
|
|
100
|
+
f.str(key);
|
|
101
|
+
if (!mixRows(f, outputs[key]?.data))
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// Colors can come from the engine per run; small, hash via JSON.
|
|
106
|
+
if (out.settings?.colors != null)
|
|
107
|
+
f.str(JSON.stringify(out.settings.colors));
|
|
108
|
+
// Drawings/tables are visual; JSON-hash small sets, fail open on large
|
|
109
|
+
// ones rather than pay a heavy stringify per tick.
|
|
110
|
+
const drawings = out.drawings;
|
|
111
|
+
if (drawings != null) {
|
|
112
|
+
if (!Array.isArray(drawings) || drawings.length > DRAWINGS_JSON_CAP)
|
|
113
|
+
return null;
|
|
114
|
+
f.str(JSON.stringify(drawings));
|
|
115
|
+
}
|
|
116
|
+
const tables = out.tables;
|
|
117
|
+
if (tables != null) {
|
|
118
|
+
if (!Array.isArray(tables) || tables.length > TABLES_JSON_CAP)
|
|
119
|
+
return null;
|
|
120
|
+
f.str(JSON.stringify(tables));
|
|
121
|
+
}
|
|
122
|
+
if (projection)
|
|
123
|
+
mixProjection(f, projection);
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
return f.h.toString(36);
|
|
129
|
+
}
|
|
130
|
+
// ─── Render identity for compact unchanged posts (KSCRIPT-LIVE-CHURN U1) ────
|
|
131
|
+
//
|
|
132
|
+
// Stricter than the apply-skip fingerprint above: besides the rows it hashes
|
|
133
|
+
// every per-output field (palettes, widths, style layouts), the run-level
|
|
134
|
+
// `settings`, the timeline, the strategy ledger and every key it does not
|
|
135
|
+
// know, so a result whose paint COULD differ never reads as unchanged. Only
|
|
136
|
+
// the side-channel keys below are left out: they never influence the paint
|
|
137
|
+
// and ride a compact post fresh (see splitKScriptRunResultForCompactPost).
|
|
138
|
+
/** Heavy render keys: hashed here, reconstructed from the cached full result on re-delivery. */
|
|
139
|
+
const RENDER_IDENTITY_HEAVY_KEYS = new Set([
|
|
140
|
+
'data',
|
|
141
|
+
'outputs',
|
|
142
|
+
'drawings',
|
|
143
|
+
'tables',
|
|
144
|
+
'nestedMeta',
|
|
145
|
+
'combinedTimes',
|
|
146
|
+
'frames',
|
|
147
|
+
'wrunHost',
|
|
148
|
+
'strategy',
|
|
149
|
+
// Engine context, stripped before any post (postToMain): never hashed, never carried.
|
|
150
|
+
'series',
|
|
151
|
+
'vars',
|
|
152
|
+
]);
|
|
153
|
+
/**
|
|
154
|
+
* Run-level keys outside the paint: fresh on every post, so a compact post
|
|
155
|
+
* carries them and the re-delivered result shows the run's own values
|
|
156
|
+
* (diagnostics that cleared, a print that changed, the settled-empty flag).
|
|
157
|
+
*/
|
|
158
|
+
export const KSCRIPT_RUN_RESULT_SIDE_CHANNEL_KEYS = new Set([
|
|
159
|
+
'diagnostics',
|
|
160
|
+
'printOutputs',
|
|
161
|
+
'alerts',
|
|
162
|
+
'timingMs',
|
|
163
|
+
'durationMs',
|
|
164
|
+
'elapsedMs',
|
|
165
|
+
'settledEmptyDrawingRun',
|
|
166
|
+
'lookbackInfo',
|
|
167
|
+
]);
|
|
168
|
+
/** JSON larger than this is not hashed: the identity fails open (null) and the result posts in full. */
|
|
169
|
+
const RENDER_IDENTITY_JSON_CAP = 65_536;
|
|
170
|
+
// Plain stringify, the same the apply-skip fingerprint uses: both sides hash
|
|
171
|
+
// objects the same engine code path built, so their key order is stable, and a
|
|
172
|
+
// key-sorting replacer ran once per array element on every tick (the strategy
|
|
173
|
+
// ledger and 200 drawings made it the costliest step of the hash).
|
|
174
|
+
function stableJson(value) {
|
|
175
|
+
const json = JSON.stringify(value);
|
|
176
|
+
if (json === undefined)
|
|
177
|
+
return 'undefined';
|
|
178
|
+
return json.length > RENDER_IDENTITY_JSON_CAP ? null : json;
|
|
179
|
+
}
|
|
180
|
+
function mixJson(f, value) {
|
|
181
|
+
const json = stableJson(value);
|
|
182
|
+
if (json === null)
|
|
183
|
+
return false;
|
|
184
|
+
f.str(json);
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
function mixNumberList(f, values) {
|
|
188
|
+
if (values == null) {
|
|
189
|
+
f.str('∅');
|
|
190
|
+
return true;
|
|
191
|
+
}
|
|
192
|
+
if (!Array.isArray(values))
|
|
193
|
+
return false;
|
|
194
|
+
f.num(values.length);
|
|
195
|
+
for (const value of values) {
|
|
196
|
+
if (typeof value === 'number')
|
|
197
|
+
f.num(value);
|
|
198
|
+
else if (value == null)
|
|
199
|
+
f.str('·');
|
|
200
|
+
else
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
return true;
|
|
204
|
+
}
|
|
205
|
+
function mixRenderIdentity(f, result) {
|
|
206
|
+
// A strategy ledger (per-bar equity and drawdown arrays plus every trade), a
|
|
207
|
+
// hosted wrun reply or wrun snapshot frames change on nearly every tick and
|
|
208
|
+
// run to megabytes: never hashed, the result simply never posts compact.
|
|
209
|
+
if (result.strategy != null || result.wrunHost != null || result.frames != null)
|
|
210
|
+
return false;
|
|
211
|
+
if (!mixRows(f, result.data))
|
|
212
|
+
return false;
|
|
213
|
+
const outputs = result.outputs;
|
|
214
|
+
if (outputs == null)
|
|
215
|
+
f.str('∅outputs');
|
|
216
|
+
else {
|
|
217
|
+
if (typeof outputs !== 'object' || Array.isArray(outputs))
|
|
218
|
+
return false;
|
|
219
|
+
const record = outputs;
|
|
220
|
+
for (const key of Object.keys(record).sort()) {
|
|
221
|
+
f.str(key);
|
|
222
|
+
const output = record[key];
|
|
223
|
+
if (output && typeof output === 'object' && !Array.isArray(output)) {
|
|
224
|
+
const { data, ...meta } = output;
|
|
225
|
+
if (!mixJson(f, meta) || !mixRows(f, data))
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
228
|
+
else if (!mixJson(f, output))
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if (result.drawings != null && (!Array.isArray(result.drawings) || result.drawings.length > DRAWINGS_JSON_CAP)) {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
if (result.tables != null && (!Array.isArray(result.tables) || result.tables.length > TABLES_JSON_CAP))
|
|
236
|
+
return false;
|
|
237
|
+
if (!mixJson(f, result.drawings ?? null) || !mixJson(f, result.tables ?? null))
|
|
238
|
+
return false;
|
|
239
|
+
if (!mixNumberList(f, result.combinedTimes))
|
|
240
|
+
return false;
|
|
241
|
+
for (const key of Object.keys(result).sort()) {
|
|
242
|
+
if (RENDER_IDENTITY_HEAVY_KEYS.has(key) || KSCRIPT_RUN_RESULT_SIDE_CHANNEL_KEYS.has(key))
|
|
243
|
+
continue;
|
|
244
|
+
f.str(key);
|
|
245
|
+
if (!mixJson(f, result[key]))
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
const nested = result.nestedMeta;
|
|
249
|
+
if (nested == null)
|
|
250
|
+
f.str('∅nested');
|
|
251
|
+
else {
|
|
252
|
+
if (!Array.isArray(nested))
|
|
253
|
+
return false;
|
|
254
|
+
f.num(nested.length);
|
|
255
|
+
for (const entry of nested) {
|
|
256
|
+
if (!entry || typeof entry !== 'object' || !mixRenderIdentity(f, entry))
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return true;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* The render identity of a run result (see the section comment): equal strings
|
|
264
|
+
* mean equal paint. `null` when any part fails open (oversized drawings, tables
|
|
265
|
+
* or JSON, an unsupported cell shape): a null identity is never equal.
|
|
266
|
+
*/
|
|
267
|
+
export function fingerprintKScriptRunResultRenderIdentity(result) {
|
|
268
|
+
if (!result || typeof result !== 'object' || Array.isArray(result))
|
|
269
|
+
return null;
|
|
270
|
+
const f = new Fnv();
|
|
271
|
+
try {
|
|
272
|
+
if (!mixRenderIdentity(f, result))
|
|
273
|
+
return null;
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
return f.h.toString(16);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The part of a run result a compact post carries: ONLY the side-channel keys
|
|
282
|
+
* (diagnostics, print outputs, timings, the settled-empty flag, the declared
|
|
283
|
+
* depth): fresh values the host consumes outside the paint. Every other key
|
|
284
|
+
* is inside the render identity, so the cached full result's copy is equal by
|
|
285
|
+
* construction and the compose below reuses it (settings, define, script
|
|
286
|
+
* inputs and the like never cross twice; a compact post stays a few hundred
|
|
287
|
+
* bytes next to a 35 KB full one).
|
|
288
|
+
*/
|
|
289
|
+
export function splitKScriptRunResultForCompactPost(result) {
|
|
290
|
+
const light = {};
|
|
291
|
+
if (!result || typeof result !== 'object' || Array.isArray(result))
|
|
292
|
+
return light;
|
|
293
|
+
for (const key of KSCRIPT_RUN_RESULT_SIDE_CHANNEL_KEYS) {
|
|
294
|
+
if (key in result)
|
|
295
|
+
light[key] = result[key];
|
|
296
|
+
}
|
|
297
|
+
return light;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* The full result a compact post stands for: the cached result (every key by
|
|
301
|
+
* reference, so the apply-skip memo below still hits) with the compact post's
|
|
302
|
+
* side-channel fields over it. A side-channel key the new run dropped is
|
|
303
|
+
* dropped here too (its absence is the fresh value).
|
|
304
|
+
*/
|
|
305
|
+
export function composeKScriptRunResultFromCompact(cached, light) {
|
|
306
|
+
if (!cached || typeof cached !== 'object' || Array.isArray(cached))
|
|
307
|
+
return cached;
|
|
308
|
+
const composed = { ...cached };
|
|
309
|
+
for (const key of KSCRIPT_RUN_RESULT_SIDE_CHANNEL_KEYS) {
|
|
310
|
+
if (key in light)
|
|
311
|
+
composed[key] = light[key];
|
|
312
|
+
else
|
|
313
|
+
delete composed[key];
|
|
314
|
+
}
|
|
315
|
+
return composed;
|
|
316
|
+
}
|
|
317
|
+
const applySkipFingerprintMemo = new WeakMap();
|
|
318
|
+
function projectionMemoKey(projection) {
|
|
319
|
+
if (!projection)
|
|
320
|
+
return '';
|
|
321
|
+
return `${projection.firstTs}|${projection.lastTs}|${projection.rows}|${projection.runMs}|${projection.waitForClose ? 1 : 0}`;
|
|
322
|
+
}
|
|
323
|
+
export function fingerprintKScriptRunResultForApplySkipMemo(runResult, projection) {
|
|
324
|
+
if (!runResult || typeof runResult !== 'object')
|
|
325
|
+
return fingerprintKScriptRunResultForApplySkip(runResult, projection);
|
|
326
|
+
const out = runResult;
|
|
327
|
+
const key = out.outputs && typeof out.outputs === 'object' ? out.outputs : runResult;
|
|
328
|
+
const projectionKey = projectionMemoKey(projection);
|
|
329
|
+
const colors = out.settings?.colors;
|
|
330
|
+
const hit = applySkipFingerprintMemo.get(key);
|
|
331
|
+
if (hit &&
|
|
332
|
+
hit.projectionKey === projectionKey &&
|
|
333
|
+
hit.data === out.data &&
|
|
334
|
+
hit.drawings === out.drawings &&
|
|
335
|
+
hit.tables === out.tables &&
|
|
336
|
+
hit.colors === colors) {
|
|
337
|
+
return hit.fingerprint;
|
|
338
|
+
}
|
|
339
|
+
const fingerprint = fingerprintKScriptRunResultForApplySkip(runResult, projection);
|
|
340
|
+
applySkipFingerprintMemo.set(key, {
|
|
341
|
+
data: out.data,
|
|
342
|
+
drawings: out.drawings,
|
|
343
|
+
tables: out.tables,
|
|
344
|
+
colors,
|
|
345
|
+
projectionKey,
|
|
346
|
+
fingerprint,
|
|
347
|
+
});
|
|
348
|
+
return fingerprint;
|
|
349
|
+
}
|
|
350
|
+
function mixProjection(f, projection) {
|
|
351
|
+
f.str('projection');
|
|
352
|
+
f.num(projection.firstTs);
|
|
353
|
+
f.num(projection.lastTs);
|
|
354
|
+
f.num(projection.rows);
|
|
355
|
+
f.num(projection.runMs);
|
|
356
|
+
f.num(projection.waitForClose ? 1 : 0);
|
|
357
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The synchronous chart paint (kscript-chart-paint.util): cancel the engine's own trailing debounces, then process and
|
|
3
|
+
* render once. A pure leaf (no imports, no module state: it touches only the chart it is handed), so the wrun replay
|
|
4
|
+
* row cut (wrun-replay-rows.util) reads it without the paint module, whose coalescing map stays the one owner of every
|
|
5
|
+
* deferred paint. The old file re-exports both names and paints through them.
|
|
6
|
+
*/
|
|
7
|
+
/** The engine surface a paint request reaches: titan's coalesced live pass, its rAF request, or
|
|
8
|
+
* the synchronous pair. Structural, so a chart typed by its consumer (a wrun child mount) passes
|
|
9
|
+
* as it is. */
|
|
10
|
+
export interface KScriptChartPaintTarget {
|
|
11
|
+
requestLiveRecompute?(opts?: {
|
|
12
|
+
overlayIds?: readonly string[];
|
|
13
|
+
}): void;
|
|
14
|
+
requestProcessAndRender?(opts?: {
|
|
15
|
+
mode?: 'raf' | 'sync';
|
|
16
|
+
}): void;
|
|
17
|
+
processData?(): void;
|
|
18
|
+
renderService?: {
|
|
19
|
+
renderOnce?(): void;
|
|
20
|
+
} | null;
|
|
21
|
+
}
|
|
22
|
+
export declare function flushKScriptChartPaint(tc: KScriptChartPaintTarget): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The synchronous chart paint (kscript-chart-paint.util): cancel the engine's own trailing debounces, then process and
|
|
3
|
+
* render once. A pure leaf (no imports, no module state: it touches only the chart it is handed), so the wrun replay
|
|
4
|
+
* row cut (wrun-replay-rows.util) reads it without the paint module, whose coalescing map stays the one owner of every
|
|
5
|
+
* deferred paint. The old file re-exports both names and paints through them.
|
|
6
|
+
*/
|
|
7
|
+
export function flushKScriptChartPaint(tc) {
|
|
8
|
+
const chart = tc;
|
|
9
|
+
chart.debouncedProcessData?.cancel?.();
|
|
10
|
+
chart.debouncedRenderOnce?.cancel?.();
|
|
11
|
+
tc.processData?.();
|
|
12
|
+
tc.renderService?.renderOnce?.();
|
|
13
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the chart's fetch gate refuses a kScript data source on an interval (a leaf of utility/chart/indicator.util.ts;
|
|
3
|
+
* P2/inventory.md section 1.1): the rule the wrun executor's tape check reads (K_TRADES on a sub-minute chart). Pure:
|
|
4
|
+
* it reads the restrictions constants module and the interval registry (a chart-host package module), so it moves into
|
|
5
|
+
* the package with the phase 2 closure; the indicator util re-exports it.
|
|
6
|
+
*/
|
|
7
|
+
import { ALLOWED_1S_INDICATORS, KSCRIPT_DATA_INTERVAL_RESTRICTIONS, ROLLED_INTERVAL_RESTRICTED_KSCRIPT_DATA, } from '../../constants/kscript-data-interval-restrictions.constants.js';
|
|
8
|
+
import { isCustomInterval, isSubMinuteInterval, standardIntervalAtOrBelow } from './interval-registry.util.js';
|
|
9
|
+
/**
|
|
10
|
+
* @param kscriptType
|
|
11
|
+
* @param interval
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export function isKScriptDataRestrictedForInterval(kscriptType, interval) {
|
|
15
|
+
if (isSubMinuteInterval(interval)) {
|
|
16
|
+
return !ALLOWED_1S_INDICATORS.includes(kscriptType);
|
|
17
|
+
}
|
|
18
|
+
// Same gateway refusal as the native lookup: the twin sends the same request.
|
|
19
|
+
if (isCustomInterval(interval) && ROLLED_INTERVAL_RESTRICTED_KSCRIPT_DATA.includes(kscriptType)) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
const restrictedIndicators = KSCRIPT_DATA_INTERVAL_RESTRICTIONS[standardIntervalAtOrBelow(interval)];
|
|
23
|
+
if (!restrictedIndicators) {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return restrictedIndicators.includes(kscriptType);
|
|
27
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/** Reference capture of the mounted overlay fields the deciders consult. */
|
|
2
|
+
export type MountedIntegrationSnapshot = {
|
|
3
|
+
present: boolean;
|
|
4
|
+
lazyIdentity?: unknown;
|
|
5
|
+
rawData?: unknown;
|
|
6
|
+
runResult?: unknown;
|
|
7
|
+
nestedMeta?: unknown;
|
|
8
|
+
};
|
|
9
|
+
export type LazyMergePlan = 'degenerate-replace' | 'canonical-merge';
|
|
10
|
+
/**
|
|
11
|
+
* A zombie mount (epoch-adjacent rows from a broken integration) must not be
|
|
12
|
+
* preserved by the merge; the fresh result replaces it wholesale.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveLazyMergePlan(snapshot: MountedIntegrationSnapshot): LazyMergePlan;
|
|
15
|
+
export type LocalRunRoute = {
|
|
16
|
+
action: 'skip';
|
|
17
|
+
reason: 'style-mismatch' | 'preserve-previous-output' | 'orderbook-zero-bar-summary-only' | 'no-renderer-update';
|
|
18
|
+
} | {
|
|
19
|
+
action: 'apply-rows-refresh';
|
|
20
|
+
} | {
|
|
21
|
+
action: 'apply-rows-merge';
|
|
22
|
+
} | {
|
|
23
|
+
action: 'apply-remount';
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The local engine callback's integration route, in its exact historical
|
|
27
|
+
* decision order: style mismatch -> transient preserve -> no renderer update
|
|
28
|
+
* (orderbook zero-bar results surface summaries only; everything else is
|
|
29
|
+
* diagnostics-only) -> mounted-rows fast path when the run is an ambient
|
|
30
|
+
* live-source refresh AND no full integration is owed -> mounted-rows MERGE
|
|
31
|
+
* when the run is a range refresh over the same plot set AND no full
|
|
32
|
+
* integration is owed -> full remount.
|
|
33
|
+
* Pure: the caller keeps every side effect; this pins the CHOICE.
|
|
34
|
+
*/
|
|
35
|
+
export declare function localRunIntegrationRoute(input: {
|
|
36
|
+
styleMatch: boolean;
|
|
37
|
+
preservePreviousOutput: boolean;
|
|
38
|
+
hasRendererUpdate: boolean;
|
|
39
|
+
allowOrderbookZeroBar: boolean;
|
|
40
|
+
isLiveSourceRefresh: boolean;
|
|
41
|
+
owedFullIntegration: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* A source-cache revalidation result whose plot set (output keys, plot
|
|
44
|
+
* types, nested panes) matches the last integrated result: the fresh rows
|
|
45
|
+
* land on the mounted row set, never a remount. Defaults false (every
|
|
46
|
+
* pre-existing caller).
|
|
47
|
+
*/
|
|
48
|
+
revalidationSamePlotSet?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* A range-refresh result (a lazy history page, the loaded-range refresh,
|
|
51
|
+
* or a refresh whose cycle already acked: `isLocalRunRangeRefreshResult`)
|
|
52
|
+
* whose plot set matches the last integrated result and whose mount is
|
|
53
|
+
* not a degenerate zombie (`resolveLazyMergePlan`). Its rows UNION with
|
|
54
|
+
* the mounted rows in place (mounted rows plus the new rows, values
|
|
55
|
+
* refreshed where they overlap), never a remount: every candle prepend
|
|
56
|
+
* used to remount every local script, one blink per page per script.
|
|
57
|
+
* Defaults false (every pre-existing caller).
|
|
58
|
+
*/
|
|
59
|
+
rangeRefreshSamePlotSet?: boolean;
|
|
60
|
+
}): LocalRunRoute;
|
|
61
|
+
/**
|
|
62
|
+
* Resync reasons whose results are full recomputes over the loaded range:
|
|
63
|
+
* a lazy history page (titan-charts.ts lazy load) and the loaded-range
|
|
64
|
+
* refresh after a main candle commit (data-fetching.util.ts). String
|
|
65
|
+
* literals on purpose: this is a leaf module and the loaded-range reason is
|
|
66
|
+
* only ever spelled at its producer.
|
|
67
|
+
*/
|
|
68
|
+
export declare const LOCAL_RUN_RANGE_REFRESH_REASONS: ReadonlySet<string>;
|
|
69
|
+
/**
|
|
70
|
+
* Whether a local-run result is a range refresh (a full recompute over the
|
|
71
|
+
* loaded range) rather than a first run, a live tick, a settings recompute
|
|
72
|
+
* or a domain switch. Two shapes qualify:
|
|
73
|
+
* - the resync slot names a range-refresh reason;
|
|
74
|
+
* - the slot is EMPTY on a non-first, non-deferred result. The engine
|
|
75
|
+
* proxy resolves `refresh()` on the worker ACK, which can land before the
|
|
76
|
+
* run result posts, and the cycle's `complete()` clears the slot on that
|
|
77
|
+
* ack: the run result then arrives unlabelled. The 2026-09-13 boot ring
|
|
78
|
+
* (three overlapping refreshes: init, loaded-range, warmup lazy page)
|
|
79
|
+
* showed exactly that, the third result attributed `null` and remounted.
|
|
80
|
+
* A deferred unlabelled result is a live tick (the caller's live arm);
|
|
81
|
+
* a first run is the mount and never a refresh.
|
|
82
|
+
* Only the attribution: the same-plot-set and degenerate-mount checks stay
|
|
83
|
+
* with the caller (`rangeRefreshSamePlotSet`).
|
|
84
|
+
*/
|
|
85
|
+
export declare function isLocalRunRangeRefreshResult(input: {
|
|
86
|
+
resyncReason: string | null | undefined;
|
|
87
|
+
deferred: boolean;
|
|
88
|
+
wasFirstRun: boolean;
|
|
89
|
+
}): boolean;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The integration decision core's names a wrun run reads (a leaf of utility/chart/kscript-integration-decision.util.ts;
|
|
3
|
+
* P2/inventory.md section 1.1): the lazy merge plan over a mounted snapshot, and the local-run route with its
|
|
4
|
+
* range-refresh attribution, the choice wrun-integration-route.util feeds from a wrun run. Pure: verbatim bodies, no
|
|
5
|
+
* state, and its one import is the degenerate-rows leaf, so it moves into the chart-host package with the phase 2
|
|
6
|
+
* closure. The decision core re-exports every name and keeps its deciders.
|
|
7
|
+
*/
|
|
8
|
+
import { protectedKScriptRowsLookDegenerate } from './protected-kscript-degenerate-rows.leaf.js';
|
|
9
|
+
/**
|
|
10
|
+
* A zombie mount (epoch-adjacent rows from a broken integration) must not be
|
|
11
|
+
* preserved by the merge; the fresh result replaces it wholesale.
|
|
12
|
+
*/
|
|
13
|
+
export function resolveLazyMergePlan(snapshot) {
|
|
14
|
+
if (snapshot.present && protectedKScriptRowsLookDegenerate(snapshot.rawData))
|
|
15
|
+
return 'degenerate-replace';
|
|
16
|
+
return 'canonical-merge';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* The local engine callback's integration route, in its exact historical
|
|
20
|
+
* decision order: style mismatch -> transient preserve -> no renderer update
|
|
21
|
+
* (orderbook zero-bar results surface summaries only; everything else is
|
|
22
|
+
* diagnostics-only) -> mounted-rows fast path when the run is an ambient
|
|
23
|
+
* live-source refresh AND no full integration is owed -> mounted-rows MERGE
|
|
24
|
+
* when the run is a range refresh over the same plot set AND no full
|
|
25
|
+
* integration is owed -> full remount.
|
|
26
|
+
* Pure: the caller keeps every side effect; this pins the CHOICE.
|
|
27
|
+
*/
|
|
28
|
+
export function localRunIntegrationRoute(input) {
|
|
29
|
+
if (!input.styleMatch)
|
|
30
|
+
return { action: 'skip', reason: 'style-mismatch' };
|
|
31
|
+
if (input.preservePreviousOutput)
|
|
32
|
+
return { action: 'skip', reason: 'preserve-previous-output' };
|
|
33
|
+
if (!input.hasRendererUpdate) {
|
|
34
|
+
if (input.allowOrderbookZeroBar)
|
|
35
|
+
return { action: 'skip', reason: 'orderbook-zero-bar-summary-only' };
|
|
36
|
+
return { action: 'skip', reason: 'no-renderer-update' };
|
|
37
|
+
}
|
|
38
|
+
if ((input.isLiveSourceRefresh || input.revalidationSamePlotSet === true) && !input.owedFullIntegration) {
|
|
39
|
+
return { action: 'apply-rows-refresh' };
|
|
40
|
+
}
|
|
41
|
+
if (input.rangeRefreshSamePlotSet === true && !input.owedFullIntegration) {
|
|
42
|
+
return { action: 'apply-rows-merge' };
|
|
43
|
+
}
|
|
44
|
+
return { action: 'apply-remount' };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resync reasons whose results are full recomputes over the loaded range:
|
|
48
|
+
* a lazy history page (titan-charts.ts lazy load) and the loaded-range
|
|
49
|
+
* refresh after a main candle commit (data-fetching.util.ts). String
|
|
50
|
+
* literals on purpose: this is a leaf module and the loaded-range reason is
|
|
51
|
+
* only ever spelled at its producer.
|
|
52
|
+
*/
|
|
53
|
+
export const LOCAL_RUN_RANGE_REFRESH_REASONS = new Set([
|
|
54
|
+
'lazy-range-refresh',
|
|
55
|
+
'loaded-range-refresh',
|
|
56
|
+
]);
|
|
57
|
+
/**
|
|
58
|
+
* Whether a local-run result is a range refresh (a full recompute over the
|
|
59
|
+
* loaded range) rather than a first run, a live tick, a settings recompute
|
|
60
|
+
* or a domain switch. Two shapes qualify:
|
|
61
|
+
* - the resync slot names a range-refresh reason;
|
|
62
|
+
* - the slot is EMPTY on a non-first, non-deferred result. The engine
|
|
63
|
+
* proxy resolves `refresh()` on the worker ACK, which can land before the
|
|
64
|
+
* run result posts, and the cycle's `complete()` clears the slot on that
|
|
65
|
+
* ack: the run result then arrives unlabelled. The 2026-09-13 boot ring
|
|
66
|
+
* (three overlapping refreshes: init, loaded-range, warmup lazy page)
|
|
67
|
+
* showed exactly that, the third result attributed `null` and remounted.
|
|
68
|
+
* A deferred unlabelled result is a live tick (the caller's live arm);
|
|
69
|
+
* a first run is the mount and never a refresh.
|
|
70
|
+
* Only the attribution: the same-plot-set and degenerate-mount checks stay
|
|
71
|
+
* with the caller (`rangeRefreshSamePlotSet`).
|
|
72
|
+
*/
|
|
73
|
+
export function isLocalRunRangeRefreshResult(input) {
|
|
74
|
+
if (input.wasFirstRun)
|
|
75
|
+
return false;
|
|
76
|
+
if (typeof input.resyncReason === 'string' && input.resyncReason.length > 0) {
|
|
77
|
+
return LOCAL_RUN_RANGE_REFRESH_REASONS.has(input.resyncReason);
|
|
78
|
+
}
|
|
79
|
+
return !input.deferred;
|
|
80
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type KScriptLiveSourceSnapshotLike } from './kscript-live-source-identity.util.js';
|
|
2
|
+
export declare const V2_LIVE_PENDING_DATA_POINT_CAP = 1024;
|
|
3
|
+
export declare const V2_LIVE_HIDDEN_BACKLOG_RUN_POINTS = 512;
|
|
4
|
+
/**
|
|
5
|
+
* Hidden hold counters (rest-cost H6), for the hidden live pace stats
|
|
6
|
+
* (`window.__kiyoLiveHiddenPaceStats()`, hidden-live-drain.util):
|
|
7
|
+
* - `kscriptHolds`: script holds taken, once per script per hide (the
|
|
8
|
+
* `local-kscript-hidden-hold` ring event);
|
|
9
|
+
* - `kscriptHiddenRuns`: engine passes a held script ran while the page was
|
|
10
|
+
* hidden (the backlog runs). A healthy hide adds 0: the return's one pass
|
|
11
|
+
* per script is the `local-kscript-hidden-drain` ring event.
|
|
12
|
+
*/
|
|
13
|
+
export interface LocalKScriptHiddenHoldStats {
|
|
14
|
+
kscriptHolds: number;
|
|
15
|
+
kscriptHiddenRuns: number;
|
|
16
|
+
}
|
|
17
|
+
export declare function noteLocalKScriptHiddenHold(): void;
|
|
18
|
+
export declare function noteLocalKScriptHiddenRun(): void;
|
|
19
|
+
export declare function getLocalKScriptHiddenHoldStats(): LocalKScriptHiddenHoldStats;
|
|
20
|
+
export declare function shouldAccumulateV2LiveDataPoints(sourceType: unknown): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The size floor a raw TRADE print must clear to fold into ANY `trades`
|
|
23
|
+
* source of an engine: the smallest declared minSize (0 when a source has
|
|
24
|
+
* none). Applied at intake, before the pending queue, so a busy feed's small
|
|
25
|
+
* prints cannot push a qualifying print out of the 1,024-message window.
|
|
26
|
+
*/
|
|
27
|
+
export declare function v2LiveTradesSizeFloor(snapshots: ReadonlyArray<{
|
|
28
|
+
sourceType?: string;
|
|
29
|
+
payload?: unknown;
|
|
30
|
+
}> | undefined): number;
|
|
31
|
+
/** True when a raw TRADE message carries a print below `floor` (a non-print message never is). */
|
|
32
|
+
export declare function v2LiveTradePrintBelowFloor(data: unknown, floor: number): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* One coalesce key's pending live points, oldest first, bounded by the cap.
|
|
35
|
+
*
|
|
36
|
+
* The intake appends every point IN PLACE. The previous shape (a fresh copy
|
|
37
|
+
* of the whole queue per point) cost the busiest key a quadratic amount of
|
|
38
|
+
* copying up to the cap, per local engine (field 2026-09-26). A trim advances
|
|
39
|
+
* a head cursor instead of shifting the array, and the dead prefix is
|
|
40
|
+
* compacted once per cap trims, so a push is O(1) amortized and the array
|
|
41
|
+
* behind the queue never holds more than twice the cap.
|
|
42
|
+
*
|
|
43
|
+
* Ownership: one appender (the intake) and one consumer (the drain), never at
|
|
44
|
+
* the same time. The drain detaches its batch from the coalesce map before it
|
|
45
|
+
* reads any queue, then drains each queue exactly once; a point that arrives
|
|
46
|
+
* after the detach starts the key's next queue, for the next drain. See
|
|
47
|
+
* scheduleCoalescedV2TechnicalScriptLiveUpdate in live-feed.service.ts.
|
|
48
|
+
*/
|
|
49
|
+
export declare class V2LivePendingDataPointQueue {
|
|
50
|
+
private readonly cap;
|
|
51
|
+
private points;
|
|
52
|
+
private head;
|
|
53
|
+
constructor(cap?: number);
|
|
54
|
+
get size(): number;
|
|
55
|
+
/** Appends `point`; returns 1 when the oldest point was trimmed to keep the cap, else 0. */
|
|
56
|
+
push(point: unknown): 0 | 1;
|
|
57
|
+
/** Hands the pending points (oldest first) to the caller and empties the queue. */
|
|
58
|
+
drain(): unknown[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* True when a message of `sourceType` can never fold into this engine: it has
|
|
62
|
+
* initialised with a populated source cache that declares no source of that
|
|
63
|
+
* type. The router offers every subscribed symbol's messages to every local
|
|
64
|
+
* engine, so most (engine, source type) pairs it visits are foreign. The
|
|
65
|
+
* drain already skipped those without a worker round-trip (its zero-match
|
|
66
|
+
* cheap path); this is the same predicate at the intake, so a foreign type
|
|
67
|
+
* never queues a point or arms a drain. Anything less certain still queues
|
|
68
|
+
* (an uninitialised engine, an empty cache, a declared type whose variants
|
|
69
|
+
* reject the message's identity): those keep the drain's bootstrap and
|
|
70
|
+
* deep-lookup paths.
|
|
71
|
+
*/
|
|
72
|
+
export declare function isV2LiveSourceTypeForeignToEngine(engine: {
|
|
73
|
+
hasInitialized?: boolean;
|
|
74
|
+
}, cachedSnapshots: KScriptLiveSourceSnapshotLike[] | undefined, sourceType: string): boolean;
|
|
75
|
+
export declare function v2LiveSeriesIdentityKey(exchange: string | undefined, symbol: string | undefined): string;
|
|
76
|
+
export declare function filterV2LiveDataPointsBySeries(points: unknown[], expectedExchange: string | undefined, expectedSymbol: string | undefined): unknown[];
|