@ksp-gonogo/sitrep-sdk 1.0.0 → 1.1.0-rc.52

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.
Files changed (599) hide show
  1. package/dist/__generated__/command-map.d.ts +118 -2
  2. package/dist/__generated__/command-map.d.ts.map +1 -1
  3. package/dist/__generated__/command-map.js +36 -0
  4. package/dist/__generated__/command-map.js.map +1 -1
  5. package/dist/__generated__/contract.d.ts +2380 -186
  6. package/dist/__generated__/contract.d.ts.map +1 -1
  7. package/dist/__generated__/contract.js +39 -3
  8. package/dist/__generated__/contract.js.map +1 -1
  9. package/dist/__generated__/delay-roles.d.ts +2 -2
  10. package/dist/__generated__/delay-roles.d.ts.map +1 -1
  11. package/dist/__generated__/delay-roles.js +8 -0
  12. package/dist/__generated__/delay-roles.js.map +1 -1
  13. package/dist/__generated__/error-codes.d.ts +2 -3
  14. package/dist/__generated__/error-codes.d.ts.map +1 -1
  15. package/dist/__generated__/error-codes.js +6 -7
  16. package/dist/__generated__/error-codes.js.map +1 -1
  17. package/dist/__generated__/frames.d.ts +72 -0
  18. package/dist/__generated__/frames.d.ts.map +1 -1
  19. package/dist/__generated__/frames.js +36 -0
  20. package/dist/__generated__/frames.js.map +1 -1
  21. package/dist/__generated__/reckonability.d.ts +3 -3
  22. package/dist/__generated__/reckonability.d.ts.map +1 -1
  23. package/dist/__generated__/reckonability.js +2 -2
  24. package/dist/__generated__/reckonability.js.map +1 -1
  25. package/dist/__generated__/sample-kinds.d.ts +9 -0
  26. package/dist/__generated__/sample-kinds.d.ts.map +1 -1
  27. package/dist/__generated__/sample-kinds.js +9 -0
  28. package/dist/__generated__/sample-kinds.js.map +1 -1
  29. package/dist/__generated__/test-theme.d.ts +145 -0
  30. package/dist/__generated__/test-theme.d.ts.map +1 -1
  31. package/dist/__generated__/test-theme.js +172 -2
  32. package/dist/__generated__/test-theme.js.map +1 -1
  33. package/dist/__generated__/topic-map.d.ts +21 -3
  34. package/dist/__generated__/topic-map.d.ts.map +1 -1
  35. package/dist/__generated__/topic-map.js +9 -0
  36. package/dist/__generated__/topic-map.js.map +1 -1
  37. package/dist/__generated__/units.d.ts +210 -27
  38. package/dist/__generated__/units.d.ts.map +1 -1
  39. package/dist/__generated__/units.js +757 -7
  40. package/dist/__generated__/units.js.map +1 -1
  41. package/dist/api/aero-models.d.ts +198 -0
  42. package/dist/api/aero-models.d.ts.map +1 -0
  43. package/dist/api/aero-models.js +67 -0
  44. package/dist/api/aero-models.js.map +1 -0
  45. package/dist/api/biome-knowledge.d.ts +79 -0
  46. package/dist/api/biome-knowledge.d.ts.map +1 -0
  47. package/dist/api/biome-knowledge.js +61 -0
  48. package/dist/api/biome-knowledge.js.map +1 -0
  49. package/dist/api/bodies.d.ts +2 -0
  50. package/dist/api/bodies.d.ts.map +1 -1
  51. package/dist/api/bodies.js +2 -0
  52. package/dist/api/bodies.js.map +1 -1
  53. package/dist/api/comms-models.d.ts +264 -0
  54. package/dist/api/comms-models.d.ts.map +1 -0
  55. package/dist/api/comms-models.js +86 -0
  56. package/dist/api/comms-models.js.map +1 -0
  57. package/dist/api/flight-sources.d.ts +143 -0
  58. package/dist/api/flight-sources.d.ts.map +1 -0
  59. package/dist/api/flight-sources.js +76 -0
  60. package/dist/api/flight-sources.js.map +1 -0
  61. package/dist/api/flight-tags.d.ts +52 -0
  62. package/dist/api/flight-tags.d.ts.map +1 -0
  63. package/dist/api/flight-tags.js +43 -0
  64. package/dist/api/flight-tags.js.map +1 -0
  65. package/dist/api/index.d.ts +13 -2
  66. package/dist/api/index.d.ts.map +1 -1
  67. package/dist/api/index.js +11 -0
  68. package/dist/api/index.js.map +1 -1
  69. package/dist/api/modes.d.ts +1067 -0
  70. package/dist/api/modes.d.ts.map +1 -0
  71. package/dist/api/modes.js +73 -0
  72. package/dist/api/modes.js.map +1 -0
  73. package/dist/api/pilots.d.ts +656 -0
  74. package/dist/api/pilots.d.ts.map +1 -0
  75. package/dist/api/pilots.js +90 -0
  76. package/dist/api/pilots.js.map +1 -0
  77. package/dist/api/planning-events.d.ts +27 -0
  78. package/dist/api/planning-events.d.ts.map +1 -0
  79. package/dist/api/planning-events.js +38 -0
  80. package/dist/api/planning-events.js.map +1 -0
  81. package/dist/api/planning-resources.d.ts +83 -0
  82. package/dist/api/planning-resources.d.ts.map +1 -0
  83. package/dist/api/planning-resources.js +42 -0
  84. package/dist/api/planning-resources.js.map +1 -0
  85. package/dist/api/prediction-models.d.ts +1031 -0
  86. package/dist/api/prediction-models.d.ts.map +1 -0
  87. package/dist/api/prediction-models.js +77 -0
  88. package/dist/api/prediction-models.js.map +1 -0
  89. package/dist/api/slots.d.ts +32 -2
  90. package/dist/api/slots.d.ts.map +1 -1
  91. package/dist/api/stock-bodies.d.ts +4 -3
  92. package/dist/api/stock-bodies.d.ts.map +1 -1
  93. package/dist/api/stock-bodies.js +6 -19
  94. package/dist/api/stock-bodies.js.map +1 -1
  95. package/dist/api/theme.d.ts +453 -6
  96. package/dist/api/theme.d.ts.map +1 -1
  97. package/dist/api/types.d.ts +146 -11
  98. package/dist/api/types.d.ts.map +1 -1
  99. package/dist/api/wait-ends.d.ts +215 -0
  100. package/dist/api/wait-ends.d.ts.map +1 -0
  101. package/dist/api/wait-ends.js +78 -0
  102. package/dist/api/wait-ends.js.map +1 -0
  103. package/dist/command-delay.d.ts +2 -0
  104. package/dist/command-delay.d.ts.map +1 -1
  105. package/dist/command-delay.js.map +1 -1
  106. package/dist/commands.d.ts +1 -1
  107. package/dist/commands.d.ts.map +1 -1
  108. package/dist/compat-versions.d.ts.map +1 -1
  109. package/dist/compat-versions.js +1 -1
  110. package/dist/compat-versions.js.map +1 -1
  111. package/dist/contract-tags.d.ts.map +1 -1
  112. package/dist/contract-tags.js +1 -0
  113. package/dist/contract-tags.js.map +1 -1
  114. package/dist/delay-roles.d.ts +43 -0
  115. package/dist/delay-roles.d.ts.map +1 -1
  116. package/dist/delay-roles.js +58 -0
  117. package/dist/delay-roles.js.map +1 -1
  118. package/dist/event-timeline.d.ts.map +1 -1
  119. package/dist/event-timeline.js +14 -3
  120. package/dist/event-timeline.js.map +1 -1
  121. package/dist/flight/types.d.ts +30 -0
  122. package/dist/flight/types.d.ts.map +1 -1
  123. package/dist/flight/types.js.map +1 -1
  124. package/dist/frames/index.d.ts +2 -1
  125. package/dist/frames/index.d.ts.map +1 -1
  126. package/dist/frames/index.js +2 -1
  127. package/dist/frames/index.js.map +1 -1
  128. package/dist/index.d.ts +11 -7
  129. package/dist/index.d.ts.map +1 -1
  130. package/dist/index.js +12 -12
  131. package/dist/index.js.map +1 -1
  132. package/dist/maths/index.d.ts +16 -0
  133. package/dist/maths/index.d.ts.map +1 -0
  134. package/dist/maths/index.js +16 -0
  135. package/dist/maths/index.js.map +1 -0
  136. package/dist/reading.d.ts +61 -2
  137. package/dist/reading.d.ts.map +1 -1
  138. package/dist/reading.js +29 -0
  139. package/dist/reading.js.map +1 -1
  140. package/dist/reads-index.json +955 -86
  141. package/dist/registry/index.d.ts +14 -0
  142. package/dist/registry/index.d.ts.map +1 -1
  143. package/dist/registry/index.js +14 -0
  144. package/dist/registry/index.js.map +1 -1
  145. package/dist/runtime-topic-registry.d.ts.map +1 -1
  146. package/dist/runtime-topic-registry.js +11 -0
  147. package/dist/runtime-topic-registry.js.map +1 -1
  148. package/dist/spine/__fixtures__/stock-catalogue.d.ts +4 -0
  149. package/dist/spine/__fixtures__/stock-catalogue.d.ts.map +1 -0
  150. package/dist/spine/__fixtures__/stock-catalogue.js +29 -0
  151. package/dist/spine/__fixtures__/stock-catalogue.js.map +1 -0
  152. package/dist/spine/body-derivations.d.ts +21 -0
  153. package/dist/spine/body-derivations.d.ts.map +1 -1
  154. package/dist/spine/body-derivations.js +34 -1
  155. package/dist/spine/body-derivations.js.map +1 -1
  156. package/dist/spine/body-ephemeris.d.ts +152 -0
  157. package/dist/spine/body-ephemeris.d.ts.map +1 -0
  158. package/dist/spine/body-ephemeris.js +579 -0
  159. package/dist/spine/body-ephemeris.js.map +1 -0
  160. package/dist/spine/body-orbit-curve.d.ts +19 -0
  161. package/dist/spine/body-orbit-curve.d.ts.map +1 -0
  162. package/dist/spine/body-orbit-curve.js +53 -0
  163. package/dist/spine/body-orbit-curve.js.map +1 -0
  164. package/dist/spine/body-pose.d.ts +21 -0
  165. package/dist/spine/body-pose.d.ts.map +1 -1
  166. package/dist/spine/body-pose.js +98 -31
  167. package/dist/spine/body-pose.js.map +1 -1
  168. package/dist/spine/capability-lock.d.ts +5 -1
  169. package/dist/spine/capability-lock.d.ts.map +1 -1
  170. package/dist/spine/capability-lock.js +9 -1
  171. package/dist/spine/capability-lock.js.map +1 -1
  172. package/dist/spine/catalogue-elements.d.ts +1 -1
  173. package/dist/spine/catalogue-elements.d.ts.map +1 -1
  174. package/dist/spine/catalogue-elements.js +10 -5
  175. package/dist/spine/catalogue-elements.js.map +1 -1
  176. package/dist/spine/celestial-facts.d.ts +27 -1
  177. package/dist/spine/celestial-facts.d.ts.map +1 -1
  178. package/dist/spine/celestial-facts.js +37 -2
  179. package/dist/spine/celestial-facts.js.map +1 -1
  180. package/dist/spine/client-reading.d.ts +3 -3
  181. package/dist/spine/client-reading.d.ts.map +1 -1
  182. package/dist/spine/client-reading.js +9 -1
  183. package/dist/spine/client-reading.js.map +1 -1
  184. package/dist/spine/client-timeline.js +7 -4
  185. package/dist/spine/client-timeline.js.map +1 -1
  186. package/dist/spine/client.d.ts +43 -11
  187. package/dist/spine/client.d.ts.map +1 -1
  188. package/dist/spine/client.js +221 -40
  189. package/dist/spine/client.js.map +1 -1
  190. package/dist/spine/comms-path-geometry.d.ts +4 -4
  191. package/dist/spine/comms-path-geometry.js +5 -5
  192. package/dist/spine/comms-path-geometry.js.map +1 -1
  193. package/dist/spine/context.d.ts +7 -0
  194. package/dist/spine/context.d.ts.map +1 -1
  195. package/dist/spine/context.js +35 -6
  196. package/dist/spine/context.js.map +1 -1
  197. package/dist/spine/core-reckoners.d.ts +5 -0
  198. package/dist/spine/core-reckoners.d.ts.map +1 -1
  199. package/dist/spine/core-reckoners.js +5 -959
  200. package/dist/spine/core-reckoners.js.map +1 -1
  201. package/dist/spine/delay-estimate.js +2 -2
  202. package/dist/spine/delay-estimate.js.map +1 -1
  203. package/dist/spine/elements-from-state.d.ts +22 -0
  204. package/dist/spine/elements-from-state.d.ts.map +1 -0
  205. package/dist/spine/elements-from-state.js +97 -0
  206. package/dist/spine/elements-from-state.js.map +1 -0
  207. package/dist/spine/hermite.d.ts +9 -0
  208. package/dist/spine/hermite.d.ts.map +1 -0
  209. package/dist/spine/hermite.js +34 -0
  210. package/dist/spine/hermite.js.map +1 -0
  211. package/dist/spine/impact-point.d.ts +33 -0
  212. package/dist/spine/impact-point.d.ts.map +1 -1
  213. package/dist/spine/impact-point.js +157 -45
  214. package/dist/spine/impact-point.js.map +1 -1
  215. package/dist/spine/index.d.ts +17 -1
  216. package/dist/spine/index.d.ts.map +1 -1
  217. package/dist/spine/index.js +17 -1
  218. package/dist/spine/index.js.map +1 -1
  219. package/dist/spine/kepler-reckoning.d.ts.map +1 -1
  220. package/dist/spine/kepler-reckoning.js +4 -3
  221. package/dist/spine/kepler-reckoning.js.map +1 -1
  222. package/dist/spine/kepler.d.ts +2 -0
  223. package/dist/spine/kepler.d.ts.map +1 -1
  224. package/dist/spine/kepler.js +2 -0
  225. package/dist/spine/kepler.js.map +1 -1
  226. package/dist/spine/live-run-reckoners.d.ts +6 -0
  227. package/dist/spine/live-run-reckoners.d.ts.map +1 -0
  228. package/dist/spine/live-run-reckoners.js +596 -0
  229. package/dist/spine/live-run-reckoners.js.map +1 -0
  230. package/dist/spine/live-run-relay.d.ts +160 -0
  231. package/dist/spine/live-run-relay.d.ts.map +1 -0
  232. package/dist/spine/live-run-relay.js +292 -0
  233. package/dist/spine/live-run-relay.js.map +1 -0
  234. package/dist/spine/live-run.d.ts +185 -0
  235. package/dist/spine/live-run.d.ts.map +1 -0
  236. package/dist/spine/live-run.js +69 -0
  237. package/dist/spine/live-run.js.map +1 -0
  238. package/dist/spine/lock-scope.d.ts +7 -0
  239. package/dist/spine/lock-scope.d.ts.map +1 -1
  240. package/dist/spine/lock-scope.js +12 -1
  241. package/dist/spine/lock-scope.js.map +1 -1
  242. package/dist/spine/mode-command-gate.d.ts +16 -0
  243. package/dist/spine/mode-command-gate.d.ts.map +1 -0
  244. package/dist/spine/mode-command-gate.js +43 -0
  245. package/dist/spine/mode-command-gate.js.map +1 -0
  246. package/dist/spine/mode-view.d.ts +38 -0
  247. package/dist/spine/mode-view.d.ts.map +1 -0
  248. package/dist/spine/mode-view.js +335 -0
  249. package/dist/spine/mode-view.js.map +1 -0
  250. package/dist/spine/orbit-patches.d.ts +12 -0
  251. package/dist/spine/orbit-patches.d.ts.map +1 -1
  252. package/dist/spine/orbit-patches.js +12 -0
  253. package/dist/spine/orbit-patches.js.map +1 -1
  254. package/dist/spine/orbit-speed.d.ts +20 -0
  255. package/dist/spine/orbit-speed.d.ts.map +1 -0
  256. package/dist/spine/orbit-speed.js +29 -0
  257. package/dist/spine/orbit-speed.js.map +1 -0
  258. package/dist/spine/orbit-states.d.ts +54 -0
  259. package/dist/spine/orbit-states.d.ts.map +1 -0
  260. package/dist/spine/orbit-states.js +251 -0
  261. package/dist/spine/orbit-states.js.map +1 -0
  262. package/dist/spine/orbit-trajectory.d.ts +40 -4
  263. package/dist/spine/orbit-trajectory.d.ts.map +1 -1
  264. package/dist/spine/orbit-trajectory.js +82 -44
  265. package/dist/spine/orbit-trajectory.js.map +1 -1
  266. package/dist/spine/orbital-solve.d.ts +79 -9
  267. package/dist/spine/orbital-solve.d.ts.map +1 -1
  268. package/dist/spine/orbital-solve.js +157 -59
  269. package/dist/spine/orbital-solve.js.map +1 -1
  270. package/dist/spine/overlay-context.d.ts +105 -0
  271. package/dist/spine/overlay-context.d.ts.map +1 -0
  272. package/dist/spine/overlay-context.js +34 -0
  273. package/dist/spine/overlay-context.js.map +1 -0
  274. package/dist/spine/own-craft-vantage.js +6 -3
  275. package/dist/spine/own-craft-vantage.js.map +1 -1
  276. package/dist/spine/patch-chain.d.ts +33 -4
  277. package/dist/spine/patch-chain.d.ts.map +1 -1
  278. package/dist/spine/patch-chain.js +26 -6
  279. package/dist/spine/patch-chain.js.map +1 -1
  280. package/dist/spine/path-source-state.d.ts +243 -0
  281. package/dist/spine/path-source-state.d.ts.map +1 -0
  282. package/dist/spine/path-source-state.js +75 -0
  283. package/dist/spine/path-source-state.js.map +1 -0
  284. package/dist/spine/path-source.d.ts +18 -0
  285. package/dist/spine/path-source.d.ts.map +1 -0
  286. package/dist/spine/path-source.js +23 -0
  287. package/dist/spine/path-source.js.map +1 -0
  288. package/dist/spine/phase-angle.d.ts.map +1 -1
  289. package/dist/spine/phase-angle.js +1 -10
  290. package/dist/spine/phase-angle.js.map +1 -1
  291. package/dist/spine/plan.d.ts +11 -0
  292. package/dist/spine/plan.d.ts.map +1 -0
  293. package/dist/spine/plan.js +85 -0
  294. package/dist/spine/plan.js.map +1 -0
  295. package/dist/spine/pressure-profile.d.ts +38 -0
  296. package/dist/spine/pressure-profile.d.ts.map +1 -0
  297. package/dist/spine/pressure-profile.js +43 -0
  298. package/dist/spine/pressure-profile.js.map +1 -0
  299. package/dist/spine/provider-arc.d.ts +75 -0
  300. package/dist/spine/provider-arc.d.ts.map +1 -0
  301. package/dist/spine/provider-arc.js +187 -0
  302. package/dist/spine/provider-arc.js.map +1 -0
  303. package/dist/spine/provider-declines.d.ts +10 -0
  304. package/dist/spine/provider-declines.d.ts.map +1 -0
  305. package/dist/spine/provider-declines.js +35 -0
  306. package/dist/spine/provider-declines.js.map +1 -0
  307. package/dist/spine/provider-orbit-solver.d.ts +27 -0
  308. package/dist/spine/provider-orbit-solver.d.ts.map +1 -0
  309. package/dist/spine/provider-orbit-solver.js +55 -0
  310. package/dist/spine/provider-orbit-solver.js.map +1 -0
  311. package/dist/spine/provider-patches.d.ts +32 -0
  312. package/dist/spine/provider-patches.d.ts.map +1 -0
  313. package/dist/spine/provider-patches.js +119 -0
  314. package/dist/spine/provider-patches.js.map +1 -0
  315. package/dist/spine/reference-frame.d.ts +19 -0
  316. package/dist/spine/reference-frame.d.ts.map +1 -1
  317. package/dist/spine/reference-frame.js +55 -22
  318. package/dist/spine/reference-frame.js.map +1 -1
  319. package/dist/spine/replay-recorder.d.ts +11 -1
  320. package/dist/spine/replay-recorder.d.ts.map +1 -1
  321. package/dist/spine/replay-recorder.js +21 -0
  322. package/dist/spine/replay-recorder.js.map +1 -1
  323. package/dist/spine/replay-session.d.ts +5 -21
  324. package/dist/spine/replay-session.d.ts.map +1 -1
  325. package/dist/spine/replay-session.js +7 -31
  326. package/dist/spine/replay-session.js.map +1 -1
  327. package/dist/spine/replay-transport.d.ts +0 -1
  328. package/dist/spine/replay-transport.d.ts.map +1 -1
  329. package/dist/spine/replay-transport.js +32 -15
  330. package/dist/spine/replay-transport.js.map +1 -1
  331. package/dist/spine/screen-mode.d.ts +50 -0
  332. package/dist/spine/screen-mode.d.ts.map +1 -0
  333. package/dist/spine/screen-mode.js +121 -0
  334. package/dist/spine/screen-mode.js.map +1 -0
  335. package/dist/spine/screen.d.ts +14 -0
  336. package/dist/spine/screen.d.ts.map +1 -1
  337. package/dist/spine/screen.js +16 -0
  338. package/dist/spine/screen.js.map +1 -1
  339. package/dist/spine/slot-ids.d.ts +1 -1
  340. package/dist/spine/slot-ids.d.ts.map +1 -1
  341. package/dist/spine/slot-ids.js +11 -0
  342. package/dist/spine/slot-ids.js.map +1 -1
  343. package/dist/spine/soi-exit.d.ts +8 -0
  344. package/dist/spine/soi-exit.d.ts.map +1 -0
  345. package/dist/spine/soi-exit.js +33 -0
  346. package/dist/spine/soi-exit.js.map +1 -0
  347. package/dist/spine/state-at-epoch.d.ts +31 -0
  348. package/dist/spine/state-at-epoch.d.ts.map +1 -0
  349. package/dist/spine/state-at-epoch.js +44 -0
  350. package/dist/spine/state-at-epoch.js.map +1 -0
  351. package/dist/spine/telemetry-overlay.d.ts +15 -0
  352. package/dist/spine/telemetry-overlay.d.ts.map +1 -0
  353. package/dist/spine/telemetry-overlay.js +20 -0
  354. package/dist/spine/telemetry-overlay.js.map +1 -0
  355. package/dist/spine/timeline-store.d.ts +58 -0
  356. package/dist/spine/timeline-store.d.ts.map +1 -1
  357. package/dist/spine/timeline-store.js +144 -12
  358. package/dist/spine/timeline-store.js.map +1 -1
  359. package/dist/spine/uplink-health.d.ts +8 -0
  360. package/dist/spine/uplink-health.d.ts.map +1 -1
  361. package/dist/spine/uplink-health.js +1 -0
  362. package/dist/spine/uplink-health.js.map +1 -1
  363. package/dist/spine/use-command.d.ts.map +1 -1
  364. package/dist/spine/use-command.js +26 -4
  365. package/dist/spine/use-command.js.map +1 -1
  366. package/dist/spine/use-events.d.ts +29 -0
  367. package/dist/spine/use-events.d.ts.map +1 -0
  368. package/dist/spine/use-events.js +57 -0
  369. package/dist/spine/use-events.js.map +1 -0
  370. package/dist/spine/use-orbit-solve-at.d.ts +19 -0
  371. package/dist/spine/use-orbit-solve-at.d.ts.map +1 -0
  372. package/dist/spine/use-orbit-solve-at.js +50 -0
  373. package/dist/spine/use-orbit-solve-at.js.map +1 -0
  374. package/dist/spine/use-orbit-trajectory.d.ts.map +1 -1
  375. package/dist/spine/use-orbit-trajectory.js +261 -17
  376. package/dist/spine/use-orbit-trajectory.js.map +1 -1
  377. package/dist/spine/use-patch-chain.d.ts +4 -0
  378. package/dist/spine/use-patch-chain.d.ts.map +1 -1
  379. package/dist/spine/use-patch-chain.js +73 -5
  380. package/dist/spine/use-patch-chain.js.map +1 -1
  381. package/dist/spine/use-phase-angle.d.ts.map +1 -1
  382. package/dist/spine/use-phase-angle.js +81 -20
  383. package/dist/spine/use-phase-angle.js.map +1 -1
  384. package/dist/spine/use-processor.d.ts +1 -1
  385. package/dist/spine/use-processor.d.ts.map +1 -1
  386. package/dist/spine/use-processor.js +24 -2
  387. package/dist/spine/use-processor.js.map +1 -1
  388. package/dist/spine/use-stream.d.ts.map +1 -1
  389. package/dist/spine/use-stream.js +3 -3
  390. package/dist/spine/use-stream.js.map +1 -1
  391. package/dist/spine/use-telemetry.d.ts.map +1 -1
  392. package/dist/spine/use-telemetry.js +2 -3
  393. package/dist/spine/use-telemetry.js.map +1 -1
  394. package/dist/spine/vector-parts.d.ts +11 -0
  395. package/dist/spine/vector-parts.d.ts.map +1 -0
  396. package/dist/spine/vector-parts.js +19 -0
  397. package/dist/spine/vector-parts.js.map +1 -0
  398. package/dist/spine/vector.d.ts +38 -0
  399. package/dist/spine/vector.d.ts.map +1 -0
  400. package/dist/spine/vector.js +53 -0
  401. package/dist/spine/vector.js.map +1 -0
  402. package/dist/testing/body-ephemeris-stand-in.d.ts +14 -0
  403. package/dist/testing/body-ephemeris-stand-in.d.ts.map +1 -0
  404. package/dist/testing/body-ephemeris-stand-in.js +39 -0
  405. package/dist/testing/body-ephemeris-stand-in.js.map +1 -0
  406. package/dist/testing/index.d.ts +13 -1
  407. package/dist/testing/index.d.ts.map +1 -1
  408. package/dist/testing/index.js +13 -1
  409. package/dist/testing/index.js.map +1 -1
  410. package/dist/testing/legacy-orbit-solve.d.ts +18 -0
  411. package/dist/testing/legacy-orbit-solve.d.ts.map +1 -0
  412. package/dist/testing/legacy-orbit-solve.js +29 -0
  413. package/dist/testing/legacy-orbit-solve.js.map +1 -0
  414. package/dist/{spine/powered-reckoning.d.ts → testing/legacy-powered-reckoning.d.ts} +3 -14
  415. package/dist/testing/legacy-powered-reckoning.d.ts.map +1 -0
  416. package/dist/{spine/powered-reckoning.js → testing/legacy-powered-reckoning.js} +5 -106
  417. package/dist/testing/legacy-powered-reckoning.js.map +1 -0
  418. package/dist/testing/legacy-reckoners.d.ts +78 -0
  419. package/dist/testing/legacy-reckoners.d.ts.map +1 -0
  420. package/dist/testing/legacy-reckoners.js +729 -0
  421. package/dist/testing/legacy-reckoners.js.map +1 -0
  422. package/dist/{spine/target-range-reckoning.d.ts → testing/legacy-target-range-reckoning.d.ts} +4 -4
  423. package/dist/testing/legacy-target-range-reckoning.d.ts.map +1 -0
  424. package/dist/{spine/target-range-reckoning.js → testing/legacy-target-range-reckoning.js} +3 -3
  425. package/dist/testing/legacy-target-range-reckoning.js.map +1 -0
  426. package/dist/testing/orbit-live-run-stand-in.d.ts +23 -0
  427. package/dist/testing/orbit-live-run-stand-in.d.ts.map +1 -0
  428. package/dist/testing/orbit-live-run-stand-in.js +33 -0
  429. package/dist/testing/orbit-live-run-stand-in.js.map +1 -0
  430. package/dist/testing/path-source-stand-in.d.ts +15 -0
  431. package/dist/testing/path-source-stand-in.d.ts.map +1 -0
  432. package/dist/testing/path-source-stand-in.js +90 -0
  433. package/dist/testing/path-source-stand-in.js.map +1 -0
  434. package/dist/testing/recorded-live-run.d.ts +19 -0
  435. package/dist/testing/recorded-live-run.d.ts.map +1 -0
  436. package/dist/testing/recorded-live-run.js +23 -0
  437. package/dist/testing/recorded-live-run.js.map +1 -0
  438. package/dist/testing/render.d.ts +1 -1
  439. package/dist/testing/render.js +3 -3
  440. package/dist/testing/render.js.map +1 -1
  441. package/dist/testing/stream-fixture.d.ts +6 -0
  442. package/dist/testing/stream-fixture.d.ts.map +1 -1
  443. package/dist/testing/stream-fixture.js +7 -0
  444. package/dist/testing/stream-fixture.js.map +1 -1
  445. package/dist/testing/theme.d.ts +195 -8
  446. package/dist/testing/theme.d.ts.map +1 -1
  447. package/dist/testing/theme.js +35 -8
  448. package/dist/testing/theme.js.map +1 -1
  449. package/dist/topics.d.ts +1 -1
  450. package/dist/topics.d.ts.map +1 -1
  451. package/dist/unit-system/definitions.d.ts +14 -0
  452. package/dist/unit-system/definitions.d.ts.map +1 -1
  453. package/dist/unit-system/definitions.js +11 -0
  454. package/dist/unit-system/definitions.js.map +1 -1
  455. package/dist/unit-system/registry.d.ts.map +1 -1
  456. package/dist/unit-system/registry.js +20 -0
  457. package/dist/unit-system/registry.js.map +1 -1
  458. package/dist/uplink-load.d.ts +6 -0
  459. package/dist/uplink-load.d.ts.map +1 -1
  460. package/dist/uplink-load.js.map +1 -1
  461. package/dist/uplink-manifest.d.ts +20 -1
  462. package/dist/uplink-manifest.d.ts.map +1 -1
  463. package/dist/uplink-manifest.js +11 -2
  464. package/dist/uplink-manifest.js.map +1 -1
  465. package/package.json +7 -2
  466. package/src/__generated__/command-map.ts +97 -0
  467. package/src/__generated__/contract.ts +2374 -120
  468. package/src/__generated__/delay-roles.ts +8 -0
  469. package/src/__generated__/error-codes.ts +6 -7
  470. package/src/__generated__/frames.ts +36 -0
  471. package/src/__generated__/reckonability.ts +3 -2
  472. package/src/__generated__/sample-kinds.ts +9 -0
  473. package/src/__generated__/test-theme.ts +172 -2
  474. package/src/__generated__/topic-map.ts +37 -1
  475. package/src/__generated__/units.json +749 -14
  476. package/src/__generated__/units.ts +759 -7
  477. package/src/api/aero-models.ts +273 -0
  478. package/src/api/biome-knowledge.ts +125 -0
  479. package/src/api/bodies.ts +2 -0
  480. package/src/api/comms-models.ts +356 -0
  481. package/src/api/flight-sources.ts +219 -0
  482. package/src/api/flight-tags.ts +80 -0
  483. package/src/api/index.ts +197 -0
  484. package/src/api/modes.ts +1178 -0
  485. package/src/api/pilots.ts +759 -0
  486. package/src/api/planning-events.ts +66 -0
  487. package/src/api/planning-resources.ts +122 -0
  488. package/src/api/prediction-models.ts +1127 -0
  489. package/src/api/slots.ts +28 -2
  490. package/src/api/stock-bodies.ts +6 -20
  491. package/src/api/theme.ts +470 -6
  492. package/src/api/types.ts +153 -11
  493. package/src/api/wait-ends.ts +300 -0
  494. package/src/command-delay.ts +2 -0
  495. package/src/compat-versions.ts +1 -1
  496. package/src/contract-tags.ts +1 -0
  497. package/src/delay-roles.ts +74 -0
  498. package/src/event-timeline.ts +12 -3
  499. package/src/flight/types.ts +19 -0
  500. package/src/frames/index.ts +2 -0
  501. package/src/index.ts +43 -18
  502. package/src/maths/index.ts +32 -0
  503. package/src/reading.ts +77 -1
  504. package/src/registry/index.ts +23 -1
  505. package/src/runtime-topic-registry.ts +11 -0
  506. package/src/spine/__fixtures__/late-first-state-descent.json +504 -0
  507. package/src/spine/__fixtures__/n-body-bodies.json +1607 -0
  508. package/src/spine/__fixtures__/stock-catalogue.ts +29 -0
  509. package/src/spine/body-derivations.ts +45 -1
  510. package/src/spine/body-ephemeris.ts +828 -0
  511. package/src/spine/body-orbit-curve.ts +72 -0
  512. package/src/spine/body-pose.ts +129 -28
  513. package/src/spine/capability-lock.ts +13 -1
  514. package/src/spine/catalogue-elements.ts +14 -6
  515. package/src/spine/celestial-facts.ts +65 -3
  516. package/src/spine/client-reading.ts +12 -0
  517. package/src/spine/client-timeline.ts +7 -7
  518. package/src/spine/client.ts +228 -39
  519. package/src/spine/comms-path-geometry.ts +5 -5
  520. package/src/spine/context.tsx +35 -6
  521. package/src/spine/core-reckoners.ts +5 -1192
  522. package/src/spine/delay-estimate.ts +2 -2
  523. package/src/spine/elements-from-state.ts +127 -0
  524. package/src/spine/hermite.ts +53 -0
  525. package/src/spine/impact-point.ts +188 -55
  526. package/src/spine/index.ts +17 -1
  527. package/src/spine/kepler-reckoning.ts +4 -3
  528. package/src/spine/kepler.ts +2 -0
  529. package/src/spine/live-run-reckoners.ts +682 -0
  530. package/src/spine/live-run-relay.ts +484 -0
  531. package/src/spine/live-run.ts +234 -0
  532. package/src/spine/lock-scope.ts +15 -1
  533. package/src/spine/mode-command-gate.ts +45 -0
  534. package/src/spine/mode-view.ts +413 -0
  535. package/src/spine/orbit-patches.ts +12 -0
  536. package/src/spine/orbit-speed.ts +31 -0
  537. package/src/spine/orbit-states.ts +346 -0
  538. package/src/spine/orbit-trajectory.ts +123 -49
  539. package/src/spine/orbital-solve.ts +224 -88
  540. package/src/spine/overlay-context.ts +136 -0
  541. package/src/spine/own-craft-vantage.tsx +9 -3
  542. package/src/spine/patch-chain.ts +55 -6
  543. package/src/spine/path-source-state.ts +285 -0
  544. package/src/spine/path-source.ts +34 -0
  545. package/src/spine/phase-angle.ts +1 -12
  546. package/src/spine/plan.ts +98 -0
  547. package/src/spine/pressure-profile.ts +58 -0
  548. package/src/spine/provider-arc.ts +245 -0
  549. package/src/spine/provider-declines.ts +40 -0
  550. package/src/spine/provider-orbit-solver.ts +67 -0
  551. package/src/spine/provider-patches.ts +145 -0
  552. package/src/spine/reference-frame.ts +64 -28
  553. package/src/spine/replay-recorder.ts +21 -1
  554. package/src/spine/replay-session.tsx +7 -47
  555. package/src/spine/replay-transport.ts +33 -19
  556. package/src/spine/screen-mode.ts +158 -0
  557. package/src/spine/screen.tsx +29 -0
  558. package/src/spine/slot-ids.ts +11 -0
  559. package/src/spine/soi-exit.ts +37 -0
  560. package/src/spine/state-at-epoch.ts +51 -0
  561. package/src/spine/telemetry-overlay.tsx +55 -0
  562. package/src/spine/timeline-store.ts +207 -8
  563. package/src/spine/uplink-health.ts +9 -0
  564. package/src/spine/use-command.ts +29 -4
  565. package/src/spine/use-events.ts +88 -0
  566. package/src/spine/use-orbit-solve-at.ts +62 -0
  567. package/src/spine/use-orbit-trajectory.ts +342 -15
  568. package/src/spine/use-patch-chain.ts +106 -11
  569. package/src/spine/use-phase-angle.ts +117 -21
  570. package/src/spine/use-processor.ts +28 -3
  571. package/src/spine/use-stream.ts +3 -6
  572. package/src/spine/use-telemetry.ts +2 -6
  573. package/src/spine/vector-parts.ts +23 -0
  574. package/src/spine/vector.ts +59 -0
  575. package/src/testing/body-ephemeris-stand-in.ts +53 -0
  576. package/src/testing/index.ts +14 -1
  577. package/src/testing/legacy-orbit-solve.ts +56 -0
  578. package/src/{spine/powered-reckoning.ts → testing/legacy-powered-reckoning.ts} +13 -131
  579. package/src/testing/legacy-reckoners.ts +954 -0
  580. package/src/{spine/target-range-reckoning.ts → testing/legacy-target-range-reckoning.ts} +5 -5
  581. package/src/testing/orbit-live-run-stand-in.ts +45 -0
  582. package/src/testing/path-source-stand-in.ts +110 -0
  583. package/src/testing/recorded-live-run.ts +23 -0
  584. package/src/testing/render.tsx +3 -3
  585. package/src/testing/stream-fixture.tsx +13 -0
  586. package/src/testing/theme.ts +37 -8
  587. package/src/unit-system/definitions.ts +11 -0
  588. package/src/unit-system/registry.ts +21 -0
  589. package/src/uplink-load.ts +6 -0
  590. package/src/uplink-manifest.ts +34 -3
  591. package/dist/spine/powered-reckoning.d.ts.map +0 -1
  592. package/dist/spine/powered-reckoning.js.map +0 -1
  593. package/dist/spine/replay-session-controller.d.ts +0 -73
  594. package/dist/spine/replay-session-controller.d.ts.map +0 -1
  595. package/dist/spine/replay-session-controller.js +0 -253
  596. package/dist/spine/replay-session-controller.js.map +0 -1
  597. package/dist/spine/target-range-reckoning.d.ts.map +0 -1
  598. package/dist/spine/target-range-reckoning.js.map +0 -1
  599. package/src/spine/replay-session-controller.ts +0 -317
