@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/wire.js ADDED
@@ -0,0 +1,491 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { captureUint64Words as t } from "./fixedWords.js";
3
+ import { RoomInputCodec as n, RoomStateCodec as r } from "./stateCodec.js";
4
+ import { captureRoomLockstepWireRoster as i } from "./lockstepWireRoster.js";
5
+ import { geometryNativeCodecMetadata as a } from "./geometryNativeMetadata.js";
6
+ import { geometryWorldMetadata as o } from "./geometryWorldMetadata.js";
7
+ import { Result as s } from "effect";
8
+ // src/wire.ts
9
+ var c = "v1/input-ackTick/state-inputReceipt/pong-tick/lockstep-v4-snapshot/recovery-v2/world-handoff-v1", l = Object.freeze({
10
+ maxBytes: 65536,
11
+ maxInputs: 256
12
+ });
13
+ function u(t) {
14
+ throw new e({ detail: t });
15
+ }
16
+ var d = (e) => Number.isInteger(e) && e >= 0 && e <= 4294967295 ? e : u("Expected an unsigned32 lockstep word"), f = (e) => Number.isSafeInteger(e) && e >= 0 ? e : u("Expected a nonnegative safe integer"), p = (e) => ((!["departed", "cancelled"].includes(e.phase) || ![
17
+ e.transitionId,
18
+ e.entityId,
19
+ e.targetRoomId
20
+ ].every((e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(e)) || ![e.sourceEpoch, e.targetEpoch].every((e) => Number.isSafeInteger(e) && e > 0) || !Number.isSafeInteger(e.holdMs) || e.holdMs < 1 || e.holdMs > 3e5) && u("Invalid World handoff metadata"), f(e.tick), e), m = class {
21
+ maxBytes;
22
+ bytes = [];
23
+ constructor(e) {
24
+ this.maxBytes = e;
25
+ }
26
+ byte(e) {
27
+ (!Number.isInteger(e) || e < 0 || e > 255) && u("Expected an unsigned byte"), this.bytes.length >= this.maxBytes && u("Frame exceeds its byte budget"), this.bytes.push(e);
28
+ }
29
+ word(e) {
30
+ d(e);
31
+ for (let t = 0; t < 4; t++) this.byte(e >>> t * 8 & 255);
32
+ }
33
+ uint(e) {
34
+ let t = f(e);
35
+ do {
36
+ let e = t % 128;
37
+ t = Math.floor(t / 128), this.byte(e + (t > 0 ? 128 : 0));
38
+ } while (t > 0);
39
+ }
40
+ blob(e) {
41
+ e.byteLength > this.maxBytes - this.bytes.length && u("Blob exceeds its byte budget"), this.uint(e.byteLength);
42
+ for (let t of e) this.byte(t);
43
+ }
44
+ string(e) {
45
+ e.isWellFormed() || u("Strings must contain well-formed Unicode"), this.blob(new TextEncoder().encode(e));
46
+ }
47
+ finish() {
48
+ return Uint8Array.from(this.bytes);
49
+ }
50
+ }, h = class {
51
+ bytes;
52
+ at = 0;
53
+ constructor(e) {
54
+ this.bytes = e;
55
+ }
56
+ remaining() {
57
+ return this.bytes.byteLength - this.at;
58
+ }
59
+ byte() {
60
+ let e = this.bytes[this.at++];
61
+ return e === void 0 ? u("Truncated frame") : e;
62
+ }
63
+ word() {
64
+ let e = 0;
65
+ for (let t = 0; t < 4; t++) e += this.byte() * 2 ** (t * 8);
66
+ return e;
67
+ }
68
+ uint() {
69
+ let e = 0, t = 1;
70
+ for (let n = 0; n < 8; n++) {
71
+ let r = this.byte(), i = r & 127;
72
+ if (e += i * t, Number.isSafeInteger(e) || u("Varint exceeds the safe integer range"), r < 128) return n > 0 && i === 0 && u("Noncanonical varint"), e;
73
+ t *= 128;
74
+ }
75
+ u("Varint is too long");
76
+ }
77
+ blob() {
78
+ let e = this.uint();
79
+ e > this.remaining() && u("Truncated blob");
80
+ let t = this.bytes.slice(this.at, this.at + e);
81
+ return this.at += e, t;
82
+ }
83
+ string() {
84
+ return new TextDecoder("utf-8", { fatal: !0 }).decode(this.blob());
85
+ }
86
+ end() {
87
+ this.remaining() !== 0 && u("Trailing frame bytes");
88
+ }
89
+ }, g = (e) => {
90
+ let t = {
91
+ ...l,
92
+ ...e
93
+ };
94
+ return (!Number.isSafeInteger(t.maxBytes) || t.maxBytes < 1 || !Number.isSafeInteger(t.maxInputs) || t.maxInputs < 1) && u("Invalid frame limits"), t;
95
+ }, _ = (t) => t instanceof e ? t : new e({ detail: "Malformed frame" }), v = (e) => e.remaining() === 0 ? {} : { inputAck: {
96
+ lastAppliedSeq: e.uint(),
97
+ flags: e.byte()
98
+ } }, y = (e, t) => {
99
+ t !== void 0 && (e.uint(t.lastAppliedSeq), e.byte(t.flags));
100
+ }, b = (e, t) => {
101
+ if (!Array.isArray(e) || e.length < 1 || e.length > t || Reflect.ownKeys(e).length !== e.length + 1) return u("Lockstep arrays exceed count or dense-shape budget");
102
+ let n = [];
103
+ for (let t = 0; t < e.length; t++) {
104
+ let r = Object.getOwnPropertyDescriptor(e, String(t));
105
+ if (!r?.enumerable || !("value" in r)) return u("Lockstep arrays cannot contain holes or accessors");
106
+ n.push(r.value);
107
+ }
108
+ return n;
109
+ }, x = (e) => {
110
+ let t = 0, n = e;
111
+ for (; n !== 0;) n &= n - 1, t++;
112
+ return t;
113
+ }, S = (e) => x(e.hi) + x(e.lo), C = (e, n) => {
114
+ let r = t(n), i = S(r);
115
+ return i === 0 ? u("Lockstep player mask must contain at least one slot") : (e.word(r.hi), e.word(r.lo), i);
116
+ }, w = (e) => {
117
+ let t = {
118
+ hi: e.word(),
119
+ lo: e.word()
120
+ };
121
+ return S(t) === 0 ? u("Lockstep player mask must contain at least one slot") : t;
122
+ }, T = (e, t, n) => {
123
+ d(e), (!Number.isSafeInteger(t) || t < 1 || t > n || e > 4294967295 - t + 1) && u("Lockstep tick batch exceeds count or unsigned32 tick budget");
124
+ }, E = (e) => e instanceof Uint8Array ? e : u("Lockstep payloads require byte arrays"), D = (t, n = {}) => {
125
+ try {
126
+ let r = g(n);
127
+ t.byteLength > r.maxBytes && u("Frame exceeds its byte budget");
128
+ let a = new h(t), o;
129
+ switch (a.byte()) {
130
+ case 1: {
131
+ let e = a.uint(), t = a.blob(), n = a.uint(), r = a.remaining() > 1 ? a.uint() : void 0;
132
+ o = {
133
+ kind: "Hello",
134
+ protocolVersion: e,
135
+ token: t,
136
+ schemaHash: n,
137
+ ...r === void 0 ? {} : { resumeFromTick: r },
138
+ transportCaps: a.byte()
139
+ };
140
+ break;
141
+ }
142
+ case 2: {
143
+ let e = a.uint(), t = a.uint();
144
+ (t < 1 || t > r.maxInputs || e > 2 ** 53 - 1 - t + 1) && u("Input batch exceeds its sequence or count budget");
145
+ let n = [];
146
+ for (let e = 0; e < t; e++) n.push({
147
+ tickHint: a.uint(),
148
+ payload: a.blob()
149
+ });
150
+ o = {
151
+ kind: "Input",
152
+ firstSeq: e,
153
+ inputs: n,
154
+ ...a.remaining() === 0 ? {} : { ackTick: a.uint() }
155
+ };
156
+ break;
157
+ }
158
+ case 7: {
159
+ let e = a.uint(), t = a.uint();
160
+ T(e, t, r.maxInputs);
161
+ let n = [];
162
+ for (let e = 0; e < t; e++) n.push(a.blob());
163
+ o = {
164
+ kind: "LsInput",
165
+ firstTick: e,
166
+ inputs: n
167
+ };
168
+ break;
169
+ }
170
+ case 8:
171
+ o = {
172
+ kind: "LsHash",
173
+ tick: d(a.uint()),
174
+ hi: a.word(),
175
+ lo: a.word()
176
+ };
177
+ break;
178
+ case 138: {
179
+ let e = a.uint(), t = a.uint();
180
+ T(e, t, r.maxInputs);
181
+ let n = [], i = 0;
182
+ for (let e = 0; e < t; e++) {
183
+ let e = w(a), t = S(e);
184
+ i += t, i > r.maxInputs && u("Lockstep matrix cells exceed input count budget");
185
+ let o = [];
186
+ for (let e = 0; e < t; e++) o.push(a.blob());
187
+ n.push({
188
+ players: e,
189
+ inputs: o
190
+ });
191
+ }
192
+ o = {
193
+ kind: "LsInputs",
194
+ firstTick: e,
195
+ matrices: n
196
+ };
197
+ break;
198
+ }
199
+ case 139: {
200
+ let t = d(a.uint()), n = a.byte();
201
+ if (n === 0) {
202
+ let e = a.blob();
203
+ e.byteLength === 0 && u("Lockstep resync requires snapshot bytes"), o = {
204
+ kind: "LsDesync",
205
+ tick: t,
206
+ action: "resync",
207
+ snapshot: e
208
+ };
209
+ } else if (n === 1 || n === 2) o = {
210
+ kind: "LsDesync",
211
+ tick: t,
212
+ action: n === 1 ? "end" : "flag"
213
+ };
214
+ else return s.fail(new e({ detail: "Unknown lockstep desync action" }));
215
+ break;
216
+ }
217
+ case 140: {
218
+ let e = d(a.uint()), t = d(a.uint()), n = a.blob(), s = a.uint(), c = d(a.uint()), l = a.uint();
219
+ (l < 1 || l > Math.min(64, r.maxInputs)) && u("Start roster exceeds player count budget");
220
+ let f = [];
221
+ for (let e = 0; e < l; e++) f.push({
222
+ slot: a.byte(),
223
+ playerId: d(a.uint())
224
+ });
225
+ let p = i(f, Math.min(64, r.maxInputs));
226
+ !p.some((e) => e.playerId === c) && p.length >= 64 && u("Start recipient must belong to its actual roster");
227
+ let m = a.blob(), h = a.blob();
228
+ (m.byteLength > 0 && h.byteLength > 0 || e > 0 && m.byteLength === 0 && h.byteLength === 0 || e === 0 && h.byteLength > 0) && u("Recovered Start requires one actual history or positive-frontier snapshot"), o = {
229
+ kind: "LsStart",
230
+ startTick: e,
231
+ seed: t,
232
+ options: n,
233
+ serverTimeMs: s,
234
+ localPlayerId: c,
235
+ roster: p,
236
+ ...m.byteLength ? { history: m } : {},
237
+ ...h.byteLength ? { snapshot: h } : {}
238
+ };
239
+ break;
240
+ }
241
+ case 141:
242
+ o = {
243
+ kind: "LsStall",
244
+ waitingFor: w(a)
245
+ };
246
+ break;
247
+ case 143: {
248
+ let e = d(a.uint()), t = a.byte(), n = d(a.uint());
249
+ (e < 1 || t > 63) && u("Late join names an invalid tick or slot"), o = {
250
+ kind: "LsJoin",
251
+ tick: e,
252
+ slot: t,
253
+ playerId: n
254
+ };
255
+ break;
256
+ }
257
+ case 3: {
258
+ let e = a.uint(), t = a.remaining() === 0 ? void 0 : a.uint();
259
+ t !== void 0 && t > 1e3 && u("Loss estimate exceeds 1000 permille"), o = {
260
+ kind: "Ack",
261
+ tick: e,
262
+ ...t === void 0 ? {} : { lossPermille: t }
263
+ };
264
+ break;
265
+ }
266
+ case 4:
267
+ o = {
268
+ kind: "Ping",
269
+ clientTimeMs: a.uint()
270
+ };
271
+ break;
272
+ case 5:
273
+ o = {
274
+ kind: "ClientMessage",
275
+ channelId: a.uint(),
276
+ payload: a.blob()
277
+ };
278
+ break;
279
+ case 6:
280
+ o = {
281
+ kind: "Leave",
282
+ reason: a.byte()
283
+ };
284
+ break;
285
+ case 129:
286
+ o = {
287
+ kind: "Welcome",
288
+ sessionId: a.string(),
289
+ tick: a.uint(),
290
+ serverTimeMs: a.uint(),
291
+ epoch: a.uint(),
292
+ baseline: a.blob(),
293
+ transformRules: a.blob()
294
+ };
295
+ break;
296
+ case 130:
297
+ o = {
298
+ kind: "Delta",
299
+ tick: a.uint(),
300
+ baseTick: a.uint(),
301
+ patch: a.blob(),
302
+ ...v(a)
303
+ };
304
+ break;
305
+ case 131:
306
+ o = {
307
+ kind: "Full",
308
+ tick: a.uint(),
309
+ epoch: a.uint(),
310
+ baseline: a.blob(),
311
+ ...v(a)
312
+ };
313
+ break;
314
+ case 132:
315
+ o = {
316
+ kind: "InputAck",
317
+ lastAppliedSeq: a.uint(),
318
+ tick: a.uint(),
319
+ flags: a.byte()
320
+ };
321
+ break;
322
+ case 133: {
323
+ let e = a.uint(), t = a.uint(), n = a.uint(), r = a.remaining() === 0 ? void 0 : a.uint();
324
+ o = {
325
+ kind: "Pong",
326
+ clientTimeMs: e,
327
+ serverTimeMs: t,
328
+ tick: n,
329
+ ...r === void 0 ? {} : { deltaDatagramsSent: r }
330
+ };
331
+ break;
332
+ }
333
+ case 134:
334
+ o = {
335
+ kind: "ServerMessage",
336
+ channelId: a.uint(),
337
+ payload: a.blob()
338
+ };
339
+ break;
340
+ case 135:
341
+ o = {
342
+ kind: "Kick",
343
+ code: a.byte(),
344
+ reason: a.string()
345
+ };
346
+ break;
347
+ case 136: {
348
+ let e = a.string(), t = a.uint();
349
+ o = {
350
+ kind: "Migrate",
351
+ ...e === "" ? {} : { address: e },
352
+ graceMs: t
353
+ };
354
+ break;
355
+ }
356
+ case 142: {
357
+ let e = a.byte();
358
+ e > 1 && u("Invalid World handoff phase"), o = p({
359
+ kind: "WorldHandoff",
360
+ phase: e === 0 ? "departed" : "cancelled",
361
+ transitionId: a.string(),
362
+ entityId: a.string(),
363
+ tick: a.uint(),
364
+ sourceEpoch: a.uint(),
365
+ targetRoomId: a.string(),
366
+ targetEpoch: a.uint(),
367
+ holdMs: a.uint()
368
+ });
369
+ break;
370
+ }
371
+ case 137:
372
+ o = {
373
+ kind: "Error",
374
+ code: a.byte(),
375
+ detail: a.string()
376
+ };
377
+ break;
378
+ default: return s.fail(new e({ detail: "Unknown frame kind" }));
379
+ }
380
+ return a.end(), s.succeed(o);
381
+ } catch (e) {
382
+ return s.fail(_(e));
383
+ }
384
+ }, O = (e, t = {}) => {
385
+ try {
386
+ let n = g(t), r = new m(n.maxBytes);
387
+ switch (e.kind) {
388
+ case "Hello":
389
+ r.byte(1), r.uint(e.protocolVersion), r.blob(e.token), r.uint(e.schemaHash), e.resumeFromTick !== void 0 && r.uint(e.resumeFromTick), r.byte(e.transportCaps);
390
+ break;
391
+ case "Input":
392
+ (e.inputs.length < 1 || e.inputs.length > n.maxInputs || e.firstSeq > 2 ** 53 - 1 - e.inputs.length + 1) && u("Input batch exceeds its sequence or count budget"), r.byte(2), r.uint(e.firstSeq), r.uint(e.inputs.length);
393
+ for (let t of e.inputs) r.uint(t.tickHint), r.blob(t.payload);
394
+ e.ackTick !== void 0 && r.uint(e.ackTick);
395
+ break;
396
+ case "LsInput": {
397
+ let t = b(e.inputs, n.maxInputs);
398
+ T(e.firstTick, t.length, n.maxInputs), r.byte(7), r.uint(e.firstTick), r.uint(t.length);
399
+ for (let e of t) r.blob(E(e));
400
+ break;
401
+ }
402
+ case "LsHash":
403
+ r.byte(8), r.uint(d(e.tick)), r.word(e.hi), r.word(e.lo);
404
+ break;
405
+ case "LsInputs": {
406
+ let t = b(e.matrices, n.maxInputs);
407
+ T(e.firstTick, t.length, n.maxInputs), r.byte(138), r.uint(e.firstTick), r.uint(t.length);
408
+ let i = 0;
409
+ for (let e of t) {
410
+ e && Object.getPrototypeOf(e) === Object.prototype && Reflect.ownKeys(e).length === 2 || u("Lockstep matrices require exact own players/inputs data");
411
+ let t = Object.getOwnPropertyDescriptor(e, "players"), a = Object.getOwnPropertyDescriptor(e, "inputs");
412
+ t?.enumerable && a?.enumerable && "value" in t && "value" in a || u("Lockstep matrix accessors refuse");
413
+ let o = C(r, t.value), s = b(a.value, 64);
414
+ (s.length !== o || (i += o) > n.maxInputs) && u("Lockstep matrix mask/cell count exceeds input budget");
415
+ for (let e of s) r.blob(E(e));
416
+ }
417
+ break;
418
+ }
419
+ case "LsDesync":
420
+ r.byte(139), r.uint(d(e.tick)), e.action === "resync" ? (E(e.snapshot).byteLength === 0 && u("Lockstep resync requires snapshot bytes"), r.byte(0), r.blob(e.snapshot)) : e.action === "end" || e.action === "flag" ? (Object.hasOwn(e, "snapshot") && u("Only resync may carry snapshot bytes"), r.byte(e.action === "end" ? 1 : 2)) : u("Unknown lockstep desync action");
421
+ break;
422
+ case "LsStart": {
423
+ let t = Object.getOwnPropertyDescriptor(e, "roster"), a = Object.getOwnPropertyDescriptor(e, "localPlayerId");
424
+ t?.enumerable && a?.enumerable && "value" in t && "value" in a || u("Start identity requires own data without accessors");
425
+ let o = i(t.value, Math.min(64, n.maxInputs)), s = d(a.value);
426
+ !o.some((e) => e.playerId === s) && o.length >= 64 && u("Start recipient must belong to its actual roster"), r.byte(140), r.uint(d(e.startTick)), r.uint(d(e.seed)), r.blob(E(e.options)), r.uint(e.serverTimeMs), r.uint(s), r.uint(o.length);
427
+ for (let e of o) r.byte(e.slot), r.uint(e.playerId);
428
+ let c = Object.getOwnPropertyDescriptor(e, "history");
429
+ (c && (!c.enumerable || !("value" in c)) || !c && "history" in e) && u("Start history requires own data without accessors");
430
+ let l = Object.getOwnPropertyDescriptor(e, "snapshot");
431
+ (l && (!l.enumerable || !("value" in l)) || !l && "snapshot" in e) && u("Start snapshot requires own data without accessors");
432
+ let f = c ? E(c.value) : /* @__PURE__ */ new Uint8Array(), p = l ? E(l.value) : /* @__PURE__ */ new Uint8Array();
433
+ (f.byteLength > 0 && p.byteLength > 0 || e.startTick > 0 && !f.byteLength && !p.byteLength || e.startTick === 0 && p.byteLength > 0) && u("Recovered Start requires one actual history or positive-frontier snapshot"), r.blob(f), r.blob(p);
434
+ break;
435
+ }
436
+ case "LsStall":
437
+ r.byte(141), C(r, e.waitingFor);
438
+ break;
439
+ case "LsJoin":
440
+ (d(e.tick) < 1 || !Number.isInteger(e.slot) || e.slot < 0 || e.slot > 63) && u("Late join names an invalid tick or slot"), r.byte(143), r.uint(e.tick), r.byte(e.slot), r.uint(d(e.playerId));
441
+ break;
442
+ case "Ack":
443
+ e.lossPermille !== void 0 && (!Number.isSafeInteger(e.lossPermille) || e.lossPermille < 0 || e.lossPermille > 1e3) && u("Loss estimate must be 0–1000 permille"), r.byte(3), r.uint(e.tick), e.lossPermille !== void 0 && r.uint(e.lossPermille);
444
+ break;
445
+ case "Ping":
446
+ r.byte(4), r.uint(e.clientTimeMs);
447
+ break;
448
+ case "ClientMessage":
449
+ r.byte(5), r.uint(e.channelId), r.blob(e.payload);
450
+ break;
451
+ case "Leave":
452
+ r.byte(6), r.byte(e.reason);
453
+ break;
454
+ case "Welcome":
455
+ r.byte(129), r.string(e.sessionId), r.uint(e.tick), r.uint(e.serverTimeMs), r.uint(e.epoch), r.blob(e.baseline), r.blob(e.transformRules);
456
+ break;
457
+ case "Delta":
458
+ r.byte(130), r.uint(e.tick), r.uint(e.baseTick), r.blob(e.patch), y(r, e.inputAck);
459
+ break;
460
+ case "Full":
461
+ r.byte(131), r.uint(e.tick), r.uint(e.epoch), r.blob(e.baseline), y(r, e.inputAck);
462
+ break;
463
+ case "InputAck":
464
+ r.byte(132), r.uint(e.lastAppliedSeq), r.uint(e.tick), r.byte(e.flags);
465
+ break;
466
+ case "Pong":
467
+ r.byte(133), r.uint(e.clientTimeMs), r.uint(e.serverTimeMs), r.uint(e.tick), e.deltaDatagramsSent !== void 0 && r.uint(e.deltaDatagramsSent);
468
+ break;
469
+ case "ServerMessage":
470
+ r.byte(134), r.uint(e.channelId), r.blob(e.payload);
471
+ break;
472
+ case "Kick":
473
+ r.byte(135), r.byte(e.code), r.string(e.reason);
474
+ break;
475
+ case "Migrate":
476
+ r.byte(136), r.string(e.address ?? ""), r.uint(e.graceMs);
477
+ break;
478
+ case "WorldHandoff":
479
+ p(e), r.byte(142), r.byte(e.phase === "departed" ? 0 : 1), r.string(e.transitionId), r.string(e.entityId), r.uint(e.tick), r.uint(e.sourceEpoch), r.string(e.targetRoomId), r.uint(e.targetEpoch), r.uint(e.holdMs);
480
+ break;
481
+ case "Error":
482
+ r.byte(137), r.byte(e.code), r.string(e.detail);
483
+ break;
484
+ default: u("Unknown frame kind");
485
+ }
486
+ return s.succeed(r.finish());
487
+ } catch (e) {
488
+ return s.fail(_(e));
489
+ }
490
+ };
491
+ export { n as RoomInputCodec, r as RoomStateCodec, D as decodeRoomFrame, O as encodeRoomFrame, a as geometryNativeCodecMetadata, o as geometryWorldMetadata, c as roomFrameLayout };
@@ -0,0 +1,27 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { RoomHostWithdrawalPort as t } from "./ports.js";
3
+ import { captureRoomHostWithdrawalInput as n } from "./ownershipWithdrawal.js";
4
+ import { Effect as r, Layer as i } from "effect";
5
+ // src/withdrawalPort.ts
6
+ var a = (t) => {
7
+ let i = t.host.id, a = t.withdraw.bind(t);
8
+ return Object.freeze({ withdraw: (t, o) => {
9
+ try {
10
+ if (t !== i) throw new e({ detail: "Room withdrawal belongs to another host" });
11
+ let s = n(o);
12
+ return r.uninterruptible(r.tryPromise({
13
+ try: () => a(s),
14
+ catch: (t) => t instanceof e ? t : new e({ detail: "Room owner withdrawal remains unconfirmed" })
15
+ }));
16
+ } catch (t) {
17
+ return r.fail(t instanceof e ? t : new e({ detail: "Invalid room ownership withdrawal" }));
18
+ }
19
+ } });
20
+ }, o = (e) => i.succeed(t, a(e)), s = (t) => Object.freeze({ withdraw: (n, i) => {
21
+ let o = r.fail(new e({ detail: "Room owner withdrawal remains unconfirmed" })), s = t.local();
22
+ if (s === void 0) return o;
23
+ if (n === s.host.id) return a(s).withdraw(n, i);
24
+ let c = t.peers();
25
+ return c === void 0 ? o : c.withdraw(n, i);
26
+ } });
27
+ export { o as controllerRoomHostWithdrawalLayer, a as controllerRoomHostWithdrawalService, s as routedRoomHostWithdrawalService };