@voltro/plugin-rooms 0.0.0-stage → 0.87.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 +24329 -0
  2. package/LICENSE +61 -0
  3. package/README.md +9204 -2
  4. package/SECURITY.md +56 -0
  5. package/THIRD-PARTY-NOTICES.md +11322 -0
  6. package/dist/actor.js +1474 -0
  7. package/dist/apiBinding.js +678 -0
  8. package/dist/apiRegistryBinding.js +399 -0
  9. package/dist/apiReservations.js +433 -0
  10. package/dist/baselines.js +73 -0
  11. package/dist/bots.d.ts +1485 -0
  12. package/dist/bots.js +563 -0
  13. package/dist/catalog.js +80 -0
  14. package/dist/checkpointJson.js +24 -0
  15. package/dist/checkpointStore.js +386 -0
  16. package/dist/client.js +56 -0
  17. package/dist/clockSync.js +51 -0
  18. package/dist/collision.js +156 -0
  19. package/dist/commandDelivery.js +101 -0
  20. package/dist/commandRecord.js +11 -0
  21. package/dist/commandWithdrawal.js +183 -0
  22. package/dist/connection.js +497 -0
  23. package/dist/controlCarrier.js +375 -0
  24. package/dist/controlRegistry.js +79 -0
  25. package/dist/controlTarget.js +45 -0
  26. package/dist/controlTransport.js +574 -0
  27. package/dist/developmentBinding.js +113 -0
  28. package/dist/directory.js +323 -0
  29. package/dist/directoryProjection.js +117 -0
  30. package/dist/errors.d.ts +125 -0
  31. package/dist/errors.js +53 -0
  32. package/dist/fixed.d.ts +284 -0
  33. package/dist/fixed.js +10 -0
  34. package/dist/fixed32.js +134 -0
  35. package/dist/fixedCollision.js +60 -0
  36. package/dist/fixedCollision32.js +109 -0
  37. package/dist/fixedMath.js +56 -0
  38. package/dist/fixedRaw.js +11 -0
  39. package/dist/fixedSlabs.js +34 -0
  40. package/dist/fixedTrig.js +48 -0
  41. package/dist/fixedTrig32.js +38 -0
  42. package/dist/fixedVectors.js +113 -0
  43. package/dist/fixedVectors32.js +95 -0
  44. package/dist/fixedWide.js +50 -0
  45. package/dist/fixedWords.js +46 -0
  46. package/dist/gateway.js +57 -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 +82 -0
  54. package/dist/geometryActorInventory.js +108 -0
  55. package/dist/geometryAdminClient.js +87 -0
  56. package/dist/geometryAdminData.js +32 -0
  57. package/dist/geometryAdminFixtures.js +50 -0
  58. package/dist/geometryAdminPorts.js +5 -0
  59. package/dist/geometryAdminRpc.js +58 -0
  60. package/dist/geometryAdminRpcRoutes.js +49 -0
  61. package/dist/geometryAdminSchemas.js +39 -0
  62. package/dist/geometryAdministration.js +190 -0
  63. package/dist/geometryAdministrationPorts.js +5 -0
  64. package/dist/geometryApiBinding.js +165 -0
  65. package/dist/geometryAppStorage.js +58 -0
  66. package/dist/geometryArtifacts.js +198 -0
  67. package/dist/geometryAssetBundle.js +117 -0
  68. package/dist/geometryAssetClient.js +25 -0
  69. package/dist/geometryAssetData.js +106 -0
  70. package/dist/geometryAssetHttp.js +123 -0
  71. package/dist/geometryAssetPorts.js +5 -0
  72. package/dist/geometryAssetRpc.js +30 -0
  73. package/dist/geometryAssetRpcRoutes.js +40 -0
  74. package/dist/geometryAssetStorageGrant.js +103 -0
  75. package/dist/geometryBoxOverlap.js +110 -0
  76. package/dist/geometryCatalogueDigest.js +111 -0
  77. package/dist/geometryCellCoverage.js +85 -0
  78. package/dist/geometryCellLoader.js +28 -0
  79. package/dist/geometryChannel.js +134 -0
  80. package/dist/geometryChunkHttp.js +54 -0
  81. package/dist/geometryChunkLeases.js +22 -0
  82. package/dist/geometryClient.d.ts +1429 -0
  83. package/dist/geometryClient.js +149 -0
  84. package/dist/geometryClientChunks.js +330 -0
  85. package/dist/geometryClientDelta.js +25 -0
  86. package/dist/geometryClientHttp.js +37 -0
  87. package/dist/geometryClientInterest.js +109 -0
  88. package/dist/geometryClientStatic.js +34 -0
  89. package/dist/geometryCms.d.ts +763 -0
  90. package/dist/geometryCms.js +217 -0
  91. package/dist/geometryCommitCoordinator.js +241 -0
  92. package/dist/geometryCompactionFixture.js +84 -0
  93. package/dist/geometryCompactionStrategies.js +38 -0
  94. package/dist/geometryConnectionClient.js +23 -0
  95. package/dist/geometryDerivationFixtures.js +141 -0
  96. package/dist/geometryDerivationStrategies.js +27 -0
  97. package/dist/geometryDigest.js +13 -0
  98. package/dist/geometryEditChannel.js +70 -0
  99. package/dist/geometryEditIngress.js +263 -0
  100. package/dist/geometryEdits.js +366 -0
  101. package/dist/geometryEnvelope.js +41 -0
  102. package/dist/geometryGridRaycast.js +92 -0
  103. package/dist/geometryGridSweep.js +92 -0
  104. package/dist/geometryHeightfield.js +166 -0
  105. package/dist/geometryHeightfieldRaycast.js +74 -0
  106. package/dist/geometryHeightfieldSweep.js +85 -0
  107. package/dist/geometryHeightfieldVolume.js +45 -0
  108. package/dist/geometryHost.js +322 -0
  109. package/dist/geometryHostDirectory.js +207 -0
  110. package/dist/geometryHostMutations.js +137 -0
  111. package/dist/geometryHostStreams.js +124 -0
  112. package/dist/geometryHttpBody.js +76 -0
  113. package/dist/geometryHttpRoutes.js +112 -0
  114. package/dist/geometryImportGltf.js +300 -0
  115. package/dist/geometryImportLdtk.js +54 -0
  116. package/dist/geometryImportPng.js +144 -0
  117. package/dist/geometryImportPublication.js +67 -0
  118. package/dist/geometryImportTiled.js +39 -0
  119. package/dist/geometryImportTiles.js +136 -0
  120. package/dist/geometryImportVox.js +130 -0
  121. package/dist/geometryImportedSource.js +101 -0
  122. package/dist/geometryInspectEndpoint.js +248 -0
  123. package/dist/geometryInspection.js +92 -0
  124. package/dist/geometryInstall.js +121 -0
  125. package/dist/geometryJournalArchiveData.js +21 -0
  126. package/dist/geometryJournalArchiveIndex.js +330 -0
  127. package/dist/geometryJournalArchiveTable.js +21 -0
  128. package/dist/geometryJournalCompaction.js +100 -0
  129. package/dist/geometryJournalPatch.js +47 -0
  130. package/dist/geometryJournalRetention.js +112 -0
  131. package/dist/geometryJournalRetentionSchemas.js +36 -0
  132. package/dist/geometryJournalRetentionSweep.js +112 -0
  133. package/dist/geometryJournalRetentionWorkflow.js +28 -0
  134. package/dist/geometryJournalRetentionWorkflowData.js +31 -0
  135. package/dist/geometryJournalStorage.js +148 -0
  136. package/dist/geometryLoader.js +118 -0
  137. package/dist/geometryManifest.js +113 -0
  138. package/dist/geometryManifestChannel.js +93 -0
  139. package/dist/geometryManifestClient.js +122 -0
  140. package/dist/geometryManifestData.js +49 -0
  141. package/dist/geometryManifestPorts.js +5 -0
  142. package/dist/geometryManifestPublication.js +109 -0
  143. package/dist/geometryManifestSource.js +68 -0
  144. package/dist/geometryMigrationJournal.js +14 -0
  145. package/dist/geometryMigrationStrategies.js +7 -0
  146. package/dist/geometryMigrations.js +323 -0
  147. package/dist/geometryNativeMetadata.js +52 -0
  148. package/dist/geometryPatch.js +170 -0
  149. package/dist/geometryPersistence.js +449 -0
  150. package/dist/geometryPersistenceCapture.js +69 -0
  151. package/dist/geometryPersistenceData.js +140 -0
  152. package/dist/geometryPersistencePorts.js +5 -0
  153. package/dist/geometryPlayerAdmission.js +34 -0
  154. package/dist/geometryPlayerEditOwner.js +265 -0
  155. package/dist/geometryPlayerEdits.js +49 -0
  156. package/dist/geometryPrepared.js +188 -0
  157. package/dist/geometryPrivacyFence.js +24 -0
  158. package/dist/geometryProceduralPublication.js +91 -0
  159. package/dist/geometryProceduralWorker.js +164 -0
  160. package/dist/geometryPublication.js +110 -0
  161. package/dist/geometryRayAlgebra.js +116 -0
  162. package/dist/geometryReadClient.js +157 -0
  163. package/dist/geometryReadPorts.js +5 -0
  164. package/dist/geometryReadRpc.js +27 -0
  165. package/dist/geometryReadRpcRoutes.js +47 -0
  166. package/dist/geometryReliablePublication.js +82 -0
  167. package/dist/geometryReloadPorts.js +46 -0
  168. package/dist/geometryReloadSource.js +278 -0
  169. package/dist/geometryRenderCache.js +165 -0
  170. package/dist/geometryRenderLod.js +102 -0
  171. package/dist/geometryRollback.js +125 -0
  172. package/dist/geometryRollbackCoordinator.js +203 -0
  173. package/dist/geometryRollbackPorts.js +46 -0
  174. package/dist/geometryRollbackSource.js +209 -0
  175. package/dist/geometryRollbackStore.js +198 -0
  176. package/dist/geometrySchemas.js +27 -0
  177. package/dist/geometryServer.d.ts +2766 -0
  178. package/dist/geometryServer.js +62 -0
  179. package/dist/geometryShapeRaycast.js +111 -0
  180. package/dist/geometryShapeSegments.js +34 -0
  181. package/dist/geometryShapes.js +223 -0
  182. package/dist/geometrySnapshot.js +76 -0
  183. package/dist/geometrySnapshotChannel.js +160 -0
  184. package/dist/geometrySnapshotClient.js +159 -0
  185. package/dist/geometrySnapshotPreparation.js +76 -0
  186. package/dist/geometrySnapshotServer.js +191 -0
  187. package/dist/geometrySqlOwner.js +21 -0
  188. package/dist/geometryStorage.js +127 -0
  189. package/dist/geometryStorageGrant.js +69 -0
  190. package/dist/geometryStorageIdentity.js +9 -0
  191. package/dist/geometryTileArtifact.js +10 -0
  192. package/dist/geometryTileCodec.js +194 -0
  193. package/dist/geometryTileCollision.js +96 -0
  194. package/dist/geometryTileNavigation.js +128 -0
  195. package/dist/geometryTileView.js +35 -0
  196. package/dist/geometryVersionActivation.js +114 -0
  197. package/dist/geometryVersionClient.js +238 -0
  198. package/dist/geometryVersionCompare.js +40 -0
  199. package/dist/geometryVersionMigration.js +106 -0
  200. package/dist/geometryVoxel.js +253 -0
  201. package/dist/geometryWorldEntitySubject.js +32 -0
  202. package/dist/geometryWorldExtent.js +12 -0
  203. package/dist/geometryWorldMetadata.js +38 -0
  204. package/dist/geometryWorldStrategyFixtures.js +127 -0
  205. package/dist/geometryWorldView.js +307 -0
  206. package/dist/host.js +128 -0
  207. package/dist/hostBinding.js +277 -0
  208. package/dist/hostCellObservation.js +114 -0
  209. package/dist/hostClientCapacity.js +90 -0
  210. package/dist/hostCommandScope.js +64 -0
  211. package/dist/hostController.js +3094 -0
  212. package/dist/hostDeployment.js +65 -0
  213. package/dist/hostDrain.js +152 -0
  214. package/dist/hostDrainPorts.js +5 -0
  215. package/dist/hostDriver.js +179 -0
  216. package/dist/hostLane.js +288 -0
  217. package/dist/hostListener.js +79 -0
  218. package/dist/hostListenerBinding.js +19 -0
  219. package/dist/hostLoopObservation.js +90 -0
  220. package/dist/hostMetrics.js +56 -0
  221. package/dist/hostRegistryBinding.js +418 -0
  222. package/dist/hostSelection.js +16 -0
  223. package/dist/hostShutdown.js +47 -0
  224. package/dist/hostTurnObservation.js +53 -0
  225. package/dist/identities.js +4 -0
  226. package/dist/index.d.ts +8632 -0
  227. package/dist/index.js +232 -0
  228. package/dist/inputReceipts.js +63 -0
  229. package/dist/inputRedundancy.js +55 -0
  230. package/dist/inspect.js +238 -0
  231. package/dist/lockstep.d.ts +436 -0
  232. package/dist/lockstep.js +382 -0
  233. package/dist/lockstepAdmission.js +262 -0
  234. package/dist/lockstepAdmissionCodec.js +94 -0
  235. package/dist/lockstepAdmissionPorts.js +5 -0
  236. package/dist/lockstepClientSession.js +578 -0
  237. package/dist/lockstepDefinition.js +148 -0
  238. package/dist/lockstepHostLoop.js +243 -0
  239. package/dist/lockstepInitialAdmission.js +67 -0
  240. package/dist/lockstepInitialStrategyFixtures.js +45 -0
  241. package/dist/lockstepJournal.js +395 -0
  242. package/dist/lockstepJournalCodec.js +254 -0
  243. package/dist/lockstepJournalPorts.js +5 -0
  244. package/dist/lockstepJournalRebuild.js +208 -0
  245. package/dist/lockstepJournalRows.js +57 -0
  246. package/dist/lockstepMembers.js +131 -0
  247. package/dist/lockstepMessages.js +47 -0
  248. package/dist/lockstepOwnedRoom.js +764 -0
  249. package/dist/lockstepPolicies.js +84 -0
  250. package/dist/lockstepReact.js +47 -0
  251. package/dist/lockstepRecoveryTruth.js +121 -0
  252. package/dist/lockstepRosterConfig.js +32 -0
  253. package/dist/lockstepSeed.js +12 -0
  254. package/dist/lockstepSeedFixture.js +20 -0
  255. package/dist/lockstepServer.d.ts +3897 -0
  256. package/dist/lockstepServer.js +325 -0
  257. package/dist/lockstepServerConfig.js +101 -0
  258. package/dist/lockstepServerRoles.js +403 -0
  259. package/dist/lockstepServerStrategyFixtures.js +33 -0
  260. package/dist/lockstepStrategies.js +6 -0
  261. package/dist/lockstepStrategyFixtures.js +137 -0
  262. package/dist/lockstepTerminal.js +90 -0
  263. package/dist/lockstepTerminalPorts.js +5 -0
  264. package/dist/lockstepTransport.js +773 -0
  265. package/dist/lockstepTransportConfig.js +32 -0
  266. package/dist/lockstepWireRoster.js +34 -0
  267. package/dist/matchRoomProvider.js +32 -0
  268. package/dist/matchRooms.js +19 -0
  269. package/dist/membershipObserver.js +47 -0
  270. package/dist/moderation.js +98 -0
  271. package/dist/movementSpecials.js +104 -0
  272. package/dist/ownership.js +17 -0
  273. package/dist/ownershipWithdrawal.js +18 -0
  274. package/dist/pcg32.js +96 -0
  275. package/dist/ports.d.ts +1241 -0
  276. package/dist/ports.js +11 -0
  277. package/dist/quaternion.js +70 -0
  278. package/dist/react.d.ts +406 -0
  279. package/dist/react.js +109 -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 +243 -0
  283. package/dist/reaperSchemas.js +42 -0
  284. package/dist/reaperWorkflow.js +70 -0
  285. package/dist/recovery.js +189 -0
  286. package/dist/recoverySeats.js +26 -0
  287. package/dist/replay.d.ts +273 -0
  288. package/dist/replay.js +485 -0
  289. package/dist/replayPorts.js +5 -0
  290. package/dist/replayRecording.js +67 -0
  291. package/dist/replaySchema.js +157 -0
  292. package/dist/replayStorage.d.ts +149 -0
  293. package/dist/replayStorage.js +485 -0
  294. package/dist/reservationBatch.js +422 -0
  295. package/dist/reservationSchemas.js +17 -0
  296. package/dist/reservations.js +259 -0
  297. package/dist/reservePort.js +69 -0
  298. package/dist/resolvedOptions.js +4 -0
  299. package/dist/room.d.ts +1006 -0
  300. package/dist/room.js +284 -0
  301. package/dist/roomAccessSweep.js +95 -0
  302. package/dist/roomAppCommandControl.js +59 -0
  303. package/dist/roomAuthoringStrategy.js +17 -0
  304. package/dist/roomErasure.js +198 -0
  305. package/dist/roomPoolRuntimeDefaults.js +24 -0
  306. package/dist/roomPoolSelection.js +19 -0
  307. package/dist/roomPoolTopology.js +212 -0
  308. package/dist/rpc.d.ts +551 -0
  309. package/dist/rpc.js +112 -0
  310. package/dist/rpcClient.js +152 -0
  311. package/dist/rpcRoutes.js +28 -0
  312. package/dist/runtime.js +1123 -0
  313. package/dist/schemaHistory.js +98 -0
  314. package/dist/seatStore.js +151 -0
  315. package/dist/seatStrategyFixtures.js +52 -0
  316. package/dist/seatSubject.js +32 -0
  317. package/dist/seats.js +130 -0
  318. package/dist/serverSession.js +811 -0
  319. package/dist/serverSessionConfig.js +43 -0
  320. package/dist/sessionAdmission.js +53 -0
  321. package/dist/sidecarAdmission.js +103 -0
  322. package/dist/sidecarConfig.js +116 -0
  323. package/dist/sidecarConfigPublication.js +64 -0
  324. package/dist/sidecarHostListener.js +208 -0
  325. package/dist/sidecarIpc.js +205 -0
  326. package/dist/sidecarPeer.js +310 -0
  327. package/dist/sidecarProcessPort.js +28 -0
  328. package/dist/sidecarRuntime.js +168 -0
  329. package/dist/sidecarSelection.js +142 -0
  330. package/dist/sidecarWire.js +178 -0
  331. package/dist/sidecarWrites.js +163 -0
  332. package/dist/simulation.d.ts +391 -0
  333. package/dist/simulation.js +282 -0
  334. package/dist/simulationAuthoring.js +29 -0
  335. package/dist/simulationBytes.js +27 -0
  336. package/dist/simulationConformance.js +305 -0
  337. package/dist/simulationInputHistoryCapture.js +35 -0
  338. package/dist/simulationInputHistoryWire.js +193 -0
  339. package/dist/simulationOptionsWire.js +78 -0
  340. package/dist/simulationRecoveryWire.js +134 -0
  341. package/dist/simulationReplay.js +127 -0
  342. package/dist/simulationSnapshotWire.js +112 -0
  343. package/dist/simulationState.js +178 -0
  344. package/dist/snapshotBlob.js +126 -0
  345. package/dist/snapshotBlobCleanup.js +93 -0
  346. package/dist/snapshotBlobIndex.js +38 -0
  347. package/dist/snapshotBudget.js +80 -0
  348. package/dist/snapshotChain.js +185 -0
  349. package/dist/snapshotErasure.js +172 -0
  350. package/dist/snapshotInspection.js +105 -0
  351. package/dist/snapshotSegmentBlobs.js +58 -0
  352. package/dist/snapshotUploads.js +166 -0
  353. package/dist/socketTransport.js +253 -0
  354. package/dist/spatial.js +104 -0
  355. package/dist/spectatorPolicy.js +26 -0
  356. package/dist/spectatorProducer.js +89 -0
  357. package/dist/startFailureCause.js +4 -0
  358. package/dist/stateCodec.js +658 -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 +182 -0
  364. package/dist/streamFraming.js +122 -0
  365. package/dist/streamTransport.js +266 -0
  366. package/dist/subjectAdmission.js +50 -0
  367. package/dist/subjectPrivacy.js +281 -0
  368. package/dist/subjectPrivacyBinding.js +90 -0
  369. package/dist/systemManifest.js +182 -0
  370. package/dist/tables.js +159 -0
  371. package/dist/testHarness.js +89 -0
  372. package/dist/testing.d.ts +3684 -0
  373. package/dist/testing.js +221 -0
  374. package/dist/testingPorts.js +271 -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 +217 -0
  379. package/dist/transform3d.js +118 -0
  380. package/dist/transformCollection.js +24 -0
  381. package/dist/transformCollection3d.js +24 -0
  382. package/dist/transformCollectionCore.js +156 -0
  383. package/dist/transformFrames.js +121 -0
  384. package/dist/transformPrediction3d.js +127 -0
  385. package/dist/transformRules.js +123 -0
  386. package/dist/transformSchemas.js +20 -0
  387. package/dist/transport.js +32 -0
  388. package/dist/transportAuthoring.js +29 -0
  389. package/dist/transportCleanup.js +22 -0
  390. package/dist/transportConformance.js +124 -0
  391. package/dist/transportConnector.js +82 -0
  392. package/dist/transportEndpoints.js +38 -0
  393. package/dist/transportsServer.d.ts +5515 -0
  394. package/dist/transportsServer.js +6 -0
  395. package/dist/viewProjection.js +16 -0
  396. package/dist/web.d.ts +2286 -0
  397. package/dist/web.js +518 -0
  398. package/dist/webTransportClient.js +173 -0
  399. package/dist/wire.d.ts +992 -0
  400. package/dist/wire.js +492 -0
  401. package/dist/withdrawalPort.js +28 -0
  402. package/dist/world.d.ts +1894 -0
  403. package/dist/world.js +333 -0
  404. package/dist/worldActorReceipts.js +48 -0
  405. package/dist/worldActorTransferSnapshot.js +14 -0
  406. package/dist/worldAdmissionPending.js +8 -0
  407. package/dist/worldBoundaryCoordinator.js +148 -0
  408. package/dist/worldCatalog.js +81 -0
  409. package/dist/worldCellAllocation.js +203 -0
  410. package/dist/worldCellDestination.js +68 -0
  411. package/dist/worldCells.js +489 -0
  412. package/dist/worldChange.js +32 -0
  413. package/dist/worldClient.js +664 -0
  414. package/dist/worldClientControl.js +141 -0
  415. package/dist/worldClientPendingInput.js +16 -0
  416. package/dist/worldClientRpc.js +133 -0
  417. package/dist/worldClientRpcRoutes.js +43 -0
  418. package/dist/worldClientSchemas.js +28 -0
  419. package/dist/worldCommands.js +140 -0
  420. package/dist/worldData.js +42 -0
  421. package/dist/worldDefaultBinding.js +377 -0
  422. package/dist/worldDefaultGroupAdmission.js +82 -0
  423. package/dist/worldDefaultGroupAppServices.js +31 -0
  424. package/dist/worldDefaultGroupCompensation.js +109 -0
  425. package/dist/worldDefaultGroupContinuation.js +96 -0
  426. package/dist/worldDefaultGroupControl.js +72 -0
  427. package/dist/worldDefaultGroupMembers.js +85 -0
  428. package/dist/worldDefaultGroups.js +21 -0
  429. package/dist/worldDefaultPending.js +79 -0
  430. package/dist/worldDefaultService.js +245 -0
  431. package/dist/worldEntities.js +2980 -0
  432. package/dist/worldEntityCodec.js +21 -0
  433. package/dist/worldEntityHandoffView.js +154 -0
  434. package/dist/worldGeometry.js +170 -0
  435. package/dist/worldGhostAdmission.js +65 -0
  436. package/dist/worldGhostDestination.js +118 -0
  437. package/dist/worldGhostGateway.js +132 -0
  438. package/dist/worldGhostHandshake.js +108 -0
  439. package/dist/worldGhostHost.js +42 -0
  440. package/dist/worldGhostIngress.js +132 -0
  441. package/dist/worldGhostNeighborhood.js +70 -0
  442. package/dist/worldGhostNeighbors.js +86 -0
  443. package/dist/worldGhostOutbound.js +110 -0
  444. package/dist/worldGhostPublisher.js +216 -0
  445. package/dist/worldGhostReceiver.js +213 -0
  446. package/dist/worldGhostSender.js +146 -0
  447. package/dist/worldGhostSocket.js +78 -0
  448. package/dist/worldGhostWire.js +172 -0
  449. package/dist/worldGroupCommand.js +49 -0
  450. package/dist/worldGroupDeadline.js +115 -0
  451. package/dist/worldGroupPreparation.js +115 -0
  452. package/dist/worldGroupReadyControl.js +128 -0
  453. package/dist/worldGroupSupervisor.js +120 -0
  454. package/dist/worldHandoffMetrics.js +59 -0
  455. package/dist/worldHandoffView.js +100 -0
  456. package/dist/worldHostSource.js +69 -0
  457. package/dist/worldInspectEndpoint.js +250 -0
  458. package/dist/worldInspection.js +109 -0
  459. package/dist/worldInstanceAdmission.js +31 -0
  460. package/dist/worldInstanceAllocation.js +116 -0
  461. package/dist/worldInstanceDestination.js +64 -0
  462. package/dist/worldInstanceExpiry.js +282 -0
  463. package/dist/worldInstanceExpirySupervisor.js +88 -0
  464. package/dist/worldInstanceLifecycle.js +103 -0
  465. package/dist/worldInstanceState.js +52 -0
  466. package/dist/worldInstances.js +478 -0
  467. package/dist/worldJoin.js +56 -0
  468. package/dist/worldLayers.js +151 -0
  469. package/dist/worldLeases.js +78 -0
  470. package/dist/worldManifest.js +25 -0
  471. package/dist/worldMovement.js +63 -0
  472. package/dist/worldPersistence.js +134 -0
  473. package/dist/worldProjection.js +221 -0
  474. package/dist/worldReact.js +110 -0
  475. package/dist/worldRecoveryActor.js +35 -0
  476. package/dist/worldReturnAnchor.js +49 -0
  477. package/dist/worldRoomHooks.js +57 -0
  478. package/dist/worldRoomPool.js +27 -0
  479. package/dist/worldRoomSteps.js +133 -0
  480. package/dist/worldSeatBinding.js +36 -0
  481. package/dist/worldServer.d.ts +6936 -0
  482. package/dist/worldServer.js +48 -0
  483. package/dist/worldSourceSeatPending.js +9 -0
  484. package/dist/worldStrategyFixtures.js +164 -0
  485. package/dist/worldTesting.js +27 -0
  486. package/dist/worldTransitionDefaults.js +198 -0
  487. package/dist/worldTransitionExecutor.js +519 -0
  488. package/dist/worldTransitionGroup.js +113 -0
  489. package/dist/worldTransitionPhysicalSteps.js +40 -0
  490. package/dist/worldTransitionResolver.js +228 -0
  491. package/dist/worldTransitionSeatGroup.js +64 -0
  492. package/dist/worldTransitionSeats.js +260 -0
  493. package/dist/worldTransitionState.js +95 -0
  494. package/dist/worldTransitions.js +101 -0
  495. package/package.json +189 -4
