@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,93 @@
|
|
|
1
|
+
import type { WrunIndicatorMetadata } from '../../interfaces/wrun-runtime.interface.js';
|
|
2
|
+
/** One audited package on the prefix-safe roster (src/constants/wrun-prefix-safe.constants.ts). */
|
|
3
|
+
export interface WrunPrefixSafeEntry {
|
|
4
|
+
/** The registry package name, matched exactly (`@scope/name`), or a kit template's `template:<id>`, which only
|
|
5
|
+
* names the audit: a template mounts as a draft and is matched by `sourceDigest`, never by this name. */
|
|
6
|
+
packageName: string;
|
|
7
|
+
/** '*' (every version, an unknown one included) or a semver range: `||` between alternatives, spaces between
|
|
8
|
+
* the comparators of one alternative, each comparator a strict version with an optional `=`, `>`, `>=`, `<`,
|
|
9
|
+
* `<=`, `^` or `~` joined to it. A prerelease is admitted only by an exact pin of that prerelease. A draft has
|
|
10
|
+
* no version, so only '*' admits one. */
|
|
11
|
+
versions: string;
|
|
12
|
+
/** The audited builds' module sha256 (lowercase hex). Present = only these bytes ride the entry. */
|
|
13
|
+
wasmSha256?: string[];
|
|
14
|
+
/** The audited sources' sha256 (lowercase hex of the compiled entry's UTF-8 text: the draft lane's
|
|
15
|
+
* `wrunDraftRef.sourceDigest`). Present = a draft compiled from one of these sources rides the entry, whatever
|
|
16
|
+
* the entry's name; a registry identity (it carries no source digest) never does. Required on a template entry. */
|
|
17
|
+
sourceDigest?: string[];
|
|
18
|
+
/** The day of the audit, YYYY-MM-DD. */
|
|
19
|
+
auditedOn: string;
|
|
20
|
+
/** What the audit read, in plain words with file and line references. */
|
|
21
|
+
why: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The roster's verdict on a package identity: safe with the first entry (file order) that admits its version and,
|
|
25
|
+
* when the entry pins builds or sources, its module hash and its source digest; 'not-audited' when no well-formed
|
|
26
|
+
* entry names the package (a registry identity) or lists the draft's source digest (a draft: `sourceDigest` set,
|
|
27
|
+
* looked up by that digest alone, never by a name); 'version-outside-audit' when entries name it but none admits this
|
|
28
|
+
* version, build or source (an unknown version passes only a '*' entry, an unknown hash never passes a pinned one, a
|
|
29
|
+
* registry identity never passes a source-pinned one). `wasmSha256` is the sheet's `wasm_sha256`, which the host
|
|
30
|
+
* verifies against the module bytes before it compiles them (wrun-host.service loadModule); `sourceDigest` is a
|
|
31
|
+
* draft overlay's `wrunDraftRef.sourceDigest`, the compile pipeline's sha256 of the entry source's UTF-8 text, and
|
|
32
|
+
* null for every other overlay.
|
|
33
|
+
*/
|
|
34
|
+
export declare function isWrunPrefixSafePackage(identity: {
|
|
35
|
+
packageName: string;
|
|
36
|
+
version: string | null;
|
|
37
|
+
wasmSha256: string | null;
|
|
38
|
+
sourceDigest: string | null;
|
|
39
|
+
}): {
|
|
40
|
+
safe: true;
|
|
41
|
+
entry: WrunPrefixSafeEntry;
|
|
42
|
+
} | {
|
|
43
|
+
safe: false;
|
|
44
|
+
reason: 'not-audited' | 'version-outside-audit';
|
|
45
|
+
};
|
|
46
|
+
/** How a mounted output reached the chart, as the caller classifies it: `handle` is a drawing from the run's handle
|
|
47
|
+
* ledger (wrun-3 `wrun_h_<kind>_<id>`), `drawing` any other (a sheet drawing, a segment, a line's fill),
|
|
48
|
+
* `cornerLabel` a corner `label` renderer's plot output, `guide` a guide output's hline (`role: "guide"`). */
|
|
49
|
+
export type WrunPrefixMountedOutputKind = 'series' | 'guide' | 'priceLabel' | 'cornerLabel' | 'table' | 'drawing' | 'handle' | 'child' | 'other';
|
|
50
|
+
/** One output the overlay mounts: its key (an output name, a child's name, a drawing's id), its plot word (a
|
|
51
|
+
* handle's: its handle kind), its kind and, for a child, its cell layout (a heatmap's `cellLayout`); for a handle,
|
|
52
|
+
* its anchor word as its record carries it (absent: chart coordinates, a bar's time and a price). */
|
|
53
|
+
export interface WrunPrefixMountedOutput {
|
|
54
|
+
key: string;
|
|
55
|
+
plot: string;
|
|
56
|
+
kind: WrunPrefixMountedOutputKind;
|
|
57
|
+
childLayout?: string;
|
|
58
|
+
anchor?: string;
|
|
59
|
+
}
|
|
60
|
+
/** The nine pane corners a snapshot handle may be pinned to (the first nine of wrun-handles.util
|
|
61
|
+
* WRUN_DRAWING_ANCHORS, its WRUN_LABEL_POSITIONS; mirrored so this leaf never pulls the handle ledger's graph in,
|
|
62
|
+
* the cohort spec pins the two together): both coordinates in pane pixels, so the picture is the record's props and
|
|
63
|
+
* no bar's. The edge words follow a chart axis (`top` and `bottom`: x is a bar's time; `left` and `right`: y is a
|
|
64
|
+
* price) and a record with no anchor sits at a bar's time and a price. */
|
|
65
|
+
export declare const WRUN_PREFIX_SNAPSHOT_ANCHORS: ReadonlyArray<string>;
|
|
66
|
+
/**
|
|
67
|
+
* Whether every output the overlay mounts lands as an exact prepend: each mounted output a dense timestamped series
|
|
68
|
+
* (line, spline, bar, histogram, area, step and their fill variants), a guide's hline, a lower-pane `series` child, a
|
|
69
|
+
* child with cell layout 'book' or 'grid', or a batched marks child (`marks`, `spans`, `rays`); and nothing the sheet
|
|
70
|
+
* declares outside that cohort (guides, sparse declarations and last-row styles are in it, under the run lane's
|
|
71
|
+
* landing-time proofs). The one exception is a snapshot
|
|
72
|
+
* output, a label handle pinned to a pane corner (a sheet whose `handles` enable corner labels alone): admitted,
|
|
73
|
+
* and listed in `snapshotHandles` (positions in `mountedOutputs`, in order), whose payload the overlap proof must
|
|
74
|
+
* find equal on both runs because a landing replaces the mounted handle set whole. Unsupported answers carry the
|
|
75
|
+
* first offending key, mounted outputs first (in the order given), then the sheet's declarations (in sheet order),
|
|
76
|
+
* as `<key>: <why>`.
|
|
77
|
+
*/
|
|
78
|
+
export declare function wrunPrefixCohort(input: {
|
|
79
|
+
sheet: WrunIndicatorMetadata;
|
|
80
|
+
mountedOutputs: ReadonlyArray<{
|
|
81
|
+
key: string;
|
|
82
|
+
plot: string;
|
|
83
|
+
kind: WrunPrefixMountedOutputKind;
|
|
84
|
+
childLayout?: string;
|
|
85
|
+
anchor?: string;
|
|
86
|
+
}>;
|
|
87
|
+
}): {
|
|
88
|
+
supported: true;
|
|
89
|
+
snapshotHandles: number[];
|
|
90
|
+
} | {
|
|
91
|
+
supported: false;
|
|
92
|
+
reason: string;
|
|
93
|
+
};
|
|
@@ -0,0 +1,484 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who may take a prefix run (TITAN-RENDER-SAFEGUARDS pan-back plan, contract C8): a pan-back that prepends older
|
|
3
|
+
* bars computes only those bars plus a short overlap, instead of re-running the whole loaded history, when the
|
|
4
|
+
* package is admitted (the compiler's stamp, or the roster here) AND the landing shape here says yes. The overlap
|
|
5
|
+
* check (wrun-prefix-proof.util) only validates a prefix; it never admits one.
|
|
6
|
+
*
|
|
7
|
+
* - isWrunPrefixSafePackage (the audited exceptions): the package is on the roster
|
|
8
|
+
* (src/constants/wrun-prefix-safe.constants.ts).
|
|
9
|
+
* The property both admissions rest on is history independence: every bar's outputs and price-canvas cells read
|
|
10
|
+
* only that bar's inputs, no module-level state carries from bar to bar, and nothing reads a bar index or the run's
|
|
11
|
+
* length. Only that property makes a cold run started at the chart's first bar agree with the mounted rows AFTER
|
|
12
|
+
* the overlap, and no comparison of the overlap can see it (wrun-prefix-proof.util has the counterexample). The
|
|
13
|
+
* compiler proves it for most authors and says so on the sheet (`history_independent: true`, kit 0.66.0), and the
|
|
14
|
+
* overlay run admits a session on that stamp once the module corroborates it (wrun-overlay-run.util,
|
|
15
|
+
* `wrunPrefixStampCorroborated`), with no roster entry: the shipped Book Heat template is admitted that way since
|
|
16
|
+
* kit 0.67.2, which dropped its corner note and with it the one value the template carried from bar to bar. This
|
|
17
|
+
* roster is the audited-exception list beside the stamp: modules a person read and found history-independent where
|
|
18
|
+
* it matters although the compiler cannot prove it (today the registry's compiled Book Heat, whose sheet carries no
|
|
19
|
+
* stamp, pinned to its audited module bytes), each admitted with the closed-book guard the stamp does not need. A
|
|
20
|
+
* registry package is looked up by its name; an editor draft (a kit template the Indicators dialog compiles in the
|
|
21
|
+
* browser, or an author's own Run) carries no registry identity, so it is looked up by the sha256 of the source it
|
|
22
|
+
* was compiled from (`wrunDraftRef.sourceDigest`), never by a name; no shipped template has an entry.
|
|
23
|
+
* - wrunPrefixCohort (the landing shape): every output the overlay mounts lands as an exact prepend through the
|
|
24
|
+
* merge route, so the union of the prefix rows and the mounted rows is the full run's picture. Dense per-bar
|
|
25
|
+
* series, the lower pane that carries them, book or grid heatmap children, and the batched marks children
|
|
26
|
+
* (WRUN-BATCHED-MARKS: `marks`, `spans` and `rays`, one row per bar read off the bar's own data-only outputs, so a
|
|
27
|
+
* landing prepends rows like a heatmap's) do; anything whose picture depends on more than its own bar does not
|
|
28
|
+
* (price and corner labels, tables, drawings, displaced outputs, profiles, matrices and other children,
|
|
29
|
+
* strategies). One exception is a SNAPSHOT
|
|
30
|
+
* output: a label handle pinned to one of the nine pane corners. The run hands back its handle ledger's whole live
|
|
31
|
+
* set and a landing replaces the mounted set with it (drawings are never merged), so a prefix may land it only when
|
|
32
|
+
* its set equals the mounted one; the proof compares the two (wrun-prefix-proof.util), and the cohort answers which
|
|
33
|
+
* mounted outputs those handles are (`snapshotHandles`). Every other handle kind or anchor still refuses.
|
|
34
|
+
* - Three declarations a run reads past its own bar are admitted under the landing-time proofs the run lane takes
|
|
35
|
+
* (WRUN-WARMUP-LEVELS 4a, wrun-prefix-proof.util `proveWrunPrefixRunSnapshots` and `proveWrunPrefixSparseMount`):
|
|
36
|
+
* a guide (`role: "guide"`, mounted as the engine's hline: one constant value, the last finite value its run gave
|
|
37
|
+
* it), held to the mounted guide and the session rows (`guides`); a style read from the run's last ready row
|
|
38
|
+
* (`stroke_width_by`, `show_price_display_by`, `edge_width_by`), held to the one the session derives and the one
|
|
39
|
+
* its mounted plot shows (`styles`); and a sparse output or range (`omit_if_empty`, mounted only once a run gave it
|
|
40
|
+
* a value), whose presence on the mount and whose band fields there the prefix result must keep (`sparse-mount`),
|
|
41
|
+
* the prefix payload carrying every one the mount shows.
|
|
42
|
+
*
|
|
43
|
+
* Pure and leaf: no run module, no store, no chart; the roster loads once with the module.
|
|
44
|
+
*/
|
|
45
|
+
import { WRUN_PREFIX_SAFE_ROSTER } from '../../constants/wrun-prefix-safe.constants.js';
|
|
46
|
+
import { compareSemver, parseSemver } from '../scriptEditor/package-semver.util.js';
|
|
47
|
+
// The registry's package-name grammar (tharamine ANY_PACKAGE_NAME_RE, mirrored as WRUN_PACKAGE_NAME_RE in
|
|
48
|
+
// wrun-registry.service). Mirrored again rather than imported so this leaf never pulls the registry service in.
|
|
49
|
+
const PACKAGE_NAME_RE = /^@[a-z0-9_-]+\/[a-z0-9_-]+$/;
|
|
50
|
+
// A kit template's audit name (`template:<id>`, the id of src/constants/scriptEditor/wrun-templates.generated.json).
|
|
51
|
+
const TEMPLATE_NAME_RE = /^template:[a-z0-9_-]+$/;
|
|
52
|
+
const SHA256_RE = /^[0-9a-f]{64}$/i;
|
|
53
|
+
const AUDIT_DAY_RE = /^\d{4}-\d{2}-\d{2}$/;
|
|
54
|
+
const ENTRY_KEYS = new Set([
|
|
55
|
+
'packageName',
|
|
56
|
+
'versions',
|
|
57
|
+
'wasmSha256',
|
|
58
|
+
'sourceDigest',
|
|
59
|
+
'auditedOn',
|
|
60
|
+
'why',
|
|
61
|
+
]);
|
|
62
|
+
const COMPARATOR_RE = /^(>=|<=|>|<|=|\^|~)?(.+)$/;
|
|
63
|
+
/** One comparator token as plain comparators: `^` and `~` become their lower and upper bounds. Null = malformed. */
|
|
64
|
+
function comparatorsOf(token) {
|
|
65
|
+
const match = COMPARATOR_RE.exec(token);
|
|
66
|
+
if (!match)
|
|
67
|
+
return null;
|
|
68
|
+
const op = match[1] ?? '=';
|
|
69
|
+
const version = match[2];
|
|
70
|
+
const parsed = parseSemver(version);
|
|
71
|
+
if (!parsed)
|
|
72
|
+
return null;
|
|
73
|
+
if (op === '^') {
|
|
74
|
+
const { major, minor, patch } = parsed;
|
|
75
|
+
const upper = major > 0 ? `${major + 1}.0.0` : minor > 0 ? `0.${minor + 1}.0` : `0.0.${patch + 1}`;
|
|
76
|
+
return [
|
|
77
|
+
{ op: '>=', version },
|
|
78
|
+
{ op: '<', version: upper },
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
if (op === '~') {
|
|
82
|
+
return [
|
|
83
|
+
{ op: '>=', version },
|
|
84
|
+
{ op: '<', version: `${parsed.major}.${parsed.minor + 1}.0` },
|
|
85
|
+
];
|
|
86
|
+
}
|
|
87
|
+
return [{ op: op, version }];
|
|
88
|
+
}
|
|
89
|
+
/** A range's alternatives, null for '*', undefined when the range is malformed. */
|
|
90
|
+
function alternativesOf(range) {
|
|
91
|
+
const text = range.trim();
|
|
92
|
+
if (text === '*')
|
|
93
|
+
return null;
|
|
94
|
+
const alternatives = [];
|
|
95
|
+
for (const alternative of text.split('||')) {
|
|
96
|
+
const tokens = alternative.trim().split(/\s+/);
|
|
97
|
+
if (tokens.length === 0 || tokens[0] === '')
|
|
98
|
+
return undefined;
|
|
99
|
+
const comparators = [];
|
|
100
|
+
for (const token of tokens) {
|
|
101
|
+
const parsed = comparatorsOf(token);
|
|
102
|
+
if (parsed === null)
|
|
103
|
+
return undefined;
|
|
104
|
+
comparators.push(...parsed);
|
|
105
|
+
}
|
|
106
|
+
alternatives.push(comparators);
|
|
107
|
+
}
|
|
108
|
+
return alternatives;
|
|
109
|
+
}
|
|
110
|
+
function holds(cmp, op) {
|
|
111
|
+
switch (op) {
|
|
112
|
+
case '=':
|
|
113
|
+
return cmp === 0;
|
|
114
|
+
case '>':
|
|
115
|
+
return cmp > 0;
|
|
116
|
+
case '>=':
|
|
117
|
+
return cmp >= 0;
|
|
118
|
+
case '<':
|
|
119
|
+
return cmp < 0;
|
|
120
|
+
case '<=':
|
|
121
|
+
return cmp <= 0;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/** A release satisfies an alternative when every comparator holds; a prerelease also needs an exact pin of itself
|
|
125
|
+
* in that alternative, so a range never admits a build nobody named. */
|
|
126
|
+
function versionAdmitted(version, alternatives) {
|
|
127
|
+
if (alternatives === null)
|
|
128
|
+
return true;
|
|
129
|
+
if (version === null)
|
|
130
|
+
return false;
|
|
131
|
+
const parsed = parseSemver(version);
|
|
132
|
+
if (!parsed)
|
|
133
|
+
return false;
|
|
134
|
+
const prerelease = parsed.prerelease.length > 0;
|
|
135
|
+
return alternatives.some((comparators) => {
|
|
136
|
+
let pinned = false;
|
|
137
|
+
for (const comparator of comparators) {
|
|
138
|
+
const cmp = compareSemver(version, comparator.version);
|
|
139
|
+
if (!holds(cmp, comparator.op))
|
|
140
|
+
return false;
|
|
141
|
+
if (comparator.op === '=')
|
|
142
|
+
pinned = true;
|
|
143
|
+
}
|
|
144
|
+
return !prerelease || pinned;
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
function isAuditDay(value) {
|
|
148
|
+
if (typeof value !== 'string' || !AUDIT_DAY_RE.test(value))
|
|
149
|
+
return false;
|
|
150
|
+
const day = new Date(`${value}T00:00:00Z`);
|
|
151
|
+
return !Number.isNaN(day.getTime()) && day.toISOString().slice(0, 10) === value;
|
|
152
|
+
}
|
|
153
|
+
/** A list of sha256 hex strings, lowercased: null when absent, undefined when malformed (not a list, empty, or an
|
|
154
|
+
* item that is not 64 hex digits). */
|
|
155
|
+
function sha256ListOf(value) {
|
|
156
|
+
if (value === undefined)
|
|
157
|
+
return null;
|
|
158
|
+
if (!Array.isArray(value) || value.length === 0)
|
|
159
|
+
return undefined;
|
|
160
|
+
if (!value.every((hash) => typeof hash === 'string' && SHA256_RE.test(hash)))
|
|
161
|
+
return undefined;
|
|
162
|
+
return value.map((hash) => hash.toLowerCase());
|
|
163
|
+
}
|
|
164
|
+
/** A well-formed roster entry, else null. Strict on purpose: an unknown key (a misspelt `wasmSha256` would silently
|
|
165
|
+
* widen the audit to every build) or any malformed field disables the entry, never the roster. A template entry
|
|
166
|
+
* without `sourceDigest` is malformed: it is matched by digest alone, so it could only ever admit nothing. */
|
|
167
|
+
function rosterEntryOf(value) {
|
|
168
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
169
|
+
return null;
|
|
170
|
+
const record = value;
|
|
171
|
+
if (Object.keys(record).some((key) => !ENTRY_KEYS.has(key)))
|
|
172
|
+
return null;
|
|
173
|
+
const { packageName, versions, wasmSha256, sourceDigest, auditedOn, why } = record;
|
|
174
|
+
if (typeof packageName !== 'string')
|
|
175
|
+
return null;
|
|
176
|
+
const template = TEMPLATE_NAME_RE.test(packageName);
|
|
177
|
+
if (!template && !PACKAGE_NAME_RE.test(packageName))
|
|
178
|
+
return null;
|
|
179
|
+
if (typeof versions !== 'string')
|
|
180
|
+
return null;
|
|
181
|
+
const alternatives = alternativesOf(versions);
|
|
182
|
+
if (alternatives === undefined)
|
|
183
|
+
return null;
|
|
184
|
+
const hashes = sha256ListOf(wasmSha256);
|
|
185
|
+
if (hashes === undefined)
|
|
186
|
+
return null;
|
|
187
|
+
const digests = sha256ListOf(sourceDigest);
|
|
188
|
+
if (digests === undefined || (template && digests === null))
|
|
189
|
+
return null;
|
|
190
|
+
if (!isAuditDay(auditedOn))
|
|
191
|
+
return null;
|
|
192
|
+
if (typeof why !== 'string' || why.trim() === '')
|
|
193
|
+
return null;
|
|
194
|
+
return {
|
|
195
|
+
entry: {
|
|
196
|
+
packageName,
|
|
197
|
+
versions,
|
|
198
|
+
...(hashes !== null ? { wasmSha256: hashes } : {}),
|
|
199
|
+
...(digests !== null ? { sourceDigest: digests } : {}),
|
|
200
|
+
auditedOn,
|
|
201
|
+
why,
|
|
202
|
+
},
|
|
203
|
+
alternatives,
|
|
204
|
+
hashes: hashes !== null ? new Set(hashes) : null,
|
|
205
|
+
digests: digests !== null ? new Set(digests) : null,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function indexEntry(index, key, entry) {
|
|
209
|
+
const list = index.get(key);
|
|
210
|
+
if (list)
|
|
211
|
+
list.push(entry);
|
|
212
|
+
else
|
|
213
|
+
index.set(key, [entry]);
|
|
214
|
+
}
|
|
215
|
+
/** The roster, indexed. A roster that is not an array admits nothing. */
|
|
216
|
+
function loadRoster(raw) {
|
|
217
|
+
const byName = new Map();
|
|
218
|
+
const byDigest = new Map();
|
|
219
|
+
if (!Array.isArray(raw))
|
|
220
|
+
return { byName, byDigest };
|
|
221
|
+
for (const value of raw) {
|
|
222
|
+
const entry = rosterEntryOf(value);
|
|
223
|
+
if (entry === null)
|
|
224
|
+
continue;
|
|
225
|
+
if (PACKAGE_NAME_RE.test(entry.entry.packageName))
|
|
226
|
+
indexEntry(byName, entry.entry.packageName, entry);
|
|
227
|
+
for (const digest of entry.digests ?? [])
|
|
228
|
+
indexEntry(byDigest, digest, entry);
|
|
229
|
+
}
|
|
230
|
+
return { byName, byDigest };
|
|
231
|
+
}
|
|
232
|
+
const ROSTER = loadRoster(WRUN_PREFIX_SAFE_ROSTER);
|
|
233
|
+
/**
|
|
234
|
+
* The roster's verdict on a package identity: safe with the first entry (file order) that admits its version and,
|
|
235
|
+
* when the entry pins builds or sources, its module hash and its source digest; 'not-audited' when no well-formed
|
|
236
|
+
* entry names the package (a registry identity) or lists the draft's source digest (a draft: `sourceDigest` set,
|
|
237
|
+
* looked up by that digest alone, never by a name); 'version-outside-audit' when entries name it but none admits this
|
|
238
|
+
* version, build or source (an unknown version passes only a '*' entry, an unknown hash never passes a pinned one, a
|
|
239
|
+
* registry identity never passes a source-pinned one). `wasmSha256` is the sheet's `wasm_sha256`, which the host
|
|
240
|
+
* verifies against the module bytes before it compiles them (wrun-host.service loadModule); `sourceDigest` is a
|
|
241
|
+
* draft overlay's `wrunDraftRef.sourceDigest`, the compile pipeline's sha256 of the entry source's UTF-8 text, and
|
|
242
|
+
* null for every other overlay.
|
|
243
|
+
*/
|
|
244
|
+
export function isWrunPrefixSafePackage(identity) {
|
|
245
|
+
const digest = typeof identity?.sourceDigest === 'string' && identity.sourceDigest !== ''
|
|
246
|
+
? identity.sourceDigest.toLowerCase()
|
|
247
|
+
: null;
|
|
248
|
+
const entries = digest !== null
|
|
249
|
+
? ROSTER.byDigest.get(digest)
|
|
250
|
+
: typeof identity?.packageName === 'string'
|
|
251
|
+
? ROSTER.byName.get(identity.packageName)
|
|
252
|
+
: undefined;
|
|
253
|
+
if (!entries)
|
|
254
|
+
return { safe: false, reason: 'not-audited' };
|
|
255
|
+
const version = typeof identity.version === 'string' ? identity.version : null;
|
|
256
|
+
const hash = typeof identity.wasmSha256 === 'string' ? identity.wasmSha256.toLowerCase() : null;
|
|
257
|
+
for (const candidate of entries) {
|
|
258
|
+
if (!versionAdmitted(version, candidate.alternatives))
|
|
259
|
+
continue;
|
|
260
|
+
if (candidate.hashes !== null && (hash === null || !candidate.hashes.has(hash)))
|
|
261
|
+
continue;
|
|
262
|
+
if (candidate.digests !== null && (digest === null || !candidate.digests.has(digest)))
|
|
263
|
+
continue;
|
|
264
|
+
// A copy: the roster stays the file's, whatever a caller does with the entry.
|
|
265
|
+
const { entry } = candidate;
|
|
266
|
+
return {
|
|
267
|
+
safe: true,
|
|
268
|
+
entry: {
|
|
269
|
+
...entry,
|
|
270
|
+
...(entry.wasmSha256 ? { wasmSha256: [...entry.wasmSha256] } : {}),
|
|
271
|
+
...(entry.sourceDigest ? { sourceDigest: [...entry.sourceDigest] } : {}),
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
return { safe: false, reason: 'version-outside-audit' };
|
|
276
|
+
}
|
|
277
|
+
/** The nine pane corners a snapshot handle may be pinned to (the first nine of wrun-handles.util
|
|
278
|
+
* WRUN_DRAWING_ANCHORS, its WRUN_LABEL_POSITIONS; mirrored so this leaf never pulls the handle ledger's graph in,
|
|
279
|
+
* the cohort spec pins the two together): both coordinates in pane pixels, so the picture is the record's props and
|
|
280
|
+
* no bar's. The edge words follow a chart axis (`top` and `bottom`: x is a bar's time; `left` and `right`: y is a
|
|
281
|
+
* price) and a record with no anchor sits at a bar's time and a price. */
|
|
282
|
+
export const WRUN_PREFIX_SNAPSHOT_ANCHORS = [
|
|
283
|
+
'top_left',
|
|
284
|
+
'top_center',
|
|
285
|
+
'top_right',
|
|
286
|
+
'middle_left',
|
|
287
|
+
'middle_center',
|
|
288
|
+
'middle_right',
|
|
289
|
+
'bottom_left',
|
|
290
|
+
'bottom_center',
|
|
291
|
+
'bottom_right',
|
|
292
|
+
];
|
|
293
|
+
const SNAPSHOT_ANCHORS = new Set(WRUN_PREFIX_SNAPSHOT_ANCHORS);
|
|
294
|
+
/** The one handle kind a snapshot may be: a label (text at a corner). Lines, boxes and polylines refuse. */
|
|
295
|
+
const SNAPSHOT_HANDLE_KIND = 'label';
|
|
296
|
+
/** A label handle pinned to a pane corner: a snapshot output (the proof compares it whole). */
|
|
297
|
+
function isSnapshotHandle(output) {
|
|
298
|
+
return (output.kind === 'handle' &&
|
|
299
|
+
output.plot === SNAPSHOT_HANDLE_KIND &&
|
|
300
|
+
output.anchor !== undefined &&
|
|
301
|
+
SNAPSHOT_ANCHORS.has(output.anchor));
|
|
302
|
+
}
|
|
303
|
+
// The plot words of a dense timestamped series, one row per bar, in the sheet's words (line, bar, histogram, area)
|
|
304
|
+
// and the engine's (spline, stepLine, and the band and fill shapes an area, a sheet range or a sheet fill mounts
|
|
305
|
+
// as), plus 'empty': the container anchor a parent keeps when its every plot sits in a child pane, one NaN row per
|
|
306
|
+
// bar. A union of two such row sets is a prepend.
|
|
307
|
+
const DENSE_SERIES_PLOTS = new Set([
|
|
308
|
+
'line',
|
|
309
|
+
'spline',
|
|
310
|
+
'bar',
|
|
311
|
+
'histogram',
|
|
312
|
+
'area',
|
|
313
|
+
'step',
|
|
314
|
+
'stepLine',
|
|
315
|
+
'deltaFillSpline',
|
|
316
|
+
'fillBetween',
|
|
317
|
+
'band',
|
|
318
|
+
'empty',
|
|
319
|
+
]);
|
|
320
|
+
/** The heatmap cell layouts a windowed landing merges as a prepend (the heatmap child's rows are per-bar rows). */
|
|
321
|
+
const PREPEND_CHILD_LAYOUTS = new Set(['book', 'grid']);
|
|
322
|
+
/** The batched marks children a windowed landing merges as a prepend (WRUN-BATCHED-MARKS round 2, fold 10): the
|
|
323
|
+
* row-backed canvas kinds whose rows are per-bar rows `[ts, ...fields]` read off the bar's own outputs, mounted
|
|
324
|
+
* with their kind as the layout (wrun-overlay-run `wrunPrefixMountedOutputsOf`). */
|
|
325
|
+
const PREPEND_BATCHED_LAYOUTS = new Set(['marks', 'spans', 'rays']);
|
|
326
|
+
/** A lower-pane child (`series`, wrun-run-result WrunChildOverlay): a pane of the sheet's own outputs, merged
|
|
327
|
+
* through the same route as the parent's rows (wrun-overlay-run mergeWrunChildOverlays), so it is judged by those
|
|
328
|
+
* outputs, which the sheet pass checks. Either spelling of the kind is read. */
|
|
329
|
+
function isSeriesPaneChild(output) {
|
|
330
|
+
return output.plot === 'series' || output.childLayout === 'series';
|
|
331
|
+
}
|
|
332
|
+
/** The one plot a guide mounts as: the engine's hline (wrun-run-result `role: "guide"`). */
|
|
333
|
+
const GUIDE_PLOT = 'hline';
|
|
334
|
+
const MOUNTED_KIND_WORDS = {
|
|
335
|
+
priceLabel: 'a price label',
|
|
336
|
+
cornerLabel: 'a corner label',
|
|
337
|
+
table: 'a table',
|
|
338
|
+
drawing: 'a drawing or handle',
|
|
339
|
+
handle: 'a handle that is not a label pinned to a pane corner',
|
|
340
|
+
other: 'not a dense series',
|
|
341
|
+
};
|
|
342
|
+
function mountedOffence(output) {
|
|
343
|
+
if (isSnapshotHandle(output))
|
|
344
|
+
return null;
|
|
345
|
+
if (output.kind === 'series') {
|
|
346
|
+
// A data-only column (plot '') draws nothing; the sheet pass refuses the one that does (a barcolor tint).
|
|
347
|
+
if (output.plot === '' || DENSE_SERIES_PLOTS.has(output.plot))
|
|
348
|
+
return null;
|
|
349
|
+
return `plot '${output.plot}' is not a dense series`;
|
|
350
|
+
}
|
|
351
|
+
// A guide's hline: its one constant value (the last finite value its run gave it), no rows of its own but the
|
|
352
|
+
// constant per bar a sheet fill reads. The landing rewrites its definition from the payload; the run lane's `guides`
|
|
353
|
+
// proof holds the prefix run's value, the mounted one and the session rows' to one another first.
|
|
354
|
+
if (output.kind === 'guide')
|
|
355
|
+
return output.plot === GUIDE_PLOT ? null : `guide '${output.plot}' is not an hline`;
|
|
356
|
+
if (output.kind === 'child') {
|
|
357
|
+
const layout = output.childLayout;
|
|
358
|
+
if (layout !== undefined && (PREPEND_CHILD_LAYOUTS.has(layout) || PREPEND_BATCHED_LAYOUTS.has(layout)))
|
|
359
|
+
return null;
|
|
360
|
+
if (isSeriesPaneChild(output))
|
|
361
|
+
return null;
|
|
362
|
+
return `child '${output.plot}' with layout '${output.childLayout ?? 'none'}'`;
|
|
363
|
+
}
|
|
364
|
+
return MOUNTED_KIND_WORDS[output.kind] ?? 'an unknown output kind';
|
|
365
|
+
}
|
|
366
|
+
/** Why a declared output cannot land as a prepend, null when it can. A sparse output (`omit_if_empty`), a guide
|
|
367
|
+
* (`role: "guide"`) and a style read from the run's last ready row (`stroke_width_by`, `show_price_display_by`) are
|
|
368
|
+
* admitted: a prefix run's last row is the overlap's end, not the chart's newest bar, and its result may omit what
|
|
369
|
+
* the mount shows, so each lands only under the run lane's landing-time proofs (the module note). A sparse guide is
|
|
370
|
+
* not: a page that gives it no value would carry its constant as NaN, which the guide proof refuses on every such
|
|
371
|
+
* page, so it only ever costs a run. */
|
|
372
|
+
function outputOffence(output) {
|
|
373
|
+
const plot = output.plot ?? 'line';
|
|
374
|
+
// A data-only column never mounts; the proof compares its values. A barcolor one tints the chart's candles,
|
|
375
|
+
// aligned by bar index, and an index moves under a prepend.
|
|
376
|
+
if (plot === '')
|
|
377
|
+
return output.barcolor ? 'tints the chart candles by bar index' : null;
|
|
378
|
+
if (!DENSE_SERIES_PLOTS.has(plot))
|
|
379
|
+
return `plot '${plot}' is not a dense series`;
|
|
380
|
+
if (output.displacement_bars_by !== undefined || (output.displacement_bars ?? 0) !== 0)
|
|
381
|
+
return 'displaced';
|
|
382
|
+
if (output.role === 'guide' && output.omit_if_empty)
|
|
383
|
+
return 'a sparse guide (its constant needs a value the page may not give)';
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
/** The cell layout a declared heatmap builds (wrun-canvases heatmapScaleRule): a grid, book cells or another
|
|
387
|
+
* input's cells. */
|
|
388
|
+
function heatmapLayoutOf(sheet, heatmap) {
|
|
389
|
+
if (heatmap.grid !== undefined)
|
|
390
|
+
return 'grid';
|
|
391
|
+
const source = heatmap.cells !== undefined ? sheet.inputSources?.[heatmap.cells]?.source : undefined;
|
|
392
|
+
return source === 'book' ? 'book' : `${source ?? 'unknown'} cells`;
|
|
393
|
+
}
|
|
394
|
+
function firstNamed(list, fallback) {
|
|
395
|
+
if (!Array.isArray(list) || list.length === 0)
|
|
396
|
+
return null;
|
|
397
|
+
const name = list[0]?.name;
|
|
398
|
+
return typeof name === 'string' && name !== '' ? name : fallback;
|
|
399
|
+
}
|
|
400
|
+
/** Why the sheet's `handles` section (one entry per enabled handle kind, its new-handle defaults) lets the run draw
|
|
401
|
+
* something other than a snapshot, as `<key>: <why>`; null when every kind it enables is a label whose new handles
|
|
402
|
+
* start at a pane corner (or it enables none). A record may move its anchor later; the mounted pass reads the
|
|
403
|
+
* anchor each record carries, and the proof the prefix run's. */
|
|
404
|
+
function handlesOffence(handles) {
|
|
405
|
+
if (handles === undefined)
|
|
406
|
+
return null;
|
|
407
|
+
if (typeof handles !== 'object' || handles === null || Array.isArray(handles)) {
|
|
408
|
+
return 'handles: drawings the run creates';
|
|
409
|
+
}
|
|
410
|
+
for (const [kind, entry] of Object.entries(handles)) {
|
|
411
|
+
if (kind !== SNAPSHOT_HANDLE_KIND)
|
|
412
|
+
return `handles.${kind}: drawings the run creates`;
|
|
413
|
+
const anchor = entry?.anchor;
|
|
414
|
+
if (typeof anchor !== 'string' || !SNAPSHOT_ANCHORS.has(anchor)) {
|
|
415
|
+
return `handles.${kind}: labels at a bar's time or a price, not a pane corner`;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return null;
|
|
419
|
+
}
|
|
420
|
+
/** The first declaration on the sheet that cannot land as a prepend, as `<key>: <why>`; null when none. The sheet
|
|
421
|
+
* is read beside the mounted list because a run may not have mounted it yet (a handle no bar drew, a strategy). */
|
|
422
|
+
function sheetOffence(sheet) {
|
|
423
|
+
// Untyped sheet keys: `strategy` (wrun-box-segment isWrunStrategySheet), `boxes` and `segments`.
|
|
424
|
+
const loose = sheet;
|
|
425
|
+
if (loose.strategy !== undefined)
|
|
426
|
+
return 'strategy: a strategy output';
|
|
427
|
+
const handles = handlesOffence(sheet.handles);
|
|
428
|
+
if (handles !== null)
|
|
429
|
+
return handles;
|
|
430
|
+
for (const output of sheet.outputs ?? []) {
|
|
431
|
+
const offence = outputOffence(output);
|
|
432
|
+
if (offence !== null)
|
|
433
|
+
return `${output.name}: ${offence}`;
|
|
434
|
+
}
|
|
435
|
+
// A range is a dense band over its two edges' rows: a sparse one (`omit_if_empty`) and one styled from the run's
|
|
436
|
+
// last ready row (`edge_width_by`, `show_price_display_by`) land under the same proofs as an output.
|
|
437
|
+
const declared = [
|
|
438
|
+
[sheet.renderers, 'renderers', 'a renderer (price label, corner label, table or widget)'],
|
|
439
|
+
[sheet.drawings, 'drawings', 'a drawing'],
|
|
440
|
+
[loose.boxes, 'boxes', 'a box'],
|
|
441
|
+
[loose.segments, 'segments', 'a segment'],
|
|
442
|
+
[sheet.levels, 'levels', 'docked levels'],
|
|
443
|
+
[sheet.panels, 'panels', 'a panel'],
|
|
444
|
+
[sheet.profiles, 'profiles', 'a profile'],
|
|
445
|
+
[sheet.matrices, 'matrices', 'a matrix'],
|
|
446
|
+
];
|
|
447
|
+
for (const [list, fallback, what] of declared) {
|
|
448
|
+
const key = firstNamed(list, fallback);
|
|
449
|
+
if (key !== null)
|
|
450
|
+
return `${key}: ${what}`;
|
|
451
|
+
}
|
|
452
|
+
for (const heatmap of sheet.heatmaps ?? []) {
|
|
453
|
+
const layout = heatmapLayoutOf(sheet, heatmap);
|
|
454
|
+
if (!PREPEND_CHILD_LAYOUTS.has(layout))
|
|
455
|
+
return `${heatmap.name}: a heatmap over ${layout}`;
|
|
456
|
+
}
|
|
457
|
+
// The batched sections (`marks`, `spans`, `rays`) need no pass of their own: their outputs are data-only (the
|
|
458
|
+
// output pass above reads them) and their children prepend rows (PREPEND_BATCHED_LAYOUTS).
|
|
459
|
+
return null;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Whether every output the overlay mounts lands as an exact prepend: each mounted output a dense timestamped series
|
|
463
|
+
* (line, spline, bar, histogram, area, step and their fill variants), a guide's hline, a lower-pane `series` child, a
|
|
464
|
+
* child with cell layout 'book' or 'grid', or a batched marks child (`marks`, `spans`, `rays`); and nothing the sheet
|
|
465
|
+
* declares outside that cohort (guides, sparse declarations and last-row styles are in it, under the run lane's
|
|
466
|
+
* landing-time proofs). The one exception is a snapshot
|
|
467
|
+
* output, a label handle pinned to a pane corner (a sheet whose `handles` enable corner labels alone): admitted,
|
|
468
|
+
* and listed in `snapshotHandles` (positions in `mountedOutputs`, in order), whose payload the overlap proof must
|
|
469
|
+
* find equal on both runs because a landing replaces the mounted handle set whole. Unsupported answers carry the
|
|
470
|
+
* first offending key, mounted outputs first (in the order given), then the sheet's declarations (in sheet order),
|
|
471
|
+
* as `<key>: <why>`.
|
|
472
|
+
*/
|
|
473
|
+
export function wrunPrefixCohort(input) {
|
|
474
|
+
const snapshotHandles = [];
|
|
475
|
+
for (const [at, output] of input.mountedOutputs.entries()) {
|
|
476
|
+
const offence = mountedOffence(output);
|
|
477
|
+
if (offence !== null)
|
|
478
|
+
return { supported: false, reason: `${output.key}: ${offence}` };
|
|
479
|
+
if (isSnapshotHandle(output))
|
|
480
|
+
snapshotHandles.push(at);
|
|
481
|
+
}
|
|
482
|
+
const offence = sheetOffence(input.sheet);
|
|
483
|
+
return offence === null ? { supported: true, snapshotHandles } : { supported: false, reason: offence };
|
|
484
|
+
}
|