@ksp-gonogo/sitrep-sdk 1.0.0-rc.45 → 1.0.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 +48 -93
- package/dist/__generated__/command-map.d.ts +247 -2
- package/dist/__generated__/command-map.d.ts.map +1 -1
- package/dist/__generated__/command-map.js +91 -19
- package/dist/__generated__/command-map.js.map +1 -1
- package/dist/__generated__/contract.d.ts +3062 -352
- package/dist/__generated__/contract.d.ts.map +1 -1
- package/dist/__generated__/contract.js +187 -3
- package/dist/__generated__/contract.js.map +1 -1
- package/dist/__generated__/delay-roles.d.ts +2 -2
- package/dist/__generated__/delay-roles.d.ts.map +1 -1
- package/dist/__generated__/delay-roles.js +12 -0
- package/dist/__generated__/delay-roles.js.map +1 -1
- package/dist/__generated__/error-codes.d.ts +11 -11
- package/dist/__generated__/error-codes.d.ts.map +1 -1
- package/dist/__generated__/error-codes.js +12 -12
- package/dist/__generated__/error-codes.js.map +1 -1
- package/dist/__generated__/frames.d.ts +40 -4
- package/dist/__generated__/frames.d.ts.map +1 -1
- package/dist/__generated__/frames.js +20 -4
- package/dist/__generated__/frames.js.map +1 -1
- package/dist/__generated__/reckonability.d.ts +3 -1
- package/dist/__generated__/reckonability.d.ts.map +1 -1
- package/dist/__generated__/reckonability.js +1 -1
- package/dist/__generated__/reckonability.js.map +1 -1
- package/dist/__generated__/sample-kinds.d.ts +18 -2
- package/dist/__generated__/sample-kinds.d.ts.map +1 -1
- package/dist/__generated__/sample-kinds.js +18 -2
- package/dist/__generated__/sample-kinds.js.map +1 -1
- package/dist/__generated__/topic-map.d.ts +41 -17
- package/dist/__generated__/topic-map.d.ts.map +1 -1
- package/dist/__generated__/topic-map.js +16 -3
- package/dist/__generated__/topic-map.js.map +1 -1
- package/dist/__generated__/units.d.ts +247 -6
- package/dist/__generated__/units.d.ts.map +1 -1
- package/dist/__generated__/units.js +949 -76
- package/dist/__generated__/units.js.map +1 -1
- package/dist/api/command-rejection.d.ts +2 -2
- package/dist/api/command-rejection.js +1 -1
- package/dist/api/contribution-slots.d.ts +122 -21
- package/dist/api/contribution-slots.d.ts.map +1 -1
- package/dist/api/contribution-slots.js +4 -4
- package/dist/api/contribution-slots.js.map +1 -1
- package/dist/api/error-codes.d.ts +3 -2
- package/dist/api/error-codes.d.ts.map +1 -1
- package/dist/api/error-codes.js +3 -2
- package/dist/api/error-codes.js.map +1 -1
- package/dist/api/framework-reads.d.ts +2 -2
- package/dist/api/framework-reads.d.ts.map +1 -1
- package/dist/api/framework-reads.js +6 -1
- package/dist/api/framework-reads.js.map +1 -1
- package/dist/api/host.d.ts +14 -6
- package/dist/api/host.d.ts.map +1 -1
- package/dist/api/host.js.map +1 -1
- package/dist/api/index.d.ts +70 -60
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +66 -54
- package/dist/api/index.js.map +1 -1
- package/dist/api/logger-contract.d.ts +2 -1
- package/dist/api/logger-contract.d.ts.map +1 -1
- package/dist/api/logger.d.ts +6 -3
- package/dist/api/logger.d.ts.map +1 -1
- package/dist/api/logger.js +6 -3
- package/dist/api/logger.js.map +1 -1
- package/dist/api/part-panels.d.ts +143 -0
- package/dist/api/part-panels.d.ts.map +1 -0
- package/dist/api/part-panels.js +104 -0
- package/dist/api/part-panels.js.map +1 -0
- package/dist/api/plot-layers.d.ts +1 -1
- package/dist/api/plot-layers.js +1 -1
- package/dist/api/registry.d.ts +4 -2
- package/dist/api/registry.d.ts.map +1 -1
- package/dist/api/registry.js +4 -2
- package/dist/api/registry.js.map +1 -1
- package/dist/api/settings/store.d.ts +1 -1
- package/dist/api/settings/store.d.ts.map +1 -1
- package/dist/api/settings/store.js +7 -2
- package/dist/api/settings/store.js.map +1 -1
- package/dist/api/slots.d.ts +150 -70
- package/dist/api/slots.d.ts.map +1 -1
- package/dist/api/station-brokers.d.ts +24 -15
- package/dist/api/station-brokers.d.ts.map +1 -1
- package/dist/api/station-brokers.js +24 -15
- package/dist/api/station-brokers.js.map +1 -1
- package/dist/api/tiny-size.d.ts +2 -1
- package/dist/api/tiny-size.d.ts.map +1 -1
- package/dist/api/tiny-size.js +2 -1
- package/dist/api/tiny-size.js.map +1 -1
- package/dist/api/tone.d.ts +1 -1
- package/dist/api/transport.d.ts +9 -0
- package/dist/api/transport.d.ts.map +1 -1
- package/dist/api/types.d.ts +356 -68
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/uplink-banner.d.ts +113 -0
- package/dist/api/uplink-banner.d.ts.map +1 -0
- package/dist/api/uplink-banner.js +69 -0
- package/dist/api/uplink-banner.js.map +1 -0
- package/dist/api/uplink-handles.d.ts +2 -12
- package/dist/api/uplink-handles.d.ts.map +1 -1
- package/dist/api/uplink-handles.js +2 -1
- package/dist/api/uplink-handles.js.map +1 -1
- package/dist/binary-frame.d.ts +4 -4
- package/dist/binary-frame.js +2 -2
- package/dist/combine-readings.d.ts +4 -3
- package/dist/combine-readings.d.ts.map +1 -1
- package/dist/combine-readings.js +4 -3
- package/dist/combine-readings.js.map +1 -1
- package/dist/command-delay.d.ts +81 -2
- package/dist/command-delay.d.ts.map +1 -1
- package/dist/command-delay.js +51 -8
- package/dist/command-delay.js.map +1 -1
- package/dist/command-value.d.ts +98 -0
- package/dist/command-value.d.ts.map +1 -0
- package/dist/command-value.js +87 -0
- package/dist/command-value.js.map +1 -0
- package/dist/commands.d.ts +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/compat-versions.d.ts +1 -1
- package/dist/compat-versions.d.ts.map +1 -1
- package/dist/compat-versions.js +3 -3
- package/dist/compat-versions.js.map +1 -1
- package/dist/contract-enum-names.d.ts +2 -2
- package/dist/contract-enum-names.js +2 -2
- package/dist/contract-tags.d.ts +33 -2
- package/dist/contract-tags.d.ts.map +1 -1
- package/dist/contract-tags.js +54 -5
- package/dist/contract-tags.js.map +1 -1
- package/dist/data-rate.d.ts +84 -0
- package/dist/data-rate.d.ts.map +1 -0
- package/dist/data-rate.js +133 -0
- package/dist/data-rate.js.map +1 -0
- package/dist/delay-roles.d.ts +14 -1
- package/dist/delay-roles.d.ts.map +1 -1
- package/dist/delay-roles.js +5 -1
- package/dist/delay-roles.js.map +1 -1
- package/dist/dock-markers.d.ts +126 -0
- package/dist/dock-markers.d.ts.map +1 -0
- package/dist/dock-markers.js +100 -0
- package/dist/dock-markers.js.map +1 -0
- package/dist/envelope.d.ts +2 -2
- package/dist/envelope.d.ts.map +1 -1
- package/dist/flight/types.d.ts +31 -2
- package/dist/flight/types.d.ts.map +1 -1
- package/dist/flight/types.js.map +1 -1
- package/dist/frames/index.d.ts +1 -4
- package/dist/frames/index.d.ts.map +1 -1
- package/dist/frames/index.js +0 -3
- package/dist/frames/index.js.map +1 -1
- package/dist/go-no-go-countdown.d.ts +65 -0
- package/dist/go-no-go-countdown.d.ts.map +1 -0
- package/dist/go-no-go-countdown.js +71 -0
- package/dist/go-no-go-countdown.js.map +1 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/ksp-enum-names.d.ts +35 -4
- package/dist/ksp-enum-names.d.ts.map +1 -1
- package/dist/ksp-enum-names.js +31 -4
- package/dist/ksp-enum-names.js.map +1 -1
- package/dist/locked.d.ts +1 -1
- package/dist/locked.js +1 -1
- package/dist/media/delayed-playout-buffer.d.ts +29 -4
- package/dist/media/delayed-playout-buffer.d.ts.map +1 -1
- package/dist/media/delayed-playout-buffer.js +12 -5
- package/dist/media/delayed-playout-buffer.js.map +1 -1
- package/dist/media/encoded-frame-delay.d.ts +21 -16
- package/dist/media/encoded-frame-delay.d.ts.map +1 -1
- package/dist/media/encoded-frame-delay.js +21 -14
- package/dist/media/encoded-frame-delay.js.map +1 -1
- package/dist/media/frame-delay.d.ts +119 -5
- package/dist/media/frame-delay.d.ts.map +1 -1
- package/dist/media/frame-delay.js +201 -15
- package/dist/media/frame-delay.js.map +1 -1
- package/dist/media/frame-stamp-timeline.d.ts +119 -0
- package/dist/media/frame-stamp-timeline.d.ts.map +1 -0
- package/dist/media/frame-stamp-timeline.js +194 -0
- package/dist/media/frame-stamp-timeline.js.map +1 -0
- package/dist/media/index.d.ts +4 -3
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/index.js.map +1 -1
- package/dist/media/radio-support.d.ts +8 -7
- package/dist/media/radio-support.d.ts.map +1 -1
- package/dist/media/radio-support.js +5 -6
- package/dist/media/radio-support.js.map +1 -1
- package/dist/media/worker/delay-worker-client.d.ts +27 -1
- package/dist/media/worker/delay-worker-client.d.ts.map +1 -1
- package/dist/media/worker/delay-worker-client.js +53 -5
- package/dist/media/worker/delay-worker-client.js.map +1 -1
- package/dist/media/worker/delay-worker.d.ts +45 -8
- package/dist/media/worker/delay-worker.d.ts.map +1 -1
- package/dist/media/worker/delay-worker.js +644 -56
- package/dist/media/worker/delay-worker.js.map +4 -4
- package/dist/media/worker/frame-delay-report.d.ts +25 -0
- package/dist/media/worker/frame-delay-report.d.ts.map +1 -0
- package/dist/media/worker/frame-delay-report.js +112 -0
- package/dist/media/worker/frame-delay-report.js.map +1 -0
- package/dist/media/worker/lead-limit-report.d.ts +13 -0
- package/dist/media/worker/lead-limit-report.d.ts.map +1 -0
- package/dist/media/worker/lead-limit-report.js +19 -0
- package/dist/media/worker/lead-limit-report.js.map +1 -0
- package/dist/media/worker/presentation-pacer.d.ts +70 -1
- package/dist/media/worker/presentation-pacer.d.ts.map +1 -1
- package/dist/media/worker/presentation-pacer.js +167 -9
- package/dist/media/worker/presentation-pacer.js.map +1 -1
- package/dist/media/worker/worker-delay-clock.d.ts +4 -5
- package/dist/media/worker/worker-delay-clock.d.ts.map +1 -1
- package/dist/media/worker/worker-delay-clock.js +6 -2
- package/dist/media/worker/worker-delay-clock.js.map +1 -1
- package/dist/perf/PerfBudget.d.ts +2 -2
- package/dist/perf/PerfBudget.js +2 -2
- package/dist/rail-tags.d.ts +7 -0
- package/dist/rail-tags.d.ts.map +1 -1
- package/dist/rail-tags.js.map +1 -1
- package/dist/raw-field-split.d.ts +1 -1
- package/dist/raw-field-split.js +1 -1
- package/dist/reading.d.ts +6 -6
- package/dist/reading.js +5 -5
- package/dist/reads-index.json +446 -37
- package/dist/resource-transfer.d.ts +177 -0
- package/dist/resource-transfer.d.ts.map +1 -0
- package/dist/resource-transfer.js +190 -0
- package/dist/resource-transfer.js.map +1 -0
- package/dist/runtime-topic-registry.d.ts +2 -2
- package/dist/runtime-topic-registry.d.ts.map +1 -1
- package/dist/runtime-topic-registry.js +23 -2
- package/dist/runtime-topic-registry.js.map +1 -1
- package/dist/sample-step-tracker.d.ts +17 -0
- package/dist/sample-step-tracker.d.ts.map +1 -0
- package/dist/sample-step-tracker.js +38 -0
- package/dist/sample-step-tracker.js.map +1 -0
- package/dist/sha256-fallback.d.ts +6 -0
- package/dist/sha256-fallback.d.ts.map +1 -0
- package/dist/sha256-fallback.js +68 -0
- package/dist/sha256-fallback.js.map +1 -0
- package/dist/spine/arrival-deadline.d.ts +7 -0
- package/dist/spine/arrival-deadline.d.ts.map +1 -1
- package/dist/spine/arrival-deadline.js +12 -0
- package/dist/spine/arrival-deadline.js.map +1 -1
- package/dist/spine/bound-command.d.ts +58 -0
- package/dist/spine/bound-command.d.ts.map +1 -0
- package/dist/spine/bound-command.js +162 -0
- package/dist/spine/bound-command.js.map +1 -0
- package/dist/spine/capability-lock.d.ts +6 -1
- package/dist/spine/capability-lock.d.ts.map +1 -1
- package/dist/spine/capability-lock.js +56 -5
- package/dist/spine/capability-lock.js.map +1 -1
- package/dist/spine/catalog-fallback.d.ts +28 -0
- package/dist/spine/catalog-fallback.d.ts.map +1 -0
- package/dist/spine/catalog-fallback.js +120 -0
- package/dist/spine/catalog-fallback.js.map +1 -0
- package/dist/spine/celestial-facts.d.ts.map +1 -1
- package/dist/spine/celestial-facts.js +5 -2
- package/dist/spine/celestial-facts.js.map +1 -1
- package/dist/spine/centre-commands.d.ts +84 -0
- package/dist/spine/centre-commands.d.ts.map +1 -0
- package/dist/spine/centre-commands.js +236 -0
- package/dist/spine/centre-commands.js.map +1 -0
- package/dist/spine/client-reading.js +1 -1
- package/dist/spine/client-timeline.d.ts +48 -1
- package/dist/spine/client-timeline.d.ts.map +1 -1
- package/dist/spine/client-timeline.js +151 -3
- package/dist/spine/client-timeline.js.map +1 -1
- package/dist/spine/client.d.ts +154 -4
- package/dist/spine/client.d.ts.map +1 -1
- package/dist/spine/client.js +530 -34
- package/dist/spine/client.js.map +1 -1
- package/dist/spine/command-gate.d.ts +8 -0
- package/dist/spine/command-gate.d.ts.map +1 -1
- package/dist/spine/command-gate.js +36 -3
- package/dist/spine/command-gate.js.map +1 -1
- package/dist/spine/command-outcomes.d.ts +60 -0
- package/dist/spine/command-outcomes.d.ts.map +1 -0
- package/dist/spine/command-outcomes.js +256 -0
- package/dist/spine/command-outcomes.js.map +1 -0
- package/dist/spine/connectivity-history.d.ts +5 -3
- package/dist/spine/connectivity-history.d.ts.map +1 -1
- package/dist/spine/connectivity-history.js.map +1 -1
- package/dist/spine/context.d.ts +62 -11
- package/dist/spine/context.d.ts.map +1 -1
- package/dist/spine/context.js +125 -39
- package/dist/spine/context.js.map +1 -1
- package/dist/spine/core-reckoners.d.ts.map +1 -1
- package/dist/spine/core-reckoners.js +16 -39
- package/dist/spine/core-reckoners.js.map +1 -1
- package/dist/spine/delay-authority-context.d.ts +5 -0
- package/dist/spine/delay-authority-context.d.ts.map +1 -0
- package/dist/spine/delay-authority-context.js +7 -0
- package/dist/spine/delay-authority-context.js.map +1 -0
- package/dist/spine/delay-authority.d.ts +76 -1
- package/dist/spine/delay-authority.d.ts.map +1 -1
- package/dist/spine/delay-authority.js +217 -3
- package/dist/spine/delay-authority.js.map +1 -1
- package/dist/spine/delay-estimate.d.ts +41 -0
- package/dist/spine/delay-estimate.d.ts.map +1 -0
- package/dist/spine/delay-estimate.js +70 -0
- package/dist/spine/delay-estimate.js.map +1 -0
- package/dist/spine/delta-v-budget.js +2 -2
- package/dist/spine/delta-v-budget.js.map +1 -1
- package/dist/spine/dv-stage-resources.d.ts +32 -17
- package/dist/spine/dv-stage-resources.d.ts.map +1 -1
- package/dist/spine/dv-stage-resources.js +44 -37
- package/dist/spine/dv-stage-resources.js.map +1 -1
- package/dist/spine/index.d.ts +7 -1
- package/dist/spine/index.d.ts.map +1 -1
- package/dist/spine/index.js +11 -5
- package/dist/spine/index.js.map +1 -1
- package/dist/spine/kepler-reckoning.d.ts +56 -0
- package/dist/spine/kepler-reckoning.d.ts.map +1 -1
- package/dist/spine/kepler-reckoning.js +179 -3
- package/dist/spine/kepler-reckoning.js.map +1 -1
- package/dist/spine/kepler.d.ts +1 -1
- package/dist/spine/kepler.js +1 -1
- package/dist/spine/known-holds.d.ts +8 -0
- package/dist/spine/known-holds.d.ts.map +1 -0
- package/dist/spine/known-holds.js +78 -0
- package/dist/spine/known-holds.js.map +1 -0
- package/dist/spine/lagrange.d.ts +9 -34
- package/dist/spine/lagrange.d.ts.map +1 -1
- package/dist/spine/lagrange.js +4 -24
- package/dist/spine/lagrange.js.map +1 -1
- package/dist/spine/lifecycle.d.ts +21 -0
- package/dist/spine/lifecycle.d.ts.map +1 -1
- package/dist/spine/lifecycle.js.map +1 -1
- package/dist/spine/lock-scope.d.ts +2 -2
- package/dist/spine/map-topic.d.ts +3 -3
- package/dist/spine/map-topic.js +3 -3
- package/dist/spine/never-reckonable.js +1 -1
- package/dist/spine/never-reckonable.js.map +1 -1
- package/dist/spine/orbit-patches.d.ts +6 -4
- package/dist/spine/orbit-patches.d.ts.map +1 -1
- package/dist/spine/orbit-patches.js +45 -10
- package/dist/spine/orbit-patches.js.map +1 -1
- package/dist/spine/orbital-solve.d.ts +1 -1
- package/dist/spine/orbital-solve.d.ts.map +1 -1
- package/dist/spine/orbital-solve.js +35 -0
- package/dist/spine/orbital-solve.js.map +1 -1
- package/dist/spine/powered-reckoning.d.ts +5 -0
- package/dist/spine/powered-reckoning.d.ts.map +1 -1
- package/dist/spine/powered-reckoning.js.map +1 -1
- package/dist/spine/processorEvaluator.d.ts +29 -0
- package/dist/spine/processorEvaluator.d.ts.map +1 -1
- package/dist/spine/processorEvaluator.js +94 -71
- package/dist/spine/processorEvaluator.js.map +1 -1
- package/dist/spine/processors.d.ts +56 -4
- package/dist/spine/processors.d.ts.map +1 -1
- package/dist/spine/processors.js +110 -0
- package/dist/spine/processors.js.map +1 -1
- package/dist/spine/rail-registry.d.ts +1 -1
- package/dist/spine/rail-registry.d.ts.map +1 -1
- package/dist/spine/reckoner-generation.d.ts +5 -0
- package/dist/spine/reckoner-generation.d.ts.map +1 -0
- package/dist/spine/reckoner-generation.js +10 -0
- package/dist/spine/reckoner-generation.js.map +1 -0
- package/dist/spine/reckoners.d.ts.map +1 -1
- package/dist/spine/reckoners.js +3 -0
- package/dist/spine/reckoners.js.map +1 -1
- package/dist/spine/replay-session-controller.d.ts +1 -1
- package/dist/spine/replay-session-controller.d.ts.map +1 -1
- package/dist/spine/replay-session-controller.js +4 -6
- package/dist/spine/replay-session-controller.js.map +1 -1
- package/dist/spine/resolve-tracked.d.ts +20 -2
- package/dist/spine/resolve-tracked.d.ts.map +1 -1
- package/dist/spine/resolve-tracked.js +32 -2
- package/dist/spine/resolve-tracked.js.map +1 -1
- package/dist/spine/send-status.d.ts +2 -0
- package/dist/spine/send-status.d.ts.map +1 -1
- package/dist/spine/send-status.js.map +1 -1
- package/dist/spine/settings-registry.d.ts +7 -0
- package/dist/spine/settings-registry.d.ts.map +1 -1
- package/dist/spine/settings-registry.js.map +1 -1
- package/dist/spine/slot-ids.d.ts +1 -1
- package/dist/spine/slot-ids.d.ts.map +1 -1
- package/dist/spine/slot-ids.js +6 -3
- package/dist/spine/slot-ids.js.map +1 -1
- package/dist/spine/space-center-state.d.ts +17 -9
- package/dist/spine/space-center-state.d.ts.map +1 -1
- package/dist/spine/space-center-state.js +14 -15
- package/dist/spine/space-center-state.js.map +1 -1
- package/dist/spine/stage-countdown-store.d.ts +38 -0
- package/dist/spine/stage-countdown-store.d.ts.map +1 -0
- package/dist/spine/stage-countdown-store.js +53 -0
- package/dist/spine/stage-countdown-store.js.map +1 -0
- package/dist/spine/stream-status.d.ts +3 -3
- package/dist/spine/stream-status.js +3 -3
- package/dist/spine/subscribe-read.d.ts +1 -1
- package/dist/spine/subscribe-read.js +2 -2
- package/dist/spine/system-state.d.ts +13 -13
- package/dist/spine/system-state.d.ts.map +1 -1
- package/dist/spine/system-state.js +18 -18
- package/dist/spine/system-state.js.map +1 -1
- package/dist/spine/timeline-store.d.ts +304 -113
- package/dist/spine/timeline-store.d.ts.map +1 -1
- package/dist/spine/timeline-store.js +921 -223
- package/dist/spine/timeline-store.js.map +1 -1
- package/dist/spine/uplink-clients.d.ts +32 -16
- package/dist/spine/uplink-clients.d.ts.map +1 -1
- package/dist/spine/uplink-clients.js +8 -4
- package/dist/spine/uplink-clients.js.map +1 -1
- package/dist/spine/uplink-delays.d.ts +31 -0
- package/dist/spine/uplink-delays.d.ts.map +1 -0
- package/dist/spine/uplink-delays.js +46 -0
- package/dist/spine/uplink-delays.js.map +1 -0
- package/dist/spine/uplink-health.d.ts +109 -14
- package/dist/spine/uplink-health.d.ts.map +1 -1
- package/dist/spine/uplink-health.js +21 -17
- package/dist/spine/uplink-health.js.map +1 -1
- package/dist/spine/use-action-input.d.ts.map +1 -1
- package/dist/spine/use-action-input.js +14 -9
- package/dist/spine/use-action-input.js.map +1 -1
- package/dist/spine/use-body-states.d.ts.map +1 -1
- package/dist/spine/use-body-states.js +3 -3
- package/dist/spine/use-body-states.js.map +1 -1
- package/dist/spine/use-command.d.ts +94 -31
- package/dist/spine/use-command.d.ts.map +1 -1
- package/dist/spine/use-command.js +409 -197
- package/dist/spine/use-command.js.map +1 -1
- package/dist/spine/use-last-known-path.d.ts +36 -0
- package/dist/spine/use-last-known-path.d.ts.map +1 -0
- package/dist/spine/use-last-known-path.js +46 -0
- package/dist/spine/use-last-known-path.js.map +1 -0
- package/dist/spine/use-observed-vantage.d.ts +13 -0
- package/dist/spine/use-observed-vantage.d.ts.map +1 -0
- package/dist/spine/use-observed-vantage.js +20 -0
- package/dist/spine/use-observed-vantage.js.map +1 -0
- package/dist/spine/use-orbit-trajectory.d.ts +1 -1
- package/dist/spine/use-orbit-trajectory.d.ts.map +1 -1
- package/dist/spine/use-orbit-trajectory.js +17 -3
- package/dist/spine/use-orbit-trajectory.js.map +1 -1
- package/dist/spine/use-stream-connected.d.ts +8 -0
- package/dist/spine/use-stream-connected.d.ts.map +1 -0
- package/dist/spine/use-stream-connected.js +16 -0
- package/dist/spine/use-stream-connected.js.map +1 -0
- package/dist/spine/use-stream-event.d.ts +6 -1
- package/dist/spine/use-stream-event.d.ts.map +1 -1
- package/dist/spine/use-stream-event.js +5 -1
- package/dist/spine/use-stream-event.js.map +1 -1
- package/dist/spine/use-stream.d.ts +5 -2
- package/dist/spine/use-stream.d.ts.map +1 -1
- package/dist/spine/use-stream.js +7 -4
- package/dist/spine/use-stream.js.map +1 -1
- package/dist/spine/use-telemetry.d.ts +5 -1
- package/dist/spine/use-telemetry.d.ts.map +1 -1
- package/dist/spine/use-telemetry.js.map +1 -1
- package/dist/spine/use-topic-clock.d.ts +54 -0
- package/dist/spine/use-topic-clock.d.ts.map +1 -0
- package/dist/spine/use-topic-clock.js +137 -0
- package/dist/spine/use-topic-clock.js.map +1 -0
- package/dist/spine/use-transmissions.d.ts.map +1 -1
- package/dist/spine/use-transmissions.js +9 -4
- package/dist/spine/use-transmissions.js.map +1 -1
- package/dist/spine/vantage.d.ts +6 -0
- package/dist/spine/vantage.d.ts.map +1 -1
- package/dist/spine/vantage.js +6 -0
- package/dist/spine/vantage.js.map +1 -1
- package/dist/spine/view-clock.d.ts +23 -3
- package/dist/spine/view-clock.d.ts.map +1 -1
- package/dist/spine/view-clock.js +80 -2
- package/dist/spine/view-clock.js.map +1 -1
- package/dist/testing/fake-command.d.ts +48 -0
- package/dist/testing/fake-command.d.ts.map +1 -0
- package/dist/testing/fake-command.js +63 -0
- package/dist/testing/fake-command.js.map +1 -0
- package/dist/testing/index.d.ts +5 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/install-act-gate-stretch.d.ts +1 -2
- package/dist/testing/install-act-gate-stretch.d.ts.map +1 -1
- package/dist/testing/install-act-gate-stretch.js +1 -2
- package/dist/testing/install-act-gate-stretch.js.map +1 -1
- package/dist/testing/install-dom-stubs.d.ts +2 -5
- package/dist/testing/install-dom-stubs.d.ts.map +1 -1
- package/dist/testing/install-dom-stubs.js +2 -34
- package/dist/testing/install-dom-stubs.js.map +1 -1
- package/dist/testing/install-real-test-host.d.ts.map +1 -1
- package/dist/testing/install-real-test-host.js +7 -6
- package/dist/testing/install-real-test-host.js.map +1 -1
- package/dist/testing/recorded-uplink-banners.d.ts +49 -0
- package/dist/testing/recorded-uplink-banners.d.ts.map +1 -0
- package/dist/testing/recorded-uplink-banners.js +45 -0
- package/dist/testing/recorded-uplink-banners.js.map +1 -0
- package/dist/testing/render.d.ts +16 -3
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/testing/render.js +16 -3
- package/dist/testing/render.js.map +1 -1
- package/dist/testing/stream-fixture.js +3 -3
- package/dist/testing/stream-fixture.js.map +1 -1
- package/dist/testing/stub-transport.d.ts +6 -0
- package/dist/testing/stub-transport.d.ts.map +1 -1
- package/dist/testing/stub-transport.js +3 -0
- package/dist/testing/stub-transport.js.map +1 -1
- package/dist/timeline.d.ts +2 -98
- package/dist/timeline.d.ts.map +1 -1
- package/dist/topics.d.ts +68 -28
- package/dist/topics.d.ts.map +1 -1
- package/dist/topics.js +21 -18
- package/dist/topics.js.map +1 -1
- package/dist/unit-system/index.d.ts +1 -1
- package/dist/unit-system/index.d.ts.map +1 -1
- package/dist/unit-system/index.js +1 -1
- package/dist/unit-system/index.js.map +1 -1
- package/dist/unit-system/value.d.ts +26 -5
- package/dist/unit-system/value.d.ts.map +1 -1
- package/dist/unit-system/value.js +41 -21
- package/dist/unit-system/value.js.map +1 -1
- package/dist/units.d.ts.map +1 -1
- package/dist/units.js +2 -1
- package/dist/units.js.map +1 -1
- package/dist/uplink-externals.d.ts +17 -7
- package/dist/uplink-externals.d.ts.map +1 -1
- package/dist/uplink-externals.js +17 -7
- package/dist/uplink-externals.js.map +1 -1
- package/dist/uplink-load.d.ts +3 -2
- package/dist/uplink-load.d.ts.map +1 -1
- package/dist/uplink-load.js +9 -6
- package/dist/uplink-load.js.map +1 -1
- package/dist/uplink-manifest.d.ts +8 -3
- package/dist/uplink-manifest.d.ts.map +1 -1
- package/dist/uplink-manifest.js +5 -1
- package/dist/uplink-manifest.js.map +1 -1
- package/dist/wrap-units.d.ts.map +1 -1
- package/dist/wrap-units.js +3 -2
- package/dist/wrap-units.js.map +1 -1
- package/package.json +1 -1
- package/src/__generated__/command-map.ts +215 -19
- package/src/__generated__/contract.ts +3102 -330
- package/src/__generated__/delay-roles.ts +12 -0
- package/src/__generated__/error-codes.ts +13 -13
- package/src/__generated__/frames.ts +20 -4
- package/src/__generated__/reckonability.ts +3 -1
- package/src/__generated__/sample-kinds.ts +18 -2
- package/src/__generated__/topic-map.ts +68 -19
- package/src/__generated__/units.json +958 -94
- package/src/__generated__/units.ts +949 -76
- package/src/api/command-rejection.ts +2 -2
- package/src/api/contribution-slots.ts +128 -25
- package/src/api/error-codes.ts +3 -2
- package/src/api/framework-reads.ts +6 -1
- package/src/api/host.ts +14 -6
- package/src/api/index.ts +127 -67
- package/src/api/logger-contract.ts +2 -1
- package/src/api/logger.ts +6 -3
- package/src/api/part-panels.ts +221 -0
- package/src/api/plot-layers.ts +1 -1
- package/src/api/registry.ts +4 -2
- package/src/api/settings/store.ts +7 -2
- package/src/api/slots.ts +153 -70
- package/src/api/station-brokers.ts +24 -15
- package/src/api/tiny-size.ts +2 -1
- package/src/api/tone.ts +1 -1
- package/src/api/transport.ts +13 -0
- package/src/api/types.ts +388 -68
- package/src/api/uplink-banner.ts +128 -0
- package/src/api/uplink-handles.ts +4 -1
- package/src/binary-frame.ts +4 -4
- package/src/combine-readings.ts +4 -3
- package/src/command-delay.ts +144 -11
- package/src/command-value.ts +181 -0
- package/src/compat-versions.ts +3 -3
- package/src/contract-enum-names.ts +2 -2
- package/src/contract-tags.ts +67 -5
- package/src/data-rate.ts +178 -0
- package/src/delay-roles.ts +19 -2
- package/src/dock-markers.ts +182 -0
- package/src/envelope.ts +4 -0
- package/src/flight/types.ts +31 -2
- package/src/frames/index.ts +0 -4
- package/src/go-no-go-countdown.ts +116 -0
- package/src/index.ts +64 -4
- package/src/ksp-enum-names.ts +48 -3
- package/src/locked.ts +1 -1
- package/src/media/__fixtures__/hull-after-revert.json +1506 -0
- package/src/media/delayed-playout-buffer.ts +41 -9
- package/src/media/encoded-frame-delay.ts +29 -17
- package/src/media/frame-delay.ts +328 -22
- package/src/media/frame-stamp-timeline.ts +270 -0
- package/src/media/index.ts +5 -0
- package/src/media/radio-support.ts +8 -7
- package/src/media/worker/delay-worker-client.ts +104 -6
- package/src/media/worker/delay-worker.ts +228 -27
- package/src/media/worker/frame-delay-report.ts +141 -0
- package/src/media/worker/lead-limit-report.ts +27 -0
- package/src/media/worker/presentation-pacer.ts +216 -9
- package/src/media/worker/worker-delay-clock.ts +9 -6
- package/src/perf/PerfBudget.ts +2 -2
- package/src/rail-tags.ts +8 -0
- package/src/raw-field-split.ts +1 -1
- package/src/reading.ts +6 -6
- package/src/resource-transfer.ts +352 -0
- package/src/runtime-topic-registry.ts +23 -2
- package/src/sample-step-tracker.ts +38 -0
- package/src/sha256-fallback.ts +69 -0
- package/src/spine/__fixtures__/crash/crash-eva.json +224 -0
- package/src/spine/__fixtures__/crash/crash-separated-pod-pod-root.json +144 -0
- package/src/spine/__fixtures__/crash/crash-separated-pod.json +111 -0
- package/src/spine/__fixtures__/switch/back-to-craft.jsonl +101 -0
- package/src/spine/__fixtures__/switch/late-sent-frame.jsonl +16 -0
- package/src/spine/__fixtures__/switch/linked-craft.jsonl +63 -0
- package/src/spine/__fixtures__/switch/station-trim.jsonl +229 -0
- package/src/spine/__fixtures__/switch/switch-with-scene.jsonl +110 -0
- package/src/spine/__fixtures__/switch/unlinked-craft.jsonl +46 -0
- package/src/spine/arrival-deadline.ts +15 -0
- package/src/spine/bound-command.ts +243 -0
- package/src/spine/capability-lock.ts +65 -6
- package/src/spine/catalog-fallback.ts +152 -0
- package/src/spine/celestial-facts.ts +4 -2
- package/src/spine/centre-commands.ts +314 -0
- package/src/spine/client-reading.ts +1 -1
- package/src/spine/client-timeline.ts +165 -4
- package/src/spine/client.ts +615 -32
- package/src/spine/command-gate.ts +44 -3
- package/src/spine/command-outcomes.ts +303 -0
- package/src/spine/connectivity-history.ts +5 -3
- package/src/spine/context.tsx +154 -50
- package/src/spine/core-reckoners.ts +31 -50
- package/src/spine/delay-authority-context.ts +9 -0
- package/src/spine/delay-authority.ts +227 -3
- package/src/spine/delay-estimate.ts +88 -0
- package/src/spine/delta-v-budget.ts +2 -2
- package/src/spine/dv-stage-resources.ts +55 -43
- package/src/spine/index.ts +11 -5
- package/src/spine/kepler-reckoning.ts +245 -3
- package/src/spine/kepler.ts +1 -1
- package/src/spine/known-holds.ts +96 -0
- package/src/spine/lagrange.ts +10 -46
- package/src/spine/lifecycle.ts +22 -0
- package/src/spine/lock-scope.ts +2 -2
- package/src/spine/map-topic.ts +3 -3
- package/src/spine/never-reckonable.ts +1 -1
- package/src/spine/orbit-patches.ts +54 -10
- package/src/spine/orbital-solve.ts +53 -1
- package/src/spine/powered-reckoning.ts +5 -1
- package/src/spine/processorEvaluator.ts +106 -72
- package/src/spine/processors.ts +144 -4
- package/src/spine/rail-registry.ts +1 -1
- package/src/spine/reckoner-generation.ts +11 -0
- package/src/spine/reckoners.ts +3 -0
- package/src/spine/replay-session-controller.ts +4 -6
- package/src/spine/resolve-tracked.ts +50 -1
- package/src/spine/send-status.ts +2 -0
- package/src/spine/settings-registry.ts +7 -0
- package/src/spine/slot-ids.ts +6 -3
- package/src/spine/space-center-state.ts +17 -20
- package/src/spine/stage-countdown-store.ts +76 -0
- package/src/spine/stream-status.ts +4 -4
- package/src/spine/subscribe-read.ts +2 -2
- package/src/spine/system-state.ts +19 -21
- package/src/spine/timeline-store.ts +1119 -247
- package/src/spine/uplink-clients.ts +44 -22
- package/src/spine/uplink-delays.ts +57 -0
- package/src/spine/uplink-health.ts +59 -27
- package/src/spine/use-action-input.ts +13 -9
- package/src/spine/use-body-states.ts +5 -4
- package/src/spine/use-command.ts +620 -239
- package/src/spine/use-last-known-path.ts +75 -0
- package/src/spine/use-observed-vantage.ts +24 -0
- package/src/spine/use-orbit-trajectory.ts +22 -3
- package/src/spine/use-stream-connected.ts +23 -0
- package/src/spine/use-stream-event.ts +6 -2
- package/src/spine/use-stream.ts +7 -4
- package/src/spine/use-telemetry.ts +5 -1
- package/src/spine/use-topic-clock.ts +196 -0
- package/src/spine/use-transmissions.ts +37 -18
- package/src/spine/vantage.ts +7 -0
- package/src/spine/view-clock.ts +89 -3
- package/src/testing/fake-command.ts +109 -0
- package/src/testing/index.ts +12 -1
- package/src/testing/install-act-gate-stretch.ts +1 -2
- package/src/testing/install-dom-stubs.ts +2 -38
- package/src/testing/install-real-test-host.ts +10 -6
- package/src/testing/recorded-uplink-banners.ts +71 -0
- package/src/testing/render.tsx +16 -3
- package/src/testing/stream-fixture.tsx +3 -3
- package/src/testing/stub-transport.ts +9 -0
- package/src/timeline.ts +2 -103
- package/src/topics.ts +87 -26
- package/src/unit-system/index.ts +2 -0
- package/src/unit-system/value.ts +61 -21
- package/src/units.ts +2 -1
- package/src/uplink-externals.ts +17 -7
- package/src/uplink-load.ts +9 -8
- package/src/uplink-manifest.ts +8 -3
- package/src/wrap-units.ts +3 -9
- package/dist/spine/contributed-channels.d.ts +0 -56
- package/dist/spine/contributed-channels.d.ts.map +0 -1
- package/dist/spine/contributed-channels.js +0 -108
- package/dist/spine/contributed-channels.js.map +0 -1
- package/src/spine/contributed-channels.ts +0 -134
package/dist/spine/client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CommandErrorCode, FaultCode } from "../__generated__/error-codes.js";
|
|
2
2
|
import { COMMAND_LOST, COMMAND_REFUSED } from "../api/command-rejection.js";
|
|
3
3
|
import { wrapCommandReply } from "../command-reply-units.js";
|
|
4
|
+
import { fieldsSentOnChange, fillUnchangedFields, } from "../data-rate.js";
|
|
4
5
|
import { PerfBudget } from "../perf/PerfBudget.js";
|
|
5
6
|
import { dehydrateArgs } from "../wrap-units.js";
|
|
6
7
|
import { warnChannelError } from "./channel-error-warning.js";
|
|
@@ -9,7 +10,7 @@ import { traceCommandOutcome } from "./command-trace.js";
|
|
|
9
10
|
import { warnConnectionError } from "./connection-error-warning.js";
|
|
10
11
|
import { CommandError } from "./lifecycle.js";
|
|
11
12
|
import { TopicOwnershipTracker } from "./topic-ownership.js";
|
|
12
|
-
import { META_VANTAGE } from "./vantage.js";
|
|
13
|
+
import { ACTIVE_CRAFT_VANTAGE, META_VANTAGE } from "./vantage.js";
|
|
13
14
|
/*
|
|
14
15
|
* **Shared with `classifyRetained`'s `overdueMarginSeconds`, deliberately.** Two
|
|
15
16
|
* layers judge the same silence about the same command, so they judge it on ONE
|
|
@@ -39,10 +40,16 @@ import { META_VANTAGE } from "./vantage.js";
|
|
|
39
40
|
* classification and the commcast reveal logic.
|
|
40
41
|
*/
|
|
41
42
|
export const LOSS_MARGIN = 3;
|
|
43
|
+
/** How long a command sent while the delay is unknown waits for any answer before it is called lost, in seconds on the client's clock. */
|
|
44
|
+
const UNKNOWN_DELAY_LOSS_SECONDS = 120;
|
|
42
45
|
/** The longest a deadline in game UT waits on the client's clock before it reads the game's UT again, in seconds. */
|
|
43
46
|
const GAME_UT_RECHECK_SECONDS = 5;
|
|
44
47
|
/** How close to a deadline in game UT counts as reached, in seconds, so that rounding in the clock arithmetic cannot leave a timer one tick short. */
|
|
45
48
|
const GAME_UT_TOLERANCE = 1e-6;
|
|
49
|
+
/** How far behind the game's UT a frame after a load may be stamped and still belong to the same timeline, in seconds: the mod stamps a withdrawal one float step below the instant it happens at. */
|
|
50
|
+
const REWIND_TOLERANCE_SECONDS = 1e-3;
|
|
51
|
+
/** The `meta.source` of a reading delivered from a craft's own node, which keeps that craft's own delay. */
|
|
52
|
+
const CRAFT_NODE_SOURCE_PREFIX = "fleet.";
|
|
46
53
|
/**
|
|
47
54
|
* Dispatch-rate budget for every command this client sends.
|
|
48
55
|
*
|
|
@@ -191,13 +198,24 @@ function randomIdPrefix() {
|
|
|
191
198
|
globalThis.crypto.getRandomValues(bytes);
|
|
192
199
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
193
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* The `seenVesselId` a command carries when the screen has read a
|
|
203
|
+
* `vessel.identity` and the mod has since withdrawn it, because the active
|
|
204
|
+
* vessel changed and the new one has not been heard yet. No vessel has this id,
|
|
205
|
+
* so the mod refuses the order instead of sending it to a vessel the operator
|
|
206
|
+
* has not seen.
|
|
207
|
+
*/
|
|
208
|
+
const UNKNOWN_CRAFT_ID = "unknown";
|
|
194
209
|
/**
|
|
195
210
|
* The vessel the operator's screen shows as active, as the optional
|
|
196
|
-
* `seenVesselId` of a command frame
|
|
197
|
-
*
|
|
198
|
-
*
|
|
211
|
+
* `seenVesselId` of a command frame. Nothing when no `vessel.identity` reading
|
|
212
|
+
* has ever arrived; {@link UNKNOWN_CRAFT_ID} when one has arrived and been
|
|
213
|
+
* withdrawn. The mod refuses an order for the active vessel when the game has
|
|
214
|
+
* since switched to another one.
|
|
199
215
|
*/
|
|
200
|
-
function seenVessel(identity) {
|
|
216
|
+
function seenVessel(identity, read) {
|
|
217
|
+
if (identity === null && read)
|
|
218
|
+
return { seenVesselId: UNKNOWN_CRAFT_ID };
|
|
201
219
|
if (typeof identity !== "object" || identity === null)
|
|
202
220
|
return {};
|
|
203
221
|
if (!("vesselId" in identity))
|
|
@@ -205,11 +223,32 @@ function seenVessel(identity) {
|
|
|
205
223
|
const id = identity.vesselId;
|
|
206
224
|
return typeof id === "string" && id !== "" ? { seenVesselId: id } : {};
|
|
207
225
|
}
|
|
226
|
+
const isSampleFrame = (message) => message.type === "stream-data" || message.type === "stream-binary";
|
|
227
|
+
/**
|
|
228
|
+
* `applied` with the `Meta` the mod sent. A station learns its timeline from
|
|
229
|
+
* what the main screen relays and its commands must name the mod's own epoch,
|
|
230
|
+
* so the epoch a client applies for its own stores stays inside that client.
|
|
231
|
+
*/
|
|
232
|
+
function stampedAsSent(applied, incoming) {
|
|
233
|
+
if (applied === incoming)
|
|
234
|
+
return applied;
|
|
235
|
+
if (!isSampleFrame(applied) || !isSampleFrame(incoming))
|
|
236
|
+
return applied;
|
|
237
|
+
return { ...applied, meta: incoming.meta };
|
|
238
|
+
}
|
|
208
239
|
export class TelemetryClient {
|
|
209
240
|
transport;
|
|
210
241
|
clock;
|
|
211
242
|
subscribers = new Map();
|
|
243
|
+
/** How many live {@link requestRate} claims hold each topic at the fast tier. */
|
|
244
|
+
fastClaims = new Map();
|
|
245
|
+
/** The tier last sent for each subscribed topic, base ones left out: the mod drops it on unsubscribe, and so does this. */
|
|
246
|
+
sentTiers = new Map();
|
|
247
|
+
/** The subscription to `system.dataRates` held while any claim is live, so a store attached to this client learns each fast Topic's rate. */
|
|
248
|
+
releaseRateReport = null;
|
|
212
249
|
lastValues = new Map();
|
|
250
|
+
/** The last payload this connection delivered of each Topic with fields sent only on change, which a later frame's unchanged fields are taken from. */
|
|
251
|
+
lastDeliveredWithHeldFields = new Map();
|
|
213
252
|
/** The `Meta` of the frame that carried each topic's `lastValues` entry, so a value replayed on subscribe says which sample it is. */
|
|
214
253
|
lastMetas = new Map();
|
|
215
254
|
/**
|
|
@@ -231,6 +270,10 @@ export class TelemetryClient {
|
|
|
231
270
|
*/
|
|
232
271
|
newestRaw = new Map();
|
|
233
272
|
storeListeners = new Set();
|
|
273
|
+
/** Clients whose commands this one reads as its own screen's, as {@link carryCommandsFrom} lends them. */
|
|
274
|
+
carriers = new Set();
|
|
275
|
+
carriedRevision = 0;
|
|
276
|
+
carriedForOther = new Set();
|
|
234
277
|
/** Reactive-read listeners for the selected vantage: see `onSelectedVantageChange`. */
|
|
235
278
|
vantageListeners = new Set();
|
|
236
279
|
/** Reactive-read listeners for the observed vantage: see `onObservedVantageChange`. */
|
|
@@ -251,6 +294,10 @@ export class TelemetryClient {
|
|
|
251
294
|
idPrefix;
|
|
252
295
|
selectedVantageId;
|
|
253
296
|
observedVantageId;
|
|
297
|
+
/** The epoch and `deliveredAt` of the frame that last moved the observed vantage. */
|
|
298
|
+
observedStampedAt;
|
|
299
|
+
/** Whether the mod was asked to keep this connection at the active craft: see {@link followActiveCraft}. */
|
|
300
|
+
followingActiveCraft = false;
|
|
254
301
|
/** Raw-frame tap listeners: see `onRawMessage`. */
|
|
255
302
|
rawMessageListeners = new Set();
|
|
256
303
|
/**
|
|
@@ -269,6 +316,22 @@ export class TelemetryClient {
|
|
|
269
316
|
* forward on the client's clock until a frame says it runs again.
|
|
270
317
|
*/
|
|
271
318
|
gamePaused = false;
|
|
319
|
+
/**
|
|
320
|
+
* Whether the newest `game-state` said a scene is loading. UT does not
|
|
321
|
+
* advance through a load, so it holds the game's UT still the same way a
|
|
322
|
+
* pause does.
|
|
323
|
+
*/
|
|
324
|
+
gameLoading = false;
|
|
325
|
+
/** Whether a load has begun since the last live sample that was not behind the game's UT. */
|
|
326
|
+
loadSinceLastSample = false;
|
|
327
|
+
/** The newest UT a live sample was delivered at, the timeline it was on, and the `seq` of the frame that carried it. */
|
|
328
|
+
newestDelivered;
|
|
329
|
+
/** How far the client's timeline epoch runs ahead of the wire's, for rewinds the mod did not announce with a new epoch. */
|
|
330
|
+
epochShift = 0;
|
|
331
|
+
lastWireEpoch = 0;
|
|
332
|
+
/** The mod's run this client last heard from, empty until it has. */
|
|
333
|
+
wireBootId = "";
|
|
334
|
+
timelineListeners = new Set();
|
|
272
335
|
/** The keyframe interval each topic's `subscribed` ack declared, kept so a store attached later is told too. */
|
|
273
336
|
declaredKeyframeIntervals = new Map();
|
|
274
337
|
/**
|
|
@@ -335,10 +398,16 @@ export class TelemetryClient {
|
|
|
335
398
|
/* A transport still connecting reports no change until it opens, so the tracker is told here that nothing can ack yet. */
|
|
336
399
|
if (transport.status !== "connected")
|
|
337
400
|
this.ownership?.handleDisconnected();
|
|
338
|
-
this.unsubscribeFromTransport = transport.onMessage((
|
|
401
|
+
this.unsubscribeFromTransport = transport.onMessage((incoming, delivery) => {
|
|
402
|
+
const replayed = delivery?.replayed === true;
|
|
403
|
+
this.followTimeline(incoming);
|
|
404
|
+
const message = replayed ? incoming : this.followRewind(incoming);
|
|
405
|
+
if (message.type === "stream-data")
|
|
406
|
+
this.restoreUnchanged(message);
|
|
407
|
+
const asSent = stampedAsSent(message, incoming);
|
|
339
408
|
for (const listener of this.rawMessageListeners)
|
|
340
|
-
listener(
|
|
341
|
-
this.handleMessage(message,
|
|
409
|
+
listener(asSent);
|
|
410
|
+
this.handleMessage(message, replayed);
|
|
342
411
|
});
|
|
343
412
|
this.unsubscribeFromUndelivered =
|
|
344
413
|
transport.onUndelivered?.((command) => this.handleUndelivered(command.requestId, command.reason)) ?? (() => undefined);
|
|
@@ -457,7 +526,7 @@ export class TelemetryClient {
|
|
|
457
526
|
outstandingList() {
|
|
458
527
|
const list = [];
|
|
459
528
|
for (const [requestId, pending] of this.commands) {
|
|
460
|
-
if (pending.unclaimable)
|
|
529
|
+
if (pending.unclaimable || this.carriedForOther.has(requestId))
|
|
461
530
|
continue;
|
|
462
531
|
const phase = pending.status.phase;
|
|
463
532
|
if (phase !== "in-flight" && phase !== "lost")
|
|
@@ -569,6 +638,9 @@ export class TelemetryClient {
|
|
|
569
638
|
* Purely additive: does not affect `subscribe`/`getValue`/store-ingest
|
|
570
639
|
* delivery, and costs nothing when no listener is registered (the common
|
|
571
640
|
* case: mission history off, or no recorder attached).
|
|
641
|
+
*
|
|
642
|
+
* A frame keeps the timeline epoch the mod stamped on it, whatever rewind this
|
|
643
|
+
* client has inferred for its own stores.
|
|
572
644
|
*/
|
|
573
645
|
onRawMessage(listener) {
|
|
574
646
|
this.rawMessageListeners.add(listener);
|
|
@@ -581,10 +653,14 @@ export class TelemetryClient {
|
|
|
581
653
|
* `undefined` is "wherever the server puts a connection that has not chosen",
|
|
582
654
|
* which is the home command, and not a centre id this client could spell: the
|
|
583
655
|
* server alone knows which centre is home. Where that turned out to be is
|
|
584
|
-
* {@link observedVantage}.
|
|
656
|
+
* {@link observedVantage}. After {@link followActiveCraft} it is that observed
|
|
657
|
+
* centre, since the mod chooses it.
|
|
585
658
|
*/
|
|
586
659
|
get selectedVantage() {
|
|
587
|
-
|
|
660
|
+
// While following, the mod picks the centre, so the one in force is the one the frames name.
|
|
661
|
+
return this.followingActiveCraft
|
|
662
|
+
? this.observedVantageId
|
|
663
|
+
: this.selectedVantageId;
|
|
588
664
|
}
|
|
589
665
|
/**
|
|
590
666
|
* Whether {@link setVantage} can do anything on this connection. False on a
|
|
@@ -650,17 +726,101 @@ export class TelemetryClient {
|
|
|
650
726
|
// a request nothing will act on.
|
|
651
727
|
if (!this.canSetVantage)
|
|
652
728
|
return;
|
|
729
|
+
this.followingActiveCraft = false;
|
|
653
730
|
this.selectedVantageId = centreId;
|
|
654
731
|
for (const listener of this.vantageListeners)
|
|
655
732
|
listener();
|
|
733
|
+
this.sendVantage(centreId);
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Ask the mod to keep this connection at the active craft, and to move it
|
|
737
|
+
* whenever the game changes craft (a switch, an EVA, a docking or an undock),
|
|
738
|
+
* with no further message from this client. While there is no active craft
|
|
739
|
+
* the connection stays at the vantage a fresh connection starts at. Useful for
|
|
740
|
+
* a screen that flies whichever craft is active, which sends this once instead
|
|
741
|
+
* of naming a craft. Used by the pilot screen.
|
|
742
|
+
*
|
|
743
|
+
* Does nothing when the connection is already following, and on a transport
|
|
744
|
+
* that cannot carry a vantage. {@link selectedVantage} then reports the centre
|
|
745
|
+
* the frames name.
|
|
746
|
+
*/
|
|
747
|
+
followActiveCraft() {
|
|
748
|
+
if (!this.canSetVantage || this.followingActiveCraft)
|
|
749
|
+
return;
|
|
750
|
+
this.followingActiveCraft = true;
|
|
751
|
+
for (const listener of this.vantageListeners)
|
|
752
|
+
listener();
|
|
753
|
+
this.sendVantage(ACTIVE_CRAFT_VANTAGE);
|
|
754
|
+
}
|
|
755
|
+
sendVantage(centreId) {
|
|
656
756
|
this.transport.send({ type: "set-vantage", centreId });
|
|
657
757
|
// Re-point existing subscriptions at the new vantage: the server reads the selected vantage at subscribe time, so an active topic must re-subscribe.
|
|
658
758
|
for (const topic of this.subscribers.keys()) {
|
|
659
759
|
this.transport.send({ type: "unsubscribe", topic });
|
|
760
|
+
this.sentTiers.delete(topic);
|
|
660
761
|
this.transport.send({ type: "subscribe", topic });
|
|
661
762
|
this.ownership?.noteSubscribeSent(topic);
|
|
763
|
+
this.syncRate(topic);
|
|
662
764
|
}
|
|
663
765
|
}
|
|
766
|
+
/**
|
|
767
|
+
* Ask for `topic` at `tier` until the returned release is called. The mod is
|
|
768
|
+
* asked for the fastest tier any live claim on the topic holds, and only while
|
|
769
|
+
* the topic is subscribed: a claim made first waits for the subscribe, and one
|
|
770
|
+
* outliving its subscriptions is asked for again when the topic is next
|
|
771
|
+
* subscribed. A `"base"` claim asks for nothing.
|
|
772
|
+
*/
|
|
773
|
+
requestRate(topic, tier) {
|
|
774
|
+
if (topic === "" || tier === "base")
|
|
775
|
+
return () => { };
|
|
776
|
+
this.fastClaims.set(topic, (this.fastClaims.get(topic) ?? 0) + 1);
|
|
777
|
+
this.releaseRateReport ??= this.subscribe("system.dataRates", () => { });
|
|
778
|
+
this.syncRate(topic);
|
|
779
|
+
let released = false;
|
|
780
|
+
return () => {
|
|
781
|
+
if (released)
|
|
782
|
+
return;
|
|
783
|
+
released = true;
|
|
784
|
+
const remaining = (this.fastClaims.get(topic) ?? 1) - 1;
|
|
785
|
+
if (remaining > 0)
|
|
786
|
+
this.fastClaims.set(topic, remaining);
|
|
787
|
+
else
|
|
788
|
+
this.fastClaims.delete(topic);
|
|
789
|
+
this.syncRate(topic);
|
|
790
|
+
if (this.fastClaims.size === 0) {
|
|
791
|
+
this.releaseRateReport?.();
|
|
792
|
+
this.releaseRateReport = null;
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
/**
|
|
797
|
+
* Ask the mod to send `tier` no faster than `samplesPerSecond` while this
|
|
798
|
+
* connection is open, or withdraw the request with `null`. The mod sends the
|
|
799
|
+
* tier at the lowest rate any connection asks for this way, never below the
|
|
800
|
+
* base rate, and `system.dataRates` reports what it sends.
|
|
801
|
+
*/
|
|
802
|
+
capRate(tier, samplesPerSecond) {
|
|
803
|
+
this.transport.send(samplesPerSecond === null
|
|
804
|
+
? { type: "cap-rate", tier }
|
|
805
|
+
: { type: "cap-rate", tier, samplesPerSecond });
|
|
806
|
+
}
|
|
807
|
+
/** The tier the live claims on `topic` ask for. */
|
|
808
|
+
claimedTier(topic) {
|
|
809
|
+
return (this.fastClaims.get(topic) ?? 0) > 0 ? "fast" : "base";
|
|
810
|
+
}
|
|
811
|
+
/** Send `set-rate` for `topic` when the tier its claims ask for differs from what the mod holds for it. */
|
|
812
|
+
syncRate(topic) {
|
|
813
|
+
if (!this.subscribers.has(topic))
|
|
814
|
+
return;
|
|
815
|
+
const wanted = this.claimedTier(topic);
|
|
816
|
+
if (wanted === (this.sentTiers.get(topic) ?? "base"))
|
|
817
|
+
return;
|
|
818
|
+
if (wanted === "base")
|
|
819
|
+
this.sentTiers.delete(topic);
|
|
820
|
+
else
|
|
821
|
+
this.sentTiers.set(topic, wanted);
|
|
822
|
+
this.transport.send({ type: "set-rate", topic, tier: wanted });
|
|
823
|
+
}
|
|
664
824
|
/**
|
|
665
825
|
* Subscribe to a topic. On the first subscriber for a topic, sends a
|
|
666
826
|
* `subscribe` message to the transport. If a sticky last value already
|
|
@@ -691,6 +851,7 @@ export class TelemetryClient {
|
|
|
691
851
|
this.subscribers.set(topic, subs);
|
|
692
852
|
this.transport.send({ type: "subscribe", topic });
|
|
693
853
|
this.ownership?.noteSubscribeSent(topic);
|
|
854
|
+
this.syncRate(topic);
|
|
694
855
|
}
|
|
695
856
|
const sub = { cb };
|
|
696
857
|
subs.add(sub);
|
|
@@ -708,6 +869,7 @@ export class TelemetryClient {
|
|
|
708
869
|
this.lastMetas.delete(topic);
|
|
709
870
|
this.lastPoints.delete(topic);
|
|
710
871
|
this.newestRaw.delete(topic);
|
|
872
|
+
this.sentTiers.delete(topic);
|
|
711
873
|
this.transport.send({ type: "unsubscribe", topic });
|
|
712
874
|
this.ownership?.noteReleased(topic);
|
|
713
875
|
}
|
|
@@ -725,7 +887,7 @@ export class TelemetryClient {
|
|
|
725
887
|
* already does, the two delivery paths are independent, neither replaces
|
|
726
888
|
* the other. `point.validAt`/`point.epoch` are read straight off the
|
|
727
889
|
* message's own `meta` (`meta.validAt`/`meta.timelineEpoch`), which is what
|
|
728
|
-
* makes this feed correct for a
|
|
890
|
+
* makes this feed correct for a published processor's epoch-guard/quality-pick
|
|
729
891
|
* machinery without this class needing to know anything about derivation.
|
|
730
892
|
*
|
|
731
893
|
* Does not replay history: a store attached after samples have already
|
|
@@ -747,6 +909,17 @@ export class TelemetryClient {
|
|
|
747
909
|
// Only each topic's newest point is replayed, never the history behind it.
|
|
748
910
|
for (const [topic, point] of this.lastPoints)
|
|
749
911
|
store.ingest(topic, point);
|
|
912
|
+
const requestHistory = this.transport.requestHistory?.bind(this.transport);
|
|
913
|
+
const releaseHistory = requestHistory
|
|
914
|
+
? store.setHistorySource({
|
|
915
|
+
request: async (topic, fromUt, toUt) => (await requestHistory(topic, fromUt, toUt)).map((frame) => ({
|
|
916
|
+
validAt: frame.meta.validAt,
|
|
917
|
+
payload: frame.payload,
|
|
918
|
+
meta: frame.meta,
|
|
919
|
+
epoch: frame.meta.timelineEpoch,
|
|
920
|
+
})),
|
|
921
|
+
})
|
|
922
|
+
: undefined;
|
|
750
923
|
if (this.gameState) {
|
|
751
924
|
store.setGameState(this.gameState.state, this.gameState.scene);
|
|
752
925
|
}
|
|
@@ -758,6 +931,7 @@ export class TelemetryClient {
|
|
|
758
931
|
store.markTopicUnowned(topic);
|
|
759
932
|
}
|
|
760
933
|
return () => {
|
|
934
|
+
releaseHistory?.();
|
|
761
935
|
this.stores.delete(store);
|
|
762
936
|
};
|
|
763
937
|
}
|
|
@@ -812,6 +986,7 @@ export class TelemetryClient {
|
|
|
812
986
|
*/
|
|
813
987
|
delaySource;
|
|
814
988
|
warnedNoLossDeadline = false;
|
|
989
|
+
awaitingDelayCount = 0;
|
|
815
990
|
warnedEmptyTopic = false;
|
|
816
991
|
/**
|
|
817
992
|
* Hand the client the authoritative one-way delay so it can settle a dispatch that
|
|
@@ -830,6 +1005,13 @@ export class TelemetryClient {
|
|
|
830
1005
|
this.delaySource = undefined;
|
|
831
1006
|
};
|
|
832
1007
|
}
|
|
1008
|
+
/** The delay source's figure, or nothing while it says the delay is unknown (not finite). */
|
|
1009
|
+
knownSourceDelay() {
|
|
1010
|
+
const seconds = this.delaySource?.();
|
|
1011
|
+
return seconds !== undefined && Number.isFinite(seconds)
|
|
1012
|
+
? seconds
|
|
1013
|
+
: undefined;
|
|
1014
|
+
}
|
|
833
1015
|
/**
|
|
834
1016
|
* Say so, once, when a dispatch gets no loss deadline.
|
|
835
1017
|
*
|
|
@@ -850,13 +1032,19 @@ export class TelemetryClient {
|
|
|
850
1032
|
if (this.warnedNoLossDeadline)
|
|
851
1033
|
return;
|
|
852
1034
|
this.warnedNoLossDeadline = true;
|
|
853
|
-
|
|
854
|
-
"
|
|
855
|
-
|
|
856
|
-
|
|
1035
|
+
if (this.delaySource === undefined) {
|
|
1036
|
+
console.warn("[sitrep] no delay authority and no transport prediction: command promises " +
|
|
1037
|
+
"cannot be settled on silence, so an unanswered dispatch will hang. " +
|
|
1038
|
+
"Attach a DelayAuthority (TelemetryProvider does this) or implement " +
|
|
1039
|
+
"Transport.predictConfirmEta.");
|
|
1040
|
+
return;
|
|
1041
|
+
}
|
|
1042
|
+
console.warn("[sitrep] the command delay is not yet known: a command sent now is timed " +
|
|
1043
|
+
"from its dispatch once the figure arrives, and is called lost after " +
|
|
1044
|
+
"a fixed wait if none does.");
|
|
857
1045
|
}
|
|
858
|
-
dispatch(command, args, label, topic, vantage, requestIdOverride) {
|
|
859
|
-
const { requestId, result, frame } = this.register(command, args, label, topic, vantage, requestIdOverride);
|
|
1046
|
+
dispatch(command, args, label, topic, vantage, requestIdOverride, seen) {
|
|
1047
|
+
const { requestId, result, frame } = this.register(command, args, label, topic, vantage, requestIdOverride, seen);
|
|
860
1048
|
this.transport.send(frame);
|
|
861
1049
|
return { requestId, result };
|
|
862
1050
|
}
|
|
@@ -878,7 +1066,7 @@ export class TelemetryClient {
|
|
|
878
1066
|
overrides.some((id) => this.commands.has(id))) {
|
|
879
1067
|
throw new Error("a request id in the group is already in use");
|
|
880
1068
|
}
|
|
881
|
-
const registered = members.map((m) => this.register(m.command, m.args, m.label, m.topic, vantage, m.requestId));
|
|
1069
|
+
const registered = members.map((m) => this.register(m.command, m.args, m.label, m.topic, vantage, m.requestId, m.seen));
|
|
882
1070
|
const id = groupId ?? `${this.idPrefix}-g${this.nextRequestId++}`;
|
|
883
1071
|
this.transport.send({
|
|
884
1072
|
type: "command-group",
|
|
@@ -898,7 +1086,7 @@ export class TelemetryClient {
|
|
|
898
1086
|
* sending it: {@link dispatch} sends it alone and {@link dispatchGroup} sends
|
|
899
1087
|
* several in one frame.
|
|
900
1088
|
*/
|
|
901
|
-
register(command, args, label, topic, vantage, requestIdOverride) {
|
|
1089
|
+
register(command, args, label, topic, vantage, requestIdOverride, seen) {
|
|
902
1090
|
if (requestIdOverride !== undefined &&
|
|
903
1091
|
this.commands.has(requestIdOverride)) {
|
|
904
1092
|
throw new Error(`request id ${requestIdOverride} is already in use`);
|
|
@@ -936,9 +1124,10 @@ export class TelemetryClient {
|
|
|
936
1124
|
// They are alternatives, never both: one source per deployment rather than two
|
|
937
1125
|
// competing ones. See `Transport.predictConfirmEta` for the rule a new transport
|
|
938
1126
|
// must follow.
|
|
1127
|
+
const sourceDelay = this.knownSourceDelay();
|
|
939
1128
|
const predictedEta = this.transport.predictConfirmEta?.() ??
|
|
940
|
-
(
|
|
941
|
-
? this.clock.now() + 2 *
|
|
1129
|
+
(sourceDelay !== undefined
|
|
1130
|
+
? this.clock.now() + 2 * sourceDelay
|
|
942
1131
|
: undefined);
|
|
943
1132
|
const etaConfirm = predictedEta ?? this.clock.now();
|
|
944
1133
|
/*
|
|
@@ -948,9 +1137,9 @@ export class TelemetryClient {
|
|
|
948
1137
|
*/
|
|
949
1138
|
const dispatchUt = this.gameUtNow();
|
|
950
1139
|
const delayDeadlineUt = this.transport.predictConfirmEta?.() === undefined &&
|
|
951
|
-
|
|
1140
|
+
sourceDelay !== undefined &&
|
|
952
1141
|
dispatchUt !== undefined
|
|
953
|
-
? dispatchUt + 2 *
|
|
1142
|
+
? dispatchUt + 2 * sourceDelay
|
|
954
1143
|
: undefined;
|
|
955
1144
|
if (predictedEta === undefined)
|
|
956
1145
|
this.warnNoLossDeadlineOnce();
|
|
@@ -971,6 +1160,9 @@ export class TelemetryClient {
|
|
|
971
1160
|
unclaimable: false,
|
|
972
1161
|
});
|
|
973
1162
|
});
|
|
1163
|
+
/* Another screen sent it under its own id, and only that screen reloads and claims it. */
|
|
1164
|
+
if (requestIdOverride !== undefined)
|
|
1165
|
+
this.carriedForOther.add(requestId);
|
|
974
1166
|
this.outstandingDirty = true;
|
|
975
1167
|
this.dropOldestAnswered();
|
|
976
1168
|
const pendingNow = this.commands.get(requestId);
|
|
@@ -983,6 +1175,13 @@ export class TelemetryClient {
|
|
|
983
1175
|
pendingNow.cancelLossTimer = this.clock.schedule(predictedEta + LOSS_MARGIN, () => this.handleLoss(requestId));
|
|
984
1176
|
}
|
|
985
1177
|
}
|
|
1178
|
+
if (predictedEta === undefined &&
|
|
1179
|
+
pendingNow &&
|
|
1180
|
+
this.delaySource !== undefined) {
|
|
1181
|
+
pendingNow.awaitingDelay = { at: this.clock.now(), ut: dispatchUt };
|
|
1182
|
+
pendingNow.cancelLossTimer = this.clock.schedule(this.clock.now() + UNKNOWN_DELAY_LOSS_SECONDS, () => this.handleLoss(requestId));
|
|
1183
|
+
this.awaitingDelayCount += 1;
|
|
1184
|
+
}
|
|
986
1185
|
this.notifyStore();
|
|
987
1186
|
return {
|
|
988
1187
|
requestId,
|
|
@@ -995,7 +1194,7 @@ export class TelemetryClient {
|
|
|
995
1194
|
topic: topic ?? "",
|
|
996
1195
|
// Per-call vantage override (delay-UX): "" ⇒ the server uses the session vantage; "meta" pins a program-meta command to instant dispatch.
|
|
997
1196
|
vantage: vantage ?? "",
|
|
998
|
-
...
|
|
1197
|
+
...(seen ?? this.seen()),
|
|
999
1198
|
args: wireArgs,
|
|
1000
1199
|
sentAt: 0,
|
|
1001
1200
|
},
|
|
@@ -1018,6 +1217,8 @@ export class TelemetryClient {
|
|
|
1018
1217
|
continue;
|
|
1019
1218
|
if (this.heldCommands.has(requestId))
|
|
1020
1219
|
continue;
|
|
1220
|
+
if (pending.awaitingDelay)
|
|
1221
|
+
this.awaitingDelayCount -= 1;
|
|
1021
1222
|
this.commands.delete(requestId);
|
|
1022
1223
|
excess -= 1;
|
|
1023
1224
|
}
|
|
@@ -1045,6 +1246,45 @@ export class TelemetryClient {
|
|
|
1045
1246
|
}
|
|
1046
1247
|
};
|
|
1047
1248
|
}
|
|
1249
|
+
/**
|
|
1250
|
+
* Reads the commands `carrier` dispatched as ones this screen follows, through
|
|
1251
|
+
* {@link getCarriedCommand}. Useful for a main screen whose stations' commands
|
|
1252
|
+
* leave through a connection of their own. Returns the release.
|
|
1253
|
+
*/
|
|
1254
|
+
carryCommandsFrom(carrier) {
|
|
1255
|
+
if (carrier === this)
|
|
1256
|
+
return () => undefined;
|
|
1257
|
+
this.carriers.add(carrier);
|
|
1258
|
+
const stop = carrier.subscribeStore(() => {
|
|
1259
|
+
this.carriedRevision += 1;
|
|
1260
|
+
this.notifyStore();
|
|
1261
|
+
});
|
|
1262
|
+
this.carriedRevision += 1;
|
|
1263
|
+
this.notifyStore();
|
|
1264
|
+
return () => {
|
|
1265
|
+
stop();
|
|
1266
|
+
this.carriers.delete(carrier);
|
|
1267
|
+
};
|
|
1268
|
+
}
|
|
1269
|
+
/** Changes whenever a client this one carries commands from changes, so a reader of {@link getCarriedCommand} can tell. */
|
|
1270
|
+
carriedCommandsRevision() {
|
|
1271
|
+
return this.carriedRevision;
|
|
1272
|
+
}
|
|
1273
|
+
/**
|
|
1274
|
+
* The status of a command this client or a client it carries dispatched,
|
|
1275
|
+
* preferring this client's own record. `idle` when none holds it.
|
|
1276
|
+
*/
|
|
1277
|
+
getCarriedCommand(requestId) {
|
|
1278
|
+
const own = this.commands.get(requestId)?.status;
|
|
1279
|
+
if (own)
|
|
1280
|
+
return own;
|
|
1281
|
+
for (const carrier of this.carriers) {
|
|
1282
|
+
const status = carrier.commands.get(requestId)?.status;
|
|
1283
|
+
if (status)
|
|
1284
|
+
return status;
|
|
1285
|
+
}
|
|
1286
|
+
return UNKNOWN_COMMAND;
|
|
1287
|
+
}
|
|
1048
1288
|
/** Current lifecycle status for a dispatched command, or `idle` if the client holds no record of it: it was never sent, or it was answered long enough ago to be dropped. */
|
|
1049
1289
|
getCommand(requestId) {
|
|
1050
1290
|
return this.commands.get(requestId)?.status ?? UNKNOWN_COMMAND;
|
|
@@ -1092,6 +1332,7 @@ export class TelemetryClient {
|
|
|
1092
1332
|
this.unownedListeners.clear();
|
|
1093
1333
|
this.subscriberLabels.clear();
|
|
1094
1334
|
this.commands.clear();
|
|
1335
|
+
this.awaitingDelayCount = 0;
|
|
1095
1336
|
this.stores.clear();
|
|
1096
1337
|
}
|
|
1097
1338
|
/**
|
|
@@ -1100,25 +1341,67 @@ export class TelemetryClient {
|
|
|
1100
1341
|
* no stamp at all (a transport with nothing to say about vantage) changes
|
|
1101
1342
|
* nothing, and the mod's empty stamp clears it: no centre is active yet.
|
|
1102
1343
|
*/
|
|
1103
|
-
noteObservedVantage(
|
|
1344
|
+
noteObservedVantage(meta) {
|
|
1345
|
+
const vantage = meta.vantage;
|
|
1104
1346
|
if (vantage === undefined || vantage === META_VANTAGE)
|
|
1105
1347
|
return;
|
|
1348
|
+
/*
|
|
1349
|
+
* A host replays a quiet Topic's older frames after its newest, to a
|
|
1350
|
+
* station that has just joined, so a frame can arrive stamped from a
|
|
1351
|
+
* centre the session has since left. Only a frame from the same or a later
|
|
1352
|
+
* timeline epoch, and delivered no earlier than the one that set the
|
|
1353
|
+
* vantage within an epoch, may change it.
|
|
1354
|
+
*/
|
|
1355
|
+
const prior = this.observedStampedAt;
|
|
1356
|
+
if (prior !== undefined &&
|
|
1357
|
+
(meta.timelineEpoch < prior.epoch ||
|
|
1358
|
+
(prior.epoch === meta.timelineEpoch &&
|
|
1359
|
+
meta.deliveredAt < prior.deliveredAt))) {
|
|
1360
|
+
return;
|
|
1361
|
+
}
|
|
1362
|
+
const stamp = { epoch: meta.timelineEpoch, deliveredAt: meta.deliveredAt };
|
|
1106
1363
|
// The mod's empty stamp says no command centre is active, so the earlier centre no longer describes what arrives.
|
|
1107
1364
|
if (vantage === "") {
|
|
1365
|
+
this.observedStampedAt = stamp;
|
|
1108
1366
|
if (this.observedVantageId === undefined)
|
|
1109
1367
|
return;
|
|
1110
1368
|
this.observedVantageId = undefined;
|
|
1111
|
-
|
|
1112
|
-
listener();
|
|
1369
|
+
this.notifyObservedVantage();
|
|
1113
1370
|
return;
|
|
1114
1371
|
}
|
|
1372
|
+
this.observedStampedAt = stamp;
|
|
1115
1373
|
if (vantage === this.observedVantageId)
|
|
1116
1374
|
return;
|
|
1117
1375
|
this.observedVantageId = vantage;
|
|
1376
|
+
this.notifyObservedVantage();
|
|
1377
|
+
}
|
|
1378
|
+
notifyObservedVantage() {
|
|
1118
1379
|
for (const listener of this.observedVantageListeners)
|
|
1119
1380
|
listener();
|
|
1381
|
+
// A following connection's selection is the observed one.
|
|
1382
|
+
if (this.followingActiveCraft) {
|
|
1383
|
+
for (const listener of this.vantageListeners)
|
|
1384
|
+
listener();
|
|
1385
|
+
}
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Put back the fields a frame left out as unchanged, from the last frame of its
|
|
1389
|
+
* Topic this connection delivered, so every reader past this point sees a whole
|
|
1390
|
+
* payload.
|
|
1391
|
+
*/
|
|
1392
|
+
restoreUnchanged(message) {
|
|
1393
|
+
const { unchanged } = message;
|
|
1394
|
+
if (unchanged !== undefined && unchanged.length > 0) {
|
|
1395
|
+
fillUnchangedFields(message.payload, unchanged, this.lastDeliveredWithHeldFields.get(message.topic));
|
|
1396
|
+
message.unchanged = undefined;
|
|
1397
|
+
}
|
|
1398
|
+
if (fieldsSentOnChange(message.topic).length > 0) {
|
|
1399
|
+
this.lastDeliveredWithHeldFields.set(message.topic, message.payload);
|
|
1400
|
+
}
|
|
1120
1401
|
}
|
|
1121
1402
|
handleMessage(message, replayed = false) {
|
|
1403
|
+
if (this.awaitingDelayCount > 0)
|
|
1404
|
+
this.timeCommandsAwaitingDelay();
|
|
1122
1405
|
if (message.type === "command-response") {
|
|
1123
1406
|
this.handleCommandResponse(message.requestId, message.result);
|
|
1124
1407
|
return;
|
|
@@ -1162,6 +1445,7 @@ export class TelemetryClient {
|
|
|
1162
1445
|
}
|
|
1163
1446
|
if (message.type === "game-state") {
|
|
1164
1447
|
this.gameState = { state: message.state, scene: message.scene };
|
|
1448
|
+
this.noteLoading(message.state === "loading");
|
|
1165
1449
|
for (const store of this.stores) {
|
|
1166
1450
|
store.setGameState(message.state, message.scene);
|
|
1167
1451
|
}
|
|
@@ -1171,6 +1455,12 @@ export class TelemetryClient {
|
|
|
1171
1455
|
// branch existed, which is why the mod's own answer to "does anything
|
|
1172
1456
|
// publish this topic" reached nothing that could use it.
|
|
1173
1457
|
if (message.type === "event") {
|
|
1458
|
+
if (message.name === "timeline-reset") {
|
|
1459
|
+
const kept = message.keptThroughUt;
|
|
1460
|
+
for (const store of this.stores) {
|
|
1461
|
+
store.noteTimelineReset(message.topic, typeof kept === "number" ? kept : undefined);
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1174
1464
|
if (message.name === "subscribed") {
|
|
1175
1465
|
this.ownership?.noteAck(message.topic);
|
|
1176
1466
|
/* An ack can arrive after the window that called the topic unowned, and it is the mod's own answer. */
|
|
@@ -1211,6 +1501,8 @@ export class TelemetryClient {
|
|
|
1211
1501
|
const epoch = meta.timelineEpoch ?? 0;
|
|
1212
1502
|
const vantage = meta.vantage ?? "";
|
|
1213
1503
|
const prior = this.newestRaw.get(topic);
|
|
1504
|
+
if (prior !== undefined && prior.epoch > epoch)
|
|
1505
|
+
return false;
|
|
1214
1506
|
if (prior !== undefined &&
|
|
1215
1507
|
prior.epoch === epoch &&
|
|
1216
1508
|
prior.vantage === vantage &&
|
|
@@ -1221,7 +1513,7 @@ export class TelemetryClient {
|
|
|
1221
1513
|
return true;
|
|
1222
1514
|
}
|
|
1223
1515
|
ingestTopicPayload(topic, payload, meta, replayed) {
|
|
1224
|
-
this.noteObservedVantage(meta
|
|
1516
|
+
this.noteObservedVantage(meta);
|
|
1225
1517
|
this.noteGameUt(meta, replayed);
|
|
1226
1518
|
const newest = this.isNewestRaw(topic, meta);
|
|
1227
1519
|
/* A replay included: whether the game is paused is a state, and a station's link back to the main screen hands over the current one as replayed history. */
|
|
@@ -1303,8 +1595,16 @@ export class TelemetryClient {
|
|
|
1303
1595
|
knownOneWay !== undefined && nowUt !== undefined
|
|
1304
1596
|
? nowUt + 2 * knownOneWay
|
|
1305
1597
|
: undefined;
|
|
1306
|
-
if (
|
|
1307
|
-
pending.status =
|
|
1598
|
+
if (pending.status.phase === "in-flight") {
|
|
1599
|
+
pending.status = warning
|
|
1600
|
+
? { ...pending.status, accepted: true, warning }
|
|
1601
|
+
: { ...pending.status, accepted: true };
|
|
1602
|
+
}
|
|
1603
|
+
if (gameDeadlineUt !== undefined || roundTrip !== undefined) {
|
|
1604
|
+
if (pending.awaitingDelay) {
|
|
1605
|
+
pending.awaitingDelay = undefined;
|
|
1606
|
+
this.awaitingDelayCount -= 1;
|
|
1607
|
+
}
|
|
1308
1608
|
}
|
|
1309
1609
|
if (gameDeadlineUt !== undefined) {
|
|
1310
1610
|
pending.gameDeadlineUt = gameDeadlineUt;
|
|
@@ -1333,6 +1633,40 @@ export class TelemetryClient {
|
|
|
1333
1633
|
pending.cancelLossTimer = this.clock.schedule(roundTrip + LOSS_MARGIN, () => this.handleLoss(requestId));
|
|
1334
1634
|
this.notifyStore();
|
|
1335
1635
|
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Gives each command sent while the delay was unknown its loss deadline, worked
|
|
1638
|
+
* from the moment it was dispatched, as soon as the delay source has a figure.
|
|
1639
|
+
*/
|
|
1640
|
+
timeCommandsAwaitingDelay() {
|
|
1641
|
+
const sourceDelay = this.knownSourceDelay();
|
|
1642
|
+
if (sourceDelay === undefined)
|
|
1643
|
+
return;
|
|
1644
|
+
let changed = false;
|
|
1645
|
+
for (const [requestId, pending] of this.commands) {
|
|
1646
|
+
const waiting = pending.awaitingDelay;
|
|
1647
|
+
if (!waiting)
|
|
1648
|
+
continue;
|
|
1649
|
+
pending.awaitingDelay = undefined;
|
|
1650
|
+
this.awaitingDelayCount -= 1;
|
|
1651
|
+
if (!pending.resolve || pending.status.phase !== "in-flight")
|
|
1652
|
+
continue;
|
|
1653
|
+
changed = true;
|
|
1654
|
+
this.outstandingDirty = true;
|
|
1655
|
+
if (waiting.ut !== undefined) {
|
|
1656
|
+
pending.gameDeadlineUt = waiting.ut + 2 * sourceDelay;
|
|
1657
|
+
pending.replyDueUt = pending.gameDeadlineUt;
|
|
1658
|
+
if (this.placeGameDeadline(requestId, pending))
|
|
1659
|
+
continue;
|
|
1660
|
+
}
|
|
1661
|
+
pending.cancelLossTimer?.();
|
|
1662
|
+
const dueAt = waiting.at + 2 * sourceDelay;
|
|
1663
|
+
pending.etaConfirm = dueAt;
|
|
1664
|
+
pending.status = { ...pending.status, etaConfirm: dueAt };
|
|
1665
|
+
pending.cancelLossTimer = this.clock.schedule(dueAt + LOSS_MARGIN, () => this.handleLoss(requestId));
|
|
1666
|
+
}
|
|
1667
|
+
if (changed)
|
|
1668
|
+
this.notifyStore();
|
|
1669
|
+
}
|
|
1336
1670
|
/**
|
|
1337
1671
|
* The game's UT now, carried forward on the client's clock from the newest
|
|
1338
1672
|
* frame. `undefined` until a frame has arrived.
|
|
@@ -1341,7 +1675,7 @@ export class TelemetryClient {
|
|
|
1341
1675
|
const anchor = this.gameClock;
|
|
1342
1676
|
if (!anchor)
|
|
1343
1677
|
return undefined;
|
|
1344
|
-
if (this.gamePaused)
|
|
1678
|
+
if (this.gamePaused || this.gameLoading)
|
|
1345
1679
|
return anchor.ut;
|
|
1346
1680
|
return anchor.ut + (this.clock.now() - anchor.at);
|
|
1347
1681
|
}
|
|
@@ -1371,6 +1705,165 @@ export class TelemetryClient {
|
|
|
1371
1705
|
}
|
|
1372
1706
|
this.gamePaused = paused;
|
|
1373
1707
|
}
|
|
1708
|
+
/**
|
|
1709
|
+
* Gives a live sample the timeline epoch the client holds it under.
|
|
1710
|
+
*
|
|
1711
|
+
* A quickload or revert starts a new timeline, which the mod announces with
|
|
1712
|
+
* a higher epoch. When a load was seen and the next live sample's UT is
|
|
1713
|
+
* behind the game's UT already seen on the same epoch, no epoch came, and
|
|
1714
|
+
* the sample is the new timeline: the client bumps its own epoch so every
|
|
1715
|
+
* store and the view clock drop the abandoned one. The game's own load is
|
|
1716
|
+
* what tells this apart from samples that merely arrive out of order within
|
|
1717
|
+
* one timeline, which are still refused. A later epoch from the mod is
|
|
1718
|
+
* absorbed into the shift so the two never add up.
|
|
1719
|
+
*/
|
|
1720
|
+
followRewind(message) {
|
|
1721
|
+
if (message.type !== "stream-data" && message.type !== "stream-binary") {
|
|
1722
|
+
return message;
|
|
1723
|
+
}
|
|
1724
|
+
const meta = message.meta;
|
|
1725
|
+
const wire = meta.timelineEpoch ?? 0;
|
|
1726
|
+
this.absorbWireEpoch(wire);
|
|
1727
|
+
let epoch = wire + this.epochShift;
|
|
1728
|
+
/*
|
|
1729
|
+
* Behind what has actually been delivered on this timeline, not behind the
|
|
1730
|
+
* clock's estimate of the game's UT. The estimate runs on through a dialog
|
|
1731
|
+
* or a scene load the game spends paused, such as a switch of craft, so the
|
|
1732
|
+
* first frame after one would read as a rewind and empty every Topic.
|
|
1733
|
+
*/
|
|
1734
|
+
const delivered = this.newestDelivered;
|
|
1735
|
+
/*
|
|
1736
|
+
* A reading delivered from a craft's own node arrives on that craft's clock,
|
|
1737
|
+
* after its own delay, so it can trail frames already delivered without any
|
|
1738
|
+
* rewind. A rewind takes every Topic back, so the frames the mod sends from
|
|
1739
|
+
* its own nodes are enough to tell one.
|
|
1740
|
+
*/
|
|
1741
|
+
const fromACraftsNode = typeof meta.source === "string" &&
|
|
1742
|
+
meta.source.startsWith(CRAFT_NODE_SOURCE_PREFIX);
|
|
1743
|
+
/*
|
|
1744
|
+
* The mod numbers frames in the order it builds them, and can send one built
|
|
1745
|
+
* earlier after one built later. A frame built before the newest delivered
|
|
1746
|
+
* one was built before any load that frame could have come after, so it is
|
|
1747
|
+
* not a rewind however far behind its stamp is.
|
|
1748
|
+
*/
|
|
1749
|
+
const builtEarlier = Number.isFinite(meta.seq) &&
|
|
1750
|
+
delivered?.seq !== undefined &&
|
|
1751
|
+
meta.seq < delivered.seq;
|
|
1752
|
+
const behind = !fromACraftsNode &&
|
|
1753
|
+
!builtEarlier &&
|
|
1754
|
+
delivered !== undefined &&
|
|
1755
|
+
epoch === delivered.epoch &&
|
|
1756
|
+
Number.isFinite(meta.deliveredAt) &&
|
|
1757
|
+
meta.deliveredAt < delivered.ut - REWIND_TOLERANCE_SECONDS;
|
|
1758
|
+
const rewound = this.loadSinceLastSample && behind;
|
|
1759
|
+
if (rewound) {
|
|
1760
|
+
this.epochShift += 1;
|
|
1761
|
+
epoch += 1;
|
|
1762
|
+
/* Every Topic starts again on a rewind, so the frame that made the call is named, to be found when one was not a rewind at all. */
|
|
1763
|
+
console.warn(`[sitrep] read a load as a rewind from ${message.topic} (source ${String(meta.source)}, ` +
|
|
1764
|
+
`valid at ${meta.validAt}, delivered at ${meta.deliveredAt}, ` +
|
|
1765
|
+
`behind ${delivered?.ut} delivered on this timeline); every Topic starts again.`);
|
|
1766
|
+
}
|
|
1767
|
+
if (Number.isFinite(meta.deliveredAt) &&
|
|
1768
|
+
(delivered === undefined ||
|
|
1769
|
+
epoch !== delivered.epoch ||
|
|
1770
|
+
meta.deliveredAt > delivered.ut)) {
|
|
1771
|
+
this.newestDelivered = {
|
|
1772
|
+
ut: meta.deliveredAt,
|
|
1773
|
+
epoch,
|
|
1774
|
+
seq: Number.isFinite(meta.seq) ? meta.seq : undefined,
|
|
1775
|
+
};
|
|
1776
|
+
}
|
|
1777
|
+
if (rewound || (!this.gameLoading && !behind)) {
|
|
1778
|
+
this.loadSinceLastSample = false;
|
|
1779
|
+
}
|
|
1780
|
+
if (epoch === wire)
|
|
1781
|
+
return message;
|
|
1782
|
+
return { ...message, meta: { ...meta, timelineEpoch: epoch } };
|
|
1783
|
+
}
|
|
1784
|
+
/**
|
|
1785
|
+
* Learns the mod's run and timeline from the frames that carry them outside a
|
|
1786
|
+
* sample. A quiet connection hears no stream data after a load, so without
|
|
1787
|
+
* these it would send the old timeline forever and have its commands refused.
|
|
1788
|
+
* Replayed frames count: a late station hears the game's state only that way.
|
|
1789
|
+
*/
|
|
1790
|
+
followTimeline(message) {
|
|
1791
|
+
if (message.type === "hello" || message.type === "game-state") {
|
|
1792
|
+
this.adoptRun(message.bootId);
|
|
1793
|
+
this.absorbWireEpoch(message.timelineEpoch ?? 0);
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
if (message.type === "event" && message.name === "timeline-reset") {
|
|
1797
|
+
this.absorbWireEpoch(message.meta.timelineEpoch ?? 0);
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
/** A new run counts its epochs from zero again, so nothing kept from the old one can be compared with them. */
|
|
1801
|
+
adoptRun(bootId) {
|
|
1802
|
+
if (!bootId || bootId === this.wireBootId)
|
|
1803
|
+
return;
|
|
1804
|
+
const restarted = this.wireBootId !== "";
|
|
1805
|
+
this.wireBootId = bootId;
|
|
1806
|
+
if (!restarted)
|
|
1807
|
+
return;
|
|
1808
|
+
this.lastWireEpoch = 0;
|
|
1809
|
+
this.epochShift = 0;
|
|
1810
|
+
this.notifyTimeline();
|
|
1811
|
+
}
|
|
1812
|
+
/** Takes a wire epoch, absorbing a rewind the client had inferred for itself into the shift so the two never add up. */
|
|
1813
|
+
absorbWireEpoch(wire) {
|
|
1814
|
+
if (wire <= this.lastWireEpoch)
|
|
1815
|
+
return;
|
|
1816
|
+
this.epochShift = Math.max(0, this.epochShift - (wire - this.lastWireEpoch));
|
|
1817
|
+
this.lastWireEpoch = wire;
|
|
1818
|
+
/*
|
|
1819
|
+
* The mod has announced the timeline the load started, so the load needs no
|
|
1820
|
+
* inferring. Left set, a frame delayed to an earlier UT than another on the
|
|
1821
|
+
* new epoch reads as a second rewind and the client ends one epoch ahead of
|
|
1822
|
+
* every frame the mod sends.
|
|
1823
|
+
*/
|
|
1824
|
+
this.loadSinceLastSample = false;
|
|
1825
|
+
this.notifyTimeline();
|
|
1826
|
+
}
|
|
1827
|
+
notifyTimeline() {
|
|
1828
|
+
for (const listener of this.timelineListeners)
|
|
1829
|
+
listener();
|
|
1830
|
+
}
|
|
1831
|
+
/** The raw timeline epoch this screen last received from the mod, as a command sends it. */
|
|
1832
|
+
get wireEpoch() {
|
|
1833
|
+
return this.lastWireEpoch;
|
|
1834
|
+
}
|
|
1835
|
+
/** Calls `fn` once `seconds` have passed on this client's clock. Returns a function that cancels it. */
|
|
1836
|
+
scheduleAfter(seconds, fn) {
|
|
1837
|
+
return this.clock.schedule(this.clock.now() + seconds, fn);
|
|
1838
|
+
}
|
|
1839
|
+
/** Calls `listener` whenever {@link wireEpoch} changes. Returns a function that stops it. */
|
|
1840
|
+
onTimelineChange(listener) {
|
|
1841
|
+
this.timelineListeners.add(listener);
|
|
1842
|
+
return () => {
|
|
1843
|
+
this.timelineListeners.delete(listener);
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
/** What this screen has last received from the mod, as a command frame carries it. */
|
|
1847
|
+
seen() {
|
|
1848
|
+
return {
|
|
1849
|
+
seenBootId: this.wireBootId,
|
|
1850
|
+
seenEpoch: this.lastWireEpoch,
|
|
1851
|
+
...seenVessel(this.lastValues.get("vessel.identity"), this.lastValues.has("vessel.identity")),
|
|
1852
|
+
};
|
|
1853
|
+
}
|
|
1854
|
+
/** Holds the game's UT still from the moment a load starts and lets it run again from there when it ends. */
|
|
1855
|
+
noteLoading(loading) {
|
|
1856
|
+
if (loading === this.gameLoading)
|
|
1857
|
+
return;
|
|
1858
|
+
if (loading)
|
|
1859
|
+
this.loadSinceLastSample = true;
|
|
1860
|
+
const anchor = this.gameClock;
|
|
1861
|
+
const ut = this.gameUtNow();
|
|
1862
|
+
if (anchor && ut !== undefined) {
|
|
1863
|
+
this.gameClock = { ut, at: this.clock.now(), epoch: anchor.epoch };
|
|
1864
|
+
}
|
|
1865
|
+
this.gameLoading = loading;
|
|
1866
|
+
}
|
|
1374
1867
|
/** The UT a pause began at: the record's own, never earlier than the estimate on the same timeline. */
|
|
1375
1868
|
pausedAtUt(anchor, meta, epoch) {
|
|
1376
1869
|
const ut = meta.deliveredAt;
|
|
@@ -1411,6 +1904,9 @@ export class TelemetryClient {
|
|
|
1411
1904
|
if (prior && epoch > prior.epoch)
|
|
1412
1905
|
this.gamePaused = false;
|
|
1413
1906
|
this.gameClock = { ut, at: this.clock.now(), epoch };
|
|
1907
|
+
/* The deadlines of commands in flight are in the old timeline's UT, so the mod is asked what became of them. */
|
|
1908
|
+
if (prior && epoch > prior.epoch)
|
|
1909
|
+
this.scheduleClaim();
|
|
1414
1910
|
if (prior)
|
|
1415
1911
|
return;
|
|
1416
1912
|
let placed = false;
|
|
@@ -1468,7 +1964,7 @@ export class TelemetryClient {
|
|
|
1468
1964
|
* The reading of the client's clock at which a command's deadline in game UT
|
|
1469
1965
|
* and its margin run out, were the game to run at normal speed from the
|
|
1470
1966
|
* newest frame. Worked from that frame's own reading, so a deadline a whole
|
|
1471
|
-
* number of seconds away lands on one. Infinite while the game is paused, so
|
|
1967
|
+
* number of seconds away lands on one. Infinite while the game is paused or loading, so
|
|
1472
1968
|
* the timer keeps rechecking rather than spending the deadline on the pause.
|
|
1473
1969
|
*/
|
|
1474
1970
|
clockTimeOfLoss(pending) {
|
|
@@ -1476,7 +1972,7 @@ export class TelemetryClient {
|
|
|
1476
1972
|
const dueUt = pending.gameDeadlineUt;
|
|
1477
1973
|
if (!anchor || dueUt === undefined)
|
|
1478
1974
|
return undefined;
|
|
1479
|
-
if (this.gamePaused)
|
|
1975
|
+
if (this.gamePaused || this.gameLoading)
|
|
1480
1976
|
return Number.POSITIVE_INFINITY;
|
|
1481
1977
|
return anchor.at + (dueUt + LOSS_MARGIN - anchor.ut);
|
|
1482
1978
|
}
|