@@ -0,0 +1,82 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { RoomInputCodec as n } from "./stateCodec.js";
3
+ import { geometryOwnData as r } from "./geometryTileCodec.js";
4
+ import { captureGeometryDense as i, captureGeometryOwner as a, captureGeometryPersistenceScope as o, geometryPersistenceId as s, geometryPersistenceInteger as c } from "./geometryPersistenceData.js";
5
+ import { captureGeometryEditIntent as l } from "./geometryEdits.js";
6
+ import { captureGeometryPreparedScope as u } from "./geometryPrepared.js";
7
+ import { GeometryDeltaFragmentSchema as d, createGeometryDeltaFragments as f } from "./geometryChannel.js";
8
+ import { captureRoomSnapshotEffectRunner as p } from "./snapshotBlobIndex.js";
9
+ import { captureRoomReliableChannelWriter as m } from "./serverSession.js";
10
+ import { Effect as h } from "effect";
11
+ //#region src/geometryReliablePublication.ts
12
+ var g = (g) => {
13
+ let _ = r(g, [
14
+ "scope",
15
+ "owner",
16
+ "currentSessions",
17
+ "authorizeRecipient",
18
+ "channel",
19
+ "maxRecipients",
20
+ "maxPatchBytes",
21
+ "maxFragmentDeliveries"
22
+ ], [
23
+ "scope",
24
+ "owner",
25
+ "currentSessions",
26
+ "authorizeRecipient"
27
+ ]), v = u(_.scope), y = a(_.owner), b = Object.hasOwn(_, "channel") ? s(_.channel, 96) : "geometry", x = (e, t, n, r) => Object.hasOwn(_, e) ? c(_[e], n, r) : t, S = x("maxRecipients", 64, 1, 4096), C = x("maxPatchBytes", 262144, 512, 16777216), w = x("maxFragmentDeliveries", 8192, 1, 65536), T = new n(d).schemaHash;
28
+ if (typeof _.currentSessions != "function" || typeof _.authorizeRecipient != "function" || !/^[A-Za-z][A-Za-z0-9._-]*$/.test(b)) throw new t({ detail: "Geometry reliable publication needs actual native recipient and authorization capabilities" });
29
+ let E = _.currentSessions, D = _.authorizeRecipient;
30
+ return (n) => {
31
+ try {
32
+ let a = r(n, [
33
+ "scope",
34
+ "requestId",
35
+ "intent",
36
+ "receipt",
37
+ "patch"
38
+ ]), c = o(a.scope), u = s(a.requestId);
39
+ l(a.intent);
40
+ let d = f(a.receipt, a.patch, { maxPatchBytes: C }), g = d[0].receipt;
41
+ if (c.tenantId !== v.tenantId || c.kind !== v.kind || c.worldId !== v.worldId || c.version !== v.version || c.layerSetId !== v.layerSetId || JSON.stringify(g.scope) !== JSON.stringify(c) || g.requestId !== u) throw new t({ detail: "Geometry reliable publication escaped its exact prepared scope/result" });
42
+ return h.flatMap(h.context(), (n) => h.uninterruptible(h.tryPromise({
43
+ try: async () => {
44
+ let r = p(n), a = /* @__PURE__ */ new Set(), o = i(E(), S, (e) => {
45
+ let n = m(e), r = n.identity();
46
+ if (!r || r.tenantId !== v.tenantId || r.roomId !== y.roomId || r.epoch !== y.epoch || a.has(r.sessionId)) throw new t({ detail: "Geometry publication recipient is not a unique current native owner Session" });
47
+ return a.add(r.sessionId), {
48
+ writer: n,
49
+ evidence: r,
50
+ recipient: Object.freeze({
51
+ tenantId: r.tenantId,
52
+ roomId: r.roomId,
53
+ sessionId: r.sessionId,
54
+ subjectId: r.subjectId,
55
+ epoch: r.epoch
56
+ })
57
+ };
58
+ });
59
+ if (o.length * d.length > w) throw new e({
60
+ budget: "geometryReliableFragmentDeliveries",
61
+ limit: w
62
+ });
63
+ for (let e of o) {
64
+ let n = D(e.recipient, c);
65
+ if (!h.isEffect(n)) throw new t({ detail: "Geometry recipient authorization must be an actual Effect" });
66
+ if (await r(n) !== void 0) throw new t({ detail: "Geometry recipient authorization did not confirm void" });
67
+ if (JSON.stringify(e.writer.identity()) !== JSON.stringify(e.evidence)) throw new t({ detail: "Geometry native recipient changed during authorization" });
68
+ }
69
+ for (let e of o) for (let n of d) {
70
+ if (JSON.stringify(e.writer.identity()) !== JSON.stringify(e.evidence)) throw new t({ detail: "Geometry native recipient changed before reliable handoff" });
71
+ await e.writer.write(b, n, T);
72
+ }
73
+ },
74
+ catch: (n) => n instanceof e ? n : new t({ detail: "Geometry reliable publication remains unconfirmed" })
75
+ })));
76
+ } catch (n) {
77
+ return h.fail(n instanceof e ? n : new t({ detail: "Geometry reliable publication could not capture its exact result" }));
78
+ }
79
+ };
80
+ };
81
+ //#endregion
82
+ export { g as makeGeometryReliablePublication };
@@ -0,0 +1,46 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { geometryOwnData as n } from "./geometryTileCodec.js";
3
+ import { captureRoomGeometryReloadRequest as r } from "./geometryAdminData.js";
4
+ import { captureGeometryVersionActivation as i } from "./geometryActorInventory.js";
5
+ import { Context as a, Effect as o, Layer as s } from "effect";
6
+ //#region src/geometryReloadPorts.ts
7
+ var c = class extends a.Service()("@voltro/RoomGeometryReloadPort") {}, l = (a) => {
8
+ let s = n(a, [
9
+ "authorize",
10
+ "prepare",
11
+ "resume",
12
+ "release"
13
+ ]);
14
+ if (Object.values(s).some((e) => typeof e != "function")) throw new t({ detail: "Host geometry reload requires the complete actual administrative source" });
15
+ let c = s.authorize.bind(a), l = s.prepare.bind(a), u = s.resume.bind(a), d = s.release.bind(a), f = (n) => o.suspend(() => {
16
+ try {
17
+ let r = n();
18
+ return o.isEffect(r) ? r.pipe(o.mapError((n) => n instanceof e ? n : new t({ detail: "Actual geometry reload source remains unconfirmed" }))) : o.fail(new t({ detail: "Geometry reload source must return its actual Effect" }));
19
+ } catch {
20
+ return o.fail(new t({ detail: "Actual geometry reload source refused admission" }));
21
+ }
22
+ }), p = (e) => e === void 0 ? o.void : o.fail(new t({ detail: "Geometry reload source did not confirm void completion" }));
23
+ return Object.freeze({
24
+ authorize: (e, t, n) => {
25
+ let i = r(n);
26
+ return f(() => c(e, t, i)).pipe(o.flatMap(p));
27
+ },
28
+ prepare: (e, n) => {
29
+ let a = r(n);
30
+ return f(() => l(e, a)).pipe(o.flatMap((n) => o.try({
31
+ try: () => i(e.inventory, n),
32
+ catch: () => new t({ detail: "Reload preparation did not return the actual native actor token" })
33
+ })));
34
+ },
35
+ resume: (e, t, n) => {
36
+ let a = r(t), s = i(e.inventory, n);
37
+ return f(() => u(e, a, s)).pipe(o.flatMap(p));
38
+ },
39
+ release: (e, t) => {
40
+ let n = r(t);
41
+ return f(() => d(e, n)).pipe(o.flatMap(p));
42
+ }
43
+ });
44
+ }, u = (e) => s.succeed(c, l(e));
45
+ //#endregion
46
+ export { c as RoomGeometryReloadPort, l as captureRoomGeometryReloadPort, r as captureRoomGeometryReloadRequest, u as roomGeometryReloadLayer };
@@ -0,0 +1,278 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { geometryOwnData as n } from "./geometryTileCodec.js";
3
+ import { captureGeometryArtifact as r } from "./geometryArtifacts.js";
4
+ import { captureGeometryPersistenceScope as i, geometryPersistenceInteger as a } from "./geometryPersistenceData.js";
5
+ import { captureRoomGeometryReloadRequest as o } from "./geometryAdminData.js";
6
+ import { captureGeometryPreparedBaseline as s } from "./geometryPrepared.js";
7
+ import { captureGeometryActorReadFrame as c, captureGeometryVersionActivationDetails as l } from "./geometryActorInventory.js";
8
+ import { captureRoomGeometryReloadPort as u } from "./geometryReloadPorts.js";
9
+ import { captureRoomSnapshotEffectRunner as d } from "./snapshotBlobIndex.js";
10
+ import { geometryPersistenceDigest as f } from "./geometryPersistenceCapture.js";
11
+ import { captureGeometryMigrationRequest as p } from "./geometryMigrations.js";
12
+ import { captureRoomGeometryResourceIdentity as m, captureRoomGeometryResourceState as h } from "./geometryHost.js";
13
+ import { bindGeometryChunkLeases as g } from "./geometryChunkLeases.js";
14
+ import { prepareGeometryVersionActivation as _ } from "./geometryVersionActivation.js";
15
+ import { Effect as v, Option as y } from "effect";
16
+ //#region src/geometryReloadSource.ts
17
+ var b = () => new t({ detail: "Geometry version coordination, SQL preparation or compare-only cleanup remains unconfirmed" }), x = (t) => {
18
+ let g = n(t, [
19
+ "authorize",
20
+ "migrations",
21
+ "persistence",
22
+ "leases",
23
+ "maxChunks",
24
+ "maxAccountedBytes"
25
+ ], [
26
+ "authorize",
27
+ "migrations",
28
+ "persistence",
29
+ "leases"
30
+ ]), x = n(g.migrations, [
31
+ "migrate",
32
+ "exportSubject",
33
+ "eraseSubject"
34
+ ]), S = n(g.persistence, [
35
+ "publish",
36
+ "observe",
37
+ "commit",
38
+ "exportSubject",
39
+ "eraseSubject"
40
+ ]);
41
+ if (typeof g.authorize != "function" || typeof g.leases != "function" || [...Object.values(x), ...Object.values(S)].some((e) => typeof e != "function")) throw b();
42
+ let C = g.migrations, w = g.persistence, T = g.authorize.bind(t), E = g.leases.bind(t), D = Object.freeze({
43
+ migrate: x.migrate.bind(C),
44
+ exportSubject: x.exportSubject.bind(C),
45
+ eraseSubject: x.eraseSubject.bind(C)
46
+ }), O = Object.freeze({
47
+ publish: S.publish.bind(w),
48
+ observe: S.observe.bind(w),
49
+ commit: S.commit.bind(w),
50
+ exportSubject: S.exportSubject.bind(w),
51
+ eraseSubject: S.eraseSubject.bind(w)
52
+ }), k = Object.hasOwn(g, "maxChunks") ? a(g.maxChunks, 1, 65536) : void 0, A = Object.hasOwn(g, "maxAccountedBytes") ? a(g.maxAccountedBytes, 512) : void 0, j = /* @__PURE__ */ new WeakMap(), M = async (e, t) => {
53
+ let n = t();
54
+ if (!v.isEffect(n)) throw b();
55
+ return e(n);
56
+ }, N = (t) => v.flatMap(v.context(), (n) => v.uninterruptible(v.tryPromise({
57
+ try: () => t(d(n)),
58
+ catch: (t) => t instanceof e ? t : b()
59
+ }))), P = (e, t) => {
60
+ m(e);
61
+ let n = o(t), r = j.get(e);
62
+ if (r) {
63
+ if (JSON.stringify(r.request) !== JSON.stringify(n) || r.active) throw b();
64
+ return r;
65
+ }
66
+ let i = {
67
+ resource: e,
68
+ request: n,
69
+ held: [],
70
+ active: !1
71
+ };
72
+ return j.set(e, i), i;
73
+ }, F = async (e, t) => {
74
+ let n = [];
75
+ for (let r of [...t.held].reverse()) try {
76
+ if (typeof await M(e, () => r.lease.release()) != "boolean") throw b();
77
+ t.held.splice(t.held.indexOf(r), 1);
78
+ } catch (e) {
79
+ n.push(e);
80
+ }
81
+ if (n.length) throw b();
82
+ }, I = async (e, t) => {
83
+ for (let n of t.held) if (await M(e, () => n.lease.renew()) !== !0) throw b();
84
+ }, L = async (e, t, r) => {
85
+ await F(e, t);
86
+ let i = await M(e, () => E(t.resource)), a = n(i, ["tenantId", "acquire"]);
87
+ if (a.tenantId !== t.resource.scope.tenantId || typeof a.acquire != "function") throw b();
88
+ let o = a.acquire.bind(i);
89
+ for (let i of [...r].sort((e, t) => {
90
+ let n = JSON.stringify([
91
+ e.cx,
92
+ e.cy,
93
+ e.cz ?? null
94
+ ]), r = JSON.stringify([
95
+ t.cx,
96
+ t.cy,
97
+ t.cz ?? null
98
+ ]);
99
+ return n < r ? -1 : +(n > r);
100
+ })) {
101
+ let r = await M(e, () => o(i));
102
+ if (y.isNone(r)) throw b();
103
+ let a = y.getOrThrow(r), s = n(a, ["renew", "release"]);
104
+ if (typeof s.renew != "function" || typeof s.release != "function") throw b();
105
+ t.held.push({
106
+ scope: i,
107
+ lease: Object.freeze({
108
+ renew: s.renew.bind(a),
109
+ release: s.release.bind(a)
110
+ })
111
+ }), await I(e, t);
112
+ }
113
+ }, R = (e) => Object.freeze({
114
+ roomId: e.scope.roomId,
115
+ hostId: e.scope.hostId,
116
+ epoch: e.scope.epoch
117
+ });
118
+ return u({
119
+ authorize: (e, t, n) => (h(t), T(e, t, n)),
120
+ prepare: (t, n) => {
121
+ let r = P(h(t), n);
122
+ return N(async (n) => {
123
+ if (r.active) throw b();
124
+ r.active = !0;
125
+ try {
126
+ await t.quiesce();
127
+ let o = c(t.inventory), s = k === void 0 ? t.world.geometry.budgets.maxPreparedChunks : a(k, 1, t.world.geometry.budgets.maxPreparedChunks);
128
+ if (A !== void 0 && a(A, 512, t.world.geometry.budgets.maxPreparedBytes), o.entries.length > s) throw new e({
129
+ budget: "geometryReloadLeaseChunks",
130
+ limit: s
131
+ });
132
+ await L(n, r, o.entries.map((e) => i({
133
+ ...o.scope,
134
+ ...e.scope
135
+ })));
136
+ let l = (e) => N(async (t) => {
137
+ await I(t, r);
138
+ let n = await M(t, e);
139
+ return await I(t, r), n;
140
+ }), u = {
141
+ ...D,
142
+ migrate: (e) => l(() => D.migrate(e))
143
+ }, d = {
144
+ ...O,
145
+ observe: (e) => l(() => O.observe(e))
146
+ }, f = await M(n, () => _(t.inventory, t.world, {
147
+ ...r.request,
148
+ owner: R(t)
149
+ }, {
150
+ migrations: u,
151
+ persistence: d,
152
+ quiesce: () => v.sync(() => {
153
+ if (c(t.inventory) !== o) throw b();
154
+ }),
155
+ ...k === void 0 ? {} : { maxChunks: k },
156
+ ...A === void 0 ? {} : { maxAccountedBytes: A }
157
+ }));
158
+ return await I(n, r), f;
159
+ } finally {
160
+ r.active = !1;
161
+ }
162
+ });
163
+ },
164
+ resume: (t, o, c) => {
165
+ let u = P(h(t), o);
166
+ return N(async (o) => {
167
+ if (u.active) throw b();
168
+ u.active = !0;
169
+ try {
170
+ await t.quiesce();
171
+ let d = l(t.inventory, c), m = R(t);
172
+ if (d.after.scope.version !== u.request.version || c.receipts.length !== d.before.entries.length) throw b();
173
+ let h = k === void 0 ? t.world.geometry.budgets.maxPreparedChunks : a(k, 1, t.world.geometry.budgets.maxPreparedChunks);
174
+ if (A !== void 0 && a(A, 512, t.world.geometry.budgets.maxPreparedBytes), d.before.entries.length > h) throw new e({
175
+ budget: "geometryReloadLeaseChunks",
176
+ limit: h
177
+ });
178
+ for (let e of d.before.entries) {
179
+ let t = s(d.before, {
180
+ cx: e.scope.cx,
181
+ cy: e.scope.cy,
182
+ ...e.scope.cz === void 0 ? {} : { cz: e.scope.cz }
183
+ }), n = i({
184
+ ...t.scope,
185
+ version: u.request.version
186
+ }), r = p({
187
+ from: t.scope,
188
+ to: n,
189
+ owner: m,
190
+ expectedRevision: t.revision,
191
+ requestId: u.request.requestId + "." + f(JSON.stringify([
192
+ t.scope.cx,
193
+ t.scope.cy,
194
+ t.scope.cz ?? null
195
+ ]))
196
+ }), a = c.receipts.find((e) => JSON.stringify(e.from) === JSON.stringify(t.scope));
197
+ if (!a || a.inputSha256 !== f(JSON.stringify(r)) || a.requestKey !== f(JSON.stringify([t.scope.tenantId, r.requestId]))) throw b();
198
+ }
199
+ await L(o, u, d.before.entries.map((e) => i({
200
+ ...d.before.scope,
201
+ ...e.scope
202
+ })));
203
+ for (let e of [d.before, d.after]) for (let t of e.entries) {
204
+ await I(o, u);
205
+ let s = i({
206
+ ...e.scope,
207
+ ...t.scope
208
+ }), c = n(await M(o, () => O.observe(s)), [
209
+ "scope",
210
+ "revision",
211
+ "artifact"
212
+ ]), l = Object.freeze({
213
+ scope: i(c.scope),
214
+ revision: a(c.revision),
215
+ artifact: r(c.artifact)
216
+ });
217
+ if (JSON.stringify(l.scope) !== JSON.stringify(s) || l.revision !== t.revision || l.artifact.blobSha256 !== t.blobSha256 || l.artifact.contentSha256 !== t.contentSha256) throw b();
218
+ await I(o, u);
219
+ }
220
+ l(t.inventory, c);
221
+ } finally {
222
+ u.active = !1;
223
+ }
224
+ });
225
+ },
226
+ release: (e, t) => {
227
+ m(e);
228
+ let n = o(t), r = j.get(e);
229
+ return r ? JSON.stringify(r.request) === JSON.stringify(n) ? N(async (t) => {
230
+ if (r.active) throw b();
231
+ r.active = !0;
232
+ try {
233
+ await F(t, r), j.delete(e);
234
+ } finally {
235
+ r.active = !1;
236
+ }
237
+ }) : v.fail(b()) : v.void;
238
+ }
239
+ });
240
+ }, S = (e, t) => {
241
+ let r = n(t, [
242
+ "authorize",
243
+ "migrations",
244
+ "persistence",
245
+ "namespace",
246
+ "ttlMs",
247
+ "maxChunks",
248
+ "maxAccountedBytes"
249
+ ], [
250
+ "authorize",
251
+ "migrations",
252
+ "persistence",
253
+ "namespace",
254
+ "ttlMs"
255
+ ]), i = Object.getOwnPropertyDescriptor(e, "connectionRegistry"), o = Object.getOwnPropertyDescriptor(e, "hotStore");
256
+ if (!i?.enumerable || !("value" in i) || !i.value || !o?.enumerable || !("value" in o) || typeof o.value != "function" || typeof r.namespace != "string") throw b();
257
+ let s = Object.freeze({
258
+ connectionRegistry: i.value,
259
+ hotStore: o.value.bind(e)
260
+ }), c = r.namespace, l = a(r.ttlMs, 1);
261
+ return x({
262
+ authorize: r.authorize,
263
+ migrations: r.migrations,
264
+ persistence: r.persistence,
265
+ ...Object.hasOwn(r, "maxChunks") ? { maxChunks: a(r.maxChunks, 1, 65536) } : {},
266
+ ...Object.hasOwn(r, "maxAccountedBytes") ? { maxAccountedBytes: a(r.maxAccountedBytes, 512) } : {},
267
+ leases: (e) => v.tryPromise({
268
+ try: () => g(s, {
269
+ namespace: c,
270
+ tenantId: e.scope.tenantId,
271
+ ttlMs: l
272
+ }),
273
+ catch: () => b()
274
+ })
275
+ });
276
+ };
277
+ //#endregion
278
+ export { S as bindRoomGeometryReloadSource, x as makeRoomGeometryReloadSource };
@@ -0,0 +1,165 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { geometryOwnData as n } from "./geometryTileCodec.js";
3
+ import { createGeometryHeightfieldCodec as r } from "./geometryHeightfield.js";
4
+ import { captureGeometryArtifact as i } from "./geometryArtifacts.js";
5
+ import { captureGeometryDense as a, geometryPersistenceInteger as o } from "./geometryPersistenceData.js";
6
+ import { captureGeometryPreparedCoordinate as s } from "./geometryPrepared.js";
7
+ import { geometryClientFieldsAtDistance as c } from "./geometryClientInterest.js";
8
+ import { geometryChunkHasWorldExtent as l } from "./geometryWorldExtent.js";
9
+ import { captureOwnedRoomGeometryChunkCache as u, captureRoomGeometryChunkCacheArtifact as d, captureRoomGeometryChunkCacheRoot as f } from "./geometryClientChunks.js";
10
+ import { prepareGeometryRenderLod as p } from "./geometryRenderLod.js";
11
+ import { captureWorldCatalog as m } from "./world.js";
12
+ //#region src/geometryRenderCache.ts
13
+ var h = () => new t({ detail: "Geometry render cache requires its fresh native content, current admission and complete bounded projection" }), g = (e = {}) => {
14
+ let t = n(e, [
15
+ "maxEntries",
16
+ "maxEncodedBytes",
17
+ "maxConcurrent",
18
+ "lod",
19
+ "strategies"
20
+ ], []), i = {};
21
+ if (Object.hasOwn(t, "maxEntries") && (i.maxEntries = o(t.maxEntries, 1, 65536)), Object.hasOwn(t, "maxEncodedBytes") && (i.maxEncodedBytes = o(t.maxEncodedBytes, 512)), Object.hasOwn(t, "maxConcurrent") && (i.maxConcurrent = o(t.maxConcurrent, 1, 256)), Object.hasOwn(t, "lod")) {
22
+ let e = n(t.lod, [
23
+ "maxStride",
24
+ "maxSamples",
25
+ "codecLimits",
26
+ "strategies"
27
+ ], []), a = {};
28
+ if (Object.hasOwn(e, "maxStride") && (a.maxStride = o(e.maxStride, 1, 1024)), Object.hasOwn(e, "maxSamples") && (a.maxSamples = o(e.maxSamples, 4, 1050625)), Object.hasOwn(e, "codecLimits") && (a.codecLimits = r(n(e.codecLimits, [
29
+ "maxSide",
30
+ "maxSamples",
31
+ "maxBytes"
32
+ ], [])).limits), Object.hasOwn(e, "strategies")) {
33
+ let t = n(e.strategies, ["sampleStride"], []);
34
+ if (Object.hasOwn(t, "sampleStride") && typeof t.sampleStride != "function") throw h();
35
+ a.strategies = Object.freeze({ ...t });
36
+ }
37
+ i.lod = Object.freeze(a);
38
+ }
39
+ if (Object.hasOwn(t, "strategies")) {
40
+ let e = n(t.strategies, ["prepare"], []);
41
+ if (Object.hasOwn(e, "prepare") && typeof e.prepare != "function") throw h();
42
+ i.strategies = Object.freeze({ ...e });
43
+ }
44
+ return Object.freeze(i);
45
+ }, _ = (t, r, _ = {}) => {
46
+ let v = u(t), y = m([r])[0], b = f(v), x = y.geometry, S = g(_);
47
+ if (!x || x.kind !== b.kind || y.name !== b.worldId) throw h();
48
+ let C = S.maxEntries === void 0 ? Math.min(64, x.streaming.client.maxCachedChunks) : o(S.maxEntries, 1, x.streaming.client.maxCachedChunks), w = S.maxEncodedBytes === void 0 ? x.budgets.maxPreparedBytes : o(S.maxEncodedBytes, 512, x.budgets.maxPreparedBytes), T = S.maxConcurrent ?? 4, E = S.strategies?.prepare ?? p, D = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), k = !1, A = () => [...D.values()].reduce((e, t) => e + t.encodedBytes, 0), j = (e, t) => {
49
+ if (k) throw h();
50
+ let n = s(b, e), r = Object.freeze({
51
+ cx: n.cx,
52
+ cy: n.cy,
53
+ ...n.cz === void 0 ? {} : { cz: n.cz }
54
+ }), i = o(t, 0, 2147483647), a = d(v, r), l = c(y, i);
55
+ return {
56
+ coordinate: r,
57
+ distance: i,
58
+ artifact: a,
59
+ fields: l,
60
+ key: JSON.stringify([
61
+ n.cx,
62
+ n.cy,
63
+ n.cz ?? null,
64
+ a.blobSha256,
65
+ l,
66
+ S.strategies?.prepare ? i : null
67
+ ])
68
+ };
69
+ }, M = (t, r, s) => {
70
+ let c = n(t, [
71
+ "fields",
72
+ "sampleStride",
73
+ "sourceBlobSha256",
74
+ "sourceContentSha256",
75
+ "artifact",
76
+ "coarseArtifact"
77
+ ], [
78
+ "fields",
79
+ "sampleStride",
80
+ "sourceBlobSha256",
81
+ "sourceContentSha256",
82
+ "artifact"
83
+ ]), u = a(c.fields, 4, (e) => typeof e == "string" ? e : (() => {
84
+ throw h();
85
+ })()), d = i(c.artifact), f = Object.hasOwn(c, "coarseArtifact") ? i(c.coarseArtifact) : void 0, p = o(c.sampleStride, 1, 1024), m = !s.includes("heightsCoarse") || s.includes("heights");
86
+ if (!s.includes("heightsCoarse") && (f !== void 0 || p !== 1) || JSON.stringify(u) !== JSON.stringify(s) || c.sourceBlobSha256 !== r.blobSha256 || c.sourceContentSha256 !== r.contentSha256 || m && d.blobSha256 !== r.blobSha256 || s.includes("heights") && s.includes("heightsCoarse") && !f) throw h();
87
+ for (let e of [d, ...f ? [f] : []]) if (e.chunk.kind !== b.kind || e.chunk.version !== b.version || JSON.stringify(e.chunk.address) !== JSON.stringify(r.chunk.address) || !l(e, x.chunkSizeRaw)) throw h();
88
+ if (r.chunk.kind === "2d-heightfield" && s.includes("heightsCoarse")) {
89
+ let e = s.includes("heights") ? f : d;
90
+ if (e.chunk.kind !== "2d-heightfield") throw h();
91
+ let t = r.chunk, n = e.chunk;
92
+ if ((t.width - 1) % p != 0 || (t.height - 1) % p != 0 || n.width !== (t.width - 1) / p + 1 || n.height !== (t.height - 1) / p + 1 || n.sampleSpacingRaw !== t.sampleSpacingRaw * p || n.baseHeightRaw !== t.baseHeightRaw || n.heightQuantumRaw !== t.heightQuantumRaw) throw h();
93
+ for (let e = 0; e < n.height; e++) for (let r = 0; r < n.width; r++) if (n.heights[e * n.width + r] !== t.heights[e * p * t.width + r * p]) throw h();
94
+ }
95
+ let g = Object.freeze({
96
+ fields: u,
97
+ sampleStride: p,
98
+ sourceBlobSha256: r.blobSha256,
99
+ sourceContentSha256: r.contentSha256,
100
+ artifact: d,
101
+ ...f ? { coarseArtifact: f } : {}
102
+ }), _ = [.../* @__PURE__ */ new Set([d, ...f ? [f] : []])].reduce((e, t) => e + t.bytes().byteLength, 0);
103
+ if (_ > w) throw new e({
104
+ budget: "geometryRenderCacheEncodedBytes",
105
+ limit: w
106
+ });
107
+ return Object.freeze({
108
+ value: g,
109
+ encodedBytes: _
110
+ });
111
+ };
112
+ return Object.freeze({
113
+ at: (e, t) => {
114
+ let n = j(e, t), r = D.get(n.key);
115
+ if (!r) throw h();
116
+ return D.delete(n.key), D.set(n.key, r), r.value;
117
+ },
118
+ prepare: (t, n) => {
119
+ try {
120
+ let r = j(t, n), i = D.get(r.key);
121
+ if (i) return D.delete(r.key), D.set(r.key, i), Promise.resolve(i.value);
122
+ let a = O.get(r.key);
123
+ if (a) return a;
124
+ if (O.size >= T) throw new e({
125
+ budget: "geometryRenderCacheJobs",
126
+ limit: T
127
+ });
128
+ let o = Promise.resolve().then(async () => {
129
+ if (k) throw h();
130
+ let e = E(y, r.artifact, r.distance, S.lod ?? {});
131
+ if (!(e instanceof Promise)) throw h();
132
+ let t = M(await e, r.artifact, r.fields);
133
+ if (k || d(v, r.coordinate).blobSha256 !== r.artifact.blobSha256) throw h();
134
+ for (; D.size >= C || A() + t.encodedBytes > w;) {
135
+ let e = D.keys().next().value;
136
+ if (e === void 0) throw h();
137
+ D.delete(e);
138
+ }
139
+ return D.set(r.key, t), t.value;
140
+ }).catch((t) => {
141
+ throw t instanceof e ? t : h();
142
+ });
143
+ return O.set(r.key, o), o.then(() => {
144
+ O.delete(r.key);
145
+ }, () => {
146
+ O.delete(r.key);
147
+ }), o;
148
+ } catch (t) {
149
+ return Promise.reject(t instanceof e ? t : h());
150
+ }
151
+ },
152
+ observation: () => Object.freeze({
153
+ entries: D.size,
154
+ encodedBytes: A(),
155
+ jobs: O.size,
156
+ closed: k,
157
+ withdrawn: v.observation().withdrawn
158
+ }),
159
+ close: async () => {
160
+ k = !0, D.clear(), await Promise.allSettled([...O.values()]);
161
+ }
162
+ });
163
+ };
164
+ //#endregion
165
+ export { g as captureGeometryRenderLodCacheOptions, _ as makeGeometryRenderLodCache };
@@ -0,0 +1,102 @@
1
+ import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
2
+ import { geometryOwnData as n } from "./geometryTileCodec.js";
3
+ import { createGeometryHeightfieldCodec as r } from "./geometryHeightfield.js";
4
+ import { captureGeometryArtifact as i, createGeometryArtifact as a } from "./geometryArtifacts.js";
5
+ import { geometryPersistenceInteger as o } from "./geometryPersistenceData.js";
6
+ import { geometryClientFieldsAtDistance as s } from "./geometryClientInterest.js";
7
+ import { geometryChunkHasWorldExtent as c } from "./geometryWorldExtent.js";
8
+ import { captureWorldCatalog as l } from "./world.js";
9
+ //#region src/geometryRenderLod.ts
10
+ var u = () => new t({ detail: "Native geometry LOD requires exact admitted content, World extent and bounded pure sample selection" }), d = (e, t) => {
11
+ let r = n(e, [
12
+ "kind",
13
+ "formatVersion",
14
+ "address",
15
+ "version",
16
+ "width",
17
+ "height",
18
+ "sampleSpacingRaw",
19
+ "baseHeightRaw",
20
+ "heightQuantumRaw",
21
+ "heights"
22
+ ]), i = o(t, 1, 1024), a = o(r.width, 2, 1025), s = o(r.height, 2, 1025);
23
+ if (r.kind !== "2d-heightfield" || r.formatVersion !== 1) throw u();
24
+ for (let e = Math.min(i, a - 1, s - 1); e >= 1; e--) if ((a - 1) % e == 0 && (s - 1) % e == 0) return e;
25
+ throw u();
26
+ }, f = async (t, s = {}) => {
27
+ let c = i(t), l = n(s, [
28
+ "maxStride",
29
+ "maxSamples",
30
+ "codecLimits",
31
+ "strategies"
32
+ ], []);
33
+ if (c.chunk.kind !== "2d-heightfield") throw u();
34
+ let f = Object.hasOwn(l, "codecLimits") ? n(l.codecLimits, [
35
+ "maxSide",
36
+ "maxSamples",
37
+ "maxBytes"
38
+ ], []) : {}, p = r(f), m = p.capture(c.chunk), h = Object.hasOwn(l, "maxStride") ? o(l.maxStride, 1, 1024) : 4, g = Object.hasOwn(l, "maxSamples") ? o(l.maxSamples, 4, p.limits.maxSamples) : p.limits.maxSamples, _ = Object.hasOwn(l, "strategies") ? n(l.strategies, ["sampleStride"], []) : {}, v = Object.hasOwn(_, "sampleStride") ? _.sampleStride : d;
39
+ if (typeof v != "function") throw u();
40
+ let y;
41
+ try {
42
+ y = v(m, h);
43
+ } catch {
44
+ throw u();
45
+ }
46
+ if (y instanceof Promise) throw y.catch(() => void 0), u();
47
+ let b = o(y, 1, h);
48
+ if ((m.width - 1) % b != 0 || (m.height - 1) % b != 0) throw u();
49
+ let x = (m.width - 1) / b + 1, S = (m.height - 1) / b + 1;
50
+ if (x * S > g) throw new e({
51
+ budget: "geometryRenderLodSamples",
52
+ limit: g
53
+ });
54
+ if (b === 1) return Object.freeze({
55
+ fields: Object.freeze(["heightsCoarse"]),
56
+ sampleStride: 1,
57
+ sourceBlobSha256: c.blobSha256,
58
+ sourceContentSha256: c.contentSha256,
59
+ artifact: c
60
+ });
61
+ let C = [];
62
+ for (let e = 0; e < m.height; e += b) for (let t = 0; t < m.width; t += b) C.push(m.heights[e * m.width + t]);
63
+ let w = p.capture({
64
+ ...m,
65
+ width: x,
66
+ height: S,
67
+ sampleSpacingRaw: o(m.sampleSpacingRaw * b, 1, 2147483647),
68
+ heights: C
69
+ }), T = await a(w, p.limits);
70
+ return Object.freeze({
71
+ fields: Object.freeze(["heightsCoarse"]),
72
+ sampleStride: b,
73
+ sourceBlobSha256: c.blobSha256,
74
+ sourceContentSha256: c.contentSha256,
75
+ artifact: T
76
+ });
77
+ }, p = async (e, t, n, r = {}) => {
78
+ let a = l([e])[0], o = i(t), d = a.geometry, p = s(a, n);
79
+ if (!d || o.chunk.address.worldId !== a.name || o.chunk.kind !== d.kind || !c(o, d.chunkSizeRaw)) throw u();
80
+ if (p.includes("heightsCoarse")) {
81
+ let e = await f(o, r);
82
+ if (!c(e.artifact, d.chunkSizeRaw)) throw u();
83
+ return p.includes("heights") ? Object.freeze({
84
+ ...e,
85
+ fields: p,
86
+ artifact: o,
87
+ coarseArtifact: e.artifact
88
+ }) : Object.freeze({
89
+ ...e,
90
+ fields: p
91
+ });
92
+ }
93
+ return Object.freeze({
94
+ fields: p,
95
+ sampleStride: 1,
96
+ sourceBlobSha256: o.blobSha256,
97
+ sourceContentSha256: o.contentSha256,
98
+ artifact: o
99
+ });
100
+ };
101
+ //#endregion
102
+ export { d as defaultGeometryHeightfieldLodStride, f as prepareGeometryHeightfieldLod, p as prepareGeometryRenderLod };