@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
@@ -0,0 +1,77 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { Effect as t, Option as n } from "effect";
3
+ import { randomUUID as r } from "node:crypto";
4
+ import { HotError as i } from "@voltro/kv/hot/contract";
5
+ // src/worldLeases.ts
6
+ var a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakSet(), s = (e) => a.get(e), c = (e) => typeof e == "object" && !!e && o.has(e);
7
+ function l() {
8
+ throw new e({ detail: "Invalid World transition lease admission" });
9
+ }
10
+ var u = (e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(e) ? e : l(), d = (e) => {
11
+ e && Object.getPrototypeOf(e) === Object.prototype || l();
12
+ for (let t of Reflect.ownKeys(e)) {
13
+ let n = Object.getOwnPropertyDescriptor(e, t);
14
+ typeof t == "string" && [
15
+ "namespace",
16
+ "tenantId",
17
+ "ttlMs"
18
+ ].includes(t) && n?.enumerable && "value" in n || l();
19
+ }
20
+ let t = e.namespace, n = u(e.tenantId), r = e.ttlMs;
21
+ return (typeof t != "string" || !/^[A-Za-z0-9][A-Za-z0-9:_-]{0,95}$/.test(t) || !Number.isSafeInteger(r) || r <= 0) && l(), Object.freeze({
22
+ namespace: t,
23
+ tenantId: n,
24
+ ttlMs: r
25
+ });
26
+ }, f = (s, c) => {
27
+ let { namespace: f, tenantId: p, ttlMs: m } = d(c);
28
+ (typeof s.setNx != "function" || typeof s.compareDelete != "function" || typeof s.compareExpire != "function") && l();
29
+ let h = s.setNx.bind(s), g = s.compareDelete.bind(s), _ = s.compareExpire.bind(s), v = (n) => t.suspend(() => {
30
+ let r;
31
+ try {
32
+ r = n();
33
+ } catch {
34
+ return t.fail(new e({ detail: "World transition lease provider refused admission" }));
35
+ }
36
+ return t.isEffect(r) ? r.pipe(t.mapError((e) => new i({
37
+ operation: e.operation,
38
+ key: "worldTransitionLease",
39
+ reason: e.reason
40
+ })), t.flatMap((n) => typeof n == "boolean" ? t.succeed(n) : t.fail(new e({ detail: "Invalid World transition lease result" })))) : t.fail(new e({ detail: "World transition lease provider must return an Effect" }));
41
+ }), y = (e) => `${f}:wt:${Buffer.from(JSON.stringify([p, u(e)]), "utf8").toString("base64url")}`;
42
+ return Object.freeze({
43
+ tenantId: p,
44
+ acquire: (e) => {
45
+ let i = y(e);
46
+ return t.suspend(() => {
47
+ let e = r();
48
+ return v(() => h(i, e, m)).pipe(t.map((t) => {
49
+ if (!t) return n.none();
50
+ let r = Object.freeze({
51
+ renew: () => v(() => _(i, e, m)),
52
+ release: () => v(() => g(i, e))
53
+ });
54
+ return a.set(r, e), n.some(r);
55
+ }));
56
+ });
57
+ },
58
+ verify: (r, i) => t.suspend(() => {
59
+ let a;
60
+ try {
61
+ a = y(r), typeof i == "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(i) || l();
62
+ } catch {
63
+ return t.fail(new e({ detail: "Invalid World transition lease admission" }));
64
+ }
65
+ return v(() => _(a, i, m)).pipe(t.map((e) => {
66
+ if (!e) return n.none();
67
+ let t = Object.freeze({ renew: () => v(() => _(a, i, m)) });
68
+ return o.add(t), n.some(t);
69
+ }));
70
+ })
71
+ });
72
+ }, p = async (t, n) => {
73
+ let r = d(n);
74
+ if (!t.connectionRegistry || typeof t.hotStore != "function") throw new e({ detail: "World transition leases require the app-owned registry and tenant HotStore" });
75
+ return f(await t.hotStore.bind(t)({ tenantId: r.tenantId }), r);
76
+ };
77
+ export { p as bindWorldTransitionLeases, c as isVerifiedWorldTransitionLease, f as makeWorldTransitionLeases, s as worldTransitionLeaseToken };
@@ -0,0 +1,24 @@
1
+ // src/worldManifest.ts
2
+ var e = Object.freeze({
3
+ slots: Object.freeze({
4
+ onWorldChange: Object.freeze({
5
+ defaultExport: "defaultWorldOnWorldChange",
6
+ fixtureExport: "worldOnWorldChangeSlotFixture"
7
+ }),
8
+ layerPolicy: Object.freeze({
9
+ defaultExport: "defaultWorldLayerPolicy",
10
+ fixtureExport: "worldLayerPolicySlotFixture"
11
+ }),
12
+ transitionPolicy: Object.freeze({
13
+ defaultExport: "defaultWorldTransitionPolicy",
14
+ fixtureExport: "worldTransitionPolicySlotFixture"
15
+ })
16
+ }),
17
+ ports: Object.freeze({ transition: Object.freeze({
18
+ tagExport: "WorldTransitionPort",
19
+ fakeLayerExport: "worldTransitionFakeLayer",
20
+ fixtureExport: "worldTransitionPortFixture"
21
+ }) }),
22
+ events: Object.freeze([])
23
+ });
24
+ export { e as worldSystemContractManifest };
@@ -0,0 +1,62 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { captureWorldData as t } from "./worldData.js";
3
+ // src/worldMovement.ts
4
+ function n() {
5
+ throw new e({ detail: "World movement requires finite positions in its acquired source cell" });
6
+ }
7
+ var r = (e) => {
8
+ let r = t(e, 128);
9
+ return !Array.isArray(r) || r.length !== 2 || !r.every(Number.isFinite) ? n() : r;
10
+ }, i = (e) => {
11
+ if (e === 0) return -Number.MIN_VALUE;
12
+ let t = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
13
+ return t.setFloat64(0, e), t.setBigUint64(0, t.getBigUint64(0) + (e > 0 ? -1n : 1n)), t.getFloat64(0);
14
+ }, a = (e) => {
15
+ let a = t(e, 256);
16
+ if (!Array.isArray(a) || a.length !== 2) return n();
17
+ let o = r(a[0]), s = r(a[1]), c = Object.freeze([i(s[0]), i(s[1])]);
18
+ if (o[0] >= s[0] || o[1] >= s[1] || c[0] < o[0] || c[1] < o[1]) return n();
19
+ let l = (e) => e[0] >= o[0] && e[0] < s[0] && e[1] >= o[1] && e[1] < s[1], u = (e, t) => {
20
+ let i = r(e), a = r(t);
21
+ if (!l(i)) return n();
22
+ if (l(a)) return Object.freeze({
23
+ at: a,
24
+ clamped: !1
25
+ });
26
+ let u = 1;
27
+ for (let e of [0, 1]) {
28
+ let t = a[e] - i[e];
29
+ if (!Number.isFinite(t)) return n();
30
+ t > 0 && a[e] >= s[e] && (u = Math.min(u, (c[e] - i[e]) / t)), t < 0 && a[e] < o[e] && (u = Math.min(u, (o[e] - i[e]) / t));
31
+ }
32
+ let d = Object.freeze([0, 1].map((e) => Math.max(o[e], Math.min(c[e], i[e] + (a[e] - i[e]) * u))));
33
+ return l(d) ? Object.freeze({
34
+ at: d,
35
+ clamped: !0
36
+ }) : n();
37
+ };
38
+ return Object.freeze({
39
+ bounds: a,
40
+ approach: (e, t, a) => {
41
+ let d = r(e), f = r(t);
42
+ if (!l(d) || !Number.isFinite(a) || a < 0) return n();
43
+ let p, m = Infinity;
44
+ for (let e of [0, 1]) {
45
+ let t = f[e] - d[e];
46
+ if (!Number.isFinite(t)) return n();
47
+ if (t === 0) continue;
48
+ let r = t > 0 ? s[e] - f[e] : f[e] - o[e], i = ((t > 0 ? s[e] : o[e]) - d[e]) / t;
49
+ r <= a && i < m && (p = e, m = i);
50
+ }
51
+ if (p === void 0) return null;
52
+ let h = p, g = +(h === 0), _ = f[h] > d[h], v = _ ? f[h] >= s[h] : f[h] < o[h], y = [0, 0];
53
+ return y[h] = _ ? s[h] : i(o[h]), y[g] = Math.max(o[g], Math.min(c[g], d[g] + (f[g] - d[g]) * m)), y.every(Number.isFinite) ? Object.freeze({
54
+ sourceAt: u(d, f).at,
55
+ targetAt: Object.freeze(y),
56
+ crossing: v
57
+ }) : n();
58
+ },
59
+ constrain: u
60
+ });
61
+ };
62
+ export { a as makeWorldCellMovement };
@@ -0,0 +1,133 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { Effect as n } from "effect";
3
+ import { randomUUID as r } from "node:crypto";
4
+ // src/worldPersistence.ts
5
+ function i(e) {
6
+ throw new t({ detail: e });
7
+ }
8
+ var a = (e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(e) ? e : i("Invalid World persistence scope"), o = (e) => typeof e == "number" && Number.isSafeInteger(e) && e > 0 && e < 2147483647 ? e : i("Invalid World persistence budget"), s = (e) => {
9
+ e && Object.getPrototypeOf(e) === Object.prototype || i("World persistence requires own options");
10
+ for (let t of Reflect.ownKeys(e)) {
11
+ let n = Object.getOwnPropertyDescriptor(e, t);
12
+ typeof t == "string" && [
13
+ "tenantId",
14
+ "roomId",
15
+ "maxEntries",
16
+ "maxRows",
17
+ "maxDelayMs",
18
+ "epochNow",
19
+ "onPersisted"
20
+ ].includes(t) && n?.enumerable && "value" in n || i("Invalid World persistence option");
21
+ }
22
+ }, c = (e) => Array.isArray(e) ? e.map(c) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => [e, c(t)])) : e, l = (e, t) => e.tenantId === t.tenantId && e.entityId === t.entityId && e.source.worldId === t.source.worldId && e.source.zoneId === t.source.zoneId && e.source.layer === t.source.layer && e.source.roomId === t.source.roomId && e.source.epoch === t.source.epoch, u = (r) => n.suspend(() => {
23
+ let i;
24
+ try {
25
+ i = r();
26
+ } catch (r) {
27
+ return n.fail(r instanceof e || r instanceof t ? r : new t({ detail: "World persistence operation remains incomplete" }));
28
+ }
29
+ return n.isEffect(i) ? i : n.fail(new t({ detail: "World persistence provider requires an Effect" }));
30
+ }), d = (d, f) => {
31
+ s(f);
32
+ let p = a(f.tenantId), m = a(f.roomId), h = o(f.maxEntries), g = o(f.maxRows ?? 500), _ = o(f.maxDelayMs ?? 1e3), v = f.epochNow, y = f.onPersisted;
33
+ (g > h || g > o(d.persistenceBatchRows) || typeof v != "function" || typeof y != "function" || typeof d.capturePersistence != "function" || typeof d.persistBatchFromCommand != "function" || typeof d.observe != "function") && i("World persistence requires complete source and budgets");
34
+ let b = d.capturePersistence.bind(d), x = d.persistBatchFromCommand.bind(d), S = d.observe.bind(d), C = /* @__PURE__ */ new Map(), w = null, T = 0, E = !1, D = !1, O = !1, k = 0, A = () => {
35
+ let e = v();
36
+ return (!Number.isSafeInteger(e) || e < k || e < 0 || e > 864e13) && i("World persistence clock moved backwards or is invalid"), k = e, e;
37
+ }, j = () => {
38
+ let e = null;
39
+ for (let t of C.values()) e = e === null ? t.firstAt : Math.min(e, t.firstAt);
40
+ for (let t of w?.rows ?? []) e = e === null ? t.firstAt : Math.min(e, t.firstAt);
41
+ return e;
42
+ }, M = () => Object.freeze({
43
+ dirty: C.size,
44
+ pending: w?.rows.length ?? 0,
45
+ oldestAt: j(),
46
+ closing: D,
47
+ closed: O
48
+ }), N = (t) => {
49
+ (D || O) && i("World persistence is closing");
50
+ let n = b(t), r = n.input;
51
+ (r.tenantId !== p || r.source.roomId !== m) && i("World persistence snapshot escaped its owner");
52
+ let a = C.get(r.entityId), o = w?.rows.find((e) => e.input.entityId === r.entityId), s = a ?? o;
53
+ if (s && (!l(s.input, r) || s.cellId !== n.cellId || s.input.expectedRevision !== r.expectedRevision) && i("World persistence snapshot changed its active owner or revision"), !s && C.size >= h) throw new e({
54
+ budget: "worldPersistenceEntries",
55
+ limit: h
56
+ });
57
+ T === 2 ** 53 - 1 && i("World persistence generation exhausted"), C.set(r.entityId, Object.freeze({
58
+ input: r,
59
+ cellId: n.cellId,
60
+ generation: ++T,
61
+ firstAt: s?.firstAt ?? A()
62
+ }));
63
+ }, P = () => {
64
+ if (O) return !1;
65
+ if (w !== null || C.size >= g) return !0;
66
+ let e = j();
67
+ return e !== null && A() - e >= _;
68
+ }, F = (e, t) => {
69
+ let n = e.input;
70
+ (t === null || t.tenantId !== p || t.entityId !== n.entityId || t.revision !== n.expectedRevision + 1 || t.worldId !== n.source.worldId || t.zoneId !== n.source.zoneId || t.layer !== n.source.layer || t.cellId !== e.cellId || t.roomId !== m || t.epoch !== n.source.epoch || JSON.stringify(c(t.data)) !== JSON.stringify(c(n.data))) && i("World persistence confirmation lost its exact committed snapshot");
71
+ }, I = () => u(() => n.gen(function* () {
72
+ if (w === null) {
73
+ if (C.size === 0) return;
74
+ let e = [...C.values()].sort((e, t) => e.input.entityId < t.input.entityId ? -1 : +(e.input.entityId > t.input.entityId)).slice(0, g);
75
+ w = Object.freeze({
76
+ rows: Object.freeze(e),
77
+ origin: Object.freeze({
78
+ tenantId: p,
79
+ roomId: m,
80
+ requestId: `world-persist:${r()}`
81
+ })
82
+ });
83
+ }
84
+ let e = w;
85
+ yield* u(() => x(e.rows.map((e) => e.input), e.origin));
86
+ let t = [];
87
+ for (let n of e.rows) {
88
+ let e = yield* u(() => S({
89
+ tenantId: p,
90
+ entityId: n.input.entityId
91
+ }));
92
+ F(n, e), t.push(e);
93
+ }
94
+ A();
95
+ let n = [];
96
+ for (let t of e.rows) {
97
+ let e = C.get(t.input.entityId);
98
+ !e || e.generation === t.generation ? n.push([t.input.entityId, null]) : n.push([t.input.entityId, Object.freeze({
99
+ ...e,
100
+ input: b({
101
+ ...e.input,
102
+ expectedRevision: t.input.expectedRevision + 1
103
+ }).input
104
+ })]);
105
+ }
106
+ let a;
107
+ try {
108
+ a = y(Object.freeze(t));
109
+ } catch {
110
+ i("World persistence actor revision update remains incomplete");
111
+ }
112
+ a !== void 0 && (a instanceof Promise && a.catch(() => void 0), i("World persistence actor revision update must be synchronous"));
113
+ for (let [e, t] of n) t === null ? C.delete(e) : C.set(e, t);
114
+ w = null;
115
+ })), L = (e) => n.suspend(() => O ? n.void : E ? n.fail(new t({ detail: "World persistence flush is already running" })) : (E = !0, n.uninterruptible(u(e)).pipe(n.ensuring(n.sync(() => {
116
+ E = !1;
117
+ }))))), R = () => L(I);
118
+ return Object.freeze({
119
+ mark: N,
120
+ observation: M,
121
+ isDue: P,
122
+ flush: R,
123
+ runDue: () => u(() => P() ? R() : n.void),
124
+ close: () => L(() => n.gen(function* () {
125
+ D = !0;
126
+ let e = Math.ceil(h / g) + 1;
127
+ for (let t = 0; t < e && (w !== null || C.size > 0); t++) yield* I();
128
+ if (w !== null || C.size > 0) return yield* n.fail(new t({ detail: "World persistence shutdown retains incomplete batches" }));
129
+ O = !0;
130
+ }))
131
+ });
132
+ };
133
+ export { d as makeWorldPersistence };
@@ -0,0 +1,220 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { captureWorldCatalog as n, worldCellAt as r } from "./world.js";
3
+ import { Effect as i, Option as a } from "effect";
4
+ import { HotError as o, readHotStoreWithFallback as s } from "@voltro/kv/hot/contract";
5
+ // src/worldProjection.ts
6
+ function c(e) {
7
+ throw new t({ detail: e });
8
+ }
9
+ var l = (e) => typeof e == "string" && e.length > 0 && e.length <= 191 && e.trim() === e ? e : c("Invalid World projection identity"), u = (e, t = 0) => typeof e == "number" && Number.isSafeInteger(e) && e >= t ? e : c("Invalid World projection counter"), d = (e, t) => {
10
+ typeof e == "object" && e && Object.getPrototypeOf(e) === Object.prototype || c("World projection requires plain own data");
11
+ for (let n of Reflect.ownKeys(e)) {
12
+ let r = Object.getOwnPropertyDescriptor(e, n);
13
+ typeof n == "string" && t.includes(n) && r?.enumerable && "value" in r || c("Invalid World projection field");
14
+ }
15
+ }, f = (e) => {
16
+ d(e, [
17
+ "namespace",
18
+ "tenantId",
19
+ "world",
20
+ "ttlMs",
21
+ "maxEntries",
22
+ "maxPayloadBytes",
23
+ "onUnavailable"
24
+ ]);
25
+ let t = e.namespace, r = l(e.tenantId), i = n([e.world])[0], a = u(e.ttlMs, 1), o = u(e.maxEntries, 1), s = u(e.maxPayloadBytes, 1), f = e.onUnavailable ?? "fail";
26
+ return (typeof t != "string" || !/^[a-zA-Z0-9][a-zA-Z0-9:_-]{0,95}$/.test(t) || o === 2 ** 53 - 1 || f !== "fail" && f !== "degrade") && c("Invalid World projection namespace, budgets or availability policy"), Object.freeze({
27
+ namespace: t,
28
+ tenantId: r,
29
+ world: i,
30
+ ttlMs: a,
31
+ maxEntries: o,
32
+ maxPayloadBytes: s,
33
+ onUnavailable: f
34
+ });
35
+ }, p = (e, t) => {
36
+ d(e, [
37
+ "zoneId",
38
+ "cellId",
39
+ "layer",
40
+ "roomId",
41
+ "hostId",
42
+ "epoch",
43
+ "revision",
44
+ "players",
45
+ "state"
46
+ ]);
47
+ let n = (t) => Object.getOwnPropertyDescriptor(e, t)?.value, i = l(n("zoneId")), a = l(n("cellId")), o = t.zones.find((e) => e.id === i);
48
+ o || c("World projection refers to an unconfigured zone");
49
+ let s = a.split(":"), f = Number(s[1]), p = Number(s[2]);
50
+ (s.length !== 3 || s[0] !== i || !Number.isSafeInteger(f) || f < 0 || String(f) !== s[1] || !Number.isSafeInteger(p) || p < 0 || String(p) !== s[2]) && c("Invalid World projection cell");
51
+ let m = o.cells?.size ?? Math.max(o.bounds[1][0] - o.bounds[0][0], o.bounds[1][1] - o.bounds[0][1]);
52
+ r(t, {
53
+ zone: i,
54
+ at: [o.bounds[0][0] + f * m, o.bounds[0][1] + p * m]
55
+ }).id !== a && c("World projection escaped configured geometry");
56
+ let h = u(n("layer"), 1), g = l(n("roomId")), _ = n("hostId"), v = _ === null ? null : l(_), y = u(n("epoch"), 1), b = u(n("revision"), 1), x = u(n("players")), S = n("state");
57
+ return (S !== "live" && S !== "hibernated" || S === "hibernated" && (v !== null || x !== 0) || S === "live" && v === null || o.layering !== void 0 && x > o.layering.maxPlayers) && c("Contradictory World projection hint"), Object.freeze({
58
+ zoneId: i,
59
+ cellId: a,
60
+ layer: h,
61
+ roomId: g,
62
+ hostId: v,
63
+ epoch: y,
64
+ revision: b,
65
+ players: x,
66
+ state: S
67
+ });
68
+ }, m = (n, r, l) => {
69
+ let { namespace: u, tenantId: m, world: h, ttlMs: g, maxEntries: _, maxPayloadBytes: v, onUnavailable: y } = f(l);
70
+ typeof n.list != "function" && c("World projection requires an actual SQL source");
71
+ let b = n.list.bind(n), x = `${u}:world-cells:${Buffer.from(JSON.stringify([m, h.name]), "utf8").toString("base64url")}`, S = (t) => {
72
+ if (!Array.isArray(t) || t.length > _ || Reflect.ownKeys(t).length !== t.length + 1) throw new e({
73
+ budget: "worldProjectionEntries",
74
+ limit: _
75
+ });
76
+ let n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
77
+ for (let e = 0; e < t.length; e++) {
78
+ let a = Object.getOwnPropertyDescriptor(t, String(e));
79
+ a && "value" in a || c("World projection entries must be own data");
80
+ let o = p(a.value, h), s = JSON.stringify([
81
+ o.zoneId,
82
+ o.cellId,
83
+ o.layer
84
+ ]);
85
+ (r.has(s) || i.has(o.roomId)) && c("Duplicate World projection routing identity"), r.add(s), i.add(o.roomId), n.push(o);
86
+ }
87
+ return Object.freeze(n);
88
+ }, C = () => i.suspend(() => {
89
+ let n;
90
+ try {
91
+ n = b({
92
+ tenantId: m,
93
+ worldId: h.name
94
+ }, _);
95
+ } catch {
96
+ return i.fail(new t({ detail: "World projection source admission remains incomplete" }));
97
+ }
98
+ return i.isEffect(n) ? n.pipe(i.flatMap((n) => i.try({
99
+ try: () => {
100
+ if (!Array.isArray(n) || Object.getPrototypeOf(n) !== Array.prototype || n.length > _ || Reflect.ownKeys(n).length !== n.length + 1) throw new e({
101
+ budget: "worldProjectionEntries",
102
+ limit: _
103
+ });
104
+ for (let e = 0; e < n.length; e++) {
105
+ let t = Object.getOwnPropertyDescriptor(n, String(e));
106
+ t?.enumerable && "value" in t || c("World SQL projection source must contain own data");
107
+ }
108
+ let t = n.map((e) => (d(e, [
109
+ "id",
110
+ "tenantId",
111
+ "worldId",
112
+ "zoneId",
113
+ "cellId",
114
+ "layer",
115
+ "roomId",
116
+ "hostId",
117
+ "epoch",
118
+ "revision",
119
+ "players",
120
+ "state",
121
+ "updatedAt"
122
+ ]), (e.tenantId !== m || e.worldId !== h.name) && c("World SQL source escaped the exact projection scope"), {
123
+ zoneId: e.zoneId,
124
+ cellId: e.cellId,
125
+ layer: e.layer,
126
+ roomId: e.roomId,
127
+ hostId: e.hostId,
128
+ epoch: e.epoch,
129
+ revision: e.revision,
130
+ players: e.players,
131
+ state: e.state
132
+ })), r = S(t);
133
+ if (Buffer.byteLength(JSON.stringify({
134
+ version: 1,
135
+ tenantId: m,
136
+ worldId: h.name,
137
+ entries: r
138
+ }), "utf8") > v) throw new e({
139
+ budget: "worldProjectionPayloadBytes",
140
+ limit: v
141
+ });
142
+ return r;
143
+ },
144
+ catch: (n) => n instanceof e ? n : new t({ detail: "World projection SQL source failed admission" })
145
+ }))) : i.fail(new t({ detail: "World projection source must return an Effect" }));
146
+ }), w = (e) => i.try({
147
+ try: () => {
148
+ Buffer.byteLength(e, "utf8") > v && c("World projection cached payload exceeds its read budget");
149
+ let t = JSON.parse(e);
150
+ d(t, [
151
+ "version",
152
+ "tenantId",
153
+ "worldId",
154
+ "entries"
155
+ ]);
156
+ let n = (e) => Object.getOwnPropertyDescriptor(t, e)?.value;
157
+ (n("version") !== 1 || n("tenantId") !== m || n("worldId") !== h.name) && c("Cached World projection escaped its scope");
158
+ let r = n("entries");
159
+ return Array.isArray(r) || c("Missing World projection entries"), S(r);
160
+ },
161
+ catch: () => new t({ detail: "Cached World routing hints failed admission" })
162
+ }), T = (e, t) => t.pipe(i.mapError((t) => t._tag === "HotError" ? new o({
163
+ operation: e,
164
+ key: "worldCells",
165
+ reason: t.reason
166
+ }) : t));
167
+ return Object.freeze({
168
+ hints: () => T("worldCellsRead", i.gen(function* () {
169
+ let e = yield* s({
170
+ store: r,
171
+ onUnavailable: y,
172
+ read: (e) => e.hget(x, "payload", { consistency: "primary" }).pipe(i.map((e) => ({
173
+ kind: "hot",
174
+ value: e
175
+ }))),
176
+ fallback: () => C().pipe(i.map((e) => ({
177
+ kind: "sql",
178
+ value: e
179
+ })))
180
+ });
181
+ return e.kind === "sql" ? e.value : a.isNone(e.value) ? yield* C() : yield* w(e.value.value);
182
+ })),
183
+ rebuildFromSource: () => T("worldCellsRebuild", i.gen(function* () {
184
+ let t = yield* C(), n = JSON.stringify({
185
+ version: 1,
186
+ tenantId: m,
187
+ worldId: h.name,
188
+ entries: t
189
+ });
190
+ return Buffer.byteLength(n, "utf8") > v ? yield* i.fail(new e({
191
+ budget: "worldProjectionPayloadBytes",
192
+ limit: v
193
+ })) : (yield* r.hset(x, { payload: n }, { ttlMs: g }), Object.freeze({ entries: t.length }));
194
+ })),
195
+ invalidate: () => T("worldCellsInvalidate", r.delete(x).pipe(i.asVoid))
196
+ });
197
+ }, h = async (e, t, n) => {
198
+ d(n, [
199
+ "namespace",
200
+ "tenantId",
201
+ "world",
202
+ "ttlMs",
203
+ "maxEntries",
204
+ "maxPayloadBytes",
205
+ "availabilityRole"
206
+ ]);
207
+ let r = n.availabilityRole, i = e.connectionAvailability?.bind(e), a = e.hotStore?.bind(e);
208
+ e.connectionRegistry && a && (r === void 0 || i) || c("World projection requires the app-owned connection registry and tenant HotStore"), r !== void 0 && l(r);
209
+ let o = r === void 0 ? "fail" : i(r), s = f({
210
+ namespace: n.namespace,
211
+ tenantId: n.tenantId,
212
+ world: n.world,
213
+ ttlMs: n.ttlMs,
214
+ maxEntries: n.maxEntries,
215
+ maxPayloadBytes: n.maxPayloadBytes,
216
+ onUnavailable: o
217
+ });
218
+ return m(t, await a({ tenantId: s.tenantId }), s);
219
+ };
220
+ export { h as bindWorldCellProjection, m as makeWorldCellProjection };
@@ -0,0 +1,109 @@
1
+ import { createElement as e, useId as t, useLayoutEffect as n, useRef as r, useState as i, useSyncExternalStore as a } from "react";
2
+ // src/worldReact.ts
3
+ var o = (e) => a((t) => e.subscribe(t), () => e.observation, () => e.observation), s = {
4
+ en: {
5
+ title: "Moving to another location",
6
+ preparing: "Reserving the destination",
7
+ loading: "Loading the destination",
8
+ switching: "Switching connections",
9
+ failed: "The move is not confirmed",
10
+ help: "Your source remains selected until the server confirms the commit. A connected destination alone does not confirm the move.",
11
+ committed: "The server confirmed the destination. Connection cleanup or buffered delivery may still be incomplete.",
12
+ uncertain: "Check the saved request to continue. Cancelling also requires confirmation from the server.",
13
+ reserve: "Reserve",
14
+ connect: "Connect",
15
+ welcome: "Receive Welcome",
16
+ assets: "Load assets",
17
+ commit: "Confirm commit",
18
+ cleanup: "Finish connections",
19
+ retry: "Check and continue",
20
+ cancel: "Request cancellation",
21
+ actionError: "The request remains incomplete. Check it again."
22
+ },
23
+ de: {
24
+ title: "Ortswechsel",
25
+ preparing: "Ziel wird reserviert",
26
+ loading: "Ziel wird geladen",
27
+ switching: "Verbindungen werden umgeschaltet",
28
+ failed: "Der Ortswechsel ist nicht bestätigt",
29
+ help: "Die Quelle bleibt ausgewählt, bis der Server den Commit bestätigt. Eine verbundene Ziel-Session bestätigt den Wechsel allein nicht.",
30
+ committed: "Der Server hat das Ziel bestätigt. Verbindungsbereinigung oder gepufferte Übertragung können noch unvollständig sein.",
31
+ uncertain: "Prüfe den gespeicherten Request, um fortzufahren. Auch Abbrechen benötigt eine Bestätigung vom Server.",
32
+ reserve: "Reservieren",
33
+ connect: "Verbinden",
34
+ welcome: "Welcome empfangen",
35
+ assets: "Assets laden",
36
+ commit: "Commit bestätigen",
37
+ cleanup: "Verbindungen abschließen",
38
+ retry: "Prüfen und fortsetzen",
39
+ cancel: "Abbruch anfordern",
40
+ actionError: "Der Request bleibt unvollständig. Prüfe ihn erneut."
41
+ }
42
+ }, c = ({ client: a, locale: c, showSeamless: l = !1, tip: u, className: d }) => {
43
+ let f = o(a), p = s[c], m = t(), h = t(), [g, _] = i(!1), [v, y] = i(!1), b = r({
44
+ client: a,
45
+ revision: 0,
46
+ mounted: !1
47
+ });
48
+ n(() => (b.current = {
49
+ client: a,
50
+ revision: b.current.revision + 1,
51
+ mounted: !0
52
+ }, _(!1), y(!1), () => {
53
+ b.current.mounted = !1, b.current.revision++;
54
+ }), [a]);
55
+ let x = (e) => {
56
+ if (g || b.current.client !== a || !b.current.mounted) return;
57
+ let t = b.current.revision;
58
+ _(!0), y(!1);
59
+ let n = () => b.current.mounted && b.current.client === a && b.current.revision === t;
60
+ Promise.resolve().then(() => a[e]()).then(() => {
61
+ n() && _(!1);
62
+ }, () => {
63
+ n() && (_(!1), y(!0));
64
+ });
65
+ };
66
+ if (f.status === "idle" || f.status === "settled" || f.status === "closed" || f.mode === "seamless" && !l && f.status !== "failed") return null;
67
+ let S = f.committed ? p.switching : p[f.status];
68
+ return e("section", {
69
+ className: d ?? "mx-auto w-full max-w-xl space-y-4 rounded-xl border border-border bg-background p-5 text-foreground",
70
+ "aria-labelledby": m,
71
+ "aria-describedby": h,
72
+ "aria-busy": g
73
+ }, e("h2", {
74
+ id: m,
75
+ className: "text-xl font-semibold"
76
+ }, p.title), e("p", {
77
+ role: "status",
78
+ "aria-live": "polite",
79
+ className: "text-base font-medium"
80
+ }, S), e("p", {
81
+ id: h,
82
+ className: "max-w-prose text-sm text-muted-foreground"
83
+ }, f.committed ? p.committed : f.status === "failed" ? p.uncertain : p.help), e("ol", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm" }, ...[
84
+ "reserve",
85
+ "connect",
86
+ "welcome",
87
+ "assets",
88
+ "commit",
89
+ "cleanup"
90
+ ].map((t) => e("li", {
91
+ key: t,
92
+ "aria-current": f.step === t ? "step" : void 0,
93
+ className: f.step === t ? "font-semibold text-foreground" : "text-muted-foreground"
94
+ }, p[t]))), u === void 0 ? null : e("div", { className: "text-sm" }, u), f.status === "failed" ? e("div", { className: "space-y-3" }, v ? e("p", {
95
+ role: "alert",
96
+ className: "text-sm"
97
+ }, p.actionError) : null, e("div", { className: "flex flex-wrap gap-2" }, e("button", {
98
+ type: "button",
99
+ "aria-disabled": g,
100
+ className: "rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
101
+ onClick: () => x("resume")
102
+ }, p.retry), f.committed ? null : e("button", {
103
+ type: "button",
104
+ "aria-disabled": g,
105
+ className: "rounded-md border border-input px-3 py-2 text-sm font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
106
+ onClick: () => x("cancel")
107
+ }, p.cancel))) : null);
108
+ };
109
+ export { c as TransitionScreen, o as useWorldTransition };
@@ -0,0 +1,34 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { captureWorldData as t } from "./worldData.js";
3
+ // src/worldRecoveryActor.ts
4
+ var n = /* @__PURE__ */ new WeakSet(), r = (t, r) => {
5
+ if (!t || !n.has(t) || t.scope.tenantId !== r.tenantId || t.scope.roomId !== r.roomId || t.scope.hostId !== r.hostId || t.scope.epoch !== r.epoch || t.scope.priorEpoch !== r.priorEpoch || (t.scope.worldRecoveryEpoch ?? t.scope.priorEpoch) !== (r.worldRecoveryEpoch ?? r.priorEpoch)) throw new e({ detail: "World recovery actor requires its active adoption scope" });
6
+ return t;
7
+ }, i = async (i, a, o) => {
8
+ let s = Object.freeze({ ...i }), c, l, u = !1, d = Object.freeze({
9
+ scope: s,
10
+ rollback: async (n, i, o, f) => {
11
+ if (r(d, s), c) throw new e({ detail: "World recovery actor already has an outstanding rollback" });
12
+ let p = t(n, 4096);
13
+ if (p.tenantId !== s.tenantId || p.roomId !== s.roomId) throw new e({ detail: "World recovery rollback escaped its Room" });
14
+ let m = Promise.resolve().then(() => a(p, i, o, f, d));
15
+ c = m;
16
+ try {
17
+ await m;
18
+ } catch (e) {
19
+ throw u = !0, l = e, e;
20
+ } finally {
21
+ c === m && (c = void 0);
22
+ }
23
+ }
24
+ });
25
+ n.add(d);
26
+ try {
27
+ let e = await o(d);
28
+ if (c && await c, u) throw l;
29
+ return e;
30
+ } finally {
31
+ n.delete(d), c && await c;
32
+ }
33
+ };
34
+ export { r as captureWorldRecoveryActor, i as withWorldRecoveryActor };