@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/world.js ADDED
@@ -0,0 +1,332 @@
1
+ import { RoomAuthoringError as e } from "./errors.js";
2
+ import { captureWorldGeometry as t, cmsGeometry as n, importedGeometry as r, procedural as i } from "./worldGeometry.js";
3
+ import { defaultWorldLayerPolicy as a, resolveWorldLayerPolicy as o, worldLayerMaintenance as s } from "./worldLayers.js";
4
+ import { defaultWorldOnWorldChange as c, resolveWorldOnWorldChange as l } from "./worldChange.js";
5
+ import { defaultWorldTransitionPolicy as u, resolveWorldTransitionPolicy as d } from "./worldTransitions.js";
6
+ import { worldSystemContractManifest as f } from "./worldManifest.js";
7
+ import { WorldGroupTransitionRequestSchema as p, WorldTransitionPhaseSchema as m, WorldTransitionPort as h, WorldTransitionRequestSchema as g, WorldTransitionTargetSchema as _, stageWorldGroupTransition as v, stageWorldTransition as y, worldGroupTransitionRequest as b, worldTransitionCommandBindings as x, worldTransitionPhases as S, worldTransitionRequest as C } from "./worldCommands.js";
8
+ import { WorldInspectionSchema as w, decodeWorldInspection as T } from "./worldInspection.js";
9
+ import { WorldClientReceiptSchema as E, WorldClientRequestIdSchema as D, WorldClientTicketSchema as O } from "./worldClientSchemas.js";
10
+ import { makeWorldHandoffView as k } from "./worldHandoffView.js";
11
+ import { worldRpcControls as A, worldRpcPending as ee } from "./rpcClient.js";
12
+ import { makeWorldEntityHandoffView as j } from "./worldEntityHandoffView.js";
13
+ import { WorldClient as M, worldClientReceipt as N, worldClientTicket as P } from "./worldClient.js";
14
+ import { makeWorldGhostNeighborhood as F } from "./worldGhostNeighborhood.js";
15
+ import { makeWorldCellMovement as I } from "./worldMovement.js";
16
+ import { Duration as L } from "effect";
17
+ // src/world.ts
18
+ function R(t) {
19
+ throw new e({
20
+ room: "world",
21
+ detail: t
22
+ });
23
+ }
24
+ var z = (e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_-]{0,119}$/.test(e) ? e : R("World names must be nonempty bounded identifiers"), B = (e) => Number.isFinite(e) ? e : R("World coordinates must be finite"), V = (e) => Number.isFinite(e) && e > 0 ? e : R("World dimensions must be positive and finite"), H = (e, t = !1) => Number.isSafeInteger(e) && e >= +!t ? e : R("World counts and durations must be safe whole numbers"), U = (e, t) => {
25
+ typeof e == "object" && e && Object.getPrototypeOf(e) === Object.prototype || R("World configuration must use plain own data");
26
+ for (let n of Reflect.ownKeys(e)) {
27
+ let r = Object.getOwnPropertyDescriptor(e, n);
28
+ typeof n == "string" && t.includes(n) && r?.enumerable && "value" in r || R("Unknown or accessor World configuration field");
29
+ }
30
+ }, W = (e, t) => {
31
+ (!Array.isArray(e) || e.length > t || Reflect.ownKeys(e).length !== e.length + 1) && R("Invalid or over-budget World list");
32
+ for (let t = 0; t < e.length; t++) {
33
+ let n = Object.getOwnPropertyDescriptor(e, String(t));
34
+ n?.enumerable && "value" in n || R("World lists must contain own data entries");
35
+ }
36
+ }, G = (e) => (W(e, 2), e.length !== 2 && R("World points require two coordinates"), Object.freeze([B(e[0]), B(e[1])])), K = (e, t, n, r) => (B(e), B(t), B(n), B(r), V(n - e), V(r - t), Object.freeze([Object.freeze([e, t]), Object.freeze([n, r])])), q = (e) => {
37
+ W(e, 2), e.length !== 2 && R("World bounds require minimum and maximum");
38
+ let t = G(e[0]), n = G(e[1]);
39
+ return K(t[0], t[1], n[0], n[1]);
40
+ }, J = (e, t) => t[0] >= e[0][0] && t[0] < e[1][0] && t[1] >= e[0][1] && t[1] < e[1][1], Y = (e) => {
41
+ let t = e.cells?.size;
42
+ return t === void 0 ? {
43
+ columns: 1,
44
+ rows: 1,
45
+ size: Math.max(e.bounds[1][0] - e.bounds[0][0], e.bounds[1][1] - e.bounds[0][1])
46
+ } : {
47
+ columns: Math.ceil((e.bounds[1][0] - e.bounds[0][0]) / t),
48
+ rows: Math.ceil((e.bounds[1][1] - e.bounds[0][1]) / t),
49
+ size: t
50
+ };
51
+ }, X = (e) => {
52
+ U(e, [
53
+ "name",
54
+ "map",
55
+ "zones",
56
+ "instances",
57
+ "persistence",
58
+ "handoff",
59
+ "spawn",
60
+ "hosts",
61
+ "characters",
62
+ "transitionCooldownMs",
63
+ "budgets",
64
+ "strategies",
65
+ "geometry"
66
+ ]);
67
+ let n = z(e.name), r = Object.hasOwn(e, "geometry") ? t(e.geometry, n) : void 0;
68
+ U(e.map, ["bounds"]);
69
+ let i = Object.freeze({ bounds: q(e.map.bounds) });
70
+ e.budgets !== void 0 && U(e.budgets, [
71
+ "maxZones",
72
+ "maxCells",
73
+ "maxInstances"
74
+ ]);
75
+ let o = Object.freeze({
76
+ maxZones: H(e.budgets?.maxZones ?? 256),
77
+ maxCells: H(e.budgets?.maxCells ?? 65536),
78
+ maxInstances: H(e.budgets?.maxInstances ?? 256)
79
+ });
80
+ W(e.zones, o.maxZones), e.zones.length || R("A World requires at least one Zone");
81
+ let s = /* @__PURE__ */ new Set(), l = 0, d = e.zones.map((e) => {
82
+ U(e, [
83
+ "id",
84
+ "bounds",
85
+ "room",
86
+ "neighbors",
87
+ "cells",
88
+ "layering"
89
+ ]);
90
+ let t = z(e.id), n = z(e.room), r = q(e.bounds);
91
+ s.has(t) && R("Duplicate World Zone"), s.add(t), (r[0][0] < i.bounds[0][0] || r[0][1] < i.bounds[0][1] || r[1][0] > i.bounds[1][0] || r[1][1] > i.bounds[1][1]) && R("Zone bounds must stay inside the World map"), W(e.neighbors, o.maxZones);
92
+ let a = Object.freeze(e.neighbors.map(z));
93
+ (new Set(a).size !== a.length || a.includes(t)) && R("Zone neighbors must be unique and exclude itself"), e.cells !== void 0 && U(e.cells, ["size"]);
94
+ let c = e.cells === void 0 ? void 0 : Object.freeze({ size: V(e.cells.size) });
95
+ e.layering !== void 0 && U(e.layering, [
96
+ "maxPlayers",
97
+ "splitAt",
98
+ "mergeBelow"
99
+ ]);
100
+ let u = e.layering === void 0 ? void 0 : Object.freeze({
101
+ maxPlayers: H(e.layering.maxPlayers),
102
+ splitAt: H(e.layering.splitAt),
103
+ mergeBelow: H(e.layering.mergeBelow, !0)
104
+ });
105
+ u !== void 0 && (u.mergeBelow >= u.splitAt || u.splitAt >= u.maxPlayers) && R("Layering requires mergeBelow < splitAt < maxPlayers");
106
+ let d = Object.freeze({
107
+ id: t,
108
+ room: n,
109
+ bounds: r,
110
+ neighbors: a,
111
+ ...c === void 0 ? {} : { cells: c },
112
+ ...u === void 0 ? {} : { layering: u }
113
+ }), f = Y(d), p = f.columns * f.rows;
114
+ return (!Number.isSafeInteger(p) || p < 1 || p > o.maxCells - l) && R("World cell inventory exceeds its authoring budget"), l += p, d;
115
+ });
116
+ for (let e of d) for (let t of e.neighbors) {
117
+ let n = d.find((e) => e.id === t);
118
+ n && n.neighbors.includes(e.id) || R("World neighbors must exist and be reciprocal");
119
+ }
120
+ for (let e = 0; e < d.length; e++) for (let t = e + 1; t < d.length; t++) {
121
+ let n = d[e].bounds, r = d[t].bounds;
122
+ Math.max(n[0][0], r[0][0]) < Math.min(n[1][0], r[1][0]) && Math.max(n[0][1], r[0][1]) < Math.min(n[1][1], r[1][1]) && R("World Zone interiors must not overlap");
123
+ }
124
+ W(e.instances ?? [], o.maxInstances);
125
+ let f = /* @__PURE__ */ new Set(), p = (e.instances ?? []).map((e) => {
126
+ U(e, [
127
+ "id",
128
+ "room",
129
+ "maxGroups",
130
+ "ttl"
131
+ ]);
132
+ let t = z(e.id), n = z(e.room);
133
+ (f.has(t) || s.has(t)) && R("World Instance identifiers must be unique"), f.add(t);
134
+ let r;
135
+ try {
136
+ r = L.toMillis(e.ttl);
137
+ } catch {
138
+ return R("Invalid World Instance duration");
139
+ }
140
+ return Object.freeze({
141
+ id: t,
142
+ room: n,
143
+ maxGroups: H(e.maxGroups),
144
+ ttlMs: H(r)
145
+ });
146
+ });
147
+ U(e.persistence, [
148
+ "entities",
149
+ "snapshotEveryMs",
150
+ "journal"
151
+ ]), (e.persistence.entities !== "world" || typeof e.persistence.journal != "boolean") && R("Invalid World persistence policy");
152
+ let m = Object.freeze({
153
+ entities: "world",
154
+ snapshotEveryMs: H(e.persistence.snapshotEveryMs),
155
+ journal: e.persistence.journal
156
+ });
157
+ U(e.handoff, ["marginUnits", "ghostUnits"]);
158
+ let h = Object.freeze({
159
+ marginUnits: V(e.handoff.marginUnits),
160
+ ghostUnits: V(e.handoff.ghostUnits)
161
+ });
162
+ h.marginUnits > h.ghostUnits && R("Handoff margin cannot exceed the ghost range"), typeof e.spawn != "function" && R("World spawn requires an author-owned function"), e.hosts !== void 0 && U(e.hosts, ["pool"]);
163
+ let g = e.hosts === void 0 ? void 0 : Object.freeze({ pool: z(e.hosts.pool) }), _ = e.characters ?? "shared";
164
+ _ !== "shared" && _ !== "per-world" && R("Invalid World character policy"), e.strategies !== void 0 && U(e.strategies, [
165
+ "layerPolicy",
166
+ "transitionPolicy",
167
+ "onWorldChange"
168
+ ]);
169
+ let v = e.strategies?.layerPolicy ?? a, y = e.strategies?.transitionPolicy ?? u, b = e.strategies?.onWorldChange ?? c;
170
+ return typeof b != "function" && R("World change requires a synchronous strategy"), (typeof v != "function" || typeof y != "function") && R("World policies require synchronous strategies"), Object.freeze({
171
+ _tag: "WorldDescriptor",
172
+ name: n,
173
+ map: i,
174
+ zones: Object.freeze(d),
175
+ instances: Object.freeze(p),
176
+ persistence: m,
177
+ handoff: h,
178
+ spawn: e.spawn,
179
+ ...r === void 0 ? {} : { geometry: r },
180
+ ...g === void 0 ? {} : { hosts: g },
181
+ characters: _,
182
+ transitionCooldownMs: H(e.transitionCooldownMs ?? 2e3, !0),
183
+ budgets: o,
184
+ cellCount: l,
185
+ strategies: Object.freeze({
186
+ layerPolicy: v,
187
+ transitionPolicy: y,
188
+ onWorldChange: b
189
+ })
190
+ });
191
+ }, Z = /* @__PURE__ */ new WeakSet(), Q = (e) => {
192
+ if (Z.has(e)) return;
193
+ let n = [e], r = /* @__PURE__ */ new Set();
194
+ for (; n.length > 0;) {
195
+ let e = n.pop();
196
+ if (typeof e != "object" || !e || r.has(e)) continue;
197
+ r.add(e), Object.isFrozen(e) || R("World catalogue definitions must be deeply immutable");
198
+ let t = Reflect.ownKeys(e);
199
+ Array.isArray(e) ? W(e, e.length) : U(e, t.filter((e) => typeof e == "string"));
200
+ for (let r of t) {
201
+ if (Array.isArray(e) && r === "length") continue;
202
+ let t = Object.getOwnPropertyDescriptor(e, r);
203
+ t?.enumerable && "value" in t || R("World catalogue definitions require own data"), n.push(t.value);
204
+ }
205
+ }
206
+ try {
207
+ for (let t of [
208
+ "name",
209
+ "map",
210
+ "zones",
211
+ "instances",
212
+ "persistence",
213
+ "handoff",
214
+ "spawn",
215
+ "characters",
216
+ "transitionCooldownMs",
217
+ "budgets",
218
+ "cellCount",
219
+ "strategies"
220
+ ]) Object.hasOwn(e, t) || R("Incomplete immutable World descriptor");
221
+ U(e.strategies, [
222
+ "layerPolicy",
223
+ "transitionPolicy",
224
+ "onWorldChange"
225
+ ]);
226
+ for (let t of [
227
+ "layerPolicy",
228
+ "transitionPolicy",
229
+ "onWorldChange"
230
+ ]) {
231
+ let n = Object.getOwnPropertyDescriptor(e.strategies, t);
232
+ n && "value" in n && typeof n.value == "function" || R("World descriptor requires complete policy slots");
233
+ }
234
+ U(e.budgets, [
235
+ "maxZones",
236
+ "maxCells",
237
+ "maxInstances"
238
+ ]), H(e.budgets.maxZones), H(e.budgets.maxCells), H(e.budgets.maxInstances), W(e.instances, e.budgets.maxInstances);
239
+ let n = e.instances.map((e) => (U(e, [
240
+ "id",
241
+ "room",
242
+ "maxGroups",
243
+ "ttlMs"
244
+ ]), {
245
+ id: e.id,
246
+ room: e.room,
247
+ maxGroups: e.maxGroups,
248
+ ttl: H(e.ttlMs)
249
+ })), r = X({
250
+ name: e.name,
251
+ map: e.map,
252
+ zones: e.zones,
253
+ instances: n,
254
+ persistence: e.persistence,
255
+ handoff: e.handoff,
256
+ spawn: e.spawn,
257
+ ...e.hosts === void 0 ? {} : { hosts: e.hosts },
258
+ characters: e.characters,
259
+ transitionCooldownMs: e.transitionCooldownMs,
260
+ budgets: e.budgets,
261
+ strategies: e.strategies,
262
+ ...Object.hasOwn(e, "geometry") ? { geometry: t(e.geometry, e.name) } : {}
263
+ });
264
+ (r.cellCount !== H(e.cellCount) || r.characters !== e.characters || r.transitionCooldownMs !== H(e.transitionCooldownMs, !0)) && R("World descriptor contradicts its captured topology");
265
+ } catch {
266
+ R("World catalogue descriptor failed topology admission");
267
+ }
268
+ Z.add(e);
269
+ }, te = (e, t = 256) => {
270
+ H(t), W(e, t);
271
+ let n = /* @__PURE__ */ new Set(), r = e.map((e) => {
272
+ U(e, [
273
+ "_tag",
274
+ "name",
275
+ "map",
276
+ "zones",
277
+ "instances",
278
+ "persistence",
279
+ "handoff",
280
+ "spawn",
281
+ "hosts",
282
+ "characters",
283
+ "transitionCooldownMs",
284
+ "budgets",
285
+ "cellCount",
286
+ "strategies",
287
+ "geometry"
288
+ ]), e._tag === "WorldDescriptor" && Object.isFrozen(e) || R("World catalogue requires immutable definitions"), Q(e);
289
+ let t = z(e.name);
290
+ return n.has(t) && R("Duplicate configured World"), n.add(t), e;
291
+ });
292
+ return Object.freeze(r);
293
+ }, ne = (e, t) => {
294
+ let n = G(t);
295
+ return e.zones.find((e) => J(e.bounds, n)) ?? R("Position has no World Zone");
296
+ }, $ = (e, t) => {
297
+ U(t, ["zone", "at"]);
298
+ let n = G(t.at), r = e.zones.find((e) => e.id === t.zone);
299
+ if (!r || !J(r.bounds, n)) return R("Position is outside its declared World Zone");
300
+ let i = Y(r), a = (e, t, n) => {
301
+ let r = 0, a = n;
302
+ for (; r + 1 < a;) {
303
+ let n = r + Math.floor((a - r) / 2);
304
+ e < t + n * i.size ? a = n : r = n;
305
+ }
306
+ return r;
307
+ }, o = a(n[0], r.bounds[0][0], i.columns), s = a(n[1], r.bounds[0][1], i.rows), c = r.bounds[0][0] + o * i.size, l = r.bounds[0][1] + s * i.size;
308
+ return Object.freeze({
309
+ id: `${r.id}:${o}:${s}`,
310
+ zone: r.id,
311
+ column: o,
312
+ row: s,
313
+ bounds: K(c, l, Math.min(r.bounds[0][0] + (o + 1) * i.size, r.bounds[1][0]), Math.min(r.bounds[0][1] + (s + 1) * i.size, r.bounds[1][1]))
314
+ });
315
+ }, re = (e, t, n) => {
316
+ let r = e.zones.find((e) => e.id === t), i = typeof n == "string" ? n.split(":") : [];
317
+ if (!r || i.length < 3 || i.slice(0, -2).join(":") !== r.id) return R("Cell is not in its declared World Zone");
318
+ let a = Y(r), o = Number(i[i.length - 2]), s = Number(i[i.length - 1]);
319
+ if (!/^(0|[1-9][0-9]*)$/.test(i[i.length - 2]) || !/^(0|[1-9][0-9]*)$/.test(i[i.length - 1]) || o >= a.columns || s >= a.rows) return R("Cell is not in its declared World Zone");
320
+ let c = $(e, {
321
+ zone: r.id,
322
+ at: [r.bounds[0][0] + o * a.size, r.bounds[0][1] + s * a.size]
323
+ });
324
+ return c.id === n ? c : R("Cell is not in its declared World Zone");
325
+ }, ie = (e, t) => {
326
+ let n = e.spawn({ player: t });
327
+ return U(n, ["zone", "at"]), $(e, n), Object.freeze({
328
+ zone: n.zone,
329
+ at: G(n.at)
330
+ });
331
+ };
332
+ export { M as WorldClient, E as WorldClientReceiptSchema, D as WorldClientRequestIdSchema, O as WorldClientTicketSchema, p as WorldGroupTransitionRequestSchema, w as WorldInspectionSchema, m as WorldTransitionPhaseSchema, h as WorldTransitionPort, g as WorldTransitionRequestSchema, _ as WorldTransitionTargetSchema, te as captureWorldCatalog, n as cmsGeometry, T as decodeWorldInspection, a as defaultWorldLayerPolicy, c as defaultWorldOnWorldChange, u as defaultWorldTransitionPolicy, X as defineWorld, r as importedGeometry, I as makeWorldCellMovement, j as makeWorldEntityHandoffView, F as makeWorldGhostNeighborhood, k as makeWorldHandoffView, i as procedural, K as rect, o as resolveWorldLayerPolicy, l as resolveWorldOnWorldChange, d as resolveWorldTransitionPolicy, v as stageWorldGroupTransition, y as stageWorldTransition, $ as worldCellAt, re as worldCellById, N as worldClientReceipt, P as worldClientTicket, b as worldGroupTransitionRequest, s as worldLayerMaintenance, A as worldRpcControls, ee as worldRpcPending, ie as worldSpawn, f as worldSystemContractManifest, x as worldTransitionCommandBindings, S as worldTransitionPhases, C as worldTransitionRequest, ne as worldZoneAt };
@@ -0,0 +1,47 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { captureWorldData as n } from "./worldData.js";
3
+ // src/worldActorReceipts.ts
4
+ var r = (r, i = 4096) => {
5
+ if (!Number.isSafeInteger(i) || i < 1 || i > 4096 || !Array.isArray(r)) throw new t({ detail: "Invalid World actor receipt budget or inventory" });
6
+ if (r.length > i) throw new e({
7
+ budget: "worldActorReceipts",
8
+ limit: i
9
+ });
10
+ let a = n(r, 1048576), o = /* @__PURE__ */ new Set();
11
+ for (let e of a) {
12
+ if (!e || Object.keys(e).some((e) => ![
13
+ "requestId",
14
+ "operation",
15
+ "fingerprint",
16
+ "projection"
17
+ ].includes(e)) || typeof e.requestId != "string" || !e.requestId || e.requestId.length > 191 || o.has(e.requestId) || ![
18
+ "enter",
19
+ "exit",
20
+ "ghost"
21
+ ].includes(e.operation) || typeof e.fingerprint != "string" || !/^[0-9a-f]{64}$/.test(e.fingerprint)) throw new t({ detail: "Invalid World actor receipt" });
22
+ if (e.projection !== void 0) {
23
+ let n = e.projection;
24
+ if (!n || typeof n != "object" || Array.isArray(n)) throw new t({ detail: "Invalid retained World ghost projection" });
25
+ let r = n.location, i = n.entity;
26
+ if (e.operation !== "ghost" || !/^wghost-[0-9a-f]{64}:ghost$/.test(e.requestId) || Object.keys(n).some((e) => ![
27
+ "entity",
28
+ "location",
29
+ "expiresAt"
30
+ ].includes(e)) || n.expiresAt !== void 0 && (!Number.isSafeInteger(n.expiresAt) || n.expiresAt < 0) || !i || typeof i != "object" || Array.isArray(i) || typeof i.id != "string" || !i.id || i.id.length > 191 || !r || Object.keys(r).length !== 6 || ![
31
+ r.worldId,
32
+ r.zoneId,
33
+ r.roomId
34
+ ].every((e) => typeof e == "string" && e.length > 0 && e.length <= 191) || ![r.epoch, r.layer].every((e) => Number.isSafeInteger(e) && e > 0) || !Array.isArray(r.at) || r.at.length !== 2 || !r.at.every((e) => typeof e == "number" && Number.isFinite(e))) throw new t({ detail: "Invalid retained World ghost projection" });
35
+ }
36
+ o.add(e.requestId);
37
+ }
38
+ return a;
39
+ }, i = (e) => {
40
+ let n = (e) => Array.isArray(e) ? e.map(n) : e && typeof e == "object" ? Object.fromEntries(Object.keys(e).sort().map((t) => [t, n(e[t])])) : e, r = JSON.stringify(n(e));
41
+ if (typeof r != "string") throw new t({ detail: "World actor identity requires captured JSON data" });
42
+ return r;
43
+ }, a = async (e) => {
44
+ let t = new TextEncoder().encode(i(e)), n = await globalThis.crypto.subtle.digest("SHA-256", t);
45
+ return Array.from(new Uint8Array(n), (e) => e.toString(16).padStart(2, "0")).join("");
46
+ };
47
+ export { r as captureWorldActorReceipts, i as worldActorCanonicalJson, a as worldActorFingerprint };
@@ -0,0 +1,13 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { captureWorldData as t } from "./worldData.js";
3
+ import { worldActorCanonicalJson as n } from "./worldActorReceipts.js";
4
+ // src/worldActorTransferSnapshot.ts
5
+ var r = (n, r) => {
6
+ let i = t(n, r);
7
+ if (!i || typeof i != "object" || Object.keys(i).length !== 3 || !Number.isSafeInteger(i.schemaHash) || i.schemaHash < 0 || i.schemaHash > 4294967295 || !Array.isArray(i.bytes) || !i.bytes.length || !i.bytes.every((e) => Number.isInteger(e) && e >= 0 && e <= 255) || !i.entity || typeof i.entity != "object" || Array.isArray(i.entity) || typeof i.entity.id != "string" || !i.entity.id || i.entity.id.length > 191) throw new e({ detail: "World actor transfer requires bounded actual codec bytes and source entity" });
8
+ return i;
9
+ }, i = (i, a, o) => {
10
+ let s = t(i, o), c = r(a, o);
11
+ if (n(s) !== n(c.entity)) throw new e({ detail: "World source requires final snapshot reconciliation before rollback" });
12
+ };
13
+ export { i as assertWorldActorSnapshotSource, r as captureWorldActorTransferSnapshot };
@@ -0,0 +1,7 @@
1
+ // src/worldAdmissionPending.ts
2
+ var e = class extends Error {
3
+ constructor() {
4
+ super("World reconnect discard must be checkpointed before admission"), this.name = "WorldAdmissionPending";
5
+ }
6
+ };
7
+ export { e as WorldAdmissionPending };
@@ -0,0 +1,147 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { simulationOwnData as n } from "./simulationAuthoring.js";
3
+ import { captureWorldData as r } from "./worldData.js";
4
+ import { captureWorldCatalog as i, worldCellAt as a } from "./world.js";
5
+ import { Effect as o } from "effect";
6
+ import { randomUUID as s } from "node:crypto";
7
+ // src/worldBoundaryCoordinator.ts
8
+ var c = () => new t({ detail: "World boundary coordination requires its bounded actual source and exact durable requests" }), l = (t, l, u) => {
9
+ let d = [
10
+ "tenantId",
11
+ "roomId",
12
+ "epoch",
13
+ "world",
14
+ "maxPending",
15
+ "maxEntriesPerTurn",
16
+ "maxBytes",
17
+ "prepareTtlMs",
18
+ "epochNow"
19
+ ];
20
+ n(u, d, d);
21
+ let { tenantId: f, roomId: p, epoch: m, maxPending: h, maxEntriesPerTurn: g, maxBytes: _, prepareTtlMs: v } = u, y = i([u.world])[0], b = u.epochNow.bind(u);
22
+ if (![f, p].every((e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(e)) || !Number.isSafeInteger(m) || m < 1 || !Number.isSafeInteger(h) || h < 1 || h > 4095 || !Number.isSafeInteger(g) || g < 1 || g > h || !Number.isSafeInteger(_) || _ < 1 || _ > 16777216 || !Number.isSafeInteger(v) || v < 1 || v > 3e5) throw c();
23
+ let x = t.scanWorldSourceTransitions.bind(t), S = t.captureWorldBoundaryIntents.bind(t), C = l.prepare.bind(l), w = l.commit.bind(l), T = l.cancel.bind(l), E = l.resume.bind(l), D = l.status.bind(l), O = /* @__PURE__ */ new Map(), k = `boundary-${s()}`, A = 0, j = -1, M = 0, N = !1, P, F = () => {
24
+ let e = b();
25
+ if (!Number.isSafeInteger(e) || e < 0 || e < j || e > 2 ** 53 - 1 - v) throw c();
26
+ return j = e, e;
27
+ }, I = (e, t) => JSON.stringify(e) === JSON.stringify(t), L = (e, t) => {
28
+ let n = r(e, _);
29
+ if (n.origin.tenantId !== f || n.origin.roomId !== p || n.source.epoch !== m || n.source.worldId !== y.name || n.source.roomId !== p || n.mode !== "seamless" || n.group || n.intent.entityId !== n.entityId || n.intent.options.reason !== "boundary" || n.intent.target.kind !== "cell" || t && (!I(n.origin, t.origin) || !I(n.intent, t.intent))) throw c();
30
+ return n;
31
+ }, R = (t, n) => {
32
+ if (!O.has(t) && O.size >= h) throw new e({
33
+ budget: "worldBoundaryPending",
34
+ limit: h
35
+ });
36
+ r([...O.entries()].filter(([e]) => e !== t).map(([, e]) => e).concat(n), _), O.set(t, n);
37
+ }, z = (e, t, n) => {
38
+ let r = L(n, t);
39
+ return R(e, {
40
+ ...t,
41
+ record: r,
42
+ commitStarted: t.commitStarted || r.actorFinalSnapshot !== void 0 || ["committed", "settled"].includes(r.phase)
43
+ }), O.get(e);
44
+ }, B = (e) => o.isEffect(e) ? o.runPromise(e) : Promise.reject(c()), V = (e, t) => e.entityId !== t.entityId || e.target.kind !== "cell" || t.intent.target.kind !== "cell" || e.target.zone !== t.target.zoneId || t.target.worldId !== y.name ? !1 : a(y, {
45
+ zone: e.target.zone,
46
+ at: e.target.at
47
+ }).id === a(y, {
48
+ zone: t.target.zoneId,
49
+ at: t.target.at
50
+ }).id, H = async () => {
51
+ let e = [], t = /* @__PURE__ */ new Set(), n = await x(p, f, m, y.name, h, _);
52
+ if (N) return;
53
+ for (let e of n) {
54
+ if (t.add(e.entityId), e.mode !== "seamless" || e.group || e.intent.options.reason !== "boundary") continue;
55
+ let n = L(e), r = O.get(n.entityId);
56
+ if (r && !I(r.origin, n.origin)) throw c();
57
+ let i = r ?? {
58
+ origin: n.origin,
59
+ intent: n.intent,
60
+ createdAt: n.createdAt,
61
+ commitStarted: !1
62
+ };
63
+ z(n.entityId, i, n);
64
+ }
65
+ let i;
66
+ try {
67
+ if ([...O.values()].some((e) => e.commitStarted || e.record?.phase === "failed") || (i = await S(p, f, m, y.name)), i) {
68
+ if (i.epoch !== m || i.intents.length > h) throw c();
69
+ r(i, _);
70
+ }
71
+ } catch (t) {
72
+ e.push(t);
73
+ }
74
+ if (N) return;
75
+ if (i) for (let e of i.intents) {
76
+ if (O.has(e.intention.entityId) || t.has(e.intention.entityId)) continue;
77
+ if (O.size >= h) break;
78
+ if (A >= 2 ** 53 - 1) throw c();
79
+ let n = r(e.intention, _);
80
+ R(n.entityId, {
81
+ origin: Object.freeze({
82
+ tenantId: f,
83
+ roomId: p,
84
+ requestId: `${k}-${++A}`
85
+ }),
86
+ intent: n,
87
+ createdAt: F(),
88
+ commitStarted: !1
89
+ });
90
+ }
91
+ let a = [...O.keys()], o = a.slice(M % Math.max(1, a.length)).concat(a.slice(0, M % Math.max(1, a.length))).slice(0, g);
92
+ M = a.length ? (M + o.length) % a.length : 0;
93
+ for (let t of o) {
94
+ if (N) break;
95
+ let n = O.get(t);
96
+ try {
97
+ n = n.record ? z(t, n, await B(D(n.origin))) : z(t, n, await B(C(n.intent, n.origin)));
98
+ let e = n.record;
99
+ if (N) break;
100
+ if (["settled", "rolledBack"].includes(e.phase)) {
101
+ await B(E(n.origin)), O.delete(t);
102
+ continue;
103
+ }
104
+ if (e.phase === "failed") n = z(t, n, await B(T(n.origin, e.failure ?? "boundary_expired")));
105
+ else if (n.commitStarted || e.phase === "committed") n = z(t, n, await B(w(n.origin)));
106
+ else if (F() - n.createdAt >= v) n = z(t, n, await B(T(n.origin, "boundary_expired")));
107
+ else {
108
+ e.phase !== "switching" && (n = z(t, n, await B(C(n.intent, n.origin)))), e = n.record;
109
+ let i = await S(p, f, m, y.name);
110
+ if (i.epoch !== m || i.intents.length > h) throw c();
111
+ r(i, _);
112
+ let a = i.intents.find((e) => e.intention.entityId === t);
113
+ if (N) break;
114
+ !a || a.revision !== e.entityRevision || !V(a.intention, e) ? n = z(t, n, await B(T(n.origin, "boundary_withdrawn"))) : a.crossing && (n = {
115
+ ...n,
116
+ commitStarted: !0
117
+ }, R(t, n), n = z(t, n, await B(w(n.origin))));
118
+ }
119
+ ["settled", "rolledBack"].includes(n.record.phase) && O.delete(t);
120
+ } catch (t) {
121
+ e.push(t);
122
+ }
123
+ }
124
+ if (e.length) throw AggregateError(e, "World boundary operations remain retained");
125
+ };
126
+ return Object.freeze({
127
+ runDue: () => {
128
+ if (N) return Promise.resolve();
129
+ if (P) return P;
130
+ let e = Promise.resolve().then(H);
131
+ return P = e, e.then(() => {
132
+ P === e && (P = void 0);
133
+ }, () => {
134
+ P === e && (P = void 0);
135
+ }), e;
136
+ },
137
+ observation: () => Object.freeze({
138
+ closed: N,
139
+ busy: P !== void 0,
140
+ pending: O.size
141
+ }),
142
+ close: async () => {
143
+ N = !0, P && await P.catch(() => void 0);
144
+ }
145
+ });
146
+ };
147
+ export { l as makeWorldBoundaryCoordinator };
@@ -0,0 +1,80 @@
1
+ import { RoomAuthoringError as e } from "./errors.js";
2
+ import { captureWorldCatalog as t } from "./world.js";
3
+ // src/worldCatalog.ts
4
+ function n(t) {
5
+ throw new e({
6
+ room: "world-catalog",
7
+ detail: t
8
+ });
9
+ }
10
+ var r = (e, r, i = 256) => {
11
+ let a = [];
12
+ for (let o of t(e, i)) {
13
+ for (let e of o.zones) {
14
+ let t = r.get(e.room);
15
+ e.layering !== void 0 && e.layering.maxPlayers !== t.maxClients && n("World layering capacity differs from its admitted Room"), a.push(Object.freeze({
16
+ worldId: o.name,
17
+ areaId: e.id,
18
+ kind: "zone",
19
+ room: t.name,
20
+ maxClients: t.maxClients
21
+ }));
22
+ }
23
+ for (let e of o.instances) {
24
+ let t = r.get(e.room);
25
+ a.push(Object.freeze({
26
+ worldId: o.name,
27
+ areaId: e.id,
28
+ kind: "instance",
29
+ room: t.name,
30
+ maxClients: t.maxClients
31
+ }));
32
+ }
33
+ }
34
+ return Object.freeze(a);
35
+ }, i = async (e, r, i, o = {}) => {
36
+ let s = o.maxWorlds ?? 256;
37
+ (!Number.isSafeInteger(s) || s < 1 || !Array.isArray(e) || e.length > s || Reflect.ownKeys(e).length !== e.length + 1) && n("Invalid or over-budget World source inventory");
38
+ let c = [];
39
+ for (let t = 0; t < e.length; t++) {
40
+ let r = Object.getOwnPropertyDescriptor(e, String(t));
41
+ (!r?.enumerable || !("value" in r) || typeof r.value != "string" || r.value.length === 0 || r.value.length > 4096) && n("World source inventory requires bounded own data"), c.push(r.value);
42
+ }
43
+ let l = [];
44
+ for (let e of [...new Set(c)].sort()) {
45
+ let i = await r(e), a = Object.getOwnPropertyDescriptor(i, "default");
46
+ a && "value" in a || n("World modules must default-export their immutable definition as data");
47
+ let o = t([a.value], s)[0];
48
+ l.push(Object.freeze({
49
+ source: e,
50
+ descriptor: o
51
+ }));
52
+ }
53
+ return new a(l, i, o);
54
+ }, a = class {
55
+ entries;
56
+ roomReferences;
57
+ constructor(e, i, a = {}) {
58
+ let o = a.maxWorlds ?? 256;
59
+ (!Number.isSafeInteger(o) || o < 1 || !Array.isArray(e) || e.length > o || Reflect.ownKeys(e).length !== e.length + 1) && n("Invalid or over-budget World catalogue");
60
+ let s = [];
61
+ for (let t = 0; t < e.length; t++) {
62
+ let r = Object.getOwnPropertyDescriptor(e, String(t));
63
+ r && "value" in r || n("World catalogue requires own entries");
64
+ let i = Object.getOwnPropertyDescriptor(r.value, "source"), a = Object.getOwnPropertyDescriptor(r.value, "descriptor");
65
+ (!i || !("value" in i) || typeof i.value != "string" || i.value.length === 0 || i.value.length > 4096 || !a || !("value" in a)) && n("Invalid World catalogue source"), s.push(Object.freeze({
66
+ source: i.value,
67
+ descriptor: a.value
68
+ }));
69
+ }
70
+ let c = t(s.map((e) => e.descriptor), o);
71
+ new Set(s.map((e) => e.source)).size !== s.length && n("Duplicate World source identity"), this.roomReferences = r(c, i, o), this.entries = Object.freeze(s.sort((e, t) => e.descriptor.name < t.descriptor.name ? -1 : +(e.descriptor.name > t.descriptor.name)));
72
+ }
73
+ get(e) {
74
+ return this.entries.find((t) => t.descriptor.name === e)?.descriptor ?? n("Unknown admitted World");
75
+ }
76
+ inventory() {
77
+ return this.entries;
78
+ }
79
+ };
80
+ export { a as WorldCatalog, i as loadWorldCatalog, r as validateWorldRooms };