@@ -159,6 +159,14 @@ const ANSWERED_COMMAND_CAP = 256;
159
159
  /** The record count at which the oldest answered commands are dropped, set above the cap so a sweep runs once per many dispatches and not on each. */
160
160
  const ANSWERED_COMMAND_SWEEP_AT = 2 * ANSWERED_COMMAND_CAP;
161
161
 
162
+ /*
163
+ * The most characters of replies, as JSON, the records of confirmed commands
164
+ * hold together. A simulation asks hundreds of commands whose replies run to
165
+ * hundreds of kilobytes, so a count alone would keep a great deal more than a
166
+ * reader of a command's status needs.
167
+ */
168
+ const ANSWERED_REPLIES_MOST = 4_000_000;
169
+
162
170
  /**
163
171
  * The phases nothing further can happen to. A command still in flight awaits
164
172
  * its reply, and one reported lost can still be found, so neither is here.
@@ -350,6 +358,48 @@ export interface OutstandingCommandStore {
350
358
  */
351
359
  export const OUTSTANDING_COMMAND_CAP = 256;
352
360
 
361
+ /*
362
+ * The longest arguments, as JSON, an outstanding command is stored with. The
363
+ * list is written whole on every change to it, so a stream of commands with
364
+ * large arguments, such as a simulation's states, would write their whole size
365
+ * many times over. A claim needs only the request id, and the arguments only
366
+ * name what was sent.
367
+ */
368
+ const STORED_ARGS_MOST = 4_096;
369
+
370
+ /*
371
+ * True when `value` written as JSON is at most `most` characters, give or
372
+ * take its punctuation. It is asked of every command, and a simulation's
373
+ * arguments run to megabytes, so it counts as it walks and stops once past
374
+ * `most` rather than writing them out.
375
+ */
376
+ function writesWithin(value: unknown, most: number): boolean {
377
+ return writtenSize(value, most) <= most;
378
+ }
379
+
380
+ /* About how many characters `value` writes as JSON, or just past `most` once it is past it, so a reply of megabytes is not walked whole. */
381
+ function writtenSize(value: unknown, most: number): number {
382
+ let left = most;
383
+ const walk = (v: unknown): boolean => {
384
+ left -= sizeOfOwn(v);
385
+ if (left < 0 || typeof v !== "object" || v === null) return left >= 0;
386
+ if (Array.isArray(v)) return v.every(walk);
387
+ for (const k of Object.keys(v)) {
388
+ left -= k.length + 3;
389
+ if (left < 0 || !walk(Reflect.get(v, k))) return false;
390
+ }
391
+ return left >= 0;
392
+ };
393
+ return walk(value) ? most - left : most + 1;
394
+ }
395
+
396
+ /* What `v` adds to its JSON before anything it holds: a string's characters and quotes, a number's few digits, a bracket pair. */
397
+ function sizeOfOwn(v: unknown): number {
398
+ if (typeof v === "string") return v.length + 2;
399
+ if (typeof v === "number" || typeof v === "boolean") return 8;
400
+ return typeof v === "object" && v !== null ? 2 : 0;
401
+ }
402
+
353
403
  /**
354
404
  * Construction options for the Sitrep client: the prefix of the request ids it
355
405
  * mints and where it keeps its outstanding commands. Taken by `TelemetryClient`.
@@ -376,22 +426,37 @@ function randomIdPrefix(): string {
376
426
  */
