@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,20 @@
|
|
|
1
|
+
import { type WrunStrategyResponseFields } from './wrun-abi-host.js';
|
|
2
|
+
import { type WrunAbiVersion, type WrunDrawSkips, type WrunWorkerRequest, type WrunWorkerResponse } from '../../interfaces/wrun-runtime.interface.js';
|
|
3
|
+
/** How the handler answers a request: the realm's `postMessage` (the worker's entry passes
|
|
4
|
+
* `(message, options) => self.postMessage(message, options)`); a transfer list rides `options`. */
|
|
5
|
+
type WrunEnginePost = (message: WrunWorkerResponse & WrunStrategyResponseFields & WrunDrawSkips, options?: StructuredSerializeOptions) => void;
|
|
6
|
+
/** Handles one request; the promise settles once its answer is posted. */
|
|
7
|
+
type WrunEngineHandler = (request: WrunWorkerRequest) => Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* The module the engine worker compiles from a package's original bytes, in the order the main thread compiled them
|
|
10
|
+
* before 0.6.0: the memory clamp (clampWrunModuleMemory: a memory with no maximum gets the 4 MiB limit as its maximum,
|
|
11
|
+
* so the engine refuses a growth past it inside the guest's call; a refusal throws its plain words), then the shared
|
|
12
|
+
* host's `prepareModuleBytes` for the ABI (every mutable global exported under `__wrun_g<index>`, so the live lane's
|
|
13
|
+
* snapshot and restore cover a compiler's top-level scalars beside its memory), then the engine's compile. The
|
|
14
|
+
* module's identity stays its ORIGINAL bytes (the caller hashed them first); only the memory and export sections
|
|
15
|
+
* change. Exported for the ABI drive specs that run a module exactly as the worker compiles it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function compileWrunModuleBytes(bytes: Uint8Array, abi: WrunAbiVersion): Promise<WebAssembly.Module>;
|
|
18
|
+
/** The engine worker's request handler, answering through `post`. The worker's entry makes one, after its env. */
|
|
19
|
+
export declare function createWrunEngineHandler(post: WrunEnginePost): WrunEngineHandler;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wrun sandbox worker's request handler, apart from its realm wiring: the worker's entry
|
|
3
|
+
* (src/workers/wrun-engine.worker.ts) sets the worker's chart-host env first, then binds `self.onmessage` to the
|
|
4
|
+
* handler this factory makes and hands it the realm's `postMessage` as `post`. Every answer leaves through `post`
|
|
5
|
+
* (one argument, or the transfer list as `{ transfer }`), so the handler reads no realm global and keeps no module
|
|
6
|
+
* state: its compiled modules and its live sessions live in the factory's closure, one handler per worker realm, and
|
|
7
|
+
* die with the worker.
|
|
8
|
+
*
|
|
9
|
+
* Modules (the shared engine protocol, wrun-chart-host 0.6.0): the main thread never hashes or compiles a module; it
|
|
10
|
+
* posts the original bytes. A `module-load` hashes them (wrun-sha256.leaf), checks the sheet's pin, clamps the memory,
|
|
11
|
+
* prepares the bytes for the ABI and compiles them (`compileWrunModuleBytes`), caches the compiled module under
|
|
12
|
+
* `${sha256}|${abi}` and answers the key, the digest and the import list, which the client's handle carries. The cache
|
|
13
|
+
* is an LRU of WRUN_MODULE_CACHE_CAPACITY compiled modules: each entry is the compile's promise, inserted before the
|
|
14
|
+
* first await so every request for a key shares one compile; a compile in flight is never evicted; a failed compile
|
|
15
|
+
* leaves the cache before its requests read the failure. A full run and a live-start name their module by key and
|
|
16
|
+
* carry its bytes too: a cached key is reused as it is (the key was minted by a verified load, the bytes are the
|
|
17
|
+
* host's own snapshot), a miss (a respawned worker starts empty; an evicted key is gone) takes the load path over the
|
|
18
|
+
* request's own bytes, which must hash to the key's digest. Once a request's module is instantiated (right before the
|
|
19
|
+
* guest's first call; a live-rows' session at once) the handler posts `{ id, running: true }`: the client's run
|
|
20
|
+
* deadline starts there, the wait, the compile and the instantiation before it under the client's start ceiling.
|
|
21
|
+
* Instantiation is asynchronous, so `running` means executing: a request still awaiting its instantiation never reads
|
|
22
|
+
* as the one holding the worker's turn. A terminal answer may come without it (a lost session, a refused load).
|
|
23
|
+
*
|
|
24
|
+
* Live forming-bar sessions: a `live-start` request runs like a classic
|
|
25
|
+
* request but KEEPS the instantiated guest under its sessionKey, so later
|
|
26
|
+
* `live-rows` ticks execute only the new/revised rows against the retained
|
|
27
|
+
* state (the ABI's snapshot/restore replays a revised forming bar, memory
|
|
28
|
+
* and ledger alike). Sessions die with the worker; a tick against an
|
|
29
|
+
* unknown key answers `sessionLost` so the main-thread driver rebuilds via
|
|
30
|
+
* a fresh live-start.
|
|
31
|
+
*
|
|
32
|
+
* Session ownership (push-intake contract, plan section 8 fold 3): every
|
|
33
|
+
* `live-start` carries the live context generation as its `epoch`. The
|
|
34
|
+
* worker keeps, per session key, the newest epoch seen and a live-end fence
|
|
35
|
+
* counter, both read as the start ARRIVES, before its first await. The
|
|
36
|
+
* module's compile (on a miss) and its instantiation are asynchronous, so a
|
|
37
|
+
* start can still be pending when a newer start or a `live-end` (teardown)
|
|
38
|
+
* arrives; when it settles it installs its session ONLY if its epoch is still
|
|
39
|
+
* the newest and no live-end passed meanwhile (the block is still computed
|
|
40
|
+
* and answered: the caller's full run integrates it, and a later tick on
|
|
41
|
+
* the uninstalled key answers `sessionLost`, whose reseed opens a fresh
|
|
42
|
+
* session under the current generation). A `live-end` bumps the fence and
|
|
43
|
+
* deletes. The session key stays the indicator id.
|
|
44
|
+
*/
|
|
45
|
+
import { ensureWrunChartHostSharedHost, wrunChartHostEnv } from '../../host-env.js';
|
|
46
|
+
import { createWrunAbiSession, runWrunPackedRequest, WrunLiveOrderError, wrunModuleImportList, } from './wrun-abi-host.js';
|
|
47
|
+
import { wrunModuleKey, } from '../../interfaces/wrun-runtime.interface.js';
|
|
48
|
+
import { clampWrunModuleMemory } from '../../utility/wrun/wrun-memory-clamp.util.js';
|
|
49
|
+
import { wrunSha256Hex } from '../../utility/wrun/wrun-sha256.leaf.js';
|
|
50
|
+
/** How many compiled modules one engine worker keeps by `${sha256}|${abi}`: every package version, draft Run and REPL
|
|
51
|
+
* compile mints a key, and a compiled module is mostly native memory the heap never shows. The client keeps its
|
|
52
|
+
* handles in an LRU of the same size under the same name (wrun-host.service.ts); this one is the worker's own, and
|
|
53
|
+
* stays unexported because the package index joins both modules. */
|
|
54
|
+
const WRUN_MODULE_CACHE_CAPACITY = 16;
|
|
55
|
+
/** Bytes that hash to another digest than the one they must carry (the sheet's pin on a load, the module key's on a
|
|
56
|
+
* full run or live-start compiling on a miss): answered `module-pin-mismatch` with the digest found; nothing is
|
|
57
|
+
* cached. */
|
|
58
|
+
class WrunModulePinMismatch extends Error {
|
|
59
|
+
sha256;
|
|
60
|
+
constructor(message, sha256) {
|
|
61
|
+
super(message);
|
|
62
|
+
this.name = 'WrunModulePinMismatch';
|
|
63
|
+
this.sha256 = sha256;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The module the engine worker compiles from a package's original bytes, in the order the main thread compiled them
|
|
68
|
+
* before 0.6.0: the memory clamp (clampWrunModuleMemory: a memory with no maximum gets the 4 MiB limit as its maximum,
|
|
69
|
+
* so the engine refuses a growth past it inside the guest's call; a refusal throws its plain words), then the shared
|
|
70
|
+
* host's `prepareModuleBytes` for the ABI (every mutable global exported under `__wrun_g<index>`, so the live lane's
|
|
71
|
+
* snapshot and restore cover a compiler's top-level scalars beside its memory), then the engine's compile. The
|
|
72
|
+
* module's identity stays its ORIGINAL bytes (the caller hashed them first); only the memory and export sections
|
|
73
|
+
* change. Exported for the ABI drive specs that run a module exactly as the worker compiles it.
|
|
74
|
+
*/
|
|
75
|
+
export async function compileWrunModuleBytes(bytes, abi) {
|
|
76
|
+
const bounded = clampWrunModuleMemory(bytes);
|
|
77
|
+
const hostLoading = ensureWrunChartHostSharedHost();
|
|
78
|
+
if (hostLoading)
|
|
79
|
+
await hostLoading;
|
|
80
|
+
const { prepareModuleBytes } = wrunChartHostEnv().sharedHost();
|
|
81
|
+
return WebAssembly.compile(prepareModuleBytes(bounded, abi));
|
|
82
|
+
}
|
|
83
|
+
/** A full run as the ABI host runs it: the request's module key and bytes turned into the compiled module. */
|
|
84
|
+
function resolvedRunRequest(request, module) {
|
|
85
|
+
const { moduleKey: _moduleKey, moduleBytes: _moduleBytes, ...fields } = request;
|
|
86
|
+
return { ...fields, module };
|
|
87
|
+
}
|
|
88
|
+
/** A failure as the client reads it: the error's words, and the module codes (a pin mismatch with the digest found,
|
|
89
|
+
* an engine compile refusal) the client maps back to today's error class and words. */
|
|
90
|
+
function failureOf(id, error) {
|
|
91
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
92
|
+
if (error instanceof WrunModulePinMismatch) {
|
|
93
|
+
return { id, ok: false, error: message, code: 'module-pin-mismatch', sha256: error.sha256 };
|
|
94
|
+
}
|
|
95
|
+
if (error instanceof WebAssembly.CompileError)
|
|
96
|
+
return { id, ok: false, error: message, code: 'module-compile-failed' };
|
|
97
|
+
return { id, ok: false, error: message };
|
|
98
|
+
}
|
|
99
|
+
/** The engine worker's request handler, answering through `post`. The worker's entry makes one, after its env. */
|
|
100
|
+
export function createWrunEngineHandler(post) {
|
|
101
|
+
const liveSessions = new Map();
|
|
102
|
+
/** The epoch the session installed under each key opened with (none for a legacy start). */
|
|
103
|
+
const liveSessionEpochs = new Map();
|
|
104
|
+
const liveEpochs = new Map();
|
|
105
|
+
/** Compiled modules by key, least recently used first (Map order: a hit moves its entry to the end). */
|
|
106
|
+
const modules = new Map();
|
|
107
|
+
/** The entries whose compile has not settled: never evicted, since every request for the key shares them. */
|
|
108
|
+
const compiling = new Set();
|
|
109
|
+
function liveEpochFor(sessionKey) {
|
|
110
|
+
let epoch = liveEpochs.get(sessionKey);
|
|
111
|
+
if (!epoch) {
|
|
112
|
+
epoch = { newest: Number.NEGATIVE_INFINITY, ends: 0, endedThrough: Number.NEGATIVE_INFINITY };
|
|
113
|
+
liveEpochs.set(sessionKey, epoch);
|
|
114
|
+
}
|
|
115
|
+
return epoch;
|
|
116
|
+
}
|
|
117
|
+
/** Evict compiled entries, least recently used first, until the cache is back at its capacity (a compile in flight
|
|
118
|
+
* stays: the cache passes the capacity only while more compiles than that are in flight). */
|
|
119
|
+
function trimModules() {
|
|
120
|
+
for (const [key, entry] of modules) {
|
|
121
|
+
if (modules.size <= WRUN_MODULE_CACHE_CAPACITY)
|
|
122
|
+
return;
|
|
123
|
+
if (!compiling.has(entry))
|
|
124
|
+
modules.delete(key);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/** The cached module under `key` as the most recent use, or undefined. */
|
|
128
|
+
function cachedModule(key) {
|
|
129
|
+
const cached = modules.get(key);
|
|
130
|
+
if (cached === undefined)
|
|
131
|
+
return undefined;
|
|
132
|
+
modules.delete(key);
|
|
133
|
+
modules.set(key, cached);
|
|
134
|
+
return cached;
|
|
135
|
+
}
|
|
136
|
+
/** The module under `key`: the cached one, else the compile of `bytes`, cached under the key before this returns
|
|
137
|
+
* (synchronously, before any await of the caller's), so a request for the key arriving meanwhile joins it. */
|
|
138
|
+
function moduleUnder(key, bytes, abi) {
|
|
139
|
+
const cached = cachedModule(key);
|
|
140
|
+
if (cached !== undefined)
|
|
141
|
+
return cached;
|
|
142
|
+
const entry = compileWrunModuleBytes(bytes, abi).then((module) => {
|
|
143
|
+
compiling.delete(entry);
|
|
144
|
+
trimModules();
|
|
145
|
+
return module;
|
|
146
|
+
}, (error) => {
|
|
147
|
+
// A module that fails to load is never cached: the next request for its key tries the bytes again.
|
|
148
|
+
compiling.delete(entry);
|
|
149
|
+
if (modules.get(key) === entry)
|
|
150
|
+
modules.delete(key);
|
|
151
|
+
throw error;
|
|
152
|
+
});
|
|
153
|
+
compiling.add(entry);
|
|
154
|
+
modules.set(key, entry);
|
|
155
|
+
trimModules();
|
|
156
|
+
return entry;
|
|
157
|
+
}
|
|
158
|
+
/** A full run's or a live-start's module: the cached one under its key, else the load path over the request's own
|
|
159
|
+
* bytes, which must hash to the key's digest; they compile for the key's ABI, the load's. */
|
|
160
|
+
function moduleFor(request) {
|
|
161
|
+
const { moduleKey, moduleBytes } = request;
|
|
162
|
+
const cached = cachedModule(moduleKey);
|
|
163
|
+
if (cached !== undefined)
|
|
164
|
+
return cached;
|
|
165
|
+
if (typeof moduleKey !== 'string' || !ArrayBuffer.isView(moduleBytes) || moduleBytes.byteLength === 0) {
|
|
166
|
+
// A handle no host loaded (its runs carry no bytes) or a malformed request: refused by name.
|
|
167
|
+
return Promise.reject(new Error(`WRUN module ${moduleKey} is not in this worker and the run carries no bytes to compile it from`));
|
|
168
|
+
}
|
|
169
|
+
const at = moduleKey.lastIndexOf('|');
|
|
170
|
+
const sha256 = wrunSha256Hex(moduleBytes);
|
|
171
|
+
if (at < 0 || moduleKey.slice(0, at) !== sha256) {
|
|
172
|
+
return Promise.reject(new WrunModulePinMismatch(`WRUN module bytes (sha256 ${sha256}) do not match the run's module key ${moduleKey}`, sha256));
|
|
173
|
+
}
|
|
174
|
+
return moduleUnder(moduleKey, moduleBytes, moduleKey.slice(at + 1));
|
|
175
|
+
}
|
|
176
|
+
/** `module-load`: the digest of the original bytes, the sheet's pin, then the module under its key. */
|
|
177
|
+
async function loadModule(request) {
|
|
178
|
+
const sha256 = wrunSha256Hex(request.bytes);
|
|
179
|
+
if (request.sha256Pin && request.sha256Pin !== sha256) {
|
|
180
|
+
throw new WrunModulePinMismatch(`WRUN module sha256 mismatch (the sheet pins ${request.sha256Pin}, the bytes are ${sha256})`, sha256);
|
|
181
|
+
}
|
|
182
|
+
const key = wrunModuleKey(sha256, request.abi);
|
|
183
|
+
const module = await moduleUnder(key, request.bytes, request.abi);
|
|
184
|
+
const response = {
|
|
185
|
+
id: request.id,
|
|
186
|
+
ok: true,
|
|
187
|
+
kind: 'module-load',
|
|
188
|
+
key,
|
|
189
|
+
sha256,
|
|
190
|
+
imports: [...wrunModuleImportList(module)],
|
|
191
|
+
};
|
|
192
|
+
post(response);
|
|
193
|
+
}
|
|
194
|
+
async function handleRequest(request) {
|
|
195
|
+
try {
|
|
196
|
+
if (!('kind' in request)) {
|
|
197
|
+
const module = await moduleFor(request);
|
|
198
|
+
postOutput(request.id, await runWrunPackedRequest(resolvedRunRequest(request, module), {
|
|
199
|
+
// Instantiated: the run executes from here, and its deadline starts with it.
|
|
200
|
+
onInstantiated: () => post({ id: request.id, running: true }),
|
|
201
|
+
}));
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
if (request.kind === 'module-load') {
|
|
205
|
+
await loadModule(request);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
if (request.kind === 'live-end') {
|
|
209
|
+
const gate = liveEpochFor(request.sessionKey);
|
|
210
|
+
if (request.epoch === undefined) {
|
|
211
|
+
// The fence moves BEFORE the delete: a start whose compile or
|
|
212
|
+
// instantiation is pending right now must find the fence moved when
|
|
213
|
+
// it settles.
|
|
214
|
+
gate.ends += 1;
|
|
215
|
+
liveSessions.delete(request.sessionKey);
|
|
216
|
+
liveSessionEpochs.delete(request.sessionKey);
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
// An epoch-scoped end (a run ending what it opened) retires that
|
|
220
|
+
// generation only: its session, and its start (or an older one) still
|
|
221
|
+
// instantiating. A newer generation's session or start under the key
|
|
222
|
+
// belongs to another owner and stays.
|
|
223
|
+
gate.endedThrough = Math.max(gate.endedThrough, request.epoch);
|
|
224
|
+
if (liveSessionEpochs.get(request.sessionKey) === request.epoch) {
|
|
225
|
+
liveSessions.delete(request.sessionKey);
|
|
226
|
+
liveSessionEpochs.delete(request.sessionKey);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
postOutput(request.id, { ready: new Uint8Array(0), outputs: new Float64Array(0), strings: undefined });
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
if (request.kind === 'live-start') {
|
|
233
|
+
const startRequest = request;
|
|
234
|
+
const gate = liveEpochFor(startRequest.sessionKey);
|
|
235
|
+
const epoch = startRequest.epoch;
|
|
236
|
+
// A start already older than the newest epoch seen is stale on
|
|
237
|
+
// arrival (a newer generation opened this key while it queued); it
|
|
238
|
+
// still computes its block for its caller but never installs.
|
|
239
|
+
const staleOnArrival = epoch !== undefined && epoch < gate.newest;
|
|
240
|
+
if (epoch !== undefined && !staleOnArrival)
|
|
241
|
+
gate.newest = epoch;
|
|
242
|
+
// Read as the start arrives, before its first await (the module's
|
|
243
|
+
// compile on a miss, then the instantiation): a live-end that lands
|
|
244
|
+
// during either fences this start out.
|
|
245
|
+
const endsAtStart = gate.ends;
|
|
246
|
+
const module = await moduleFor(startRequest);
|
|
247
|
+
const session = await createWrunAbiSession({
|
|
248
|
+
module,
|
|
249
|
+
abi: startRequest.abi,
|
|
250
|
+
outputCount: startRequest.outputCount,
|
|
251
|
+
initArgs: startRequest.initArgs,
|
|
252
|
+
textParams: startRequest.textParams,
|
|
253
|
+
stringMaxBytes: startRequest.stringMaxBytes,
|
|
254
|
+
frameMaxBytes: startRequest.frameMaxBytes,
|
|
255
|
+
handleDefaults: startRequest.handleDefaults,
|
|
256
|
+
// The strategy config rides the session (the broker is the session's
|
|
257
|
+
// committed fold); later ticks carry only their rows' broker feed.
|
|
258
|
+
strategy: startRequest.strategy,
|
|
259
|
+
// Instantiated: the start executes from here, and its deadline starts with it.
|
|
260
|
+
onInstantiated: () => post({ id: startRequest.id, running: true }),
|
|
261
|
+
});
|
|
262
|
+
// Replace-on-start: a remount/pan rebuild under the same key must not
|
|
263
|
+
// leak the superseded guest. The output of the failed create above
|
|
264
|
+
// never replaces an existing session (the throw skips this line).
|
|
265
|
+
const output = session.runRows(startRequest, 'live');
|
|
266
|
+
// The supersession check, now the module is in hand and the block ran:
|
|
267
|
+
// against the fence and the epoch read at arrival.
|
|
268
|
+
const current = liveEpochFor(startRequest.sessionKey);
|
|
269
|
+
const superseded = staleOnArrival ||
|
|
270
|
+
current.ends !== endsAtStart ||
|
|
271
|
+
(epoch !== undefined && (current.newest !== epoch || epoch <= current.endedThrough));
|
|
272
|
+
if (!superseded) {
|
|
273
|
+
liveSessions.set(startRequest.sessionKey, session);
|
|
274
|
+
if (epoch !== undefined)
|
|
275
|
+
liveSessionEpochs.set(startRequest.sessionKey, epoch);
|
|
276
|
+
else
|
|
277
|
+
liveSessionEpochs.delete(startRequest.sessionKey);
|
|
278
|
+
}
|
|
279
|
+
postOutput(startRequest.id, output);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
// The one kind left is 'live-rows'.
|
|
283
|
+
const rowsRequest = request;
|
|
284
|
+
{
|
|
285
|
+
const session = liveSessions.get(rowsRequest.sessionKey);
|
|
286
|
+
if (!session) {
|
|
287
|
+
// A lost session answers at once, without `running`: the terminal answer settles the request.
|
|
288
|
+
const response = {
|
|
289
|
+
id: rowsRequest.id,
|
|
290
|
+
ok: false,
|
|
291
|
+
error: `WRUN live session '${rowsRequest.sessionKey}' is not open in this worker`,
|
|
292
|
+
sessionLost: true,
|
|
293
|
+
};
|
|
294
|
+
post(response);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
// The session is in hand: the tick starts now, and its deadline with it.
|
|
298
|
+
post({ id: rowsRequest.id, running: true });
|
|
299
|
+
let output;
|
|
300
|
+
try {
|
|
301
|
+
output = session.runRows(rowsRequest, 'live');
|
|
302
|
+
}
|
|
303
|
+
catch (error) {
|
|
304
|
+
// A trapped/failed tick leaves the guest's state unknowable (the trap
|
|
305
|
+
// may have landed mid-bar). Drop the session so the next tick reports
|
|
306
|
+
// sessionLost and the driver rebuilds from a full run. The ONE
|
|
307
|
+
// exception is the pre-evaluation ordering refusal: it fires before
|
|
308
|
+
// any guest call, the state is untouched, and the session survives
|
|
309
|
+
// (the caller just sent a stale/misordered block); it answers with
|
|
310
|
+
// the 'live-order' code so the host can reject with the typed error.
|
|
311
|
+
if (error instanceof WrunLiveOrderError) {
|
|
312
|
+
const response = {
|
|
313
|
+
id: rowsRequest.id,
|
|
314
|
+
ok: false,
|
|
315
|
+
error: error.message,
|
|
316
|
+
code: 'live-order',
|
|
317
|
+
};
|
|
318
|
+
post(response);
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
liveSessions.delete(rowsRequest.sessionKey);
|
|
322
|
+
liveSessionEpochs.delete(rowsRequest.sessionKey);
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
postOutput(rowsRequest.id, output);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
catch (error) {
|
|
329
|
+
post(failureOf(request.id, error));
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
function postOutput(id, output) {
|
|
333
|
+
const { ready, outputs, strings, handles, strategy, frames, live, skipped, skippedCount } = output;
|
|
334
|
+
// The handle records are small plain objects (caps bound the set), so
|
|
335
|
+
// they ride structured clone beside the transferred row buffers; so does
|
|
336
|
+
// the strategy output (the engine's StrategyOutput: plain records and
|
|
337
|
+
// number arrays, bounded by the trade cap and the render result limit),
|
|
338
|
+
// the live block's accounting (a handful of numbers), and the run's
|
|
339
|
+
// skipped draw calls (at most 64 records and a count, exactly when a call
|
|
340
|
+
// was skipped: a clean run's answer keeps its shape).
|
|
341
|
+
const handlesField = handles !== undefined ? { handles } : {};
|
|
342
|
+
const framesField = frames !== undefined ? { frames } : {};
|
|
343
|
+
const liveField = live !== undefined ? { live } : {};
|
|
344
|
+
const strategyField = strategy !== undefined ? { strategy } : {};
|
|
345
|
+
const skipsField = skipped !== undefined ? { skipped, skippedCount: skippedCount ?? 0 } : {};
|
|
346
|
+
if (strings === undefined) {
|
|
347
|
+
const response = {
|
|
348
|
+
id,
|
|
349
|
+
ok: true,
|
|
350
|
+
ready,
|
|
351
|
+
outputs,
|
|
352
|
+
...handlesField,
|
|
353
|
+
...skipsField,
|
|
354
|
+
...strategyField,
|
|
355
|
+
...framesField,
|
|
356
|
+
...liveField,
|
|
357
|
+
};
|
|
358
|
+
post(response, { transfer: [ready.buffer, outputs.buffer] });
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
const response = {
|
|
362
|
+
id,
|
|
363
|
+
ok: true,
|
|
364
|
+
ready,
|
|
365
|
+
outputs,
|
|
366
|
+
stringLens: strings.lens,
|
|
367
|
+
stringOffsets: strings.offsets,
|
|
368
|
+
stringBytes: strings.bytes,
|
|
369
|
+
...handlesField,
|
|
370
|
+
...skipsField,
|
|
371
|
+
...strategyField,
|
|
372
|
+
...framesField,
|
|
373
|
+
...liveField,
|
|
374
|
+
};
|
|
375
|
+
post(response, {
|
|
376
|
+
transfer: [ready.buffer, outputs.buffer, strings.lens.buffer, strings.offsets.buffer, strings.bytes.buffer],
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
return handleRequest;
|
|
380
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orangecharts/wrun-chart-host",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "The wrun chart-host layer shared by the kiyotaka web app and the mobile app: the wrun result reader and painter model, cut from the web app (its reference implementation).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@orangecharts/indicator-kit": "0.
|
|
31
|
+
"@orangecharts/indicator-kit": "0.87.0",
|
|
32
32
|
"@orangecharts/orange-v2-pb-common": "12.69.0",
|
|
33
33
|
"dayjs": "1.11.23",
|
|
34
34
|
"lodash-es": "4.18.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@orangecharts/indicator-kit": "0.
|
|
37
|
+
"@orangecharts/indicator-kit": "0.87.0",
|
|
38
38
|
"@orangecharts/orange-v2-pb-common": "12.69.0",
|
|
39
39
|
"@types/lodash-es": "4.17.12",
|
|
40
40
|
"dayjs": "1.11.23",
|