@voltro/plugin-rooms 0.0.0-stage → 0.88.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24492 -0
- package/LICENSE +61 -0
- package/README.md +9204 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +12496 -0
- package/dist/actor.js +1473 -0
- package/dist/apiBinding.js +677 -0
- package/dist/apiRegistryBinding.js +398 -0
- package/dist/apiReservations.js +432 -0
- package/dist/baselines.js +72 -0
- package/dist/bots.d.ts +1485 -0
- package/dist/bots.js +562 -0
- package/dist/catalog.js +79 -0
- package/dist/checkpointJson.js +23 -0
- package/dist/checkpointStore.js +385 -0
- package/dist/client.js +55 -0
- package/dist/clockSync.js +50 -0
- package/dist/collision.js +155 -0
- package/dist/commandDelivery.js +100 -0
- package/dist/commandRecord.js +10 -0
- package/dist/commandWithdrawal.js +182 -0
- package/dist/connection.js +496 -0
- package/dist/controlCarrier.js +374 -0
- package/dist/controlRegistry.js +78 -0
- package/dist/controlTarget.js +44 -0
- package/dist/controlTransport.js +573 -0
- package/dist/developmentBinding.js +112 -0
- package/dist/directory.js +322 -0
- package/dist/directoryProjection.js +116 -0
- package/dist/errors.d.ts +125 -0
- package/dist/errors.js +52 -0
- package/dist/fixed.d.ts +284 -0
- package/dist/fixed.js +10 -0
- package/dist/fixed32.js +133 -0
- package/dist/fixedCollision.js +59 -0
- package/dist/fixedCollision32.js +108 -0
- package/dist/fixedMath.js +55 -0
- package/dist/fixedRaw.js +10 -0
- package/dist/fixedSlabs.js +33 -0
- package/dist/fixedTrig.js +47 -0
- package/dist/fixedTrig32.js +37 -0
- package/dist/fixedVectors.js +112 -0
- package/dist/fixedVectors32.js +94 -0
- package/dist/fixedWide.js +49 -0
- package/dist/fixedWords.js +45 -0
- package/dist/gateway.js +56 -0
- package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.server.tsx +4 -0
- package/dist/geometry-retention-app/rooms.geometryJournalRetention.workflow.tsx +14 -0
- package/dist/geometry-worker/worker.d.mts +2 -0
- package/dist/geometry-worker/worker.mjs +50 -0
- package/dist/geometry.d.ts +2249 -0
- package/dist/geometry.js +40 -0
- package/dist/geometryActivation.js +81 -0
- package/dist/geometryActorInventory.js +107 -0
- package/dist/geometryAdminClient.js +86 -0
- package/dist/geometryAdminData.js +31 -0
- package/dist/geometryAdminFixtures.js +49 -0
- package/dist/geometryAdminPorts.js +4 -0
- package/dist/geometryAdminRpc.js +57 -0
- package/dist/geometryAdminRpcRoutes.js +48 -0
- package/dist/geometryAdminSchemas.js +38 -0
- package/dist/geometryAdministration.js +189 -0
- package/dist/geometryAdministrationPorts.js +4 -0
- package/dist/geometryApiBinding.js +164 -0
- package/dist/geometryAppStorage.js +57 -0
- package/dist/geometryArtifacts.js +197 -0
- package/dist/geometryAssetBundle.js +116 -0
- package/dist/geometryAssetClient.js +24 -0
- package/dist/geometryAssetData.js +105 -0
- package/dist/geometryAssetHttp.js +122 -0
- package/dist/geometryAssetPorts.js +4 -0
- package/dist/geometryAssetRpc.js +29 -0
- package/dist/geometryAssetRpcRoutes.js +39 -0
- package/dist/geometryAssetStorageGrant.js +102 -0
- package/dist/geometryBoxOverlap.js +109 -0
- package/dist/geometryCatalogueDigest.js +110 -0
- package/dist/geometryCellCoverage.js +84 -0
- package/dist/geometryCellLoader.js +27 -0
- package/dist/geometryChannel.js +133 -0
- package/dist/geometryChunkHttp.js +53 -0
- package/dist/geometryChunkLeases.js +21 -0
- package/dist/geometryClient.d.ts +1429 -0
- package/dist/geometryClient.js +148 -0
- package/dist/geometryClientChunks.js +329 -0
- package/dist/geometryClientDelta.js +24 -0
- package/dist/geometryClientHttp.js +36 -0
- package/dist/geometryClientInterest.js +108 -0
- package/dist/geometryClientStatic.js +33 -0
- package/dist/geometryCms.d.ts +763 -0
- package/dist/geometryCms.js +216 -0
- package/dist/geometryCommitCoordinator.js +240 -0
- package/dist/geometryCompactionFixture.js +83 -0
- package/dist/geometryCompactionStrategies.js +37 -0
- package/dist/geometryConnectionClient.js +22 -0
- package/dist/geometryDerivationFixtures.js +140 -0
- package/dist/geometryDerivationStrategies.js +26 -0
- package/dist/geometryDigest.js +12 -0
- package/dist/geometryEditChannel.js +69 -0
- package/dist/geometryEditIngress.js +262 -0
- package/dist/geometryEdits.js +365 -0
- package/dist/geometryEnvelope.js +40 -0
- package/dist/geometryGridRaycast.js +91 -0
- package/dist/geometryGridSweep.js +91 -0
- package/dist/geometryHeightfield.js +165 -0
- package/dist/geometryHeightfieldRaycast.js +73 -0
- package/dist/geometryHeightfieldSweep.js +84 -0
- package/dist/geometryHeightfieldVolume.js +44 -0
- package/dist/geometryHost.js +321 -0
- package/dist/geometryHostDirectory.js +206 -0
- package/dist/geometryHostMutations.js +136 -0
- package/dist/geometryHostStreams.js +123 -0
- package/dist/geometryHttpBody.js +75 -0
- package/dist/geometryHttpRoutes.js +111 -0
- package/dist/geometryImportGltf.js +299 -0
- package/dist/geometryImportLdtk.js +53 -0
- package/dist/geometryImportPng.js +143 -0
- package/dist/geometryImportPublication.js +66 -0
- package/dist/geometryImportTiled.js +38 -0
- package/dist/geometryImportTiles.js +135 -0
- package/dist/geometryImportVox.js +129 -0
- package/dist/geometryImportedSource.js +100 -0
- package/dist/geometryInspectEndpoint.js +247 -0
- package/dist/geometryInspection.js +91 -0
- package/dist/geometryInstall.js +120 -0
- package/dist/geometryJournalArchiveData.js +20 -0
- package/dist/geometryJournalArchiveIndex.js +329 -0
- package/dist/geometryJournalArchiveTable.js +20 -0
- package/dist/geometryJournalCompaction.js +99 -0
- package/dist/geometryJournalPatch.js +46 -0
- package/dist/geometryJournalRetention.js +111 -0
- package/dist/geometryJournalRetentionSchemas.js +35 -0
- package/dist/geometryJournalRetentionSweep.js +111 -0
- package/dist/geometryJournalRetentionWorkflow.js +27 -0
- package/dist/geometryJournalRetentionWorkflowData.js +30 -0
- package/dist/geometryJournalStorage.js +147 -0
- package/dist/geometryLoader.js +117 -0
- package/dist/geometryManifest.js +112 -0
- package/dist/geometryManifestChannel.js +92 -0
- package/dist/geometryManifestClient.js +121 -0
- package/dist/geometryManifestData.js +48 -0
- package/dist/geometryManifestPorts.js +4 -0
- package/dist/geometryManifestPublication.js +108 -0
- package/dist/geometryManifestSource.js +67 -0
- package/dist/geometryMigrationJournal.js +13 -0
- package/dist/geometryMigrationStrategies.js +6 -0
- package/dist/geometryMigrations.js +322 -0
- package/dist/geometryNativeMetadata.js +51 -0
- package/dist/geometryPatch.js +169 -0
- package/dist/geometryPersistence.js +448 -0
- package/dist/geometryPersistenceCapture.js +68 -0
- package/dist/geometryPersistenceData.js +139 -0
- package/dist/geometryPersistencePorts.js +4 -0
- package/dist/geometryPlayerAdmission.js +33 -0
- package/dist/geometryPlayerEditOwner.js +264 -0
- package/dist/geometryPlayerEdits.js +48 -0
- package/dist/geometryPrepared.js +187 -0
- package/dist/geometryPrivacyFence.js +23 -0
- package/dist/geometryProceduralPublication.js +90 -0
- package/dist/geometryProceduralWorker.js +163 -0
- package/dist/geometryPublication.js +109 -0
- package/dist/geometryRayAlgebra.js +115 -0
- package/dist/geometryReadClient.js +156 -0
- package/dist/geometryReadPorts.js +4 -0
- package/dist/geometryReadRpc.js +26 -0
- package/dist/geometryReadRpcRoutes.js +46 -0
- package/dist/geometryReliablePublication.js +81 -0
- package/dist/geometryReloadPorts.js +45 -0
- package/dist/geometryReloadSource.js +277 -0
- package/dist/geometryRenderCache.js +164 -0
- package/dist/geometryRenderLod.js +101 -0
- package/dist/geometryRollback.js +124 -0
- package/dist/geometryRollbackCoordinator.js +202 -0
- package/dist/geometryRollbackPorts.js +45 -0
- package/dist/geometryRollbackSource.js +208 -0
- package/dist/geometryRollbackStore.js +197 -0
- package/dist/geometrySchemas.js +26 -0
- package/dist/geometryServer.d.ts +2766 -0
- package/dist/geometryServer.js +62 -0
- package/dist/geometryShapeRaycast.js +110 -0
- package/dist/geometryShapeSegments.js +33 -0
- package/dist/geometryShapes.js +222 -0
- package/dist/geometrySnapshot.js +75 -0
- package/dist/geometrySnapshotChannel.js +159 -0
- package/dist/geometrySnapshotClient.js +158 -0
- package/dist/geometrySnapshotPreparation.js +75 -0
- package/dist/geometrySnapshotServer.js +190 -0
- package/dist/geometrySqlOwner.js +20 -0
- package/dist/geometryStorage.js +126 -0
- package/dist/geometryStorageGrant.js +68 -0
- package/dist/geometryStorageIdentity.js +8 -0
- package/dist/geometryTileArtifact.js +9 -0
- package/dist/geometryTileCodec.js +193 -0
- package/dist/geometryTileCollision.js +95 -0
- package/dist/geometryTileNavigation.js +127 -0
- package/dist/geometryTileView.js +34 -0
- package/dist/geometryVersionActivation.js +113 -0
- package/dist/geometryVersionClient.js +237 -0
- package/dist/geometryVersionCompare.js +39 -0
- package/dist/geometryVersionMigration.js +105 -0
- package/dist/geometryVoxel.js +252 -0
- package/dist/geometryWorldEntitySubject.js +31 -0
- package/dist/geometryWorldExtent.js +11 -0
- package/dist/geometryWorldMetadata.js +37 -0
- package/dist/geometryWorldStrategyFixtures.js +126 -0
- package/dist/geometryWorldView.js +306 -0
- package/dist/host.js +127 -0
- package/dist/hostBinding.js +276 -0
- package/dist/hostCellObservation.js +113 -0
- package/dist/hostClientCapacity.js +89 -0
- package/dist/hostCommandScope.js +63 -0
- package/dist/hostController.js +3093 -0
- package/dist/hostDeployment.js +64 -0
- package/dist/hostDrain.js +151 -0
- package/dist/hostDrainPorts.js +4 -0
- package/dist/hostDriver.js +178 -0
- package/dist/hostLane.js +287 -0
- package/dist/hostListener.js +78 -0
- package/dist/hostListenerBinding.js +18 -0
- package/dist/hostLoopObservation.js +89 -0
- package/dist/hostMetrics.js +55 -0
- package/dist/hostRegistryBinding.js +417 -0
- package/dist/hostSelection.js +15 -0
- package/dist/hostShutdown.js +46 -0
- package/dist/hostTurnObservation.js +52 -0
- package/dist/identities.js +3 -0
- package/dist/index.d.ts +8632 -0
- package/dist/index.js +231 -0
- package/dist/inputReceipts.js +62 -0
- package/dist/inputRedundancy.js +54 -0
- package/dist/inspect.js +237 -0
- package/dist/lockstep.d.ts +436 -0
- package/dist/lockstep.js +381 -0
- package/dist/lockstepAdmission.js +261 -0
- package/dist/lockstepAdmissionCodec.js +93 -0
- package/dist/lockstepAdmissionPorts.js +4 -0
- package/dist/lockstepClientSession.js +577 -0
- package/dist/lockstepDefinition.js +147 -0
- package/dist/lockstepHostLoop.js +242 -0
- package/dist/lockstepInitialAdmission.js +66 -0
- package/dist/lockstepInitialStrategyFixtures.js +44 -0
- package/dist/lockstepJournal.js +394 -0
- package/dist/lockstepJournalCodec.js +253 -0
- package/dist/lockstepJournalPorts.js +4 -0
- package/dist/lockstepJournalRebuild.js +207 -0
- package/dist/lockstepJournalRows.js +56 -0
- package/dist/lockstepMembers.js +130 -0
- package/dist/lockstepMessages.js +46 -0
- package/dist/lockstepOwnedRoom.js +763 -0
- package/dist/lockstepPolicies.js +83 -0
- package/dist/lockstepReact.js +46 -0
- package/dist/lockstepRecoveryTruth.js +120 -0
- package/dist/lockstepRosterConfig.js +31 -0
- package/dist/lockstepSeed.js +11 -0
- package/dist/lockstepSeedFixture.js +19 -0
- package/dist/lockstepServer.d.ts +3897 -0
- package/dist/lockstepServer.js +324 -0
- package/dist/lockstepServerConfig.js +100 -0
- package/dist/lockstepServerRoles.js +402 -0
- package/dist/lockstepServerStrategyFixtures.js +32 -0
- package/dist/lockstepStrategies.js +5 -0
- package/dist/lockstepStrategyFixtures.js +136 -0
- package/dist/lockstepTerminal.js +89 -0
- package/dist/lockstepTerminalPorts.js +4 -0
- package/dist/lockstepTransport.js +772 -0
- package/dist/lockstepTransportConfig.js +31 -0
- package/dist/lockstepWireRoster.js +33 -0
- package/dist/matchRoomProvider.js +31 -0
- package/dist/matchRooms.js +18 -0
- package/dist/membershipObserver.js +46 -0
- package/dist/moderation.js +97 -0
- package/dist/movementSpecials.js +103 -0
- package/dist/ownership.js +16 -0
- package/dist/ownershipWithdrawal.js +17 -0
- package/dist/pcg32.js +95 -0
- package/dist/ports.d.ts +1241 -0
- package/dist/ports.js +10 -0
- package/dist/quaternion.js +69 -0
- package/dist/react.d.ts +406 -0
- package/dist/react.js +108 -0
- package/dist/reaper-app/rooms.reaper.workflow.server.tsx +5 -0
- package/dist/reaper-app/rooms.reaper.workflow.tsx +13 -0
- package/dist/reaper.js +242 -0
- package/dist/reaperSchemas.js +41 -0
- package/dist/reaperWorkflow.js +69 -0
- package/dist/recovery.js +188 -0
- package/dist/recoverySeats.js +25 -0
- package/dist/replay.d.ts +273 -0
- package/dist/replay.js +484 -0
- package/dist/replayPorts.js +4 -0
- package/dist/replayRecording.js +66 -0
- package/dist/replaySchema.js +156 -0
- package/dist/replayStorage.d.ts +149 -0
- package/dist/replayStorage.js +484 -0
- package/dist/reservationBatch.js +421 -0
- package/dist/reservationSchemas.js +16 -0
- package/dist/reservations.js +258 -0
- package/dist/reservePort.js +68 -0
- package/dist/resolvedOptions.js +3 -0
- package/dist/room.d.ts +1006 -0
- package/dist/room.js +283 -0
- package/dist/roomAccessSweep.js +94 -0
- package/dist/roomAppCommandControl.js +58 -0
- package/dist/roomAuthoringStrategy.js +16 -0
- package/dist/roomErasure.js +197 -0
- package/dist/roomPoolRuntimeDefaults.js +23 -0
- package/dist/roomPoolSelection.js +18 -0
- package/dist/roomPoolTopology.js +211 -0
- package/dist/rpc.d.ts +551 -0
- package/dist/rpc.js +111 -0
- package/dist/rpcClient.js +151 -0
- package/dist/rpcRoutes.js +27 -0
- package/dist/runtime.js +1122 -0
- package/dist/schemaHistory.js +97 -0
- package/dist/seatStore.js +150 -0
- package/dist/seatStrategyFixtures.js +51 -0
- package/dist/seatSubject.js +31 -0
- package/dist/seats.js +129 -0
- package/dist/serverSession.js +810 -0
- package/dist/serverSessionConfig.js +42 -0
- package/dist/sessionAdmission.js +52 -0
- package/dist/sidecarAdmission.js +102 -0
- package/dist/sidecarConfig.js +115 -0
- package/dist/sidecarConfigPublication.js +63 -0
- package/dist/sidecarHostListener.js +207 -0
- package/dist/sidecarIpc.js +204 -0
- package/dist/sidecarPeer.js +309 -0
- package/dist/sidecarProcessPort.js +27 -0
- package/dist/sidecarRuntime.js +167 -0
- package/dist/sidecarSelection.js +141 -0
- package/dist/sidecarWire.js +177 -0
- package/dist/sidecarWrites.js +162 -0
- package/dist/simulation.d.ts +391 -0
- package/dist/simulation.js +281 -0
- package/dist/simulationAuthoring.js +28 -0
- package/dist/simulationBytes.js +26 -0
- package/dist/simulationConformance.js +304 -0
- package/dist/simulationInputHistoryCapture.js +34 -0
- package/dist/simulationInputHistoryWire.js +192 -0
- package/dist/simulationOptionsWire.js +77 -0
- package/dist/simulationRecoveryWire.js +133 -0
- package/dist/simulationReplay.js +126 -0
- package/dist/simulationSnapshotWire.js +111 -0
- package/dist/simulationState.js +177 -0
- package/dist/snapshotBlob.js +125 -0
- package/dist/snapshotBlobCleanup.js +92 -0
- package/dist/snapshotBlobIndex.js +37 -0
- package/dist/snapshotBudget.js +79 -0
- package/dist/snapshotChain.js +184 -0
- package/dist/snapshotErasure.js +171 -0
- package/dist/snapshotInspection.js +104 -0
- package/dist/snapshotSegmentBlobs.js +57 -0
- package/dist/snapshotUploads.js +165 -0
- package/dist/socketTransport.js +252 -0
- package/dist/spatial.js +103 -0
- package/dist/spectatorPolicy.js +25 -0
- package/dist/spectatorProducer.js +88 -0
- package/dist/startFailureCause.js +3 -0
- package/dist/stateCodec.js +657 -0
- package/dist/strategies.d.ts +210 -0
- package/dist/strategies.js +8 -0
- package/dist/strategiesServer.d.ts +286 -0
- package/dist/strategiesServer.js +11 -0
- package/dist/strategyFixtures.js +181 -0
- package/dist/streamFraming.js +121 -0
- package/dist/streamTransport.js +265 -0
- package/dist/subjectAdmission.js +49 -0
- package/dist/subjectPrivacy.js +280 -0
- package/dist/subjectPrivacyBinding.js +89 -0
- package/dist/systemManifest.js +181 -0
- package/dist/tables.js +158 -0
- package/dist/testHarness.js +88 -0
- package/dist/testing.d.ts +3684 -0
- package/dist/testing.js +220 -0
- package/dist/testingPorts.js +270 -0
- package/dist/testingServer.d.ts +4060 -0
- package/dist/testingServer.js +18 -0
- package/dist/transform.d.ts +692 -0
- package/dist/transform.js +216 -0
- package/dist/transform3d.js +117 -0
- package/dist/transformCollection.js +23 -0
- package/dist/transformCollection3d.js +23 -0
- package/dist/transformCollectionCore.js +155 -0
- package/dist/transformFrames.js +120 -0
- package/dist/transformPrediction3d.js +126 -0
- package/dist/transformRules.js +122 -0
- package/dist/transformSchemas.js +19 -0
- package/dist/transport.js +31 -0
- package/dist/transportAuthoring.js +28 -0
- package/dist/transportCleanup.js +21 -0
- package/dist/transportConformance.js +123 -0
- package/dist/transportConnector.js +81 -0
- package/dist/transportEndpoints.js +37 -0
- package/dist/transportsServer.d.ts +5515 -0
- package/dist/transportsServer.js +6 -0
- package/dist/viewProjection.js +15 -0
- package/dist/web.d.ts +2286 -0
- package/dist/web.js +517 -0
- package/dist/webTransportClient.js +172 -0
- package/dist/wire.d.ts +992 -0
- package/dist/wire.js +491 -0
- package/dist/withdrawalPort.js +27 -0
- package/dist/world.d.ts +1894 -0
- package/dist/world.js +332 -0
- package/dist/worldActorReceipts.js +47 -0
- package/dist/worldActorTransferSnapshot.js +13 -0
- package/dist/worldAdmissionPending.js +7 -0
- package/dist/worldBoundaryCoordinator.js +147 -0
- package/dist/worldCatalog.js +80 -0
- package/dist/worldCellAllocation.js +202 -0
- package/dist/worldCellDestination.js +67 -0
- package/dist/worldCells.js +488 -0
- package/dist/worldChange.js +31 -0
- package/dist/worldClient.js +663 -0
- package/dist/worldClientControl.js +140 -0
- package/dist/worldClientPendingInput.js +15 -0
- package/dist/worldClientRpc.js +132 -0
- package/dist/worldClientRpcRoutes.js +42 -0
- package/dist/worldClientSchemas.js +27 -0
- package/dist/worldCommands.js +139 -0
- package/dist/worldData.js +41 -0
- package/dist/worldDefaultBinding.js +376 -0
- package/dist/worldDefaultGroupAdmission.js +81 -0
- package/dist/worldDefaultGroupAppServices.js +30 -0
- package/dist/worldDefaultGroupCompensation.js +108 -0
- package/dist/worldDefaultGroupContinuation.js +95 -0
- package/dist/worldDefaultGroupControl.js +71 -0
- package/dist/worldDefaultGroupMembers.js +84 -0
- package/dist/worldDefaultGroups.js +20 -0
- package/dist/worldDefaultPending.js +78 -0
- package/dist/worldDefaultService.js +244 -0
- package/dist/worldEntities.js +2979 -0
- package/dist/worldEntityCodec.js +20 -0
- package/dist/worldEntityHandoffView.js +153 -0
- package/dist/worldGeometry.js +169 -0
- package/dist/worldGhostAdmission.js +64 -0
- package/dist/worldGhostDestination.js +117 -0
- package/dist/worldGhostGateway.js +131 -0
- package/dist/worldGhostHandshake.js +107 -0
- package/dist/worldGhostHost.js +41 -0
- package/dist/worldGhostIngress.js +131 -0
- package/dist/worldGhostNeighborhood.js +69 -0
- package/dist/worldGhostNeighbors.js +85 -0
- package/dist/worldGhostOutbound.js +109 -0
- package/dist/worldGhostPublisher.js +215 -0
- package/dist/worldGhostReceiver.js +212 -0
- package/dist/worldGhostSender.js +145 -0
- package/dist/worldGhostSocket.js +77 -0
- package/dist/worldGhostWire.js +171 -0
- package/dist/worldGroupCommand.js +48 -0
- package/dist/worldGroupDeadline.js +114 -0
- package/dist/worldGroupPreparation.js +114 -0
- package/dist/worldGroupReadyControl.js +127 -0
- package/dist/worldGroupSupervisor.js +119 -0
- package/dist/worldHandoffMetrics.js +58 -0
- package/dist/worldHandoffView.js +99 -0
- package/dist/worldHostSource.js +68 -0
- package/dist/worldInspectEndpoint.js +249 -0
- package/dist/worldInspection.js +108 -0
- package/dist/worldInstanceAdmission.js +30 -0
- package/dist/worldInstanceAllocation.js +115 -0
- package/dist/worldInstanceDestination.js +63 -0
- package/dist/worldInstanceExpiry.js +281 -0
- package/dist/worldInstanceExpirySupervisor.js +87 -0
- package/dist/worldInstanceLifecycle.js +102 -0
- package/dist/worldInstanceState.js +51 -0
- package/dist/worldInstances.js +477 -0
- package/dist/worldJoin.js +55 -0
- package/dist/worldLayers.js +150 -0
- package/dist/worldLeases.js +77 -0
- package/dist/worldManifest.js +24 -0
- package/dist/worldMovement.js +62 -0
- package/dist/worldPersistence.js +133 -0
- package/dist/worldProjection.js +220 -0
- package/dist/worldReact.js +109 -0
- package/dist/worldRecoveryActor.js +34 -0
- package/dist/worldReturnAnchor.js +48 -0
- package/dist/worldRoomHooks.js +56 -0
- package/dist/worldRoomPool.js +26 -0
- package/dist/worldRoomSteps.js +132 -0
- package/dist/worldSeatBinding.js +35 -0
- package/dist/worldServer.d.ts +6936 -0
- package/dist/worldServer.js +48 -0
- package/dist/worldSourceSeatPending.js +8 -0
- package/dist/worldStrategyFixtures.js +163 -0
- package/dist/worldTesting.js +26 -0
- package/dist/worldTransitionDefaults.js +197 -0
- package/dist/worldTransitionExecutor.js +518 -0
- package/dist/worldTransitionGroup.js +112 -0
- package/dist/worldTransitionPhysicalSteps.js +39 -0
- package/dist/worldTransitionResolver.js +227 -0
- package/dist/worldTransitionSeatGroup.js +63 -0
- package/dist/worldTransitionSeats.js +259 -0
- package/dist/worldTransitionState.js +94 -0
- package/dist/worldTransitions.js +100 -0
- package/package.json +189 -4
package/dist/web.js
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomAuthoringError as n } from "./errors.js";
|
|
2
|
+
import { RoomInputCodec as r, RoomStateCodec as i } from "./stateCodec.js";
|
|
3
|
+
import { WorldClientReceiptSchema as a, WorldClientRequestIdSchema as o, WorldClientTicketSchema as s } from "./worldClientSchemas.js";
|
|
4
|
+
import { makeWorldHandoffView as c } from "./worldHandoffView.js";
|
|
5
|
+
import { RoomTransportCleanupFailure as l } from "./transportCleanup.js";
|
|
6
|
+
import { captureRoomTransportEndpoints as u } from "./transportEndpoints.js";
|
|
7
|
+
import { RoomInputRedundancy as d, defaultRoomInputRedundancy as f } from "./inputRedundancy.js";
|
|
8
|
+
import { RoomConnection as p, defaultRoomClockPingCadence as m, defaultRoomReconnectPolicy as h } from "./connection.js";
|
|
9
|
+
import { defaultRoomWebSocketFactory as g, openRoomSocketTransport as _ } from "./socketTransport.js";
|
|
10
|
+
import { RoomLatestDatagram as v, RoomStreamFrameDecoder as ee, encodeRoomStreamFrame as y } from "./streamFraming.js";
|
|
11
|
+
import { makeRoomStreamTransport as b } from "./streamTransport.js";
|
|
12
|
+
import { defaultRoomWebTransportFactory as x, openRoomWebTransport as S } from "./webTransportClient.js";
|
|
13
|
+
import { roomTransportConnector as C } from "./transportConnector.js";
|
|
14
|
+
import { listRooms as w, roomRpcReservations as T, worldRpcControls as E, worldRpcFollowerReservations as D, worldRpcPending as O, worldRpcReservations as k } from "./rpcClient.js";
|
|
15
|
+
import { createRoom as A, createRoomClient as j, joinById as M, joinRoom as N, joinSeat as te, joinWorld as P } from "./client.js";
|
|
16
|
+
import { RoomClockSync as F } from "./clockSync.js";
|
|
17
|
+
import { decodeRoomFrame as I, encodeRoomFrame as L, roomFrameLayout as R } from "./wire.js";
|
|
18
|
+
import { makeWorldEntityHandoffView as z } from "./worldEntityHandoffView.js";
|
|
19
|
+
import { WorldClient as B, worldClientReceipt as V, worldClientTicket as H } from "./worldClient.js";
|
|
20
|
+
import { shapeDigest as U } from "@voltro/protocol";
|
|
21
|
+
import { Result as W } from "effect";
|
|
22
|
+
// src/web.ts
|
|
23
|
+
var G = Object.freeze({
|
|
24
|
+
maxPendingPings: 8,
|
|
25
|
+
pingTimeoutMs: 1e4
|
|
26
|
+
}), K = (e) => {
|
|
27
|
+
let t = new i(e.state), a = new r(e.input), o = Object.entries(e.messages ?? {}).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => {
|
|
28
|
+
if (!/^[A-Za-z][A-Za-z0-9._-]*$/.test(e)) throw new n({
|
|
29
|
+
room: "wire",
|
|
30
|
+
detail: "Channel names must be stable ASCII identifiers"
|
|
31
|
+
});
|
|
32
|
+
return Object.freeze({
|
|
33
|
+
name: e,
|
|
34
|
+
direction: t.direction,
|
|
35
|
+
reliable: t.reliable,
|
|
36
|
+
codec: new r(t.schema)
|
|
37
|
+
});
|
|
38
|
+
}), s = Number.parseInt(U(JSON.stringify([
|
|
39
|
+
R,
|
|
40
|
+
t.schemaHash,
|
|
41
|
+
a.schemaHash,
|
|
42
|
+
o.map((e) => [
|
|
43
|
+
e.name,
|
|
44
|
+
e.codec.schemaHash,
|
|
45
|
+
e.direction,
|
|
46
|
+
e.reliable
|
|
47
|
+
])
|
|
48
|
+
])), 16), c = new TextEncoder().encode(JSON.stringify(t.transformRulesManifest()));
|
|
49
|
+
return Object.freeze({
|
|
50
|
+
state: t,
|
|
51
|
+
input: a,
|
|
52
|
+
channels: Object.freeze(o),
|
|
53
|
+
schemaHash: s,
|
|
54
|
+
get transformRules() {
|
|
55
|
+
return Uint8Array.from(c);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}, q = /* @__PURE__ */ new WeakSet(), J = class {
|
|
59
|
+
transport;
|
|
60
|
+
clock;
|
|
61
|
+
maxBaselines;
|
|
62
|
+
codecs;
|
|
63
|
+
baselines = /* @__PURE__ */ new Map();
|
|
64
|
+
handoffListeners = /* @__PURE__ */ new Set();
|
|
65
|
+
listeners = /* @__PURE__ */ new Set();
|
|
66
|
+
messageListeners = /* @__PURE__ */ new Map();
|
|
67
|
+
detach = [];
|
|
68
|
+
currentState = null;
|
|
69
|
+
currentStatus = "connecting";
|
|
70
|
+
currentError = null;
|
|
71
|
+
tick = -1;
|
|
72
|
+
epoch = -1;
|
|
73
|
+
receivedAt = -1;
|
|
74
|
+
seq = 0;
|
|
75
|
+
inputAck = -1;
|
|
76
|
+
acknowledgedTick = -1;
|
|
77
|
+
pendingInputAck = null;
|
|
78
|
+
pairedInputState = null;
|
|
79
|
+
sessionId = null;
|
|
80
|
+
started = !1;
|
|
81
|
+
pendingPings = /* @__PURE__ */ new Map();
|
|
82
|
+
deltaDatagramsReceived = 0;
|
|
83
|
+
lossSample = null;
|
|
84
|
+
lossEstimate = null;
|
|
85
|
+
sampling;
|
|
86
|
+
clockSync;
|
|
87
|
+
inputHistory;
|
|
88
|
+
constructor(e, t, r, i = 8, a = {
|
|
89
|
+
nextSeq: 0,
|
|
90
|
+
lastAppliedSeq: -1
|
|
91
|
+
}, o = G, s = f) {
|
|
92
|
+
if (this.transport = e, this.clock = r, this.maxBaselines = i, this.inputHistory = new d(s), !Number.isSafeInteger(i) || i < 1) throw new n({
|
|
93
|
+
room: "client",
|
|
94
|
+
detail: "Client baseline history must be bounded"
|
|
95
|
+
});
|
|
96
|
+
if (!Number.isSafeInteger(a.nextSeq) || a.nextSeq < 0 || !Number.isSafeInteger(a.lastAppliedSeq) || a.lastAppliedSeq < -1 || a.lastAppliedSeq >= a.nextSeq) throw new n({
|
|
97
|
+
room: "client",
|
|
98
|
+
detail: "Invalid input recovery cursor"
|
|
99
|
+
});
|
|
100
|
+
if (this.seq = a.nextSeq, this.inputAck = a.lastAppliedSeq, !Number.isSafeInteger(o.maxPendingPings) || o.maxPendingPings < 1 || !Number.isSafeInteger(o.pingTimeoutMs) || o.pingTimeoutMs < 1) throw new n({
|
|
101
|
+
room: "client",
|
|
102
|
+
detail: "Clock sampling budgets must be positive safe integers"
|
|
103
|
+
});
|
|
104
|
+
this.sampling = Object.freeze({ ...o }), this.codecs = K(t), this.clockSync = new F(r), this.detach.push(e.reliable.onFrame((e, t) => this.receive(e, t))), e.unreliable && this.detach.push(e.unreliable.onFrame((e, t) => this.receive(e, t, !0)));
|
|
105
|
+
let c = () => {
|
|
106
|
+
(this.currentStatus === "joined" || this.currentStatus === "connecting") && (this.currentStatus = "reconnecting"), this.cleanup(), this.notify();
|
|
107
|
+
};
|
|
108
|
+
e.signal.addEventListener("abort", c, { once: !0 }), this.detach.push(() => e.signal.removeEventListener("abort", c)), e.signal.aborted && c(), q.add(this);
|
|
109
|
+
}
|
|
110
|
+
currentReliableChannelIdentity(e, t) {
|
|
111
|
+
let n = this.codecs.channels.find((t) => t.name === e);
|
|
112
|
+
return this.currentStatus !== "joined" || this.transport.signal.aborted || this.currentState === null || !this.sessionId || !n || !n.reliable || n.direction === "client" || n.codec.schemaHash !== t ? null : Object.freeze({
|
|
113
|
+
sessionId: this.sessionId,
|
|
114
|
+
epoch: this.epoch
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
currentReliableClientChannelIdentity(e, t) {
|
|
118
|
+
let n = this.codecs.channels.find((t) => t.name === e);
|
|
119
|
+
return this.currentStatus !== "joined" || this.transport.signal.aborted || this.currentState === null || !this.sessionId || !n || !n.reliable || n.direction !== "client" || n.codec.schemaHash !== t ? null : Object.freeze({
|
|
120
|
+
sessionId: this.sessionId,
|
|
121
|
+
epoch: this.epoch
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
get status() {
|
|
125
|
+
return this.currentStatus;
|
|
126
|
+
}
|
|
127
|
+
get error() {
|
|
128
|
+
return this.currentError;
|
|
129
|
+
}
|
|
130
|
+
get state() {
|
|
131
|
+
return this.currentState === null ? null : structuredClone(this.currentState);
|
|
132
|
+
}
|
|
133
|
+
get lastAppliedTick() {
|
|
134
|
+
return this.tick;
|
|
135
|
+
}
|
|
136
|
+
get lastAppliedInputSeq() {
|
|
137
|
+
return this.inputAck;
|
|
138
|
+
}
|
|
139
|
+
get reconciliationSnapshot() {
|
|
140
|
+
return this.pairedInputState === null ? null : structuredClone(this.pairedInputState);
|
|
141
|
+
}
|
|
142
|
+
get nextInputSeq() {
|
|
143
|
+
return this.seq;
|
|
144
|
+
}
|
|
145
|
+
get id() {
|
|
146
|
+
return this.sessionId;
|
|
147
|
+
}
|
|
148
|
+
get lossRate() {
|
|
149
|
+
return this.lossEstimate;
|
|
150
|
+
}
|
|
151
|
+
deliveredSnapshot() {
|
|
152
|
+
return this.currentStatus !== "joined" || this.currentState === null ? null : {
|
|
153
|
+
epoch: this.epoch,
|
|
154
|
+
tick: this.tick,
|
|
155
|
+
receivedAt: this.receivedAt,
|
|
156
|
+
state: structuredClone(this.currentState)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
serverNow() {
|
|
160
|
+
return this.clockSync.serverNow();
|
|
161
|
+
}
|
|
162
|
+
async start(e, n) {
|
|
163
|
+
if (this.started || this.transport.signal.aborted) throw new t({ detail: "Session already started or transport closed" });
|
|
164
|
+
this.started = !0, await this.sendFrame({
|
|
165
|
+
kind: "Hello",
|
|
166
|
+
protocolVersion: 1,
|
|
167
|
+
token: e,
|
|
168
|
+
schemaHash: this.codecs.schemaHash,
|
|
169
|
+
...n === void 0 ? {} : { resumeFromTick: n },
|
|
170
|
+
transportCaps: this.transport.unreliable ? 3 : 1
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async send(e) {
|
|
174
|
+
if (this.currentStatus !== "joined") throw new t({ detail: "Inputs require a joined session" });
|
|
175
|
+
if (!Number.isSafeInteger(this.seq)) throw new t({ detail: "Input sequence exhausted" });
|
|
176
|
+
let n = this.codecs.input.full(e);
|
|
177
|
+
if (W.isFailure(n)) throw n.failure;
|
|
178
|
+
let r = this.seq, i = this.acknowledgedTick < 0 ? {} : { ackTick: this.acknowledgedTick }, a = {
|
|
179
|
+
kind: "Input",
|
|
180
|
+
firstSeq: r,
|
|
181
|
+
inputs: [{
|
|
182
|
+
tickHint: this.tick,
|
|
183
|
+
payload: n.success
|
|
184
|
+
}],
|
|
185
|
+
...i
|
|
186
|
+
};
|
|
187
|
+
if (this.transport.unreliable) {
|
|
188
|
+
let e = this.inputHistory.offer(r, this.tick, n.success), t = L({
|
|
189
|
+
...e,
|
|
190
|
+
...i
|
|
191
|
+
});
|
|
192
|
+
this.seq++, W.isSuccess(t) && t.success.byteLength <= this.transport.unreliable.maxDatagramBytes ? this.transport.unreliable.send(t.success) : await this.sendFrame(a);
|
|
193
|
+
} else this.seq++, await this.sendFrame(a);
|
|
194
|
+
return r;
|
|
195
|
+
}
|
|
196
|
+
async message(e, n) {
|
|
197
|
+
if (this.currentStatus !== "joined") throw new t({ detail: "Messages require a joined session" });
|
|
198
|
+
let r = this.codecs.channels.findIndex((t) => t.name === e), i = this.codecs.channels[r];
|
|
199
|
+
if (!i || i.direction === "server") throw new t({ detail: "Channel is not client-sendable" });
|
|
200
|
+
let a = i.codec.full(n);
|
|
201
|
+
if (W.isFailure(a)) throw a.failure;
|
|
202
|
+
let o = {
|
|
203
|
+
kind: "ClientMessage",
|
|
204
|
+
channelId: r,
|
|
205
|
+
payload: a.success
|
|
206
|
+
}, s = L(o);
|
|
207
|
+
if (W.isFailure(s)) throw s.failure;
|
|
208
|
+
!i.reliable && this.transport.unreliable && s.success.byteLength <= this.transport.unreliable.maxDatagramBytes ? this.transport.unreliable.send(s.success) : await this.transport.reliable.send(s.success);
|
|
209
|
+
}
|
|
210
|
+
async replay(e, n) {
|
|
211
|
+
if (this.currentStatus !== "joined" || !Number.isSafeInteger(e) || e <= this.inputAck || e >= this.seq) throw new t({ detail: "Replay requires a joined session and an unacknowledged submitted sequence" });
|
|
212
|
+
let r = this.codecs.input.full(n);
|
|
213
|
+
if (W.isFailure(r)) throw r.failure;
|
|
214
|
+
await this.sendFrame({
|
|
215
|
+
kind: "Input",
|
|
216
|
+
firstSeq: e,
|
|
217
|
+
inputs: [{
|
|
218
|
+
tickHint: this.tick,
|
|
219
|
+
payload: r.success
|
|
220
|
+
}],
|
|
221
|
+
...this.acknowledgedTick < 0 ? {} : { ackTick: this.acknowledgedTick }
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
async ping() {
|
|
225
|
+
if (this.currentStatus !== "joined") throw new t({ detail: "Ping requires a joined session" });
|
|
226
|
+
let n = this.clock.now(), r = Math.floor(n);
|
|
227
|
+
if (!Number.isFinite(n) || n < 0 || !Number.isSafeInteger(r)) throw new t({ detail: "Invalid local ping clock" });
|
|
228
|
+
for (let [e, t] of this.pendingPings) n - t >= this.sampling.pingTimeoutMs && this.pendingPings.delete(e);
|
|
229
|
+
if (!this.pendingPings.has(r)) {
|
|
230
|
+
if (this.pendingPings.size >= this.sampling.maxPendingPings) throw new e({
|
|
231
|
+
budget: "pendingClockPings",
|
|
232
|
+
limit: this.sampling.maxPendingPings
|
|
233
|
+
});
|
|
234
|
+
this.pendingPings.set(r, n);
|
|
235
|
+
try {
|
|
236
|
+
await this.sendFrame({
|
|
237
|
+
kind: "Ping",
|
|
238
|
+
clientTimeMs: r
|
|
239
|
+
});
|
|
240
|
+
} catch (e) {
|
|
241
|
+
throw this.pendingPings.delete(r), e;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
subscribe(e) {
|
|
246
|
+
return this.listeners.add(e), () => {
|
|
247
|
+
this.listeners.delete(e);
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
onWorldHandoff(e) {
|
|
251
|
+
return this.handoffListeners.add(e), () => {
|
|
252
|
+
this.handoffListeners.delete(e);
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
onMessage(e, t) {
|
|
256
|
+
let n = this.messageListeners.get(e) ?? /* @__PURE__ */ new Set();
|
|
257
|
+
return n.add(t), this.messageListeners.set(e, n), () => {
|
|
258
|
+
n.delete(t), n.size === 0 && this.messageListeners.delete(e);
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
async sendFrame(e) {
|
|
262
|
+
let t = L(e);
|
|
263
|
+
if (W.isFailure(t)) throw t.failure;
|
|
264
|
+
await this.transport.reliable.send(t.success);
|
|
265
|
+
}
|
|
266
|
+
sampleLoss(e) {
|
|
267
|
+
let t = this.deltaDatagramsReceived, n = this.lossSample;
|
|
268
|
+
if (n === null || e < n.sent) {
|
|
269
|
+
this.lossSample = {
|
|
270
|
+
sent: e,
|
|
271
|
+
received: t
|
|
272
|
+
};
|
|
273
|
+
return;
|
|
274
|
+
}
|
|
275
|
+
let r = e - n.sent;
|
|
276
|
+
if (r < 8) return;
|
|
277
|
+
let i = 1 - Math.min(r, t - n.received) / r;
|
|
278
|
+
this.lossEstimate = this.lossEstimate === null ? i : this.lossEstimate * .75 + i * .25, this.lossSample = {
|
|
279
|
+
sent: e,
|
|
280
|
+
received: t
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
ackFrame(e) {
|
|
284
|
+
return this.lossEstimate === null ? {
|
|
285
|
+
kind: "Ack",
|
|
286
|
+
tick: e
|
|
287
|
+
} : {
|
|
288
|
+
kind: "Ack",
|
|
289
|
+
tick: e,
|
|
290
|
+
lossPermille: Math.round(this.lossEstimate * 1e3)
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
acknowledge(e = this.tick) {
|
|
294
|
+
if (this.acknowledgedTick = e, this.transport.unreliable) {
|
|
295
|
+
let t = L(this.ackFrame(e));
|
|
296
|
+
if (W.isFailure(t)) {
|
|
297
|
+
this.fail(t.failure);
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (t.success.byteLength <= this.transport.unreliable.maxDatagramBytes) {
|
|
301
|
+
try {
|
|
302
|
+
this.transport.unreliable.send(t.success);
|
|
303
|
+
} catch (e) {
|
|
304
|
+
this.fail(e);
|
|
305
|
+
}
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
this.sendFrame(this.ackFrame(e)).catch((e) => this.fail(e));
|
|
310
|
+
}
|
|
311
|
+
fail(e) {
|
|
312
|
+
this.currentStatus !== "left" && this.currentStatus !== "kicked" && this.currentStatus !== "gone" && (this.currentError = e instanceof t ? e : new t({ detail: "Room transport failed" }), this.currentStatus = "left", this.cleanup(), this.transport.close(1002, "Room protocol error"), this.notify());
|
|
313
|
+
}
|
|
314
|
+
install(e, t, n) {
|
|
315
|
+
for (this.tick = e, this.receivedAt = n, this.currentState = structuredClone(t), this.baselines.set(e, structuredClone(t)); this.baselines.size > this.maxBaselines;) {
|
|
316
|
+
let e = this.baselines.keys().next();
|
|
317
|
+
if (e.done) break;
|
|
318
|
+
this.baselines.delete(e.value);
|
|
319
|
+
}
|
|
320
|
+
this.pairInputState(), this.acknowledge(), this.notify();
|
|
321
|
+
}
|
|
322
|
+
pairInputState() {
|
|
323
|
+
let e = this.pendingInputAck;
|
|
324
|
+
if (!e || !this.baselines.has(e.tick)) return;
|
|
325
|
+
let t = this.baselines.get(e.tick);
|
|
326
|
+
this.pairedInputState = Object.freeze({
|
|
327
|
+
epoch: this.epoch,
|
|
328
|
+
tick: e.tick,
|
|
329
|
+
lastAppliedSeq: e.seq,
|
|
330
|
+
state: structuredClone(t)
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
observeInputAck(e, n, r) {
|
|
334
|
+
if (n >= this.seq) return this.fail(new t({ detail: "Input acknowledgement exceeds submitted history" })), "refused";
|
|
335
|
+
if (r & -2) return this.fail(new t({ detail: "Unknown input acknowledgement flags" })), "refused";
|
|
336
|
+
let i = this.pendingInputAck;
|
|
337
|
+
return i && (n < i.seq || n === i.seq && e <= i.tick) ? "ignored" : i && e < i.tick ? (this.fail(new t({ detail: "Input receipt tick regressed while its sequence advanced" })), "refused") : (this.inputAck = Math.max(this.inputAck, n), this.pendingInputAck = Object.freeze({
|
|
338
|
+
tick: e,
|
|
339
|
+
seq: n
|
|
340
|
+
}), "accepted");
|
|
341
|
+
}
|
|
342
|
+
receive(e, n, r = !1) {
|
|
343
|
+
if (!Number.isFinite(n) || n < 0) {
|
|
344
|
+
this.fail(new t({ detail: "Invalid local room observation time" }));
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
let i = I(e);
|
|
348
|
+
if (W.isFailure(i)) {
|
|
349
|
+
this.fail(i.failure);
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
let a = i.success;
|
|
353
|
+
if (r && a.kind !== "Delta" && a.kind !== "InputAck" && a.kind !== "Pong" && (a.kind !== "ServerMessage" || this.codecs.channels[a.channelId]?.reliable !== !1)) this.fail(new t({ detail: "Room control and reliable message frames require the reliable lane" }));
|
|
354
|
+
else switch (r && a.kind === "Delta" && this.deltaDatagramsReceived++, a.kind) {
|
|
355
|
+
case "Welcome": {
|
|
356
|
+
if (!this.started || this.currentStatus !== "connecting") {
|
|
357
|
+
this.fail(new t({ detail: "Unexpected Welcome" }));
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
let e = this.codecs.transformRules;
|
|
361
|
+
if (e.length !== a.transformRules.length || e.some((e, t) => e !== a.transformRules[t])) {
|
|
362
|
+
this.fail(new t({ detail: "Room transform rules do not match the admitted client manifest" }));
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
let r = this.codecs.state.decodeFull(a.baseline);
|
|
366
|
+
if (W.isFailure(r)) {
|
|
367
|
+
this.fail(r.failure);
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
try {
|
|
371
|
+
this.clockSync.anchor(a.serverTimeMs, n);
|
|
372
|
+
} catch (e) {
|
|
373
|
+
this.fail(e);
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
this.sessionId = a.sessionId, this.epoch = a.epoch, this.currentStatus = "joined", this.install(a.tick, r.success, n);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
case "Full": {
|
|
380
|
+
if (this.currentStatus !== "joined") {
|
|
381
|
+
this.fail(new t({ detail: "Full requires a joined session" }));
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
if (a.epoch < this.epoch || a.epoch === this.epoch && a.tick < this.tick) return;
|
|
385
|
+
let e = this.codecs.state.decodeFull(a.baseline);
|
|
386
|
+
if (W.isFailure(e)) {
|
|
387
|
+
this.fail(e.failure);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (a.epoch !== this.epoch && (this.clockSync.reset(), this.pendingPings.clear(), this.pendingInputAck = null, this.pairedInputState = null), a.inputAck && this.observeInputAck(a.tick, a.inputAck.lastAppliedSeq, a.inputAck.flags) === "refused") return;
|
|
391
|
+
this.epoch = a.epoch, this.baselines.clear(), this.install(a.tick, e.success, n);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
case "Delta": {
|
|
395
|
+
if (this.currentStatus !== "joined") {
|
|
396
|
+
this.fail(new t({ detail: "Delta requires a joined session" }));
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
if (a.tick <= this.tick) return;
|
|
400
|
+
let e = this.baselines.get(a.baseTick);
|
|
401
|
+
if (e === void 0) {
|
|
402
|
+
this.acknowledge();
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
let r = this.codecs.state.decodeDelta(a.patch, e);
|
|
406
|
+
if (W.isFailure(r)) {
|
|
407
|
+
this.fail(r.failure);
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (a.inputAck && this.observeInputAck(a.tick, a.inputAck.lastAppliedSeq, a.inputAck.flags) === "refused") return;
|
|
411
|
+
this.install(a.tick, r.success, n);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
case "InputAck":
|
|
415
|
+
if (this.currentStatus !== "joined") {
|
|
416
|
+
this.fail(new t({ detail: "Input acknowledgement requires a joined session" }));
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
if (r && a.tick <= this.tick || this.observeInputAck(a.tick, a.lastAppliedSeq, a.flags) !== "accepted") return;
|
|
420
|
+
this.pairInputState(), !this.baselines.has(a.tick) && a.tick < this.tick && this.acknowledge(Math.max(0, Math.min(this.tick, a.tick - 1))), this.notify();
|
|
421
|
+
return;
|
|
422
|
+
case "Pong": {
|
|
423
|
+
if (this.currentStatus !== "joined") {
|
|
424
|
+
this.fail(new t({ detail: "Pong requires a joined session" }));
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
if (a.deltaDatagramsSent !== void 0 && this.pendingPings.has(a.clientTimeMs) && this.sampleLoss(a.deltaDatagramsSent), r && a.tick <= this.tick) return;
|
|
428
|
+
let e = this.pendingPings.get(a.clientTimeMs);
|
|
429
|
+
if (e === void 0 || (this.pendingPings.delete(a.clientTimeMs), n - e >= this.sampling.pingTimeoutMs)) return;
|
|
430
|
+
try {
|
|
431
|
+
this.clockSync.pong(e, a.serverTimeMs, n), this.notify();
|
|
432
|
+
} catch (e) {
|
|
433
|
+
this.fail(e);
|
|
434
|
+
}
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
case "ServerMessage": {
|
|
438
|
+
if (this.currentStatus !== "joined") {
|
|
439
|
+
this.fail(new t({ detail: "Messages require a joined session" }));
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
let e = this.codecs.channels[a.channelId];
|
|
443
|
+
if (!e || e.direction === "client") {
|
|
444
|
+
this.fail(new t({ detail: "Channel is not server-sendable" }));
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
let n = e.codec.decodeFull(a.payload);
|
|
448
|
+
if (W.isFailure(n)) {
|
|
449
|
+
this.fail(n.failure);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
for (let t of this.messageListeners.get(e.name) ?? []) t(n.success);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
case "WorldHandoff": {
|
|
456
|
+
if (this.currentStatus !== "joined") {
|
|
457
|
+
this.fail(new t({ detail: "World handoff requires a joined session" }));
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (a.sourceEpoch < this.epoch) return;
|
|
461
|
+
if (a.sourceEpoch !== this.epoch) {
|
|
462
|
+
this.fail(new t({ detail: "World handoff source epoch does not match the session" }));
|
|
463
|
+
return;
|
|
464
|
+
}
|
|
465
|
+
let e = Object.freeze({ ...a });
|
|
466
|
+
for (let t of this.handoffListeners) t(e);
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
case "Kick":
|
|
470
|
+
this.currentStatus = "kicked", this.cleanup(), this.transport.close(1e3, "Room kicked"), this.notify();
|
|
471
|
+
return;
|
|
472
|
+
case "Migrate":
|
|
473
|
+
this.currentStatus = "reconnecting", this.cleanup(), this.transport.close(1e3, "Room migrating"), this.notify();
|
|
474
|
+
return;
|
|
475
|
+
case "Error":
|
|
476
|
+
this.fail(new t({ detail: a.detail }));
|
|
477
|
+
return;
|
|
478
|
+
default: this.fail(new t({ detail: "Server sent a client-only frame" }));
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
notify() {
|
|
482
|
+
for (let e of this.listeners) e();
|
|
483
|
+
}
|
|
484
|
+
cleanup() {
|
|
485
|
+
this.pendingPings.clear(), this.inputHistory.clear();
|
|
486
|
+
for (let e of this.detach.splice(0)) e();
|
|
487
|
+
}
|
|
488
|
+
async leave() {
|
|
489
|
+
try {
|
|
490
|
+
!this.transport.signal.aborted && this.currentStatus === "joined" && await this.sendFrame({
|
|
491
|
+
kind: "Leave",
|
|
492
|
+
reason: 0
|
|
493
|
+
});
|
|
494
|
+
} finally {
|
|
495
|
+
this.currentStatus = "left", this.cleanup(), this.transport.close(1e3, "Room left"), this.notify(), this.listeners.clear(), this.messageListeners.clear(), this.handoffListeners.clear();
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}, Y = J.prototype.currentReliableChannelIdentity, X = J.prototype.onMessage, Z = J.prototype.subscribe, Q = (e, n, r) => {
|
|
499
|
+
if (!e || typeof e != "object" || !q.has(e)) throw new t({ detail: "Actual constructed Room client Session is required" });
|
|
500
|
+
let i = e;
|
|
501
|
+
return Object.freeze({
|
|
502
|
+
identity: () => Y.call(i, n, r),
|
|
503
|
+
onMessage: (e) => X.call(i, n, e),
|
|
504
|
+
subscribe: (e) => Z.call(i, e)
|
|
505
|
+
});
|
|
506
|
+
}, $ = J.prototype.currentReliableClientChannelIdentity, ne = J.prototype.message, re = (e, n, r) => {
|
|
507
|
+
if (!e || typeof e != "object" || !q.has(e)) throw new t({ detail: "Actual constructed client Session required for geometry requests" });
|
|
508
|
+
let i = e;
|
|
509
|
+
return Object.freeze({
|
|
510
|
+
identity: () => $.call(i, n, r),
|
|
511
|
+
write: (e) => {
|
|
512
|
+
if (!$.call(i, n, r)) throw new t({ detail: "Geometry request lost its exact native client channel admission" });
|
|
513
|
+
return ne.call(i, n, e);
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
};
|
|
517
|
+
export { p as RoomConnection, d as RoomInputRedundancy, v as RoomLatestDatagram, J as RoomSession, ee as RoomStreamFrameDecoder, l as RoomTransportCleanupFailure, B as WorldClient, a as WorldClientReceiptSchema, o as WorldClientRequestIdSchema, s as WorldClientTicketSchema, Q as captureRoomClientReliableChannel, re as captureRoomClientReliableIntention, u as captureRoomTransportEndpoints, A as createRoom, j as createRoomClient, m as defaultRoomClockPingCadence, G as defaultRoomClockSampling, f as defaultRoomInputRedundancy, h as defaultRoomReconnectPolicy, g as defaultRoomWebSocketFactory, x as defaultRoomWebTransportFactory, y as encodeRoomStreamFrame, M as joinById, N as joinRoom, te as joinSeat, P as joinWorld, w as listRooms, b as makeRoomStreamTransport, z as makeWorldEntityHandoffView, c as makeWorldHandoffView, _ as openRoomSocketTransport, S as openRoomWebTransport, K as roomCodecs, T as roomRpcReservations, C as roomTransportConnector, V as worldClientReceipt, H as worldClientTicket, E as worldRpcControls, D as worldRpcFollowerReservations, O as worldRpcPending, k as worldRpcReservations };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { ProtocolError as e, RoomAuthoringError as t } from "./errors.js";
|
|
2
|
+
import { captureRoomTransportClock as n } from "./transportAuthoring.js";
|
|
3
|
+
import { RoomTransportCleanupFailure as r } from "./transportCleanup.js";
|
|
4
|
+
import { RoomStreamFrameDecoder as i } from "./streamFraming.js";
|
|
5
|
+
import { makeRoomStreamTransport as a } from "./streamTransport.js";
|
|
6
|
+
// src/webTransportClient.ts
|
|
7
|
+
var o = (t, n) => {
|
|
8
|
+
let r = Reflect.get(globalThis, "WebTransport");
|
|
9
|
+
if (typeof r != "function") throw new e({ detail: "This platform requires a Room WebTransport factory" });
|
|
10
|
+
let i = n === void 0 ? {} : { serverCertificateHashes: [{
|
|
11
|
+
algorithm: "sha-256",
|
|
12
|
+
value: Uint8Array.from(atob(n), (e) => e.charCodeAt(0))
|
|
13
|
+
}] };
|
|
14
|
+
return Reflect.construct(r, [t, {
|
|
15
|
+
requireUnreliable: !1,
|
|
16
|
+
datagramsReadableType: "bytes",
|
|
17
|
+
...i
|
|
18
|
+
}]);
|
|
19
|
+
}, s = (e) => {
|
|
20
|
+
if (typeof e.createWritable == "function") return () => e.createWritable();
|
|
21
|
+
let t = e.writable;
|
|
22
|
+
return t instanceof WritableStream ? () => t : void 0;
|
|
23
|
+
}, c = async (c, l, u, d) => {
|
|
24
|
+
let f = [
|
|
25
|
+
"factory",
|
|
26
|
+
"clock",
|
|
27
|
+
"connectTimeoutMs",
|
|
28
|
+
"maxFrameBytes",
|
|
29
|
+
"maxChunkBytes",
|
|
30
|
+
"maxFramesPerChunk",
|
|
31
|
+
"maxQueuedBytes",
|
|
32
|
+
"maxListeners",
|
|
33
|
+
"maxDatagramBytes"
|
|
34
|
+
];
|
|
35
|
+
if (!u || Object.getPrototypeOf(u) !== Object.prototype || Reflect.ownKeys(u).some((e) => {
|
|
36
|
+
let t = Object.getOwnPropertyDescriptor(u, e);
|
|
37
|
+
return typeof e != "string" || !f.includes(e) || !t?.enumerable || !("value" in t);
|
|
38
|
+
}) || u.factory !== void 0 && typeof u.factory != "function" || !Number.isSafeInteger(u.connectTimeoutMs) || u.connectTimeoutMs < 1 || u.connectTimeoutMs > 3e5 || !Number.isSafeInteger(u.maxQueuedBytes) || u.maxQueuedBytes < 1 || u.maxQueuedBytes > 33554432 || !Number.isSafeInteger(u.maxListeners) || u.maxListeners < 1 || u.maxListeners > 1024 || !Number.isSafeInteger(u.maxDatagramBytes) || u.maxDatagramBytes < 1 || u.maxDatagramBytes > 65535) throw new t({
|
|
39
|
+
room: "webtransport",
|
|
40
|
+
detail: "Room WebTransport requires actual providers and bounded budgets"
|
|
41
|
+
});
|
|
42
|
+
let p = Object.freeze({
|
|
43
|
+
maxFrameBytes: u.maxFrameBytes,
|
|
44
|
+
maxChunkBytes: u.maxChunkBytes,
|
|
45
|
+
maxFramesPerChunk: u.maxFramesPerChunk
|
|
46
|
+
});
|
|
47
|
+
new i(p);
|
|
48
|
+
let m = n(u.clock), h = u.factory ?? o, g = u.maxQueuedBytes, _ = u.maxListeners, v = u.maxDatagramBytes, y = u.connectTimeoutMs, b;
|
|
49
|
+
try {
|
|
50
|
+
b = new URL(c);
|
|
51
|
+
} catch {
|
|
52
|
+
throw new e({ detail: "Room WebTransport requires a valid HTTPS address" });
|
|
53
|
+
}
|
|
54
|
+
if (b.protocol !== "https:" || b.username || b.password || b.search || b.hash) throw new e({ detail: "Room WebTransport address must use HTTPS without credentials, query or fragment" });
|
|
55
|
+
if (l.aborted) throw new e({ detail: "Room WebTransport admission was cancelled" });
|
|
56
|
+
let x;
|
|
57
|
+
if (d !== void 0 && !/^[A-Za-z0-9+/]{43}=$/.test(d)) throw new e({ detail: "Room WebTransport certificate hash must be one base64 SHA-256 digest" });
|
|
58
|
+
try {
|
|
59
|
+
x = d === void 0 ? h(b.toString()) : h(b.toString(), d);
|
|
60
|
+
} catch {
|
|
61
|
+
throw new e({ detail: "Room WebTransport native acquisition failed" });
|
|
62
|
+
}
|
|
63
|
+
if (!x || typeof x.close != "function" || typeof x.createBidirectionalStream != "function" || typeof x.ready?.then != "function" || typeof x.closed?.then != "function") {
|
|
64
|
+
typeof x?.ready?.then == "function" && Promise.resolve(x.ready).catch(() => {});
|
|
65
|
+
let t = !1, n = new r(async () => {
|
|
66
|
+
if (x && typeof x.close == "function" && !t && (x.close({
|
|
67
|
+
closeCode: 1e3,
|
|
68
|
+
reason: "Room WebTransport provider admission failed"
|
|
69
|
+
}), t = !0), !t || typeof x.closed?.then != "function") throw new e({ detail: "Room WebTransport provider lifetime remains unknown" });
|
|
70
|
+
await Promise.resolve(x.closed).catch(() => {});
|
|
71
|
+
});
|
|
72
|
+
try {
|
|
73
|
+
await n.cleanupAsync();
|
|
74
|
+
} catch {
|
|
75
|
+
throw n;
|
|
76
|
+
}
|
|
77
|
+
throw new e({ detail: "Room WebTransport provider admission failed" });
|
|
78
|
+
}
|
|
79
|
+
let S = x.close.bind(x), C = x.createBidirectionalStream.bind(x), w = x.ready, T = x.closed, E = new AbortController(), D = !1, O, k, A, j, M, N, P = Promise.resolve(T).then(() => {
|
|
80
|
+
D = !0, E.abort();
|
|
81
|
+
}, () => {
|
|
82
|
+
D = !0, E.abort();
|
|
83
|
+
}), F = () => {
|
|
84
|
+
E.abort();
|
|
85
|
+
};
|
|
86
|
+
l.addEventListener("abort", F, { once: !0 }), l.aborted && E.abort();
|
|
87
|
+
let I = () => {
|
|
88
|
+
O !== void 0 && clearTimeout(O), O = void 0, l.removeEventListener("abort", F);
|
|
89
|
+
}, L = async (e, t) => {
|
|
90
|
+
I(), D || S({
|
|
91
|
+
closeCode: e,
|
|
92
|
+
reason: t
|
|
93
|
+
}), await P;
|
|
94
|
+
}, R = () => {}, z = new Promise((t, n) => {
|
|
95
|
+
let r = () => {
|
|
96
|
+
n(new e({ detail: "Room WebTransport admission was cancelled, closed or exceeded its deadline" }));
|
|
97
|
+
};
|
|
98
|
+
E.signal.addEventListener("abort", r, { once: !0 }), R = () => {
|
|
99
|
+
E.signal.removeEventListener("abort", r);
|
|
100
|
+
}, O = setTimeout(() => {
|
|
101
|
+
E.abort();
|
|
102
|
+
}, y), E.signal.aborted && r();
|
|
103
|
+
}), B = (async () => {
|
|
104
|
+
if (await w, E.signal.aborted) throw new e({ detail: "Room WebTransport closed before stream admission" });
|
|
105
|
+
let t = x.reliability, n = t === void 0 ? Number.isSafeInteger(x.datagrams?.maxDatagramSize) && x.datagrams.maxDatagramSize > 0 && s(x.datagrams) !== void 0 ? "supports-unreliable" : "reliable-only" : t;
|
|
106
|
+
if (n !== "reliable-only" && n !== "supports-unreliable") throw new e({ detail: "Room WebTransport did not establish a reliability capability" });
|
|
107
|
+
let r = await C();
|
|
108
|
+
if (k = {
|
|
109
|
+
readable: r.readable,
|
|
110
|
+
writable: r.writable
|
|
111
|
+
}, E.signal.aborted) throw new e({ detail: "Room WebTransport closed before stream transfer" });
|
|
112
|
+
if (n === "supports-unreliable") {
|
|
113
|
+
let t = x.datagrams, n = t.maxDatagramSize, r = s(t);
|
|
114
|
+
if (!Number.isSafeInteger(n) || n < 1 || n > 65535 || r === void 0) throw new e({ detail: "Room WebTransport did not provide an actual bounded datagram capability" });
|
|
115
|
+
j = t.readable, A = {
|
|
116
|
+
readable: j,
|
|
117
|
+
writable: r()
|
|
118
|
+
}, M = await a({
|
|
119
|
+
...p,
|
|
120
|
+
reliable: k,
|
|
121
|
+
datagrams: {
|
|
122
|
+
...A,
|
|
123
|
+
maxDatagramBytes: Math.min(v, n)
|
|
124
|
+
},
|
|
125
|
+
maxQueuedBytes: g,
|
|
126
|
+
maxListeners: _,
|
|
127
|
+
clock: m,
|
|
128
|
+
signal: E.signal,
|
|
129
|
+
release: L
|
|
130
|
+
});
|
|
131
|
+
} else M = await a({
|
|
132
|
+
...p,
|
|
133
|
+
reliable: k,
|
|
134
|
+
maxQueuedBytes: g,
|
|
135
|
+
maxListeners: _,
|
|
136
|
+
clock: m,
|
|
137
|
+
signal: E.signal,
|
|
138
|
+
release: L
|
|
139
|
+
});
|
|
140
|
+
return M;
|
|
141
|
+
})().catch((e) => {
|
|
142
|
+
throw e instanceof r && (N = e), e;
|
|
143
|
+
});
|
|
144
|
+
try {
|
|
145
|
+
let t = await Promise.race([B, z]);
|
|
146
|
+
if (E.signal.aborted) throw new e({ detail: "Room WebTransport closed during admission" });
|
|
147
|
+
return O !== void 0 && clearTimeout(O), O = void 0, R(), t;
|
|
148
|
+
} catch {
|
|
149
|
+
E.abort(), R();
|
|
150
|
+
let t = /* @__PURE__ */ new Set(), n = new r(async () => {
|
|
151
|
+
if (await L(1e3, "Room WebTransport admission failed"), await Promise.allSettled([B]), M) await M.closeAsync(1e3, "Room WebTransport admission failed");
|
|
152
|
+
else {
|
|
153
|
+
N && await N.cleanupAsync();
|
|
154
|
+
let n = [], r = (e, r) => {
|
|
155
|
+
t.has(e) || n.push(Promise.resolve().then(r).then(() => {
|
|
156
|
+
t.add(e);
|
|
157
|
+
}));
|
|
158
|
+
};
|
|
159
|
+
for (let e of [k, A]) e && (r(e.readable, () => e.readable.cancel()), r(e.writable, () => e.writable.abort()));
|
|
160
|
+
if (j && !A && r(j, () => j.cancel()), (await Promise.allSettled(n)).some((e) => e.status === "rejected")) throw new e({ detail: "Room WebTransport stream cleanup remains incomplete" });
|
|
161
|
+
}
|
|
162
|
+
I();
|
|
163
|
+
});
|
|
164
|
+
try {
|
|
165
|
+
await n.cleanupAsync();
|
|
166
|
+
} catch {
|
|
167
|
+
throw n;
|
|
168
|
+
}
|
|
169
|
+
throw new e({ detail: "Room WebTransport admission failed" });
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
export { o as defaultRoomWebTransportFactory, c as openRoomWebTransport };
|