377
427
  const UNKNOWN_CRAFT_ID = "unknown";
378
428
 
429
+ /** The vessel id a `ksp.activeVessel` or `vessel.identity` payload names, or `undefined` for one that names none. */
430
+ function vesselIdOf(payload: unknown): string | undefined {
431
+ if (typeof payload !== "object" || payload === null) return undefined;
432
+ if (!("vesselId" in payload)) return undefined;
433
+ const id = payload.vesselId;
434
+ return typeof id === "string" && id !== "" ? id : undefined;
435
+ }
436
+
379
437
  /**
380
438
  * The vessel the operator's screen shows as active, as the optional
381
- * `seenVesselId` of a command frame. Nothing when no `vessel.identity` reading
382
- * has ever arrived; {@link UNKNOWN_CRAFT_ID} when one has arrived and been
383
- * withdrawn. The mod refuses an order for the active vessel when the game has
384
- * since switched to another one.
439
+ * `seenVesselId` of a command frame. The mod refuses an order for the active
440
+ * vessel when the game has since switched to another one.
441
+ *
442
+ * The game's own statement of the active vessel (`ksp.activeVessel`) is the
443
+ * one the screen names the craft by and it arrives with no signal delay, so
444
+ * it is the vessel seen whenever it names one. `vessel.identity` is the
445
+ * craft's own telemetry and can be seconds or minutes behind it after a
446
+ * switch. Without the game's statement the newest `vessel.identity` reading
447
+ * stands: nothing when none has ever arrived, {@link UNKNOWN_CRAFT_ID} when
448
+ * one has arrived and been withdrawn.
385
449
  */
