@voltro/plugin-rooms 0.0.0-stage → 0.88.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.
Files changed (495) hide show
  1. package/CHANGELOG.md +24492 -0
  2. package/LICENSE +61 -0
  3. package/README.md +9204 -2
  4. package/SECURITY.md +56 -0
  5. package/THIRD-PARTY-NOTICES.md +12496 -0
  6. package/dist/actor.js +1473 -0
  7. package/dist/apiBinding.js +677 -0
  8. package/dist/apiRegistryBinding.js +398 -0
  9. package/dist/apiReservations.js +432 -0
  10. package/dist/baselines.js +72 -0
  11. package/dist/bots.d.ts +1485 -0
  12. package/dist/bots.js +562 -0
  13. package/dist/catalog.js +79 -0
  14. package/dist/checkpointJson.js +23 -0
  15. package/dist/checkpointStore.js +385 -0
  16. package/dist/client.js +55 -0
  17. package/dist/clockSync.js +50 -0
  18. package/dist/collision.js +155 -0
  19. package/dist/commandDelivery.js +100 -0
  20. package/dist/commandRecord.js +10 -0
  21. package/dist/commandWithdrawal.js +182 -0
  22. package/dist/connection.js +496 -0
  23. package/dist/controlCarrier.js +374 -0
  24. package/dist/controlRegistry.js +78 -0
  25. package/dist/controlTarget.js +44 -0
  26. package/dist/controlTransport.js +573 -0
  27. package/dist/developmentBinding.js +112 -0
  28. package/dist/directory.js +322 -0
  29. package/dist/directoryProjection.js +116 -0
  30. package/dist/errors.d.ts +125 -0
  31. package/dist/errors.js +52 -0
  32. package/dist/fixed.d.ts +284 -0
  33. package/dist/fixed.js +10 -0
  34. package/dist/fixed32.js +133 -0
  35. package/dist/fixedCollision.js +59 -0
  36. package/dist/fixedCollision32.js +108 -0
  37. package/dist/fixedMath.js +55 -0
  38. package/dist/fixedRaw.js +10 -0
  39. package/dist/fixedSlabs.js +33 -0
  40. package/dist/fixedTrig.js +47 -0
  41. package/dist/fixedTrig32.js +37 -0
  42. package/dist/fixedVectors.js +112 -0
  43. package/dist/fixedVectors32.js +94 -0
  44. package/dist/fixedWide.js +49 -0
  45. package/dist/fixedWords.js +45 -0
  46. package/dist/gateway.js +56 -0
  47. package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.server.tsx +4 -0
  48. package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.tsx +14 -0
  49. package/dist/geometry-worker/worker.d.mts +2 -0
  50. package/dist/geometry-worker/worker.mjs +50 -0
  51. package/dist/geometry.d.ts +2249 -0
  52. package/dist/geometry.js +40 -0
  53. package/dist/geometryActivation.js +81 -0
  54. package/dist/geometryActorInventory.js +107 -0
  55. package/dist/geometryAdminClient.js +86 -0
  56. package/dist/geometryAdminData.js +31 -0
  57. package/dist/geometryAdminFixtures.js +49 -0
  58. package/dist/geometryAdminPorts.js +4 -0
  59. package/dist/geometryAdminRpc.js +57 -0
  60. package/dist/geometryAdminRpcRoutes.js +48 -0
  61. package/dist/geometryAdminSchemas.js +38 -0
  62. package/dist/geometryAdministration.js +189 -0
  63. package/dist/geometryAdministrationPorts.js +4 -0
  64. package/dist/geometryApiBinding.js +164 -0
  65. package/dist/geometryAppStorage.js +57 -0
  66. package/dist/geometryArtifacts.js +197 -0
  67. package/dist/geometryAssetBundle.js +116 -0
  68. package/dist/geometryAssetClient.js +24 -0
  69. package/dist/geometryAssetData.js +105 -0
  70. package/dist/geometryAssetHttp.js +122 -0
  71. package/dist/geometryAssetPorts.js +4 -0
  72. package/dist/geometryAssetRpc.js +29 -0
  73. package/dist/geometryAssetRpcRoutes.js +39 -0
  74. package/dist/geometryAssetStorageGrant.js +102 -0
  75. package/dist/geometryBoxOverlap.js +109 -0
  76. package/dist/geometryCatalogueDigest.js +110 -0
  77. package/dist/geometryCellCoverage.js +84 -0
  78. package/dist/geometryCellLoader.js +27 -0
  79. package/dist/geometryChannel.js +133 -0
  80. package/dist/geometryChunkHttp.js +53 -0
  81. package/dist/geometryChunkLeases.js +21 -0
  82. package/dist/geometryClient.d.ts +1429 -0
  83. package/dist/geometryClient.js +148 -0
  84. package/dist/geometryClientChunks.js +329 -0
  85. package/dist/geometryClientDelta.js +24 -0
  86. package/dist/geometryClientHttp.js +36 -0
  87. package/dist/geometryClientInterest.js +108 -0
  88. package/dist/geometryClientStatic.js +33 -0
  89. package/dist/geometryCms.d.ts +763 -0
  90. package/dist/geometryCms.js +216 -0
  91. package/dist/geometryCommitCoordinator.js +240 -0
  92. package/dist/geometryCompactionFixture.js +83 -0
  93. package/dist/geometryCompactionStrategies.js +37 -0
  94. package/dist/geometryConnectionClient.js +22 -0
  95. package/dist/geometryDerivationFixtures.js +140 -0
  96. package/dist/geometryDerivationStrategies.js +26 -0
  97. package/dist/geometryDigest.js +12 -0
  98. package/dist/geometryEditChannel.js +69 -0
  99. package/dist/geometryEditIngress.js +262 -0
  100. package/dist/geometryEdits.js +365 -0
  101. package/dist/geometryEnvelope.js +40 -0
  102. package/dist/geometryGridRaycast.js +91 -0
  103. package/dist/geometryGridSweep.js +91 -0
  104. package/dist/geometryHeightfield.js +165 -0
  105. package/dist/geometryHeightfieldRaycast.js +73 -0
  106. package/dist/geometryHeightfieldSweep.js +84 -0
  107. package/dist/geometryHeightfieldVolume.js +44 -0
  108. package/dist/geometryHost.js +321 -0
  109. package/dist/geometryHostDirectory.js +206 -0
  110. package/dist/geometryHostMutations.js +136 -0
  111. package/dist/geometryHostStreams.js +123 -0
  112. package/dist/geometryHttpBody.js +75 -0
  113. package/dist/geometryHttpRoutes.js +111 -0
  114. package/dist/geometryImportGltf.js +299 -0
  115. package/dist/geometryImportLdtk.js +53 -0
  116. package/dist/geometryImportPng.js +143 -0
  117. package/dist/geometryImportPublication.js +66 -0
  118. package/dist/geometryImportTiled.js +38 -0
  119. package/dist/geometryImportTiles.js +135 -0
  120. package/dist/geometryImportVox.js +129 -0
  121. package/dist/geometryImportedSource.js +100 -0
  122. package/dist/geometryInspectEndpoint.js +247 -0
  123. package/dist/geometryInspection.js +91 -0
  124. package/dist/geometryInstall.js +120 -0
  125. package/dist/geometryJournalArchiveData.js +20 -0
  126. package/dist/geometryJournalArchiveIndex.js +329 -0
  127. package/dist/geometryJournalArchiveTable.js +20 -0
  128. package/dist/geometryJournalCompaction.js +99 -0
  129. package/dist/geometryJournalPatch.js +46 -0
  130. package/dist/geometryJournalRetention.js +111 -0
  131. package/dist/geometryJournalRetentionSchemas.js +35 -0
  132. package/dist/geometryJournalRetentionSweep.js +111 -0
  133. package/dist/geometryJournalRetentionWorkflow.js +27 -0
  134. package/dist/geometryJournalRetentionWorkflowData.js +30 -0
  135. package/dist/geometryJournalStorage.js +147 -0
  136. package/dist/geometryLoader.js +117 -0
  137. package/dist/geometryManifest.js +112 -0
  138. package/dist/geometryManifestChannel.js +92 -0
  139. package/dist/geometryManifestClient.js +121 -0
  140. package/dist/geometryManifestData.js +48 -0
  141. package/dist/geometryManifestPorts.js +4 -0
  142. package/dist/geometryManifestPublication.js +108 -0
  143. package/dist/geometryManifestSource.js +67 -0
  144. package/dist/geometryMigrationJournal.js +13 -0
  145. package/dist/geometryMigrationStrategies.js +6 -0
  146. package/dist/geometryMigrations.js +322 -0
  147. package/dist/geometryNativeMetadata.js +51 -0
  148. package/dist/geometryPatch.js +169 -0
  149. package/dist/geometryPersistence.js +448 -0
  150. package/dist/geometryPersistenceCapture.js +68 -0
  151. package/dist/geometryPersistenceData.js +139 -0
  152. package/dist/geometryPersistencePorts.js +4 -0
  153. package/dist/geometryPlayerAdmission.js +33 -0
  154. package/dist/geometryPlayerEditOwner.js +264 -0
  155. package/dist/geometryPlayerEdits.js +48 -0
  156. package/dist/geometryPrepared.js +187 -0
  157. package/dist/geometryPrivacyFence.js +23 -0
  158. package/dist/geometryProceduralPublication.js +90 -0
  159. package/dist/geometryProceduralWorker.js +163 -0
  160. package/dist/geometryPublication.js +109 -0
  161. package/dist/geometryRayAlgebra.js +115 -0
  162. package/dist/geometryReadClient.js +156 -0
  163. package/dist/geometryReadPorts.js +4 -0
  164. package/dist/geometryReadRpc.js +26 -0
  165. package/dist/geometryReadRpcRoutes.js +46 -0
  166. package/dist/geometryReliablePublication.js +81 -0
  167. package/dist/geometryReloadPorts.js +45 -0
  168. package/dist/geometryReloadSource.js +277 -0
  169. package/dist/geometryRenderCache.js +164 -0
  170. package/dist/geometryRenderLod.js +101 -0
  171. package/dist/geometryRollback.js +124 -0
  172. package/dist/geometryRollbackCoordinator.js +202 -0
  173. package/dist/geometryRollbackPorts.js +45 -0
  174. package/dist/geometryRollbackSource.js +208 -0
  175. package/dist/geometryRollbackStore.js +197 -0
  176. package/dist/geometrySchemas.js +26 -0
  177. package/dist/geometryServer.d.ts +2766 -0
  178. package/dist/geometryServer.js +62 -0
  179. package/dist/geometryShapeRaycast.js +110 -0
  180. package/dist/geometryShapeSegments.js +33 -0
  181. package/dist/geometryShapes.js +222 -0
  182. package/dist/geometrySnapshot.js +75 -0
  183. package/dist/geometrySnapshotChannel.js +159 -0
  184. package/dist/geometrySnapshotClient.js +158 -0
  185. package/dist/geometrySnapshotPreparation.js +75 -0
  186. package/dist/geometrySnapshotServer.js +190 -0
  187. package/dist/geometrySqlOwner.js +20 -0
  188. package/dist/geometryStorage.js +126 -0
  189. package/dist/geometryStorageGrant.js +68 -0
  190. package/dist/geometryStorageIdentity.js +8 -0
  191. package/dist/geometryTileArtifact.js +9 -0
  192. package/dist/geometryTileCodec.js +193 -0
  193. package/dist/geometryTileCollision.js +95 -0
  194. package/dist/geometryTileNavigation.js +127 -0
  195. package/dist/geometryTileView.js +34 -0
  196. package/dist/geometryVersionActivation.js +113 -0
  197. package/dist/geometryVersionClient.js +237 -0
  198. package/dist/geometryVersionCompare.js +39 -0
  199. package/dist/geometryVersionMigration.js +105 -0
  200. package/dist/geometryVoxel.js +252 -0
  201. package/dist/geometryWorldEntitySubject.js +31 -0
  202. package/dist/geometryWorldExtent.js +11 -0
  203. package/dist/geometryWorldMetadata.js +37 -0
  204. package/dist/geometryWorldStrategyFixtures.js +126 -0
  205. package/dist/geometryWorldView.js +306 -0
  206. package/dist/host.js +127 -0
  207. package/dist/hostBinding.js +276 -0
  208. package/dist/hostCellObservation.js +113 -0
  209. package/dist/hostClientCapacity.js +89 -0
  210. package/dist/hostCommandScope.js +63 -0
  211. package/dist/hostController.js +3093 -0
  212. package/dist/hostDeployment.js +64 -0
  213. package/dist/hostDrain.js +151 -0
  214. package/dist/hostDrainPorts.js +4 -0
  215. package/dist/hostDriver.js +178 -0
  216. package/dist/hostLane.js +287 -0
  217. package/dist/hostListener.js +78 -0
  218. package/dist/hostListenerBinding.js +18 -0
  219. package/dist/hostLoopObservation.js +89 -0
  220. package/dist/hostMetrics.js +55 -0
  221. package/dist/hostRegistryBinding.js +417 -0
  222. package/dist/hostSelection.js +15 -0
  223. package/dist/hostShutdown.js +46 -0
  224. package/dist/hostTurnObservation.js +52 -0
  225. package/dist/identities.js +3 -0
  226. package/dist/index.d.ts +8632 -0
  227. package/dist/index.js +231 -0
  228. package/dist/inputReceipts.js +62 -0
  229. package/dist/inputRedundancy.js +54 -0
  230. package/dist/inspect.js +237 -0
  231. package/dist/lockstep.d.ts +436 -0
  232. package/dist/lockstep.js +381 -0
  233. package/dist/lockstepAdmission.js +261 -0
  234. package/dist/lockstepAdmissionCodec.js +93 -0
  235. package/dist/lockstepAdmissionPorts.js +4 -0
  236. package/dist/lockstepClientSession.js +577 -0
  237. package/dist/lockstepDefinition.js +147 -0
  238. package/dist/lockstepHostLoop.js +242 -0
  239. package/dist/lockstepInitialAdmission.js +66 -0
  240. package/dist/lockstepInitialStrategyFixtures.js +44 -0
  241. package/dist/lockstepJournal.js +394 -0
  242. package/dist/lockstepJournalCodec.js +253 -0
  243. package/dist/lockstepJournalPorts.js +4 -0
  244. package/dist/lockstepJournalRebuild.js +207 -0
  245. package/dist/lockstepJournalRows.js +56 -0
  246. package/dist/lockstepMembers.js +130 -0
  247. package/dist/lockstepMessages.js +46 -0
  248. package/dist/lockstepOwnedRoom.js +763 -0
  249. package/dist/lockstepPolicies.js +83 -0
  250. package/dist/lockstepReact.js +46 -0
  251. package/dist/lockstepRecoveryTruth.js +120 -0
  252. package/dist/lockstepRosterConfig.js +31 -0
  253. package/dist/lockstepSeed.js +11 -0
  254. package/dist/lockstepSeedFixture.js +19 -0
  255. package/dist/lockstepServer.d.ts +3897 -0
  256. package/dist/lockstepServer.js +324 -0
  257. package/dist/lockstepServerConfig.js +100 -0
  258. package/dist/lockstepServerRoles.js +402 -0
  259. package/dist/lockstepServerStrategyFixtures.js +32 -0
  260. package/dist/lockstepStrategies.js +5 -0
  261. package/dist/lockstepStrategyFixtures.js +136 -0
  262. package/dist/lockstepTerminal.js +89 -0
  263. package/dist/lockstepTerminalPorts.js +4 -0
  264. package/dist/lockstepTransport.js +772 -0
  265. package/dist/lockstepTransportConfig.js +31 -0
  266. package/dist/lockstepWireRoster.js +33 -0
  267. package/dist/matchRoomProvider.js +31 -0
  268. package/dist/matchRooms.js +18 -0
  269. package/dist/membershipObserver.js +46 -0
  270. package/dist/moderation.js +97 -0
  271. package/dist/movementSpecials.js +103 -0
  272. package/dist/ownership.js +16 -0
  273. package/dist/ownershipWithdrawal.js +17 -0
  274. package/dist/pcg32.js +95 -0
  275. package/dist/ports.d.ts +1241 -0
  276. package/dist/ports.js +10 -0
  277. package/dist/quaternion.js +69 -0
  278. package/dist/react.d.ts +406 -0
  279. package/dist/react.js +108 -0
  280. package/dist/reaper-app/rooms.reaper.workflow.server.tsx +5 -0
  281. package/dist/reaper-app/rooms.reaper.workflow.tsx +13 -0
  282. package/dist/reaper.js +242 -0
  283. package/dist/reaperSchemas.js +41 -0
  284. package/dist/reaperWorkflow.js +69 -0
  285. package/dist/recovery.js +188 -0
  286. package/dist/recoverySeats.js +25 -0
  287. package/dist/replay.d.ts +273 -0
  288. package/dist/replay.js +484 -0
  289. package/dist/replayPorts.js +4 -0
  290. package/dist/replayRecording.js +66 -0
  291. package/dist/replaySchema.js +156 -0
  292. package/dist/replayStorage.d.ts +149 -0
  293. package/dist/replayStorage.js +484 -0
  294. package/dist/reservationBatch.js +421 -0
  295. package/dist/reservationSchemas.js +16 -0
  296. package/dist/reservations.js +258 -0
  297. package/dist/reservePort.js +68 -0
  298. package/dist/resolvedOptions.js +3 -0
  299. package/dist/room.d.ts +1006 -0
  300. package/dist/room.js +283 -0
  301. package/dist/roomAccessSweep.js +94 -0
  302. package/dist/roomAppCommandControl.js +58 -0
  303. package/dist/roomAuthoringStrategy.js +16 -0
  304. package/dist/roomErasure.js +197 -0
  305. package/dist/roomPoolRuntimeDefaults.js +23 -0
  306. package/dist/roomPoolSelection.js +18 -0
  307. package/dist/roomPoolTopology.js +211 -0
  308. package/dist/rpc.d.ts +551 -0
  309. package/dist/rpc.js +111 -0
  310. package/dist/rpcClient.js +151 -0
  311. package/dist/rpcRoutes.js +27 -0
  312. package/dist/runtime.js +1122 -0
  313. package/dist/schemaHistory.js +97 -0
  314. package/dist/seatStore.js +150 -0
  315. package/dist/seatStrategyFixtures.js +51 -0
  316. package/dist/seatSubject.js +31 -0
  317. package/dist/seats.js +129 -0
  318. package/dist/serverSession.js +810 -0
  319. package/dist/serverSessionConfig.js +42 -0
  320. package/dist/sessionAdmission.js +52 -0
  321. package/dist/sidecarAdmission.js +102 -0
  322. package/dist/sidecarConfig.js +115 -0
  323. package/dist/sidecarConfigPublication.js +63 -0
  324. package/dist/sidecarHostListener.js +207 -0
  325. package/dist/sidecarIpc.js +204 -0
  326. package/dist/sidecarPeer.js +309 -0
  327. package/dist/sidecarProcessPort.js +27 -0
  328. package/dist/sidecarRuntime.js +167 -0
  329. package/dist/sidecarSelection.js +141 -0
  330. package/dist/sidecarWire.js +177 -0
  331. package/dist/sidecarWrites.js +162 -0
  332. package/dist/simulation.d.ts +391 -0
  333. package/dist/simulation.js +281 -0
  334. package/dist/simulationAuthoring.js +28 -0
  335. package/dist/simulationBytes.js +26 -0
  336. package/dist/simulationConformance.js +304 -0
  337. package/dist/simulationInputHistoryCapture.js +34 -0
  338. package/dist/simulationInputHistoryWire.js +192 -0
  339. package/dist/simulationOptionsWire.js +77 -0
  340. package/dist/simulationRecoveryWire.js +133 -0
  341. package/dist/simulationReplay.js +126 -0
  342. package/dist/simulationSnapshotWire.js +111 -0
  343. package/dist/simulationState.js +177 -0
  344. package/dist/snapshotBlob.js +125 -0
  345. package/dist/snapshotBlobCleanup.js +92 -0
  346. package/dist/snapshotBlobIndex.js +37 -0
  347. package/dist/snapshotBudget.js +79 -0
  348. package/dist/snapshotChain.js +184 -0
  349. package/dist/snapshotErasure.js +171 -0
  350. package/dist/snapshotInspection.js +104 -0
  351. package/dist/snapshotSegmentBlobs.js +57 -0
  352. package/dist/snapshotUploads.js +165 -0
  353. package/dist/socketTransport.js +252 -0
  354. package/dist/spatial.js +103 -0
  355. package/dist/spectatorPolicy.js +25 -0
  356. package/dist/spectatorProducer.js +88 -0
  357. package/dist/startFailureCause.js +3 -0
  358. package/dist/stateCodec.js +657 -0
  359. package/dist/strategies.d.ts +210 -0
  360. package/dist/strategies.js +8 -0
  361. package/dist/strategiesServer.d.ts +286 -0
  362. package/dist/strategiesServer.js +11 -0
  363. package/dist/strategyFixtures.js +181 -0
  364. package/dist/streamFraming.js +121 -0
  365. package/dist/streamTransport.js +265 -0
  366. package/dist/subjectAdmission.js +49 -0
  367. package/dist/subjectPrivacy.js +280 -0
  368. package/dist/subjectPrivacyBinding.js +89 -0
  369. package/dist/systemManifest.js +181 -0
  370. package/dist/tables.js +158 -0
  371. package/dist/testHarness.js +88 -0
  372. package/dist/testing.d.ts +3684 -0
  373. package/dist/testing.js +220 -0
  374. package/dist/testingPorts.js +270 -0
  375. package/dist/testingServer.d.ts +4060 -0
  376. package/dist/testingServer.js +18 -0
  377. package/dist/transform.d.ts +692 -0
  378. package/dist/transform.js +216 -0
  379. package/dist/transform3d.js +117 -0
  380. package/dist/transformCollection.js +23 -0
  381. package/dist/transformCollection3d.js +23 -0
  382. package/dist/transformCollectionCore.js +155 -0
  383. package/dist/transformFrames.js +120 -0
  384. package/dist/transformPrediction3d.js +126 -0
  385. package/dist/transformRules.js +122 -0
  386. package/dist/transformSchemas.js +19 -0
  387. package/dist/transport.js +31 -0
  388. package/dist/transportAuthoring.js +28 -0
  389. package/dist/transportCleanup.js +21 -0
  390. package/dist/transportConformance.js +123 -0
  391. package/dist/transportConnector.js +81 -0
  392. package/dist/transportEndpoints.js +37 -0
  393. package/dist/transportsServer.d.ts +5515 -0
  394. package/dist/transportsServer.js +6 -0
  395. package/dist/viewProjection.js +15 -0
  396. package/dist/web.d.ts +2286 -0
  397. package/dist/web.js +517 -0
  398. package/dist/webTransportClient.js +172 -0
  399. package/dist/wire.d.ts +992 -0
  400. package/dist/wire.js +491 -0
  401. package/dist/withdrawalPort.js +27 -0
  402. package/dist/world.d.ts +1894 -0
  403. package/dist/world.js +332 -0
  404. package/dist/worldActorReceipts.js +47 -0
  405. package/dist/worldActorTransferSnapshot.js +13 -0
  406. package/dist/worldAdmissionPending.js +7 -0
  407. package/dist/worldBoundaryCoordinator.js +147 -0
  408. package/dist/worldCatalog.js +80 -0
  409. package/dist/worldCellAllocation.js +202 -0
  410. package/dist/worldCellDestination.js +67 -0
  411. package/dist/worldCells.js +488 -0
  412. package/dist/worldChange.js +31 -0
  413. package/dist/worldClient.js +663 -0
  414. package/dist/worldClientControl.js +140 -0
  415. package/dist/worldClientPendingInput.js +15 -0
  416. package/dist/worldClientRpc.js +132 -0
  417. package/dist/worldClientRpcRoutes.js +42 -0
  418. package/dist/worldClientSchemas.js +27 -0
  419. package/dist/worldCommands.js +139 -0
  420. package/dist/worldData.js +41 -0
  421. package/dist/worldDefaultBinding.js +376 -0
  422. package/dist/worldDefaultGroupAdmission.js +81 -0
  423. package/dist/worldDefaultGroupAppServices.js +30 -0
  424. package/dist/worldDefaultGroupCompensation.js +108 -0
  425. package/dist/worldDefaultGroupContinuation.js +95 -0
  426. package/dist/worldDefaultGroupControl.js +71 -0
  427. package/dist/worldDefaultGroupMembers.js +84 -0
  428. package/dist/worldDefaultGroups.js +20 -0
  429. package/dist/worldDefaultPending.js +78 -0
  430. package/dist/worldDefaultService.js +244 -0
  431. package/dist/worldEntities.js +2979 -0
  432. package/dist/worldEntityCodec.js +20 -0
  433. package/dist/worldEntityHandoffView.js +153 -0
  434. package/dist/worldGeometry.js +169 -0
  435. package/dist/worldGhostAdmission.js +64 -0
  436. package/dist/worldGhostDestination.js +117 -0
  437. package/dist/worldGhostGateway.js +131 -0
  438. package/dist/worldGhostHandshake.js +107 -0
  439. package/dist/worldGhostHost.js +41 -0
  440. package/dist/worldGhostIngress.js +131 -0
  441. package/dist/worldGhostNeighborhood.js +69 -0
  442. package/dist/worldGhostNeighbors.js +85 -0
  443. package/dist/worldGhostOutbound.js +109 -0
  444. package/dist/worldGhostPublisher.js +215 -0
  445. package/dist/worldGhostReceiver.js +212 -0
  446. package/dist/worldGhostSender.js +145 -0
  447. package/dist/worldGhostSocket.js +77 -0
  448. package/dist/worldGhostWire.js +171 -0
  449. package/dist/worldGroupCommand.js +48 -0
  450. package/dist/worldGroupDeadline.js +114 -0
  451. package/dist/worldGroupPreparation.js +114 -0
  452. package/dist/worldGroupReadyControl.js +127 -0
  453. package/dist/worldGroupSupervisor.js +119 -0
  454. package/dist/worldHandoffMetrics.js +58 -0
  455. package/dist/worldHandoffView.js +99 -0
  456. package/dist/worldHostSource.js +68 -0
  457. package/dist/worldInspectEndpoint.js +249 -0
  458. package/dist/worldInspection.js +108 -0
  459. package/dist/worldInstanceAdmission.js +30 -0
  460. package/dist/worldInstanceAllocation.js +115 -0
  461. package/dist/worldInstanceDestination.js +63 -0
  462. package/dist/worldInstanceExpiry.js +281 -0
  463. package/dist/worldInstanceExpirySupervisor.js +87 -0
  464. package/dist/worldInstanceLifecycle.js +102 -0
  465. package/dist/worldInstanceState.js +51 -0
  466. package/dist/worldInstances.js +477 -0
  467. package/dist/worldJoin.js +55 -0
  468. package/dist/worldLayers.js +150 -0
  469. package/dist/worldLeases.js +77 -0
  470. package/dist/worldManifest.js +24 -0
  471. package/dist/worldMovement.js +62 -0
  472. package/dist/worldPersistence.js +133 -0
  473. package/dist/worldProjection.js +220 -0
  474. package/dist/worldReact.js +109 -0
  475. package/dist/worldRecoveryActor.js +34 -0
  476. package/dist/worldReturnAnchor.js +48 -0
  477. package/dist/worldRoomHooks.js +56 -0
  478. package/dist/worldRoomPool.js +26 -0
  479. package/dist/worldRoomSteps.js +132 -0
  480. package/dist/worldSeatBinding.js +35 -0
  481. package/dist/worldServer.d.ts +6936 -0
  482. package/dist/worldServer.js +48 -0
  483. package/dist/worldSourceSeatPending.js +8 -0
  484. package/dist/worldStrategyFixtures.js +163 -0
  485. package/dist/worldTesting.js +26 -0
  486. package/dist/worldTransitionDefaults.js +197 -0
  487. package/dist/worldTransitionExecutor.js +518 -0
  488. package/dist/worldTransitionGroup.js +112 -0
  489. package/dist/worldTransitionPhysicalSteps.js +39 -0
  490. package/dist/worldTransitionResolver.js +227 -0
  491. package/dist/worldTransitionSeatGroup.js +63 -0
  492. package/dist/worldTransitionSeats.js +259 -0
  493. package/dist/worldTransitionState.js +94 -0
  494. package/dist/worldTransitions.js +100 -0
  495. package/package.json +189 -4
