@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
package/dist/web.d.ts ADDED
@@ -0,0 +1,2286 @@
1
+ import { Duration } from 'effect';
2
+ import { QueryProcedureDescriptor } from '@voltro/protocol';
3
+ import { Result } from 'effect';
4
+ import { Schema } from 'effect';
5
+ import { YieldableError } from 'effect/Cause';
6
+
7
+ /** Configuration consumers never invoke a player callback. Its player type
8
+ * stays author-owned; this inventory type does not erase it into an input. */
9
+ declare type AnyWorldDescriptor = WorldDescriptor<never>;
10
+
11
+ declare class BudgetExceeded extends BudgetExceeded_base {
12
+ get message(): string;
13
+ }
14
+
15
+ declare const BudgetExceeded_base: Schema.Class<BudgetExceeded, Schema.TaggedStruct<"BudgetExceeded", {
16
+ readonly budget: Schema.String;
17
+ readonly limit: Schema.Number;
18
+ }>, YieldableError>;
19
+
20
+ export declare const captureRoomClientReliableChannel: (offered: unknown, channel: string, schemaHash: number) => Readonly<{
21
+ identity: () => {
22
+ readonly sessionId: string;
23
+ readonly epoch: number;
24
+ } | null;
25
+ onMessage: (listener: (payload: unknown) => void) => (() => void);
26
+ subscribe: (listener: () => void) => (() => void);
27
+ }>;
28
+
29
+ export declare const captureRoomClientReliableIntention: (offered: unknown, channel: string, schemaHash: number) => Readonly<{
30
+ identity: () => {
31
+ readonly sessionId: string;
32
+ readonly epoch: number;
33
+ } | null;
34
+ write: (payload: unknown) => Promise<void>;
35
+ }>;
36
+
37
+ export declare const captureRoomTransportEndpoints: (offered: RoomTransportEndpoints) => RoomTransportEndpoints;
38
+
39
+ export declare const createRoom: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>>(client: RoomRpcCaller, manifest: RoomWireManifest<S, I>, input: {
40
+ readonly room: string;
41
+ readonly options: unknown;
42
+ readonly pool?: string | undefined;
43
+ }, options: RoomClientOptions) => Promise<RoomConnection<S, I, {
44
+ readonly mode: "join" | "create";
45
+ readonly room: string;
46
+ readonly options: unknown;
47
+ readonly pool?: string | undefined;
48
+ } | {
49
+ readonly mode: "joinById";
50
+ readonly roomId: string;
51
+ readonly role?: "spectator" | "player" | undefined;
52
+ }>>;
53
+
54
+ /** Framework-free client composition using the actual platform binary socket.
55
+ * The API facade supplies normal reserve/resume RPC methods; the token remains
56
+ * inside the connection and is transmitted only in the binary Hello. */
57
+ export declare const createRoomClient: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, JoinInput>(manifest: RoomWireManifest<S, I>, reservations: RoomReservationClient<JoinInput>, options: RoomClientOptions) => RoomConnection<S, I, JoinInput>;
58
+
59
+ /** Initial clock convergence and steady keepalive use one owned timeout. */
60
+ export declare const defaultRoomClockPingCadence: RoomClockPingCadence;
61
+
62
+ export declare const defaultRoomClockSampling: Readonly<RoomClockSamplingOptions>;
63
+
64
+ export declare const defaultRoomInputRedundancy: Readonly<RoomInputRedundancyOptions>;
65
+
66
+ /** Default policy is used by the orchestrator and can be composed/overridden. */
67
+ export declare const defaultRoomReconnectPolicy: RoomReconnectPolicy;
68
+
69
+ /** Uses the platform WebSocket, never an RPC socket or persistent credentials. */
70
+ export declare const defaultRoomWebSocketFactory: RoomWebSocketFactory;
71
+
72
+ /** Native TLS verification remains enabled. A development certificate is only
73
+ * ever pinned by its advertised digest (`serverCertificateHashes`), never
74
+ * bypassed. No credential URL, bearer header/query, global polyfill or eager
75
+ * socket on module import. */
76
+ export declare const defaultRoomWebTransportFactory: RoomWebTransportFactory;
77
+
78
+ /** One current reliable-stream envelope: four-byte unsigned big-endian length,
79
+ * then the existing Room wire frame. Datagram frames remain unprefixed. */
80
+ export declare const encodeRoomStreamFrame: (offered: Uint8Array, maxFrameBytes: number) => Uint8Array;
81
+
82
+ declare interface GeometryArtifact<C extends GeometryChunk = GeometryChunk> {
83
+ readonly chunk: C;
84
+ readonly blobSha256: string;
85
+ /** Canonical declared content/layout, excluding actual address/version only. */
86
+ readonly contentSha256: string;
87
+ bytes(): Uint8Array;
88
+ }
89
+
90
+ declare type GeometryArtifactLimits<K extends GeometryKind> = K extends '2d-tiles' ? Partial<GeometryTileLimits> : K extends '2d-heightfield' ? Partial<GeometryHeightfieldLimits> : K extends '3d-shapes' ? Partial<GeometryShapesLimits> : Partial<GeometryVoxelLimits>;
91
+
92
+ declare interface GeometryAssetBundle {
93
+ readonly root: GeometryAssetRoot;
94
+ preload(signal: AbortSignal): Promise<void>;
95
+ at(key: string): GeometryVerifiedAsset;
96
+ observation(): {
97
+ readonly totalAssets: number;
98
+ readonly totalBytes: number;
99
+ readonly loadedAssets: number;
100
+ readonly loadedBytes: number;
101
+ readonly active: boolean;
102
+ readonly ready: boolean;
103
+ readonly closed: boolean;
104
+ };
105
+ /** Abort/join this bundle's actual accepted work only. Shared byte-cache and
106
+ * earlier detached aliases remain owned by their actual external lifetimes. */
107
+ close(): Promise<void>;
108
+ }
109
+
110
+ declare interface GeometryAssetRoot {
111
+ readonly tenantId: string;
112
+ readonly worldId: string;
113
+ readonly layerSetId: string;
114
+ readonly version: string;
115
+ }
116
+
117
+ declare type GeometryChunk = GeometryTileChunk | GeometryHeightfieldChunk | GeometryShapesChunk | GeometryVoxelChunk;
118
+
119
+ declare interface GeometryClientInterest {
120
+ readonly scope: GeometryPreparedScope;
121
+ readonly center: GeometryPreparedCoordinate;
122
+ readonly radiusChunks: number;
123
+ readonly prefetchChunks: number;
124
+ readonly visitedCoordinates: number;
125
+ readonly omittedPrefetch: number;
126
+ readonly chunks: ReadonlyArray<GeometryClientInterestEntry>;
127
+ }
128
+
129
+ declare interface GeometryClientInterestEntry {
130
+ readonly coordinate: GeometryPreparedCoordinate;
131
+ readonly distanceChunks: number;
132
+ readonly role: 'visible' | 'prefetch';
133
+ /** Declared render-field selection only. Native collision snapshots remain
134
+ * whole; this does not invent a coarse encoder/download/asset format. */
135
+ readonly fields: ReadonlyArray<string>;
136
+ }
137
+
138
+ declare interface GeometryClientInterestOptions {
139
+ readonly maxChunks?: number | undefined;
140
+ readonly maxVisitedCoordinates?: number;
141
+ /** Actual render Transform velocity in raw units/second, never server authority. */
142
+ readonly velocity?: GeometryWorldPointRaw | undefined;
143
+ }
144
+
145
+ declare type GeometryCollisionDerive = (context: GeometryDerivationContext) => GeometryChunk;
146
+
147
+ declare type GeometryCompaction = (context: GeometryCompactionContext) => GeometryPatch;
148
+
149
+ /** Genuine immutable native artifacts only. Compaction preserves the current
150
+ * truth; it cannot authorize a different edit, owner, revision or SQL write. */
151
+ declare interface GeometryCompactionContext {
152
+ readonly static: GeometryArtifact;
153
+ readonly current: GeometryArtifact;
154
+ readonly limits: GeometryPatchLimits;
155
+ readonly codecLimits: GeometryArtifactLimits<GeometryKind>;
156
+ }
157
+
158
+ declare interface GeometryCompactionStrategies {
159
+ readonly compaction: GeometryCompaction;
160
+ }
161
+
162
+ declare interface GeometryDeltaMigrationFrom {
163
+ readonly static: GeometryArtifact;
164
+ readonly current: GeometryArtifact;
165
+ readonly revision: number;
166
+ }
167
+
168
+ declare interface GeometryDeltaMigrationTo {
169
+ readonly static: GeometryArtifact;
170
+ }
171
+
172
+ /** Outside-Tick native data only. No query callback, provider, actor, Store or
173
+ * authority capability is accepted as a derivation result. */
174
+ declare interface GeometryDerivationContext {
175
+ readonly chunk: GeometryChunk;
176
+ readonly codecLimits: GeometryArtifactLimits<GeometryKind>;
177
+ }
178
+
179
+ declare interface GeometryDerivationStrategies {
180
+ readonly collisionDerive: GeometryCollisionDerive;
181
+ readonly navDerive: GeometryNavDerive;
182
+ }
183
+
184
+ /** Trusted server snapshot. Never derive these rights, positions, budgets or
185
+ * catalogs from the intent body. App policy must recheck authority at commit. */
186
+ declare interface GeometryEditAuthority {
187
+ readonly dynamicEnabled: boolean;
188
+ readonly ownsChunk: boolean;
189
+ readonly canBuild: boolean;
190
+ readonly cooldownReady: boolean;
191
+ readonly remainingOps: number;
192
+ readonly maxReachRaw: number;
193
+ readonly maxHeightUnits: number;
194
+ readonly position: {
195
+ readonly xRaw: number;
196
+ readonly yRaw: number;
197
+ readonly zRaw: number;
198
+ };
199
+ readonly materials: ReadonlyArray<GeometryTileMaterial>;
200
+ readonly shapes: ReadonlyArray<GeometryShapeTemplate>;
201
+ }
202
+
203
+ declare interface GeometryEditContext {
204
+ readonly chunk: GeometryChunk;
205
+ readonly intent: GeometryEditIntent;
206
+ readonly authority: GeometryEditAuthority;
207
+ readonly placementId: string;
208
+ readonly codecLimits?: GeometryArtifactLimits<GeometryKind> | undefined;
209
+ }
210
+
211
+ /** Player requests an action and its target, never solidity, shape dimensions,
212
+ * an authoritative player position, revision, owner, full chunk or Delta bytes. */
213
+ declare type GeometryEditIntent = {
214
+ readonly op: 'setTile';
215
+ readonly x: number;
216
+ readonly y: number;
217
+ readonly material: string;
218
+ } | {
219
+ readonly op: 'raiseHeight';
220
+ readonly x: number;
221
+ readonly y: number;
222
+ readonly units: number;
223
+ } | {
224
+ readonly op: 'setVoxel';
225
+ readonly x: number;
226
+ readonly y: number;
227
+ readonly z: number;
228
+ readonly material: string;
229
+ } | {
230
+ readonly op: 'placeShape';
231
+ readonly template: string;
232
+ readonly xRaw: number;
233
+ readonly yRaw: number;
234
+ readonly zRaw: number;
235
+ } | {
236
+ readonly op: 'removeShape';
237
+ readonly id: string;
238
+ };
239
+
240
+ declare interface GeometryEditStrategies {
241
+ /** Pure policy slot. Current native Session/SQL ownership and codec integrity cannot be overridden by this slot. */
242
+ readonly opValidator: (context: GeometryEditContext) => void;
243
+ /** Pure rule slot; returned chunk is admitted under the original identity/layout/profile. */
244
+ readonly applyOp: (context: GeometryEditContext) => GeometryChunk;
245
+ }
246
+
247
+ declare type GeometryGenerator = (context: GeometryProceduralContext) => GeometryChunk;
248
+
249
+ declare type GeometryHeightfieldChunk = (typeof GeometryHeightfieldChunkSchema)["Type"];
250
+
251
+ declare const GeometryHeightfieldChunkSchema: Schema.Struct<{
252
+ readonly kind: Schema.Literal<"2d-heightfield">;
253
+ readonly formatVersion: Schema.Literal<1>;
254
+ readonly address: Schema.Struct<{
255
+ readonly worldId: Schema.String;
256
+ readonly layerSetId: Schema.String;
257
+ readonly cx: Schema.Int;
258
+ readonly cy: Schema.Int;
259
+ }>;
260
+ readonly version: Schema.String;
261
+ readonly width: Schema.Int;
262
+ readonly height: Schema.Int;
263
+ readonly sampleSpacingRaw: Schema.Int;
264
+ readonly baseHeightRaw: Schema.Int;
265
+ readonly heightQuantumRaw: Schema.Int;
266
+ readonly heights: Schema.$Array<Schema.Int>;
267
+ }>;
268
+
269
+ declare interface GeometryHeightfieldLimits {
270
+ readonly maxSide: number;
271
+ readonly maxSamples: number;
272
+ readonly maxBytes: number;
273
+ }
274
+
275
+ declare interface GeometryHeightfieldLodOptions {
276
+ readonly maxStride?: number;
277
+ readonly maxSamples?: number | undefined;
278
+ readonly codecLimits?: Partial<GeometryHeightfieldLimits> | undefined;
279
+ readonly strategies?: {
280
+ readonly sampleStride?: GeometryHeightfieldLodStride;
281
+ } | undefined;
282
+ }
283
+
284
+ declare type GeometryHeightfieldLodStride = (chunk: GeometryHeightfieldChunk, maxStride: number) => number;
285
+
286
+ declare interface GeometryHeightfieldView {
287
+ readonly chunk: GeometryHeightfieldChunk;
288
+ heightAtSample(x: number, y: number): number;
289
+ heightAtRaw(xRaw: number, yRaw: number): number;
290
+ }
291
+
292
+ declare type GeometryKind = GeometryChunk['kind'];
293
+
294
+ /** Pure native data rule only; no SQL, actor, journal, permission or Subject. */
295
+ declare type GeometryMigrateDelta = (from: GeometryDeltaMigrationFrom, to: GeometryDeltaMigrationTo) => GeometryChunk | null;
296
+
297
+ declare type GeometryNavDerive = (context: GeometryDerivationContext) => GeometryTileChunk | null;
298
+
299
+ declare interface GeometryPatch {
300
+ readonly metadata: GeometryPatchMetadata;
301
+ bytes(): Uint8Array;
302
+ }
303
+
304
+ declare interface GeometryPatchLimits {
305
+ readonly maxBytes: number;
306
+ readonly maxMetadataBytes: number;
307
+ }
308
+
309
+ declare type GeometryPatchMetadata = (typeof GeometryPatchMetadataSchema)["Type"];
310
+
311
+ declare const GeometryPatchMetadataSchema: Schema.Struct<{
312
+ readonly kind: Schema.Literals<readonly ["2d-tiles", "2d-heightfield", "3d-shapes", "3d-voxel"]>;
313
+ readonly formatVersion: Schema.Literal<1>;
314
+ readonly worldId: Schema.String;
315
+ readonly layerSetId: Schema.String;
316
+ readonly cx: Schema.Int;
317
+ readonly cy: Schema.Int;
318
+ readonly cz: Schema.optional<Schema.Int>;
319
+ readonly version: Schema.String;
320
+ readonly baseRevision: Schema.Int;
321
+ readonly revision: Schema.Int;
322
+ readonly baseBlobSha256: Schema.String;
323
+ readonly blobSha256: Schema.String;
324
+ readonly baseContentSha256: Schema.String;
325
+ readonly contentSha256: Schema.String;
326
+ readonly changed: Schema.Boolean;
327
+ readonly stateSchemaHash: Schema.Int;
328
+ }>;
329
+
330
+ declare interface GeometryPersistenceScope {
331
+ readonly tenantId: string;
332
+ readonly kind: GeometryKind;
333
+ readonly worldId: string;
334
+ readonly version: string;
335
+ readonly layerSetId: string;
336
+ readonly cx: number;
337
+ readonly cy: number;
338
+ readonly cz?: number | undefined;
339
+ }
340
+
341
+ declare interface GeometryPointRaw3D {
342
+ readonly xRaw: number;
343
+ readonly yRaw: number;
344
+ readonly zRaw: number;
345
+ }
346
+
347
+ declare interface GeometryPreparedCoordinate {
348
+ readonly cx: number;
349
+ readonly cy: number;
350
+ readonly cz?: number | undefined;
351
+ }
352
+
353
+ declare type GeometryPreparedEntry = PreparedCommon & GeometryPreparedView & {
354
+ /** Independently prepared native collision data. Original view/artifact remains the edit/rebuild baseline. */
355
+ readonly collision: GeometryPreparedView;
356
+ readonly navigation: GeometryTileView | null;
357
+ };
358
+
359
+ declare interface GeometryPreparedScope {
360
+ readonly tenantId: string;
361
+ readonly kind: GeometryKind;
362
+ readonly worldId: string;
363
+ readonly layerSetId: string;
364
+ readonly version: string;
365
+ }
366
+
367
+ declare type GeometryPreparedView = ({
368
+ readonly kind: '2d-tiles';
369
+ readonly view: GeometryTileView;
370
+ } | {
371
+ readonly kind: '2d-heightfield';
372
+ readonly view: GeometryHeightfieldView;
373
+ } | {
374
+ readonly kind: '3d-shapes';
375
+ readonly view: GeometryShapesView;
376
+ } | {
377
+ readonly kind: '3d-voxel';
378
+ readonly view: GeometryVoxelView;
379
+ });
380
+
381
+ declare interface GeometryProceduralContext {
382
+ readonly seed: number;
383
+ readonly kind: GeometryKind;
384
+ readonly address: GeometryChunk['address'];
385
+ readonly version: string;
386
+ }
387
+
388
+ declare interface GeometryRenderLod {
389
+ readonly fields: ReadonlyArray<string>;
390
+ readonly sampleStride: number;
391
+ readonly sourceBlobSha256: string;
392
+ readonly sourceContentSha256: string;
393
+ readonly artifact: GeometryArtifact;
394
+ /** Present when both full heights and heightsCoarse are selected. */
395
+ readonly coarseArtifact?: GeometryArtifact;
396
+ }
397
+
398
+ declare interface GeometryRenderLodCache {
399
+ prepare(coordinate: GeometryPreparedCoordinate, distanceChunks: number): Promise<GeometryRenderLod>;
400
+ at(coordinate: GeometryPreparedCoordinate, distanceChunks: number): GeometryRenderLod;
401
+ observation(): {
402
+ readonly entries: number;
403
+ readonly encodedBytes: number;
404
+ readonly jobs: number;
405
+ readonly closed: boolean;
406
+ readonly withdrawn: boolean;
407
+ };
408
+ /** Clears owned references and joins all accepted preparation/hash work. It
409
+ * never closes the borrowed native cache/Session or erases earlier aliases. */
410
+ close(): Promise<void>;
411
+ }
412
+
413
+ declare interface GeometryRenderLodCacheOptions {
414
+ readonly maxEntries?: number;
415
+ readonly maxEncodedBytes?: number;
416
+ readonly maxConcurrent?: number | undefined;
417
+ readonly lod?: GeometryHeightfieldLodOptions;
418
+ readonly strategies?: {
419
+ readonly prepare?: GeometryRenderLodPreparer;
420
+ } | undefined;
421
+ }
422
+
423
+ declare type GeometryRenderLodPreparer = (world: AnyWorldDescriptor, artifact: GeometryArtifact, distanceChunks: number, options: GeometryHeightfieldLodOptions) => Promise<GeometryRenderLod>;
424
+
425
+ declare type GeometryShape = (typeof GeometryShapeSchema)["Type"];
426
+
427
+ declare const GeometryShapeSchema: Schema.Union<readonly [Schema.Struct<{
428
+ readonly halfXRaw: Schema.Int;
429
+ readonly halfYRaw: Schema.Int;
430
+ readonly halfZRaw: Schema.Int;
431
+ readonly id: Schema.String;
432
+ readonly xRaw: Schema.Int;
433
+ readonly yRaw: Schema.Int;
434
+ readonly zRaw: Schema.Int;
435
+ readonly kind: Schema.Literal<"aabb">;
436
+ }>, Schema.Struct<{
437
+ readonly radiusRaw: Schema.Int;
438
+ readonly id: Schema.String;
439
+ readonly xRaw: Schema.Int;
440
+ readonly yRaw: Schema.Int;
441
+ readonly zRaw: Schema.Int;
442
+ readonly kind: Schema.Literal<"sphere">;
443
+ }>]>;
444
+
445
+ declare type GeometryShapesChunk = (typeof GeometryShapesChunkSchema)["Type"];
446
+
447
+ declare const GeometryShapesChunkSchema: Schema.Struct<{
448
+ readonly kind: Schema.Literal<"3d-shapes">;
449
+ readonly formatVersion: Schema.Literal<1>;
450
+ readonly address: Schema.Struct<{
451
+ readonly worldId: Schema.String;
452
+ readonly layerSetId: Schema.String;
453
+ readonly cx: Schema.Int;
454
+ readonly cy: Schema.Int;
455
+ readonly cz: Schema.Int;
456
+ }>;
457
+ readonly version: Schema.String;
458
+ readonly extentXRaw: Schema.Int;
459
+ readonly extentYRaw: Schema.Int;
460
+ readonly extentZRaw: Schema.Int;
461
+ readonly shapes: Schema.$Array<Schema.Union<readonly [Schema.Struct<{
462
+ readonly halfXRaw: Schema.Int;
463
+ readonly halfYRaw: Schema.Int;
464
+ readonly halfZRaw: Schema.Int;
465
+ readonly id: Schema.String;
466
+ readonly xRaw: Schema.Int;
467
+ readonly yRaw: Schema.Int;
468
+ readonly zRaw: Schema.Int;
469
+ readonly kind: Schema.Literal<"aabb">;
470
+ }>, Schema.Struct<{
471
+ readonly radiusRaw: Schema.Int;
472
+ readonly id: Schema.String;
473
+ readonly xRaw: Schema.Int;
474
+ readonly yRaw: Schema.Int;
475
+ readonly zRaw: Schema.Int;
476
+ readonly kind: Schema.Literal<"sphere">;
477
+ }>]>>;
478
+ }>;
479
+
480
+ declare interface GeometryShapesLimits {
481
+ readonly maxShapes: number;
482
+ readonly maxBytes: number;
483
+ }
484
+
485
+ declare interface GeometryShapesView {
486
+ readonly chunk: GeometryShapesChunk;
487
+ containingRaw(point: GeometryPointRaw3D, maximumShapes?: number): ReadonlyArray<GeometryShape>;
488
+ /** Closed LOCAL segment and native volumes. Canonical ID order, not distance
489
+ * order; no first-hit fraction or cross-chunk ownership is implied. */
490
+ intersectingSegmentRaw(from: GeometryPointRaw3D, to: GeometryPointRaw3D, maximumShapes?: number): ReadonlyArray<GeometryShape>;
491
+ }
492
+
493
+ declare type GeometryShapeTemplate = {
494
+ readonly key: string;
495
+ readonly kind: 'aabb';
496
+ readonly halfXRaw: number;
497
+ readonly halfYRaw: number;
498
+ readonly halfZRaw: number;
499
+ } | {
500
+ readonly key: string;
501
+ readonly kind: 'sphere';
502
+ readonly radiusRaw: number;
503
+ };
504
+
505
+ declare type GeometrySource = {
506
+ readonly _tag: 'GeometrySource';
507
+ readonly kind: 'cms';
508
+ readonly key: string;
509
+ readonly channel: string;
510
+ } | {
511
+ readonly _tag: 'GeometrySource';
512
+ readonly kind: 'imported';
513
+ readonly directory: string;
514
+ } | {
515
+ readonly _tag: 'GeometrySource';
516
+ readonly kind: 'procedural';
517
+ readonly seed: number;
518
+ readonly generator: GeometryGenerator;
519
+ };
520
+
521
+ declare interface GeometryTileCellBounds {
522
+ readonly minXRaw: number;
523
+ readonly minYRaw: number;
524
+ readonly maxXRaw: number;
525
+ readonly maxYRaw: number;
526
+ }
527
+
528
+ declare type GeometryTileChunk = (typeof GeometryTileChunkSchema)["Type"];
529
+
530
+ declare const GeometryTileChunkSchema: Schema.Struct<{
531
+ readonly kind: Schema.Literal<"2d-tiles">;
532
+ readonly formatVersion: Schema.Literal<1>;
533
+ readonly address: Schema.Struct<{
534
+ readonly worldId: Schema.String;
535
+ readonly layerSetId: Schema.String;
536
+ readonly cx: Schema.Int;
537
+ readonly cy: Schema.Int;
538
+ }>;
539
+ readonly version: Schema.String;
540
+ readonly width: Schema.Int;
541
+ readonly height: Schema.Int;
542
+ readonly tileSizeRaw: Schema.Int;
543
+ readonly palette: Schema.$Array<Schema.Struct<{
544
+ readonly key: Schema.String;
545
+ readonly solid: Schema.Boolean;
546
+ }>>;
547
+ readonly runs: Schema.$Array<Schema.Struct<{
548
+ readonly paletteIndex: Schema.Int;
549
+ readonly length: Schema.Int;
550
+ }>>;
551
+ }>;
552
+
553
+ declare interface GeometryTileLimits {
554
+ readonly maxSide: number;
555
+ readonly maxCells: number;
556
+ readonly maxPalette: number;
557
+ readonly maxRuns: number;
558
+ readonly maxBytes: number;
559
+ }
560
+
561
+ declare type GeometryTileMaterial = (typeof GeometryTileMaterialSchema)["Type"];
562
+
563
+ declare const GeometryTileMaterialSchema: Schema.Struct<{
564
+ readonly key: Schema.String;
565
+ readonly solid: Schema.Boolean;
566
+ }>;
567
+
568
+ declare interface GeometryTileView {
569
+ readonly chunk: GeometryTileChunk;
570
+ /** Local integer cell queries. Outside cells refuse; no missing-neighbor air. */
571
+ materialAt(x: number, y: number): GeometryTileMaterial;
572
+ solidAt(x: number, y: number): boolean;
573
+ materialAtRaw(xRaw: number, yRaw: number): GeometryTileMaterial;
574
+ cellBounds(x: number, y: number): GeometryTileCellBounds;
575
+ /** Detached row-major little-bit occupancy, never the retained mutable grid. */
576
+ occupancy(): Uint8Array;
577
+ }
578
+
579
+ declare interface GeometryVerifiedAsset {
580
+ readonly root: GeometryAssetRoot;
581
+ readonly key: string;
582
+ readonly checksum: string;
583
+ readonly size: number;
584
+ readonly contentType: string;
585
+ /** Detached owned bytes; no URL/token/permission retained. */
586
+ bytes(): Uint8Array;
587
+ }
588
+
589
+ declare interface GeometryVersionMigrationStrategies {
590
+ readonly migrateDelta?: GeometryMigrateDelta;
591
+ }
592
+
593
+ declare type GeometryVoxelChunk = (typeof GeometryVoxelChunkSchema)["Type"];
594
+
595
+ declare const GeometryVoxelChunkSchema: Schema.Struct<{
596
+ readonly kind: Schema.Literal<"3d-voxel">;
597
+ readonly formatVersion: Schema.Literal<1>;
598
+ readonly address: Schema.Struct<{
599
+ readonly worldId: Schema.String;
600
+ readonly layerSetId: Schema.String;
601
+ readonly cx: Schema.Int;
602
+ readonly cy: Schema.Int;
603
+ readonly cz: Schema.Int;
604
+ }>;
605
+ readonly version: Schema.String;
606
+ readonly side: Schema.Int;
607
+ readonly voxelSizeRaw: Schema.Int;
608
+ readonly palette: Schema.$Array<Schema.Struct<{
609
+ readonly key: Schema.String;
610
+ readonly solid: Schema.Boolean;
611
+ }>>;
612
+ readonly sections: Schema.$Array<Schema.Struct<{
613
+ readonly sx: Schema.Int;
614
+ readonly sy: Schema.Int;
615
+ readonly sz: Schema.Int;
616
+ readonly runs: Schema.$Array<Schema.Struct<{
617
+ readonly paletteIndex: Schema.Int;
618
+ readonly length: Schema.Int;
619
+ }>>;
620
+ }>>;
621
+ }>;
622
+
623
+ declare interface GeometryVoxelLimits {
624
+ readonly maxSide: number;
625
+ readonly maxVoxels: number;
626
+ readonly maxPalette: number;
627
+ readonly maxSections: number;
628
+ readonly maxRunsPerSection: number;
629
+ readonly maxBytes: number;
630
+ }
631
+
632
+ declare interface GeometryVoxelView {
633
+ readonly chunk: GeometryVoxelChunk;
634
+ materialAt(x: number, y: number, z: number): GeometryTileMaterial;
635
+ solidAt(x: number, y: number, z: number): boolean;
636
+ materialAtRaw(xRaw: number, yRaw: number, zRaw: number): GeometryTileMaterial;
637
+ occupancy(): Uint8Array;
638
+ }
639
+
640
+ declare interface GeometryWorldPointRaw {
641
+ readonly xRaw: number;
642
+ readonly yRaw: number;
643
+ readonly zRaw?: number;
644
+ }
645
+
646
+ export declare const joinById: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>>(client: RoomRpcCaller, manifest: RoomWireManifest<S, I>, input: {
647
+ readonly roomId: string;
648
+ readonly role?: "player" | "spectator";
649
+ }, options: RoomClientOptions) => Promise<RoomConnection<S, I, {
650
+ readonly mode: "join" | "create";
651
+ readonly room: string;
652
+ readonly options: unknown;
653
+ readonly pool?: string | undefined;
654
+ } | {
655
+ readonly mode: "joinById";
656
+ readonly roomId: string;
657
+ readonly role?: "spectator" | "player" | undefined;
658
+ }>>;
659
+
660
+ export declare const joinRoom: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>>(client: RoomRpcCaller, manifest: RoomWireManifest<S, I>, input: {
661
+ readonly room: string;
662
+ readonly options: unknown;
663
+ readonly pool?: string | undefined;
664
+ }, options: RoomClientOptions) => Promise<RoomConnection<S, I, {
665
+ readonly mode: "join" | "create";
666
+ readonly room: string;
667
+ readonly options: unknown;
668
+ readonly pool?: string | undefined;
669
+ } | {
670
+ readonly mode: "joinById";
671
+ readonly roomId: string;
672
+ readonly role?: "spectator" | "player" | undefined;
673
+ }>>;
674
+
675
+ /** Enter a seat reserved for the caller elsewhere, such as a Matchmaking assignment: the
676
+ * seat is redeemed with `rooms.resume` (same subject only) instead of reserving a new one.
677
+ * Failed entry withdraws the seat, as the other entry helpers do. */
678
+ export declare const joinSeat: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>>(client: RoomRpcCaller, manifest: RoomWireManifest<S, I>, input: {
679
+ readonly sessionId: string;
680
+ }, options: RoomClientOptions) => Promise<RoomConnection<S, I, {
681
+ readonly sessionId: string;
682
+ }>>;
683
+
684
+ /** Enter a World: the server places a first-time player at the World's spawn and otherwise
685
+ * returns the player's current Room (`rooms.world.join`); `manifest` is that Room's
686
+ * definition. `entityId` names the player's entity in later World moves. */
687
+ export declare const joinWorld: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>>(client: RoomRpcCaller, manifest: RoomWireManifest<S, I>, input: {
688
+ readonly world: string;
689
+ }, options: RoomClientOptions) => Promise<{
690
+ connection: RoomConnection<S, I, {
691
+ readonly world: string;
692
+ }>;
693
+ entityId: string;
694
+ }>;
695
+
696
+ declare const listDescriptor: QueryProcedureDescriptor<"rooms.list", Schema.Struct<{
697
+ readonly room: Schema.NonEmptyString;
698
+ readonly limit: Schema.optional<Schema.Int>;
699
+ }>, Schema.$Array<Schema.Struct<{
700
+ readonly id: Schema.String;
701
+ readonly name: Schema.String;
702
+ readonly metadata: Schema.$Record<Schema.String, Schema.Unknown>;
703
+ readonly clients: Schema.Int;
704
+ readonly maxClients: Schema.Int;
705
+ readonly locked: Schema.Boolean;
706
+ }>>, Schema.Union<readonly [typeof BudgetExceeded, typeof NotRoomMember, typeof ProtocolError, typeof RoomAuthoringError, typeof RoomForbidden, typeof RoomFull, typeof RoomGone, typeof RoomLocked, typeof RoomPoolWaking, typeof RoomsClosed, typeof SeatExpired]>>;
707
+
708
+ export declare const listRooms: (client: RoomRpcCaller, room: string, signal: AbortSignal, limit?: number) => Promise<RoomPublicListing>;
709
+
710
+ /** Explicit transferred Web Streams adapter. Owns frame boundaries/locks and
711
+ * bounded work, never TLS/auth/socket creation, registry, SQL or an actor tick.
712
+ * A native WT opener and actual sidecar must supply the real duplex/parent. */
713
+ export declare const makeRoomStreamTransport: (offered: RoomStreamTransportOptions) => Promise<RoomManagedStreamTransport>;
714
+
715
+ /** Independent immutable projections for rendering. Never merged into the
716
+ * authoritative Room snapshot, input history, collision state or SQL state. */
717
+ export declare const makeWorldEntityHandoffView: <S, E>(options: WorldEntityHandoffViewOptions<S, E>) => Readonly<{
718
+ notice: (roomId: string, frame: RoomWorldHandoffFrame, snapshot: RoomDeliveredState<S> | null) => void;
719
+ observe: (roomId: string, snapshot: RoomDeliveredState<S> | null) => void;
720
+ read: (roomId: string, snapshot: RoomDeliveredState<S> | null) => ReadonlyArray<WorldEntityHandoffProjection<E>>;
721
+ attach: (roomId: string, connection: WorldHandoffConnection<S>) => (() => void);
722
+ stats: () => Readonly<{
723
+ entities: number;
724
+ bytes: number;
725
+ connections: number;
726
+ }>;
727
+ close: () => void;
728
+ }>;
729
+
730
+ /** Presentation only. Retained state never becomes an authoritative delivered
731
+ * snapshot, input receipt, physics baseline or SQL ownership assertion. */
732
+ export declare const makeWorldHandoffView: <S>(offered: WorldHandoffViewOptions<S>) => Readonly<{
733
+ begin: (requestId: string, entityId: string, source: RoomDeliveredState<S>) => void;
734
+ prepare: (mode: "portal" | "seamless", target: {
735
+ readonly roomId: string;
736
+ readonly epoch: number;
737
+ }) => void;
738
+ source: (raw: RoomDeliveredState<S> | null) => void;
739
+ commit: () => void;
740
+ rollback: () => void;
741
+ read: (roomId: string | null, raw: RoomDeliveredState<S> | null) => WorldHandoffPresentation<S> | null;
742
+ observation: () => Readonly<{
743
+ retained: boolean;
744
+ enabled: boolean;
745
+ committed: boolean;
746
+ expiresAt: number | null;
747
+ }>;
748
+ close: () => void;
749
+ }>;
750
+
751
+ declare class NotRoomMember extends NotRoomMember_base {
752
+ }
753
+
754
+ declare const NotRoomMember_base: Schema.Class<NotRoomMember, Schema.TaggedStruct<"NotRoomMember", {
755
+ readonly sessionId: Schema.String;
756
+ }>, YieldableError>;
757
+
758
+ /** Bounded binary WS lane. Native buffer drain is no peer receipt. One pressure
759
+ * poll only; close requests fence immediately, terminal cleanup remains awaited. */
760
+ export declare const openRoomSocketTransport: (address: string, parentSignal: AbortSignal, offered?: RoomSocketTransportOptions) => Promise<RoomManagedSocketTransport>;
761
+
762
+ /** Opens one real native session and one framed reliable stream. Capability
763
+ * comes from that session after ready, never browser/version guessing. The
764
+ * Room Hello and seat admission still belong to the existing RoomSession. */
765
+ export declare const openRoomWebTransport: (address: string, signal: AbortSignal, offered: RoomWebTransportClientOptions, certificateHash?: string) => Promise<RoomManagedStreamTransport>;
766
+
767
+ declare interface PreparedCommon {
768
+ readonly scope: GeometryPersistenceScope;
769
+ readonly revision: number;
770
+ readonly blobSha256: string;
771
+ readonly contentSha256: string;
772
+ readonly accountedBytes: number;
773
+ }
774
+
775
+ declare class ProtocolError extends ProtocolError_base {
776
+ get message(): string;
777
+ }
778
+
779
+ declare const ProtocolError_base: Schema.Class<ProtocolError, Schema.TaggedStruct<"ProtocolError", {
780
+ readonly detail: Schema.String;
781
+ }>, YieldableError>;
782
+
783
+ declare const ReserveRoomInput: Schema.Union<readonly [Schema.Struct<{
784
+ readonly mode: Schema.Literals<readonly ["join", "create"]>;
785
+ readonly room: Schema.NonEmptyString;
786
+ readonly options: Schema.Unknown;
787
+ readonly pool: Schema.optional<Schema.String>;
788
+ }>, Schema.Struct<{
789
+ readonly mode: Schema.Literal<"joinById">;
790
+ readonly roomId: Schema.NonEmptyString;
791
+ readonly role: Schema.optional<Schema.Literals<readonly ["player", "spectator"]>>;
792
+ }>]>;
793
+
794
+ declare type ReserveRoomInput = typeof ReserveRoomInput.Type;
795
+
796
+ declare class RoomAuthoringError extends RoomAuthoringError_base {
797
+ get message(): string;
798
+ }
799
+
800
+ declare const RoomAuthoringError_base: Schema.Class<RoomAuthoringError, Schema.TaggedStruct<"RoomAuthoringError", {
801
+ readonly room: Schema.String;
802
+ readonly detail: Schema.String;
803
+ }>, YieldableError>;
804
+
805
+ export declare interface RoomByteDuplex {
806
+ readonly readable: ReadableStream<Uint8Array>;
807
+ readonly writable: WritableStream<Uint8Array>;
808
+ }
809
+
810
+ declare interface RoomChannel {
811
+ readonly schema: Schema.Codec<unknown, unknown>;
812
+ readonly direction: 'both' | 'server' | 'client';
813
+ readonly reliable: boolean;
814
+ }
815
+
816
+ export declare interface RoomClientInputRecovery {
817
+ readonly nextSeq: number;
818
+ readonly lastAppliedSeq: number;
819
+ }
820
+
821
+ export declare interface RoomClientOptions extends RoomConnectionOptions {
822
+ readonly clock?: RoomClock;
823
+ readonly socket?: RoomSocketTransportOptions | undefined;
824
+ readonly webTransport?: Omit<RoomWebTransportClientOptions, 'clock'>;
825
+ readonly transportPreference?: RoomTransportPreference;
826
+ }
827
+
828
+ /** API-facing reservation result. Credentials are retained only for Hello. */
829
+ export declare interface RoomClientReservation {
830
+ readonly roomId: string;
831
+ readonly sessionId: string;
832
+ readonly token: Uint8Array;
833
+ readonly address: string;
834
+ readonly expiresAt: number;
835
+ readonly endpoints?: RoomTransportEndpoints | undefined;
836
+ }
837
+
838
+ /** Browser/Node-native shape; platform adapters may provide their own factory. */
839
+ export declare interface RoomClientSocket {
840
+ readonly readyState: number;
841
+ readonly bufferedAmount: number;
842
+ binaryType: string;
843
+ addEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (event: RoomSocketEvent) => void): void;
844
+ removeEventListener(type: 'open' | 'message' | 'close' | 'error', listener: (event: RoomSocketEvent) => void): void;
845
+ send(bytes: Uint8Array<ArrayBuffer>): void;
846
+ close(code: number, reason: string): void;
847
+ }
848
+
849
+ declare interface RoomClock {
850
+ now(): number;
851
+ }
852
+
853
+ declare type RoomClockPingCadence = (joinedForMs: number) => number;
854
+
855
+ export declare interface RoomClockSamplingOptions {
856
+ readonly maxPendingPings: number;
857
+ readonly pingTimeoutMs: number;
858
+ }
859
+
860
+ /** Syncs independent monotonic clocks; wall-clock changes do not participate. */
861
+ declare class RoomClockSync {
862
+ private readonly clock;
863
+ private readonly samples;
864
+ private lastServerNow;
865
+ private provisionalOffset;
866
+ constructor(clock: RoomClock);
867
+ /** Welcome gives an approximate clock anchor, never an RTT measurement. */
868
+ anchor(serverTimeMs: number, receivedAt?: number): void;
869
+ reset(): void;
870
+ pong(clientTimeMs: number, serverTimeMs: number, receivedAt?: number): void;
871
+ stats(): {
872
+ readonly rttMs: number | null;
873
+ readonly offsetMs: number | null;
874
+ };
875
+ serverNow(): number | null;
876
+ }
877
+
878
+ declare interface RoomCodecLimits {
879
+ readonly maxBytes: number;
880
+ readonly maxCollectionLength: number;
881
+ readonly maxFieldId: number;
882
+ }
883
+
884
+ export declare const roomCodecs: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>>(manifest: RoomWireManifest<S, I>) => Readonly<{
885
+ state: RoomStateCodec<S>;
886
+ input: RoomInputCodec<I>;
887
+ channels: readonly Readonly<{
888
+ name: string;
889
+ direction: "both" | "client" | "server";
890
+ reliable: boolean;
891
+ codec: RoomInputCodec<Schema.Codec<unknown, unknown, never, never>>;
892
+ }>[];
893
+ schemaHash: number;
894
+ readonly transformRules: Uint8Array;
895
+ }>;
896
+
897
+ /** Framework-free reserve -> transport -> Hello orchestration. It preserves
898
+ * the last authoritative state during reconnect and never writes a token to
899
+ * persistent storage. RPC facade/platform/render-hook integration is pending. */
900
+ export declare class RoomConnection<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, JoinInput> {
901
+ readonly manifest: RoomWireManifest<S, I>;
902
+ readonly clock: RoomClock;
903
+ readonly reservations: RoomReservationClient<JoinInput>;
904
+ readonly connect: (address: string, signal: AbortSignal, endpoints?: RoomTransportEndpoints) => Promise<RoomTransport>;
905
+ private readonly controller;
906
+ private readonly listeners;
907
+ private readonly buffered;
908
+ private readonly pendingInputs;
909
+ private readonly options;
910
+ private session;
911
+ private handoffDetach;
912
+ private readonly handoffListeners;
913
+ private sessionDetach;
914
+ private currentState;
915
+ private currentStatus;
916
+ private currentError;
917
+ private reconnectTask;
918
+ private startTask;
919
+ private started;
920
+ private leaving;
921
+ private lastSessionId;
922
+ private lastTick;
923
+ private nextSeq;
924
+ private appliedSeq;
925
+ private clockTimer;
926
+ private readonly messageListeners;
927
+ private readonly messageDetach;
928
+ private reservation;
929
+ private readonly cleanupTasks;
930
+ private readonly cleanupFailures;
931
+ private pendingReservationCalls;
932
+ private pendingTransportCalls;
933
+ private readonly transportOwners;
934
+ private readonly transportLifetimes;
935
+ private withdrawalAttempted;
936
+ private leaveTask;
937
+ private left;
938
+ constructor(manifest: RoomWireManifest<S, I>, clock: RoomClock, reservations: RoomReservationClient<JoinInput>, connect: (address: string, signal: AbortSignal, endpoints?: RoomTransportEndpoints) => Promise<RoomTransport>, options: RoomConnectionOptions);
939
+ /* Excluded from this release type: captureGeometrySession */
940
+ /** `waking`: the pool scaled to zero and is starting a host; entry continues on its own. */
941
+ get status(): RoomSessionStatus | 'reserving' | 'waking';
942
+ get error(): unknown;
943
+ get state(): (S)["Type"] | null;
944
+ get id(): string | null;
945
+ /** Reserved Room identity, without exposing its seat credential. */
946
+ get roomId(): string | null;
947
+ get lastAppliedTick(): number;
948
+ get lastAppliedInputSeq(): number;
949
+ /** Exact current-session pairing; epoch changes need prediction reset. */
950
+ get reconciliationSnapshot(): RoomReconciliationSnapshot<(S)["Type"]> | null;
951
+ deliveredSnapshot(): RoomDeliveredState<(S)["Type"]> | null;
952
+ clockStats(): {
953
+ readonly rttMs: number | null;
954
+ readonly offsetMs: number | null;
955
+ };
956
+ serverNow(): number | null;
957
+ /** The current session's estimated datagram loss (0–1), null until measured. */
958
+ get lossRate(): number | null;
959
+ subscribe(listener: () => void): () => void;
960
+ private notify;
961
+ private active;
962
+ start(input: JoinInput): Promise<void>;
963
+ private attempt;
964
+ private install;
965
+ private waitForJoin;
966
+ private beginReconnect;
967
+ send(input: (I)["Type"]): Promise<number>;
968
+ private submit;
969
+ message(channel: string, payload: unknown): Promise<void>;
970
+ onWorldHandoff(listener: (frame: RoomWorldHandoffFrame) => void): () => void;
971
+ onMessage(channel: string, listener: (payload: unknown) => void): () => void;
972
+ private attachMessages;
973
+ private requestReservation;
974
+ private releaseReservation;
975
+ private stopClockSampling;
976
+ private releaseTransport;
977
+ private retainTransport;
978
+ private runTransportCleanup;
979
+ private startClockSampling;
980
+ private terminal;
981
+ leave(): Promise<void>;
982
+ private withdraw;
983
+ }
984
+
985
+ export declare interface RoomConnectionOptions {
986
+ readonly graceMs: number;
987
+ readonly maxBufferedInputs?: number;
988
+ readonly maxPendingInputs?: number;
989
+ readonly initialBackoffMs?: number;
990
+ readonly maxBackoffMs?: number;
991
+ readonly connectTimeoutMs?: number;
992
+ readonly random?: () => number;
993
+ readonly sleep?: (milliseconds: number, signal: AbortSignal) => Promise<void>;
994
+ readonly reconnectPolicy?: RoomReconnectPolicy;
995
+ readonly clockSampling?: RoomClockSamplingOptions;
996
+ readonly inputRedundancy?: RoomInputRedundancyOptions;
997
+ readonly clockPingCadence?: RoomClockPingCadence;
998
+ readonly maxPendingReservationCalls?: number;
999
+ readonly maxCleanupFailures?: number;
1000
+ readonly maxPendingTransportCalls?: number;
1001
+ /** How long entry keeps waiting while a scaled-to-zero pool starts a host (`RoomPoolWaking`). Default 180000. */
1002
+ readonly wakeTimeoutMs?: number;
1003
+ }
1004
+
1005
+ export declare interface RoomDatagramLane {
1006
+ readonly maxDatagramBytes: number;
1007
+ send(frame: Uint8Array): void;
1008
+ onFrame(listener: (frame: Uint8Array, receivedAt: number) => void): () => void;
1009
+ }
1010
+
1011
+ export declare interface RoomDeliveredState<S> {
1012
+ readonly epoch: number;
1013
+ readonly tick: number;
1014
+ /** Local transport observation, not an authoritative server timestamp. */
1015
+ readonly receivedAt: number;
1016
+ readonly state: S;
1017
+ }
1018
+
1019
+ declare class RoomForbidden extends RoomForbidden_base {
1020
+ }
1021
+
1022
+ declare const RoomForbidden_base: Schema.Class<RoomForbidden, Schema.TaggedStruct<"RoomForbidden", {
1023
+ readonly roomId: Schema.String;
1024
+ }>, YieldableError>;
1025
+
1026
+ declare type RoomFrame = RoomWorldHandoffFrame | {
1027
+ readonly kind: 'Hello';
1028
+ readonly protocolVersion: number;
1029
+ readonly token: Uint8Array;
1030
+ readonly schemaHash: number;
1031
+ readonly resumeFromTick?: number;
1032
+ readonly transportCaps: number;
1033
+ } | {
1034
+ readonly kind: 'Input';
1035
+ readonly firstSeq: number;
1036
+ readonly inputs: ReadonlyArray<{
1037
+ readonly tickHint: number;
1038
+ readonly payload: Uint8Array;
1039
+ }>;
1040
+ readonly ackTick?: number;
1041
+ }
1042
+ /** `lossPermille`: the client's estimated loss of state datagrams (0–1000), once it has one. */
1043
+ | {
1044
+ readonly kind: 'Ack';
1045
+ readonly tick: number;
1046
+ readonly lossPermille?: number;
1047
+ } | {
1048
+ readonly kind: 'Ping';
1049
+ readonly clientTimeMs: number;
1050
+ } | {
1051
+ readonly kind: 'ClientMessage' | 'ServerMessage';
1052
+ readonly channelId: number;
1053
+ readonly payload: Uint8Array;
1054
+ } | {
1055
+ readonly kind: 'Leave';
1056
+ readonly reason: number;
1057
+ } | {
1058
+ readonly kind: 'Welcome';
1059
+ readonly sessionId: string;
1060
+ readonly tick: number;
1061
+ readonly serverTimeMs: number;
1062
+ readonly epoch: number;
1063
+ readonly baseline: Uint8Array;
1064
+ readonly transformRules: Uint8Array;
1065
+ } | {
1066
+ readonly kind: 'Delta';
1067
+ readonly tick: number;
1068
+ readonly baseTick: number;
1069
+ readonly patch: Uint8Array;
1070
+ readonly inputAck?: RoomFrameInputReceipt;
1071
+ } | {
1072
+ readonly kind: 'Full';
1073
+ readonly tick: number;
1074
+ readonly epoch: number;
1075
+ readonly baseline: Uint8Array;
1076
+ readonly inputAck?: RoomFrameInputReceipt;
1077
+ } | {
1078
+ readonly kind: 'InputAck';
1079
+ readonly lastAppliedSeq: number;
1080
+ readonly tick: number;
1081
+ readonly flags: number;
1082
+ }
1083
+ /** `deltaDatagramsSent`: state deltas this Session sent as datagrams so far, for the client's loss estimate. */
1084
+ | {
1085
+ readonly kind: 'Pong';
1086
+ readonly clientTimeMs: number;
1087
+ readonly serverTimeMs: number;
1088
+ readonly tick: number;
1089
+ readonly deltaDatagramsSent?: number;
1090
+ } | {
1091
+ readonly kind: 'Kick';
1092
+ readonly code: number;
1093
+ readonly reason: string;
1094
+ } | {
1095
+ readonly kind: 'Migrate';
1096
+ readonly address?: string;
1097
+ readonly graceMs: number;
1098
+ } | {
1099
+ readonly kind: 'Error';
1100
+ readonly code: number;
1101
+ readonly detail: string;
1102
+ } | {
1103
+ readonly kind: 'LsInput';
1104
+ readonly firstTick: number;
1105
+ readonly inputs: ReadonlyArray<Uint8Array>;
1106
+ } | {
1107
+ readonly kind: 'LsInputs';
1108
+ readonly firstTick: number;
1109
+ readonly matrices: ReadonlyArray<RoomLockstepInputMatrix>;
1110
+ } | {
1111
+ readonly kind: 'LsHash';
1112
+ readonly tick: number;
1113
+ readonly hi: number;
1114
+ readonly lo: number;
1115
+ } | {
1116
+ readonly kind: 'LsDesync';
1117
+ readonly tick: number;
1118
+ readonly action: 'resync';
1119
+ readonly snapshot: Uint8Array;
1120
+ } | {
1121
+ readonly kind: 'LsDesync';
1122
+ readonly tick: number;
1123
+ readonly action: 'end' | 'flag';
1124
+ readonly snapshot?: never;
1125
+ } | {
1126
+ readonly kind: 'LsStart';
1127
+ readonly startTick: number;
1128
+ readonly seed: number;
1129
+ readonly options: Uint8Array;
1130
+ readonly serverTimeMs: number;
1131
+ readonly localPlayerId: number;
1132
+ readonly roster: ReadonlyArray<RoomLockstepWirePlayer>;
1133
+ readonly history?: Uint8Array;
1134
+ readonly snapshot?: Uint8Array;
1135
+ } | {
1136
+ readonly kind: 'LsStall';
1137
+ readonly waitingFor: RoomLockstepPlayerMask;
1138
+ }
1139
+ /** A player admitted after Start: from `tick` on, every matrix carries its `slot`. */
1140
+ | {
1141
+ readonly kind: 'LsJoin';
1142
+ readonly tick: number;
1143
+ readonly slot: number;
1144
+ readonly playerId: number;
1145
+ };
1146
+
1147
+ declare interface RoomFrameInputReceipt {
1148
+ readonly lastAppliedSeq: number;
1149
+ readonly flags: number;
1150
+ }
1151
+
1152
+ declare class RoomFull extends RoomFull_base {
1153
+ }
1154
+
1155
+ declare const RoomFull_base: Schema.Class<RoomFull, Schema.TaggedStruct<"RoomFull", {
1156
+ readonly roomId: Schema.String;
1157
+ }>, YieldableError>;
1158
+
1159
+ declare interface RoomGeometryChunkCache {
1160
+ /** Last downloaded native query snapshot, never implied empty terrain. */
1161
+ at(coordinate: GeometryPreparedCoordinate): GeometryPreparedEntry;
1162
+ contains(coordinate: GeometryPreparedCoordinate): boolean;
1163
+ /** Full requested set commits to bounded LRU only after all loads/hash/views
1164
+ * complete. Failed batches preserve earlier same-admission snapshots. */
1165
+ request(coordinates: ReadonlyArray<GeometryPreparedCoordinate>): Promise<void>;
1166
+ /** Explicit render-frame work: native Deltas/recovery, visible-first load,
1167
+ * directional prefetch and old-cache hysteresis. Caller awaits each frame. */
1168
+ stream(focus: GeometryWorldPointRaw, options?: GeometryClientInterestOptions): Promise<GeometryClientInterest>;
1169
+ /** Explicit current source reconciliation, including already cached chunks. */
1170
+ /** Explicit serial native Delta application; gaps require actual source recovery. */
1171
+ pump(): Promise<{
1172
+ readonly applied: number;
1173
+ readonly duplicates: number;
1174
+ readonly obsolete: number;
1175
+ readonly recovery: ReadonlyArray<GeometryPreparedCoordinate>;
1176
+ }>;
1177
+ refresh(coordinates: ReadonlyArray<GeometryPreparedCoordinate>): Promise<void>;
1178
+ close(): Promise<void>;
1179
+ observation(): RoomGeometryChunkCacheObservation;
1180
+ }
1181
+
1182
+ declare interface RoomGeometryChunkCacheObservation {
1183
+ readonly cached: number;
1184
+ readonly accountedBytes: number;
1185
+ readonly staged: number;
1186
+ readonly stagedBytes: number;
1187
+ readonly active: boolean;
1188
+ readonly withdrawn: boolean;
1189
+ readonly stale: number;
1190
+ readonly queuedDeltas: number;
1191
+ readonly queuedDeltaBytes: number;
1192
+ readonly receiving: number;
1193
+ readonly receivingBytes: number;
1194
+ }
1195
+
1196
+ declare class RoomGone extends RoomGone_base {
1197
+ }
1198
+
1199
+ declare const RoomGone_base: Schema.Class<RoomGone, Schema.TaggedStruct<"RoomGone", {
1200
+ readonly roomId: Schema.String;
1201
+ }>, YieldableError>;
1202
+
1203
+ declare class RoomInputCodec<S extends Schema.Codec<unknown, unknown>> {
1204
+ readonly schema: S;
1205
+ private readonly codec;
1206
+ constructor(schema: S, config?: Partial<RoomCodecLimits>, defaultNumberPrecision?: 'f32' | 'f64');
1207
+ get schemaHash(): number;
1208
+ get limits(): RoomCodecLimits;
1209
+ /** Actual admitted binary input/channel layout; no schema loader or authority. */
1210
+ schemaDescription(): string;
1211
+ full(input: (S)["Type"]): Result.Result<Uint8Array, ProtocolError>;
1212
+ decodeFull(bytes: Uint8Array): Result.Result<(S)["Type"], ProtocolError>;
1213
+ }
1214
+
1215
+ /** Pure bounded client intentions. Never state, socket retransmission, SQL or
1216
+ * authority. A duplicate prefix is discarded by the actual actor's seq fence. */
1217
+ export declare class RoomInputRedundancy {
1218
+ private readonly options;
1219
+ private readonly entries;
1220
+ private bytes;
1221
+ private lastSeq;
1222
+ constructor(offered?: RoomInputRedundancyOptions);
1223
+ get bufferedBytes(): number;
1224
+ get bufferedInputs(): number;
1225
+ offer(seq: number, tickHint: number, payload: Uint8Array): Extract<RoomFrame, {
1226
+ kind: 'Input';
1227
+ }>;
1228
+ clear(): void;
1229
+ }
1230
+
1231
+ export declare interface RoomInputRedundancyOptions {
1232
+ /** Input count is a redundancy budget, never a delivery guarantee. */
1233
+ readonly inputRedundancy: number;
1234
+ readonly maxInputHistoryBytes: number;
1235
+ }
1236
+
1237
+ /** One replaceable unsent datagram, separate from an already accepted native
1238
+ * write. Latest wins under pressure; a mailbox is never a reliable replay queue. */
1239
+ export declare class RoomLatestDatagram {
1240
+ readonly maxDatagramBytes: number;
1241
+ private pending;
1242
+ private dropped;
1243
+ private ended;
1244
+ constructor(maxDatagramBytes: number);
1245
+ get droppedDatagrams(): number;
1246
+ get bufferedBytes(): number;
1247
+ offer(offered: Uint8Array): void;
1248
+ take(): Uint8Array | null;
1249
+ close(): void;
1250
+ }
1251
+
1252
+ declare class RoomLocked extends RoomLocked_base {
1253
+ }
1254
+
1255
+ declare const RoomLocked_base: Schema.Class<RoomLocked, Schema.TaggedStruct<"RoomLocked", {
1256
+ readonly roomId: Schema.String;
1257
+ }>, YieldableError>;
1258
+
1259
+ declare interface RoomLockstepInputMatrix {
1260
+ readonly players: RoomLockstepPlayerMask;
1261
+ readonly inputs: ReadonlyArray<Uint8Array>;
1262
+ }
1263
+
1264
+ /** Bits identify server-assigned roster slots 0..63, not Subject or player IDs. */
1265
+ declare type RoomLockstepPlayerMask = Uint64Words;
1266
+
1267
+ /** Public opaque simulation identities, never Subjects or Session credentials. */
1268
+ declare interface RoomLockstepWirePlayer {
1269
+ readonly slot: number;
1270
+ readonly playerId: number;
1271
+ }
1272
+
1273
+ export declare interface RoomManagedSocketTransport extends RoomTransport {
1274
+ /** Joins actual native CLOSED/close-event evidence and listener cleanup.
1275
+ * Failed cleanup remains owned and can be explicitly retried. */
1276
+ closeAsync(code: number, reason: string): Promise<void>;
1277
+ }
1278
+
1279
+ export declare interface RoomManagedStreamTransport extends RoomTransport {
1280
+ /** Await owned reads/writes, parent release and lock cleanup; failed cleanup
1281
+ * retains its handle and can be retried. Never a native delivery receipt. */
1282
+ closeAsync(code: number, reason: string): Promise<void>;
1283
+ }
1284
+
1285
+ /** Current native WebTransport API boundary. Platform objects may use native
1286
+ * prototype getters; authored options below must contain own data properties. */
1287
+ export declare interface RoomNativeWebTransport {
1288
+ readonly ready: Promise<void>;
1289
+ readonly closed: Promise<unknown>;
1290
+ /** Absent in Chromium; see the capability fallback in openRoomWebTransport. */
1291
+ readonly reliability?: 'pending' | 'reliable-only' | 'supports-unreliable' | undefined;
1292
+ readonly datagrams: {
1293
+ readonly readable: ReadableStream<Uint8Array>;
1294
+ readonly maxDatagramSize: number;
1295
+ /** Current specification; Chromium exposes the single `writable` instead. */
1296
+ createWritable?(): WritableStream<Uint8Array>;
1297
+ readonly writable?: WritableStream<Uint8Array>;
1298
+ };
1299
+ createBidirectionalStream(): Promise<RoomByteDuplex>;
1300
+ close(info: {
1301
+ readonly closeCode: number;
1302
+ readonly reason: string;
1303
+ }): void;
1304
+ }
1305
+
1306
+ /** The pool has no host because it scaled to zero; one is starting. Reserve again after `retryAfterMs`. */
1307
+ declare class RoomPoolWaking extends RoomPoolWaking_base {
1308
+ }
1309
+
1310
+ declare const RoomPoolWaking_base: Schema.Class<RoomPoolWaking, Schema.TaggedStruct<"RoomPoolWaking", {
1311
+ readonly pool: Schema.String;
1312
+ readonly retryAfterMs: Schema.Number;
1313
+ }>, YieldableError>;
1314
+
1315
+ export declare type RoomPublicListing = typeof listDescriptor.output.Type;
1316
+
1317
+ /** Framework-free binary session core. Reservation, reconnect orchestration and
1318
+ * render hooks are separate; this core never persists a seat token. */
1319
+ export declare interface RoomReconciliationSnapshot<S> {
1320
+ readonly epoch: number;
1321
+ readonly tick: number;
1322
+ readonly lastAppliedSeq: number;
1323
+ readonly state: S;
1324
+ }
1325
+
1326
+ export declare type RoomReconnectPolicy = (input: RoomReconnectPolicyInput) => number;
1327
+
1328
+ export declare interface RoomReconnectPolicyInput {
1329
+ readonly attempt: number;
1330
+ readonly initialBackoffMs: number;
1331
+ readonly maxBackoffMs: number;
1332
+ readonly remainingMs: number;
1333
+ readonly random: number;
1334
+ }
1335
+
1336
+ export declare interface RoomReliableLane {
1337
+ send(frame: Uint8Array): Promise<void>;
1338
+ onFrame(listener: (frame: Uint8Array, receivedAt: number) => void): () => void;
1339
+ }
1340
+
1341
+ export declare interface RoomReservationClient<JoinInput> {
1342
+ reserve(input: JoinInput, signal: AbortSignal): Promise<RoomClientReservation>;
1343
+ resume(sessionId: string, signal: AbortSignal): Promise<RoomClientReservation>;
1344
+ release?(sessionId: string, token: Uint8Array, signal: AbortSignal): Promise<void>;
1345
+ }
1346
+
1347
+ export declare interface RoomRpcCaller {
1348
+ call(tag: string, input: unknown, options: {
1349
+ readonly signal: AbortSignal;
1350
+ }): Promise<unknown>;
1351
+ /** Normal framework live-query callback boundary. No polling adapter. */
1352
+ readonly subscribe?: (tag: string, input: unknown, handlers: {
1353
+ readonly onValue: (value: unknown) => void;
1354
+ readonly onError?: (error: unknown) => void;
1355
+ }) => WorldClientReceiptSubscription;
1356
+ }
1357
+
1358
+ /** Tags resolve per call, so an installed plugin alias moves the entire API.
1359
+ * Responses are already decoded by the normal caller; tokens stay in memory. */
1360
+ export declare const roomRpcReservations: (client: RoomRpcCaller) => RoomReservationClient<ReserveRoomInput>;
1361
+
1362
+ /** New Room reservations are closed for this caller (maintenance, a kill switch...): the app's
1363
+ * `admission` refused. `until`: epoch ms when they reopen, if known; `messageKey`: the app's text. */
1364
+ declare class RoomsClosed extends RoomsClosed_base {
1365
+ }
1366
+
1367
+ declare const RoomsClosed_base: Schema.Class<RoomsClosed, Schema.TaggedStruct<"RoomsClosed", {
1368
+ readonly until: Schema.NullOr<Schema.Number>;
1369
+ readonly messageKey: Schema.String;
1370
+ }>, YieldableError>;
1371
+
1372
+ export declare class RoomSession<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> {
1373
+ readonly transport: RoomTransport;
1374
+ readonly clock: RoomClock;
1375
+ readonly maxBaselines: number;
1376
+ private readonly codecs;
1377
+ private readonly baselines;
1378
+ private readonly handoffListeners;
1379
+ private readonly listeners;
1380
+ private readonly messageListeners;
1381
+ private readonly detach;
1382
+ private currentState;
1383
+ private currentStatus;
1384
+ private currentError;
1385
+ private tick;
1386
+ private epoch;
1387
+ private receivedAt;
1388
+ private seq;
1389
+ private inputAck;
1390
+ private acknowledgedTick;
1391
+ private pendingInputAck;
1392
+ private pairedInputState;
1393
+ private sessionId;
1394
+ private started;
1395
+ private readonly pendingPings;
1396
+ private deltaDatagramsReceived;
1397
+ private lossSample;
1398
+ private lossEstimate;
1399
+ private readonly sampling;
1400
+ readonly clockSync: RoomClockSync;
1401
+ private readonly inputHistory;
1402
+ constructor(transport: RoomTransport, manifest: RoomWireManifest<S, I>, clock: RoomClock, maxBaselines?: number, recovery?: RoomClientInputRecovery, sampling?: RoomClockSamplingOptions, redundancy?: RoomInputRedundancyOptions);
1403
+ /* Excluded from this release type: currentReliableChannelIdentity */
1404
+ /* Excluded from this release type: currentReliableClientChannelIdentity */
1405
+ get status(): RoomSessionStatus;
1406
+ get error(): ProtocolError | null;
1407
+ get state(): (S)["Type"] | null;
1408
+ get lastAppliedTick(): number;
1409
+ get lastAppliedInputSeq(): number;
1410
+ /** Actor-applied receipt paired with the exact delivered state tick/epoch.
1411
+ * This is not a SQL persistence ACK or a state from a different tick. */
1412
+ get reconciliationSnapshot(): RoomReconciliationSnapshot<(S)["Type"]> | null;
1413
+ get nextInputSeq(): number;
1414
+ get id(): string | null;
1415
+ /** Estimated loss of state datagrams (0–1, smoothed), measured between Pongs; null until the
1416
+ * Host has sent enough datagrams. Reported back to the Host in every Ack. */
1417
+ get lossRate(): number | null;
1418
+ deliveredSnapshot(): RoomDeliveredState<(S)["Type"]> | null;
1419
+ serverNow(): number | null;
1420
+ start(token: Uint8Array, resumeFromTick?: number): Promise<void>;
1421
+ send(input: (I)["Type"]): Promise<number>;
1422
+ message(channelName: string, payload: unknown): Promise<void>;
1423
+ /** Reconnect replays only previously submitted, unacknowledged intentions. */
1424
+ replay(seq: number, input: (I)["Type"]): Promise<void>;
1425
+ ping(): Promise<void>;
1426
+ subscribe(listener: () => void): () => void;
1427
+ /** Render-only reliable notice; does not change state, inputs or connection ownership. */
1428
+ onWorldHandoff(listener: (frame: RoomWorldHandoffFrame) => void): () => void;
1429
+ onMessage(channel: string, listener: (payload: unknown) => void): () => void;
1430
+ private sendFrame;
1431
+ /** A window needs at least 8 datagrams; datagrams still in flight count as lost here and as
1432
+ * received in the next window, which the smoothing evens out. */
1433
+ private sampleLoss;
1434
+ private ackFrame;
1435
+ private acknowledge;
1436
+ private fail;
1437
+ private install;
1438
+ private pairInputState;
1439
+ /** Shared receipt authority for the independent frame and its exact state
1440
+ * trailer. A state/receipt pair is installed before notifying subscribers. */
1441
+ private observeInputAck;
1442
+ private receive;
1443
+ private notify;
1444
+ private cleanup;
1445
+ leave(): Promise<void>;
1446
+ }
1447
+
1448
+ export declare type RoomSessionStatus = 'connecting' | 'joined' | 'reconnecting' | 'left' | 'kicked' | 'gone';
1449
+
1450
+ declare interface RoomSocketEvent {
1451
+ readonly type: string;
1452
+ readonly data?: unknown;
1453
+ readonly code?: number;
1454
+ readonly reason?: string;
1455
+ }
1456
+
1457
+ export declare interface RoomSocketTransportOptions {
1458
+ readonly factory?: RoomWebSocketFactory;
1459
+ readonly clock?: RoomClock;
1460
+ readonly connectTimeoutMs?: number;
1461
+ readonly drainPollMs?: number;
1462
+ readonly maxFrameBytes?: number;
1463
+ readonly maxPendingBytes?: number;
1464
+ readonly maxPendingFrames?: number;
1465
+ readonly highWaterBytes?: number;
1466
+ readonly maxListeners?: number;
1467
+ }
1468
+
1469
+ /** Input and channel schemas are not state schemas: sorted field names derive
1470
+ * their binary order, while server state always requires explicit field IDs. */
1471
+ declare class RoomStateCodec<S extends Schema.Codec<unknown, unknown>> {
1472
+ readonly schema: S;
1473
+ private readonly codec;
1474
+ constructor(schema: S, config?: Partial<RoomCodecLimits>);
1475
+ get schemaHash(): number;
1476
+ get limits(): RoomCodecLimits;
1477
+ /** Canonical binary layout, including quantization and static movement rules.
1478
+ * This is descriptive data; it grants neither authority nor a schema loader. */
1479
+ schemaDescription(): string;
1480
+ fieldManifest(): ReadonlyArray<RoomStateField>;
1481
+ transformRulesManifest(): ReadonlyArray<RoomStateTransformRules>;
1482
+ full(state: (S)["Type"]): Result.Result<Uint8Array, ProtocolError>;
1483
+ decodeFull(bytes: Uint8Array): Result.Result<(S)["Type"], ProtocolError>;
1484
+ delta(state: (S)["Type"], baseline: (S)["Type"], includeUnchanged?: boolean): Result.Result<Uint8Array | null, ProtocolError>;
1485
+ decodeDelta(bytes: Uint8Array, baseline: (S)["Type"]): Result.Result<(S)["Type"], ProtocolError>;
1486
+ }
1487
+
1488
+ declare interface RoomStateField {
1489
+ /** Parent scope is formed from field IDs, not mutable author field names. */
1490
+ readonly scope: string;
1491
+ readonly id: number;
1492
+ readonly name: string;
1493
+ }
1494
+
1495
+ declare interface RoomStateTransformRules {
1496
+ readonly scope: string;
1497
+ readonly rules: TransformRules;
1498
+ }
1499
+
1500
+ /** Incremental byte-stream framing only. Neither stream read boundaries nor
1501
+ * writes are frame boundaries. At most one bounded frame is retained, no
1502
+ * concatenation queue, SQL, transport, timer or authentication is owned. */
1503
+ export declare class RoomStreamFrameDecoder {
1504
+ private readonly options;
1505
+ private readonly header;
1506
+ private headerBytes;
1507
+ private payload;
1508
+ private payloadBytes;
1509
+ private ended;
1510
+ constructor(offered: RoomStreamFramingOptions);
1511
+ /** Received bytes retained for the next chunk, not allocated-buffer capacity. */
1512
+ get bufferedBytes(): number;
1513
+ push(offered: Uint8Array): ReadonlyArray<Uint8Array>;
1514
+ /** EOF is valid only between frames. A truncated header/body fails closed. */
1515
+ finish(): void;
1516
+ }
1517
+
1518
+ export declare interface RoomStreamFramingOptions {
1519
+ readonly maxFrameBytes: number;
1520
+ readonly maxChunkBytes: number;
1521
+ readonly maxFramesPerChunk: number;
1522
+ }
1523
+
1524
+ export declare interface RoomStreamTransportOptions extends RoomStreamFramingOptions {
1525
+ readonly reliable: RoomByteDuplex;
1526
+ readonly datagrams?: RoomByteDuplex & {
1527
+ readonly maxDatagramBytes: number;
1528
+ };
1529
+ readonly maxQueuedBytes: number;
1530
+ readonly maxListeners: number;
1531
+ readonly clock: Pick<RoomClock, 'now'>;
1532
+ readonly signal: AbortSignal;
1533
+ /** Release the actual transferred parent transport/session; await its close. */
1534
+ readonly release: (code: number, reason: string) => Promise<void>;
1535
+ }
1536
+
1537
+ export declare interface RoomTransport {
1538
+ readonly name: 'ws' | 'wt';
1539
+ readonly reliable: RoomReliableLane;
1540
+ readonly unreliable?: RoomDatagramLane | undefined;
1541
+ readonly signal: AbortSignal;
1542
+ stats(): {
1543
+ readonly rttMs: number | null;
1544
+ readonly queuedBytes: number;
1545
+ readonly droppedDatagrams: number;
1546
+ };
1547
+ close(code: number, reason: string): void;
1548
+ /** When provided, joins actual parent/stream withdrawal and permits retry.
1549
+ * Synchronous close alone does not establish native terminal evidence. */
1550
+ closeAsync?(code: number, reason: string): Promise<void>;
1551
+ }
1552
+
1553
+ /** Retains the actual transferred lifetime after a failed acquisition or
1554
+ * withdrawal. A deadline or a thrown close is never terminal evidence. */
1555
+ export declare class RoomTransportCleanupFailure extends Error {
1556
+ private readonly cleanup;
1557
+ readonly _tag = "RoomTransportCleanupFailure";
1558
+ private pending;
1559
+ private complete;
1560
+ constructor(cleanup: () => Promise<void>);
1561
+ cleanupAsync(): Promise<void>;
1562
+ }
1563
+
1564
+ /** Opens the advertised native endpoint first in auto mode. Only a completed
1565
+ * failed acquisition can fall back; incomplete cleanup retains its owner. No
1566
+ * browser/version guesses, bearer URL, Hello replay or post-admission switch. */
1567
+ export declare const roomTransportConnector: (options: RoomTransportConnectorOptions) => ((address: string, signal: AbortSignal, endpoints?: RoomTransportEndpoints) => Promise<RoomTransport>);
1568
+
1569
+ export declare interface RoomTransportConnectorOptions {
1570
+ readonly clock: Pick<RoomClock, 'now'>;
1571
+ readonly preference?: RoomTransportPreference | undefined;
1572
+ readonly socket?: RoomSocketTransportOptions | undefined;
1573
+ readonly webTransport?: Omit<RoomWebTransportClientOptions, 'clock'> | undefined;
1574
+ }
1575
+
1576
+ /** Public routing metadata only. Neither endpoint conveys seat authority. */
1577
+ export declare interface RoomTransportEndpoints {
1578
+ readonly ws: string;
1579
+ readonly wt?: string | undefined;
1580
+ /** Base64 SHA-256 of a short-lived development certificate the browser pins
1581
+ * through `serverCertificateHashes`. Absent for a publicly trusted certificate. */
1582
+ readonly wtCertificateHash?: string | undefined;
1583
+ }
1584
+
1585
+ export declare type RoomTransportPreference = 'auto' | 'ws' | 'wt';
1586
+
1587
+ export declare type RoomWebSocketFactory = (address: string) => RoomClientSocket;
1588
+
1589
+ export declare interface RoomWebTransportClientOptions extends RoomStreamFramingOptions {
1590
+ readonly factory?: RoomWebTransportFactory;
1591
+ readonly clock: Pick<RoomClock, 'now'>;
1592
+ readonly connectTimeoutMs: number;
1593
+ readonly maxQueuedBytes: number;
1594
+ readonly maxListeners: number;
1595
+ readonly maxDatagramBytes: number;
1596
+ }
1597
+
1598
+ /** `certificateHash` is the base64 SHA-256 of a pinned development certificate. */
1599
+ export declare type RoomWebTransportFactory = (address: string, certificateHash?: string) => RoomNativeWebTransport;
1600
+
1601
+ export declare interface RoomWireManifest<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> {
1602
+ readonly state: S;
1603
+ readonly input: I;
1604
+ readonly messages?: Readonly<Record<string, RoomChannel>>;
1605
+ }
1606
+
1607
+ /** Render/connection coordination only: no token and no ownership assertion. */
1608
+ export declare interface RoomWorldHandoffFrame {
1609
+ readonly kind: 'WorldHandoff';
1610
+ readonly phase: 'departed' | 'cancelled';
1611
+ readonly transitionId: string;
1612
+ readonly entityId: string;
1613
+ readonly tick: number;
1614
+ readonly sourceEpoch: number;
1615
+ readonly targetRoomId: string;
1616
+ readonly targetEpoch: number;
1617
+ readonly holdMs: number;
1618
+ }
1619
+
1620
+ declare class SeatExpired extends SeatExpired_base {
1621
+ }
1622
+
1623
+ declare const SeatExpired_base: Schema.Class<SeatExpired, Schema.TaggedStruct<"SeatExpired", {
1624
+ readonly sessionId: Schema.String;
1625
+ }>, YieldableError>;
1626
+
1627
+ declare type TransformRules = TransformRules2D | TransformRules3D;
1628
+
1629
+ declare interface TransformRules2D {
1630
+ readonly bounds: {
1631
+ readonly min: readonly [number, number];
1632
+ readonly max: readonly [number, number];
1633
+ };
1634
+ readonly maxSpeed: number;
1635
+ readonly maxAccel: number;
1636
+ readonly precision: number;
1637
+ readonly rotation?: {
1638
+ readonly bits: number;
1639
+ } | undefined;
1640
+ readonly velocity?: 'send' | 'derive' | 'none' | undefined;
1641
+ readonly interpolation: 'linear' | 'hermite' | 'none';
1642
+ readonly extrapolateMs: number;
1643
+ readonly teleportThreshold: number;
1644
+ }
1645
+
1646
+ declare interface TransformRules3D {
1647
+ readonly bounds: {
1648
+ readonly min: readonly [number, number, number];
1649
+ readonly max: readonly [number, number, number];
1650
+ };
1651
+ readonly maxSpeed: number;
1652
+ readonly maxAccel: number;
1653
+ readonly precision: number;
1654
+ readonly rotation?: {
1655
+ readonly bits: number;
1656
+ } | undefined;
1657
+ readonly interpolation: 'linear' | 'hermite' | 'none';
1658
+ readonly extrapolateMs: number;
1659
+ readonly teleportThreshold: number;
1660
+ }
1661
+
1662
+ /** Exact unsigned 64-bit integer as independent 32-bit words. */
1663
+ declare interface Uint64Words {
1664
+ readonly hi: number;
1665
+ readonly lo: number;
1666
+ }
1667
+
1668
+ declare type WorldBounds = readonly [minimum: WorldPoint, maximum: WorldPoint];
1669
+
1670
+ /** Client connection ownership only. SQL commit is confirmed by an explicit
1671
+ * authenticated provider; Welcome/assets/local status never prove that commit. */
1672
+ export declare class WorldClient<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> {
1673
+ private readonly options;
1674
+ private readonly input;
1675
+ private readonly handoffView;
1676
+ private handoffError;
1677
+ private readonly controller;
1678
+ private readonly commitWaitMs;
1679
+ private readonly listeners;
1680
+ private readonly queue;
1681
+ private readonly sends;
1682
+ private readonly receiptSubscriptions;
1683
+ private draining;
1684
+ private bytes;
1685
+ private active;
1686
+ private source;
1687
+ private target;
1688
+ private sourceGeometry;
1689
+ private targetGeometry;
1690
+ private recoveryGeometry;
1691
+ private preparingAssets;
1692
+ private earlyAssets;
1693
+ private earlyAssetController;
1694
+ private earlyAssetFailed;
1695
+ private readonly pendingAssetBundles;
1696
+ private readonly geometryAssets;
1697
+ private readonly geometryRenders;
1698
+ private detachSource;
1699
+ private detachTarget;
1700
+ private request;
1701
+ private prepared;
1702
+ private committed;
1703
+ private assetsReady;
1704
+ private operation;
1705
+ private closeTask;
1706
+ private closing;
1707
+ private currentError;
1708
+ private snapshot;
1709
+ constructor(offered: WorldClientOptions<S, I>);
1710
+ get observation(): WorldClientObservation;
1711
+ /** Actual selected connection identity; unknown while committed target ownership is reconciling. */
1712
+ get roomId(): string | null;
1713
+ get geometry(): RoomGeometryChunkCache | null;
1714
+ /** Actual selected source/target cache only, after confirmed transition
1715
+ * choice. Own render work separately from server transition/intent state. */
1716
+ renderGeometry(coordinate: GeometryPreparedCoordinate, distanceChunks: number): Promise<GeometryRenderLod>;
1717
+ get geometryRenderObservation(): ReturnType<GeometryRenderLodCache['observation']> | null;
1718
+ asset(key: string): GeometryVerifiedAsset;
1719
+ get assetObservation(): ReturnType<GeometryAssetBundle['observation']> | null;
1720
+ private admitGeometryAssets;
1721
+ private closeGeometry;
1722
+ get error(): ProtocolError | null;
1723
+ get state(): (S)["Type"] | null;
1724
+ deliveredSnapshot(): ReturnType<WorldClientRoom<S, I>['deliveredSnapshot']>;
1725
+ /** Render-only view. A retained source snapshot carries handoff=true and
1726
+ * must never feed prediction, input acknowledgements or authority decisions. */
1727
+ presentationSnapshot(): WorldHandoffPresentation<(S)["Type"]> | null;
1728
+ private presentationWork;
1729
+ subscribe(listener: () => void): () => void;
1730
+ private notify;
1731
+ private update;
1732
+ private admitRoom;
1733
+ private run;
1734
+ private stopReceipts;
1735
+ transition(requestId: string, intention: WorldTransitionRequest): Promise<void>;
1736
+ private beginRequest;
1737
+ /** Adopt an existing server request through its authenticated receipt. The
1738
+ * entity ID is presentation context, never authority. No preparation is sent. */
1739
+ adopt(requestId: string, entityId: string): Promise<void>;
1740
+ private beginAssetPrefetch;
1741
+ private closePendingAssetBundles;
1742
+ private acceptTicket;
1743
+ private acceptReceipt;
1744
+ private connectTarget;
1745
+ private connectAndCommit;
1746
+ private waitReceipt;
1747
+ private flush;
1748
+ private finishCommit;
1749
+ /** Unknown preparation/commit outcomes are reconciled through the same
1750
+ * authenticated request receipt. Never re-resolve or invent rollback. */
1751
+ resume(): Promise<void>;
1752
+ private reconcileRequest;
1753
+ /** Explicit native Session/root recovery, separate from SQL transition
1754
+ * reconciliation. No timer, default version, authorization or retry is guessed. */
1755
+ recoverGeometry(): Promise<void>;
1756
+ cancel(): Promise<void>;
1757
+ private finishRollback;
1758
+ send(input: (I)["Type"]): Promise<WorldClientInputReceipt>;
1759
+ private trackSend;
1760
+ /** Await owned client work/withdrawal only. Closing sockets never implies
1761
+ * server rollback, SQL deletion or removal of the retained transition. */
1762
+ close(): Promise<void>;
1763
+ }
1764
+
1765
+ declare interface WorldClientGeometryAssets<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> {
1766
+ readonly source?: GeometryAssetBundle;
1767
+ /** Authenticated catalogue/grants can start before target Welcome. Return
1768
+ * a complete owned bundle; final native geometry root is checked later. */
1769
+ readonly preload?: (ticket: WorldClientTicket, signal: AbortSignal) => Promise<GeometryAssetBundle>;
1770
+ /** Own a fully preloaded bundle for this genuine selected target cache. */
1771
+ readonly prepare: (target: WorldClientTargetRoom<S, I>, geometry: RoomGeometryChunkCache, ticket: WorldClientTicket, signal: AbortSignal) => Promise<GeometryAssetBundle>;
1772
+ readonly recover?: (source: WorldClientRoom<S, I>, geometry: RoomGeometryChunkCache, signal: AbortSignal) => Promise<GeometryAssetBundle>;
1773
+ }
1774
+
1775
+ export declare interface WorldClientGeometryBinding<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> {
1776
+ /** Actual immutable World catalogue for owned local render preparation. */
1777
+ readonly worlds?: ReadonlyArray<AnyWorldDescriptor> | undefined;
1778
+ readonly assets?: WorldClientGeometryAssets<S, I>;
1779
+ readonly render?: GeometryRenderLodCacheOptions;
1780
+ /** Explicit ownership transfers to this WorldClient, Session stays separate. */
1781
+ readonly source: RoomGeometryChunkCache;
1782
+ /** Actual current source manifest/authorization after reconnect/version change. */
1783
+ readonly recover?: (source: WorldClientRoom<S, I>, signal: AbortSignal) => Promise<RoomGeometryChunkCache>;
1784
+ /** Return a fully prefetched owned cache on the actual joined target. Must
1785
+ * join all acquisition/source work before settling, including abort. */
1786
+ readonly prepare: (target: WorldClientTargetRoom<S, I>, ticket: WorldClientTicket, signal: AbortSignal) => Promise<RoomGeometryChunkCache>;
1787
+ }
1788
+
1789
+ export declare interface WorldClientInputReceipt {
1790
+ readonly sourceSeq: number | null;
1791
+ readonly targetSeq: number | null;
1792
+ }
1793
+
1794
+ export declare interface WorldClientLocation {
1795
+ readonly worldId: string;
1796
+ readonly cellId: string;
1797
+ readonly layer: number;
1798
+ readonly roomId: string;
1799
+ readonly epoch: number;
1800
+ }
1801
+
1802
+ export declare interface WorldClientObservation {
1803
+ readonly status: WorldClientStatus;
1804
+ readonly step: WorldClientStep;
1805
+ readonly mode: 'seamless' | 'portal' | null;
1806
+ readonly bufferedInputs: number;
1807
+ readonly bufferedBytes: number;
1808
+ readonly committed: boolean;
1809
+ readonly error: 'incomplete' | null;
1810
+ }
1811
+
1812
+ export declare interface WorldClientOptions<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> {
1813
+ /** One bounded live-query wait outside the Room tick; default is a budget. */
1814
+ readonly commitWaitMs?: number;
1815
+ readonly subscribeReceipt?: (requestId: string, handlers: WorldClientReceiptHandlers, signal: AbortSignal) => WorldClientReceiptSubscription;
1816
+ readonly source: WorldClientRoom<S, I>;
1817
+ readonly geometry?: WorldClientGeometryBinding<S, I> | undefined;
1818
+ /** Bounded presentation continuity; never changes authoritative state/input. */
1819
+ readonly handoffView?: WorldHandoffViewOptions<(S)["Type"]>;
1820
+ readonly input: I;
1821
+ readonly maxBufferedInputs: number;
1822
+ readonly maxBufferedBytes: number;
1823
+ readonly maxInFlightInputs: number;
1824
+ /** All server calls must be authenticated, bounded and request-idempotent. */
1825
+ readonly prepare: (requestId: string, intention: WorldTransitionRequest, signal: AbortSignal) => Promise<WorldClientTicket>;
1826
+ readonly observe: (requestId: string, signal: AbortSignal) => Promise<WorldClientReceipt>;
1827
+ readonly commit: (ticket: WorldClientTicket, signal: AbortSignal) => Promise<WorldClientReceipt>;
1828
+ readonly cancel: (requestId: string, signal: AbortSignal) => Promise<WorldClientReceipt>;
1829
+ /** Returns an unopened owned connection. start must wait for its real Welcome. */
1830
+ readonly createTarget: (ticket: WorldClientTicket) => WorldClientTargetRoom<S, I>;
1831
+ readonly prefetchAssets: (ticket: WorldClientTicket, signal: AbortSignal) => Promise<void>;
1832
+ }
1833
+
1834
+ export declare interface WorldClientReceipt {
1835
+ readonly ticket: WorldClientTicket;
1836
+ readonly phase: 'prepared' | 'committed' | 'settled' | 'rolledBack';
1837
+ readonly entityRevision: number | null;
1838
+ }
1839
+
1840
+ export declare const worldClientReceipt: (input: unknown) => WorldClientReceipt;
1841
+
1842
+ export declare interface WorldClientReceiptHandlers {
1843
+ readonly onValue: (receipt: WorldClientReceipt) => void;
1844
+ readonly onError: (error: unknown) => void;
1845
+ }
1846
+
1847
+ export declare const WorldClientReceiptSchema: Schema.Struct<{
1848
+ readonly ticket: Schema.Struct<{
1849
+ readonly requestId: Schema.String;
1850
+ readonly transitionId: Schema.String;
1851
+ readonly mode: Schema.Literals<readonly ["seamless", "portal"]>;
1852
+ readonly target: Schema.Struct<{
1853
+ readonly worldId: Schema.String;
1854
+ readonly cellId: Schema.String;
1855
+ readonly layer: Schema.Int;
1856
+ readonly roomId: Schema.String;
1857
+ readonly epoch: Schema.Int;
1858
+ }>;
1859
+ }>;
1860
+ readonly phase: Schema.Literals<readonly ["prepared", "committed", "settled", "rolledBack"]>;
1861
+ readonly entityRevision: Schema.NullOr<Schema.Int>;
1862
+ }>;
1863
+
1864
+ export declare interface WorldClientReceiptSubscription {
1865
+ unsubscribe(): void;
1866
+ }
1867
+
1868
+ /** SQL origin IDs include the group command hash and full entity identity. */
1869
+ export declare const WorldClientRequestIdSchema: Schema.String;
1870
+
1871
+ export declare type WorldClientRoom<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> = Pick<RoomConnection<S, I, unknown>, 'status' | 'state' | 'roomId' | 'send' | 'subscribe' | 'leave' | 'deliveredSnapshot'>;
1872
+
1873
+ export declare type WorldClientStatus = 'idle' | 'preparing' | 'loading' | 'switching' | 'settled' | 'failed' | 'closed';
1874
+
1875
+ export declare type WorldClientStep = 'reserve' | 'connect' | 'welcome' | 'geometry' | 'assets' | 'commit' | 'cleanup' | null;
1876
+
1877
+ export declare interface WorldClientTargetRoom<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>> extends WorldClientRoom<S, I> {
1878
+ start(ticket: WorldClientTicket): Promise<void>;
1879
+ }
1880
+
1881
+ /** Authenticated server preparation, never player-supplied authority or state. */
1882
+ export declare interface WorldClientTicket {
1883
+ readonly requestId: string;
1884
+ readonly transitionId: string;
1885
+ readonly mode: 'seamless' | 'portal';
1886
+ readonly target: WorldClientLocation;
1887
+ }
1888
+
1889
+ export declare const worldClientTicket: (input: unknown) => WorldClientTicket;
1890
+
1891
+ export declare const WorldClientTicketSchema: Schema.Struct<{
1892
+ readonly requestId: Schema.String;
1893
+ readonly transitionId: Schema.String;
1894
+ readonly mode: Schema.Literals<readonly ["seamless", "portal"]>;
1895
+ readonly target: Schema.Struct<{
1896
+ readonly worldId: Schema.String;
1897
+ readonly cellId: Schema.String;
1898
+ readonly layer: Schema.Int;
1899
+ readonly roomId: Schema.String;
1900
+ readonly epoch: Schema.Int;
1901
+ }>;
1902
+ }>;
1903
+
1904
+ declare interface WorldDefinition<Player> {
1905
+ readonly name: string;
1906
+ readonly map: {
1907
+ readonly bounds: WorldBounds;
1908
+ };
1909
+ readonly zones: ReadonlyArray<WorldZone>;
1910
+ readonly instances?: ReadonlyArray<WorldInstance>;
1911
+ readonly persistence: {
1912
+ readonly entities: 'world';
1913
+ readonly snapshotEveryMs: number;
1914
+ readonly journal: boolean;
1915
+ };
1916
+ readonly handoff: {
1917
+ readonly marginUnits: number;
1918
+ readonly ghostUnits: number;
1919
+ };
1920
+ readonly spawn: (context: {
1921
+ readonly player: Player;
1922
+ }) => WorldPosition;
1923
+ readonly geometry?: WorldGeometryDefinition | undefined;
1924
+ readonly hosts?: {
1925
+ readonly pool: string;
1926
+ };
1927
+ readonly characters?: 'shared' | 'per-world';
1928
+ readonly transitionCooldownMs?: number;
1929
+ /** Authoring inventory bounds, not measured runtime capacity. */
1930
+ readonly budgets?: {
1931
+ readonly maxZones?: number;
1932
+ readonly maxCells?: number | undefined;
1933
+ readonly maxInstances?: number;
1934
+ };
1935
+ readonly strategies?: {
1936
+ readonly layerPolicy?: WorldLayerPolicy | undefined;
1937
+ readonly transitionPolicy?: WorldTransitionPolicy;
1938
+ readonly onWorldChange?: WorldOnWorldChange;
1939
+ };
1940
+ }
1941
+
1942
+ declare interface WorldDescriptor<Player> extends Omit<WorldDefinition<Player>, 'instances' | 'budgets' | 'characters' | 'transitionCooldownMs' | 'strategies' | 'geometry'> {
1943
+ readonly geometry?: WorldGeometryDescriptor | undefined;
1944
+ readonly _tag: 'WorldDescriptor';
1945
+ readonly instances: ReadonlyArray<Omit<WorldInstance, 'ttl'> & {
1946
+ readonly ttlMs: number;
1947
+ }>;
1948
+ readonly budgets: {
1949
+ readonly maxZones: number;
1950
+ readonly maxCells: number;
1951
+ readonly maxInstances: number;
1952
+ };
1953
+ readonly characters: 'shared' | 'per-world';
1954
+ readonly transitionCooldownMs: number;
1955
+ readonly cellCount: number;
1956
+ readonly strategies: {
1957
+ readonly layerPolicy: WorldLayerPolicy;
1958
+ readonly transitionPolicy: WorldTransitionPolicy;
1959
+ readonly onWorldChange: WorldOnWorldChange;
1960
+ };
1961
+ }
1962
+
1963
+ export declare interface WorldEntityHandoffProjection<E> {
1964
+ readonly transitionId: string;
1965
+ readonly entityId: string;
1966
+ readonly sourceRoomId: string;
1967
+ readonly sourceEpoch: number;
1968
+ readonly sourceTick: number;
1969
+ readonly receivedAt: number;
1970
+ readonly targetRoomId: string;
1971
+ readonly targetEpoch: number;
1972
+ readonly expiresAt: number;
1973
+ readonly entity: E;
1974
+ }
1975
+
1976
+ export declare type WorldEntityHandoffView<S, E> = ReturnType<typeof makeWorldEntityHandoffView<S, E>>;
1977
+
1978
+ export declare interface WorldEntityHandoffViewOptions<S, E> {
1979
+ readonly maxEntities: number;
1980
+ readonly maxBytes: number;
1981
+ readonly maxHoldMs: number;
1982
+ readonly maxConnections: number;
1983
+ readonly now: () => number;
1984
+ /** Authoritative entity only. Never return a pending preview or neighbor ghost. */
1985
+ readonly entity: (state: S, entityId: string) => E | undefined;
1986
+ }
1987
+
1988
+ declare interface WorldGeometryDefinition {
1989
+ readonly strategies?: WorldGeometryStrategies | undefined;
1990
+ readonly kind: GeometryKind;
1991
+ readonly static: GeometrySource;
1992
+ readonly chunkSize?: number;
1993
+ readonly dynamic?: {
1994
+ readonly enabled?: boolean | undefined;
1995
+ readonly maxDeltaBytesPerChunk?: number;
1996
+ readonly persist?: {
1997
+ readonly everyMs?: number;
1998
+ readonly onUnload?: boolean;
1999
+ };
2000
+ };
2001
+ readonly collision?: {
2002
+ readonly derive?: 'bitgrid' | 'heightfield' | 'shapes';
2003
+ readonly resolution?: number;
2004
+ };
2005
+ readonly nav?: {
2006
+ readonly derive?: 'grid' | 'none';
2007
+ readonly navBudgetMs?: number;
2008
+ readonly maxAdvanceSteps?: number;
2009
+ };
2010
+ readonly streaming?: {
2011
+ readonly client?: {
2012
+ readonly radiusChunks?: number;
2013
+ readonly prefetchChunks?: number;
2014
+ readonly maxConcurrent?: number | undefined;
2015
+ readonly maxCachedChunks?: number;
2016
+ };
2017
+ readonly cell?: {
2018
+ readonly marginChunks?: number;
2019
+ };
2020
+ };
2021
+ readonly lod?: ReadonlyArray<{
2022
+ readonly beyondChunks: number;
2023
+ readonly fields: ReadonlyArray<string>;
2024
+ }>;
2025
+ readonly budgets?: {
2026
+ readonly maxPreparedChunks?: number;
2027
+ readonly maxPreparedBytes?: number;
2028
+ readonly maxLodLevels?: number;
2029
+ readonly maxRayCells?: number | undefined;
2030
+ readonly maxOverlapTests?: number | undefined;
2031
+ };
2032
+ }
2033
+
2034
+ declare interface WorldGeometryDescriptor {
2035
+ readonly strategies: GeometryEditStrategies & GeometryDerivationStrategies & GeometryCompactionStrategies & {
2036
+ readonly migrateDelta: GeometryMigrateDelta;
2037
+ };
2038
+ readonly _tag: 'WorldGeometry';
2039
+ readonly kind: GeometryKind;
2040
+ readonly static: GeometrySource;
2041
+ readonly chunkSize: number;
2042
+ readonly chunkSizeRaw: number;
2043
+ readonly dynamic: {
2044
+ readonly enabled: boolean;
2045
+ readonly maxDeltaBytesPerChunk: number;
2046
+ readonly persist: {
2047
+ readonly everyMs: number;
2048
+ readonly onUnload: boolean;
2049
+ };
2050
+ };
2051
+ readonly collision: {
2052
+ readonly derive: 'bitgrid' | 'heightfield' | 'shapes';
2053
+ readonly resolution: number;
2054
+ readonly resolutionRaw: number;
2055
+ };
2056
+ readonly nav: {
2057
+ readonly derive: 'grid' | 'none';
2058
+ readonly navBudgetMs: number;
2059
+ readonly maxAdvanceSteps: number;
2060
+ };
2061
+ readonly streaming: {
2062
+ readonly client: {
2063
+ readonly radiusChunks: number;
2064
+ readonly prefetchChunks: number;
2065
+ readonly maxConcurrent: number;
2066
+ readonly maxCachedChunks: number;
2067
+ };
2068
+ readonly cell: {
2069
+ readonly marginChunks: number;
2070
+ };
2071
+ };
2072
+ readonly lod: ReadonlyArray<{
2073
+ readonly beyondChunks: number;
2074
+ readonly fields: ReadonlyArray<string>;
2075
+ }>;
2076
+ readonly budgets: {
2077
+ readonly maxPreparedChunks: number;
2078
+ readonly maxPreparedBytes: number;
2079
+ readonly maxLodLevels: number;
2080
+ readonly maxRayCells: number;
2081
+ readonly maxOverlapTests: number;
2082
+ };
2083
+ }
2084
+
2085
+ declare interface WorldGeometryStrategies extends GeometryVersionMigrationStrategies, Partial<GeometryEditStrategies>, Partial<GeometryDerivationStrategies>, Partial<GeometryCompactionStrategies> {
2086
+ }
2087
+
2088
+ export declare interface WorldHandoffConnection<S> {
2089
+ deliveredSnapshot(): RoomDeliveredState<S> | null;
2090
+ onWorldHandoff(listener: (frame: RoomWorldHandoffFrame) => void): () => void;
2091
+ subscribe(listener: () => void): () => void;
2092
+ }
2093
+
2094
+ export declare interface WorldHandoffPresentation<S> {
2095
+ readonly snapshot: RoomDeliveredState<S>;
2096
+ readonly handoff: boolean;
2097
+ readonly requestId?: string | undefined;
2098
+ readonly entityId?: string;
2099
+ }
2100
+
2101
+ export declare type WorldHandoffView<S> = ReturnType<typeof makeWorldHandoffView<S>>;
2102
+
2103
+ export declare interface WorldHandoffViewOptions<S> {
2104
+ readonly maxBytes: number;
2105
+ readonly maxHoldMs: number;
2106
+ readonly now: () => number;
2107
+ /** Synchronous author projection: true only for an authoritative entity in
2108
+ * this delivered view, never a pending preview or neighbor ghost. */
2109
+ readonly contains: (state: S, entityId: string) => boolean;
2110
+ }
2111
+
2112
+ declare interface WorldInstance {
2113
+ readonly id: string;
2114
+ readonly room: string;
2115
+ readonly maxGroups: number;
2116
+ readonly ttl: Duration.Input;
2117
+ }
2118
+
2119
+ declare type WorldLayerDecision = {
2120
+ readonly kind: 'use';
2121
+ readonly layer: number;
2122
+ readonly wake: boolean;
2123
+ } | {
2124
+ readonly kind: 'create';
2125
+ readonly layer: number;
2126
+ } | {
2127
+ readonly kind: 'blocked';
2128
+ readonly reason: 'affinity-unavailable' | 'capacity' | 'layer-budget';
2129
+ };
2130
+
2131
+ declare interface WorldLayering {
2132
+ readonly maxPlayers: number;
2133
+ readonly splitAt: number;
2134
+ readonly mergeBelow: number;
2135
+ }
2136
+
2137
+ declare interface WorldLayerInput {
2138
+ readonly policy: WorldLayering;
2139
+ readonly layers: ReadonlyArray<WorldLayerObservation>;
2140
+ readonly groupSize: number;
2141
+ /** Actual server-owned party affinity; never silently choose a different layer. */
2142
+ readonly affinity: number | null;
2143
+ readonly maxLayers: number;
2144
+ }
2145
+
2146
+ declare interface WorldLayerObservation {
2147
+ readonly layer: number;
2148
+ readonly players: number;
2149
+ readonly state: 'live' | 'hibernated' | 'splitting' | 'merging';
2150
+ }
2151
+
2152
+ declare type WorldLayerPolicy = (input: WorldLayerInput) => WorldLayerDecision;
2153
+
2154
+ declare type WorldOnWorldChange = (input: WorldOnWorldChangeInput) => unknown;
2155
+
2156
+ declare interface WorldOnWorldChangeInput {
2157
+ readonly sourceWorldId: string;
2158
+ readonly targetWorldId: string;
2159
+ /** Current server-captured character data, never a player's wire state. */
2160
+ readonly sourceData: unknown;
2161
+ /** Actual server-selected target data before this policy. */
2162
+ readonly targetData: unknown;
2163
+ }
2164
+
2165
+ declare type WorldPoint = readonly [x: number, y: number];
2166
+
2167
+ declare interface WorldPosition {
2168
+ readonly zone: string;
2169
+ readonly at: WorldPoint;
2170
+ }
2171
+
2172
+ /** The ordinary Promise client's call boundary. An Effect RPC runtime can
2173
+ * supply the same boundary by running its real generated client method. */
2174
+ export declare interface WorldRpcControls {
2175
+ readonly subscribeReceipt?: (requestId: string, handlers: WorldClientReceiptHandlers, signal: AbortSignal) => WorldClientReceiptSubscription;
2176
+ prepare(requestId: string, intention: WorldTransitionRequest, signal: AbortSignal): Promise<WorldClientTicket>;
2177
+ observe(requestId: string, signal: AbortSignal): Promise<WorldClientReceipt>;
2178
+ commit(ticket: WorldClientTicket, signal: AbortSignal): Promise<WorldClientReceipt>;
2179
+ cancel(requestId: string, signal: AbortSignal): Promise<WorldClientReceipt>;
2180
+ }
2181
+
2182
+ /** Transition providers for WorldClient's normal authenticated RPC calls. */
2183
+ export declare const worldRpcControls: (client: RoomRpcCaller) => WorldRpcControls;
2184
+
2185
+ /** Explicit settled-group follower provider; never an automatic fallback from a refused reservation. */
2186
+ export declare const worldRpcFollowerReservations: (client: RoomRpcCaller) => RoomReservationClient<WorldClientTicket>;
2187
+
2188
+ export declare interface WorldRpcPending {
2189
+ pending(input: {
2190
+ readonly entityId: string;
2191
+ readonly roomId: string;
2192
+ }, signal: AbortSignal): Promise<WorldClientReceipt | null>;
2193
+ readonly subscribePending?: (input: {
2194
+ readonly entityId: string;
2195
+ readonly roomId: string;
2196
+ }, handlers: {
2197
+ readonly onValue: (receipt: WorldClientReceipt | null) => void;
2198
+ readonly onError: (error: unknown) => void;
2199
+ }, signal: AbortSignal) => WorldClientReceiptSubscription;
2200
+ }
2201
+
2202
+ /** Own active server-request discovery; separate from transition providers. */
2203
+ export declare const worldRpcPending: (client: RoomRpcCaller) => WorldRpcPending;
2204
+
2205
+ export declare const worldRpcReservations: (client: RoomRpcCaller) => RoomReservationClient<WorldClientTicket>;
2206
+
2207
+ declare type WorldTransitionKind = 'cell' | 'layer' | 'zone' | 'world' | 'instance' | 'return' | 'recover';
2208
+
2209
+ declare interface WorldTransitionLocation extends WorldPosition {
2210
+ readonly world: string;
2211
+ readonly pool: string;
2212
+ readonly layer: number;
2213
+ readonly instance: string | null;
2214
+ }
2215
+
2216
+ declare type WorldTransitionMode = 'seamless' | 'portal' | 'recover';
2217
+
2218
+ declare interface WorldTransitionPlan {
2219
+ readonly kind: WorldTransitionKind;
2220
+ readonly mode: WorldTransitionMode;
2221
+ readonly crossPool: boolean;
2222
+ readonly persistBeforeRelease: boolean;
2223
+ readonly sourceCell: string;
2224
+ readonly targetCell: string;
2225
+ }
2226
+
2227
+ declare type WorldTransitionPolicy = (input: WorldTransitionPolicyInput) => WorldTransitionPlan;
2228
+
2229
+ declare interface WorldTransitionPolicyInput {
2230
+ readonly kind: WorldTransitionKind;
2231
+ readonly sourceWorld: AnyWorldDescriptor;
2232
+ readonly targetWorld: AnyWorldDescriptor;
2233
+ readonly source: WorldTransitionLocation;
2234
+ readonly target: WorldTransitionLocation;
2235
+ readonly mode: WorldTransitionMode | 'auto';
2236
+ readonly crossPool: boolean;
2237
+ /** Trusted server recovery classification, not a player intention field. */
2238
+ readonly recovery: boolean;
2239
+ }
2240
+
2241
+ declare type WorldTransitionRequest = typeof WorldTransitionRequestSchema.Type;
2242
+
2243
+ declare const WorldTransitionRequestSchema: Schema.Struct<{
2244
+ readonly entityId: Schema.String;
2245
+ readonly target: Schema.Union<readonly [Schema.Struct<{
2246
+ readonly kind: Schema.Literal<"cell">;
2247
+ readonly zone: Schema.String;
2248
+ readonly at: Schema.Tuple<readonly [Schema.Number, Schema.Number]>;
2249
+ }>, Schema.Struct<{
2250
+ readonly kind: Schema.Literal<"zone">;
2251
+ readonly zone: Schema.String;
2252
+ readonly at: Schema.Tuple<readonly [Schema.Number, Schema.Number]>;
2253
+ }>, Schema.Struct<{
2254
+ readonly kind: Schema.Literal<"layer">;
2255
+ readonly layer: Schema.Number;
2256
+ }>, Schema.Struct<{
2257
+ readonly kind: Schema.Literal<"world">;
2258
+ readonly world: Schema.String;
2259
+ readonly spawn: Schema.String;
2260
+ }>, Schema.Struct<{
2261
+ readonly kind: Schema.Literal<"instance">;
2262
+ readonly instance: Schema.String;
2263
+ readonly group: Schema.String;
2264
+ }>, Schema.Struct<{
2265
+ readonly kind: Schema.Literal<"return">;
2266
+ }>]>;
2267
+ readonly options: Schema.Struct<{
2268
+ readonly mode: Schema.Literals<readonly ["auto", "seamless", "portal"]>;
2269
+ readonly reason: Schema.String;
2270
+ readonly crossPool: Schema.Boolean;
2271
+ readonly returnTo: Schema.optional<Schema.Literal<"here">>;
2272
+ }>;
2273
+ }>;
2274
+
2275
+ declare interface WorldZone {
2276
+ readonly id: string;
2277
+ readonly bounds: WorldBounds;
2278
+ readonly room: string;
2279
+ readonly neighbors: ReadonlyArray<string>;
2280
+ readonly cells?: {
2281
+ readonly size: number;
2282
+ } | undefined;
2283
+ readonly layering?: WorldLayering;
2284
+ }
2285
+
2286
+ export { }