@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,119 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { captureWorldData as t } from "./worldData.js";
3
+ import { captureWorldGroupCommandReceipt as n } from "./worldGroupCommand.js";
4
+ import { worldTransitionGroupFromRecords as r } from "./worldTransitionGroup.js";
5
+ import { Effect as i, Result as a } from "effect";
6
+ // src/worldGroupSupervisor.ts
7
+ function o() {
8
+ throw new e({ detail: "World group supervisor requires complete bounded actual providers" });
9
+ }
10
+ var s = (e, t) => {
11
+ e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype && Reflect.ownKeys(e).length === t.length || o();
12
+ for (let n of Reflect.ownKeys(e)) {
13
+ let r = Object.getOwnPropertyDescriptor(e, n);
14
+ typeof n == "string" && t.includes(n) && r?.enumerable && "value" in r || o();
15
+ }
16
+ }, c = (e, t) => {
17
+ let n = Object.getOwnPropertyDescriptor(e, t);
18
+ return !n || !("value" in n) || typeof n.value != "function" ? o() : n.value.bind(e);
19
+ }, l = (t) => i.suspend(() => {
20
+ let n = t();
21
+ return i.isEffect(n) ? n : i.fail(new e({ detail: "World group supervisor requires an actual Effect" }));
22
+ }).pipe(i.catchCause(() => i.fail(new e({ detail: "World group continuation remains incomplete" })))), u = (u) => {
23
+ s(u, [
24
+ "tenantId",
25
+ "maxCommands",
26
+ "maxMembers",
27
+ "maxPageBytes",
28
+ "epochNow",
29
+ "states",
30
+ "preparation",
31
+ "deadline",
32
+ "authorize"
33
+ ]);
34
+ let { tenantId: d, maxCommands: f, maxMembers: p, maxPageBytes: m } = u;
35
+ (typeof d != "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:-]*$/.test(d) || d.length > 191 || ![
36
+ f,
37
+ p,
38
+ m
39
+ ].every((e) => Number.isSafeInteger(e) && e > 0)) && o();
40
+ let h = c(u, "epochNow"), g = c(u.states, "scanGroupCommands"), _ = c(u.states, "acknowledgeGroupCommand"), v = c(u.preparation, "prepare"), y = c(u.deadline, "advance"), b = c(u, "authorize"), x = null, S = !1, C = (e, t) => {
41
+ if (!e || typeof e != "object" || Object.getPrototypeOf(e) !== Object.prototype) return o();
42
+ let n = Object.getOwnPropertyDescriptor(e, t);
43
+ return n?.enumerable && "value" in n ? n.value : o();
44
+ }, w = (e) => {
45
+ s(e, ["groups", "nextCursor"]), (!Array.isArray(e.groups) || e.groups.length > f) && o();
46
+ let i = e.groups.map((e) => (s(e, ["command", "records"]), (!Array.isArray(e.records) || !e.records.length || e.records.length > p) && o(), {
47
+ command: n(e.command),
48
+ records: e.records.map((e) => ({
49
+ origin: C(e, "origin"),
50
+ subject: C(e, "subject"),
51
+ group: C(e, "group"),
52
+ revision: C(e, "revision"),
53
+ command: n(C(e, "groupCommand"))
54
+ }))
55
+ })), a = t({
56
+ groups: i,
57
+ nextCursor: e.nextCursor
58
+ }, m);
59
+ a.nextCursor !== null && (!/^[a-f0-9]{64}$/.test(a.nextCursor) || x !== null && a.nextCursor <= x) && o();
60
+ let c = /* @__PURE__ */ new Set();
61
+ for (let e of a.groups) {
62
+ (e.command.origin.tenantId !== d || !r(e.records) || e.records.some((t) => t.origin.tenantId !== d || JSON.stringify(t.command) !== JSON.stringify(e.command))) && o();
63
+ let t = JSON.stringify(e.command.origin);
64
+ c.has(t) && o(), c.add(t);
65
+ }
66
+ return a;
67
+ };
68
+ return Object.freeze({ runDue: () => i.suspend(() => S ? i.fail(new e({ detail: "World group supervisor cannot overlap its bounded page" })) : (S = !0, l(() => i.gen(function* () {
69
+ let t = w(yield* l(() => g({
70
+ tenantId: d,
71
+ limit: f,
72
+ ...x === null ? {} : { after: x }
73
+ })));
74
+ x = t.nextCursor;
75
+ let n = 0, s = 0, c = 0;
76
+ for (let e of t.groups) {
77
+ let t = yield* i.result(l(() => i.gen(function* () {
78
+ yield* l(() => b(e.command));
79
+ let t = (t) => l(() => i.gen(function* () {
80
+ if (![
81
+ "waiting",
82
+ "settled",
83
+ "rolledBack"
84
+ ].includes(t.state)) return o();
85
+ let n = w({
86
+ groups: [t.group],
87
+ nextCursor: null
88
+ }).groups[0];
89
+ return JSON.stringify(n.command) !== JSON.stringify(e.command) || JSON.stringify(r(n.records)) !== JSON.stringify(r(e.records)) ? o() : t.state === "waiting" ? "waiting" : (yield* l(() => _({
90
+ origin: n.command.origin,
91
+ members: n.records.map((e) => ({
92
+ origin: e.origin,
93
+ expectedRevision: e.revision
94
+ }))
95
+ })), "completed");
96
+ })), n = h();
97
+ if (!Number.isSafeInteger(n) || n < 0) return o();
98
+ if (!(e.command.intent.onTimeout === "cancel" && n >= e.command.waitUntil)) {
99
+ let n = yield* i.result(l(() => v(e.command.intent, e.command.origin)));
100
+ if (a.isFailure(n)) {
101
+ let r = yield* l(() => y(e.command.intent, e.command.origin));
102
+ return r.state === "waiting" ? yield* i.fail(n.failure) : yield* t(r);
103
+ }
104
+ }
105
+ return yield* t(yield* l(() => y(e.command.intent, e.command.origin)));
106
+ })));
107
+ a.isFailure(t) ? c++ : t.success === "waiting" ? n++ : s++;
108
+ }
109
+ return c ? yield* i.fail(new e({ detail: `World group page retains ${c} failed command continuations` })) : Object.freeze({
110
+ visited: t.groups.length,
111
+ waiting: n,
112
+ completed: s,
113
+ nextCursor: x
114
+ });
115
+ })).pipe(i.ensuring(i.sync(() => {
116
+ S = !1;
117
+ }))))) });
118
+ };
119
+ export { u as makeWorldGroupSupervisor };
@@ -0,0 +1,58 @@
1
+ import { captureWorldData as e } from "./worldData.js";
2
+ // src/worldHandoffMetrics.ts
3
+ var t = Object.freeze([
4
+ 10,
5
+ 50,
6
+ 100,
7
+ 250,
8
+ 500,
9
+ 1e3,
10
+ 2500,
11
+ 5e3,
12
+ 1e4,
13
+ 3e4,
14
+ 6e4
15
+ ]), n = () => {
16
+ let e = ["settled", "rolledBack"].map((e) => ({
17
+ result: e,
18
+ count: 0,
19
+ durationMs: 0,
20
+ buckets: t.map(() => 0)
21
+ })), n = !0;
22
+ return Object.freeze({
23
+ observe: (r) => {
24
+ if (!n || r.mode !== "seamless" || r.phase !== "settled" && r.phase !== "rolledBack") return;
25
+ let i = e[r.phase === "settled" ? 0 : 1], a = r.updatedAt - r.createdAt;
26
+ if (!Number.isSafeInteger(r.createdAt) || r.createdAt < 0 || !Number.isSafeInteger(r.updatedAt) || !Number.isSafeInteger(a) || a < 0 || i.count === 2 ** 53 - 1 || i.durationMs > 2 ** 53 - 1 - a) n = !1;
27
+ else {
28
+ i.count++, i.durationMs += a;
29
+ for (let e = 0; e < t.length; e++) a <= t[e] && i.buckets[e]++;
30
+ }
31
+ },
32
+ snapshot: () => n ? Object.freeze({
33
+ scope: "acknowledged-source-lifetime",
34
+ results: Object.freeze(e.map((e) => Object.freeze({
35
+ ...e,
36
+ buckets: Object.freeze([...e.buckets])
37
+ })))
38
+ }) : null
39
+ });
40
+ }, r = (n) => {
41
+ if (n == null) return null;
42
+ try {
43
+ let r = e(n, 4096);
44
+ if (r.scope !== "acknowledged-source-lifetime" || Object.keys(r).sort().join(",") !== "results,scope" || !Array.isArray(r.results) || r.results.length !== 2) return null;
45
+ for (let e = 0; e < 2; e++) {
46
+ let n = r.results[e];
47
+ if (!n || n.result !== (e === 0 ? "settled" : "rolledBack") || Object.keys(n).sort().join(",") !== "buckets,count,durationMs,result" || !Number.isSafeInteger(n.count) || n.count < 0 || !Number.isSafeInteger(n.durationMs) || n.durationMs < 0 || n.count === 0 && n.durationMs !== 0 || !Array.isArray(n.buckets) || n.buckets.length !== t.length) return null;
48
+ for (let e = 0; e < n.buckets.length; e++) {
49
+ let t = n.buckets[e];
50
+ if (!Number.isSafeInteger(t) || t < (n.buckets[e - 1] ?? 0) || t > n.count) return null;
51
+ }
52
+ }
53
+ return r;
54
+ } catch {
55
+ return null;
56
+ }
57
+ };
58
+ export { r as captureWorldHandoffMetrics, n as makeWorldHandoffMetrics, t as worldHandoffDurationBuckets };
@@ -0,0 +1,99 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ import { simulationOwnData as t } from "./simulationAuthoring.js";
3
+ import { captureWorldData as n } from "./worldData.js";
4
+ import { WorldClientRequestIdSchema as r } from "./worldClientSchemas.js";
5
+ import { Result as i, Schema as a } from "effect";
6
+ // src/worldHandoffView.ts
7
+ var o = () => new e({ detail: "World handoff presentation requires bounded actual delivered snapshots" }), s = (e) => {
8
+ let s = [
9
+ "maxBytes",
10
+ "maxHoldMs",
11
+ "now",
12
+ "contains"
13
+ ];
14
+ t(e, s, s);
15
+ let { maxBytes: c, maxHoldMs: l } = e;
16
+ if (!Number.isSafeInteger(c) || c < 1 || c > 16777216 || !Number.isSafeInteger(l) || l < 1 || l > 3e5 || typeof e.now != "function" || typeof e.contains != "function") throw o();
17
+ let u = e.now.bind(e), d = e.contains.bind(e), f = -1, p, m = () => {
18
+ let e = u();
19
+ if (!Number.isSafeInteger(e) || e < 0 || e < f || e > 2 ** 53 - 1 - l) throw o();
20
+ return f = e, e;
21
+ }, h = (e) => {
22
+ let t = n(e, c);
23
+ if (Object.keys(t).sort().join(",") !== "epoch,receivedAt,state,tick" || !Number.isSafeInteger(t.epoch) || t.epoch < 1 || !Number.isSafeInteger(t.tick) || t.tick < 0 || !Number.isFinite(t.receivedAt) || t.receivedAt < 0) throw o();
24
+ return t;
25
+ }, g = (e, t) => {
26
+ let n = d(e.state, t);
27
+ if (n instanceof Promise && n.catch(() => void 0), typeof n != "boolean") throw o();
28
+ return n;
29
+ }, _ = () => (p && m() >= p.expiresAt && (p = void 0), p);
30
+ return Object.freeze({
31
+ begin: (e, t, n) => {
32
+ if (_() || i.isFailure(a.decodeUnknownResult(r)(e)) || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(t)) throw o();
33
+ let s = h(n);
34
+ if (!g(s, t)) throw o();
35
+ p = {
36
+ requestId: e,
37
+ entityId: t,
38
+ snapshot: s,
39
+ expiresAt: m() + l,
40
+ enabled: !1,
41
+ committed: !1
42
+ };
43
+ },
44
+ prepare: (e, t) => {
45
+ if (e === "portal") {
46
+ p = void 0;
47
+ return;
48
+ }
49
+ if (e !== "seamless") throw o();
50
+ let r = _();
51
+ if (!r) return;
52
+ let i = n(t, 1024);
53
+ if (Object.keys(i).sort().join(",") !== "epoch,roomId" || typeof i.roomId != "string" || !i.roomId || i.roomId.length > 191 || !Number.isSafeInteger(i.epoch) || i.epoch < 1 || r.target && (r.target.roomId !== i.roomId || r.target.epoch !== i.epoch)) throw o();
54
+ r.enabled = !0, r.target = i;
55
+ },
56
+ source: (e) => {
57
+ let t = _();
58
+ if (!t || t.committed || !e) return;
59
+ let n = h(e);
60
+ if (n.epoch !== t.snapshot.epoch || n.tick < t.snapshot.tick) throw o();
61
+ g(n, t.entityId) && (t.snapshot = n);
62
+ },
63
+ commit: () => {
64
+ let e = _();
65
+ e?.enabled && (e.committed = !0);
66
+ },
67
+ rollback: () => {
68
+ p = void 0;
69
+ },
70
+ read: (e, t) => {
71
+ let n = _(), r = t === null ? null : h(t);
72
+ return n?.enabled ? r && (!n.committed || e === n.target?.roomId && r.epoch === n.target.epoch) && g(r, n.entityId) ? (n.committed && e === n.target?.roomId && r.epoch === n.target.epoch && (p = void 0), Object.freeze({
73
+ snapshot: r,
74
+ handoff: !1
75
+ })) : Object.freeze({
76
+ snapshot: n.snapshot,
77
+ handoff: !0,
78
+ requestId: n.requestId,
79
+ entityId: n.entityId
80
+ }) : r === null ? null : Object.freeze({
81
+ snapshot: r,
82
+ handoff: !1
83
+ });
84
+ },
85
+ observation: () => {
86
+ let e = _();
87
+ return Object.freeze({
88
+ retained: e !== void 0,
89
+ enabled: e?.enabled ?? !1,
90
+ committed: e?.committed ?? !1,
91
+ expiresAt: e?.expiresAt ?? null
92
+ });
93
+ },
94
+ close: () => {
95
+ p = void 0;
96
+ }
97
+ });
98
+ };
99
+ export { s as makeWorldHandoffView };
@@ -0,0 +1,68 @@
1
+ import { ProtocolError as e } from "./errors.js";
2
+ // src/worldHostSource.ts
3
+ var t = (t) => {
4
+ let n = () => {
5
+ throw new e({ detail: "World Host source requires own recovery and optional transition observation capabilities" });
6
+ };
7
+ t && typeof t == "object" || n();
8
+ let r = Object.getOwnPropertyDescriptor(t, "handoffMetrics");
9
+ (r && (!("value" in r) || typeof r.value != "function") || !r && "handoffMetrics" in t) && n();
10
+ let i = Object.getOwnPropertyDescriptor(t, "recoverRoom");
11
+ i && "value" in i && typeof i.value == "function" || n();
12
+ let a = Object.getOwnPropertyDescriptor(t, "admitActorNeighbor");
13
+ (a && (!("value" in a) || typeof a.value != "function") || !a && "admitActorNeighbor" in t) && n();
14
+ let o = Object.getOwnPropertyDescriptor(t, "admitActorProjection");
15
+ (o && (!("value" in o) || typeof o.value != "function") || !o && "admitActorProjection" in t) && n();
16
+ let s = Object.getOwnPropertyDescriptor(t, "admitActorPlayer");
17
+ (s && (!("value" in s) || typeof s.value != "function") || !s && "admitActorPlayer" in t) && n();
18
+ let c = Object.getOwnPropertyDescriptor(t, "transitions");
19
+ (c && !("value" in c) || !c && "transitions" in t) && n();
20
+ let l;
21
+ if (c?.value !== void 0) {
22
+ let e = c.value;
23
+ e && typeof e == "object" || n();
24
+ let t = Object.getOwnPropertyDescriptor(e, "observe");
25
+ t && "value" in t && typeof t.value == "function" || n();
26
+ let r = Object.getOwnPropertyDescriptor(e, "scanSourceTransitions");
27
+ (r && (!("value" in r) || typeof r.value != "function") || !r && "scanSourceTransitions" in e) && n();
28
+ let i = Object.getOwnPropertyDescriptor(e, "retainActorSnapshot");
29
+ (i && (!("value" in i) || typeof i.value != "function") || !i && "retainActorSnapshot" in e) && n();
30
+ let a = Object.getOwnPropertyDescriptor(e, "retainActorDeparture");
31
+ (a && (!("value" in a) || typeof a.value != "function") || !a && "retainActorDeparture" in e) && n();
32
+ let o = Object.getOwnPropertyDescriptor(e, "finalizeActorSnapshot");
33
+ (o && (!("value" in o) || typeof o.value != "function") || !o && "finalizeActorSnapshot" in e) && n();
34
+ let s = Object.getOwnPropertyDescriptor(e, "admitActorSeat");
35
+ (s && (!("value" in s) || typeof s.value != "function") || !s && "admitActorSeat" in e) && n();
36
+ let u = Object.getOwnPropertyDescriptor(e, "admitActorGhost");
37
+ (u && (!("value" in u) || typeof u.value != "function") || !u && "admitActorGhost" in e) && n();
38
+ let d = Object.getOwnPropertyDescriptor(e, "admitActorTarget");
39
+ (d && (!("value" in d) || typeof d.value != "function") || !d && "admitActorTarget" in e) && n();
40
+ let f = Object.getOwnPropertyDescriptor(e, "admitActorSource");
41
+ (f && (!("value" in f) || typeof f.value != "function") || !f && "admitActorSource" in e) && n();
42
+ let p = Object.getOwnPropertyDescriptor(e, "admitActorSourceRecovery");
43
+ (p && (!("value" in p) || typeof p.value != "function") || !p && "admitActorSourceRecovery" in e) && n();
44
+ let m = Object.getOwnPropertyDescriptor(e, "observeActorReceipt");
45
+ (m && (!("value" in m) || typeof m.value != "function") || !m && "observeActorReceipt" in e) && n(), l = Object.freeze({
46
+ ...r ? { scanSourceTransitions: r.value.bind(e) } : {},
47
+ ...u ? { admitActorGhost: u.value.bind(e) } : {},
48
+ ...a ? { retainActorDeparture: a.value.bind(e) } : {},
49
+ ...o ? { finalizeActorSnapshot: o.value.bind(e) } : {},
50
+ ...s ? { admitActorSeat: s.value.bind(e) } : {},
51
+ ...m ? { observeActorReceipt: m.value.bind(e) } : {},
52
+ ...p ? { admitActorSourceRecovery: p.value.bind(e) } : {},
53
+ ...f ? { admitActorSource: f.value.bind(e) } : {},
54
+ ...d ? { admitActorTarget: d.value.bind(e) } : {},
55
+ ...i ? { retainActorSnapshot: i.value.bind(e) } : {},
56
+ observe: t.value.bind(e)
57
+ });
58
+ }
59
+ return Object.freeze({
60
+ ...r ? { handoffMetrics: r.value.bind(t) } : {},
61
+ ...a ? { admitActorNeighbor: a.value.bind(t) } : {},
62
+ ...o ? { admitActorProjection: o.value.bind(t) } : {},
63
+ ...s ? { admitActorPlayer: s.value.bind(t) } : {},
64
+ recoverRoom: i.value.bind(t),
65
+ ...l ? { transitions: l } : {}
66
+ });
67
+ };
68
+ export { t as captureRoomWorldEntitySource };
@@ -0,0 +1,249 @@
1
+ import { defaultWorldLayerPolicy as e } from "./worldLayers.js";
2
+ import { defaultWorldOnWorldChange as t } from "./worldChange.js";
3
+ import { defaultWorldTransitionPolicy as n } from "./worldTransitions.js";
4
+ import { decodeWorldInspection as r } from "./worldInspection.js";
5
+ import { ROOMS_TABLE as i, WORLD_TRANSITIONS_TABLE as a } from "./identities.js";
6
+ import { captureWorldCatalog as o, worldCellAt as s } from "./world.js";
7
+ import { WORLD_CELLS_TABLE as c } from "./worldCells.js";
8
+ import { and as l, eq as u, gt as d, or as f } from "@voltro/database";
9
+ import { Effect as p, Result as m } from "effect";
10
+ import { parseReplicaSelection as h } from "@voltro/protocol/inspect";
11
+ // src/worldInspectEndpoint.ts
12
+ var g = (e) => {
13
+ if (typeof e != "string" || e.length === 0 || e.length > 191 || e.trim() !== e) throw Error("Invalid World inspection identity");
14
+ return e;
15
+ }, _ = (e, t = 0) => {
16
+ if (typeof e != "number" || !Number.isSafeInteger(e) || e < t) throw Error("Invalid World inspection counter");
17
+ return e;
18
+ }, v = (e) => {
19
+ let t = e instanceof Date ? e : typeof e == "string" ? new Date(e) : null;
20
+ if (t === null || !Number.isFinite(t.getTime())) throw Error("Invalid World observation timestamp");
21
+ return t.toISOString();
22
+ }, y = (y, b, x = y.worldState) => {
23
+ let S = o(b), C = y.worldClientControls;
24
+ return {
25
+ method: "GET",
26
+ path: "/worlds",
27
+ scope: "shared-store",
28
+ description: "Configured World geometry and paged redacted SQL routing observations",
29
+ handler: (o) => p.gen(function* () {
30
+ let b = yield* p.result(p.try({
31
+ try: () => {
32
+ let e = new URL(o.url, "http://inspect.local").searchParams;
33
+ h(e), e.delete("replica"), e.delete("replicas");
34
+ for (let t of e.keys()) if (![
35
+ "tenantId",
36
+ "worldId",
37
+ "after",
38
+ "transitionsAfter"
39
+ ].includes(t) || e.getAll(t).length !== 1) throw Error("Invalid World inspection query");
40
+ let t = g(e.get("tenantId")), n = e.has("worldId") ? g(e.get("worldId")) : null, r = e.has("after") ? g(e.get("after")) : null, i = e.has("transitionsAfter") ? g(e.get("transitionsAfter")) : null;
41
+ if (n === null && (r !== null || i !== null) || i !== null && x !== "transitions" || n !== null && !S.some((e) => e.name === n)) throw Error("Invalid configured World selection");
42
+ return {
43
+ tenantId: t,
44
+ worldId: n,
45
+ after: r,
46
+ transitionsAfter: i
47
+ };
48
+ },
49
+ catch: () => "Invalid query"
50
+ }));
51
+ if (m.isFailure(b)) return {
52
+ kind: "json",
53
+ status: 400,
54
+ data: { error: "World inspection requires one tenantId and a configured worldId before a cursor" }
55
+ };
56
+ let w = b.success, T = S.map((e) => e.name);
57
+ if (w.worldId === null) return {
58
+ kind: "json",
59
+ data: r({
60
+ worldState: x,
61
+ worldClientControls: C,
62
+ catalog: T,
63
+ page: {
64
+ ...w,
65
+ nextAfter: null
66
+ },
67
+ world: null,
68
+ cells: [],
69
+ transitions: null
70
+ })
71
+ };
72
+ let E = S.find((e) => e.name === w.worldId), D = yield* p.result(y.inspect(async (o) => {
73
+ if (E.zones.length > 256) throw Error("World geometry exceeds inspection budget");
74
+ let p = await o.query({
75
+ table: c,
76
+ predicate: l(u("tenantId", w.tenantId), u("worldId", E.name), ...w.after === null ? [] : [d("id", w.after)]),
77
+ order: [{
78
+ column: "id",
79
+ direction: "asc"
80
+ }],
81
+ take: 51,
82
+ skip: void 0,
83
+ projection: [
84
+ "id",
85
+ "tenantId",
86
+ "worldId",
87
+ "zoneId",
88
+ "cellId",
89
+ "layer",
90
+ "roomId",
91
+ "hostId",
92
+ "epoch",
93
+ "revision",
94
+ "players",
95
+ "state",
96
+ "updatedAt"
97
+ ]
98
+ });
99
+ if (p.length > 51 || new Set(p.map((e) => e.id)).size !== p.length || p.some((e, t) => e.tenantId !== w.tenantId || e.worldId !== E.name || w.after !== null && g(e.id) <= w.after || t > 0 && g(p[t - 1].id) >= g(e.id))) throw Error("World inspection scope/order mismatch");
100
+ let m = p.slice(0, 50), h = [...new Set(m.map((e) => g(e.roomId)))], y = h.length === 0 ? [] : await o.query({
101
+ table: i,
102
+ predicate: l(u("tenantId", w.tenantId), f(...h.map((e) => u("id", e)))),
103
+ order: [],
104
+ take: h.length + 1,
105
+ skip: void 0,
106
+ projection: [
107
+ "id",
108
+ "tenantId",
109
+ "name",
110
+ "hostId",
111
+ "epoch",
112
+ "clients",
113
+ "maxClients",
114
+ "state"
115
+ ]
116
+ });
117
+ if (y.length > h.length || new Set(y.map((e) => e.id)).size !== y.length || y.some((e) => e.tenantId !== w.tenantId || !h.includes(g(e.id)))) throw Error("World referenced Room scope mismatch");
118
+ let b = m.map((e) => {
119
+ let t = E.zones.find((t) => t.id === e.zoneId);
120
+ if (!t) throw Error("Unknown stored World zone");
121
+ let n = g(e.cellId).split(":"), r = Number(n[1]), i = Number(n[2]), a = t.cells?.size ?? Math.max(t.bounds[1][0] - t.bounds[0][0], t.bounds[1][1] - t.bounds[0][1]);
122
+ if (n.length !== 3 || n[0] !== t.id || !Number.isSafeInteger(r) || r < 0 || String(r) !== n[1] || !Number.isSafeInteger(i) || i < 0 || String(i) !== n[2]) throw Error("Invalid stored World cell");
123
+ let o = s(E, {
124
+ zone: t.id,
125
+ at: [t.bounds[0][0] + r * a, t.bounds[0][1] + i * a]
126
+ }), c = _(e.players), l = _(e.epoch, 1), u = e.state, d = e.hostId, f = y.find((t) => t.id === e.roomId);
127
+ if (o.id !== e.cellId || u !== "creating" && u !== "live" && u !== "hibernated" || u === "hibernated" && (d !== null || c !== 0) || u === "creating" && l === 1 && c !== 0 || (u === "live" || u === "creating") && (d === null || g(d).length === 0)) throw Error("Invalid stored World routing observation");
128
+ let p = f !== void 0 && f.name === t.room && f.hostId === d && f.epoch === l && f.clients === c && f.state === u && c <= _(f.maxClients, 1) && (t.layering === void 0 || t.layering.maxPlayers === f.maxClients);
129
+ return {
130
+ id: g(e.id),
131
+ zoneId: t.id,
132
+ cellId: o.id,
133
+ layer: _(e.layer, 1),
134
+ bounds: o.bounds,
135
+ players: c,
136
+ epoch: l,
137
+ revision: _(e.revision, 1),
138
+ state: u,
139
+ roomObservation: f === void 0 ? "missing" : p ? "matching" : "stale",
140
+ updatedAt: v(e.updatedAt)
141
+ };
142
+ }), D = null;
143
+ if (x === "transitions") {
144
+ let e = await o.query({
145
+ table: a,
146
+ predicate: l(u("tenantId", w.tenantId), f(u("sourceWorldId", E.name), u("targetWorldId", E.name)), ...w.transitionsAfter === null ? [] : [d("id", w.transitionsAfter)]),
147
+ order: [{
148
+ column: "id",
149
+ direction: "asc"
150
+ }],
151
+ take: 51,
152
+ skip: void 0,
153
+ projection: [
154
+ "id",
155
+ "tenantId",
156
+ "sourceWorldId",
157
+ "targetWorldId",
158
+ "source",
159
+ "target",
160
+ "mode",
161
+ "phase",
162
+ "revision",
163
+ "entityRevision",
164
+ "createdAt",
165
+ "updatedAt",
166
+ "committedAt"
167
+ ]
168
+ });
169
+ if (e.length > 51 || new Set(e.map((e) => e.id)).size !== e.length || e.some((t, n) => t.tenantId !== w.tenantId || t.sourceWorldId !== E.name && t.targetWorldId !== E.name || w.transitionsAfter !== null && g(t.id) <= w.transitionsAfter || n > 0 && g(e[n - 1].id) >= g(t.id))) throw Error("World transition inspection escaped its page scope");
170
+ let t = (e, t) => {
171
+ if (!e || typeof e != "object" || Object.getPrototypeOf(e) !== Object.prototype) throw Error("Invalid recorded transition location");
172
+ for (let t of Reflect.ownKeys(e)) {
173
+ let n = Object.getOwnPropertyDescriptor(e, t);
174
+ if (typeof t != "string" || ![
175
+ "worldId",
176
+ "zoneId",
177
+ "at",
178
+ "layer",
179
+ "roomId",
180
+ "epoch"
181
+ ].includes(t) || !n?.enumerable || !("value" in n)) throw Error("Invalid transition location field");
182
+ }
183
+ let n = e, r = S.find((e) => e.name === n.worldId);
184
+ if (!r || n.worldId !== t) throw Error("Unconfigured transition location");
185
+ let i = s(r, {
186
+ zone: g(n.zoneId),
187
+ at: n.at
188
+ });
189
+ return g(n.roomId), _(n.epoch, 1), {
190
+ worldId: r.name,
191
+ zoneId: g(n.zoneId),
192
+ cellId: i.id,
193
+ layer: _(n.layer, 1)
194
+ };
195
+ }, n = e.slice(0, 50).map((e) => ({
196
+ id: g(e.id),
197
+ mode: e.mode,
198
+ phase: e.phase,
199
+ revision: _(e.revision, 1),
200
+ entityRevision: _(e.entityRevision, 1),
201
+ source: t(e.source, e.sourceWorldId),
202
+ target: t(e.target, e.targetWorldId),
203
+ createdAt: v(e.createdAt),
204
+ updatedAt: v(e.updatedAt),
205
+ committedAt: e.committedAt === null ? null : v(e.committedAt)
206
+ }));
207
+ D = {
208
+ after: w.transitionsAfter,
209
+ nextAfter: e.length > 50 ? n.at(-1).id : null,
210
+ entries: n
211
+ };
212
+ }
213
+ return r({
214
+ worldState: x,
215
+ worldClientControls: C,
216
+ transitions: D,
217
+ catalog: T,
218
+ page: {
219
+ ...w,
220
+ nextAfter: p.length > 50 ? b.at(-1).id : null
221
+ },
222
+ world: {
223
+ id: E.name,
224
+ bounds: E.map.bounds,
225
+ zones: E.zones.map((e) => ({
226
+ id: e.id,
227
+ bounds: e.bounds,
228
+ cellSize: e.cells?.size ?? null,
229
+ maxPlayers: e.layering?.maxPlayers ?? null
230
+ })),
231
+ layerPolicy: E.strategies.layerPolicy === e ? "default" : "custom",
232
+ transitionPolicy: E.strategies.transitionPolicy === n ? "default" : "custom",
233
+ worldChangePolicy: E.strategies.onWorldChange === t ? "default" : "custom"
234
+ },
235
+ cells: b
236
+ });
237
+ }));
238
+ return m.isFailure(D) ? {
239
+ kind: "json",
240
+ status: 503,
241
+ data: { error: "World SQL inspection is unavailable. Load it again." }
242
+ } : {
243
+ kind: "json",
244
+ data: D.success
245
+ };
246
+ })
247
+ };
248
+ };
249
+ export { y as roomsWorldInspectEndpoint };