386
450
  function seenVessel(
451
+ active: unknown,
387
452
  identity: unknown,
388
453
  read: boolean,
389
454
  ): { seenVesselId?: string } {
455
+ const shown = vesselIdOf(active);
456
+ if (shown !== undefined) return { seenVesselId: shown };
390
457
  if (identity === null && read) return { seenVesselId: UNKNOWN_CRAFT_ID };
391
- if (typeof identity !== "object" || identity === null) return {};
392
- if (!("vesselId" in identity)) return {};
393
- const id = identity.vesselId;
394
- return typeof id === "string" && id !== "" ? { seenVesselId: id } : {};
458
+ const id = vesselIdOf(identity);
459
+ return id !== undefined ? { seenVesselId: id } : {};
395
460
  }
396
461
 
397
462
  type SampleFrame = Extract<
@@ -474,6 +539,10 @@ export class TelemetryClient {
474
539
  private readonly unsubscribeFromLost: () => void;
475
540
  private readonly commands = new Map<string, PendingCommand>();
476
541
  private readonly heldCommands = new Map<string, number>();
542
+ /** About how many characters of JSON the reply on each confirmed command's record writes, by request id. */
543
+ private readonly replySizes = new Map<string, number>();
544
+ /** The sum of `replySizes`. */
545
+ private answeredReplies = 0;
477
546
  private readonly outstandingStore: OutstandingCommandStore | undefined;
478
547
  private outstandingDirty = false;
479
548
  private lastOutstanding = "";
@@ -499,7 +568,9 @@ export class TelemetryClient {
499
568
  */
500
569
  private readonly stores = new Set<TimelineStore>();
501
570
  /** The game UT of the newest frame, with the reading of the client's clock it arrived at and its timeline. */
502
- private gameClock: { ut: number; at: number; epoch: number } | undefined;
571
+ private gameClock:
572
+ | { ut: number; at: number; epoch: number; seq?: number }
573
+ | undefined;
503
574
  /**
504
575
  * Whether the newest `time.warp` said the game is paused. A paused game can
505
576
  * go quiet on every channel, so its UT is held still rather than carried
@@ -520,9 +591,15 @@ export class TelemetryClient {
520
591
  private newestDelivered:
521
592
  | { ut: number; epoch: number; seq: number | undefined }
522
593
  | undefined;
523
- /** How far the client's timeline epoch runs ahead of the wire's, for rewinds the mod did not announce with a new epoch. */
524
- private epochShift = 0;
594
+ /**
595
+ * How many rewinds the client has inferred on the mod's current epoch. They
596
+ * lie between that epoch and the next, so an inference can never take the
597
+ * number the mod's next timeline arrives under.
598
+ */
599
+ private inferredRewinds = 0;
525
600
  private lastWireEpoch = 0;
601
+ /** What the mod's newest timeline reset kept: readings of an older epoch validated later than this are of the timeline it abandoned. */
602
+ private newestReset: { epoch: number; keptThroughUt: number } | undefined;
526
603
  /** The mod's run this client last heard from, empty until it has. */
527
604
  private wireBootId = "";
528
605
  private readonly timelineListeners = new Set<() => void>();
@@ -604,6 +681,7 @@ export class TelemetryClient {
604
681
  this.followTimeline(incoming);
605
682
  const message = replayed ? incoming : this.followRewind(incoming);
606
683
  if (message.type === "stream-data") this.restoreUnchanged(message);
684
+ if (!replayed && this.isOfAnAbandonedTimeline(incoming)) return;
607
685
  const asSent = stampedAsSent(message, incoming);
608
686
  for (const listener of this.rawMessageListeners) listener(asSent);
609
687
  this.handleMessage(message, replayed);
@@ -749,7 +827,10 @@ export class TelemetryClient {
749
827
  list.push({
750
828
  requestId,
751
829
  command: pending.command,
752
- args: pending.args,
830
+ args:
831
+ pending.restored || writesWithin(pending.args, STORED_ARGS_MOST)
832
+ ? pending.args
833
+ : undefined,
753
834
  label: pending.label,
754
835
  replyDueUt: pending.replyDueUt,
755
836
  });
@@ -1517,11 +1598,32 @@ export class TelemetryClient {
1517
1598
  if (!FINAL_PHASES.has(pending.status.phase)) continue;
1518
1599
  if (this.heldCommands.has(requestId)) continue;
1519
1600
  if (pending.awaitingDelay) this.awaitingDelayCount -= 1;
1601
+ this.answeredReplies -= this.replySizes.get(requestId) ?? 0;
1602
+ this.replySizes.delete(requestId);
1520
1603
  this.commands.delete(requestId);
1521
1604
  excess -= 1;
1522
1605
  }
1523
1606
  }
1524
1607
 
1608
+ /**
1609
+ * Drops the records of the oldest confirmed commands while the replies they
1610
+ * hold come to more than {@link ANSWERED_REPLIES_MOST}. A command still
1611
+ * waiting, a refused one, one a reader holds, and `newest` keep theirs.
1612
+ */
1613
+ private dropOldestReplies(newest: string): void {
1614
+ if (this.answeredReplies <= ANSWERED_REPLIES_MOST) return;
1615
+ for (const [requestId, pending] of this.commands) {
1616
+ if (this.answeredReplies <= ANSWERED_REPLIES_MOST) return;
1617
+ const size = this.replySizes.get(requestId);
1618
+ if (pending.status.phase !== "confirmed" || !size) continue;
1619
+ if (requestId === newest || this.heldCommands.has(requestId)) continue;
1620
+ if (pending.awaitingDelay) this.awaitingDelayCount -= 1;
1621
+ this.answeredReplies -= size;
1622
+ this.replySizes.delete(requestId);
1623
+ this.commands.delete(requestId);
1624
+ }
1625
+ }
1626
+
1525
1627
  /**
1526
1628
  * Keeps the records of these commands past the sweep of answered ones, for a
1527
1629
  * reader that reports their status later (a group of commands). Returns the
@@ -1632,6 +1734,8 @@ export class TelemetryClient {
1632
1734
  this.unownedListeners.clear();
1633
1735
  this.subscriberLabels.clear();
1634
1736
  this.commands.clear();
1737
+ this.answeredReplies = 0;
1738
+ this.replySizes.clear();
1635
1739
  this.awaitingDelayCount = 0;
1636
1740
  this.stores.clear();
1637
1741
  }
@@ -1691,13 +1795,15 @@ export class TelemetryClient {
1691
1795
  */
1692
1796
  private restoreUnchanged(message: StreamData<unknown>): void {
1693
1797
  const { unchanged } = message;
1694
- if (unchanged !== undefined && unchanged.length > 0) {
1798
+ /* A frame relayed over PeerJS carries `unchanged: null` when none was named, because the wire packs an absent field as null. */
1799
+ if (unchanged != null && unchanged.length > 0) {
1695
1800
  fillUnchangedFields(
1696
1801
  message.payload,
1697
1802
  unchanged,
1698
1803
  this.lastDeliveredWithHeldFields.get(message.topic),
1699
1804
  );
1700
- message.unchanged = undefined;
1805
+ /* Deleted, not set to undefined: the frame is relayed on, and the wire would turn an undefined field into null. */
1806
+ delete message.unchanged;
1701
1807
  }
1702
1808
  if (fieldsSentOnChange(message.topic).length > 0) {
1703
1809
  this.lastDeliveredWithHeldFields.set(message.topic, message.payload);
@@ -2043,6 +2149,7 @@ export class TelemetryClient {
2043
2149
  : (this.gameUtNow() ?? anchor.ut),
2044
2150
  at: this.clock.now(),
2045
2151
  epoch,
2152
+ seq: anchor.seq,
2046
2153
  };
2047
2154
  }
2048
2155
  this.gamePaused = paused;
@@ -2052,13 +2159,14 @@ export class TelemetryClient {
2052
2159
  * Gives a live sample the timeline epoch the client holds it under.
2053
2160
  *
2054
2161
  * A quickload or revert starts a new timeline, which the mod announces with
2055
- * a higher epoch. When a load was seen and the next live sample's UT is
2056
- * behind the game's UT already seen on the same epoch, no epoch came, and
2057
- * the sample is the new timeline: the client bumps its own epoch so every
2058
- * store and the view clock drop the abandoned one. The game's own load is
2059
- * what tells this apart from samples that merely arrive out of order within
2060
- * one timeline, which are still refused. A later epoch from the mod is
2061
- * absorbed into the shift so the two never add up.
2162
+ * a higher epoch, and that epoch decides. Only when a load has ended with no
2163
+ * new epoch, and a live sample's UT is behind the game's UT already seen on
2164
+ * the same epoch, is the sample taken as a new timeline: the client moves to
2165
+ * an epoch of its own, after the mod's and before the mod's next, so every
2166
+ * store and the view clock drop the abandoned one and the mod's next epoch
2167
+ * still replaces it. While a load runs nothing is inferred, because the mod
2168
+ * announces its epoch before it says the game is ready and the frames of both
2169
+ * timelines can be interleaved until then.
2062
2170
  */
2063
2171
  private followRewind(message: ServerMessage): ServerMessage {
2064
2172
  if (message.type !== "stream-data" && message.type !== "stream-binary") {
@@ -2067,7 +2175,7 @@ export class TelemetryClient {
2067
2175
  const meta = message.meta;
2068
2176
  const wire = meta.timelineEpoch ?? 0;
2069
2177
  this.absorbWireEpoch(wire);
2070
- let epoch = wire + this.epochShift;
2178
+ let epoch = this.heldEpoch(wire);
2071
2179
  /*
2072
2180
  * Behind what has actually been delivered on this timeline, not behind the
2073
2181
  * clock's estimate of the game's UT. The estimate runs on through a dialog
@@ -2101,10 +2209,10 @@ export class TelemetryClient {
2101
2209
  epoch === delivered.epoch &&
2102
2210
  Number.isFinite(meta.deliveredAt) &&
2103
2211
  meta.deliveredAt < delivered.ut - REWIND_TOLERANCE_SECONDS;
2104
- const rewound = this.loadSinceLastSample && behind;
2212
+ const rewound = this.loadSinceLastSample && !this.gameLoading && behind;
2105
2213
  if (rewound) {
2106
- this.epochShift += 1;
2107
- epoch += 1;
2214
+ this.inferredRewinds += 1;
2215
+ epoch = this.heldEpoch(wire);
2108
2216
  /* 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. */
2109
2217
  console.warn(
2110
2218
  `[sitrep] read a load as a rewind from ${message.topic} (source ${String(meta.source)}, ` +
@@ -2115,8 +2223,8 @@ export class TelemetryClient {
2115
2223
  if (
2116
2224
  Number.isFinite(meta.deliveredAt) &&
2117
2225
  (delivered === undefined ||
2118
- epoch !== delivered.epoch ||
2119
- meta.deliveredAt > delivered.ut)
2226
+ epoch > delivered.epoch ||
2227
+ (epoch === delivered.epoch && meta.deliveredAt > delivered.ut))
2120
2228
  ) {
2121
2229
  this.newestDelivered = {
2122
2230
  ut: meta.deliveredAt,
@@ -2131,6 +2239,30 @@ export class TelemetryClient {
2131
2239
  return { ...message, meta: { ...meta, timelineEpoch: epoch } };
2132
2240
  }
2133
2241
 
2242
+ /** The epoch the client holds a frame of the mod's epoch `wire` under. */
2243
+ private heldEpoch(wire: number): number {
2244
+ return wire === this.lastWireEpoch
2245
+ ? wire + this.inferredRewinds / (this.inferredRewinds + 1)
2246
+ : wire;
2247
+ }
2248
+
2249
+ /**
2250
+ * Whether a live sample is of the timeline the mod's newest reset abandoned.
2251
+ * What the reset kept is the new timeline's own past, whatever epoch it was
2252
+ * recorded under, so a sample from no later than that is still taken.
2253
+ */
2254
+ private isOfAnAbandonedTimeline(message: ServerMessage): boolean {
2255
+ if (message.type !== "stream-data" && message.type !== "stream-binary") {
2256
+ return false;
2257
+ }
2258
+ const reset = this.newestReset;
2259
+ return (
2260
+ reset !== undefined &&
2261
+ (message.meta.timelineEpoch ?? 0) < reset.epoch &&
2262
+ message.meta.validAt > reset.keptThroughUt
2263
+ );
2264
+ }
2265
+
2134
2266
  /**
2135
2267
  * Learns the mod's run and timeline from the frames that carry them outside a
2136
2268
  * sample. A quiet connection hears no stream data after a load, so without
@@ -2144,7 +2276,16 @@ export class TelemetryClient {
2144
2276
  return;
2145
2277
  }
2146
2278
  if (message.type === "event" && message.name === "timeline-reset") {
2147
- this.absorbWireEpoch(message.meta.timelineEpoch ?? 0);
2279
+ const epoch = message.meta.timelineEpoch ?? 0;
2280
+ this.absorbWireEpoch(epoch);
2281
+ if (epoch >= (this.newestReset?.epoch ?? 0)) {
2282
+ const kept: unknown = message.keptThroughUt;
2283
+ this.newestReset = {
2284
+ epoch,
2285
+ keptThroughUt:
2286
+ typeof kept === "number" ? kept : Number.NEGATIVE_INFINITY,
2287
+ };
2288
+ }
2148
2289
  }
2149
2290
  }
2150
2291
 
@@ -2155,23 +2296,21 @@ export class TelemetryClient {
2155
2296
  this.wireBootId = bootId;
2156
2297
  if (!restarted) return;
2157
2298
  this.lastWireEpoch = 0;
2158
- this.epochShift = 0;
2299
+ this.inferredRewinds = 0;
2300
+ this.newestReset = undefined;
2301
+ this.newestDelivered = undefined;
2159
2302
  this.notifyTimeline();
2160
2303
  }
2161
2304
 
2162
- /** Takes a wire epoch, absorbing a rewind the client had inferred for itself into the shift so the two never add up. */
2305
+ /** Takes a wire epoch, which replaces any rewind the client had inferred for itself. */
2163
2306
  private absorbWireEpoch(wire: number): void {
2164
2307
  if (wire <= this.lastWireEpoch) return;
2165
- this.epochShift = Math.max(
2166
- 0,
2167
- this.epochShift - (wire - this.lastWireEpoch),
2168
- );
2308
+ this.inferredRewinds = 0;
2169
2309
  this.lastWireEpoch = wire;
2170
2310
  /*
2171
2311
  * The mod has announced the timeline the load started, so the load needs no
2172
2312
  * inferring. Left set, a frame delayed to an earlier UT than another on the
2173
- * new epoch reads as a second rewind and the client ends one epoch ahead of
2174
- * every frame the mod sends.
2313
+ * new epoch reads as a second rewind.
2175
2314
  */
2176
2315
  this.loadSinceLastSample = false;
2177
2316
  this.notifyTimeline();
@@ -2205,6 +2344,7 @@ export class TelemetryClient {
2205
2344
  seenBootId: this.wireBootId,
2206
2345
  seenEpoch: this.lastWireEpoch,
2207
2346
  ...seenVessel(
2347
+ this.lastValues.get("ksp.activeVessel"),
2208
2348
  this.lastValues.get("vessel.identity"),
2209
2349
  this.lastValues.has("vessel.identity"),
2210
2350
  ),
@@ -2218,7 +2358,12 @@ export class TelemetryClient {
2218
2358
  const anchor = this.gameClock;
2219
2359
  const ut = this.gameUtNow();
2220
2360
  if (anchor && ut !== undefined) {
2221
- this.gameClock = { ut, at: this.clock.now(), epoch: anchor.epoch };
2361
+ this.gameClock = {
2362
+ ut,
2363
+ at: this.clock.now(),
2364
+ epoch: anchor.epoch,
2365
+ seq: anchor.seq,
2366
+ };
2222
2367
  }
2223
2368
  this.gameLoading = loading;
2224
2369
  }
@@ -2258,10 +2403,31 @@ export class TelemetryClient {
2258
2403
  const epoch = meta.timelineEpoch ?? 0;
2259
2404
  const prior = this.gameClock;
2260
2405
  if (prior && epoch < prior.epoch) return;
2261
- if (prior && epoch === prior.epoch && ut < prior.ut) return;
2406
+ const seq = Number.isFinite(meta.seq) ? meta.seq : undefined;
2407
+ if (prior && epoch === prior.epoch && ut < prior.ut) {
2408
+ /*
2409
+ * Earlier by more than a frame delayed from a craft's node can trail, and
2410
+ * built after the frame the estimate stands on: the game's UT went back
2411
+ * within the timeline, as it does from the editor into a flight. Held
2412
+ * where it was, the estimate would place every deadline in the past until
2413
+ * the game's UT climbed back to it.
2414
+ */
2415
+ const fromACraftsNode =
2416
+ typeof meta.source === "string" &&
2417
+ meta.source.startsWith(CRAFT_NODE_SOURCE_PREFIX);
2418
+ const builtLater =
2419
+ seq !== undefined && prior.seq !== undefined && seq > prior.seq;
2420
+ if (
2421
+ fromACraftsNode ||
2422
+ !builtLater ||
2423
+ ut >= prior.ut - REWIND_TOLERANCE_SECONDS
2424
+ ) {
2425
+ return;
2426
+ }
2427
+ }
2262
2428
  /* A new timeline has its own pause state, which its own `time.warp` will say. */
2263
2429
  if (prior && epoch > prior.epoch) this.gamePaused = false;
2264
- this.gameClock = { ut, at: this.clock.now(), epoch };
2430
+ this.gameClock = { ut, at: this.clock.now(), epoch, seq };
2265
2431
  /* The deadlines of commands in flight are in the old timeline's UT, so the mod is asked what became of them. */
2266
2432
  if (prior && epoch > prior.epoch) this.scheduleClaim();
2267
2433
  if (prior) return;
@@ -2403,6 +2569,12 @@ export class TelemetryClient {
2403
2569
  }
2404
2570
 
2405
2571
  pending.status = { phase: "confirmed", requestId, result };
2572
+ /* Nothing reads a confirmed command's arguments again, and its record is kept with hundreds of others. */
2573
+ pending.args = undefined;
2574
+ const size = writtenSize(result, ANSWERED_REPLIES_MOST);
2575
+ this.replySizes.set(requestId, size);
2576
+ this.answeredReplies += size;
2577
+ this.dropOldestReplies(requestId);
2406
2578
  this.traceSettled(pending);
2407
2579
  resolve(result);
2408
2580
  this.notifyStore();
@@ -2623,3 +2795,20 @@ export class TelemetryClient {
2623
2795
  }
2624
2796
  }
2625
2797
  }
2798
+
2799
+ /**
2800
+ * The newest frame `client` holds of every Topic something is subscribed to,
2801
+ * each with the `Meta` it arrived with. Useful for starting a recording from
2802
+ * the state the stream is in, since a Topic the mod sends only on change may
2803
+ * not be sent again while the recording runs. Used by {@link StreamRecorder}.
2804
+ */
2805
+ export function heldFrames(client: TelemetryClient): StreamData<unknown>[] {
2806
+ /* A function beside the class and not a member of it: a member added to a published class is one more thing every stand-in for it must carry. */
2807
+ // biome-ignore lint/complexity/useLiteralKeys: reads the class's own private state from its own module
2808
+ return [...client["lastPoints"]].map(([topic, point]) => ({
2809
+ type: "stream-data",
2810
+ topic,
2811
+ payload: point.payload,
2812
+ meta: point.meta,
2813
+ }));
2814
+ }
@@ -163,10 +163,10 @@ export function firstHopPeer(
163
163
  * ground station or relay at the far end of a hop. Used by the `comms.delay`
164
164
  * reckoner.
165
165
  *
166
- * A ground-station endpoint joins to `commandCentre.roster` by display name,
167
- * because a hop carries the station's own name where a roster entry carries
168
- * `"ground:<name>"`. Two stations sharing a name have one hop id, so they
169
- * cannot be told apart.
166
+ * A ground-station endpoint joins to `commandCentre.roster` by id: a hop names
167
+ * a station by its centre id without `"ground:"`, so the entry is the one whose
168
+ * id is `"ground:" + endpoint.id`. The entry's display name is never the join,
169
+ * since it can be localised and two stations can share one.
170
170
  *
171
171
  * A relay endpoint is placed by `orbitOf`, called with the bare vessel guid
172
172
  * the hop carries.
@@ -177,7 +177,7 @@ export function locateCommsPeer(
177
177
  orbitOf: (vesselId: string) => CommsPeerOrbit | undefined,
178
178
  ): CommsPeerLocation | null {
179
179
  if (endpoint.isHome) {
180
- const entry = roster?.find((e) => e.displayName === endpoint.id);
180
+ const entry = roster?.find((e) => e.id === `ground:${endpoint.id}`);
181
181
  if (entry == null || entry.bodyIndex == null) return null;
182
182
  const lat = magnitudeOr(entry.latitude, Number.NaN);
183
183
  const lon = magnitudeOr(entry.longitude, Number.NaN);
@@ -30,6 +30,7 @@ import {
30
30
  LATE_ARRIVAL_DETAIL,
31
31
  LATE_ARRIVAL_ERROR_CODE,
32
32
  } from "./arrival-deadline";
33
+ import { BODY_EPHEMERIS } from "./body-ephemeris";
33
34
  import type { TelemetryClient } from "./client";
34
35
  import { noteUndeclaredRead } from "./contribution-scope";
35
36
  import { registerCoreReckoners } from "./core-reckoners";
@@ -42,6 +43,7 @@ import {
42
43
  import { commandDelayed } from "./map-command";
43
44
  import { DYNAMIC_WHOLE_TOPIC_PREFIXES, resolveValueTopic } from "./map-topic";
44
45
  import { type OrbitalSolve, solveSelfOrbit } from "./orbital-solve";
46
+ import { useTelemetryOverlay } from "./overlay-context";
45
47
  import { OwnCraftDelayGate } from "./own-craft-vantage";
46
48
  import { processorRuntimeFor } from "./processorEvaluator";
47
49
  import {
@@ -50,6 +52,7 @@ import {
50
52
  type PublishedProcessorDefinition,
51
53
  publishedDefinitionOf,
52
54
  } from "./processors";
55
+ import { getReckonedTopics } from "./reckoners";
53
56
  import { StreamRecorder, type StreamRecorderOptions } from "./replay-recorder";
54
57
  import { SPACE_CENTER_STATE } from "./space-center-state";
55
58
  import { type ReadTopicResolver, subscribeTopicRead } from "./subscribe-read";
@@ -170,11 +173,12 @@ export function TelemetryProvider({
170
173
  publishProcessorsOn(built);
171
174
  /*
172
175
  * Core's own forward models, through the same registry an Uplink's go
173
- * through. Idempotent, and re-asserted here rather than left to the module
174
- * side effect alone so a suite that cleared the registry between tests gets
175
- * the vanilla back with its store.
176
+ * through. Re-asserted here rather than left to the module side effect
177
+ * alone so a suite that cleared the registry between tests gets the
178
+ * vanilla back with its store, and only into an empty registry so a model
179
+ * a suite put there on purpose is the one that answers.
176
180
  */
177
- registerCoreReckoners();
181
+ if (getReckonedTopics().length === 0) registerCoreReckoners();
178
182
  return { store: built, delayAuthority: authority, warp: warpSlope };
179
183
  }, [providedStore, client]);
180
184
 
@@ -354,9 +358,17 @@ export function TelemetryProvider({
354
358
  // `scheduled` gate, so an ingest and a tick in one animation frame still
355
359
  // mint one frame between them, and the ingest path is untouched.
356
360
  const unsubscribeClock = store.clock.onFrame(scheduleBeginFrame);
361
+ // A provider's answer about the bodies changes what the poses compute to, and arrives on no stream.
362
+ const unsubscribeEphemeris = BODY_EPHEMERIS.subscribe(scheduleBeginFrame);
363
+ // A load or revert starts another timeline, in which the provider may place a body it refused in this one.
364
+ const unsubscribeTimeline = client.onTimelineChange(() =>
365
+ BODY_EPHEMERIS.clear(),
366
+ );
357
367
  return () => {
358
368
  unsubscribe();
359
369
  unsubscribeClock();
370
+ unsubscribeEphemeris();
371
+ unsubscribeTimeline();
360
372
  cancelScheduled?.();
361
373
  };
362
374
  }, [client, store]);
@@ -589,7 +601,8 @@ function removeLast<Item>(stack: Item[], item: Item): void {
589
601
 
590
602
  export function useViewClock(): ViewClockView {
591
603
  // gonogo:reads none
592
- return useTelemetryStore().clock;
604
+ const live = useTelemetryStore();
605
+ return (useTelemetryOverlay()?.store ?? live).clock;
593
606
  }
594
607
 
595
608
  /**
@@ -603,7 +616,8 @@ export function useViewClock(): ViewClockView {
603
616
  */
604
617
  export function useViewClockOptional(): ViewClockView | undefined {
605
618
  // gonogo:reads none
606
- return useTelemetryStoreOptional()?.clock;
619
+ const live = useTelemetryStoreOptional();
620
+ return (useTelemetryOverlay()?.store ?? live)?.clock;
607
621
  }
608
622
 
609
623
  /**
@@ -1038,6 +1052,21 @@ export function getVesselTarget(): VesselTarget | undefined {
1038
1052
  return sampleActiveTopic<VesselTarget>("vessel.target");
1039
1053
  }
1040
1054
 
1055
+ /**
1056
+ * The game time `vessel.target` was observed at, or the time a held reading is
1057
+ * as of, as a single read for a caller that cannot use hooks. Useful for asking
1058
+ * where the target was on its orbit at the instant its own figures are for.
1059
+ * Used by the maneuver-trigger services. Undefined with no reading.
1060
+ */
1061
+ export function getVesselTargetAt(): Value<"ut"> | undefined {
1062
+ if (!activeTimelineStore) return undefined;
1063
+ const reading =
1064
+ activeTimelineStore.sampleReading<VesselTarget>("vessel.target");
1065
+ if (reading.state === "observed") return reading.atUt;
1066
+ if (reading.state === "held") return reading.asOfUt;
1067
+ return undefined;
1068
+ }
1069
+
1041
1070
  /**
1042
1071
  * The vessel's name, type, situation and parent body index from
1043
1072
  * `vessel.identity`, as a single read for a caller that cannot use hooks.