@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
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useCallback, useState } from "react";
|
|
2
|
+
import type {
|
|
3
|
+
LastKnownPathReply,
|
|
4
|
+
LastKnownPathRequest,
|
|
5
|
+
} from "../__generated__/contract";
|
|
6
|
+
import { useCommand } from "./use-command";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The id of the command that returns where the active craft goes from the state
|
|
10
|
+
* the asking command centre last heard. Useful for dispatching that query by name.
|
|
11
|
+
* It belongs to the engine and not to an Uplink.
|
|
12
|
+
*
|
|
13
|
+
* @category Orbits and trajectories
|
|
14
|
+
*/
|
|
15
|
+
export const LAST_KNOWN_PATH_COMMAND = "vessel.trajectory.fromLastKnown";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* What {@link useLastKnownPath} returns.
|
|
19
|
+
*
|
|
20
|
+
* @category Orbits and trajectories
|
|
21
|
+
*/
|
|
22
|
+
export interface LastKnownPathQuery {
|
|
23
|
+
/**
|
|
24
|
+
* Asks for the path. Call it on an event or a timer, never on render: it crosses
|
|
25
|
+
* to the game and back, and a provider that integrates does real work to answer.
|
|
26
|
+
*/
|
|
27
|
+
solve: (request: LastKnownPathRequest) => Promise<void>;
|
|
28
|
+
/** The latest reply, or `null` before one has arrived. */
|
|
29
|
+
reply: LastKnownPathReply | null;
|
|
30
|
+
/** True while an ask is outstanding. */
|
|
31
|
+
pending: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The path the active craft follows from the state this command centre last heard,
|
|
36
|
+
* from the elected propagation provider. Useful for drawing where a craft is going
|
|
37
|
+
* when the operator's news of it is old. A refusal arrives as a reply to show the
|
|
38
|
+
* operator, and a request that never reached the game arrives as one too, saying
|
|
39
|
+
* so.
|
|
40
|
+
*
|
|
41
|
+
* @category Orbits and trajectories
|
|
42
|
+
*/
|
|
43
|
+
export function useLastKnownPath(): LastKnownPathQuery {
|
|
44
|
+
// A question and not a command to a craft, and the caller draws the reply, so it stays off the panel's delay rail.
|
|
45
|
+
// A query no kit input draws, so it is sent without one.
|
|
46
|
+
const { dangerouslySendWithoutInput: send } = useCommand(
|
|
47
|
+
LAST_KNOWN_PATH_COMMAND,
|
|
48
|
+
{ rail: false },
|
|
49
|
+
);
|
|
50
|
+
const [reply, setReply] = useState<LastKnownPathReply | null>(null);
|
|
51
|
+
const [pending, setPending] = useState(false);
|
|
52
|
+
|
|
53
|
+
// Keyed on `send`, which `useCommand` memoises, and not on the handle, which is a fresh object each render, so an effect keyed on `solve` would loop.
|
|
54
|
+
const solve = useCallback(
|
|
55
|
+
async (request: LastKnownPathRequest) => {
|
|
56
|
+
setPending(true);
|
|
57
|
+
try {
|
|
58
|
+
setReply(await send(request));
|
|
59
|
+
} catch (error) {
|
|
60
|
+
setReply({
|
|
61
|
+
solved: false,
|
|
62
|
+
refusal:
|
|
63
|
+
error instanceof Error
|
|
64
|
+
? `The request did not reach the game: ${error.message}`
|
|
65
|
+
: "The request did not reach the game.",
|
|
66
|
+
} as LastKnownPathReply);
|
|
67
|
+
} finally {
|
|
68
|
+
setPending(false);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
[send],
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
return { solve, reply, pending };
|
|
75
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
import { useTelemetryClientOptional } from "./context";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The command centre the arriving frames are actually stamped with,
|
|
6
|
+
* reactively: `undefined` until one has arrived, or with no
|
|
7
|
+
* `TelemetryProvider` mounted.
|
|
8
|
+
*
|
|
9
|
+
* The counterpart to `useSelectedVantage`, and the one to reach for wherever a
|
|
10
|
+
* surface must state which vantage the data in front of the operator is delayed
|
|
11
|
+
* from rather than reflect a choice they made. On a station the two disagree:
|
|
12
|
+
* its frames are relayed from a host session it does not own, so its own
|
|
13
|
+
* selection never moves off the default while the host's can be anywhere.
|
|
14
|
+
*/
|
|
15
|
+
export function useObservedVantage(): string | undefined {
|
|
16
|
+
const client = useTelemetryClientOptional();
|
|
17
|
+
const subscribe = useCallback(
|
|
18
|
+
(onChange: () => void) =>
|
|
19
|
+
client ? client.onObservedVantageChange(onChange) : () => {},
|
|
20
|
+
[client],
|
|
21
|
+
);
|
|
22
|
+
const getSnapshot = useCallback(() => client?.observedVantage, [client]);
|
|
23
|
+
return useSyncExternalStore(subscribe, getSnapshot);
|
|
24
|
+
}
|
|
@@ -10,6 +10,26 @@ import {
|
|
|
10
10
|
/** Length of the UT bucket an answer is held for, in game seconds. */
|
|
11
11
|
const BUCKET_SEC = 1;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* The mean anomaly the elements put the craft at when the bucket opens, to nine
|
|
15
|
+
* figures. A coast re-anchored to a later epoch carries a different pair of
|
|
16
|
+
* `meanAnomalyAtEpoch` and `epoch` for the same curve; this is the one number both
|
|
17
|
+
* agree on.
|
|
18
|
+
*/
|
|
19
|
+
function phaseAtBucketStart(
|
|
20
|
+
e: ReturnType<typeof buildElements>,
|
|
21
|
+
bucketUt: number,
|
|
22
|
+
): string {
|
|
23
|
+
const sma = e.ecc > 1 ? Math.abs(e.sma) : e.sma;
|
|
24
|
+
const meanMotion = Math.sqrt(e.mu / (sma * sma * sma));
|
|
25
|
+
const advanced = e.meanAnomalyAtEpoch + meanMotion * (bucketUt - e.epoch);
|
|
26
|
+
const phase =
|
|
27
|
+
e.ecc > 1
|
|
28
|
+
? advanced
|
|
29
|
+
: ((advanced % (2 * Math.PI)) + 2 * Math.PI) % (2 * Math.PI);
|
|
30
|
+
return phase.toPrecision(9);
|
|
31
|
+
}
|
|
32
|
+
|
|
13
33
|
/** Everything `orbitTrajectory` reads from the orbit, as one string, so an orbit rebuilt with the same content keys the same. */
|
|
14
34
|
function orbitKey(
|
|
15
35
|
orbit: OrbitTrajectoryInput["orbit"],
|
|
@@ -27,8 +47,7 @@ function orbitKey(
|
|
|
27
47
|
e.inc,
|
|
28
48
|
e.lan,
|
|
29
49
|
e.argPe,
|
|
30
|
-
e
|
|
31
|
-
e.epoch,
|
|
50
|
+
phaseAtBucketStart(e, bucket * BUCKET_SEC),
|
|
32
51
|
e.mu,
|
|
33
52
|
h?.kind,
|
|
34
53
|
until,
|
|
@@ -54,7 +73,7 @@ function orbitKey(
|
|
|
54
73
|
* The view instant is read when your widget renders, not on every frame, so the
|
|
55
74
|
* answer moves with your own telemetry. The answer is held for each whole second
|
|
56
75
|
* of that instant: while the orbit's elements, horizon, sample count and read frame
|
|
57
|
-
* are unchanged, every render in the same second gets the very same object back, so
|
|
76
|
+
* are unchanged (a coast re-anchored to a later epoch is the same elements), every render in the same second gets the very same object back, so
|
|
58
77
|
* a caller can memoise whatever it derives from it by identity. An orbit whose
|
|
59
78
|
* payload is rebuilt on every render holds just as well, because the key is the
|
|
60
79
|
* orbit's content and never its reference.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useCallback, useSyncExternalStore } from "react";
|
|
2
|
+
import { useTelemetryStoreOptional } from "./context";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether the stream to the mod is open, as the transport last said. Useful for
|
|
6
|
+
* telling the operator that nothing can be sent to the game and that readings
|
|
7
|
+
* are not arriving. Used by the dashboard header and by the command controls.
|
|
8
|
+
* True with no stream mounted, because no connection is then being waited on.
|
|
9
|
+
*/
|
|
10
|
+
export function useStreamConnected(): boolean {
|
|
11
|
+
// gonogo:reads none
|
|
12
|
+
const store = useTelemetryStoreOptional();
|
|
13
|
+
const subscribe = useCallback(
|
|
14
|
+
(onChange: () => void) =>
|
|
15
|
+
store ? store.subscribeStreamConnected(onChange) : () => {},
|
|
16
|
+
[store],
|
|
17
|
+
);
|
|
18
|
+
const getSnapshot = useCallback(
|
|
19
|
+
() => (store ? store.streamConnected() : true),
|
|
20
|
+
[store],
|
|
21
|
+
);
|
|
22
|
+
return useSyncExternalStore(subscribe, getSnapshot);
|
|
23
|
+
}
|
|
@@ -21,12 +21,16 @@ import { useTelemetryClientOptional } from "./context";
|
|
|
21
21
|
* arrive after the subscription count. An event the mod sends again after a
|
|
22
22
|
* reconnect or a change of command centre is not delivered twice.
|
|
23
23
|
*
|
|
24
|
+
* `handler`'s second argument is the frame's `Meta`: `validAt` is when the event
|
|
25
|
+
* happened in game time and `deliveredAt` is when it reached this command centre.
|
|
26
|
+
* It is `undefined` where the frame's `Meta` is not known.
|
|
27
|
+
*
|
|
24
28
|
* `handler` may change identity on every render without re-subscribing. The
|
|
25
29
|
* latest one is always called, so callers need not memoize it.
|
|
26
30
|
*/
|
|
27
31
|
export function useStreamEvent<Payload>(
|
|
28
32
|
topic: string,
|
|
29
|
-
handler: (payload: Payload) => void,
|
|
33
|
+
handler: (payload: Payload, meta: Meta | undefined) => void,
|
|
30
34
|
): void {
|
|
31
35
|
// Degrade to a no-op when no `TelemetryProvider` is mounted (disconnected),
|
|
32
36
|
// same `*Optional` contract as `useStream`/`useTelemetry`.
|
|
@@ -55,7 +59,7 @@ export function useStreamEvent<Payload>(
|
|
|
55
59
|
const repeat = seen !== undefined && seen === lastSeen;
|
|
56
60
|
lastSeen = seen;
|
|
57
61
|
if (replayingSticky || repeat) return;
|
|
58
|
-
handlerRef.current(payload as Payload);
|
|
62
|
+
handlerRef.current(payload as Payload, meta);
|
|
59
63
|
});
|
|
60
64
|
replayingSticky = false;
|
|
61
65
|
return unsubscribe;
|
package/src/spine/use-stream.ts
CHANGED
|
@@ -17,11 +17,14 @@ import { subscribeTopicRead } from "./subscribe-read";
|
|
|
17
17
|
*
|
|
18
18
|
* The caller branches on the reading first: `observed` is current, `held` is
|
|
19
19
|
* the last real observation (with its instant and grade), and `pending`,
|
|
20
|
-
* `unowned` and `absent` carry no value. A
|
|
20
|
+
* `unowned` and `absent` carry no value. A published processor computes its
|
|
21
21
|
* currency from its inputs. The reading keeps its identity while its point,
|
|
22
22
|
* status and epoch are unchanged, so the caller re-renders only when something
|
|
23
23
|
* about `topic` changed.
|
|
24
24
|
*
|
|
25
|
+
* `pending` also while the newest payload names a craft in `meta.source` other
|
|
26
|
+
* than the one the game has active, as `useTelemetry` does.
|
|
27
|
+
*
|
|
25
28
|
* `pending` with no provider mounted, so a stream widget renders an empty
|
|
26
29
|
* state and does not throw.
|
|
27
30
|
*/
|
|
@@ -33,7 +36,7 @@ export function useStream<Payload>(topic: string): TopicReading<Payload> {
|
|
|
33
36
|
* vouching for. The reading makes the caller branch first, exactly as
|
|
34
37
|
* `useTelemetry` does for a typed Topic: `observed` is current, `held` is the
|
|
35
38
|
* last real observation held (with its instant and grade), and `pending`,
|
|
36
|
-
* `unowned` and `absent` carry no value at all. A
|
|
39
|
+
* `unowned` and `absent` carry no value at all. A published processor computes its
|
|
37
40
|
* own currency from its inputs, so its reading is as honest as a raw one.
|
|
38
41
|
*
|
|
39
42
|
* It goes through `store.sampleReading(topic, store.currentFrame())`, never
|
|
@@ -104,7 +107,7 @@ const NO_PROVIDER = topicReading<never>({
|
|
|
104
107
|
* one-way delay between a command centre and a vessel, and by the controls that
|
|
105
108
|
* send commands.
|
|
106
109
|
*
|
|
107
|
-
* Raw Topics only: a
|
|
110
|
+
* Raw Topics only: a published processor is never visible here. `undefined` with
|
|
108
111
|
* no `TelemetryProvider` mounted, or before anything has arrived for `topic`.
|
|
109
112
|
*/
|
|
110
113
|
export function useLatestValue<Payload>(topic: string): Payload | undefined {
|
|
@@ -131,7 +134,7 @@ export function useLatestValue<Payload>(topic: string): Payload | undefined {
|
|
|
131
134
|
*
|
|
132
135
|
* No derived-topic support (unlike `useStream`): `client.getValue` only
|
|
133
136
|
* ever sees raw `stream-data` frames whose `topic` matches literally, so
|
|
134
|
-
* this hook is for raw command-centre topics only, never a
|
|
137
|
+
* this hook is for raw command-centre topics only, never a published processor.
|
|
135
138
|
*/
|
|
136
139
|
const client = useTelemetryClientOptional();
|
|
137
140
|
|
|
@@ -32,7 +32,11 @@ const NO_PROVIDER = topicReading<never>({
|
|
|
32
32
|
*
|
|
33
33
|
* const orbit = useTelemetry("vessel.orbit");
|
|
34
34
|
*
|
|
35
|
-
* With no `TelemetryProvider` mounted it answers `pending`.
|
|
35
|
+
* With no `TelemetryProvider` mounted it answers `pending`. After the game
|
|
36
|
+
* switches the active craft, a Topic whose payload names a craft in
|
|
37
|
+
* `meta.source` (`"vessel:<guid>"`) answers `pending` until a payload from the
|
|
38
|
+
* new active craft arrives, rather than showing the previous craft's last
|
|
39
|
+
* value. Payloads that name no craft, or `"game"`, are unaffected. A Topic with no
|
|
36
40
|
* `TopicId` member (a per-subject dynamic namespace such as
|
|
37
41
|
* `vessel.partActions.<flightId>`) is read with `useStream`.
|
|
38
42
|
*
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import { useMemo, useSyncExternalStore } from "react";
|
|
2
|
+
import { Staleness } from "../__generated__/contract";
|
|
3
|
+
import type { TelemetryClient } from "./client";
|
|
4
|
+
import {
|
|
5
|
+
useTelemetryClientOptional,
|
|
6
|
+
useViewClockOptional,
|
|
7
|
+
type ViewClockView,
|
|
8
|
+
} from "./context";
|
|
9
|
+
import { ViewClock } from "./view-clock";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Whether a Topic's own samples are arriving: `"unknown"` before the first one,
|
|
13
|
+
* `"live"` while they keep coming, `"silent"` once the game has run on for
|
|
14
|
+
* {@link TOPIC_SILENCE_SECONDS} of UT without a new one.
|
|
15
|
+
*
|
|
16
|
+
* @category Delay and vantage
|
|
17
|
+
*/
|
|
18
|
+
export type TopicLinkState = "unknown" | "live" | "silent";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* UT seconds without a new live sample after which a Topic's link reads
|
|
22
|
+
* `"silent"`. Counted in game time, so a paused game never reads as silent.
|
|
23
|
+
*/
|
|
24
|
+
export const TOPIC_SILENCE_SECONDS = 5;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* A clock for one Topic: what {@link useTopicClock} returns.
|
|
28
|
+
*
|
|
29
|
+
* @category Delay and vantage
|
|
30
|
+
*/
|
|
31
|
+
export interface TopicClockState {
|
|
32
|
+
/**
|
|
33
|
+
* The clock to release this Topic's media against, or `undefined` with no
|
|
34
|
+
* telemetry stream mounted. It stands at `-Infinity` until the first sample
|
|
35
|
+
* arrives, so media released against it is held, never shown early.
|
|
36
|
+
*/
|
|
37
|
+
readonly clock: ViewClockView | undefined;
|
|
38
|
+
/** Whether the Topic's samples are arriving. */
|
|
39
|
+
readonly link: TopicLinkState;
|
|
40
|
+
/**
|
|
41
|
+
* The one-way delay in seconds the Topic's newest live sample was held for,
|
|
42
|
+
* or `undefined` before one has arrived. It is the last delay seen, so it is
|
|
43
|
+
* still present while `link` is `"silent"`.
|
|
44
|
+
*/
|
|
45
|
+
readonly delaySeconds: number | undefined;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const NO_STREAM: TopicClockState = {
|
|
49
|
+
clock: undefined,
|
|
50
|
+
link: "unknown",
|
|
51
|
+
delaySeconds: undefined,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* One clock per (client, topic), fed only by that Topic's own arrivals.
|
|
56
|
+
*
|
|
57
|
+
* The shared view clock holds every delayed Topic back by the active craft's
|
|
58
|
+
* delay, so a feed released against it borrows that delay whatever site it
|
|
59
|
+
* stands at. The mod already holds each per-site Topic for its own site's
|
|
60
|
+
* delay before sending it, so the Topic's own samples carry the delay: a
|
|
61
|
+
* sample's `deliveredAt - validAt` is the delay it was held for, and a
|
|
62
|
+
* ViewClock that sees only those samples reports a confirmed edge at that
|
|
63
|
+
* site's own delay.
|
|
64
|
+
*
|
|
65
|
+
* A replayed (recorded) sample describes the past and is delivered while the
|
|
66
|
+
* craft may still be out of contact, so it moves neither the delay nor the
|
|
67
|
+
* liveness instant.
|
|
68
|
+
*/
|
|
69
|
+
class TopicClockSource {
|
|
70
|
+
private delaySeconds = 0;
|
|
71
|
+
private heard = false;
|
|
72
|
+
private lastDeliveredAt: number | undefined;
|
|
73
|
+
private current: TopicClockState;
|
|
74
|
+
private readonly listeners = new Set<() => void>();
|
|
75
|
+
private release: (() => void) | undefined;
|
|
76
|
+
private releaseFrames: (() => void) | undefined;
|
|
77
|
+
|
|
78
|
+
readonly clock: ViewClock;
|
|
79
|
+
|
|
80
|
+
constructor(
|
|
81
|
+
private readonly client: TelemetryClient,
|
|
82
|
+
private readonly topic: string,
|
|
83
|
+
private readonly view: ViewClockView | undefined,
|
|
84
|
+
) {
|
|
85
|
+
this.clock = new ViewClock({ delaySeconds: () => this.delaySeconds });
|
|
86
|
+
this.current = NO_SAMPLES(this.clock);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
snapshot = (): TopicClockState => this.current;
|
|
90
|
+
|
|
91
|
+
subscribe = (listener: () => void): (() => void) => {
|
|
92
|
+
this.listeners.add(listener);
|
|
93
|
+
if (this.listeners.size === 1 && this.topic !== "") {
|
|
94
|
+
this.release = this.client.subscribeFrames(this.topic, (_v, meta) => {
|
|
95
|
+
if (!meta) return;
|
|
96
|
+
const replayed = meta.staleness === Staleness.Recorded;
|
|
97
|
+
this.clock.observeSample(
|
|
98
|
+
meta.validAt,
|
|
99
|
+
meta.deliveredAt,
|
|
100
|
+
meta.timelineEpoch,
|
|
101
|
+
replayed,
|
|
102
|
+
);
|
|
103
|
+
if (!replayed) {
|
|
104
|
+
this.delaySeconds = Math.max(0, meta.deliveredAt - meta.validAt);
|
|
105
|
+
this.heard = true;
|
|
106
|
+
this.lastDeliveredAt = Math.max(
|
|
107
|
+
this.lastDeliveredAt ?? Number.NEGATIVE_INFINITY,
|
|
108
|
+
meta.deliveredAt,
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
this.refresh();
|
|
112
|
+
});
|
|
113
|
+
this.releaseFrames = this.view?.onFrame(() => this.refresh());
|
|
114
|
+
}
|
|
115
|
+
return () => {
|
|
116
|
+
this.listeners.delete(listener);
|
|
117
|
+
if (this.listeners.size === 0) {
|
|
118
|
+
this.release?.();
|
|
119
|
+
this.release = undefined;
|
|
120
|
+
this.releaseFrames?.();
|
|
121
|
+
this.releaseFrames = undefined;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
private linkNow(): TopicLinkState {
|
|
127
|
+
if (this.lastDeliveredAt === undefined) return "unknown";
|
|
128
|
+
const present = this.presentUt();
|
|
129
|
+
if (present === undefined) return "unknown";
|
|
130
|
+
return present - this.lastDeliveredAt > TOPIC_SILENCE_SECONDS
|
|
131
|
+
? "silent"
|
|
132
|
+
: "live";
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The game's present as the shared clock last heard it, or undefined before it has heard anything. */
|
|
136
|
+
private presentUt(): number | undefined {
|
|
137
|
+
const view = this.view;
|
|
138
|
+
if (!view || !Number.isFinite(view.confirmedEdgeUt())) return undefined;
|
|
139
|
+
const ut = view.utNowEstimate();
|
|
140
|
+
return Number.isFinite(ut) ? ut : undefined;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private refresh(): void {
|
|
144
|
+
const link = this.linkNow();
|
|
145
|
+
const delaySeconds = this.heard ? this.delaySeconds : undefined;
|
|
146
|
+
if (
|
|
147
|
+
link === this.current.link &&
|
|
148
|
+
delaySeconds === this.current.delaySeconds
|
|
149
|
+
) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
this.current = { clock: this.clock, link, delaySeconds };
|
|
153
|
+
for (const listener of [...this.listeners]) listener();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The clock and link state of one Topic read at its own delay, for a feed whose
|
|
159
|
+
* site is not the active craft's. Useful for releasing a camera's video at the
|
|
160
|
+
* delay of the place the camera stands and drawing it dark while its link is
|
|
161
|
+
* silent, where the shared view clock would hold every camera to the active
|
|
162
|
+
* craft's delay. Used by the camera feed for a camera on another craft or at a
|
|
163
|
+
* ground station.
|
|
164
|
+
*
|
|
165
|
+
* Read `topic` as a Topic whose Uplink declared it delivered per site; the
|
|
166
|
+
* clock follows that Topic's own arrivals, so a Topic held at the active
|
|
167
|
+
* craft's delay yields that delay. The Topic stays subscribed while the caller
|
|
168
|
+
* is mounted. `link` is `"unknown"` until a first sample arrives, and while
|
|
169
|
+
* the Topic has never arrived the clock stands at `-Infinity`, so media is held
|
|
170
|
+
* and never shown live. With no stream mounted the clock is `undefined`.
|
|
171
|
+
*
|
|
172
|
+
* @category Delay and vantage
|
|
173
|
+
*/
|
|
174
|
+
export function useTopicClock(topic: string): TopicClockState {
|
|
175
|
+
const client = useTelemetryClientOptional();
|
|
176
|
+
const view = useViewClockOptional();
|
|
177
|
+
|
|
178
|
+
const source = useMemo(
|
|
179
|
+
() => (client ? new TopicClockSource(client, topic, view) : undefined),
|
|
180
|
+
[client, topic, view],
|
|
181
|
+
);
|
|
182
|
+
|
|
183
|
+
return useSyncExternalStore(
|
|
184
|
+
source?.subscribe ?? NOOP_SUBSCRIBE,
|
|
185
|
+
source?.snapshot ?? noStream,
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const NO_SAMPLES = (clock: ViewClock): TopicClockState => ({
|
|
190
|
+
clock,
|
|
191
|
+
link: "unknown",
|
|
192
|
+
delaySeconds: undefined,
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
const NOOP_SUBSCRIBE = (): (() => void) => () => {};
|
|
196
|
+
const noStream = (): TopicClockState => NO_STREAM;
|
|
@@ -44,6 +44,12 @@ export interface UseTransmissionsResult {
|
|
|
44
44
|
expect(transmission: SentTransmission): void;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/** A crossing with the timeline epoch it was expected under; a load that starts a new epoch undoes it. */
|
|
48
|
+
interface EpochedCrossing {
|
|
49
|
+
crossing: RailCrossing;
|
|
50
|
+
epoch: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
47
53
|
const TRANSMISSION_TAGS = railTagsForTelemetry("event");
|
|
48
54
|
const NO_IN_FLIGHT: InFlightCommand[] = [];
|
|
49
55
|
const REREAD_MS = 1000;
|
|
@@ -64,25 +70,31 @@ export function useTransmissions(): UseTransmissionsResult {
|
|
|
64
70
|
const oneWay = liveOneWaySeconds(commsDelay);
|
|
65
71
|
const oneWayRef = useRef(oneWay);
|
|
66
72
|
oneWayRef.current = oneWay;
|
|
67
|
-
const [crossings, setCrossings] = useState<
|
|
73
|
+
const [crossings, setCrossings] = useState<EpochedCrossing[]>([]);
|
|
68
74
|
const nextId = useRef(0);
|
|
69
75
|
const [, setReread] = useState(0);
|
|
70
76
|
|
|
71
|
-
const expect = useCallback(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
77
|
+
const expect = useCallback(
|
|
78
|
+
(transmission: SentTransmission) => {
|
|
79
|
+
const oneWaySeconds = oneWayRef.current;
|
|
80
|
+
if (oneWaySeconds === null) return;
|
|
81
|
+
nextId.current += 1;
|
|
82
|
+
const crossing: RailCrossing = {
|
|
83
|
+
id: `transmission-${nextId.current}`,
|
|
84
|
+
label: transmission.label,
|
|
85
|
+
command: transmission.subject,
|
|
86
|
+
topic: "",
|
|
87
|
+
tags: TRANSMISSION_TAGS,
|
|
88
|
+
sentAt: transmission.sentAt,
|
|
89
|
+
oneWaySeconds: value("s", oneWaySeconds),
|
|
90
|
+
};
|
|
91
|
+
setCrossings((prev) => [
|
|
92
|
+
...prev,
|
|
93
|
+
{ crossing, epoch: store?.clock.getEpoch() ?? 0 },
|
|
94
|
+
]);
|
|
95
|
+
},
|
|
96
|
+
[store],
|
|
97
|
+
);
|
|
86
98
|
|
|
87
99
|
// Nothing else re-renders this hook when a row arrives, so it re-reads the clock while anything is crossing.
|
|
88
100
|
const crossing = crossings.length > 0;
|
|
@@ -90,8 +102,12 @@ export function useTransmissions(): UseTransmissionsResult {
|
|
|
90
102
|
if (!crossing) return;
|
|
91
103
|
const timer = setInterval(() => {
|
|
92
104
|
const now = store?.clock.utNowEstimate() ?? 0;
|
|
105
|
+
const epoch = store?.clock.getEpoch() ?? 0;
|
|
93
106
|
setCrossings((prev) => {
|
|
94
|
-
const keep = prev.filter(
|
|
107
|
+
const keep = prev.filter(
|
|
108
|
+
(c) =>
|
|
109
|
+
c.epoch === epoch && deriveRailEntry(c.crossing, now) !== undefined,
|
|
110
|
+
);
|
|
95
111
|
return keep.length === prev.length ? prev : keep;
|
|
96
112
|
});
|
|
97
113
|
setReread((n) => n + 1);
|
|
@@ -100,7 +116,10 @@ export function useTransmissions(): UseTransmissionsResult {
|
|
|
100
116
|
}, [crossing, store]);
|
|
101
117
|
|
|
102
118
|
const nowUt = store?.clock.utNowEstimate() ?? 0;
|
|
103
|
-
const
|
|
119
|
+
const epoch = store?.clock.getEpoch() ?? 0;
|
|
120
|
+
const rows = crossings.flatMap((c) =>
|
|
121
|
+
c.epoch === epoch ? (deriveRailEntry(c.crossing, nowUt) ?? []) : [],
|
|
122
|
+
);
|
|
104
123
|
return {
|
|
105
124
|
inFlight: rows.length > 0 ? rows : NO_IN_FLIGHT,
|
|
106
125
|
tags: TRANSMISSION_TAGS,
|
package/src/spine/vantage.ts
CHANGED
|
@@ -11,3 +11,10 @@
|
|
|
11
11
|
* the session is observing from. Matches the C# `MetaVantage` constant.
|
|
12
12
|
*/
|
|
13
13
|
export const META_VANTAGE = "meta";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The reserved vantage id that asks the mod to keep a connection at the active
|
|
17
|
+
* craft and to move it whenever the game changes craft. It names no centre and
|
|
18
|
+
* is never stamped on a frame. Matches the C# `ActiveCraftVantage` constant.
|
|
19
|
+
*/
|
|
20
|
+
export const ACTIVE_CRAFT_VANTAGE = "active-craft";
|