package/dist/room.d.ts ADDED
@@ -0,0 +1,1006 @@
1
+ import { DeclaredAccess } from '@voltro/protocol';
2
+ import { Effect } from 'effect';
3
+ import { Schema } from 'effect';
4
+
5
+ /** Validate and detach a Room's listing; keys in a stable order so equal listings compare equal. */
6
+ export declare const captureRoomListing: (room: string, value: unknown) => RoomListing;
7
+
8
+ /** Validate and detach seat attributes; keys in a stable order so equal attributes compare equal. */
9
+ export declare const captureRoomSeatAttributes: (room: string, value: unknown) => RoomSeatAttributes;
10
+
11
+ declare type CollisionBody2D = {
12
+ readonly kind: 'circle';
13
+ readonly radius: number;
14
+ } | {
15
+ readonly kind: 'aabb';
16
+ readonly halfWidth: number;
17
+ readonly halfHeight: number;
18
+ };
19
+
20
+ declare interface CollisionResult2D {
21
+ readonly transform: Transform2D;
22
+ readonly collided: ReadonlyArray<string>;
23
+ readonly iterations: number;
24
+ }
25
+
26
+ /** Actual default budget slot; every value is configuration, not a proof. */
27
+ export declare const defaultRoomBudgets: (overrides?: Partial<RoomBudgets>) => RoomBudgets;
28
+
29
+ export declare const defaultRoomReconnectPolicy: (options?: Partial<{
30
+ readonly graceMs: number;
31
+ }>) => {
32
+ readonly graceMs: number;
33
+ };
34
+
35
+ /** Actual checkpoint cadence/encoding default, captured when the Room is defined.
36
+ * Commands, initial publication and terminal persistence bypass this cadence. */
37
+ export declare const defaultRoomSnapshotPolicy: <S>(options?: Readonly<Partial<RoomSnapshotPolicy<S>>>) => RoomSnapshotPolicy<S>;
38
+
39
+ /** Configuration only; no capacity assertion, history allocation or authority. */
40
+ export declare const defaultRoomSpectatorPolicy: (input?: Readonly<Partial<RoomSpectatorPolicy>>) => RoomSpectatorPolicy;
41
+
42
+ /** Per-client output remains detached even for the full-state default. */
43
+ export declare const defaultRoomView: <S>(context: RoomViewContext<S>) => S;
44
+
45
+ export declare function defineRoom<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(definition: RoomLockstepDefinition<S, I, O>): RoomLockstepDescriptor<S, I, O>;
46
+
47
+ export declare function defineRoom<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(definition: RoomDefinition<S, I, O>): RoomDescriptor<S, I, O>;
48
+
49
+ export declare function defineRoom<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(definition: RoomDefinition<S, I, O> | RoomLockstepDefinition<S, I, O>): RoomDescriptor<S, I, O> | RoomLockstepDescriptor<S, I, O>;
50
+
51
+ export declare const defineRoomExtension: <S, I>(definition: RoomExtension<S, I>) => RoomExtension<S, I>;
52
+
53
+ export declare const dequantize: (value: number, options: Quantization) => number;
54
+
55
+ export declare const fieldId: (id: number) => <S extends Schema.Codec<unknown, unknown>>(schema: S) => S;
56
+
57
+ /** Exact reduced integer ratio over admitted coordinates/differences of magnitude <= u32.
58
+ * Shared 2D/3D slab arithmetic; never round a fraction before comparing it. */
59
+ declare interface FixedSlabFraction {
60
+ readonly numerator: number;
61
+ readonly denominator: number;
62
+ }
63
+
64
+ declare interface GeometryBoxOverlapOptions {
65
+ readonly maxTests?: number;
66
+ }
67
+
68
+ declare type GeometryChunk = GeometryTileChunk | GeometryHeightfieldChunk | GeometryShapesChunk | GeometryVoxelChunk;
69
+
70
+ declare interface GeometryGridRayHit {
71
+ readonly kind: '2d-tiles' | '3d-voxel';
72
+ readonly scope: GeometryPersistenceScope;
73
+ readonly revision: number;
74
+ readonly cell: {
75
+ readonly x: number;
76
+ readonly y: number;
77
+ readonly z?: number;
78
+ };
79
+ /** Exact reduced infimum entry fraction on the offered segment, not a
80
+ * rounded contact point or a floating-point distance. */
81
+ readonly fraction: {
82
+ readonly numerator: number;
83
+ readonly denominator: number;
84
+ };
85
+ readonly visitedCells: number;
86
+ }
87
+
88
+ declare interface GeometryGridRayOptions {
89
+ readonly maxVisitedCells?: number;
90
+ }
91
+
92
+ declare interface GeometryGridSweepHit {
93
+ readonly kind: '2d-tiles' | '3d-voxel';
94
+ readonly scope: GeometryPersistenceScope;
95
+ readonly revision: number;
96
+ readonly cell: {
97
+ readonly x: number;
98
+ readonly y: number;
99
+ readonly z?: number;
100
+ };
101
+ /** Infimum/supremum of positive-volume overlap, clipped to [0,1]. Contact
102
+ * alone is not an overlap; fractions are exact reduced integer ratios. */
103
+ readonly entry: FixedSlabFraction;
104
+ readonly exit: FixedSlabFraction;
105
+ readonly initialOverlap: boolean;
106
+ readonly testedCells: number;
107
+ }
108
+
109
+ /** A half-open raw box `[min, max)` on all three axes; a heightfield box needs its z extent. */
110
+ declare interface GeometryHeightfieldBoxRaw {
111
+ readonly minXRaw: number;
112
+ readonly minYRaw: number;
113
+ readonly minZRaw: number;
114
+ readonly maxXRaw: number;
115
+ readonly maxYRaw: number;
116
+ readonly maxZRaw: number;
117
+ }
118
+
119
+ declare type GeometryHeightfieldChunk = (typeof GeometryHeightfieldChunkSchema)["Type"];
120
+
121
+ declare const GeometryHeightfieldChunkSchema: Schema.Struct<{
122
+ readonly kind: Schema.Literal<"2d-heightfield">;
123
+ readonly formatVersion: Schema.Literal<1>;
124
+ readonly address: Schema.Struct<{
125
+ readonly worldId: Schema.String;
126
+ readonly layerSetId: Schema.String;
127
+ readonly cx: Schema.Int;
128
+ readonly cy: Schema.Int;
129
+ }>;
130
+ readonly version: Schema.String;
131
+ readonly width: Schema.Int;
132
+ readonly height: Schema.Int;
133
+ readonly sampleSpacingRaw: Schema.Int;
134
+ readonly baseHeightRaw: Schema.Int;
135
+ readonly heightQuantumRaw: Schema.Int;
136
+ readonly heights: Schema.$Array<Schema.Int>;
137
+ }>;
138
+
139
+ declare interface GeometryHeightfieldRayHit {
140
+ readonly kind: '2d-heightfield';
141
+ readonly scope: GeometryPersistenceScope;
142
+ readonly revision: number;
143
+ /** The first point on the segment at or below the surface, in global raw units. */
144
+ readonly point: GeometryHeightfieldRayPoint;
145
+ /** Exact reduced position on the offered segment whose raw-grid point is `point`. */
146
+ readonly fraction: {
147
+ readonly numerator: number;
148
+ readonly denominator: number;
149
+ };
150
+ readonly visitedSamples: number;
151
+ }
152
+
153
+ declare interface GeometryHeightfieldRayPoint {
154
+ readonly xRaw: number;
155
+ readonly yRaw: number;
156
+ readonly zRaw: number;
157
+ }
158
+
159
+ declare interface GeometryHeightfieldSweepHit {
160
+ readonly kind: '2d-heightfield';
161
+ /** The first box position along the path that reaches under the surface, on the raw grid. */
162
+ readonly box: GeometryHeightfieldBoxRaw;
163
+ /** Exact reduced position of `box` on the path: raw steps along the longest axis over its length. */
164
+ readonly fraction: {
165
+ readonly numerator: number;
166
+ readonly denominator: number;
167
+ };
168
+ /** The start box already reaches under the surface (fraction 0). */
169
+ readonly initialOverlap: boolean;
170
+ /** Overlap evaluations used, coarse and refining together. */
171
+ readonly evaluations: number;
172
+ }
173
+
174
+ declare type GeometryKind = GeometryChunk['kind'];
175
+
176
+ declare interface GeometryPersistenceScope {
177
+ readonly tenantId: string;
178
+ readonly kind: GeometryKind;
179
+ readonly worldId: string;
180
+ readonly version: string;
181
+ readonly layerSetId: string;
182
+ readonly cx: number;
183
+ readonly cy: number;
184
+ readonly cz?: number | undefined;
185
+ }
186
+
187
+ declare interface GeometryPreparedScope {
188
+ readonly tenantId: string;
189
+ readonly kind: GeometryKind;
190
+ readonly worldId: string;
191
+ readonly layerSetId: string;
192
+ readonly version: string;
193
+ }
194
+
195
+ declare type GeometryShape = (typeof GeometryShapeSchema)["Type"];
196
+
197
+ declare interface GeometryShapeRayHit {
198
+ readonly kind: '3d-shapes';
199
+ readonly scope: GeometryPersistenceScope;
200
+ readonly revision: number;
201
+ /** Native LOCAL shape; scope identifies its owning chunk. */
202
+ readonly shape: GeometryShape;
203
+ /** Encloses the exact infimum entry time; width <= 2^-52. Presentation only.
204
+ * Selection and ownership decisions never use these rounded bounds. */
205
+ readonly fractionBounds: {
206
+ readonly lower: number;
207
+ readonly upper: number;
208
+ };
209
+ readonly visitedChunks: number;
210
+ readonly testedShapes: number;
211
+ }
212
+
213
+ declare const GeometryShapeSchema: Schema.Union<readonly [Schema.Struct<{
214
+ readonly halfXRaw: Schema.Int;
215
+ readonly halfYRaw: Schema.Int;
216
+ readonly halfZRaw: Schema.Int;
217
+ readonly id: Schema.String;
218
+ readonly xRaw: Schema.Int;
219
+ readonly yRaw: Schema.Int;
220
+ readonly zRaw: Schema.Int;
221
+ readonly kind: Schema.Literal<"aabb">;
222
+ }>, Schema.Struct<{
223
+ readonly radiusRaw: Schema.Int;
224
+ readonly id: Schema.String;
225
+ readonly xRaw: Schema.Int;
226
+ readonly yRaw: Schema.Int;
227
+ readonly zRaw: Schema.Int;
228
+ readonly kind: Schema.Literal<"sphere">;
229
+ }>]>;
230
+
231
+ declare type GeometryShapesChunk = (typeof GeometryShapesChunkSchema)["Type"];
232
+
233
+ declare const GeometryShapesChunkSchema: Schema.Struct<{
234
+ readonly kind: Schema.Literal<"3d-shapes">;
235
+ readonly formatVersion: Schema.Literal<1>;
236
+ readonly address: Schema.Struct<{
237
+ readonly worldId: Schema.String;
238
+ readonly layerSetId: Schema.String;
239
+ readonly cx: Schema.Int;
240
+ readonly cy: Schema.Int;
241
+ readonly cz: Schema.Int;
242
+ }>;
243
+ readonly version: Schema.String;
244
+ readonly extentXRaw: Schema.Int;
245
+ readonly extentYRaw: Schema.Int;
246
+ readonly extentZRaw: Schema.Int;
247
+ readonly shapes: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
248
+ readonly halfXRaw: Schema.Int;
249
+ readonly halfYRaw: Schema.Int;
250
+ readonly halfZRaw: Schema.Int;
251
+ readonly id: Schema.String;
252
+ readonly xRaw: Schema.Int;
253
+ readonly yRaw: Schema.Int;
254
+ readonly zRaw: Schema.Int;
255
+ readonly kind: Schema.Literal<"aabb">;
256
+ }>, Schema.Struct<{
257
+ readonly radiusRaw: Schema.Int;
258
+ readonly id: Schema.String;
259
+ readonly xRaw: Schema.Int;
260
+ readonly yRaw: Schema.Int;
261
+ readonly zRaw: Schema.Int;
262
+ readonly kind: Schema.Literal<"sphere">;
263
+ }>]>>;
264
+ }>;
265
+
266
+ declare type GeometryTileChunk = (typeof GeometryTileChunkSchema)["Type"];
267
+
268
+ declare const GeometryTileChunkSchema: Schema.Struct<{
269
+ readonly kind: Schema.Literal<"2d-tiles">;
270
+ readonly formatVersion: Schema.Literal<1>;
271
+ readonly address: Schema.Struct<{
272
+ readonly worldId: Schema.String;
273
+ readonly layerSetId: Schema.String;
274
+ readonly cx: Schema.Int;
275
+ readonly cy: Schema.Int;
276
+ }>;
277
+ readonly version: Schema.String;
278
+ readonly width: Schema.Int;
279
+ readonly height: Schema.Int;
280
+ readonly tileSizeRaw: Schema.Int;
281
+ readonly palette: Schema.$Array<Schema.Struct<{
282
+ readonly key: Schema.String;
283
+ readonly solid: Schema.Boolean;
284
+ }>>;
285
+ readonly runs: Schema.$Array<Schema.Struct<{
286
+ readonly paletteIndex: Schema.Int;
287
+ readonly length: Schema.Int;
288
+ }>>;
289
+ }>;
290
+
291
+ declare interface GeometryTileCollisionOptions {
292
+ /** Total visited cells across every solver query, including its final check.
293
+ * May only narrow the world's maxOverlapTests. */
294
+ readonly maxTests?: number;
295
+ /** Existing discrete solver limit; defaults to 8, maximum 256. */
296
+ readonly maxIterations?: number;
297
+ }
298
+
299
+ declare type GeometryTileMaterial = (typeof GeometryTileMaterialSchema)["Type"];
300
+
301
+ declare const GeometryTileMaterialSchema: Schema.Struct<{
302
+ readonly key: Schema.String;
303
+ readonly solid: Schema.Boolean;
304
+ }>;
305
+
306
+ declare type GeometryVoxelChunk = (typeof GeometryVoxelChunkSchema)["Type"];
307
+
308
+ declare const GeometryVoxelChunkSchema: Schema.Struct<{
309
+ readonly kind: Schema.Literal<"3d-voxel">;
310
+ readonly formatVersion: Schema.Literal<1>;
311
+ readonly address: Schema.Struct<{
312
+ readonly worldId: Schema.String;
313
+ readonly layerSetId: Schema.String;
314
+ readonly cx: Schema.Int;
315
+ readonly cy: Schema.Int;
316
+ readonly cz: Schema.Int;
317
+ }>;
318
+ readonly version: Schema.String;
319
+ readonly side: Schema.Int;
320
+ readonly voxelSizeRaw: Schema.Int;
321
+ readonly palette: Schema.$Array<Schema.Struct<{
322
+ readonly key: Schema.String;
323
+ readonly solid: Schema.Boolean;
324
+ }>>;
325
+ readonly sections: Schema.$Array<Schema.Struct<{
326
+ readonly sx: Schema.Int;
327
+ readonly sy: Schema.Int;
328
+ readonly sz: Schema.Int;
329
+ readonly runs: Schema.$Array<Schema.Struct<{
330
+ readonly paletteIndex: Schema.Int;
331
+ readonly length: Schema.Int;
332
+ }>>;
333
+ }>>;
334
+ }>;
335
+
336
+ /** Nonempty half-open raw box. Three-dimensional kinds require both Z fields. */
337
+ declare interface GeometryWorldBoxRaw {
338
+ readonly minXRaw: number;
339
+ readonly minYRaw: number;
340
+ readonly maxXRaw: number;
341
+ readonly maxYRaw: number;
342
+ readonly minZRaw?: number;
343
+ readonly maxZRaw?: number;
344
+ }
345
+
346
+ declare interface GeometryWorldPointRaw {
347
+ readonly xRaw: number;
348
+ readonly yRaw: number;
349
+ readonly zRaw?: number;
350
+ }
351
+
352
+ declare type GeometryWorldRayHit = GeometryGridRayHit | GeometryShapeRayHit | GeometryHeightfieldRayHit;
353
+
354
+ declare interface GeometryWorldRayOptions extends GeometryGridRayOptions {
355
+ /** Shapes only; narrows maxOverlapTests for the total shape scan. */
356
+ readonly maxTests?: number;
357
+ }
358
+
359
+ declare interface GeometryWorldShapeHit {
360
+ readonly scope: GeometryPersistenceScope;
361
+ readonly revision: number;
362
+ readonly shape: GeometryShape;
363
+ }
364
+
365
+ declare interface GeometryWorldView {
366
+ readonly kind: GeometryKind;
367
+ readonly scope: GeometryPreparedScope;
368
+ /** Discrete AABB/circle resolution in world units against current tile data.
369
+ * Reuses the Transform solver; no swept movement or velocity integration. */
370
+ collide(transform: Transform2D, body: CollisionBody2D, options?: GeometryTileCollisionOptions): CollisionResult2D;
371
+ /** Tiles/voxels only. Unloaded coordinates refuse, never implicit empty terrain. */
372
+ materialAtRaw(point: GeometryWorldPointRaw): GeometryTileMaterial;
373
+ /** Tiles/voxels/shapes: the stored solidity. Heightfields (points with `zRaw`): terrain is solid at and
374
+ * below its surface, the same surface `raycastRaw` hits. Heightfield material is not invented. */
375
+ solidAtRaw(point: GeometryWorldPointRaw): boolean;
376
+ /** Heightfield only, with exact existing native interpolation. */
377
+ heightAtRaw(point: GeometryWorldPointRaw): number;
378
+ /** Shapes only; hit volumes retain native LOCAL coordinates and exact chunk scope. */
379
+ shapesAtRaw(point: GeometryWorldPointRaw): ReadonlyArray<GeometryWorldShapeHit>;
380
+ /** Tiles/voxels return exact rational entry; shapes select exact quadratic
381
+ * entry and expose enclosing presentation bounds; heightfields (points with
382
+ * `zRaw`) return the first sampled point at or below the surface, refined to
383
+ * one raw unit (`raycastGeometryHeightfield`). Missing coverage refuses. */
384
+ raycastRaw(from: GeometryWorldPointRaw, to: GeometryWorldPointRaw, options?: GeometryWorldRayOptions): GeometryWorldRayHit | null;
385
+ /** Tiles/voxels/closed native shapes, clipped by half-open chunk ownership. Heightfields need the z extent:
386
+ * the box touches terrain when the highest surface point over its footprint is at or above `minZRaw`
387
+ * (`overlapsGeometryHeightfieldBox`). Nonempty half-open raw boxes only; missing data or work exhaustion refuses. */
388
+ overlapsBoxRaw(box: GeometryWorldBoxRaw, options?: GeometryBoxOverlapOptions): boolean;
389
+ /** Translation-only tile/voxel sweep. Shares maxOverlapTests; validates the
390
+ * whole swept bounding region before publishing the earliest overlap. */
391
+ sweepBoxRaw(from: GeometryWorldBoxRaw, to: GeometryWorldBoxRaw, options?: GeometryBoxOverlapOptions): GeometryGridSweepHit | null;
392
+ /** Heightfields only (boxes with a z extent): the first raw-grid position that reaches under the surface
393
+ * (`sweepGeometryHeightfieldBox`), coarse steps of a quarter sample spacing, at most
394
+ * `geometry.budgets.maxRayCells` overlap evaluations of `maxTests` reads each. */
395
+ sweepHeightfieldBoxRaw(from: GeometryHeightfieldBoxRaw, to: GeometryHeightfieldBoxRaw, options?: GeometryBoxOverlapOptions): GeometryHeightfieldSweepHit | null;
396
+ }
397
+
398
+ export declare const interpolate: (mode?: "linear" | "angle" | "none") => <S extends Schema.Codec<unknown, unknown>>(schema: S) => S;
399
+
400
+ declare type LockstepDesyncAction = 'resync' | 'end' | 'flag';
401
+
402
+ declare interface LockstepDesyncContext {
403
+ readonly tick: number;
404
+ readonly playerId: number;
405
+ readonly expected: Uint64Words;
406
+ readonly received: Uint64Words;
407
+ }
408
+
409
+ declare type LockstepInputPrediction<I> = 'repeat-last' | 'none' | ((last: I, context: {
410
+ readonly playerId: number;
411
+ readonly tick: number;
412
+ }) => I);
413
+
414
+ declare interface LockstepPolicyStrategies {
415
+ readonly refereeLag?: (configuredTicks: number) => number;
416
+ readonly stallPolicy?: (options: LockstepStallPolicyOptions) => LockstepStallPolicy;
417
+ readonly onDesync?: (incident: LockstepDesyncContext, configuredAction: LockstepDesyncAction) => LockstepDesyncAction;
418
+ }
419
+
420
+ declare interface LockstepStallPolicy {
421
+ readonly afterTicks: number;
422
+ readonly action: 'pause' | 'drop-player';
423
+ }
424
+
425
+ declare interface LockstepStallPolicyOptions {
426
+ readonly afterTicks?: number;
427
+ readonly action?: 'pause' | 'drop-player';
428
+ }
429
+
430
+ /** Cosmetic state remains schema-validated and copied, but is excluded from simulation hashes. */
431
+ export declare const nonAuthoritative: () => <S extends Schema.Codec<unknown, unknown>>(schema: S) => S;
432
+
433
+ /** PCG-XSH-RR 64/32. Numeric seeds are unsigned 32-bit; word seeds retain 64 bits.
434
+ * Algorithm reference: https://www.pcg-random.org/using-pcg-c-basic.html
435
+ * No global generator, BigInt, native dependency or implicit time/entropy seed. */
436
+ declare class Pcg32 {
437
+ #private;
438
+ constructor(seed: Pcg32Seed, stream?: Pcg32Seed, maxRejectionAttempts?: number);
439
+ get maxRejectionAttempts(): number;
440
+ nextU32(): number;
441
+ /** Rejection removes modulo bias. Exhaustion consumes exactly the bounded
442
+ * draws and fails; it never returns a biased fallback or substitutes entropy. */
443
+ bounded(bound: number): number;
444
+ snapshot(): Pcg32Snapshot;
445
+ restore(offered: Pcg32Snapshot): void;
446
+ clone(): Pcg32;
447
+ /** Exact skip-ahead modulo 2^64; at most 32 iterations for this delta API. */
448
+ advance(delta: number): void;
449
+ }
450
+
451
+ declare type Pcg32Seed = number | Uint64Words;
452
+
453
+ declare interface Pcg32Snapshot {
454
+ readonly stateHi: number;
455
+ readonly stateLo: number;
456
+ readonly incrementHi: number;
457
+ readonly incrementLo: number;
458
+ }
459
+
460
+ export declare const precision: (format: "f32" | "f64") => <S extends Schema.Codec<unknown, unknown>>(schema: S) => S;
461
+
462
+ export declare interface Quantization {
463
+ readonly min: number;
464
+ readonly max: number;
465
+ readonly step?: number | undefined;
466
+ readonly bits?: number | undefined;
467
+ }
468
+
469
+ export declare const quantizationStep: (options: Quantization) => number;
470
+
471
+ export declare const quantize: (value: number, options: Quantization) => number;
472
+
473
+ export declare const quantized: (options: Quantization) => <S extends Schema.Codec<unknown, unknown>>(schema: S) => S;
474
+
475
+ /** Commands are staged in memory and drained outside the tick. */
476
+ export declare interface RoomAppBridge {
477
+ publish(event: string, payload: unknown, options: {
478
+ readonly key: string;
479
+ }): string;
480
+ run(descriptor: string, input: unknown): string;
481
+ }
482
+
483
+ export declare interface RoomAuthoringStrategies<S = unknown> {
484
+ readonly budgets?: (options: Readonly<Partial<RoomBudgets>>) => RoomBudgets;
485
+ readonly reconnectPolicy?: (options: Readonly<Partial<{
486
+ readonly graceMs: number;
487
+ }>>) => {
488
+ readonly graceMs: number;
489
+ };
490
+ readonly snapshotPolicy?: (options: Readonly<Partial<RoomSnapshotPolicy<S>>>) => RoomSnapshotPolicy<S>;
491
+ readonly spectatorPolicy?: (options: Readonly<Partial<RoomSpectatorPolicy>>) => RoomSpectatorPolicy;
492
+ }
493
+
494
+ export declare interface RoomBudgets {
495
+ readonly inputsPerSecond: number;
496
+ readonly bytesPerSecond: number;
497
+ readonly burst: number;
498
+ readonly maxQueuedInputs: number;
499
+ readonly maxOutboxCommands: number;
500
+ readonly maxScheduledHooks: number;
501
+ readonly maxQueuedLifecycleHooks: number;
502
+ readonly maxNpcs: number;
503
+ /** A player input acting on state older than this many milliseconds behind the newest state
504
+ * the Host sent that client is dropped (it arrived too late to apply fairly). */
505
+ readonly inputLatencyBudgetMs: number;
506
+ }
507
+
508
+ export declare interface RoomChannel {
509
+ readonly schema: Schema.Codec<unknown, unknown>;
510
+ readonly direction: 'both' | 'server' | 'client';
511
+ readonly reliable: boolean;
512
+ }
513
+
514
+ export declare interface RoomClient {
515
+ readonly sessionId: string;
516
+ readonly subjectId: string | null;
517
+ readonly tenantId: string;
518
+ /** App data the API resolved for this seat (`seatAttributes` on the Rooms API binding), signed into
519
+ * the seat; absent without one. Not a secret from the player: it travels in their seat token. */
520
+ readonly attributes?: RoomSeatAttributes | undefined;
521
+ /** Actor-owned classification, never accepted from a socket input. */
522
+ readonly isBot?: boolean | undefined;
523
+ readonly countsAsPlayer?: boolean | undefined;
524
+ send(channel: string, payload: unknown): void;
525
+ kick(reason: string): void;
526
+ }
527
+
528
+ export declare interface RoomClock {
529
+ now(): number;
530
+ }
531
+
532
+ declare interface RoomCodecLimits {
533
+ readonly maxBytes: number;
534
+ readonly maxCollectionLength: number;
535
+ readonly maxFieldId: number;
536
+ }
537
+
538
+ export declare interface RoomDefinition<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
539
+ readonly name: string;
540
+ readonly mode?: 'state-sync';
541
+ readonly state: S;
542
+ readonly auth?: 'subject' | 'public';
543
+ readonly guards?: DeclaredAccess;
544
+ readonly openAccess?: string | undefined;
545
+ readonly input: I;
546
+ readonly options: O;
547
+ /** Author-owned initial state; no game values are guessed by the host. */
548
+ readonly initialState?: (options: (O)["Type"]) => (S)["Type"];
549
+ readonly tickRate?: number;
550
+ readonly sendRate?: number;
551
+ readonly maxClients?: number;
552
+ readonly maxCatchUpTicks?: number;
553
+ readonly lifecycleTimeoutMs?: number;
554
+ readonly budgets?: Partial<RoomBudgets>;
555
+ readonly strategies?: RoomAuthoringStrategies<(S)["Type"]> | undefined;
556
+ readonly reconnect?: {
557
+ readonly graceMs: number;
558
+ };
559
+ readonly autoDispose?: {
560
+ readonly afterEmptyMs: number;
561
+ readonly hibernate?: boolean;
562
+ };
563
+ readonly snapshot?: Partial<RoomSnapshotPolicy<(S)["Type"]>>;
564
+ /** Opt-in shared history; host must supply the actual common view/admission. */
565
+ readonly spectator?: Partial<RoomSpectatorPolicy> | undefined;
566
+ readonly messages?: Readonly<Record<string, RoomChannel>>;
567
+ readonly view?: (context: RoomViewContext<(S)["Type"]>) => (S)["Type"];
568
+ readonly viewBudgetMs?: number;
569
+ /** How the Room appears in `rooms.list`, derived from its state: `private` takes it off the list
570
+ * (it stays joinable by ID), `locked` refuses every new seat, `metadata` is shown to listers.
571
+ * Omitted fields keep their current value. The Host writes a change with the next checkpoint,
572
+ * which a change triggers at once. Synchronous and pure, like `view`. */
573
+ readonly listing?: (context: RoomListingContext<(S)["Type"], (O)["Type"]>) => RoomListing;
574
+ readonly extensions?: ReadonlyArray<RoomExtension<(S)["Type"], (I)["Type"]>>;
575
+ readonly world?: RoomWorldHooks<(S)["Type"]> | undefined;
576
+ readonly onCreate?: RoomSyncHook<Omit<RoomMemberContext<(S)["Type"], (O)["Type"]>, 'client'>>;
577
+ readonly onRehydrate?: RoomSyncHook<Omit<RoomMemberContext<(S)["Type"], (O)["Type"]>, 'client'>>;
578
+ readonly onJoin?: RoomLifecycleHook<RoomMemberContext<(S)["Type"], (O)["Type"]>>;
579
+ readonly onLeave?: RoomLifecycleHook<RoomMemberContext<(S)["Type"], (O)["Type"]> & {
580
+ readonly reason: RoomLeaveReason;
581
+ }>;
582
+ readonly onTick: RoomSyncHook<RoomTickContext<(S)["Type"], (I)["Type"]>>;
583
+ readonly onSchedule?: RoomSyncHook<RoomTickContext<(S)["Type"], (I)["Type"]> & {
584
+ readonly label: string;
585
+ }>;
586
+ readonly onDispose?: RoomLifecycleHook<{
587
+ readonly state: RoomState<(S)["Type"]> | undefined;
588
+ readonly app: RoomAppBridge;
589
+ readonly geometry?: GeometryWorldView;
590
+ }> | undefined;
591
+ }
592
+
593
+ export declare interface RoomDescriptor<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> extends RoomDefinition<S, I, O> {
594
+ readonly _tag: 'RoomDescriptor';
595
+ readonly auth: 'subject' | 'public';
596
+ readonly guards: DeclaredAccess;
597
+ readonly tickRate: number;
598
+ readonly sendRate: number;
599
+ readonly maxClients: number;
600
+ readonly maxCatchUpTicks: number;
601
+ readonly lifecycleTimeoutMs: number;
602
+ readonly budgets: RoomBudgets;
603
+ readonly view: (context: RoomViewContext<(S)["Type"]>) => (S)["Type"];
604
+ readonly reconnect: {
605
+ readonly graceMs: number;
606
+ };
607
+ readonly autoDispose: {
608
+ readonly afterEmptyMs: number;
609
+ readonly hibernate: boolean;
610
+ };
611
+ readonly snapshot: RoomSnapshotPolicy<(S)["Type"]>;
612
+ readonly spectator?: RoomSpectatorPolicy | undefined;
613
+ readonly messages: Readonly<Record<string, RoomChannel>>;
614
+ readonly viewBudgetMs: number;
615
+ readonly extensions: ReadonlyArray<RoomExtension<(S)["Type"], (I)["Type"]>>;
616
+ }
617
+
618
+ export declare interface RoomExtension<S, I> {
619
+ readonly name: string;
620
+ readonly fields: ReadonlyArray<Extract<keyof S, string>>;
621
+ readonly channel: string;
622
+ readonly tickBudgetMs: number;
623
+ readonly beforeTick?: RoomSyncHook<RoomExtensionContext<S, I>>;
624
+ readonly afterTick?: RoomSyncHook<RoomExtensionContext<S, I>>;
625
+ }
626
+
627
+ export declare interface RoomExtensionContext<S, I> {
628
+ /** Prepared native CPU queries only, installed before actor lifecycle. */
629
+ readonly geometry?: GeometryWorldView | undefined;
630
+ readonly state: RoomState<Partial<S>>;
631
+ readonly tick: number;
632
+ readonly dt: number;
633
+ readonly inputs: ReadonlyArray<Omit<RoomInput<I>, 'client'> & {
634
+ readonly client: Pick<RoomClient, 'sessionId' | 'subjectId' | 'tenantId' | 'isBot' | 'countsAsPlayer' | 'attributes'>;
635
+ }>;
636
+ readonly clock: RoomClock;
637
+ send(sessionId: string, payload: unknown): void;
638
+ }
639
+
640
+ export declare const RoomFieldId: unique symbol;
641
+
642
+ export declare interface RoomInput<I> {
643
+ readonly client: RoomClient;
644
+ readonly seq: number;
645
+ readonly tickHint: number;
646
+ readonly input: I;
647
+ }
648
+
649
+ export declare const RoomInterpolation: unique symbol;
650
+
651
+ export declare type RoomLeaveReason = 'left' | 'kicked' | 'reconnecting' | 'timeout' | 'disposed';
652
+
653
+ /** Lifecycle Effects are run by the host outside the synchronous tick. `void` admits block bodies;
654
+ * a returned Promise is refused at runtime with an authoring error. */
655
+ export declare type RoomLifecycleHook<C> = (context: C) => void | Effect.Effect<void, unknown>;
656
+
657
+ /** A Room's own listing; scalar metadata only, at most 16 keys and 2 KiB. */
658
+ export declare interface RoomListing {
659
+ readonly metadata?: Readonly<Record<string, RoomScalar>>;
660
+ readonly private?: boolean;
661
+ readonly locked?: boolean;
662
+ }
663
+
664
+ export declare interface RoomListingContext<S, O> {
665
+ readonly state: S;
666
+ readonly options: O;
667
+ }
668
+
669
+ export declare interface RoomLockstepDefinition<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
670
+ readonly name: string;
671
+ readonly mode: 'lockstep';
672
+ readonly simulation: Simulation<S, I, O>;
673
+ readonly lockstep?: RoomLockstepOptions<I> | undefined;
674
+ readonly guards?: DeclaredAccess;
675
+ readonly openAccess?: string | undefined;
676
+ readonly auth?: 'subject';
677
+ readonly tickRate?: number;
678
+ readonly maxCatchUpTicks?: number;
679
+ readonly lifecycleTimeoutMs?: number;
680
+ readonly budgets?: Partial<RoomBudgets>;
681
+ readonly reconnect?: {
682
+ readonly graceMs: number;
683
+ };
684
+ readonly strategies?: Pick<RoomAuthoringStrategies, 'reconnectPolicy'> | undefined;
685
+ readonly messages?: Readonly<Record<string, RoomChannel>>;
686
+ readonly onMessage?: (context: RoomLockstepMessageContext) => undefined;
687
+ }
688
+
689
+ export declare interface RoomLockstepDescriptor<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> extends RoomLockstepDefinition<S, I, O> {
690
+ readonly _tag: 'RoomDescriptor';
691
+ /** Lockstep rooms never join a World; declared so mixed descriptor reads narrow on it. */
692
+ readonly world?: undefined;
693
+ readonly auth: 'subject';
694
+ readonly state: S;
695
+ readonly input: I;
696
+ readonly options: O;
697
+ readonly guards: DeclaredAccess;
698
+ readonly tickRate: number;
699
+ readonly maxCatchUpTicks: number;
700
+ readonly lifecycleTimeoutMs: number;
701
+ readonly maxClients: number;
702
+ readonly budgets: RoomBudgets;
703
+ readonly reconnect: {
704
+ readonly graceMs: number;
705
+ };
706
+ readonly messages: Readonly<Record<string, RoomChannel>>;
707
+ readonly lockstep: RoomLockstepOptions<I> & {
708
+ readonly inputSchema: I;
709
+ readonly inputDelayTicks: number;
710
+ readonly rollbackHorizonTicks: number;
711
+ readonly inputPrediction: LockstepInputPrediction<(I)["Type"]>;
712
+ readonly maxPlayers: number;
713
+ };
714
+ /** State-sync lifecycle/spectators are never manufactured for a lockstep declaration. */
715
+ readonly initialState?: never;
716
+ readonly spectator?: never | undefined;
717
+ }
718
+
719
+ declare interface RoomLockstepDesync {
720
+ readonly tick: number;
721
+ readonly playerId: number;
722
+ readonly expected: Uint64Words;
723
+ readonly received: Uint64Words;
724
+ }
725
+
726
+ export declare interface RoomLockstepMessageContext {
727
+ readonly roomId: string;
728
+ readonly tenantId: string;
729
+ readonly epoch: number;
730
+ readonly client: {
731
+ readonly sessionId: string;
732
+ readonly subjectId: string;
733
+ readonly tenantId: string;
734
+ };
735
+ readonly channel: string;
736
+ readonly payload: unknown;
737
+ /** Stage an ephemeral reply to the same current native Session. */
738
+ reply(channel: string, payload: unknown): void;
739
+ /** Stage an ephemeral message to the currently activated player Sessions. */
740
+ broadcast(channel: string, payload: unknown): void;
741
+ }
742
+
743
+ export declare interface RoomLockstepOptions<I extends Schema.Codec<unknown, unknown>> extends RoomLockstepServerOptions {
744
+ readonly inputSchema?: I;
745
+ readonly inputDelayTicks?: number;
746
+ readonly rollbackHorizonTicks?: number;
747
+ readonly inputPrediction?: LockstepInputPrediction<(I)["Type"]>;
748
+ /** Admit players after Start (late join). Each joins at a tick chosen by the Host, ahead of
749
+ * the confirmed frontier by the input delay; every simulation sees it at that tick. */
750
+ readonly lateJoin?: boolean;
751
+ }
752
+
753
+ declare interface RoomLockstepRosterOptions {
754
+ readonly initialTick?: number;
755
+ readonly maxPlayers?: number;
756
+ readonly maxFutureTicks?: number;
757
+ readonly maxBatchInputs?: number;
758
+ readonly maxPendingInputs?: number;
759
+ readonly maxPendingBytes?: number | undefined;
760
+ }
761
+
762
+ declare interface RoomLockstepServerOptions extends Omit<RoomLockstepRosterOptions, 'initialTick'> {
763
+ readonly strategies?: LockstepPolicyStrategies | undefined;
764
+ readonly stallPolicy?: LockstepStallPolicyOptions;
765
+ readonly serverRole?: RoomLockstepServerRole;
766
+ readonly refereeLagTicks?: number;
767
+ readonly hashEvery?: number;
768
+ readonly hashHistoryTicks?: number;
769
+ readonly maxQueuedTicks?: number;
770
+ readonly maxQueuedInputBytes?: number;
771
+ readonly maxPendingHashes?: number;
772
+ readonly maxRefereeSteps?: number;
773
+ readonly maxReplayTicks?: number;
774
+ readonly maxReplayInputBytes?: number;
775
+ readonly maxSnapshotBudgetBytes?: number;
776
+ readonly maxRejectionAttempts?: number;
777
+ readonly onDesync?: 'resync' | 'end' | 'flag' | ((incident: RoomLockstepDesync) => 'resync' | 'end' | 'flag');
778
+ }
779
+
780
+ declare type RoomLockstepServerRole = 'relay' | 'referee' | 'full';
781
+
782
+ export declare interface RoomMemberContext<S, O> {
783
+ /** Prepared native CPU queries only, installed before actor lifecycle. */
784
+ readonly geometry?: GeometryWorldView | undefined;
785
+ readonly state: RoomState<S>;
786
+ readonly options: O;
787
+ readonly client: RoomClient;
788
+ readonly app: RoomAppBridge;
789
+ readonly clock: RoomClock;
790
+ readonly scheduler: RoomScheduler;
791
+ /** World Rooms, ordinary player join: the server-owned entity this Session controls and
792
+ * its last persisted `persistEntity` data. Build the state entity from it when absent. */
793
+ readonly world?: RoomWorldMember | undefined;
794
+ }
795
+
796
+ export declare const RoomNonAuthoritative: unique symbol;
797
+
798
+ export declare const RoomPrecision: unique symbol;
799
+
800
+ export declare const RoomQuantization: unique symbol;
801
+
802
+ export declare type RoomScalar = string | number | boolean | null;
803
+
804
+ export declare interface RoomScheduler {
805
+ after(milliseconds: number, label: string): void;
806
+ every(milliseconds: number, label: string): void;
807
+ cancel(label: string): void;
808
+ }
809
+
810
+ /** App data for one seat, resolved by the API when the seat is reserved (`seatAttributes`) and signed
811
+ * into it; scalars only, at most 16 keys and 2 KiB. */
812
+ export declare type RoomSeatAttributes = Readonly<Record<string, RoomScalar>>;
813
+
814
+ export declare interface RoomSnapshotPolicy<S> {
815
+ readonly everyMs: number;
816
+ readonly onlyIfChanged: boolean;
817
+ readonly mode: 'full' | 'delta';
818
+ readonly fullEvery: number;
819
+ readonly keepFulls: number;
820
+ readonly store: 'auto';
821
+ /** Maximum inline codec payload; the host may impose a smaller cutoff. */
822
+ readonly maxInlineBytes: number;
823
+ /** Full-schema projection of volatile data; never a partial-state format. */
824
+ readonly pick: (state: S) => S;
825
+ }
826
+
827
+ export declare interface RoomSpectatorPolicy {
828
+ readonly delayMs: number;
829
+ readonly retentionMs: number;
830
+ readonly maxFrames: number;
831
+ readonly maxBytes: number;
832
+ readonly maxFrameBytes: number;
833
+ readonly checkpointEveryMs: number;
834
+ readonly maxDeliveryFrames: number;
835
+ }
836
+
837
+ /** Plain mutable state; the author receives no store or database capability. */
838
+ export declare type RoomState<A> = A extends ReadonlyArray<infer V> ? Array<RoomState<V>> : A extends object ? {
839
+ -readonly [K in keyof A]: RoomState<A[K]>;
840
+ } : A;
841
+
842
+ /** Synchronous hook. `void` admits parameterless block bodies (TypeScript cannot narrow those to
843
+ * `undefined`); any returned value, a Promise included, is refused at runtime with an authoring error. */
844
+ export declare type RoomSyncHook<C> = (context: C) => void;
845
+
846
+ export declare interface RoomTickContext<S, I> {
847
+ /** Prepared native CPU queries only, installed before actor lifecycle. */
848
+ readonly geometry?: GeometryWorldView | undefined;
849
+ readonly state: RoomState<S>;
850
+ readonly tick: number;
851
+ readonly dt: number;
852
+ readonly inputs: ReadonlyArray<RoomInput<I>>;
853
+ readonly app: RoomAppBridge;
854
+ readonly clock: RoomClock;
855
+ readonly scheduler: RoomScheduler;
856
+ broadcast(channel: string, payload: unknown): void;
857
+ }
858
+
859
+ export declare const RoomTransform: unique symbol;
860
+
861
+ export declare interface RoomViewContext<S> {
862
+ readonly state: S;
863
+ readonly client: Pick<RoomClient, 'sessionId' | 'subjectId' | 'tenantId' | 'isBot' | 'countsAsPlayer' | 'attributes'>;
864
+ readonly role: 'player' | 'spectator';
865
+ readonly tick: number;
866
+ }
867
+
868
+ /** World Rooms keep their authored entities in the declared state record. */
869
+ export declare type RoomWorldEntity<S> = S extends {
870
+ readonly entities: Readonly<Record<string, infer E>>;
871
+ } ? RoomState<E> & {
872
+ readonly id: string;
873
+ } : never;
874
+
875
+ export declare interface RoomWorldHookContext<S> {
876
+ readonly state: RoomState<S>;
877
+ readonly phase: 'prepare' | 'commit' | 'rollback';
878
+ readonly requestId?: string | undefined;
879
+ readonly entity: RoomWorldEntity<S>;
880
+ }
881
+
882
+ export declare interface RoomWorldHookInput<E = unknown> {
883
+ /** Actual target placement, distinct from the source location. Only guarded
884
+ * target entry uses it; source rollback must restore its exact snapshot. */
885
+ readonly arrival?: WorldEntityLocation;
886
+ readonly epoch: number;
887
+ readonly entity: E;
888
+ readonly location: WorldEntityLocation;
889
+ readonly requestId?: string | undefined;
890
+ }
891
+
892
+ export declare interface RoomWorldHooks<S> {
893
+ /** Opt-in cell movement: synchronous author projection/write, no I/O. */
894
+ readonly movement?: RoomWorldMovement<S>;
895
+ /** Retained checkpoint receipts awaiting confirmed transition retirement. */
896
+ readonly maxPendingTransitions?: number;
897
+ readonly onEnter: RoomLifecycleHook<RoomWorldHookContext<S> & {
898
+ readonly from: WorldEntityLocation;
899
+ readonly to?: WorldEntityLocation;
900
+ }>;
901
+ readonly onExit: RoomLifecycleHook<RoomWorldHookContext<S> & {
902
+ readonly to: WorldEntityLocation;
903
+ }>;
904
+ /** Publish a projection on commit; remove that projection on rollback. Never
905
+ * promote it into authoritative entities. Rollback may retry after failure. */
906
+ readonly onGhost: RoomLifecycleHook<RoomWorldHookContext<S>>;
907
+ /** Synchronous, bounded JSON projection; no SQL or asynchronous effect here. */
908
+ readonly persistEntity: (context: {
909
+ readonly entity: RoomWorldEntity<S>;
910
+ }) => unknown;
911
+ /** A player who arrived by a World transition is now an active member. `onJoin` does not run for
912
+ * such arrivals (the entity came with `onEnter`); this is where the Room sees the arriving client,
913
+ * e.g. its seat attributes (`client.attributes`). */
914
+ readonly onMemberEnter?: RoomLifecycleHook<{
915
+ readonly state: RoomState<S>;
916
+ readonly client: RoomClient;
917
+ readonly entityId: string;
918
+ }>;
919
+ }
920
+
921
+ /** The server-owned entity an ordinary World player Session controls, as last persisted.
922
+ * The Room's `onJoin` receives it as `world` and builds the state entity when absent. */
923
+ declare interface RoomWorldMember {
924
+ readonly entityId: string;
925
+ readonly worldId: string;
926
+ readonly zoneId: string;
927
+ readonly cellId: string;
928
+ readonly layer: number;
929
+ readonly revision: number;
930
+ /** The Room's `persistEntity` projection from the entity's last write. */
931
+ readonly data: unknown;
932
+ }
933
+
934
+ export declare interface RoomWorldMovement<S> {
935
+ readonly maxEntities: number;
936
+ readonly maxBytesPerTick: number;
937
+ readonly position: (entity: RoomWorldEntity<S>) => WorldPoint;
938
+ readonly move: (entity: RoomWorldEntity<S>, at: WorldPoint) => void;
939
+ }
940
+
941
+ declare interface Simulation<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
942
+ readonly definition: SimulationDefinition<S, I, O>;
943
+ readonly stateCodec: SimulationStateCodec<S>;
944
+ readonly inputCodec: SimulationStateCodec<I>;
945
+ readonly optionsCodec: SimulationStateCodec<O>;
946
+ }
947
+
948
+ declare interface SimulationDefinition<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
949
+ readonly state: S;
950
+ readonly input: I;
951
+ readonly options: O;
952
+ readonly init: (seed: number, options: (O)["Type"]) => (S)["Type"];
953
+ readonly step: (state: RoomState<(S)["Type"]>, inputs: ReadonlyArray<SimulationPlayerInput<(I)["Type"]>>, tick: number, rng: Pcg32) => (S)["Type"];
954
+ readonly hash?: (state: (S)["Type"]) => Uint64Words;
955
+ /** Late join: runs before `step` at the tick a player's input first appears (it was absent
956
+ * from the previous tick's inputs), in player-ID order, e.g. to spawn the player. Pure and
957
+ * deterministic like `step`. Start players are `init`'s job: tick 1 runs no join. */
958
+ readonly join?: (state: RoomState<(S)["Type"]>, playerId: number, tick: number, rng: Pcg32) => (S)["Type"];
959
+ readonly limits?: Partial<SimulationValueLimits>;
960
+ }
961
+
962
+ declare interface SimulationPlayerInput<I> {
963
+ readonly playerId: number;
964
+ readonly input: I;
965
+ }
966
+
967
+ declare interface SimulationStateCodec<S extends Schema.Codec<unknown, unknown>> {
968
+ readonly limits: SimulationValueLimits;
969
+ /** Admitted capture/hash plan, not a binary Room wire schema. */
970
+ schemaDescription?(): string;
971
+ capture(value: unknown): (S)["Type"];
972
+ hash(value: (S)["Type"]): Uint64Words;
973
+ }
974
+
975
+ declare interface SimulationValueLimits extends RoomCodecLimits {
976
+ readonly maxNodes: number;
977
+ }
978
+
979
+ declare const Transform2D: Schema.Struct<{
980
+ readonly x: Schema.Number;
981
+ readonly y: Schema.Number;
982
+ readonly rot: Schema.Number;
983
+ readonly vx: Schema.optional<Schema.Number>;
984
+ readonly vy: Schema.optional<Schema.Number>;
985
+ }>;
986
+
987
+ declare type Transform2D = (typeof Transform2D)["Type"];
988
+
989
+ /** Exact unsigned 64-bit integer as independent 32-bit words. */
990
+ declare interface Uint64Words {
991
+ readonly hi: number;
992
+ readonly lo: number;
993
+ }
994
+
995
+ declare interface WorldEntityLocation {
996
+ readonly worldId: string;
997
+ readonly zoneId: string;
998
+ readonly at: WorldPoint;
999
+ readonly layer: number;
1000
+ readonly roomId: string;
1001
+ readonly epoch: number;
1002
+ }
1003
+
1004
+ declare type WorldPoint = readonly [x: number, y: number];
1005
+
1006
+ export { }