@orangecharts/wrun-chart-host 0.4.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 +15 -4
- 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/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 +313 -18
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +853 -16
- package/dist/index.d.ts +139 -2
- package/dist/index.js +139 -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/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 +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-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.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-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-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,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The capability evidence for "this market has no such feed" (contract C3): the dispatcher's
|
|
3
|
+
* index-mode admission (`dataFetch` in titan-charts.ts) as ONE shared predicate, so a refusal
|
|
4
|
+
* calls a feed missing only where the chart's fetch never serves it, never from an empty window.
|
|
5
|
+
*
|
|
6
|
+
* On an index-mode payload exchange (stocks, forex, commodities, index venues, DEX pools) the
|
|
7
|
+
* dispatcher answers `[]` to every kScript source type but candles and buy/sell volume; a
|
|
8
|
+
* native-rows ask is exempt (its series is not the index-mode market's). A browser-run Indicator's
|
|
9
|
+
* governed options chain is one: the run asks a CME or OPRA chain on the native-rows path (it rides
|
|
10
|
+
* its plane's own reader), so an OpenMarket package's chain on a US stock or ETF chart passes, and a
|
|
11
|
+
* package that is not OpenMarket's own never reaches it (the run refuses it by name first, the OPRA
|
|
12
|
+
* wall; wrun-input-requirements.util `wrunUnservedLanes` with `nativeLanes`).
|
|
13
|
+
*
|
|
14
|
+
* Two market facts narrow it for a browser-run Indicator's lanes (`wrunLaneServiceOnMarket`):
|
|
15
|
+
* - the market-kind table: forex and commodities trade no volume the chart can split, keep no
|
|
16
|
+
* book and list no options, so they serve no volume profile, buy/sell volume, order book,
|
|
17
|
+
* implied volatility or skew, whatever the index-mode admission lets through;
|
|
18
|
+
* - the coin table: the option-summary lanes (implied volatility, skew) hold a series for the
|
|
19
|
+
* coins `WRUN_OPTION_SUMMARY_COINS` lists (BTC and ETH) and no other.
|
|
20
|
+
* The dispatcher's own admission (`isKScriptTypeServedOnIndexMode`) stays as it is.
|
|
21
|
+
*/
|
|
22
|
+
import { checkIsIndexMode } from './index-mode.util.js';
|
|
23
|
+
import { checkIsForexOrCommodity } from './marketKind.util.js';
|
|
24
|
+
import { WRUN_OPTION_SUMMARY_COINS, WRUN_OPTION_SUMMARY_LANES } from '../wrun/wrun-option-summary-lane.util.js';
|
|
25
|
+
/** The kScript source types the dispatcher serves on an index-mode payload exchange. */
|
|
26
|
+
export function isKScriptTypeServedOnIndexMode(kScriptType) {
|
|
27
|
+
return kScriptType === 'K_OHLCV' || kScriptType === 'K_BUY_SELL_VOLUME';
|
|
28
|
+
}
|
|
29
|
+
/** The lane fetch types a forex or commodity market never serves (the market-kind table). */
|
|
30
|
+
const FOREX_COMMODITY_UNSERVED_TYPES = new Set([
|
|
31
|
+
'volume_profile',
|
|
32
|
+
'buy_sell_volume',
|
|
33
|
+
'orderbook',
|
|
34
|
+
WRUN_OPTION_SUMMARY_LANES.implied_volatility.type,
|
|
35
|
+
WRUN_OPTION_SUMMARY_LANES.skew.type,
|
|
36
|
+
]);
|
|
37
|
+
/** The lane fetch types served for some coins only, and those coins (the coin table). */
|
|
38
|
+
const COIN_SERVED_TYPES = Object.freeze({
|
|
39
|
+
[WRUN_OPTION_SUMMARY_LANES.implied_volatility.type]: WRUN_OPTION_SUMMARY_COINS,
|
|
40
|
+
[WRUN_OPTION_SUMMARY_LANES.skew.type]: WRUN_OPTION_SUMMARY_COINS,
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* The capability verdict for one lane on a market (`type` the lane's fetch type, `coin` the
|
|
44
|
+
* chart's coin): a native-rows ask is always served; then the index-mode admission
|
|
45
|
+
* (`'K_' + type.toUpperCase()`), the market-kind table, the coin table. An absent exchange reads
|
|
46
|
+
* as not index-mode and of no kind; an absent or empty coin cannot be judged and is served (the
|
|
47
|
+
* fetch decides).
|
|
48
|
+
*/
|
|
49
|
+
export function wrunLaneServiceOnMarket({ type, exchange, coin, nativeRows, }) {
|
|
50
|
+
if (nativeRows === true)
|
|
51
|
+
return { served: true };
|
|
52
|
+
if (checkIsIndexMode(exchange) && !isKScriptTypeServedOnIndexMode('K_' + type.toUpperCase())) {
|
|
53
|
+
return { served: false, reason: 'index-mode' };
|
|
54
|
+
}
|
|
55
|
+
if (FOREX_COMMODITY_UNSERVED_TYPES.has(type) && checkIsForexOrCommodity(exchange)) {
|
|
56
|
+
return { served: false, reason: 'market-kind' };
|
|
57
|
+
}
|
|
58
|
+
const coins = COIN_SERVED_TYPES[type];
|
|
59
|
+
const word = typeof coin === 'string' ? coin.trim().toUpperCase() : '';
|
|
60
|
+
if (coins !== undefined && word !== '' && !coins.includes(word))
|
|
61
|
+
return { served: false, reason: 'coin', coins };
|
|
62
|
+
return { served: true };
|
|
63
|
+
}
|
|
64
|
+
/** Whether the chart's fetch serves a lane's type on a market (`wrunLaneServiceOnMarket`). */
|
|
65
|
+
export function wrunLaneServedOnMarket(args) {
|
|
66
|
+
return wrunLaneServiceOnMarket(args).served;
|
|
67
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Change-only errorMessage stamps.
|
|
3
|
+
*
|
|
4
|
+
* The fetch pipeline stamps `errorMessage` transiently on hot paths (every
|
|
5
|
+
* non-polling indicator fetch entry and terminal, every diagnostics write),
|
|
6
|
+
* almost always with a value identical to what the overlay already holds.
|
|
7
|
+
* Each write walks the engine's updateSettings (legend rebuild, and a
|
|
8
|
+
* scheduled forced paint on engines without the errorMessage door skip), so
|
|
9
|
+
* during a fetch volley the identical stamps alone re-arm a forced paint
|
|
10
|
+
* every display frame. This helper writes ONLY on a value change.
|
|
11
|
+
*
|
|
12
|
+
* Equality is judged over the union of keys of both values (show/text plus
|
|
13
|
+
* chip extras like severity, hostCard, count, tooltip, details, source: an
|
|
14
|
+
* ownership or count transition always writes), with `show` coerced to
|
|
15
|
+
* boolean and `text` defaulting to '' so an ABSENT stored value equals a
|
|
16
|
+
* `{show:false}` clear. Everything the comparator cannot positively judge
|
|
17
|
+
* fails open (writes): non-primitive members, a malformed non-object value
|
|
18
|
+
* on either side, an overlay not yet mounted in metadata.
|
|
19
|
+
*
|
|
20
|
+
* Loading, gap-filling, and gap-detection never read errorMessage; skipped
|
|
21
|
+
* writes are value-identical by construction, so every visible transition
|
|
22
|
+
* writes exactly as before.
|
|
23
|
+
*/
|
|
24
|
+
import type { WrunChartHandle } from '../../host-ports.types.js';
|
|
25
|
+
export interface IndicatorErrorMessageValue {
|
|
26
|
+
show?: unknown;
|
|
27
|
+
text?: unknown;
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
}
|
|
30
|
+
export declare function indicatorErrorMessagesEqual(a: IndicatorErrorMessageValue | null | undefined, b: IndicatorErrorMessageValue | null | undefined): boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Stamp `errorMessage` on the overlay only when the value actually changed.
|
|
33
|
+
* Returns true when a write happened.
|
|
34
|
+
*/
|
|
35
|
+
export declare function updateIndicatorErrorMessageIfChanged(tc: WrunChartHandle | undefined | null, indicatorId: string, next: IndicatorErrorMessageValue): boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
function normalized(value) {
|
|
2
|
+
const source = value && typeof value === 'object' ? value : {};
|
|
3
|
+
const out = { ...source };
|
|
4
|
+
out.show = Boolean(source.show);
|
|
5
|
+
out.text = source.text ?? '';
|
|
6
|
+
return out;
|
|
7
|
+
}
|
|
8
|
+
export function indicatorErrorMessagesEqual(a, b) {
|
|
9
|
+
// A malformed (non-null, non-object) value cannot be judged: fail open so
|
|
10
|
+
// the write replaces it instead of a skip preserving garbage.
|
|
11
|
+
if (a !== null && a !== undefined && typeof a !== 'object')
|
|
12
|
+
return false;
|
|
13
|
+
if (b !== null && b !== undefined && typeof b !== 'object')
|
|
14
|
+
return false;
|
|
15
|
+
const na = normalized(a);
|
|
16
|
+
const nb = normalized(b);
|
|
17
|
+
const union = new Set([...Object.keys(na), ...Object.keys(nb)]);
|
|
18
|
+
for (const key of union) {
|
|
19
|
+
const av = na[key];
|
|
20
|
+
const bv = nb[key];
|
|
21
|
+
const aEmpty = av === null || av === undefined;
|
|
22
|
+
const bEmpty = bv === null || bv === undefined;
|
|
23
|
+
if (aEmpty && bEmpty)
|
|
24
|
+
continue;
|
|
25
|
+
// Strict equality; non-primitives can never be === across writers, so a
|
|
26
|
+
// structured value fails open and writes.
|
|
27
|
+
if (av !== bv)
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Stamp `errorMessage` on the overlay only when the value actually changed.
|
|
34
|
+
* Returns true when a write happened.
|
|
35
|
+
*/
|
|
36
|
+
export function updateIndicatorErrorMessageIfChanged(tc, indicatorId, next) {
|
|
37
|
+
if (!tc)
|
|
38
|
+
return false;
|
|
39
|
+
const meta = tc.metadata.find((m) => m?.id === indicatorId);
|
|
40
|
+
if (meta && indicatorErrorMessagesEqual(meta.settings?.errorMessage, next))
|
|
41
|
+
return false;
|
|
42
|
+
tc.updateSettings(indicatorId, { errorMessage: next });
|
|
43
|
+
return true;
|
|
44
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
/**
|
|
24
|
+
* The chart-side inputs a run-interval overlay's rows are projected with (run-interval-engine.util
|
|
25
|
+
* runIntervalApplyDomain): identical run rows still paint differently on a chart that gained a bar
|
|
26
|
+
* (live, or a prepended page) or under the other wait-for-close mode, so they join the hash.
|
|
27
|
+
*/
|
|
28
|
+
export interface KScriptApplyProjectionDomain {
|
|
29
|
+
firstTs: number;
|
|
30
|
+
lastTs: number;
|
|
31
|
+
rows: number;
|
|
32
|
+
runMs: number;
|
|
33
|
+
waitForClose: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare function fingerprintKScriptRunResultForApplySkip(runResult: unknown, projection?: KScriptApplyProjectionDomain): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Run-level keys outside the paint: fresh on every post, so a compact post
|
|
38
|
+
* carries them and the re-delivered result shows the run's own values
|
|
39
|
+
* (diagnostics that cleared, a print that changed, the settled-empty flag).
|
|
40
|
+
*/
|
|
41
|
+
export declare const KSCRIPT_RUN_RESULT_SIDE_CHANNEL_KEYS: ReadonlySet<string>;
|
|
42
|
+
/**
|
|
43
|
+
* The render identity of a run result (see the section comment): equal strings
|
|
44
|
+
* mean equal paint. `null` when any part fails open (oversized drawings, tables
|
|
45
|
+
* or JSON, an unsupported cell shape): a null identity is never equal.
|
|
46
|
+
*/
|
|
47
|
+
export declare function fingerprintKScriptRunResultRenderIdentity(result: unknown): string | null;
|
|
48
|
+
/**
|
|
49
|
+
* The part of a run result a compact post carries: ONLY the side-channel keys
|
|
50
|
+
* (diagnostics, print outputs, timings, the settled-empty flag, the declared
|
|
51
|
+
* depth): fresh values the host consumes outside the paint. Every other key
|
|
52
|
+
* is inside the render identity, so the cached full result's copy is equal by
|
|
53
|
+
* construction and the compose below reuses it (settings, define, script
|
|
54
|
+
* inputs and the like never cross twice; a compact post stays a few hundred
|
|
55
|
+
* bytes next to a 35 KB full one).
|
|
56
|
+
*/
|
|
57
|
+
export declare function splitKScriptRunResultForCompactPost(result: unknown): Record<string, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* The full result a compact post stands for: the cached result (every key by
|
|
60
|
+
* reference, so the apply-skip memo below still hits) with the compact post's
|
|
61
|
+
* side-channel fields over it. A side-channel key the new run dropped is
|
|
62
|
+
* dropped here too (its absence is the fresh value).
|
|
63
|
+
*/
|
|
64
|
+
export declare function composeKScriptRunResultFromCompact(cached: unknown, light: Record<string, unknown>): unknown;
|
|
65
|
+
export declare function fingerprintKScriptRunResultForApplySkipMemo(runResult: unknown, projection?: KScriptApplyProjectionDomain): string | null;
|
|
@@ -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
|
+
}
|