@orangecharts/wrun-chart-host 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -6
- package/dist/constants/exchange-names.leaf.d.ts +8 -0
- package/dist/constants/exchange-names.leaf.js +101 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.d.ts +15 -0
- package/dist/constants/kscript-data-interval-restrictions.constants.js +40 -0
- package/dist/constants/opra-compliance.constants.d.ts +19 -0
- package/dist/constants/opra-compliance.constants.js +19 -0
- package/dist/constants/replay-ladder.leaf.d.ts +30 -0
- package/dist/constants/replay-ladder.leaf.js +99 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.d.ts +133 -0
- package/dist/constants/scriptEditor/builtin-script-snippets.js +451 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.d.ts +168 -0
- package/dist/constants/scriptEditor/cme-official-scripts.constants.js +398 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.d.ts +8 -0
- package/dist/constants/scriptEditor/converted-script-id.leaf.js +10 -0
- package/dist/constants/scriptEditor/execution.constants.d.ts +4 -0
- package/dist/constants/scriptEditor/execution.constants.js +14 -0
- package/dist/constants/wrun-prefix-safe.constants.d.ts +23 -0
- package/dist/constants/wrun-prefix-safe.constants.js +26 -0
- package/dist/host-env.d.ts +321 -24
- package/dist/host-env.js +15 -0
- package/dist/host-ports.types.d.ts +857 -35
- package/dist/index.d.ts +149 -2
- package/dist/index.js +149 -2
- package/dist/instances/script-engine-worker-ohlcv-transfer.d.ts +31 -0
- package/dist/instances/script-engine-worker-ohlcv-transfer.js +164 -0
- package/dist/interfaces/market-event.interface.d.ts +231 -0
- package/dist/interfaces/market-event.interface.js +15 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +70 -134
- package/dist/interfaces/opra-realtime.interface.js +34 -59
- package/dist/interfaces/replay.interface.d.ts +285 -0
- package/dist/interfaces/replay.interface.js +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.d.ts +1 -0
- package/dist/kscript-data/controls/live-ohlcv-merge.util.js +93 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +5 -1
- package/dist/kscript-data/controls/live-trades-merge.util.js +2 -2
- package/dist/market-data/billing.interface.d.ts +219 -0
- package/dist/market-data/billing.interface.js +58 -0
- package/dist/market-data/venue-governed.util.d.ts +2 -0
- package/dist/market-data/venue-governed.util.js +10 -0
- package/dist/market-data/venue.d.ts +122 -0
- package/dist/market-data/venue.js +1 -0
- package/dist/market-data/venues/index.d.ts +97 -0
- package/dist/market-data/venues/index.js +33 -0
- package/dist/market-data/venues/opra.contract.copy.json +35 -0
- package/dist/market-data/venues/opra.d.ts +70 -0
- package/dist/market-data/venues/opra.js +74 -0
- package/dist/replay/replayIndicatorRows.d.ts +31 -0
- package/dist/replay/replayIndicatorRows.js +117 -0
- package/dist/replay/replayLadder.d.ts +85 -0
- package/dist/replay/replayLadder.js +388 -0
- package/dist/utility/auth/server-clock.util.d.ts +81 -0
- package/dist/utility/auth/server-clock.util.js +238 -0
- package/dist/utility/chart/builtin-identity.util.d.ts +18 -0
- package/dist/utility/chart/builtin-identity.util.js +51 -0
- package/dist/utility/chart/cache-alignment.util.d.ts +454 -0
- package/dist/utility/chart/cache-alignment.util.js +926 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.d.ts +15 -0
- package/dist/utility/chart/chart-data-fetch-generation.util.js +22 -0
- package/dist/utility/chart/chart-mount-epoch.util.d.ts +5 -0
- package/dist/utility/chart/chart-mount-epoch.util.js +29 -0
- package/dist/utility/chart/chart-time-domain.util.d.ts +12 -0
- package/dist/utility/chart/chart-time-domain.util.js +23 -0
- package/dist/utility/chart/color-customization.leaf.d.ts +10 -0
- package/dist/utility/chart/color-customization.leaf.js +16 -0
- package/dist/utility/chart/date-labelled-interval.leaf.d.ts +15 -0
- package/dist/utility/chart/date-labelled-interval.leaf.js +19 -0
- package/dist/utility/chart/footprint-tick-grid.util.d.ts +106 -0
- package/dist/utility/chart/footprint-tick-grid.util.js +167 -0
- package/dist/utility/chart/gesture-timing.leaf.d.ts +29 -0
- package/dist/utility/chart/gesture-timing.leaf.js +29 -0
- package/dist/utility/chart/governed-contract-coin.util.d.ts +22 -0
- package/dist/utility/chart/governed-contract-coin.util.js +39 -0
- package/dist/utility/chart/host-bar-placement.util.d.ts +107 -0
- package/dist/utility/chart/host-bar-placement.util.js +447 -0
- package/dist/utility/chart/index-host-tier.util.d.ts +31 -0
- package/dist/utility/chart/index-host-tier.util.js +118 -0
- package/dist/utility/chart/index-mode-admission.util.d.ts +34 -0
- package/dist/utility/chart/index-mode-admission.util.js +67 -0
- package/dist/utility/chart/indicator-error-message.util.d.ts +35 -0
- package/dist/utility/chart/indicator-error-message.util.js +44 -0
- package/dist/utility/chart/indicator-run-interval.util.d.ts +130 -0
- package/dist/utility/chart/indicator-run-interval.util.js +268 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.d.ts +65 -0
- package/dist/utility/chart/kscript-apply-fingerprint.util.js +357 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.d.ts +22 -0
- package/dist/utility/chart/kscript-chart-flush.leaf.js +13 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.d.ts +6 -0
- package/dist/utility/chart/kscript-data-interval-restriction.leaf.js +27 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.d.ts +89 -0
- package/dist/utility/chart/kscript-integration-decision.leaf.js +80 -0
- package/dist/utility/chart/kscript-live-coalesce.util.d.ts +76 -0
- package/dist/utility/chart/kscript-live-coalesce.util.js +156 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.d.ts +34 -0
- package/dist/utility/chart/kscript-live-rest-pace.util.js +134 -0
- package/dist/utility/chart/kscript-live-source-identity.util.d.ts +98 -0
- package/dist/utility/chart/kscript-live-source-identity.util.js +121 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.d.ts +48 -0
- package/dist/utility/chart/kscript-mounted-plot-set.leaf.js +145 -0
- package/dist/utility/chart/kscript-perf-tracker.util.d.ts +243 -0
- package/dist/utility/chart/kscript-perf-tracker.util.js +522 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.d.ts +43 -0
- package/dist/utility/chart/kscript-run-interval-projection.util.js +471 -0
- package/dist/utility/chart/kscript-run-result-equality.util.d.ts +38 -0
- package/dist/utility/chart/kscript-run-result-equality.util.js +89 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.d.ts +2 -0
- package/dist/utility/chart/kscript-settings-revision.leaf.js +12 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.d.ts +63 -0
- package/dist/utility/chart/kscript-source-degrade.leaf.js +68 -0
- package/dist/utility/chart/kscript-source-retention.util.d.ts +134 -0
- package/dist/utility/chart/kscript-source-retention.util.js +218 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.d.ts +57 -0
- package/dist/utility/chart/kscript-standin-identity.leaf.js +61 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.d.ts +15 -0
- package/dist/utility/chart/kscript-titancharts-preparation.util.js +376 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.d.ts +9 -0
- package/dist/utility/chart/kscript-titancharts-render-keys.constants.js +130 -0
- package/dist/utility/chart/kscript-venue-policy.util.d.ts +217 -0
- package/dist/utility/chart/kscript-venue-policy.util.js +324 -0
- package/dist/utility/chart/live-cadence.util.d.ts +38 -0
- package/dist/utility/chart/live-cadence.util.js +37 -0
- package/dist/utility/chart/live-feed-series-match.leaf.d.ts +13 -0
- package/dist/utility/chart/live-feed-series-match.leaf.js +21 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.d.ts +46 -0
- package/dist/utility/chart/local-engine-self-heal-backoff.util.js +46 -0
- package/dist/utility/chart/local-engine-uninit.leaf.d.ts +21 -0
- package/dist/utility/chart/local-engine-uninit.leaf.js +22 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.d.ts +62 -0
- package/dist/utility/chart/local-kscript-source-revalidation.util.js +123 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.d.ts +214 -0
- package/dist/utility/chart/local-kscript-warmup-depth.util.js +376 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.d.ts +85 -0
- package/dist/utility/chart/local-technical-script-live-apply-coalescer.util.js +197 -0
- package/dist/utility/chart/local-technical-script-range.leaf.d.ts +72 -0
- package/dist/utility/chart/local-technical-script-range.leaf.js +126 -0
- package/dist/utility/chart/mixed-mode.util.d.ts +167 -0
- package/dist/utility/chart/mixed-mode.util.js +139 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.d.ts +36 -0
- package/dist/utility/chart/ohlcv-row-readiness.util.js +90 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.d.ts +19 -0
- package/dist/utility/chart/opra-user-scripts-gate.util.js +32 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.d.ts +8 -0
- package/dist/utility/chart/overlay-execution-guard-key.leaf.js +10 -0
- package/dist/utility/chart/price-precision.util.d.ts +40 -0
- package/dist/utility/chart/price-precision.util.js +70 -0
- package/dist/utility/chart/profile-block-size.util.d.ts +64 -0
- package/dist/utility/chart/profile-block-size.util.js +141 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.d.ts +11 -0
- package/dist/utility/chart/protected-kscript-degenerate-rows.leaf.js +29 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.d.ts +28 -0
- package/dist/utility/chart/protected-kscript-empty-output.util.js +84 -0
- package/dist/utility/chart/run-interval-unservable.leaf.d.ts +9 -0
- package/dist/utility/chart/run-interval-unservable.leaf.js +20 -0
- package/dist/utility/chart/run-interval-warmup.leaf.d.ts +19 -0
- package/dist/utility/chart/run-interval-warmup.leaf.js +35 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +9 -5
- package/dist/utility/chart/titan-constants.pin.js +18 -5
- package/dist/utility/chart/warmup-backfill-retry.leaf.d.ts +9 -0
- package/dist/utility/chart/warmup-backfill-retry.leaf.js +9 -0
- package/dist/utility/chart/window-geometry.leaf.d.ts +119 -0
- package/dist/utility/chart/window-geometry.leaf.js +391 -0
- package/dist/utility/chart/window-owner.leaf.d.ts +19 -0
- package/dist/utility/chart/window-owner.leaf.js +24 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.d.ts +11 -2
- package/dist/utility/chart/wrun-bar-session-facts.util.js +10 -3
- package/dist/utility/chart/wrun-run-result.util.d.ts +5 -1
- package/dist/utility/chart/wrun-run-result.util.js +20 -14
- package/dist/utility/common/data-processing.util.d.ts +138 -0
- package/dist/utility/common/data-processing.util.js +346 -0
- package/dist/utility/common/visible-timeout.util.d.ts +13 -4
- package/dist/utility/common/visible-timeout.util.js +23 -8
- package/dist/utility/exchange-format.leaf.d.ts +1 -0
- package/dist/utility/exchange-format.leaf.js +47 -0
- package/dist/utility/html-escape.leaf.d.ts +11 -0
- package/dist/utility/html-escape.leaf.js +20 -0
- package/dist/utility/market-events/earnings-scope.util.d.ts +60 -0
- package/dist/utility/market-events/earnings-scope.util.js +92 -0
- package/dist/utility/market-events/market-events.util.d.ts +147 -0
- package/dist/utility/market-events/market-events.util.js +392 -0
- package/dist/utility/market-events/zoned-clock.util.d.ts +1 -0
- package/dist/utility/market-events/zoned-clock.util.js +11 -0
- package/dist/utility/options/option-venue-disclosure.util.d.ts +43 -0
- package/dist/utility/options/option-venue-disclosure.util.js +56 -0
- package/dist/utility/scriptEditor/package-semver.util.d.ts +51 -0
- package/dist/utility/scriptEditor/package-semver.util.js +120 -0
- package/dist/utility/scriptEditor/temp-script-id.util.d.ts +18 -0
- package/dist/utility/scriptEditor/temp-script-id.util.js +25 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.d.ts +20 -0
- package/dist/utility/symbol-selection/markets-request-from-symbols.leaf.js +81 -0
- package/dist/utility/v2/governed-tier.leaf.d.ts +103 -0
- package/dist/utility/v2/governed-tier.leaf.js +113 -0
- package/dist/utility/watchlist/import/import-request.leaf.d.ts +10 -0
- package/dist/utility/watchlist/import/import-request.leaf.js +10 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +43 -15
- package/dist/utility/wrun/sources/lanes/option_daily.js +78 -20
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +14 -10
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +5 -4
- package/dist/utility/wrun/sources/lanes/series.js +2 -2
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +22 -3
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +38 -7
- package/dist/utility/wrun/sources/registry.js +31 -1
- package/dist/utility/wrun/sources/row-lane-registry.js +5 -5
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +49 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +75 -20
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +49 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +57 -47
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +36 -4
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +6 -12
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +37 -3
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +128 -2
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +233 -51
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +0 -8
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +26 -24
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +85 -104
- package/dist/utility/wrun/wrun-alert-outputs.registry.d.ts +166 -0
- package/dist/utility/wrun/wrun-alert-outputs.registry.js +219 -0
- package/dist/utility/wrun/wrun-bar-count.util.d.ts +83 -0
- package/dist/utility/wrun/wrun-bar-count.util.js +259 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.d.ts +84 -0
- package/dist/utility/wrun/wrun-chart-context-names.util.js +186 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.d.ts +253 -0
- package/dist/utility/wrun/wrun-chart-market-facts.util.js +731 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.d.ts +28 -0
- package/dist/utility/wrun/wrun-cloud-opra-stamp.util.js +45 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-coin-lane-live.util.js +47 -0
- package/dist/utility/wrun/wrun-deadline.util.js +2 -1
- package/dist/utility/wrun/wrun-debug-output.util.d.ts +39 -0
- package/dist/utility/wrun/wrun-debug-output.util.js +63 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.d.ts +113 -0
- package/dist/utility/wrun/wrun-declared-warmup.util.js +181 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-draft-legend-note.util.js +158 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.d.ts +181 -0
- package/dist/utility/wrun/wrun-draft-overlay.util.js +357 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.d.ts +16 -0
- package/dist/utility/wrun/wrun-draw-skipped.leaf.js +16 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.d.ts +42 -0
- package/dist/utility/wrun/wrun-earnings-facts.util.js +131 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-first-run-depth.util.js +118 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.d.ts +24 -0
- package/dist/utility/wrun/wrun-gate-plane-readers.util.js +31 -0
- package/dist/utility/wrun/wrun-held-lanes.util.d.ts +32 -0
- package/dist/utility/wrun/wrun-held-lanes.util.js +94 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.d.ts +2 -0
- package/dist/utility/wrun/wrun-host-visible-clock.util.js +17 -0
- package/dist/utility/wrun/wrun-host.service.d.ts +266 -0
- package/dist/utility/wrun/wrun-host.service.js +655 -0
- package/dist/utility/wrun/wrun-inert-legend.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-inert-legend.util.js +125 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.d.ts +155 -0
- package/dist/utility/wrun/wrun-input-requirements.leaf.js +450 -0
- package/dist/utility/wrun/wrun-integration-route.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-integration-route.util.js +59 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.d.ts +8 -0
- package/dist/utility/wrun/wrun-latest-history.leaf.js +8 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.d.ts +12 -0
- package/dist/utility/wrun/wrun-legend-hover.lazy.js +96 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-lifecycle-runtime.util.js +21 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.d.ts +23 -0
- package/dist/utility/wrun/wrun-live-hidden-hold.util.js +13 -0
- package/dist/utility/wrun/wrun-live-intake.util.d.ts +374 -0
- package/dist/utility/wrun/wrun-live-intake.util.js +2027 -0
- package/dist/utility/wrun/wrun-live-patch.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-live-patch.util.js +523 -0
- package/dist/utility/wrun/wrun-live-tick.util.d.ts +619 -0
- package/dist/utility/wrun/wrun-live-tick.util.js +4974 -0
- package/dist/utility/wrun/wrun-loading-owner.util.d.ts +58 -0
- package/dist/utility/wrun/wrun-loading-owner.util.js +89 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.d.ts +29 -0
- package/dist/utility/wrun/wrun-official-scope.leaf.js +36 -0
- package/dist/utility/wrun/wrun-oi-lane.util.d.ts +27 -0
- package/dist/utility/wrun/wrun-oi-lane.util.js +42 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +29 -10
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +29 -10
- package/dist/utility/wrun/wrun-options-stop.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-options-stop.util.js +123 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.d.ts +719 -0
- package/dist/utility/wrun/wrun-overlay-drivers.util.js +1180 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.d.ts +50 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.lazy.js +131 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.d.ts +118 -0
- package/dist/utility/wrun/wrun-overlay-lifecycle.util.js +466 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.d.ts +45 -0
- package/dist/utility/wrun/wrun-overlay-metadata.util.js +112 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-overlay-recovery.util.js +971 -0
- package/dist/utility/wrun/wrun-overlay-run.util.d.ts +858 -0
- package/dist/utility/wrun/wrun-overlay-run.util.js +11013 -0
- package/dist/utility/wrun/wrun-panel-mount.lazy.d.ts +10 -0
- package/dist/utility/wrun/wrun-panel-mount.lazy.js +68 -0
- package/dist/utility/wrun/wrun-panel-mount.util.d.ts +392 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +2346 -0
- package/dist/utility/wrun/wrun-param-map.util.d.ts +19 -4
- package/dist/utility/wrun/wrun-param-map.util.js +40 -47
- package/dist/utility/wrun/wrun-param-values.util.d.ts +9 -3
- package/dist/utility/wrun/wrun-param-values.util.js +5 -5
- package/dist/utility/wrun/wrun-pause-dim.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-pause-dim.util.js +153 -0
- package/dist/utility/wrun/wrun-plot-gate.types.d.ts +23 -0
- package/dist/utility/wrun/wrun-plot-gate.types.js +7 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.d.ts +93 -0
- package/dist/utility/wrun/wrun-prefix-cohort.util.js +484 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.d.ts +114 -0
- package/dist/utility/wrun/wrun-prefix-lanes.util.js +486 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.d.ts +317 -0
- package/dist/utility/wrun/wrun-prefix-proof.util.js +630 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.d.ts +73 -0
- package/dist/utility/wrun/wrun-refusal-surface.util.js +380 -0
- package/dist/utility/wrun/wrun-refusal-text.util.d.ts +15 -0
- package/dist/utility/wrun/wrun-refusal-text.util.js +40 -0
- package/dist/utility/wrun/wrun-replay-lane.util.d.ts +139 -0
- package/dist/utility/wrun/wrun-replay-lane.util.js +520 -0
- package/dist/utility/wrun/wrun-replay-rows.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-replay-rows.util.js +172 -0
- package/dist/utility/wrun/wrun-row-source-factory.d.ts +53 -0
- package/dist/utility/wrun/wrun-row-source-factory.js +435 -0
- package/dist/utility/wrun/wrun-run-cells.util.d.ts +36 -0
- package/dist/utility/wrun/wrun-run-cells.util.js +46 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.d.ts +14 -0
- package/dist/utility/wrun/wrun-run-interval-projection.types.js +1 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.d.ts +133 -0
- package/dist/utility/wrun/wrun-run-interval-session.util.js +121 -0
- package/dist/utility/wrun/wrun-run-interval.util.d.ts +98 -0
- package/dist/utility/wrun/wrun-run-interval.util.js +207 -0
- package/dist/utility/wrun/wrun-run-retained.util.d.ts +122 -0
- package/dist/utility/wrun/wrun-run-retained.util.js +255 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.d.ts +184 -0
- package/dist/utility/wrun/wrun-sandbox-row-source.js +444 -0
- package/dist/utility/wrun/wrun-script-inputs.util.js +4 -4
- package/dist/utility/wrun/wrun-series-stream.util.d.ts +86 -0
- package/dist/utility/wrun/wrun-series-stream.util.js +537 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.d.ts +21 -0
- package/dist/utility/wrun/wrun-sheet-remembered.util.js +36 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.d.ts +7 -0
- package/dist/utility/wrun/wrun-signal-sound-reasons.leaf.js +12 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +4 -2
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +175 -3
- package/dist/utility/wrun/wrun-source-rows.util.js +294 -8
- package/dist/utility/wrun/wrun-stats-strip.util.d.ts +46 -0
- package/dist/utility/wrun/wrun-stats-strip.util.js +87 -0
- package/dist/utility/wrun/wrun-table-chrome.util.d.ts +163 -0
- package/dist/utility/wrun/wrun-table-chrome.util.js +557 -0
- package/dist/utility/wrun/wrun-text-params.util.d.ts +11 -6
- package/dist/utility/wrun/wrun-text-params.util.js +19 -30
- package/dist/utility/wrun/wrun-transient-rerun.util.d.ts +64 -0
- package/dist/utility/wrun/wrun-transient-rerun.util.js +317 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.d.ts +10 -0
- package/dist/utility/wrun/wrun-twin-lookback.util.js +43 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-warmup-head-store.util.js +120 -0
- package/dist/utility/wrun-alert-params.leaf.d.ts +24 -0
- package/dist/utility/wrun-alert-params.leaf.js +24 -0
- package/dist/utils/replay/replay-buffer-math.d.ts +148 -0
- package/dist/utils/replay/replay-buffer-math.js +684 -0
- package/dist/workers/wrun/wrun-abi-host.d.ts +190 -0
- package/dist/workers/wrun/wrun-abi-host.js +1201 -0
- package/dist/workers/wrun/wrun-engine-handler.d.ts +37 -0
- package/dist/workers/wrun/wrun-engine-handler.js +211 -0
- package/package.json +3 -3
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** How long a transient refusal waits, in visible time, before it shows. */
|
|
2
|
+
export declare const WRUN_TRANSIENT_GRACE_MS = 20000;
|
|
3
|
+
/** What asked for the rerun: the event that may have ended the transient condition. */
|
|
4
|
+
export type WrunTransientRerunTrigger = 'reconnected' | 'worker-restarted' | 'capability-landed' | 'visible' | 'heal';
|
|
5
|
+
/** The overlay a rerun is for. */
|
|
6
|
+
export interface WrunTransientRerunTarget {
|
|
7
|
+
chartIndex: number;
|
|
8
|
+
indicatorId: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* What the one admission answered (wrun-overlay-recovery.util): 'admitted' started the rerun's tail (its declines,
|
|
12
|
+
* the run hold, then one run); 'in-flight' and 'queued' left the overlay to work already under way, whose outcome
|
|
13
|
+
* decides; 'spent' found no grace waiting, or this trigger already reran it; 'no-driver' is not a wrun overlay.
|
|
14
|
+
*/
|
|
15
|
+
export type WrunTransientRerunAdmission = 'no-driver' | 'in-flight' | 'queued' | 'spent' | 'admitted';
|
|
16
|
+
/** Why a grace ended before its deadline: a retraction (a paint), the overlay left, or a record that shows at once
|
|
17
|
+
* took the place of the last one waiting. */
|
|
18
|
+
export type WrunTransientGraceEnd = 'painted' | 'teardown' | 'superseded';
|
|
19
|
+
type WrunTransientRerunAdmit = (target: WrunTransientRerunTarget, trigger: WrunTransientRerunTrigger) => WrunTransientRerunAdmission;
|
|
20
|
+
/**
|
|
21
|
+
* Hold a transient refusal of this overlay inside its grace: true when it waits (a grace started, or the one running
|
|
22
|
+
* took it in without restarting), false when it must show now (the overlay's grace ran out and it has not painted
|
|
23
|
+
* since). `onExpire` shows the records still waiting once the deadline ends the grace; the grace keeps the first one.
|
|
24
|
+
*/
|
|
25
|
+
export declare function holdWrunTransientRefusal(target: WrunTransientRerunTarget, onExpire: () => void): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* End the overlay's grace before its deadline: nothing waiting shows, and its load signal comes down. A paint or a
|
|
28
|
+
* teardown also ends the overlay's failure streak (its next transient refusal gets a grace of its own); a record that
|
|
29
|
+
* showed at once in place of the last one waiting leaves the streak as it was.
|
|
30
|
+
*/
|
|
31
|
+
export declare function endWrunTransientGrace(target: WrunTransientRerunTarget, why: WrunTransientGraceEnd): void;
|
|
32
|
+
/** True while the overlay holds a transient refusal that has not shown yet. */
|
|
33
|
+
export declare function isWrunTransientGracePending(target: WrunTransientRerunTarget): boolean;
|
|
34
|
+
/** Every overlay in its grace now: the triggers that concern any of them (a worker restart, the tab coming back). */
|
|
35
|
+
export declare function wrunTransientGraceTargets(): WrunTransientRerunTarget[];
|
|
36
|
+
/** The heal ladder hands its admission over as it evaluates (wrun-overlay-recovery.util). */
|
|
37
|
+
export declare function bindWrunTransientRerunAdmission(fn: WrunTransientRerunAdmit): void;
|
|
38
|
+
/**
|
|
39
|
+
* The admission's claim, as it admits: true once per trigger per grace (the trigger is spent from here on), false
|
|
40
|
+
* when nothing waits for the overlay or this trigger already reran it. An ask the admission deduped claims nothing.
|
|
41
|
+
*/
|
|
42
|
+
export declare function claimWrunTransientRerun(target: WrunTransientRerunTarget, trigger: WrunTransientRerunTrigger): boolean;
|
|
43
|
+
/** The triggers that say the session the overlay's run fed is gone (the kScript socket reconnected, the data worker
|
|
44
|
+
* restarted): their rerun is the 'live-rebuild' those statuses always asked for. */
|
|
45
|
+
export declare const WRUN_SESSION_LOSS_TRIGGERS: ReadonlySet<WrunTransientRerunTrigger>;
|
|
46
|
+
/**
|
|
47
|
+
* Owe an overlay in grace one rerun for an event trigger the admission found its own run in flight or queued for:
|
|
48
|
+
* that run may fail on the very condition the event ended (a worker restart rejects the run it also recovers from),
|
|
49
|
+
* so the event is kept rather than dropped. One owed rerun per overlay, coalesced: a session's loss outranks the
|
|
50
|
+
* others (its rerun rebuilds the lost session). Nothing for a spent trigger, the heal ladder's look, or an overlay
|
|
51
|
+
* with no grace.
|
|
52
|
+
*/
|
|
53
|
+
export declare function oweWrunTransientRerun(target: WrunTransientRerunTarget, trigger: WrunTransientRerunTrigger): void;
|
|
54
|
+
/** Whether the overlay's grace owes a rerun. */
|
|
55
|
+
export declare function isWrunTransientRerunOwed(target: WrunTransientRerunTarget): boolean;
|
|
56
|
+
/** The rerun the overlay's grace owes, taken (cleared): undefined when none is owed or the grace ended (a paint, its
|
|
57
|
+
* deadline, a teardown: the owed rerun went with it). */
|
|
58
|
+
export declare function takeWrunTransientOwedRerun(target: WrunTransientRerunTarget): WrunTransientRerunTrigger | undefined;
|
|
59
|
+
/** Rerun the overlay once for this trigger, deduped against a run already in flight or queued for it. */
|
|
60
|
+
export declare function requestWrunTransientRerun(target: WrunTransientRerunTarget, trigger: WrunTransientRerunTrigger): void;
|
|
61
|
+
/** Test hook: end every grace (no signal lowered), forget the spent overlays and the loaded chart side. The bound
|
|
62
|
+
* admission stays: it is the ladders' module's, bound once as it evaluates. */
|
|
63
|
+
export declare function __resetWrunTransientGraceForTests(): void;
|
|
64
|
+
export {};
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The transient grace (CLOUD-RUN-ROBUST contract C5): a cloud run that failed for a cause a later attempt usually
|
|
3
|
+
* gets past (wrun-failure-cause WRUN_TRANSIENT_FAILURE_CAUSES) does not show its refusal at once. The overlay keeps
|
|
4
|
+
* loading for up to WRUN_TRANSIENT_GRACE_MS of visible time while the events that end the condition (the socket
|
|
5
|
+
* reconnected, the worker restarted, the permission landed, the tab came back, the heal ladder's next look) rerun it
|
|
6
|
+
* through one admission path; a paint inside the grace means the refusal never shows, and a grace that ends without
|
|
7
|
+
* one shows it as before.
|
|
8
|
+
*
|
|
9
|
+
* - The grace (`holdWrunTransientRefusal`), asked by the refusal surface for a record whose cause is transient: one
|
|
10
|
+
* per overlay (`chartIndex:indicatorId`). The first such record starts it and a later one never restarts it. While
|
|
11
|
+
* it runs, its load signal shows the overlay loading (`raiseWrunGraceLoad`) and its deadline counts visible time
|
|
12
|
+
* only (startVisibleTimeout), so a hidden tab never runs it out.
|
|
13
|
+
* - Its end, one way each (data-loading rule 3): a paint (the refusal surface's retraction), the overlay's teardown,
|
|
14
|
+
* a record that shows at once in place of the last one waiting (`endWrunTransientGrace`), or the deadline, which
|
|
15
|
+
* hands the waiting records back to the refusal surface to show as they would have shown at once. Every end lowers
|
|
16
|
+
* the load signal. Bounded by construction: a grace that ran out marks its overlay spent, and until the overlay
|
|
17
|
+
* paints again a transient record shows at once (one grace per failure streak, never an endless hold).
|
|
18
|
+
* - The rerun (`requestWrunTransientRerun`): a trigger asks for one rerun of an overlay in grace. The one admission
|
|
19
|
+
* path is the heal ladder's entry (wrun-overlay-recovery.util, which binds it here as it evaluates): it dedupes
|
|
20
|
+
* against the overlay's own work, and each trigger admits at most once per grace (`claimWrunTransientRerun`). An
|
|
21
|
+
* event the dedupe met is owed one coalesced rerun once that work settles without a paint (`oweWrunTransientRerun`).
|
|
22
|
+
*
|
|
23
|
+
* Import graph: a leaf on the boot path (the refusal surface rides the drivers registry there). The chart instances
|
|
24
|
+
* and the chart store load with the first grace through the host's loaders, the recovery ladders bind themselves (they
|
|
25
|
+
* load beside their ports, `chart.loadRunPorts`, when a grace asks before they evaluated): nothing heavy at import.
|
|
26
|
+
*/
|
|
27
|
+
import { startVisibleTimeout } from '../common/visible-timeout.util.js';
|
|
28
|
+
import { wrunHostVisibleClock } from './wrun-host-visible-clock.util.js';
|
|
29
|
+
import { claimWrunGraceLoading, isWrunLoadingOwned, releaseWrunLoading } from './wrun-loading-owner.util.js';
|
|
30
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
31
|
+
/** How long a transient refusal waits, in visible time, before it shows. */
|
|
32
|
+
export const WRUN_TRANSIENT_GRACE_MS = 20_000;
|
|
33
|
+
function ring(event, details) {
|
|
34
|
+
if (wrunChartHostEnv().diagnostics.debugEnabled())
|
|
35
|
+
wrunChartHostEnv().diagnostics.debug(event, details);
|
|
36
|
+
}
|
|
37
|
+
/** The chart instances and the store the load signal writes, once loaded. */
|
|
38
|
+
let graceSide;
|
|
39
|
+
let graceSideLoad;
|
|
40
|
+
/** Load the grace's side once, shared by every caller; never rejects. A failed chart load is retried by the next
|
|
41
|
+
* grace; the store is advisory (without it the legend loader is the grace's only signal). */
|
|
42
|
+
function ensureWrunTransientGraceSide() {
|
|
43
|
+
if (graceSide)
|
|
44
|
+
return Promise.resolve();
|
|
45
|
+
graceSideLoad ??= Promise.all([
|
|
46
|
+
wrunChartHostEnv().chart.loadTitanCharts(),
|
|
47
|
+
wrunChartHostEnv()
|
|
48
|
+
.chart.loadChartStore()
|
|
49
|
+
.catch(() => undefined),
|
|
50
|
+
])
|
|
51
|
+
.then(([charts, store]) => {
|
|
52
|
+
graceSide = {
|
|
53
|
+
getTC: (chartIndex) => charts.getTC(chartIndex),
|
|
54
|
+
...(store ? { store: () => store.useChartStore() } : {}),
|
|
55
|
+
};
|
|
56
|
+
})
|
|
57
|
+
.catch(() => {
|
|
58
|
+
graceSideLoad = undefined;
|
|
59
|
+
});
|
|
60
|
+
return graceSideLoad;
|
|
61
|
+
}
|
|
62
|
+
/** Whether the chart engine holds the overlay (titan warns on an id it does not know). */
|
|
63
|
+
function holdsOverlay(tc, indicatorId) {
|
|
64
|
+
const metadata = tc.metadata;
|
|
65
|
+
return Array.isArray(metadata) && metadata.some((meta) => meta?.id === indicatorId);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The grace's load signal on the overlay, in the vocabulary a run's own speaks: the legend loader (`updateLoadState`)
|
|
69
|
+
* and the store's kScript loading flag through its owner (wrun-loading-owner.util `claimWrunGraceLoading`), claimed
|
|
70
|
+
* as a compute pass claims it and taken over from a restore whose first run failed into the grace (that restore's
|
|
71
|
+
* release then leaves it up). A rerun's own pass takes the flag over and lowers its own; a settings-apply cycle that
|
|
72
|
+
* holds the flag keeps it. The lower takes the flag down only while the grace still owns it, and the legend loader only
|
|
73
|
+
* while nothing else shows the overlay loading (a rerun in flight that took the flag over, a raiser of the flag the
|
|
74
|
+
* owner does not track) and the chart it raised on still stands. Nothing is raised for an overlay its chart does not
|
|
75
|
+
* hold, or before the chart side loaded.
|
|
76
|
+
*/
|
|
77
|
+
function raiseWrunGraceLoad(target) {
|
|
78
|
+
const side = graceSide;
|
|
79
|
+
const { chartIndex, indicatorId } = target;
|
|
80
|
+
const tc = side?.getTC(chartIndex);
|
|
81
|
+
if (!side || !tc || !holdsOverlay(tc, indicatorId))
|
|
82
|
+
return undefined;
|
|
83
|
+
tc.updateLoadState?.(indicatorId, true);
|
|
84
|
+
let store;
|
|
85
|
+
let generation;
|
|
86
|
+
try {
|
|
87
|
+
store = side.store?.();
|
|
88
|
+
if (store) {
|
|
89
|
+
generation = claimWrunGraceLoading(chartIndex, indicatorId, store.kscriptLoadingIndicators?.[chartIndex]?.[indicatorId] === true);
|
|
90
|
+
if (generation !== undefined)
|
|
91
|
+
store.setKScriptLoadingIndicator(chartIndex, indicatorId, true);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
// A partial store: the legend loader alone.
|
|
96
|
+
}
|
|
97
|
+
let lowered = false;
|
|
98
|
+
return {
|
|
99
|
+
lower() {
|
|
100
|
+
if (lowered)
|
|
101
|
+
return;
|
|
102
|
+
lowered = true;
|
|
103
|
+
let owned = false;
|
|
104
|
+
let flagUp = false;
|
|
105
|
+
try {
|
|
106
|
+
owned = releaseWrunLoading(chartIndex, indicatorId, generation);
|
|
107
|
+
if (owned)
|
|
108
|
+
store?.setKScriptLoadingIndicator(chartIndex, indicatorId, false);
|
|
109
|
+
flagUp = store?.kscriptLoadingIndicators?.[chartIndex]?.[indicatorId] === true;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Advisory like the raise.
|
|
113
|
+
}
|
|
114
|
+
const othersLoading = !owned && (flagUp || isWrunLoadingOwned(chartIndex, indicatorId));
|
|
115
|
+
if (!othersLoading && side.getTC(chartIndex) === tc)
|
|
116
|
+
tc.updateLoadState?.(indicatorId, false);
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
const graces = new Map();
|
|
121
|
+
/** Overlays whose grace ran out and that have not painted since: a transient refusal of theirs shows at once. */
|
|
122
|
+
const spent = new Set();
|
|
123
|
+
function keyOf(target) {
|
|
124
|
+
return `${target.chartIndex}:${target.indicatorId}`;
|
|
125
|
+
}
|
|
126
|
+
/** (Re)raise the grace's load signal: at once when the chart side is loaded, else once it is, unless the grace ended
|
|
127
|
+
* meanwhile. A raise replaces the earlier one: the failed run that brought a later record lowered the loader it had
|
|
128
|
+
* raised over the grace's. */
|
|
129
|
+
function raiseGraceSignal(key, grace) {
|
|
130
|
+
const raise = () => {
|
|
131
|
+
if (graces.get(key) !== grace)
|
|
132
|
+
return;
|
|
133
|
+
grace.load?.lower();
|
|
134
|
+
grace.load = raiseWrunGraceLoad(grace.target);
|
|
135
|
+
};
|
|
136
|
+
if (graceSide) {
|
|
137
|
+
raise();
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
void ensureWrunTransientGraceSide().then(raise);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Hold a transient refusal of this overlay inside its grace: true when it waits (a grace started, or the one running
|
|
144
|
+
* took it in without restarting), false when it must show now (the overlay's grace ran out and it has not painted
|
|
145
|
+
* since). `onExpire` shows the records still waiting once the deadline ends the grace; the grace keeps the first one.
|
|
146
|
+
*/
|
|
147
|
+
export function holdWrunTransientRefusal(target, onExpire) {
|
|
148
|
+
const key = keyOf(target);
|
|
149
|
+
const running = graces.get(key);
|
|
150
|
+
if (running) {
|
|
151
|
+
raiseGraceSignal(key, running);
|
|
152
|
+
ring('wrun-transient-grace', { ...running.target, verdict: 'again' });
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
if (spent.has(key)) {
|
|
156
|
+
ring('wrun-transient-grace', { chartIndex: target.chartIndex, indicatorId: target.indicatorId, verdict: 'spent' });
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
const grace = {
|
|
160
|
+
target: { chartIndex: target.chartIndex, indicatorId: target.indicatorId },
|
|
161
|
+
deadline: undefined,
|
|
162
|
+
load: undefined,
|
|
163
|
+
admitted: new Set(),
|
|
164
|
+
owed: undefined,
|
|
165
|
+
expire: onExpire,
|
|
166
|
+
};
|
|
167
|
+
graces.set(key, grace);
|
|
168
|
+
// The deadline is armed before the load signal: the store's loading watchdog arms its 20 s "Still loading" chip on
|
|
169
|
+
// the same visible clock, and the grace must end (and lower the flag) first.
|
|
170
|
+
grace.deadline = startVisibleTimeout(() => expireWrunTransientGrace(key, grace), WRUN_TRANSIENT_GRACE_MS,
|
|
171
|
+
// The host's suspension pauses the grace too (a suspended app never runs it out).
|
|
172
|
+
wrunHostVisibleClock());
|
|
173
|
+
raiseGraceSignal(key, grace);
|
|
174
|
+
ring('wrun-transient-grace', { ...grace.target, verdict: 'held', graceMs: WRUN_TRANSIENT_GRACE_MS });
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
function expireWrunTransientGrace(key, grace) {
|
|
178
|
+
if (graces.get(key) !== grace)
|
|
179
|
+
return;
|
|
180
|
+
graces.delete(key);
|
|
181
|
+
spent.add(key);
|
|
182
|
+
grace.load?.lower();
|
|
183
|
+
ring('wrun-transient-grace', { ...grace.target, verdict: 'expired', admitted: [...grace.admitted] });
|
|
184
|
+
try {
|
|
185
|
+
grace.expire();
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
console.warn(`[wrun] the refusal of '${grace.target.indicatorId}' was not shown after its grace:`, error);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* End the overlay's grace before its deadline: nothing waiting shows, and its load signal comes down. A paint or a
|
|
193
|
+
* teardown also ends the overlay's failure streak (its next transient refusal gets a grace of its own); a record that
|
|
194
|
+
* showed at once in place of the last one waiting leaves the streak as it was.
|
|
195
|
+
*/
|
|
196
|
+
export function endWrunTransientGrace(target, why) {
|
|
197
|
+
const key = keyOf(target);
|
|
198
|
+
if (why !== 'superseded')
|
|
199
|
+
spent.delete(key);
|
|
200
|
+
const grace = graces.get(key);
|
|
201
|
+
if (!grace)
|
|
202
|
+
return;
|
|
203
|
+
graces.delete(key);
|
|
204
|
+
grace.deadline?.clear();
|
|
205
|
+
grace.load?.lower();
|
|
206
|
+
ring('wrun-transient-grace', { ...grace.target, verdict: why, admitted: [...grace.admitted] });
|
|
207
|
+
}
|
|
208
|
+
/** True while the overlay holds a transient refusal that has not shown yet. */
|
|
209
|
+
export function isWrunTransientGracePending(target) {
|
|
210
|
+
return graces.has(keyOf(target));
|
|
211
|
+
}
|
|
212
|
+
/** Every overlay in its grace now: the triggers that concern any of them (a worker restart, the tab coming back). */
|
|
213
|
+
export function wrunTransientGraceTargets() {
|
|
214
|
+
return [...graces.values()].map(({ target }) => ({ chartIndex: target.chartIndex, indicatorId: target.indicatorId }));
|
|
215
|
+
}
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
// The rerun
|
|
218
|
+
// ---------------------------------------------------------------------------
|
|
219
|
+
let admit;
|
|
220
|
+
let admitLoad;
|
|
221
|
+
/** The heal ladder hands its admission over as it evaluates (wrun-overlay-recovery.util). */
|
|
222
|
+
export function bindWrunTransientRerunAdmission(fn) {
|
|
223
|
+
admit = fn;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The admission's claim, as it admits: true once per trigger per grace (the trigger is spent from here on), false
|
|
227
|
+
* when nothing waits for the overlay or this trigger already reran it. An ask the admission deduped claims nothing.
|
|
228
|
+
*/
|
|
229
|
+
export function claimWrunTransientRerun(target, trigger) {
|
|
230
|
+
const grace = graces.get(keyOf(target));
|
|
231
|
+
if (!grace || grace.admitted.has(trigger))
|
|
232
|
+
return false;
|
|
233
|
+
grace.admitted.add(trigger);
|
|
234
|
+
// The trigger reran the overlay: a rerun it was owed is that one.
|
|
235
|
+
if (grace.owed === trigger)
|
|
236
|
+
grace.owed = undefined;
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
/** The triggers that say the session the overlay's run fed is gone (the kScript socket reconnected, the data worker
|
|
240
|
+
* restarted): their rerun is the 'live-rebuild' those statuses always asked for. */
|
|
241
|
+
export const WRUN_SESSION_LOSS_TRIGGERS = new Set([
|
|
242
|
+
'reconnected',
|
|
243
|
+
'worker-restarted',
|
|
244
|
+
]);
|
|
245
|
+
/** The event triggers a rerun is owed to when they meet the overlay's own work (the heal ladder's look keeps its own
|
|
246
|
+
* cadence instead). */
|
|
247
|
+
const OWED_TRIGGERS = new Set([
|
|
248
|
+
'reconnected',
|
|
249
|
+
'worker-restarted',
|
|
250
|
+
'capability-landed',
|
|
251
|
+
'visible',
|
|
252
|
+
]);
|
|
253
|
+
/**
|
|
254
|
+
* Owe an overlay in grace one rerun for an event trigger the admission found its own run in flight or queued for:
|
|
255
|
+
* that run may fail on the very condition the event ended (a worker restart rejects the run it also recovers from),
|
|
256
|
+
* so the event is kept rather than dropped. One owed rerun per overlay, coalesced: a session's loss outranks the
|
|
257
|
+
* others (its rerun rebuilds the lost session). Nothing for a spent trigger, the heal ladder's look, or an overlay
|
|
258
|
+
* with no grace.
|
|
259
|
+
*/
|
|
260
|
+
export function oweWrunTransientRerun(target, trigger) {
|
|
261
|
+
const grace = graces.get(keyOf(target));
|
|
262
|
+
if (!grace || grace.admitted.has(trigger) || !OWED_TRIGGERS.has(trigger))
|
|
263
|
+
return;
|
|
264
|
+
const owed = grace.owed;
|
|
265
|
+
if (owed === undefined || (WRUN_SESSION_LOSS_TRIGGERS.has(trigger) && !WRUN_SESSION_LOSS_TRIGGERS.has(owed))) {
|
|
266
|
+
grace.owed = trigger;
|
|
267
|
+
}
|
|
268
|
+
ring('wrun-transient-rerun-owed', { ...grace.target, trigger, owed: grace.owed });
|
|
269
|
+
}
|
|
270
|
+
/** Whether the overlay's grace owes a rerun. */
|
|
271
|
+
export function isWrunTransientRerunOwed(target) {
|
|
272
|
+
return graces.get(keyOf(target))?.owed !== undefined;
|
|
273
|
+
}
|
|
274
|
+
/** The rerun the overlay's grace owes, taken (cleared): undefined when none is owed or the grace ended (a paint, its
|
|
275
|
+
* deadline, a teardown: the owed rerun went with it). */
|
|
276
|
+
export function takeWrunTransientOwedRerun(target) {
|
|
277
|
+
const grace = graces.get(keyOf(target));
|
|
278
|
+
const owed = grace?.owed;
|
|
279
|
+
if (grace)
|
|
280
|
+
grace.owed = undefined;
|
|
281
|
+
return owed;
|
|
282
|
+
}
|
|
283
|
+
function admitWith(fn, target, trigger) {
|
|
284
|
+
const verdict = fn(target, trigger);
|
|
285
|
+
ring('wrun-transient-rerun-ask', { ...target, trigger, verdict });
|
|
286
|
+
}
|
|
287
|
+
/** Rerun the overlay once for this trigger, deduped against a run already in flight or queued for it. */
|
|
288
|
+
export function requestWrunTransientRerun(target, trigger) {
|
|
289
|
+
// Nothing waits for the overlay, or this trigger already reran it: the trigger's own line (if any) owns it.
|
|
290
|
+
const grace = graces.get(keyOf(target));
|
|
291
|
+
if (!grace || grace.admitted.has(trigger))
|
|
292
|
+
return;
|
|
293
|
+
const asked = { chartIndex: target.chartIndex, indicatorId: target.indicatorId };
|
|
294
|
+
if (admit) {
|
|
295
|
+
admitWith(admit, asked, trigger);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
// A grace before the ladders evaluated (they load with the run pass that raised it): they bind as they land. They
|
|
299
|
+
// read the run's ports, which load beside them (chart.loadRunPorts).
|
|
300
|
+
admitLoad ??= Promise.all([import('./wrun-overlay-recovery.util.js'), wrunChartHostEnv().chart.loadRunPorts()]).then(() => undefined, () => {
|
|
301
|
+
admitLoad = undefined;
|
|
302
|
+
});
|
|
303
|
+
void admitLoad.then(() => {
|
|
304
|
+
if (admit)
|
|
305
|
+
admitWith(admit, asked, trigger);
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
/** Test hook: end every grace (no signal lowered), forget the spent overlays and the loaded chart side. The bound
|
|
309
|
+
* admission stays: it is the ladders' module's, bound once as it evaluates. */
|
|
310
|
+
export function __resetWrunTransientGraceForTests() {
|
|
311
|
+
for (const grace of graces.values())
|
|
312
|
+
grace.deadline?.clear();
|
|
313
|
+
graces.clear();
|
|
314
|
+
spent.clear();
|
|
315
|
+
graceSide = undefined;
|
|
316
|
+
graceSideLoad = undefined;
|
|
317
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The original's declared lookback for a mounted twin (its `wrunRegistryRef` package), folded at
|
|
3
|
+
* `intervalMs` and capped like the kScript lane's read; null for an overlay that is no such twin
|
|
4
|
+
* (an authored Indicator, a twin whose row carries no declaration), for a twin version below the
|
|
5
|
+
* one that holds the depth, or without a usable interval.
|
|
6
|
+
* The twins join loads on first use: it stays off the pre-candle closure the run pass rides
|
|
7
|
+
* (wrun-twins.closure.spec.ts), as every other reader of the join reaches it; the roster is web's
|
|
8
|
+
* (wrun-twins.util), loaded through `chart.loadTwinsRoster()`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function wrunTwinOriginalLookbackBars(settings: unknown, intervalMs: number): Promise<number | null>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The declared lookback a twin reads from its kScript original, in bars of the chart interval.
|
|
3
|
+
*
|
|
4
|
+
* The kScript lane sizes its warm-up decider with the engine's declaration over the script's code:
|
|
5
|
+
* `minimumBars` folded with the deepest vwap calendar anchor span at the chart interval
|
|
6
|
+
* (`foldAnchorSpanIntoLookbackBars`, capped at KSCRIPT_LOOKBACK_ANCHOR_CAP_BARS), read before the
|
|
7
|
+
* first run (the declared-depth pages the first run waits for, chart.add-indicator.ts
|
|
8
|
+
* `prefetchDeclaredDepthBeforeFirstRun`) and after every integrated run (the declared lookback of
|
|
9
|
+
* `chooseLocalKScriptWarmupDepth`). A twin's sheet can declare bars (`warmup` / `warmup_bars`) but no
|
|
10
|
+
* span, so the twin of an original with a calendar anchor (Anchored VWAP: a 366-day yearly anchor,
|
|
11
|
+
* 5,000 bars at 1h, 366 at 1D) bought less history than its original and computed its quarter and
|
|
12
|
+
* year from a shorter window. The twins roster carries the original's declaration
|
|
13
|
+
* (`wrunTwinOriginalLookbackInfo`), and this folds it exactly as the kScript lane folds the
|
|
14
|
+
* original's, so both lanes hand the decider the same number. A twin version below the row's
|
|
15
|
+
* `fromTwinVersion` reads none: its run cannot hold the original's depth (Anchored VWAP 0.1.5 mounts
|
|
16
|
+
* 44 row arrays and refuses past 3,409 bars at 1h), so it keeps the history it buys today.
|
|
17
|
+
* A row may carry a bar count with no span, the declared lookback a sheet's warm-up never is: Session
|
|
18
|
+
* Sweeps' original declares 8 bars and draws nothing above 5m (its timeframe gate), where a null
|
|
19
|
+
* lookback bought two 500-bar pages on every settings save and its 20 marker rows per bar crossed
|
|
20
|
+
* the row budget at the third switch at 1h; with the 8 it buys the original's one page, then stops.
|
|
21
|
+
*/
|
|
22
|
+
import { foldAnchorSpanIntoLookbackBars, KSCRIPT_LOOKBACK_ANCHOR_CAP_BARS, } from '../chart/kscript-source-retention.util.js';
|
|
23
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
24
|
+
import { wrunRegistryRefOf } from './wrun-overlay-identity.util.js';
|
|
25
|
+
/**
|
|
26
|
+
* The original's declared lookback for a mounted twin (its `wrunRegistryRef` package), folded at
|
|
27
|
+
* `intervalMs` and capped like the kScript lane's read; null for an overlay that is no such twin
|
|
28
|
+
* (an authored Indicator, a twin whose row carries no declaration), for a twin version below the
|
|
29
|
+
* one that holds the depth, or without a usable interval.
|
|
30
|
+
* The twins join loads on first use: it stays off the pre-candle closure the run pass rides
|
|
31
|
+
* (wrun-twins.closure.spec.ts), as every other reader of the join reaches it; the roster is web's
|
|
32
|
+
* (wrun-twins.util), loaded through `chart.loadTwinsRoster()`.
|
|
33
|
+
*/
|
|
34
|
+
export async function wrunTwinOriginalLookbackBars(settings, intervalMs) {
|
|
35
|
+
const ref = wrunRegistryRefOf(settings);
|
|
36
|
+
if (!ref || !(Number.isFinite(intervalMs) && intervalMs > 0))
|
|
37
|
+
return null;
|
|
38
|
+
const { wrunTwinOriginalLookbackInfo } = await wrunChartHostEnv().chart.loadTwinsRoster();
|
|
39
|
+
const declared = wrunTwinOriginalLookbackInfo(ref.package, ref.version);
|
|
40
|
+
if (!declared)
|
|
41
|
+
return null;
|
|
42
|
+
return Math.min(KSCRIPT_LOOKBACK_ANCHOR_CAP_BARS, foldAnchorSpanIntoLookbackBars(declared.minimumBars, declared.anchorMinSpanMs, intervalMs));
|
|
43
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Which candles a head belongs to: the chart, its candle identity, the data generation and the first loaded bar. */
|
|
2
|
+
export interface WrunWarmupHeadStoreKey {
|
|
3
|
+
chartIndex: number;
|
|
4
|
+
/** The main series' candle identity: market, interval, transformation and session (the caller composes it). */
|
|
5
|
+
identity: string;
|
|
6
|
+
dataGen: number;
|
|
7
|
+
beforeTs: number;
|
|
8
|
+
}
|
|
9
|
+
interface WrunWarmupHeadStoreEntry {
|
|
10
|
+
/** The oldest bar the rows are complete from (`beforeTs` while nothing is stored). */
|
|
11
|
+
fromTs: number;
|
|
12
|
+
rows: number[][];
|
|
13
|
+
}
|
|
14
|
+
/** A walk's hold on its key: the entry it stores into, valid while that entry is still the chart's. */
|
|
15
|
+
export interface WrunWarmupHeadClaim {
|
|
16
|
+
readonly key: WrunWarmupHeadStoreKey;
|
|
17
|
+
readonly entry: WrunWarmupHeadStoreEntry;
|
|
18
|
+
}
|
|
19
|
+
/** The stored candles in `[fromTs, beforeTs)` when the store is complete from `fromTs` or earlier, else undefined. */
|
|
20
|
+
export declare function readWrunWarmupHeadSpan(key: WrunWarmupHeadStoreKey, fromTs: number): number[][] | undefined;
|
|
21
|
+
/** The last `bars` stored candles before `beforeTs` when the store holds that many, else undefined. */
|
|
22
|
+
export declare function readWrunWarmupHeadBars(key: WrunWarmupHeadStoreKey, bars: number): number[][] | undefined;
|
|
23
|
+
/** Every stored candle (ascending) and the bar they are complete from (`beforeTs` when nothing is stored). */
|
|
24
|
+
export declare function wrunWarmupHeadStored(key: WrunWarmupHeadStoreKey): {
|
|
25
|
+
fromTs: number;
|
|
26
|
+
rows: number[][];
|
|
27
|
+
};
|
|
28
|
+
/** Claim a key for a walk that is about to fetch: its entry (created empty when the chart holds none), the newest of
|
|
29
|
+
* the chart's keys from now on. */
|
|
30
|
+
export declare function claimWrunWarmupHead(key: WrunWarmupHeadStoreKey): WrunWarmupHeadClaim;
|
|
31
|
+
/**
|
|
32
|
+
* Store one served span `[fromTs, toTs)` through a walk's claim: every candle the main request served in it (an empty
|
|
33
|
+
* span is closed hours or no history, walked past). Nothing is stored when the claim is no longer the chart's entry
|
|
34
|
+
* (the chart was torn down, the key evicted) or the span would leave a gap: it must reach what the key already covers
|
|
35
|
+
* (`toTs` at or after its `fromTs`), the way a walk asks backward from the stored edge. Rows at or after the stored
|
|
36
|
+
* edge are already held and are skipped.
|
|
37
|
+
*/
|
|
38
|
+
export declare function storeWrunWarmupHeadSpan(claim: WrunWarmupHeadClaim, fromTs: number, toTs: number, rows: ReadonlyArray<ArrayLike<number>>): void;
|
|
39
|
+
/** Drop a chart's heads (chart teardown); every chart's when no index is given. */
|
|
40
|
+
export declare function clearWrunWarmupHeadStore(chartIndex?: number): void;
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chart's warm-up head store (INDICATOR-ADD-INSTANT, 2026-10-17): the candles BEFORE a chart's first loaded bar
|
|
3
|
+
* that a browser wrun run evaluates as its hidden head (an exact warm-up session's W candles, the cloud's warm-up
|
|
4
|
+
* depth), kept per chart instead of per overlay.
|
|
5
|
+
*
|
|
6
|
+
* Why: the head was held per overlay (the live context's `warmupHead` / `laneWarmupHead`), so every new overlay over
|
|
7
|
+
* the same first bar fetched the same span again (a field dump: RSI, CCI and a second RSI each asked the gateway for
|
|
8
|
+
* the candles before the same bar), and a run that painted without its head had nowhere to find it when it landed.
|
|
9
|
+
* Every head page a run fetches lands here; both acquisitions (wrun-overlay-run.util `acquireWrunWarmupHead`,
|
|
10
|
+
* `acquireWrunLaneWarmupHead`) read it before the network and ask only the older span it lacks.
|
|
11
|
+
*
|
|
12
|
+
* A head is keyed by the chart index, the chart's candle identity (market, interval, transformation, session), the
|
|
13
|
+
* chart's data-fetch generation and the first loaded bar the candles precede (`beforeTs`). Each chart keeps its few
|
|
14
|
+
* newest keys (a switch, a refetch or history that moved the first bar starts a new one); chart teardown drops them
|
|
15
|
+
* all. Rows are `[ts, open, high, low, close, volume]`, ascending, all `< beforeTs`, and complete from `fromTs`: every
|
|
16
|
+
* candle the chart's main candle request served in `[fromTs, beforeTs)` (a venue's closed hours hold none).
|
|
17
|
+
*
|
|
18
|
+
* Acquisitions walk on their own, never queued behind each other (a stalled page must not hold another overlay's
|
|
19
|
+
* head): two walks over one key at once may ask the same span, and the store keeps whichever lands first. A walk
|
|
20
|
+
* claims its key when it starts (`claimWrunWarmupHead`) and stores pages through that claim only while the claim is
|
|
21
|
+
* still the chart's entry, so a page that lands after the chart was torn down (or the key evicted) stores nothing and
|
|
22
|
+
* never recreates what the teardown cleared.
|
|
23
|
+
*/
|
|
24
|
+
import { onWrunChartTeardown } from './wrun-overlay-drivers.util.js';
|
|
25
|
+
/** Keys kept per chart: the current head plus the few a switch or a moved first bar just left behind. */
|
|
26
|
+
const KEYS_PER_CHART = 4;
|
|
27
|
+
const charts = new Map();
|
|
28
|
+
function stampOf(key) {
|
|
29
|
+
return `${key.identity}|${key.dataGen}|${key.beforeTs}`;
|
|
30
|
+
}
|
|
31
|
+
function entryOf(key) {
|
|
32
|
+
return charts.get(key.chartIndex)?.get(stampOf(key));
|
|
33
|
+
}
|
|
34
|
+
/** The stored candles in `[fromTs, beforeTs)` when the store is complete from `fromTs` or earlier, else undefined. */
|
|
35
|
+
export function readWrunWarmupHeadSpan(key, fromTs) {
|
|
36
|
+
const entry = entryOf(key);
|
|
37
|
+
if (entry === undefined || entry.fromTs > fromTs)
|
|
38
|
+
return undefined;
|
|
39
|
+
return entry.rows.filter((row) => row[0] >= fromTs).map((row) => [...row]);
|
|
40
|
+
}
|
|
41
|
+
/** The last `bars` stored candles before `beforeTs` when the store holds that many, else undefined. */
|
|
42
|
+
export function readWrunWarmupHeadBars(key, bars) {
|
|
43
|
+
const entry = entryOf(key);
|
|
44
|
+
if (entry === undefined || entry.rows.length < bars)
|
|
45
|
+
return undefined;
|
|
46
|
+
return entry.rows.slice(entry.rows.length - bars).map((row) => [...row]);
|
|
47
|
+
}
|
|
48
|
+
/** Every stored candle (ascending) and the bar they are complete from (`beforeTs` when nothing is stored). */
|
|
49
|
+
export function wrunWarmupHeadStored(key) {
|
|
50
|
+
const entry = entryOf(key);
|
|
51
|
+
if (entry === undefined)
|
|
52
|
+
return { fromTs: key.beforeTs, rows: [] };
|
|
53
|
+
return { fromTs: entry.fromTs, rows: entry.rows.map((row) => [...row]) };
|
|
54
|
+
}
|
|
55
|
+
/** Claim a key for a walk that is about to fetch: its entry (created empty when the chart holds none), the newest of
|
|
56
|
+
* the chart's keys from now on. */
|
|
57
|
+
export function claimWrunWarmupHead(key) {
|
|
58
|
+
let keys = charts.get(key.chartIndex);
|
|
59
|
+
if (keys === undefined) {
|
|
60
|
+
keys = new Map();
|
|
61
|
+
charts.set(key.chartIndex, keys);
|
|
62
|
+
}
|
|
63
|
+
const stamp = stampOf(key);
|
|
64
|
+
let entry = keys.get(stamp);
|
|
65
|
+
if (entry !== undefined) {
|
|
66
|
+
keys.delete(stamp);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
entry = { fromTs: key.beforeTs, rows: [] };
|
|
70
|
+
}
|
|
71
|
+
keys.set(stamp, entry);
|
|
72
|
+
while (keys.size > KEYS_PER_CHART) {
|
|
73
|
+
const oldest = keys.keys().next().value;
|
|
74
|
+
if (oldest === undefined)
|
|
75
|
+
break;
|
|
76
|
+
keys.delete(oldest);
|
|
77
|
+
}
|
|
78
|
+
return { key, entry };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Store one served span `[fromTs, toTs)` through a walk's claim: every candle the main request served in it (an empty
|
|
82
|
+
* span is closed hours or no history, walked past). Nothing is stored when the claim is no longer the chart's entry
|
|
83
|
+
* (the chart was torn down, the key evicted) or the span would leave a gap: it must reach what the key already covers
|
|
84
|
+
* (`toTs` at or after its `fromTs`), the way a walk asks backward from the stored edge. Rows at or after the stored
|
|
85
|
+
* edge are already held and are skipped.
|
|
86
|
+
*/
|
|
87
|
+
export function storeWrunWarmupHeadSpan(claim, fromTs, toTs, rows) {
|
|
88
|
+
if (!(fromTs < toTs))
|
|
89
|
+
return;
|
|
90
|
+
const { entry } = claim;
|
|
91
|
+
if (charts.get(claim.key.chartIndex)?.get(stampOf(claim.key)) !== entry)
|
|
92
|
+
return;
|
|
93
|
+
if (toTs < entry.fromTs || fromTs >= entry.fromTs)
|
|
94
|
+
return;
|
|
95
|
+
const older = [];
|
|
96
|
+
for (const row of rows) {
|
|
97
|
+
const ts = Number(row[0]);
|
|
98
|
+
if (ts >= fromTs && ts < entry.fromTs)
|
|
99
|
+
older.push(Array.from(row, Number));
|
|
100
|
+
}
|
|
101
|
+
older.sort((a, b) => a[0] - b[0]);
|
|
102
|
+
entry.rows = [...older, ...entry.rows];
|
|
103
|
+
entry.fromTs = fromTs;
|
|
104
|
+
}
|
|
105
|
+
/** Drop a chart's heads (chart teardown); every chart's when no index is given. */
|
|
106
|
+
export function clearWrunWarmupHeadStore(chartIndex) {
|
|
107
|
+
if (chartIndex === undefined)
|
|
108
|
+
charts.clear();
|
|
109
|
+
else
|
|
110
|
+
charts.delete(chartIndex);
|
|
111
|
+
}
|
|
112
|
+
// Chart teardown drops the chart's heads. A spec that mocks the drivers util partially has no teardown door (reading a
|
|
113
|
+
// missing export of a mocked module throws at access time), so the registration is skipped there rather than failing
|
|
114
|
+
// the import (the host's live-series bind does the same).
|
|
115
|
+
try {
|
|
116
|
+
onWrunChartTeardown((chartIndex) => clearWrunWarmupHeadStore(chartIndex));
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
// partial module mock (specs): no teardown door to register with
|
|
120
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical param map of an Indicator alert and the computation identity of an Indicator run (a leaf of
|
|
3
|
+
* utility/wrunAlertScript.util.ts; P2/inventory.md section 1.1): the JSON of the params with keys sorted, which the
|
|
4
|
+
* alert's predicted mint hashes and the run stamps on its live context for the arm parity check. Pure, no state, no
|
|
5
|
+
* imports, so it moves into the chart-host package with the phase 2 closure; the alert script module imports and
|
|
6
|
+
* re-exports all three names.
|
|
7
|
+
*/
|
|
8
|
+
/** The arm's param map: numbers, and a text setting's run value (a string
|
|
9
|
+
* is legal only for a `type: "text"` param: the stored words plain and
|
|
10
|
+
* within the row's max_bytes, else the declared words, the value the chart
|
|
11
|
+
* runs with; the alerts engine applies the rule again on its side and mints
|
|
12
|
+
* the identity over the string it received, so the chart predicts over the
|
|
13
|
+
* same string). */
|
|
14
|
+
export type WrunAlertParamMap = Record<string, number | string>;
|
|
15
|
+
/**
|
|
16
|
+
* The computation identity of an Indicator run (the arm parity check): the package version and the
|
|
17
|
+
* canonical param map it computed with. A browser run stamps it on its live context at install
|
|
18
|
+
* (WrunOverlayLiveContext.computeIdentity, over the arm's own derivation of the run's settings), and
|
|
19
|
+
* an arm sends the run's values only when the arm's identity reads the same.
|
|
20
|
+
*/
|
|
21
|
+
export declare function wrunRunComputeIdentity(version: string | undefined, params: Readonly<Record<string, number | string>>): string;
|
|
22
|
+
/** JSON of the params with keys sorted (flat map: numbers, a text setting's
|
|
23
|
+
* words as a JSON string). */
|
|
24
|
+
export declare function canonicalWrunAlertParams(params: WrunAlertParamMap): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical param map of an Indicator alert and the computation identity of an Indicator run (a leaf of
|
|
3
|
+
* utility/wrunAlertScript.util.ts; P2/inventory.md section 1.1): the JSON of the params with keys sorted, which the
|
|
4
|
+
* alert's predicted mint hashes and the run stamps on its live context for the arm parity check. Pure, no state, no
|
|
5
|
+
* imports, so it moves into the chart-host package with the phase 2 closure; the alert script module imports and
|
|
6
|
+
* re-exports all three names.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The computation identity of an Indicator run (the arm parity check): the package version and the
|
|
10
|
+
* canonical param map it computed with. A browser run stamps it on its live context at install
|
|
11
|
+
* (WrunOverlayLiveContext.computeIdentity, over the arm's own derivation of the run's settings), and
|
|
12
|
+
* an arm sends the run's values only when the arm's identity reads the same.
|
|
13
|
+
*/
|
|
14
|
+
export function wrunRunComputeIdentity(version, params) {
|
|
15
|
+
return `${version ?? ''}|${canonicalWrunAlertParams(params)}`;
|
|
16
|
+
}
|
|
17
|
+
/** JSON of the params with keys sorted (flat map: numbers, a text setting's
|
|
18
|
+
* words as a JSON string). */
|
|
19
|
+
export function canonicalWrunAlertParams(params) {
|
|
20
|
+
const sorted = {};
|
|
21
|
+
for (const key of Object.keys(params).sort())
|
|
22
|
+
sorted[key] = params[key];
|
|
23
|
+
return JSON.stringify(sorted);
|
|
24
|
+
}
|