@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,237 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { geometryOwnData as n } from "./geometryTileCodec.js";
3
+ import { captureGeometryCodecProfiles as r, captureGeometryKind as i, geometryPersistenceId as a, geometryPersistenceInteger as o } from "./geometryPersistenceData.js";
4
+ import { planGeometryClientInterest as s } from "./geometryClientInterest.js";
5
+ import { captureRoomConnectionGeometrySession as c } from "./connection.js";
6
+ import { makeRoomGeometryChunkCache as l } from "./geometryClientChunks.js";
7
+ import { captureGeometryRenderLodCacheOptions as u, makeGeometryRenderLodCache as d } from "./geometryRenderCache.js";
8
+ import { captureWorldCatalog as f } from "./world.js";
9
+ import { makeRoomGeometrySnapshotSource as p } from "./geometrySnapshotClient.js";
10
+ import { makeRoomGeometryManifestClient as m } from "./geometryManifestClient.js";
11
+ // src/geometryVersionClient.ts
12
+ var h = () => new t({ detail: "Geometry version handoff requires its current native manifest, admission and fully verified downloads" }), g = (t, c, g, _) => {
13
+ let v = f([c])[0], y = n(g, [
14
+ "tenantId",
15
+ "kind",
16
+ "worldId",
17
+ "layerSetId"
18
+ ]), b = Object.freeze({
19
+ tenantId: a(y.tenantId),
20
+ kind: i(y.kind),
21
+ worldId: a(y.worldId, 96),
22
+ layerSetId: a(y.layerSetId, 96)
23
+ }), x = n(_, [
24
+ "staticSource",
25
+ "manifest",
26
+ "snapshot",
27
+ "cache",
28
+ "render"
29
+ ], ["staticSource"]), S = n(x.staticSource, ["load"]);
30
+ if (!v.geometry || b.worldId !== v.name || b.kind !== v.geometry.kind || typeof S.load != "function") throw h();
31
+ let C = Object.freeze({ load: S.load.bind(x.staticSource) }), w = (e, t) => {
32
+ let i = { ...Object.hasOwn(x, e) ? n(x[e], t, []) : {} };
33
+ if (Object.hasOwn(i, "codecLimits") && (i.codecLimits = Object.freeze(Object.fromEntries(r(i.codecLimits)))), Object.hasOwn(i, "requestId")) {
34
+ if (typeof i.requestId != "function") throw h();
35
+ i.requestId = i.requestId.bind(x[e]);
36
+ }
37
+ return Object.freeze(i);
38
+ }, T = w("manifest", [
39
+ "channel",
40
+ "maxManifestChunks",
41
+ "maxManifestBytes",
42
+ "maxPending",
43
+ "maxPendingBytes",
44
+ "maxQueued",
45
+ "maxQueuedBytes"
46
+ ]), E = w("snapshot", [
47
+ "requestChannel",
48
+ "responseChannel",
49
+ "requestId",
50
+ "maxPending",
51
+ "maxPatchBytes",
52
+ "maxPendingBytes",
53
+ "maxWaitMs",
54
+ "maxManifestChunks",
55
+ "maxManifestBytes",
56
+ "codecLimits"
57
+ ]), D = w("cache", [
58
+ "channel",
59
+ "maxCachedChunks",
60
+ "maxConcurrent",
61
+ "maxCacheBytes",
62
+ "maxStagedBytes",
63
+ "maxChunkBytes",
64
+ "maxPendingDeltas",
65
+ "maxQueuedDeltaBytes",
66
+ "codecLimits"
67
+ ]), O = u(Object.hasOwn(x, "render") ? x.render : {}), k = m(t, {
68
+ tenantId: b.tenantId,
69
+ kind: b.kind,
70
+ worldId: b.worldId,
71
+ layerSetId: b.layerSetId
72
+ }, T), A = /* @__PURE__ */ new Set(), j = null, M = null, N = !1, P = null, F = (e) => {
73
+ if (!e.retiring) {
74
+ let t = Promise.resolve().then(async () => {
75
+ if ((await Promise.allSettled([
76
+ (async () => {
77
+ if (!e.cacheClosed) {
78
+ if (e.cache) {
79
+ let t = e.cache.close();
80
+ if (!(t instanceof Promise) || await t !== void 0) throw h();
81
+ }
82
+ e.cacheClosed = !0;
83
+ }
84
+ })(),
85
+ (async () => {
86
+ if (e.sourceClosed) return;
87
+ let t = e.source.close();
88
+ if (!(t instanceof Promise) || await t !== void 0) throw h();
89
+ e.sourceClosed = !0;
90
+ })(),
91
+ (async () => {
92
+ if (!e.renderClosed) {
93
+ if (e.render) {
94
+ let t = e.render.close();
95
+ if (!(t instanceof Promise) || await t !== void 0) throw h();
96
+ }
97
+ e.renderClosed = !0;
98
+ }
99
+ })()
100
+ ])).some((e) => e.status === "rejected")) throw h();
101
+ A.delete(e);
102
+ });
103
+ e.retiring = t, t.then(() => {
104
+ e.retiring = null;
105
+ }, () => {
106
+ e.retiring = null;
107
+ });
108
+ }
109
+ return e.retiring;
110
+ }, I = () => {
111
+ if (N || M || !j?.cache) throw h();
112
+ return k.current(), j.cache;
113
+ };
114
+ return Object.freeze({
115
+ at: (e) => I().at(e),
116
+ contains: (e) => I().contains(e),
117
+ render: (t, n) => {
118
+ try {
119
+ let e = I(), r = j;
120
+ if (!r.render) {
121
+ let t = b.kind === "2d-heightfield" ? D.codecLimits?.["2d-heightfield"] : void 0, n = t && !O.lod?.codecLimits ? {
122
+ ...O,
123
+ lod: {
124
+ ...O.lod,
125
+ codecLimits: t
126
+ }
127
+ } : O;
128
+ r.render = d(e, v, n);
129
+ }
130
+ return r.render.prepare(t, n);
131
+ } catch (t) {
132
+ return Promise.reject(t instanceof e ? t : h());
133
+ }
134
+ },
135
+ observation: () => {
136
+ let e = j?.cache;
137
+ return Object.freeze({
138
+ scope: j?.scope ?? null,
139
+ ready: !N && M === null && e != null && !e.observation().withdrawn && !k.observation().withdrawn,
140
+ active: M !== null,
141
+ withdrawn: N || k.observation().withdrawn,
142
+ retiring: [...A].filter((e) => e !== j).length,
143
+ renderEntries: j?.render?.observation().entries ?? 0,
144
+ renderEncodedBytes: j?.render?.observation().encodedBytes ?? 0,
145
+ renderJobs: j?.render?.observation().jobs ?? 0
146
+ });
147
+ },
148
+ stream: (r, i = {}) => {
149
+ try {
150
+ if (N || M) throw h();
151
+ let a = b.kind === "3d-voxel" || b.kind === "3d-shapes", c = n(r, a ? [
152
+ "xRaw",
153
+ "yRaw",
154
+ "zRaw"
155
+ ] : ["xRaw", "yRaw"]), u = Object.freeze(Object.fromEntries(Object.entries(c).map(([e, t]) => [e, o(t, -2147483648, 2147483647)]))), d = { ...n(i, [
156
+ "maxChunks",
157
+ "maxVisitedCoordinates",
158
+ "velocity"
159
+ ], []) };
160
+ if (Object.hasOwn(d, "velocity")) {
161
+ let e = n(d.velocity, a ? [
162
+ "xRaw",
163
+ "yRaw",
164
+ "zRaw"
165
+ ] : ["xRaw", "yRaw"]);
166
+ d.velocity = Object.freeze(Object.fromEntries(Object.entries(e).map(([e, t]) => [e, o(t, -2147483648, 2147483647)])));
167
+ }
168
+ let f = Promise.resolve().then(async () => {
169
+ let n = null;
170
+ try {
171
+ for (let e of A) e !== j && await F(e);
172
+ if (await k.pump(), N) throw h();
173
+ let e = k.current().scope, r = D.maxCachedChunks ?? v.geometry.streaming.client.maxCachedChunks;
174
+ if (s(v, e, u, {
175
+ ...d,
176
+ maxChunks: Object.hasOwn(d, "maxChunks") ? o(d.maxChunks, 1, r) : r
177
+ }), j && JSON.stringify(j.scope) !== JSON.stringify(e)) {
178
+ let e = j;
179
+ j = null, await F(e);
180
+ }
181
+ if (!j) {
182
+ let r = p(t, e, {
183
+ ...E,
184
+ manifest: () => k.current(),
185
+ staticSource: C
186
+ });
187
+ n = {
188
+ scope: e,
189
+ source: r,
190
+ cache: null,
191
+ render: null,
192
+ renderClosed: !1,
193
+ sourceClosed: !1,
194
+ cacheClosed: !1,
195
+ retiring: null
196
+ }, A.add(n), n.cache = l(t, v, e, { load: (e, t) => r.load(e, t) }, D);
197
+ }
198
+ let i = j ?? n;
199
+ if (!i?.cache || N) throw h();
200
+ let a = await i.cache.stream(u, d);
201
+ if (N || JSON.stringify(k.current().scope) !== JSON.stringify(e)) throw h();
202
+ return j = i, n = null, a;
203
+ } catch (t) {
204
+ throw n && await F(n), t instanceof e ? t : h();
205
+ }
206
+ });
207
+ return M = f, f.then(() => {
208
+ M = null;
209
+ }, () => {
210
+ M = null;
211
+ }), f;
212
+ } catch (t) {
213
+ return Promise.reject(t instanceof e ? t : h());
214
+ }
215
+ },
216
+ close: () => {
217
+ if (N = !0, j = null, !P) {
218
+ let e = M, t = Promise.resolve().then(async () => {
219
+ let t = [...A].map(F);
220
+ if ((await Promise.allSettled([
221
+ k.close(),
222
+ ...t,
223
+ ...e ? [e.then(() => void 0, () => void 0)] : []
224
+ ])).some((e) => e.status === "rejected")) throw h();
225
+ for (let e of A) await F(e);
226
+ });
227
+ P = t, t.then(() => {
228
+ P = null;
229
+ }, () => {
230
+ P = null;
231
+ });
232
+ }
233
+ return P;
234
+ }
235
+ });
236
+ }, _ = (e, t, n, r) => g(c(e), t, n, r);
237
+ export { _ as makeRoomConnectionGeometryVersionClient, g as makeRoomGeometryVersionClient };
@@ -0,0 +1,39 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ // src/geometryVersionCompare.ts
3
+ function t() {
4
+ throw new e({ detail: "Geometry version comparison requires two manifests of the same tenant, World and kind with unique chunk addresses" });
5
+ }
6
+ var n = (e) => JSON.stringify([
7
+ e.layerSetId,
8
+ e.cx,
9
+ e.cy,
10
+ e.cz ?? null
11
+ ]), r = (e) => Object.freeze({
12
+ layerSetId: e.layerSetId,
13
+ cx: e.cx,
14
+ cy: e.cy,
15
+ ...e.cz === void 0 ? {} : { cz: e.cz }
16
+ }), i = (e, t) => e.layerSetId < t.layerSetId ? -1 : e.layerSetId > t.layerSetId ? 1 : e.cx - t.cx || e.cy - t.cy || (e.cz ?? 0) - (t.cz ?? 0), a = (e, a) => {
17
+ if (!e || !a || e.tenantId !== a.tenantId || e.worldId !== a.worldId || e.kind !== a.kind || !Array.isArray(e.chunks) || !Array.isArray(a.chunks)) return t();
18
+ let o = (e) => {
19
+ let r = /* @__PURE__ */ new Map();
20
+ for (let i of e) {
21
+ let e = n(i);
22
+ if (r.has(e)) return t();
23
+ r.set(e, i);
24
+ }
25
+ return r;
26
+ }, s = o(e.chunks), c = o(a.chunks), l = [], u = [], d = [], f = 0;
27
+ for (let [e, t] of c) {
28
+ let n = s.get(e);
29
+ n ? n.contentSha256 === t.contentSha256 ? f++ : d.push(r(t)) : l.push(r(t));
30
+ }
31
+ for (let [e, t] of s) c.has(e) || u.push(r(t));
32
+ return Object.freeze({
33
+ added: Object.freeze(l.sort(i)),
34
+ removed: Object.freeze(u.sort(i)),
35
+ changed: Object.freeze(d.sort(i)),
36
+ unchanged: f
37
+ });
38
+ };
39
+ export { a as compareGeometryVersions };
@@ -0,0 +1,105 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { geometryOwnData as n } from "./geometryTileCodec.js";
3
+ import { admitGeometryChunkForKind as r, captureGeometryArtifact as i, createGeometryArtifact as a } from "./geometryArtifacts.js";
4
+ import { assertGeometryArtifactScope as o, captureGeometryCodecProfiles as s, captureGeometryPersistenceScope as c, captureGeometryStaticReference as l, geometryPersistenceInteger as u } from "./geometryPersistenceData.js";
5
+ import { defaultGeometryMigrateDelta as d } from "./geometryMigrationStrategies.js";
6
+ import { captureGeometryCompactionStrategies as f, prepareGeometryCompaction as p } from "./geometryCompactionStrategies.js";
7
+ import { geometryChunkHasWorldExtent as m } from "./geometryWorldExtent.js";
8
+ import { captureWorldCatalog as h } from "./world.js";
9
+ import { Effect as g } from "effect";
10
+ // src/geometryVersionMigration.ts
11
+ function _() {
12
+ throw new t({ detail: "Geometry version migration requires exact genuine same-chunk artifacts and a bounded pure rule" });
13
+ }
14
+ var v = (v, y, b = {}) => {
15
+ try {
16
+ let x = h([v])[0], S = x.geometry;
17
+ if (!S) return _();
18
+ let C = n(y, ["from", "to"]), w = n(C.from, [
19
+ "reference",
20
+ "static",
21
+ "current"
22
+ ]), T = n(C.to, ["reference", "static"]), E = n(w.current, [
23
+ "scope",
24
+ "revision",
25
+ "artifact"
26
+ ]), D = l(w.reference), O = l(T.reference), k = i(w.static), A = i(T.static), j = i(E.artifact), M = c(E.scope), N = c({
27
+ tenantId: O.tenantId,
28
+ kind: O.kind,
29
+ worldId: O.worldId,
30
+ layerSetId: O.layerSetId,
31
+ version: O.version,
32
+ cx: O.cx,
33
+ cy: O.cy,
34
+ ...O.cz === void 0 ? {} : { cz: O.cz }
35
+ }), P = u(E.revision), F = n(b, [
36
+ "strategies",
37
+ "maxAccountedBytes",
38
+ "maxPatchBytes",
39
+ "codecLimits"
40
+ ], []), I = Object.hasOwn(F, "maxAccountedBytes") ? u(F.maxAccountedBytes, 512, S.budgets.maxPreparedBytes) : S.budgets.maxPreparedBytes, L = Object.hasOwn(F, "maxPatchBytes") ? u(F.maxPatchBytes, 512, S.dynamic.maxDeltaBytesPerChunk) : S.dynamic.maxDeltaBytesPerChunk, R = (Object.hasOwn(F, "codecLimits") ? s(F.codecLimits) : /* @__PURE__ */ new Map()).get(N.kind) ?? {}, z = Object.hasOwn(F, "strategies") ? n(F.strategies, ["migrateDelta", "compaction"], []) : {}, B = Object.hasOwn(z, "migrateDelta"), V = f({ compaction: Object.hasOwn(z, "compaction") ? z.compaction : S.strategies.compaction }), H = B ? z.migrateDelta : S.strategies.migrateDelta, U = H !== d;
41
+ if (D.version === O.version || !S.dynamic.enabled && P !== 0 || D.kind !== S.kind || O.kind !== S.kind || D.worldId !== x.name || O.worldId !== x.name || D.tenantId !== O.tenantId || D.layerSetId !== O.layerSetId || D.cx !== O.cx || D.cy !== O.cy || D.cz !== O.cz || JSON.stringify(M) !== JSON.stringify(c({
42
+ tenantId: D.tenantId,
43
+ kind: D.kind,
44
+ worldId: D.worldId,
45
+ layerSetId: D.layerSetId,
46
+ version: D.version,
47
+ cx: D.cx,
48
+ cy: D.cy,
49
+ ...D.cz === void 0 ? {} : { cz: D.cz }
50
+ })) || typeof H != "function") return _();
51
+ for (let [e, t] of [[k, D], [A, O]]) if (o(e, t), e.blobSha256 !== t.blobSha256 || e.contentSha256 !== t.contentSha256) return _();
52
+ o(j, M);
53
+ let W = 0;
54
+ for (let t of [
55
+ k,
56
+ A,
57
+ j
58
+ ]) {
59
+ if (r(N.kind, t.chunk, R), !m(t, S.chunkSizeRaw)) return _();
60
+ if (W += t.bytes().length, W > I) throw new e({
61
+ budget: "geometryMigrationAccountedBytes",
62
+ limit: I
63
+ });
64
+ }
65
+ let G = B ? H.bind(F.strategies) : H, K = Object.freeze({
66
+ static: k,
67
+ current: j,
68
+ revision: P
69
+ }), q = Object.freeze({ static: A }), J = k.contentSha256 !== A.contentSha256;
70
+ return g.uninterruptible(g.tryPromise({
71
+ try: async () => {
72
+ let t = G(K, q);
73
+ if (t instanceof Promise) return t.catch(() => void 0), _();
74
+ let n = t === null ? A : await a(r(N.kind, t, R), R);
75
+ if (o(n, N), !m(n, S.chunkSizeRaw)) return _();
76
+ let i = await p({
77
+ static: A,
78
+ current: n,
79
+ limits: {
80
+ maxBytes: L,
81
+ maxMetadataBytes: Math.min(4096, L - 16)
82
+ },
83
+ codecLimits: R
84
+ }, V);
85
+ if (W + n.bytes().length + i.bytes().length > I) throw new e({
86
+ budget: "geometryMigrationAccountedBytes",
87
+ limit: I
88
+ });
89
+ return Object.freeze({
90
+ fromScope: M,
91
+ scope: N,
92
+ fromRevision: P,
93
+ staticChanged: J,
94
+ decision: U ? "custom" : J ? "discarded" : "kept",
95
+ artifact: n,
96
+ patch: i
97
+ });
98
+ },
99
+ catch: (n) => n instanceof e ? n : new t({ detail: "Actual native geometry migration preparation remains unavailable" })
100
+ }));
101
+ } catch (n) {
102
+ return g.fail(n instanceof e ? n : new t({ detail: "Geometry version migration input could not be captured" }));
103
+ }
104
+ };
105
+ export { d as defaultGeometryMigrateDelta, v as prepareGeometryVersionMigration };
@@ -0,0 +1,252 @@
1
+ import { BudgetExceeded as e } from "./errors.js";
2
+ import { geometryEnvelopeMagic as t } from "./geometryEnvelope.js";
3
+ import { createFixed as n } from "./fixedMath.js";
4
+ import { captureSimulationBytes as r } from "./simulationBytes.js";
5
+ import { fieldId as i } from "./room.js";
6
+ import { RoomStateCodec as a } from "./stateCodec.js";
7
+ import { GeometryTileMaterialSchema as o, GeometryTileRunSchema as s } from "./geometrySchemas.js";
8
+ import { geometryOwnData as c, geometryTileRefusal as l } from "./geometryTileCodec.js";
9
+ import { GeometryChunkAddress3DSchema as u } from "./geometryShapes.js";
10
+ import { Result as d, Schema as f } from "effect";
11
+ // src/geometryVoxel.ts
12
+ var p = n(), m = f.Struct({
13
+ sx: f.Int.pipe(i(1)),
14
+ sy: f.Int.pipe(i(2)),
15
+ sz: f.Int.pipe(i(3)),
16
+ runs: f.Array(s).pipe(i(4))
17
+ }), h = f.Struct({
18
+ kind: f.Literal("3d-voxel").pipe(i(1)),
19
+ formatVersion: f.Literal(1).pipe(i(2)),
20
+ address: u.pipe(i(3)),
21
+ version: f.String.pipe(i(4)),
22
+ side: f.Int.pipe(i(5)),
23
+ voxelSizeRaw: f.Int.pipe(i(6)),
24
+ palette: f.Array(o).pipe(i(7)),
25
+ sections: f.Array(m).pipe(i(8))
26
+ }), g = Object.freeze({
27
+ maxSide: 64,
28
+ maxVoxels: 262144,
29
+ maxPalette: 256,
30
+ maxSections: 64,
31
+ maxRunsPerSection: 4096,
32
+ maxBytes: 1048576
33
+ }), _ = Object.freeze({
34
+ maxSide: 128,
35
+ maxVoxels: 2097152,
36
+ maxPalette: 4096,
37
+ maxSections: 512,
38
+ maxRunsPerSection: 4096,
39
+ maxBytes: 16777216
40
+ }), v = (e, t, n) => typeof e == "number" && Number.isSafeInteger(e) && e >= t && e <= n ? e === 0 ? 0 : e : l(), y = (e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9._:-]{0,95}$/.test(e) ? e : l(), b = (e) => {
41
+ let t = c(e, [
42
+ "worldId",
43
+ "layerSetId",
44
+ "cx",
45
+ "cy",
46
+ "cz"
47
+ ]);
48
+ return Object.freeze({
49
+ worldId: y(t.worldId),
50
+ layerSetId: y(t.layerSetId),
51
+ cx: v(t.cx, -2147483648, 2147483647),
52
+ cy: v(t.cy, -2147483648, 2147483647),
53
+ cz: v(t.cz, -2147483648, 2147483647)
54
+ });
55
+ }, x = (e) => {
56
+ let t = c(e, ["key", "solid"]);
57
+ return typeof t.key != "string" || !/^[A-Za-z0-9][A-Za-z0-9._:-]{0,63}$/.test(t.key) || typeof t.solid != "boolean" ? l() : Object.freeze({
58
+ key: t.key,
59
+ solid: t.solid
60
+ });
61
+ }, S = (e, t, n) => {
62
+ if (!Array.isArray(e) || e.length > t || Reflect.ownKeys(e).length !== e.length + 1) return l();
63
+ let r = [];
64
+ for (let t = 0; t < e.length; t++) {
65
+ let i = Object.getOwnPropertyDescriptor(e, String(t));
66
+ if (!i?.enumerable || !("value" in i)) return l();
67
+ r.push(n(i.value, t));
68
+ }
69
+ return Object.freeze(r);
70
+ }, C = [
71
+ "address",
72
+ "version",
73
+ "side",
74
+ "voxelSizeRaw"
75
+ ], w = (e, t) => ({
76
+ sx: e % t,
77
+ sy: Math.floor(e / t) % t,
78
+ sz: Math.floor(e / (t * t))
79
+ }), T = (n = {}) => {
80
+ let i = Object.keys(g), o = c(n, i, []), s = { ...g };
81
+ for (let e of i) Object.hasOwn(o, e) && (s[e] = v(o[e], e === "maxBytes" ? 64 : e === "maxSide" ? 16 : 1, _[e]));
82
+ let u = Object.freeze(s), f = new a(h, {
83
+ maxBytes: u.maxBytes - 12,
84
+ maxCollectionLength: Math.max(u.maxPalette, u.maxSections, u.maxRunsPerSection),
85
+ maxFieldId: 16
86
+ }), p = (t) => {
87
+ let n = v(t.side, 16, u.maxSide), r = v(t.voxelSizeRaw, 1, 2147483647);
88
+ if (n % 16 != 0 || n * r > 2147483647) return l();
89
+ let i = n / 16, a = i * i * i, o = n * n * n;
90
+ if (a > u.maxSections) throw new e({
91
+ budget: "geometryVoxelSections",
92
+ limit: u.maxSections
93
+ });
94
+ if (o > u.maxVoxels) throw new e({
95
+ budget: "geometryVoxels",
96
+ limit: u.maxVoxels
97
+ });
98
+ return {
99
+ side: n,
100
+ voxelSizeRaw: r,
101
+ edge: i,
102
+ sections: a,
103
+ voxels: o
104
+ };
105
+ }, m = (e) => {
106
+ let t = c(e, [
107
+ "kind",
108
+ "formatVersion",
109
+ ...C,
110
+ "palette",
111
+ "sections"
112
+ ]);
113
+ if (t.kind !== "3d-voxel" || t.formatVersion !== 1) return l();
114
+ let n = p(t), r = S(t.palette, u.maxPalette, x);
115
+ if (!r.length) return l();
116
+ for (let e = 1; e < r.length; e++) if (r[e - 1].key >= r[e].key) return l();
117
+ let i = new Uint8Array(r.length), a = S(t.sections, n.sections, (e, t) => {
118
+ let a = c(e, [
119
+ "sx",
120
+ "sy",
121
+ "sz",
122
+ "runs"
123
+ ]), o = w(t, n.edge);
124
+ if (a.sx !== o.sx || a.sy !== o.sy || a.sz !== o.sz) return l();
125
+ let s = 0, d = -1, f = S(a.runs, u.maxRunsPerSection, (e) => {
126
+ let t = c(e, ["paletteIndex", "length"]), n = v(t.paletteIndex, 0, r.length - 1), a = v(t.length, 1, 4096);
127
+ return n === d || a > 4096 - s ? l() : (s += a, d = n, i[n] = 1, Object.freeze({
128
+ paletteIndex: n,
129
+ length: a
130
+ }));
131
+ });
132
+ return s === 4096 ? Object.freeze({
133
+ ...o,
134
+ runs: f
135
+ }) : l();
136
+ });
137
+ return a.length !== n.sections || i.some((e) => e === 0) ? l() : Object.freeze({
138
+ kind: "3d-voxel",
139
+ formatVersion: 1,
140
+ address: b(t.address),
141
+ version: y(t.version),
142
+ side: n.side,
143
+ voxelSizeRaw: n.voxelSizeRaw,
144
+ palette: r,
145
+ sections: a
146
+ });
147
+ }, T = (t) => {
148
+ let n = c(t, [...C, "voxels"]), r = p(n), i = S(n.voxels, r.voxels, x);
149
+ if (i.length !== r.voxels) return l();
150
+ let a = /* @__PURE__ */ new Map();
151
+ for (let t of i) {
152
+ let n = a.get(t.key);
153
+ if (n && n.solid !== t.solid) return l();
154
+ if (a.set(t.key, t), a.size > u.maxPalette) throw new e({
155
+ budget: "geometryVoxelPalette",
156
+ limit: u.maxPalette
157
+ });
158
+ }
159
+ let o = [...a.values()].sort((e, t) => e.key < t.key ? -1 : +(e.key > t.key)), s = new Map(o.map((e, t) => [e.key, t])), d = [];
160
+ for (let t = 0; t < r.sections; t++) {
161
+ let n = w(t, r.edge), a = [];
162
+ for (let t = 0; t < 4096; t++) {
163
+ let o = n.sx * 16 + (t & 15), c = n.sy * 16 + (t >>> 4 & 15), l = n.sz * 16 + (t >>> 8), d = s.get(i[(l * r.side + c) * r.side + o].key), f = a.at(-1);
164
+ if (f?.paletteIndex === d ? a[a.length - 1] = {
165
+ paletteIndex: d,
166
+ length: f.length + 1
167
+ } : a.push({
168
+ paletteIndex: d,
169
+ length: 1
170
+ }), a.length > u.maxRunsPerSection) throw new e({
171
+ budget: "geometryVoxelRuns",
172
+ limit: u.maxRunsPerSection
173
+ });
174
+ }
175
+ d.push({
176
+ ...n,
177
+ runs: a
178
+ });
179
+ }
180
+ return m({
181
+ kind: "3d-voxel",
182
+ formatVersion: 1,
183
+ address: n.address,
184
+ version: n.version,
185
+ side: r.side,
186
+ voxelSizeRaw: r.voxelSizeRaw,
187
+ palette: o,
188
+ sections: d
189
+ });
190
+ }, E = (e) => {
191
+ let n = f.full(m(e));
192
+ if (d.isFailure(n)) return l();
193
+ let r = new Uint8Array(12 + n.success.byteLength), i = new DataView(r.buffer);
194
+ return r.set(t["3d-voxel"]), i.setUint32(4, f.schemaHash, !0), i.setUint32(8, n.success.byteLength, !0), r.set(n.success, 12), r;
195
+ };
196
+ return Object.freeze({
197
+ limits: u,
198
+ schemaHash: f.schemaHash,
199
+ capture: m,
200
+ create: T,
201
+ encode: E,
202
+ decode: (n) => {
203
+ let i;
204
+ try {
205
+ i = r(n, u.maxBytes, "geometryVoxelBytes");
206
+ } catch (t) {
207
+ if (t instanceof e) throw t;
208
+ return l();
209
+ }
210
+ if (i.length < 12 || t["3d-voxel"].some((e, t) => i[t] !== e)) return l();
211
+ let a = new DataView(i.buffer, i.byteOffset, 12);
212
+ if (a.getUint32(4, !0) !== f.schemaHash || a.getUint32(8, !0) !== i.length - 12) return l();
213
+ let o = f.decodeFull(i.subarray(12));
214
+ if (d.isFailure(o)) return l();
215
+ let s = m(o.success), c = E(s);
216
+ return c.length !== i.length || c.some((e, t) => e !== i[t]) ? l() : s;
217
+ }
218
+ });
219
+ }, E = (e, t = {}) => {
220
+ let n = T(t).capture(e), r = n.side / 16, i = n.sections.map((e) => {
221
+ let t = new Uint16Array(e.runs.length), n = new Uint16Array(e.runs.length), r = 0;
222
+ return e.runs.forEach((e, i) => {
223
+ r += e.length, t[i] = r, n[i] = e.paletteIndex;
224
+ }), {
225
+ ends: t,
226
+ palette: n
227
+ };
228
+ }), a = (e, t, a) => {
229
+ v(e, 0, n.side - 1), v(t, 0, n.side - 1), v(a, 0, n.side - 1);
230
+ let o = i[((a >>> 4) * r + (t >>> 4)) * r + (e >>> 4)], s = ((a & 15) * 16 + (t & 15)) * 16 + (e & 15), c = 0, l = o.ends.length;
231
+ for (; c < l;) {
232
+ let e = c + l >>> 1;
233
+ o.ends[e] > s ? l = e : c = e + 1;
234
+ }
235
+ return n.palette[o.palette[c]];
236
+ };
237
+ return Object.freeze({
238
+ chunk: n,
239
+ materialAt: a,
240
+ solidAt: (e, t, n) => a(e, t, n).solid,
241
+ materialAtRaw: (e, t, r) => {
242
+ let i = n.side * n.voxelSizeRaw;
243
+ return v(e, 0, i - 1), v(t, 0, i - 1), v(r, 0, i - 1), a(p.div(p.raw(e), p.raw(n.voxelSizeRaw)) >>> 16, p.div(p.raw(t), p.raw(n.voxelSizeRaw)) >>> 16, p.div(p.raw(r), p.raw(n.voxelSizeRaw)) >>> 16);
244
+ },
245
+ occupancy: () => {
246
+ let e = n.side * n.side * n.side, t = new Uint8Array(Math.ceil(e / 8));
247
+ for (let r = 0; r < e; r++) a(r % n.side, Math.floor(r / n.side) % n.side, Math.floor(r / (n.side * n.side))).solid && (t[r >>> 3] = t[r >>> 3] | 1 << (r & 7));
248
+ return t;
249
+ }
250
+ });
251
+ };
252
+ export { h as GeometryVoxelChunkSchema, m as GeometryVoxelSectionSchema, T as createGeometryVoxelCodec, E as createGeometryVoxelView, g as defaultGeometryVoxelLimits };
@@ -0,0 +1,31 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { WORLD_ENTITIES_TABLE as t } from "./worldEntities.js";
3
+ import { and as n, eq as r } from "@voltro/database";
4
+ import { Effect as i } from "effect";
5
+ // src/geometryWorldEntitySubject.ts
6
+ var a = (a) => (o) => i.tryPromise({
7
+ try: async () => {
8
+ let e = await a.query({
9
+ table: t,
10
+ predicate: n(r("tenantId", o.tenantId), r("subjectId", o.subjectId), r("roomId", o.roomId)),
11
+ order: [],
12
+ take: 16,
13
+ skip: void 0,
14
+ projection: [
15
+ "tenantId",
16
+ "subjectId",
17
+ "subjectKind",
18
+ "roomId"
19
+ ]
20
+ }), i = new Set(e.map((e) => e.subjectKind));
21
+ if (!e.length || i.size !== 1 || e.some((e) => e.tenantId !== o.tenantId || e.subjectId !== o.subjectId || e.roomId !== o.roomId)) throw Error("no entity");
22
+ let s = [...i][0];
23
+ if (s !== "user" && s !== "guest") throw Error("no kind");
24
+ return Object.freeze({
25
+ id: o.subjectId,
26
+ kind: s
27
+ });
28
+ },
29
+ catch: () => new e({ detail: "Geometry recipient has no World entity in this Room" })
30
+ });
31
+ export { a as worldEntityGeometrySubject };
@@ -0,0 +1,11 @@
1
+ // src/geometryWorldExtent.ts
2
+ var e = (e, t) => {
3
+ let n = e.chunk;
4
+ switch (n.kind) {
5
+ case "2d-tiles": return n.width * n.tileSizeRaw === t && n.height * n.tileSizeRaw === t;
6
+ case "2d-heightfield": return (n.width - 1) * n.sampleSpacingRaw === t && (n.height - 1) * n.sampleSpacingRaw === t;
7
+ case "3d-shapes": return n.extentXRaw === t && n.extentYRaw === t && n.extentZRaw === t;
8
+ case "3d-voxel": return n.side * n.voxelSizeRaw === t;
9
+ }
10
+ };
11
+ export { e as geometryChunkHasWorldExtent };