@orangecharts/wrun-chart-host 0.2.0 → 0.4.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 +22 -8
- package/dist/constants/common.constants.d.ts +15 -0
- package/dist/constants/common.constants.js +23 -0
- package/dist/constants/data-source.constants.d.ts +1 -0
- package/dist/constants/data-source.constants.js +1 -0
- package/dist/constants/economic.constants.d.ts +39 -0
- package/dist/constants/economic.constants.js +77 -0
- package/dist/constants/etf-covered-coins.constants.d.ts +1 -0
- package/dist/constants/etf-covered-coins.constants.js +9 -0
- package/dist/constants/feature-flags.constants.d.ts +60 -0
- package/dist/constants/feature-flags.constants.js +308 -0
- package/dist/constants/feature-limits.constants.d.ts +134 -0
- package/dist/constants/feature-limits.constants.js +155 -0
- package/dist/constants/marketCapabilities.constants.d.ts +87 -0
- package/dist/constants/marketCapabilities.constants.js +213 -0
- package/dist/constants/option-venues.constants.d.ts +100 -0
- package/dist/constants/option-venues.constants.js +167 -0
- package/dist/constants/overlay-data.constants.d.ts +53 -0
- package/dist/constants/overlay-data.constants.js +80 -0
- package/dist/constants/pane-grid.constants.d.ts +15 -0
- package/dist/constants/pane-grid.constants.js +17 -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/venue-presets.constants.d.ts +10 -0
- package/dist/constants/venue-presets.constants.js +22 -0
- package/dist/enums/chart.enum.d.ts +68 -0
- package/dist/enums/chart.enum.js +70 -0
- package/dist/helpers/data.helpers.d.ts +2 -0
- package/dist/helpers/data.helpers.js +14 -0
- package/dist/host-env.d.ts +163 -5
- package/dist/host-ports.types.d.ts +431 -0
- package/dist/host-ports.types.js +1 -0
- package/dist/index.d.ts +138 -0
- package/dist/index.js +138 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.d.ts +86 -0
- package/dist/indicators/controls/technical-script/technical-script-input-rendering.js +179 -0
- package/dist/interfaces/asset-venue.interface.d.ts +91 -0
- package/dist/interfaces/asset-venue.interface.js +1 -0
- package/dist/interfaces/cancel-reason.interface.d.ts +24 -0
- package/dist/interfaces/cancel-reason.interface.js +2 -0
- package/dist/interfaces/catalog-display.interface.d.ts +3 -0
- package/dist/interfaces/catalog-display.interface.js +1 -0
- package/dist/interfaces/cme-realtime.interface.d.ts +251 -0
- package/dist/interfaces/cme-realtime.interface.js +46 -0
- package/dist/interfaces/feed.interface.d.ts +80 -0
- package/dist/interfaces/feed.interface.js +7 -0
- package/dist/interfaces/market-kind.interface.d.ts +8 -0
- package/dist/interfaces/market-kind.interface.js +1 -0
- package/dist/interfaces/opra-realtime.interface.d.ts +224 -0
- package/dist/interfaces/opra-realtime.interface.js +105 -0
- package/dist/interfaces/option-instrument.interface.d.ts +32 -0
- package/dist/interfaces/option-instrument.interface.js +1 -0
- package/dist/interfaces/options-chain-scope.interface.d.ts +29 -0
- package/dist/interfaces/options-chain-scope.interface.js +7 -0
- package/dist/interfaces/prediction-market.interface.d.ts +88 -0
- package/dist/interfaces/prediction-market.interface.js +8 -0
- package/dist/interfaces/wrun-runtime.interface.d.ts +5 -0
- package/dist/kscript-data/controls/live-trades-merge.util.d.ts +185 -0
- package/dist/kscript-data/controls/live-trades-merge.util.js +357 -0
- package/dist/settings-templates/frvp-fields.d.ts +27 -0
- package/dist/settings-templates/frvp-fields.js +108 -0
- package/dist/settings-templates/index.d.ts +119 -0
- package/dist/settings-templates/index.js +442 -0
- package/dist/settings-templates/indicator-fields.d.ts +56 -0
- package/dist/settings-templates/indicator-fields.js +793 -0
- package/dist/settings-templates/tool-rules.d.ts +59 -0
- package/dist/settings-templates/tool-rules.js +49 -0
- package/dist/settings-templates/tool-tables.generated.d.ts +2 -0
- package/dist/settings-templates/tool-tables.generated.js +1668 -0
- package/dist/utility/blk-market.util.d.ts +5 -0
- package/dist/utility/blk-market.util.js +12 -0
- package/dist/utility/chart/chart-load-phase.util.d.ts +32 -0
- package/dist/utility/chart/chart-load-phase.util.js +78 -0
- package/dist/utility/chart/cme-cache-context.util.d.ts +108 -0
- package/dist/utility/chart/cme-cache-context.util.js +166 -0
- package/dist/utility/chart/cme-session-bucket.util.d.ts +82 -0
- package/dist/utility/chart/cme-session-bucket.util.js +343 -0
- package/dist/utility/chart/cme-trade-calendar.util.d.ts +26 -0
- package/dist/utility/chart/cme-trade-calendar.util.js +147 -0
- package/dist/utility/chart/continuous-contracts.util.d.ts +138 -0
- package/dist/utility/chart/continuous-contracts.util.js +374 -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/feed-interval.util.d.ts +119 -0
- package/dist/utility/chart/feed-interval.util.js +321 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.d.ts +110 -0
- package/dist/utility/chart/fetch-dedupe-policy.util.js +407 -0
- package/dist/utility/chart/footprint-band.util.d.ts +76 -0
- package/dist/utility/chart/footprint-band.util.js +205 -0
- package/dist/utility/chart/footprint-cell-identity.util.d.ts +82 -0
- package/dist/utility/chart/footprint-cell-identity.util.js +346 -0
- package/dist/utility/chart/formula-calendar.util.d.ts +27 -0
- package/dist/utility/chart/formula-calendar.util.js +59 -0
- package/dist/utility/chart/history-wall.util.d.ts +67 -0
- package/dist/utility/chart/history-wall.util.js +87 -0
- package/dist/utility/chart/index-mode.util.d.ts +66 -0
- package/dist/utility/chart/index-mode.util.js +360 -0
- package/dist/utility/chart/indicator-coverage-planner.util.d.ts +217 -0
- package/dist/utility/chart/indicator-coverage-planner.util.js +443 -0
- package/dist/utility/chart/indicator-coverage-state.util.d.ts +33 -0
- package/dist/utility/chart/indicator-coverage-state.util.js +110 -0
- package/dist/utility/chart/indicator-gap-detector.util.d.ts +127 -0
- package/dist/utility/chart/indicator-gap-detector.util.js +260 -0
- package/dist/utility/chart/indicator-gap-repair.util.d.ts +88 -0
- package/dist/utility/chart/indicator-gap-repair.util.js +177 -0
- package/dist/utility/chart/indicator-inflight-registry.util.d.ts +26 -0
- package/dist/utility/chart/indicator-inflight-registry.util.js +254 -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/interval-registry.util.d.ts +23 -0
- package/dist/utility/chart/interval-registry.util.js +83 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.d.ts +21 -0
- package/dist/utility/chart/kscript-main-grid-stages.util.js +332 -0
- package/dist/utility/chart/legacy-exchange.leaf.d.ts +11 -0
- package/dist/utility/chart/legacy-exchange.leaf.js +43 -0
- package/dist/utility/chart/live-bucket.util.d.ts +66 -0
- package/dist/utility/chart/live-bucket.util.js +165 -0
- package/dist/utility/chart/market-session-schedule.util.d.ts +91 -0
- package/dist/utility/chart/market-session-schedule.util.js +337 -0
- package/dist/utility/chart/marketKind.util.d.ts +181 -0
- package/dist/utility/chart/marketKind.util.js +371 -0
- package/dist/utility/chart/opra-read-access.leaf.d.ts +26 -0
- package/dist/utility/chart/opra-read-access.leaf.js +25 -0
- package/dist/utility/chart/prediction-identity.util.d.ts +159 -0
- package/dist/utility/chart/prediction-identity.util.js +236 -0
- package/dist/utility/chart/rth-session.util.d.ts +352 -0
- package/dist/utility/chart/rth-session.util.js +926 -0
- package/dist/utility/chart/titan-constants.pin.d.ts +43 -0
- package/dist/utility/chart/titan-constants.pin.js +50 -0
- package/dist/utility/chart/us-equities-session.util.d.ts +127 -0
- package/dist/utility/chart/us-equities-session.util.js +251 -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 +100 -0
- package/dist/utility/chart/wrun-bar-session-facts.util.js +354 -0
- package/dist/utility/chart/wrun-wire-ref.util.d.ts +23 -0
- package/dist/utility/chart/wrun-wire-ref.util.js +16 -0
- package/dist/utility/common/safe-math-eval.d.ts +18 -0
- package/dist/utility/common/safe-math-eval.js +160 -0
- package/dist/utility/common/time.util.d.ts +134 -0
- package/dist/utility/common/time.util.js +428 -0
- package/dist/utility/common/transformations.util.d.ts +126 -0
- package/dist/utility/common/transformations.util.js +711 -0
- package/dist/utility/common/visible-timeout.util.d.ts +17 -0
- package/dist/utility/common/visible-timeout.util.js +75 -0
- package/dist/utility/exchange-normalization.util.d.ts +8 -0
- package/dist/utility/exchange-normalization.util.js +32 -0
- package/dist/utility/html-escape.leaf.d.ts +11 -0
- package/dist/utility/html-escape.leaf.js +20 -0
- package/dist/utility/intl-locale.util.d.ts +2 -0
- package/dist/utility/intl-locale.util.js +28 -0
- package/dist/utility/number-format.util.d.ts +14 -1
- package/dist/utility/number-format.util.js +50 -19
- package/dist/utility/options/option-symbol.util.d.ts +28 -0
- package/dist/utility/options/option-symbol.util.js +176 -0
- package/dist/utility/options/option-trade-units.util.d.ts +190 -0
- package/dist/utility/options/option-trade-units.util.js +283 -0
- package/dist/utility/options/option-venue.util.d.ts +75 -0
- package/dist/utility/options/option-venue.util.js +85 -0
- package/dist/utility/pool-symbol.leaf.d.ts +34 -0
- package/dist/utility/pool-symbol.leaf.js +95 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.d.ts +109 -0
- package/dist/utility/scriptEditor/wrun-runtime-diagnostics.leaf.js +302 -0
- package/dist/utility/symbol-selection/contract-expiry.util.d.ts +39 -0
- package/dist/utility/symbol-selection/contract-expiry.util.js +111 -0
- package/dist/utility/v2/gate-plane.util.d.ts +58 -0
- package/dist/utility/v2/gate-plane.util.js +99 -0
- package/dist/utility/v2/gate-session-latch.util.d.ts +22 -0
- package/dist/utility/v2/gate-session-latch.util.js +34 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.d.ts +76 -0
- package/dist/utility/watchlist/import/tradingview-symbols.leaf.js +221 -0
- package/dist/utility/wrun/sources/host-grid-landing.d.ts +15 -0
- package/dist/utility/wrun/sources/host-grid-landing.js +26 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/bitfinex_funding.js +85 -0
- package/dist/utility/wrun/sources/lanes/economic.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/economic.js +79 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.d.ts +35 -0
- package/dist/utility/wrun/sources/lanes/etf_holdings.js +165 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.d.ts +19 -0
- package/dist/utility/wrun/sources/lanes/etf_premium.js +114 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/ethena_positions.js +51 -0
- package/dist/utility/wrun/sources/lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/lanes/index.js +32 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.d.ts +17 -0
- package/dist/utility/wrun/sources/lanes/long_short_ratio.js +47 -0
- package/dist/utility/wrun/sources/lanes/option_daily.d.ts +58 -0
- package/dist/utility/wrun/sources/lanes/option_daily.js +111 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.d.ts +27 -0
- package/dist/utility/wrun/sources/lanes/option_stats_10m.js +21 -0
- package/dist/utility/wrun/sources/lanes/options_flow.d.ts +50 -0
- package/dist/utility/wrun/sources/lanes/options_flow.js +155 -0
- package/dist/utility/wrun/sources/lanes/options_oi.d.ts +29 -0
- package/dist/utility/wrun/sources/lanes/options_oi.js +59 -0
- package/dist/utility/wrun/sources/lanes/options_volume.d.ts +38 -0
- package/dist/utility/wrun/sources/lanes/options_volume.js +63 -0
- package/dist/utility/wrun/sources/lanes/series.d.ts +67 -0
- package/dist/utility/wrun/sources/lanes/series.js +321 -0
- package/dist/utility/wrun/sources/lanes/token_supply.d.ts +30 -0
- package/dist/utility/wrun/sources/lanes/token_supply.js +145 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.d.ts +25 -0
- package/dist/utility/wrun/sources/lanes/treasury_balance.js +47 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.d.ts +21 -0
- package/dist/utility/wrun/sources/lanes/volatility_index.js +11 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.d.ts +215 -0
- package/dist/utility/wrun/sources/opra-option-lanes.util.js +477 -0
- package/dist/utility/wrun/sources/registry.d.ts +21 -0
- package/dist/utility/wrun/sources/registry.js +237 -0
- package/dist/utility/wrun/sources/row-lane-registry.d.ts +28 -0
- package/dist/utility/wrun/sources/row-lane-registry.js +230 -0
- package/dist/utility/wrun/sources/row-lanes/index.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/index.js +12 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.d.ts +2 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_flow.js +38 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.d.ts +55 -0
- package/dist/utility/wrun/sources/row-lanes/option_contract_state.js +126 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.d.ts +4 -0
- package/dist/utility/wrun/sources/row-lanes/option_prints.js +191 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.d.ts +62 -0
- package/dist/utility/wrun/sources/row-lanes/option_strikes.js +147 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.d.ts +70 -0
- package/dist/utility/wrun/sources/row-lanes/option_surface.js +144 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.d.ts +309 -0
- package/dist/utility/wrun/sources/wrun-poll-lane.types.js +26 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.d.ts +350 -0
- package/dist/utility/wrun/sources/wrun-poll-lanes.util.js +576 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.d.ts +275 -0
- package/dist/utility/wrun/sources/wrun-row-lane.types.js +16 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.d.ts +207 -0
- package/dist/utility/wrun/sources/wrun-row-lanes.util.js +450 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.d.ts +28 -0
- package/dist/utility/wrun/wrun-browser-sources.leaf.js +66 -0
- package/dist/utility/wrun/wrun-cloud-record.util.d.ts +65 -0
- package/dist/utility/wrun/wrun-cloud-record.util.js +121 -0
- package/dist/utility/wrun/wrun-daily-lane.util.d.ts +95 -0
- package/dist/utility/wrun/wrun-daily-lane.util.js +297 -0
- package/dist/utility/wrun/wrun-deadline.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-deadline.util.js +82 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.d.ts +94 -0
- package/dist/utility/wrun/wrun-etf-flow-lane.util.js +224 -0
- package/dist/utility/wrun/wrun-etf-funds.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-etf-funds.util.js +242 -0
- package/dist/utility/wrun/wrun-frames.d.ts +20 -1
- package/dist/utility/wrun/wrun-frames.js +103 -49
- package/dist/utility/wrun/wrun-hosted-wire-caps.d.ts +2 -2
- package/dist/utility/wrun/wrun-hosted-wire-caps.js +27 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.d.ts +22 -0
- package/dist/utility/wrun/wrun-lane-refusal.leaf.js +32 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-lane-warmup.util.js +112 -0
- package/dist/utility/wrun/wrun-leg-close.util.d.ts +57 -0
- package/dist/utility/wrun/wrun-leg-close.util.js +187 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-leg-fetch.util.js +212 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.d.ts +73 -0
- package/dist/utility/wrun/wrun-leg-stream-classes.js +86 -0
- package/dist/utility/wrun/wrun-levels-child.util.d.ts +101 -6
- package/dist/utility/wrun/wrun-levels-child.util.js +335 -157
- package/dist/utility/wrun/wrun-memory-clamp.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-memory-clamp.util.js +146 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.d.ts +51 -0
- package/dist/utility/wrun/wrun-odds-template-market.util.js +251 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.d.ts +65 -0
- package/dist/utility/wrun/wrun-opra-flow.leaf.js +94 -0
- package/dist/utility/wrun/wrun-opra-lane.util.d.ts +47 -0
- package/dist/utility/wrun/wrun-opra-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.d.ts +49 -0
- package/dist/utility/wrun/wrun-opra-stats.leaf.js +115 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.d.ts +12 -0
- package/dist/utility/wrun/wrun-opra-underlying.util.js +1 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.d.ts +142 -0
- package/dist/utility/wrun/wrun-option-contract-flow.util.js +451 -0
- package/dist/utility/wrun/wrun-option-knobs.util.d.ts +43 -0
- package/dist/utility/wrun/wrun-option-knobs.util.js +81 -0
- package/dist/utility/wrun/wrun-option-prints.util.d.ts +144 -0
- package/dist/utility/wrun/wrun-option-prints.util.js +356 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.d.ts +102 -0
- package/dist/utility/wrun/wrun-option-summary-lane.util.js +143 -0
- package/dist/utility/wrun/wrun-options-chain.util.d.ts +308 -0
- package/dist/utility/wrun/wrun-options-chain.util.js +502 -0
- package/dist/utility/wrun/wrun-overlay-identity.util.d.ts +9 -4
- package/dist/utility/wrun/wrun-overlay-identity.util.js +16 -6
- 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 +377 -0
- package/dist/utility/wrun/wrun-panel-mount.util.js +2251 -0
- package/dist/utility/wrun/wrun-param-map.util.d.ts +298 -0
- package/dist/utility/wrun/wrun-param-map.util.js +581 -0
- 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-pin-spelling.util.d.ts +149 -0
- package/dist/utility/wrun/wrun-pin-spelling.util.js +523 -0
- package/dist/utility/wrun/wrun-pin-venues.util.d.ts +116 -0
- package/dist/utility/wrun/wrun-pin-venues.util.js +320 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.d.ts +20 -0
- package/dist/utility/wrun/wrun-pinned-interval.util.js +47 -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-present-bits.util.d.ts +37 -0
- package/dist/utility/wrun/wrun-present-bits.util.js +73 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.d.ts +33 -0
- package/dist/utility/wrun/wrun-protocol-pending.util.js +57 -0
- package/dist/utility/wrun/wrun-refusal.util.d.ts +41 -1
- package/dist/utility/wrun/wrun-refusal.util.js +69 -2
- package/dist/utility/wrun/wrun-registry-errors.util.d.ts +1 -14
- package/dist/utility/wrun/wrun-registry-errors.util.js +0 -16
- package/dist/utility/wrun/wrun-row-source.d.ts +158 -0
- package/dist/utility/wrun/wrun-row-source.js +75 -0
- package/dist/utility/wrun/wrun-run-health.util.d.ts +155 -0
- package/dist/utility/wrun/wrun-run-health.util.js +273 -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-socket-row-source.d.ts +439 -0
- package/dist/utility/wrun/wrun-socket-row-source.js +1689 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.d.ts +18 -0
- package/dist/utility/wrun/wrun-socket-session-losses.util.js +25 -0
- package/dist/utility/wrun/wrun-source-rows.util.d.ts +911 -0
- package/dist/utility/wrun/wrun-source-rows.util.js +2597 -0
- package/dist/utility/wrun/wrun-tape-source.util.d.ts +82 -0
- package/dist/utility/wrun/wrun-tape-source.util.js +151 -0
- package/dist/utility/wrun/wrun-tier-grid.util.d.ts +137 -0
- package/dist/utility/wrun/wrun-tier-grid.util.js +279 -0
- package/dist/utility/wrun/wrun-trades-lane.util.d.ts +52 -0
- package/dist/utility/wrun/wrun-trades-lane.util.js +58 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.d.ts +41 -0
- package/dist/utility/wrun/wrun-volume-profile-lane.util.js +66 -0
- package/dist/utility/wrun-display-name.util.d.ts +33 -0
- package/dist/utility/wrun-display-name.util.js +64 -0
- package/dist/workers/constants/kscript-transport-codes.d.ts +15 -0
- package/dist/workers/constants/kscript-transport-codes.js +15 -0
- package/dist/workers/constants/socket-slots.d.ts +574 -0
- package/dist/workers/constants/socket-slots.js +539 -0
- package/dist/workers/utils/number.worker.util.d.ts +5 -0
- package/dist/workers/utils/number.worker.util.js +10 -0
- package/dist/workers/utils/time.worker.util.d.ts +12 -0
- package/dist/workers/utils/time.worker.util.js +24 -0
- package/dist/workers/utils/volume-profile.worker.util.d.ts +200 -0
- package/dist/workers/utils/volume-profile.worker.util.js +631 -0
- package/package.json +10 -4
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
/** f64s per contract tuple (the shared host's `WRUN_HOST_CELL_TUPLE_WIDTHS.options_chain`, the width
|
|
2
|
+
* the packer packs; wrun-source-words.kit-mirror.spec.ts pins it). */
|
|
3
|
+
export const WRUN_OPTIONS_CHAIN_TUPLE_WIDTH = 10;
|
|
4
|
+
/** The `venue` knob's words (the kit's WRUN_OPTIONS_CHAIN_VENUES, in its
|
|
5
|
+
* order): "auto" reads the chart's own market when it is an options venue
|
|
6
|
+
* (a CME futures chart reads the CME chain of its root, a flagged crypto
|
|
7
|
+
* options venue its own chain, a US stock or ETF chart or an OPRA option
|
|
8
|
+
* contract chart the OPRA chain of its ticker for an OpenMarket package
|
|
9
|
+
* only), else the coin's Deribit chain; every other
|
|
10
|
+
* word pins one venue's chain and refuses by name on a chart that has no
|
|
11
|
+
* chain there ("deribit" and "cme" as before; the five crypto words behind
|
|
12
|
+
* the crypto-options gate, see `WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS`). */
|
|
13
|
+
export const WRUN_OPTIONS_CHAIN_VENUES = [
|
|
14
|
+
'auto',
|
|
15
|
+
'deribit',
|
|
16
|
+
'cme',
|
|
17
|
+
'binance',
|
|
18
|
+
'okx',
|
|
19
|
+
'bybit',
|
|
20
|
+
'bullish',
|
|
21
|
+
'derive',
|
|
22
|
+
];
|
|
23
|
+
/** The crypto venue words' rows in the chart's venue table (`OPTION_VENUES`
|
|
24
|
+
* ids): each reads the coin's chain on that plain venue, resolved on the
|
|
25
|
+
* main thread through the metadata listing (`WrunOptionsChainCryptoVenues`
|
|
26
|
+
* below) and gated by the crypto-options gate; `deribit` stays ungated. */
|
|
27
|
+
export const WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS = Object.freeze({
|
|
28
|
+
binance: 'binance-options',
|
|
29
|
+
okx: 'okx-options',
|
|
30
|
+
bybit: 'bybit',
|
|
31
|
+
bullish: 'bullish',
|
|
32
|
+
derive: 'derive',
|
|
33
|
+
});
|
|
34
|
+
/** The venues' names in the refusals (the plain English of the panes' labels). */
|
|
35
|
+
const WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_NAMES = Object.freeze({
|
|
36
|
+
binance: 'Binance Options',
|
|
37
|
+
okx: 'OKX Options',
|
|
38
|
+
bybit: 'Bybit',
|
|
39
|
+
bullish: 'Bullish',
|
|
40
|
+
derive: 'Derive',
|
|
41
|
+
});
|
|
42
|
+
export function isWrunOptionsChainCryptoVenueWord(word) {
|
|
43
|
+
return Object.prototype.hasOwnProperty.call(WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_IDS, word);
|
|
44
|
+
}
|
|
45
|
+
/** The venue knob's words spelled for a refusal: `"deribit", "cme", ... or "derive"`. */
|
|
46
|
+
const WRUN_OPTIONS_CHAIN_PINNED_VENUE_WORDS = (() => {
|
|
47
|
+
const spelled = WRUN_OPTIONS_CHAIN_VENUES.filter((word) => word !== 'auto').map((word) => `"${word}"`);
|
|
48
|
+
return `${spelled.slice(0, -1).join(', ')} or ${spelled[spelled.length - 1]}`;
|
|
49
|
+
})();
|
|
50
|
+
/** The chain snapshot's freshness window (`FRESH_SNAPSHOT_MS` in
|
|
51
|
+
* options-chain-state.worker.util.ts, mirrored here so the main thread
|
|
52
|
+
* never imports the worker module): the K_OPTIONS_CHAIN request stamps the
|
|
53
|
+
* bucket into its identity, so the source caches (single-flight, row cache,
|
|
54
|
+
* replay cache) rotate with the chain instead of serving one snapshot for a
|
|
55
|
+
* whole bar. */
|
|
56
|
+
export const WRUN_OPTIONS_CHAIN_SNAPSHOT_MS = 30_000;
|
|
57
|
+
const OPTIONS_CHAIN_NEAREST_RE = /^nearest:([1-9]\d{0,2})$/;
|
|
58
|
+
/** The `expiries` knob parsed (the kit's wrunOptionsChainExpiries): "all"
|
|
59
|
+
* (or absent) is the whole live chain, "nearest:N" its N nearest live
|
|
60
|
+
* expiries; undefined for any other word (the kit refuses it at the sheet,
|
|
61
|
+
* the row builder again by name). */
|
|
62
|
+
export function wrunOptionsChainExpiries(value) {
|
|
63
|
+
if (value === undefined || value === 'all')
|
|
64
|
+
return { kind: 'all' };
|
|
65
|
+
const match = OPTIONS_CHAIN_NEAREST_RE.exec(value);
|
|
66
|
+
return match ? { kind: 'nearest', count: Number(match[1]) } : undefined;
|
|
67
|
+
}
|
|
68
|
+
function isWrunOptionsChainServedTier(value) {
|
|
69
|
+
return value === 'realtime' || value === 'delayed';
|
|
70
|
+
}
|
|
71
|
+
/** The identity as the flat payload fields the lane's acquisition record
|
|
72
|
+
* and the K_OPTIONS_CHAIN request carry. Prefixed (`chain*`) so the
|
|
73
|
+
* chart's placeholder rewrite (`exchange`, `symbol`, `coin`) never touches
|
|
74
|
+
* them. A governed identity adds the tier it is read on (`chainServedTier`:
|
|
75
|
+
* the request's identity and the worker's ceiling, so a source cache never
|
|
76
|
+
* serves one tier's chain to the other; the legend names a delayed OPRA read,
|
|
77
|
+
* wrun-draft-legend-note.util `wrunChainServedTierNote`) and, with a scope,
|
|
78
|
+
* the scope's wire spelling (`chainExpiries`, `chainNeighborStrikes`). */
|
|
79
|
+
export function wrunOptionsChainLaneExtras(identity) {
|
|
80
|
+
switch (identity.venue) {
|
|
81
|
+
case 'cme':
|
|
82
|
+
case 'opra':
|
|
83
|
+
return {
|
|
84
|
+
chainVenue: identity.venue,
|
|
85
|
+
chainExchange: identity.exchange,
|
|
86
|
+
chainUnderlying: identity.underlying,
|
|
87
|
+
...(identity.scope !== undefined ? wrunOptionsChainScopeFields(identity.scope) : {}),
|
|
88
|
+
chainServedTier: identity.servedTier ?? 'delayed',
|
|
89
|
+
};
|
|
90
|
+
case 'crypto':
|
|
91
|
+
return { chainVenue: 'crypto', chainSource: { ...identity.source } };
|
|
92
|
+
default:
|
|
93
|
+
return { chainVenue: 'deribit', chainCoin: identity.coin };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/** The identity a payload carries (the control's settings, the worker's
|
|
97
|
+
* request), or undefined when it carries none. A governed identity reads its
|
|
98
|
+
* scope and its tier back too; a scope the payload names but spells wrong
|
|
99
|
+
* reads no identity at all (the request is declined, never widened to the
|
|
100
|
+
* whole ladder), and a tier word it does not know is left out (read delayed). */
|
|
101
|
+
export function wrunOptionsChainIdentityOf(payload) {
|
|
102
|
+
const venue = payload?.chainVenue;
|
|
103
|
+
if (venue === 'deribit') {
|
|
104
|
+
const coin = payload?.chainCoin;
|
|
105
|
+
return typeof coin === 'string' && coin.length > 0 ? { venue: 'deribit', coin } : undefined;
|
|
106
|
+
}
|
|
107
|
+
if (venue === 'cme' || venue === 'opra') {
|
|
108
|
+
const exchange = payload?.chainExchange;
|
|
109
|
+
const underlying = payload?.chainUnderlying;
|
|
110
|
+
if (!(typeof exchange === 'string' &&
|
|
111
|
+
exchange.length > 0 &&
|
|
112
|
+
typeof underlying === 'string' &&
|
|
113
|
+
underlying.length > 0)) {
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
const expiries = payload?.chainExpiries;
|
|
117
|
+
const neighborStrikes = payload?.chainNeighborStrikes;
|
|
118
|
+
const scope = wrunOptionsChainScopeOf(expiries, neighborStrikes);
|
|
119
|
+
if (scope === undefined && !(isAbsent(expiries) && isAbsent(neighborStrikes)))
|
|
120
|
+
return undefined;
|
|
121
|
+
const servedTier = payload?.chainServedTier;
|
|
122
|
+
return {
|
|
123
|
+
venue,
|
|
124
|
+
exchange,
|
|
125
|
+
underlying,
|
|
126
|
+
...(scope !== undefined ? { scope } : {}),
|
|
127
|
+
...(isWrunOptionsChainServedTier(servedTier) ? { servedTier } : {}),
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
if (venue === 'crypto') {
|
|
131
|
+
const source = payload?.chainSource;
|
|
132
|
+
return typeof source?.exchange === 'string' &&
|
|
133
|
+
typeof source.coin === 'string' &&
|
|
134
|
+
typeof source.tradeCoin === 'string'
|
|
135
|
+
? { venue: 'crypto', source: { exchange: source.exchange, coin: source.coin, tradeCoin: source.tradeCoin } }
|
|
136
|
+
: undefined;
|
|
137
|
+
}
|
|
138
|
+
return undefined;
|
|
139
|
+
}
|
|
140
|
+
/** One key per identity (two inputs must resolve to the same chain). A
|
|
141
|
+
* governed key is scope-free: two inputs read the same chain whatever the
|
|
142
|
+
* lane asks of it (`opra:OPRA:SPY`). */
|
|
143
|
+
export function wrunOptionsChainIdentityKey(identity) {
|
|
144
|
+
switch (identity.venue) {
|
|
145
|
+
case 'cme':
|
|
146
|
+
case 'opra':
|
|
147
|
+
return `${identity.venue}:${identity.exchange.toUpperCase()}:${identity.underlying.toUpperCase()}`;
|
|
148
|
+
case 'crypto':
|
|
149
|
+
return `crypto:${identity.source.exchange}:${identity.source.coin}`;
|
|
150
|
+
default:
|
|
151
|
+
return `deribit:${identity.coin}`;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
function isAbsent(value) {
|
|
155
|
+
return value === undefined || value === null;
|
|
156
|
+
}
|
|
157
|
+
const OPTIONS_CHAIN_EXPIRY_SCOPE_RE = /^(nearest|horizon):([1-9]\d*)$/;
|
|
158
|
+
/**
|
|
159
|
+
* A scope's wire spelling: `chainExpiries` "all" | "nearest:N" | "horizon:<ms>" and
|
|
160
|
+
* `chainNeighborStrikes` (the strikes each side of every expiry's at-the-money strike, 0 = every
|
|
161
|
+
* strike). The chain store's own grammar (`formatOptionsChainExpiryScope` and
|
|
162
|
+
* `parseOptionsChainScope` in options-chain-state.worker.util), copied here so the main thread never
|
|
163
|
+
* loads the worker module; tests/utility/wrun/wrun-options-chain.util.spec.ts pins the copy against
|
|
164
|
+
* the store's.
|
|
165
|
+
*/
|
|
166
|
+
export function wrunOptionsChainScopeFields(scope) {
|
|
167
|
+
return {
|
|
168
|
+
chainExpiries: wrunOptionsChainExpiryScopeWord(scope.expiries),
|
|
169
|
+
chainNeighborStrikes: scope.neighborStrikes,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function wrunOptionsChainExpiryScopeWord(scope) {
|
|
173
|
+
switch (scope.kind) {
|
|
174
|
+
case 'all':
|
|
175
|
+
return 'all';
|
|
176
|
+
case 'nearest':
|
|
177
|
+
return `nearest:${scope.count}`;
|
|
178
|
+
case 'horizon':
|
|
179
|
+
return `horizon:${scope.ms}`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/** The scope a payload's two fields spell (`wrunOptionsChainScopeFields` read back): both absent is
|
|
183
|
+
* undefined (no scope asked), one absent takes its whole-ladder default (`all`, 0 strikes), any
|
|
184
|
+
* other value undefined. */
|
|
185
|
+
export function wrunOptionsChainScopeOf(expiries, neighborStrikes) {
|
|
186
|
+
if (isAbsent(expiries) && isAbsent(neighborStrikes))
|
|
187
|
+
return undefined;
|
|
188
|
+
let expiryScope;
|
|
189
|
+
if (isAbsent(expiries) || expiries === 'all') {
|
|
190
|
+
expiryScope = { kind: 'all' };
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
const match = typeof expiries === 'string' ? OPTIONS_CHAIN_EXPIRY_SCOPE_RE.exec(expiries) : null;
|
|
194
|
+
const amount = match ? Number(match[2]) : Number.NaN;
|
|
195
|
+
if (match && Number.isSafeInteger(amount)) {
|
|
196
|
+
expiryScope = match[1] === 'nearest' ? { kind: 'nearest', count: amount } : { kind: 'horizon', ms: amount };
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
const strikes = isAbsent(neighborStrikes) ? 0 : neighborStrikes;
|
|
200
|
+
if (expiryScope === undefined || typeof strikes !== 'number' || !Number.isSafeInteger(strikes) || strikes < 0) {
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
return { expiries: expiryScope, neighborStrikes: strikes };
|
|
204
|
+
}
|
|
205
|
+
/** The strike window each side of every expiry's at-the-money strike a governed lane serves: never
|
|
206
|
+
* narrower than 8 (the floor it trades for more expiries), never wider than 80. */
|
|
207
|
+
export const WRUN_OPTIONS_CHAIN_MIN_NEIGHBOR_STRIKES = 8;
|
|
208
|
+
export const WRUN_OPTIONS_CHAIN_MAX_NEIGHBOR_STRIKES = 80;
|
|
209
|
+
/** Contracts one expiry holds at a strike window of `strikes` each side: a call and a put per strike. */
|
|
210
|
+
function wrunOptionsChainExpiryContracts(strikes) {
|
|
211
|
+
return 2 * (2 * strikes + 1);
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* The scope a governed lane asks (CME, OPRA), bounded by the package's declared appetite alone,
|
|
215
|
+
* never by a count of expiries: the smallest `max_cells` over its chain inputs (it counts contracts,
|
|
216
|
+
* one tuple each, the pack layer's unit; one fetch feeds every input) is the budget. The lane serves
|
|
217
|
+
* as many of the expiries the inputs read as the budget fits at the floor window of
|
|
218
|
+
* WRUN_OPTIONS_CHAIN_MIN_NEIGHBOR_STRIKES (8) each side, preferring more expiries over a wider window;
|
|
219
|
+
* once every one of them fits, the window widens as far as the budget allows, up to
|
|
220
|
+
* WRUN_OPTIONS_CHAIN_MAX_NEIGHBOR_STRIKES (80): K = floor((budget / 2E - 1) / 2) for E expiries. The
|
|
221
|
+
* expiries the inputs read: every live one (`all`, or a word outside the grammar, which the row
|
|
222
|
+
* builder refuses by name), else the largest `nearest:N`, kept exact when N fits. `liveExpiries` is how
|
|
223
|
+
* many the chain lists now (its expiry directory); unknown, or a listing that names none (a directory
|
|
224
|
+
* that told nothing, never a chain of one), `all` asks the most expiries the budget fits at the floor
|
|
225
|
+
* window. SPY lists about 36: Gamma Map (4000, `all`) reads all 36 at K = 27 (3,960
|
|
226
|
+
* contracts), a `nearest:1` package declaring 800 reads 1 at K = 80, an `all` package declaring 100
|
|
227
|
+
* reads 2 at K = 12. No declared `max_cells` leaves the budget open (every expiry the inputs read, at 80).
|
|
228
|
+
*/
|
|
229
|
+
export function wrunOptionsChainLaneScope(inputs, liveExpiries) {
|
|
230
|
+
let budget = Number.POSITIVE_INFINITY;
|
|
231
|
+
// The expiries the inputs read: every live one for `all`, the largest `nearest:N` otherwise.
|
|
232
|
+
let read = inputs.length === 0 ? Number.POSITIVE_INFINITY : 0;
|
|
233
|
+
for (const input of inputs) {
|
|
234
|
+
const cells = Number(input.maxCells);
|
|
235
|
+
if (Number.isFinite(cells) && cells > 0)
|
|
236
|
+
budget = Math.min(budget, Math.floor(cells));
|
|
237
|
+
read = Math.max(read, input.expiries?.kind === 'nearest' ? input.expiries.count : Number.POSITIVE_INFINITY);
|
|
238
|
+
}
|
|
239
|
+
const live = liveExpiries !== undefined && Number.isFinite(liveExpiries) && liveExpiries >= 1
|
|
240
|
+
? Math.floor(liveExpiries)
|
|
241
|
+
: Number.POSITIVE_INFINITY;
|
|
242
|
+
// As many as fit at the floor window (one at least), of those the inputs read and the chain lists.
|
|
243
|
+
const fitAtFloor = Math.max(1, Math.floor(budget / wrunOptionsChainExpiryContracts(WRUN_OPTIONS_CHAIN_MIN_NEIGHBOR_STRIKES)));
|
|
244
|
+
const served = Math.max(1, Math.min(read, live, fitAtFloor));
|
|
245
|
+
// The widest window the budget allows for them (open when nothing bounds either).
|
|
246
|
+
const widest = Number.isFinite(served) ? Math.floor((budget / (2 * served) - 1) / 2) : Number.POSITIVE_INFINITY;
|
|
247
|
+
const strikes = Math.min(WRUN_OPTIONS_CHAIN_MAX_NEIGHBOR_STRIKES, Math.max(WRUN_OPTIONS_CHAIN_MIN_NEIGHBOR_STRIKES, widest));
|
|
248
|
+
// Every expiry, uncounted, only with an open budget and a chain whose listing is unknown.
|
|
249
|
+
return Number.isFinite(served)
|
|
250
|
+
? { expiries: { kind: 'nearest', count: served }, neighborStrikes: strikes }
|
|
251
|
+
: { expiries: { kind: 'all' }, neighborStrikes: strikes };
|
|
252
|
+
}
|
|
253
|
+
/** The crypto venues of a chart without the flag, the listing or the words:
|
|
254
|
+
* every crypto word refuses by name. */
|
|
255
|
+
export const WRUN_OPTIONS_CHAIN_NO_CRYPTO_VENUES = Object.freeze({
|
|
256
|
+
enabled: false,
|
|
257
|
+
coin: '',
|
|
258
|
+
sourceOf: () => undefined,
|
|
259
|
+
});
|
|
260
|
+
export const WRUN_OPTIONS_CHAIN_VENUE_CODE = 'wrun_options_chain_venue';
|
|
261
|
+
export const WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE = 'wrun_options_chain_unavailable';
|
|
262
|
+
export const WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE = 'wrun_options_chain_venue_unavailable';
|
|
263
|
+
export const WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE = 'wrun_options_chain_one_venue';
|
|
264
|
+
export const WRUN_OPTIONS_CHAIN_EXPIRIES_CODE = 'wrun_options_chain_expiries';
|
|
265
|
+
/** The name each plane's chain directory goes by in a refusal's technical words. */
|
|
266
|
+
const WRUN_OPTIONS_CHAIN_DIRECTORY_NAMES = Object.freeze({
|
|
267
|
+
cme: 'CME',
|
|
268
|
+
opra: 'US',
|
|
269
|
+
});
|
|
270
|
+
/**
|
|
271
|
+
* The `venue` knob against the chart, decided in ONE place for the run lane,
|
|
272
|
+
* the works-on list and the K_ control: `chartSource` is what the chart's own
|
|
273
|
+
* options controls resolve for the market (`resolveOptionsChartSource`),
|
|
274
|
+
* `chartCoin` the chart's coin for a pinned Deribit family off a market that
|
|
275
|
+
* is not Deribit-backed, `deribitListed` the Deribit coin set, `cryptoVenues`
|
|
276
|
+
* what the main thread resolved for the five crypto venue words (the flag and
|
|
277
|
+
* the coin's listing per venue), `official` whether the package is one of
|
|
278
|
+
* OpenMarket's own (`isOfficialWrunOverlay`; a caller without the overlay's
|
|
279
|
+
* provenance passes false: fail closed). A governed identity comes back
|
|
280
|
+
* without a scope: the run lane sizes it once the identity names the chain
|
|
281
|
+
* (`wrunOptionsChainLaneScope` over the chain's live expiry count).
|
|
282
|
+
* `directoryFailed` is the caller's evidence that
|
|
283
|
+
* a plane's chain directory call itself threw on a chart governed by it
|
|
284
|
+
* (`chartSource` is then unknown): a word that reads that chain (`cme` and
|
|
285
|
+
* `auto` on a CME chart, `auto` on a US stock chart) refuses `cme-directory`
|
|
286
|
+
* or `opra-directory` instead of guessing another chain (a run the OPRA plane
|
|
287
|
+
* is closed to meets the OPRA wall first). Refuses by name
|
|
288
|
+
* before any fetch, the odds lane's way: the message names the input, the
|
|
289
|
+
* market and the way out, and the reason says why
|
|
290
|
+
* (`WrunOptionsChainRefusalReason`). A crypto word resolves to
|
|
291
|
+
* `{ venue: 'crypto', source }` exactly as `auto` does on a flagged crypto
|
|
292
|
+
* options chart, so the lane, the worker and the identity key read one shape.
|
|
293
|
+
* `auto` reads an OPRA chain (a US stock or ETF chart, an OPRA option
|
|
294
|
+
* contract chart) for an official package, or for any run the
|
|
295
|
+
* `opra-user-scripts` flag opened the plane to (`opraUserScripts`: the
|
|
296
|
+
* caller's kscript-venue-policy `isOpraUserScriptRun` over the overlay's
|
|
297
|
+
* settings), and refuses `opra-official-only` otherwise; no venue word pins OPRA.
|
|
298
|
+
*/
|
|
299
|
+
export function decideWrunOptionsChainIdentity(args) {
|
|
300
|
+
const { chartSource, marketLabel, inputName } = args;
|
|
301
|
+
const venue = args.venue ?? 'auto';
|
|
302
|
+
// The OPRA plane is open to OpenMarket's own packages, and to any run the flag opened it to.
|
|
303
|
+
const opraOpen = args.official || args.opraUserScripts === true;
|
|
304
|
+
const who = `Input '${inputName}' reads options_chain cells`;
|
|
305
|
+
const deribitCoin = chartSource?.venue === 'deribit'
|
|
306
|
+
? chartSource.coin
|
|
307
|
+
: chartSource?.venue === 'crypto'
|
|
308
|
+
? chartSource.source.coin
|
|
309
|
+
: (args.chartCoin ?? '');
|
|
310
|
+
const refuse = (reason, code, message, facts = {}) => ({
|
|
311
|
+
ok: false,
|
|
312
|
+
code,
|
|
313
|
+
message,
|
|
314
|
+
reason,
|
|
315
|
+
...(facts.venueName !== undefined ? { venueName: facts.venueName } : {}),
|
|
316
|
+
...(facts.coin !== undefined && facts.coin !== '' ? { coin: facts.coin } : {}),
|
|
317
|
+
...(facts.stop !== undefined ? { stop: facts.stop } : {}),
|
|
318
|
+
...(facts.plane !== undefined ? { plane: facts.plane } : {}),
|
|
319
|
+
});
|
|
320
|
+
if (!WRUN_OPTIONS_CHAIN_VENUES.includes(venue)) {
|
|
321
|
+
return refuse('bad-venue-word', WRUN_OPTIONS_CHAIN_VENUE_CODE, `${who} with venue '${venue}' (${WRUN_OPTIONS_CHAIN_VENUE_CODE}): declare "auto" (the chart's own market when it is an options venue, else the coin's Deribit chain) or one venue's chain: ${WRUN_OPTIONS_CHAIN_PINNED_VENUE_WORDS}`);
|
|
322
|
+
}
|
|
323
|
+
if (isWrunOptionsChainCryptoVenueWord(venue)) {
|
|
324
|
+
const { cryptoVenues } = args;
|
|
325
|
+
const name = WRUN_OPTIONS_CHAIN_CRYPTO_VENUE_NAMES[venue];
|
|
326
|
+
const coin = cryptoVenues.coin.length > 0 ? cryptoVenues.coin : deribitCoin;
|
|
327
|
+
if (!cryptoVenues.enabled) {
|
|
328
|
+
return refuse('flag-off', WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE, `${who} with venue "${venue}", but ${name} chains are not enabled on this chart (${WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE}: the crypto-options flag is off): declare venue "auto" (the chart's own market when it is an options venue, else the coin's Deribit chain) or "deribit"`, { venueName: name, coin });
|
|
329
|
+
}
|
|
330
|
+
const source = cryptoVenues.sourceOf(venue);
|
|
331
|
+
if (source !== undefined)
|
|
332
|
+
return { ok: true, identity: { venue: 'crypto', source } };
|
|
333
|
+
return refuse('venue-not-listed', WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE, `${who} with venue "${venue}", but ${name} lists no options for ${cryptoVenues.coin.length > 0 ? `coin '${cryptoVenues.coin}'` : `the chart market ${marketLabel}`} (${WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE}): open a chart of a coin ${name} lists, or declare venue "auto"`, { venueName: name, coin });
|
|
334
|
+
}
|
|
335
|
+
// The chart's source on one gate plane with an identity, as the identity the lane reads (the run
|
|
336
|
+
// sizes its scope once it names the chain); undefined for any other source, or one that resolved empty.
|
|
337
|
+
const governedIdentity = (plane) => {
|
|
338
|
+
if (chartSource === undefined || chartSource.venue === 'deribit' || chartSource.venue === 'crypto') {
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
if (chartSource.venue !== plane || chartSource.exchange.length === 0 || chartSource.underlying.length === 0) {
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
return { venue: plane, exchange: chartSource.exchange, underlying: chartSource.underlying };
|
|
345
|
+
};
|
|
346
|
+
const cmeIdentity = governedIdentity('cme');
|
|
347
|
+
const directoryRefusal = (plane) => refuse(plane === 'opra' ? 'opra-directory' : 'cme-directory', WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, `${who}, but the ${WRUN_OPTIONS_CHAIN_DIRECTORY_NAMES[plane]} option chain directory did not answer for the chart market ${marketLabel} (${WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE}): Run again`, { coin: deribitCoin });
|
|
348
|
+
// Another screen holds the plane's one session (gate-session-latch.util): the chain is not read here until the
|
|
349
|
+
// session is taken back, so the word stops by that name, never "did not answer".
|
|
350
|
+
const sessionStop = (plane) => refuse('options-stopped', WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, `${who}, but the ${WRUN_OPTIONS_CHAIN_DIRECTORY_NAMES[plane]} options data session is open on another screen (${WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE}): Resume here takes it back`, { coin: deribitCoin, stop: 'session-elsewhere', plane });
|
|
351
|
+
// The OPRA wall: US options data is open to OpenMarket's own packages only.
|
|
352
|
+
const opraWall = () => refuse('opra-official-only', WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, `${who}, but US options data is open to OpenMarket's own Indicators only (${WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE}): a package you wrote or added from the community cannot read it yet`, { coin: deribitCoin });
|
|
353
|
+
if (venue === 'cme') {
|
|
354
|
+
if (cmeIdentity)
|
|
355
|
+
return { ok: true, identity: cmeIdentity };
|
|
356
|
+
if (args.heldElsewhere === 'cme')
|
|
357
|
+
return sessionStop('cme');
|
|
358
|
+
if (args.directoryFailed === 'cme')
|
|
359
|
+
return directoryRefusal('cme');
|
|
360
|
+
// Provably no CME futures chart: the chart's own options controls resolved a crypto, a Deribit or
|
|
361
|
+
// an OPRA chain for it, or its US option chain directory threw (a CME-governed exchange always
|
|
362
|
+
// resolves the `cme` shape).
|
|
363
|
+
const provablyNotCme = (chartSource !== undefined && chartSource.venue !== 'cme') ||
|
|
364
|
+
args.directoryFailed === 'opra' ||
|
|
365
|
+
args.heldElsewhere === 'opra';
|
|
366
|
+
return refuse(provablyNotCme ? 'cme-venue' : 'cme-unresolved', WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE, `${who} with venue "cme", but the chart market ${marketLabel} has no CME option chain (${WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE}): open a CME futures chart, or declare venue "auto" to read the coin's Deribit chain here`, { coin: deribitCoin });
|
|
367
|
+
}
|
|
368
|
+
if (venue === 'deribit') {
|
|
369
|
+
if (deribitCoin.length > 0 && args.deribitListed(deribitCoin)) {
|
|
370
|
+
return { ok: true, identity: { venue: 'deribit', coin: deribitCoin } };
|
|
371
|
+
}
|
|
372
|
+
return refuse('venue-not-listed', WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE, `${who} with venue "deribit", but Deribit lists no options for ${deribitCoin.length > 0 ? `coin '${deribitCoin}'` : `the chart market ${marketLabel}`} (${WRUN_OPTIONS_CHAIN_VENUE_UNAVAILABLE_CODE}): open a chart of a coin Deribit lists (BTC, ETH, SOL, ...), or declare venue "auto"`, { venueName: 'Deribit', coin: deribitCoin });
|
|
373
|
+
}
|
|
374
|
+
// "auto": the chart's own market when it is an options venue, else the
|
|
375
|
+
// coin's Deribit chain. A governed chart whose directory threw reads no other
|
|
376
|
+
// chain in its place; the OPRA wall stands before the directory (a run the
|
|
377
|
+
// plane is closed to reads no US chain, answered or not).
|
|
378
|
+
if ((args.directoryFailed === 'opra' || args.heldElsewhere === 'opra') && !opraOpen)
|
|
379
|
+
return opraWall();
|
|
380
|
+
// A plane another screen holds: no directory read was sent, the chain stops by that name (Resume here).
|
|
381
|
+
if (args.heldElsewhere !== undefined)
|
|
382
|
+
return sessionStop(args.heldElsewhere);
|
|
383
|
+
if (args.directoryFailed !== undefined)
|
|
384
|
+
return directoryRefusal(args.directoryFailed);
|
|
385
|
+
if (cmeIdentity)
|
|
386
|
+
return { ok: true, identity: cmeIdentity };
|
|
387
|
+
// A chart whose options list on OPRA but ride no plane for a known reason (the `opra` flag, the plane router) reads
|
|
388
|
+
// no other chain in their place (a stock's options are never Deribit's): the wall first for a run the plane is
|
|
389
|
+
// closed to, as on the plane, then the reason itself.
|
|
390
|
+
if (args.opraStop !== undefined) {
|
|
391
|
+
if (!opraOpen)
|
|
392
|
+
return opraWall();
|
|
393
|
+
return refuse('options-stopped', WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, `${who}, but the chart market ${marketLabel} reads no US options data (${WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE}): ${args.opraStop === 'flag-off'
|
|
394
|
+
? 'the opra flag is off for this account'
|
|
395
|
+
: 'an index chart does not ride the OPRA plane yet; open a US stock or ETF chart, or an option contract'}`, { coin: deribitCoin, stop: args.opraStop });
|
|
396
|
+
}
|
|
397
|
+
if (chartSource?.venue === 'opra') {
|
|
398
|
+
const opraIdentity = governedIdentity('opra');
|
|
399
|
+
if (opraIdentity === undefined) {
|
|
400
|
+
return refuse('no-chain', WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, `${who}, but the chart market ${marketLabel} has no option chain (${WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE}): OPRA lists none for it on this chart (an index's options do not attach to a stock chart); open a US stock or ETF chart that lists options`, { coin: deribitCoin });
|
|
401
|
+
}
|
|
402
|
+
return opraOpen ? { ok: true, identity: opraIdentity } : opraWall();
|
|
403
|
+
}
|
|
404
|
+
if (chartSource?.venue === 'crypto')
|
|
405
|
+
return { ok: true, identity: { venue: 'crypto', source: chartSource.source } };
|
|
406
|
+
if (chartSource?.venue === 'cme') {
|
|
407
|
+
return refuse('cme-unresolved', WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, `${who}, but the CME option chain of the chart market ${marketLabel} could not be resolved (${WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE}): the root has no listed options, or the chain directory did not answer; Run again or open a root with options`, { coin: deribitCoin });
|
|
408
|
+
}
|
|
409
|
+
if (deribitCoin.length > 0 && args.deribitListed(deribitCoin)) {
|
|
410
|
+
return { ok: true, identity: { venue: 'deribit', coin: deribitCoin } };
|
|
411
|
+
}
|
|
412
|
+
return refuse('no-chain', WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE, `${who}, but the chart market ${marketLabel} has no option chain (${WRUN_OPTIONS_CHAIN_UNAVAILABLE_CODE}): ${deribitCoin.length > 0 ? `coin '${deribitCoin}' is not listed on Deribit` : 'the market has no coin'} and the market is not an options venue; open a CME futures chart or a chart of a coin Deribit lists (BTC, ETH, SOL, ...)`, { coin: deribitCoin });
|
|
413
|
+
}
|
|
414
|
+
/** Two inputs that resolved to two chains: one package reads one chain (the run lane's words,
|
|
415
|
+
* reason `one-venue`). */
|
|
416
|
+
export function wrunOptionsChainOneVenueRefusal(firstInputName, inputName) {
|
|
417
|
+
return {
|
|
418
|
+
ok: false,
|
|
419
|
+
code: WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE,
|
|
420
|
+
message: `Inputs '${firstInputName}' and '${inputName}' read options_chain cells of two different chains ` +
|
|
421
|
+
`(${WRUN_OPTIONS_CHAIN_ONE_VENUE_CODE}): one package reads one chain, so declare the same venue on both`,
|
|
422
|
+
reason: 'one-venue',
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
/** The worker's block: every instrument of the shared chain snapshot as a
|
|
426
|
+
* tuple, ordered by expiry, then strike, calls before puts, then symbol
|
|
427
|
+
* (deterministic whatever order the map holds), zero-OI contracts kept
|
|
428
|
+
* (the raw chain; a package decides what a zero means). */
|
|
429
|
+
export function wrunOptionsChainTuples(instruments) {
|
|
430
|
+
const entries = [...instruments].filter((snap) => Number.isFinite(snap.strike) && snap.strike > 0 && Number.isFinite(snap.expiryMs));
|
|
431
|
+
entries.sort((a, b) => a.expiryMs - b.expiryMs ||
|
|
432
|
+
a.strike - b.strike ||
|
|
433
|
+
(a.side === b.side ? 0 : a.side === 'CALL' ? -1 : 1) ||
|
|
434
|
+
(a.symbol < b.symbol ? -1 : a.symbol > b.symbol ? 1 : 0));
|
|
435
|
+
return entries.map((snap) => [
|
|
436
|
+
snap.strike,
|
|
437
|
+
snap.expiryMs,
|
|
438
|
+
snap.side === 'CALL' ? 1 : -1,
|
|
439
|
+
finiteOr(snap.oi, 0),
|
|
440
|
+
finiteOr(snap.gamma, 0),
|
|
441
|
+
finiteOr(snap.delta, 0),
|
|
442
|
+
finiteOr(snap.markIv, 0),
|
|
443
|
+
finiteOr(snap.underlyingPrice, 0),
|
|
444
|
+
Number(snap.multiplier) > 0 ? Number(snap.multiplier) : 1,
|
|
445
|
+
finiteOr(snap.vega, 0),
|
|
446
|
+
]);
|
|
447
|
+
}
|
|
448
|
+
function finiteOr(value, fallback) {
|
|
449
|
+
const number = Number(value);
|
|
450
|
+
return Number.isFinite(number) ? number : fallback;
|
|
451
|
+
}
|
|
452
|
+
/** A lane row `[ts, [tuple], ...]` (the K_OPTIONS_CHAIN worker's shape,
|
|
453
|
+
* nested like the volume-profile lane's) read back as tuples; a malformed
|
|
454
|
+
* tuple (not an array of nine finite numbers) is skipped whole, the VP
|
|
455
|
+
* lane's malformed-bucket rule. */
|
|
456
|
+
export function wrunOptionsChainRowTuples(row) {
|
|
457
|
+
const tuples = [];
|
|
458
|
+
for (let at = 1; at < row.length; at += 1) {
|
|
459
|
+
const cell = row[at];
|
|
460
|
+
if (!Array.isArray(cell) || cell.length !== WRUN_OPTIONS_CHAIN_TUPLE_WIDTH)
|
|
461
|
+
continue;
|
|
462
|
+
const tuple = cell.map(Number);
|
|
463
|
+
if (tuple.some((value) => !Number.isFinite(value)))
|
|
464
|
+
continue;
|
|
465
|
+
tuples.push(tuple);
|
|
466
|
+
}
|
|
467
|
+
return tuples;
|
|
468
|
+
}
|
|
469
|
+
/** The newest lane row's chain (the row with the greatest finite ts), or
|
|
470
|
+
* undefined when no row carries one: the hosts serve the latest chain, so
|
|
471
|
+
* the live primary row reads it whatever bar the poll stamped it on. */
|
|
472
|
+
export function latestWrunOptionsChainTuples(rows) {
|
|
473
|
+
let latest;
|
|
474
|
+
for (const row of rows ?? []) {
|
|
475
|
+
const ts = Number(row?.[0]);
|
|
476
|
+
if (!Number.isFinite(ts))
|
|
477
|
+
continue;
|
|
478
|
+
if (latest !== undefined && ts <= latest.ts)
|
|
479
|
+
continue;
|
|
480
|
+
latest = { ts, tuples: wrunOptionsChainRowTuples(row) };
|
|
481
|
+
}
|
|
482
|
+
return latest;
|
|
483
|
+
}
|
|
484
|
+
/** The block one input receives: the tuples under its `expiries` selector
|
|
485
|
+
* ("nearest:N" keeps the N earliest distinct expiries of the chain, which
|
|
486
|
+
* the snapshot already pruned of expired contracts), flattened in tuple
|
|
487
|
+
* order. */
|
|
488
|
+
export function wrunOptionsChainCells(tuples, expiries) {
|
|
489
|
+
let kept = tuples;
|
|
490
|
+
if (expiries.kind === 'nearest') {
|
|
491
|
+
const distinct = [...new Set(tuples.map((tuple) => Number(tuple[1])))].sort((a, b) => a - b);
|
|
492
|
+
const nearest = new Set(distinct.slice(0, expiries.count));
|
|
493
|
+
kept = tuples.filter((tuple) => nearest.has(Number(tuple[1])));
|
|
494
|
+
}
|
|
495
|
+
const cells = new Array(kept.length * WRUN_OPTIONS_CHAIN_TUPLE_WIDTH);
|
|
496
|
+
kept.forEach((tuple, index) => {
|
|
497
|
+
for (let column = 0; column < WRUN_OPTIONS_CHAIN_TUPLE_WIDTH; column += 1) {
|
|
498
|
+
cells[index * WRUN_OPTIONS_CHAIN_TUPLE_WIDTH + column] = Number(tuple[column]);
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
return cells;
|
|
502
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Overlay-settings predicates for the package-backed Indicator lanes. Leaf
|
|
3
|
-
* module (
|
|
4
|
-
* analytics envelope and the boot seam
|
|
5
|
-
* TECHNICAL_SCRIPT record is a package, not a
|
|
3
|
+
* module (its one import is the display-name rule, itself a leaf): the alert
|
|
4
|
+
* resolver, the store's add lane, the analytics envelope and the boot seam
|
|
5
|
+
* read ONE definition of "this TECHNICAL_SCRIPT record is a package, not a
|
|
6
|
+
* script".
|
|
6
7
|
*
|
|
7
8
|
* Identities, by settings key:
|
|
8
9
|
* - `wrunRegistryRef` ({package, version, position}): a registry package the
|
|
@@ -80,5 +81,9 @@ export declare function isWrunScriptSlug(scriptId: unknown): boolean;
|
|
|
80
81
|
* `customName` (the Indicator's display name, stamped at mount and kept by
|
|
81
82
|
* the save), else the plot name both lanes stamp at mount (`meta.plots[0]`).
|
|
82
83
|
* A candidate shaped like a slug or a package address is skipped: a reader
|
|
83
|
-
* falls back to its own generic label instead of showing either.
|
|
84
|
+
* falls back to its own generic label instead of showing either. A saved
|
|
85
|
+
* package's candidate is skipped too while it stands in for a name
|
|
86
|
+
* (`isPlaceholderWrunTitle`: the editor's untitled placeholder a row added
|
|
87
|
+
* before the 2026-10-05 publish fix froze, its address, its slug); a draft
|
|
88
|
+
* keeps its tab's title, whatever it is. */
|
|
84
89
|
export declare function wrunOverlayTitleOf(settings: unknown): string | undefined;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Overlay-settings predicates for the package-backed Indicator lanes. Leaf
|
|
3
|
-
* module (
|
|
4
|
-
* analytics envelope and the boot seam
|
|
5
|
-
* TECHNICAL_SCRIPT record is a package, not a
|
|
3
|
+
* module (its one import is the display-name rule, itself a leaf): the alert
|
|
4
|
+
* resolver, the store's add lane, the analytics envelope and the boot seam
|
|
5
|
+
* read ONE definition of "this TECHNICAL_SCRIPT record is a package, not a
|
|
6
|
+
* script".
|
|
6
7
|
*
|
|
7
8
|
* Identities, by settings key:
|
|
8
9
|
* - `wrunRegistryRef` ({package, version, position}): a registry package the
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
* it beside `wrunRunTarget` for the builds from before wave 3
|
|
18
19
|
* (wrun-cloud-row-compat.util); the record a driver runs never does.
|
|
19
20
|
*/
|
|
21
|
+
import { isPlaceholderWrunTitle } from '../wrun-display-name.util.js';
|
|
20
22
|
function hasPackageName(ref) {
|
|
21
23
|
if (!ref || typeof ref !== 'object')
|
|
22
24
|
return false;
|
|
@@ -127,16 +129,24 @@ const PACKAGE_ADDRESS_RE = /^@[^\s/]+\/\S+$/;
|
|
|
127
129
|
* `customName` (the Indicator's display name, stamped at mount and kept by
|
|
128
130
|
* the save), else the plot name both lanes stamp at mount (`meta.plots[0]`).
|
|
129
131
|
* A candidate shaped like a slug or a package address is skipped: a reader
|
|
130
|
-
* falls back to its own generic label instead of showing either.
|
|
132
|
+
* falls back to its own generic label instead of showing either. A saved
|
|
133
|
+
* package's candidate is skipped too while it stands in for a name
|
|
134
|
+
* (`isPlaceholderWrunTitle`: the editor's untitled placeholder a row added
|
|
135
|
+
* before the 2026-10-05 publish fix froze, its address, its slug); a draft
|
|
136
|
+
* keeps its tab's title, whatever it is. */
|
|
131
137
|
export function wrunOverlayTitleOf(settings) {
|
|
132
138
|
const candidate = settings;
|
|
133
139
|
const plots = candidate?.meta?.plots;
|
|
140
|
+
const packageName = isWrunSavedPackageOverlaySettings(settings) ? wrunPackageNameOf(settings) : undefined;
|
|
134
141
|
for (const value of [candidate?.customName, Array.isArray(plots) ? plots[0] : undefined]) {
|
|
135
142
|
if (typeof value !== 'string')
|
|
136
143
|
continue;
|
|
137
144
|
const title = value.trim();
|
|
138
|
-
if (title
|
|
139
|
-
|
|
145
|
+
if (!title || isWrunScriptSlug(title) || PACKAGE_ADDRESS_RE.test(title))
|
|
146
|
+
continue;
|
|
147
|
+
if (packageName !== undefined && isPlaceholderWrunTitle(title, packageName))
|
|
148
|
+
continue;
|
|
149
|
+
return title;
|
|
140
150
|
}
|
|
141
151
|
return undefined;
|
|
142
152
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { WrunChildOverlayChart } from './wrun-panel-mount.util.js';
|
|
2
|
+
export type WrunPanelMountRuntime = Pick<typeof import('./wrun-panel-mount.util.js'), 'retranslateWrunChildOverlays'> & Partial<Pick<typeof import('./wrun-panel-mount.util.js'), 'cutWrunBatchedChildRecords'>>;
|
|
3
|
+
/** Hand the child mount over: it calls this as it evaluates. */
|
|
4
|
+
export declare function bindWrunPanelMountRuntime(loaded: WrunPanelMountRuntime): void;
|
|
5
|
+
/** `retranslateWrunChildOverlays` (the child mount): nothing to do without a child on the chart. */
|
|
6
|
+
export declare function retranslateWrunChildOverlays(tc: WrunChildOverlayChart): void;
|
|
7
|
+
/** `cutWrunBatchedChildRecords` (the child mount): the replay cut of a batched child's mount record. A
|
|
8
|
+
* child mount not bound yet holds no record (it owns them and binds as it evaluates), so the cut has
|
|
9
|
+
* nothing to cut and no import is made. */
|
|
10
|
+
export declare function cutWrunBatchedChildRecords(tc: WrunChildOverlayChart, overlayId: string, fromTs: number, toTs: number): string[];
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The boot graph's side of the wrun child mount (`wrun-panel-mount.util`): the timezone sync
|
|
3
|
+
* (timezone-sync.util) retranslates every chart's mounted wrun children through here, so the child
|
|
4
|
+
* mount, the panel translator and the run-result adapter behind it stay out of the pre-candle
|
|
5
|
+
* closure (docs/features/kscript/wrun/wrun-browser-runtime.md, "Boot doors").
|
|
6
|
+
*
|
|
7
|
+
* The door's contract:
|
|
8
|
+
* - The child mount in hand: the call goes straight to it in the caller's turn. The child mount
|
|
9
|
+
* binds itself as it evaluates (`bindWrunPanelMountRuntime`): it owns the map of mounted
|
|
10
|
+
* children, so a chart can hold none before it evaluates, and every lane that mounts one (the
|
|
11
|
+
* loaders' run pass, the hosted lanes) evaluates it first.
|
|
12
|
+
* - Not mine: no child overlay id (`<parent>::<kind>:<name>`, wrun-child-overlay-id.util) on the
|
|
13
|
+
* chart's metadata, no import. A flag-off session and every kScript chart stay here.
|
|
14
|
+
* - A child id before the child mount (a registrant that skipped it): the child mount loads once
|
|
15
|
+
* and the retranslate runs once when it lands, never rejecting; the children relabel then.
|
|
16
|
+
* Ring `wrun-panel-mount-late`.
|
|
17
|
+
*/
|
|
18
|
+
import { wrunChartHostEnv } from '../../host-env.js';
|
|
19
|
+
import { wrunChildOverlayParentId } from './wrun-child-overlay-id.util.js';
|
|
20
|
+
let runtime;
|
|
21
|
+
let loading;
|
|
22
|
+
/** Hand the child mount over: it calls this as it evaluates. */
|
|
23
|
+
export function bindWrunPanelMountRuntime(loaded) {
|
|
24
|
+
runtime = loaded;
|
|
25
|
+
}
|
|
26
|
+
function loadWrunPanelMountRuntime() {
|
|
27
|
+
if (runtime)
|
|
28
|
+
return Promise.resolve(runtime);
|
|
29
|
+
// The mount's host ports load beside it (chart.loadPanelMountPorts): its retranslate reads them.
|
|
30
|
+
loading ??= Promise.all([import('./wrun-panel-mount.util.js'), wrunChartHostEnv().chart.loadPanelMountPorts()]).then(([loaded]) => {
|
|
31
|
+
runtime ??= loaded;
|
|
32
|
+
return runtime;
|
|
33
|
+
}, (error) => {
|
|
34
|
+
loading = undefined;
|
|
35
|
+
throw error;
|
|
36
|
+
});
|
|
37
|
+
return loading;
|
|
38
|
+
}
|
|
39
|
+
/** True when the chart's metadata holds a wrun child overlay. */
|
|
40
|
+
function chartHoldsWrunChild(tc) {
|
|
41
|
+
const metadata = tc?.metadata;
|
|
42
|
+
if (!Array.isArray(metadata))
|
|
43
|
+
return false;
|
|
44
|
+
return metadata.some((meta) => typeof meta?.id === 'string' && wrunChildOverlayParentId(meta.id) !== null);
|
|
45
|
+
}
|
|
46
|
+
/** `retranslateWrunChildOverlays` (the child mount): nothing to do without a child on the chart. */
|
|
47
|
+
export function retranslateWrunChildOverlays(tc) {
|
|
48
|
+
if (runtime) {
|
|
49
|
+
runtime.retranslateWrunChildOverlays(tc);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (!chartHoldsWrunChild(tc))
|
|
53
|
+
return;
|
|
54
|
+
if (wrunChartHostEnv().diagnostics.debugEnabled()) {
|
|
55
|
+
wrunChartHostEnv().diagnostics.debug('wrun-panel-mount-late', { entry: 'retranslate' });
|
|
56
|
+
}
|
|
57
|
+
void loadWrunPanelMountRuntime()
|
|
58
|
+
.then((loaded) => loaded.retranslateWrunChildOverlays(tc))
|
|
59
|
+
.catch((error) => {
|
|
60
|
+
console.warn("[wrun] child mount unavailable for 'retranslate':", error);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/** `cutWrunBatchedChildRecords` (the child mount): the replay cut of a batched child's mount record. A
|
|
64
|
+
* child mount not bound yet holds no record (it owns them and binds as it evaluates), so the cut has
|
|
65
|
+
* nothing to cut and no import is made. */
|
|
66
|
+
export function cutWrunBatchedChildRecords(tc, overlayId, fromTs, toTs) {
|
|
67
|
+
return runtime?.cutWrunBatchedChildRecords?.(tc, overlayId, fromTs, toTs) ?? [];
|
|
68
|
+
}
|