@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
|
@@ -0,0 +1,772 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomAuthoringError as n } from "./errors.js";
|
|
2
|
+
import { unsignedWord as r } from "./fixedWords.js";
|
|
3
|
+
import { simulationOwnData as i } from "./simulationAuthoring.js";
|
|
4
|
+
import { createSimulationOptionsCodec as a } from "./simulationOptionsWire.js";
|
|
5
|
+
import { createSimulationInputHistoryCodec as o } from "./simulationInputHistoryWire.js";
|
|
6
|
+
import { createSimulationRecoveryCodec as s } from "./simulationRecoveryWire.js";
|
|
7
|
+
import { assertCapturedSimulation as c } from "./simulation.js";
|
|
8
|
+
import { captureRoomLockstepServerOptions as l } from "./lockstepServerConfig.js";
|
|
9
|
+
import { RoomInputCodec as u } from "./stateCodec.js";
|
|
10
|
+
import { captureRoomLockstepWireRoster as d, roomLockstepStartBudgetRoster as f } from "./lockstepWireRoster.js";
|
|
11
|
+
import { encodeRoomFrame as p } from "./wire.js";
|
|
12
|
+
import { roomLockstepJournalRosterAt as m } from "./lockstepJournalPorts.js";
|
|
13
|
+
import { captureLockstepJournalScope as h, createLockstepJournalCodec as g, extendsRoomLockstepJournal as _, lockstepJournalIdentity as v } from "./lockstepJournalCodec.js";
|
|
14
|
+
import { captureRoomLockstepSessionPort as y } from "./serverSession.js";
|
|
15
|
+
import { captureRoomLockstepTransportLimits as b } from "./lockstepTransportConfig.js";
|
|
16
|
+
import { createRoomLockstepHostLoop as x } from "./lockstepHostLoop.js";
|
|
17
|
+
import { Effect as S, Result as C } from "effect";
|
|
18
|
+
// src/lockstepTransport.ts
|
|
19
|
+
function w(e) {
|
|
20
|
+
throw new t({ detail: e });
|
|
21
|
+
}
|
|
22
|
+
var T = (e, t) => t !== null && Object.keys(e).every((n) => e[n] === t[n]), E = class {
|
|
23
|
+
id;
|
|
24
|
+
#e;
|
|
25
|
+
#t;
|
|
26
|
+
#n;
|
|
27
|
+
#r;
|
|
28
|
+
#i;
|
|
29
|
+
#a;
|
|
30
|
+
#o;
|
|
31
|
+
#s;
|
|
32
|
+
#c;
|
|
33
|
+
#l;
|
|
34
|
+
#u;
|
|
35
|
+
#d = /* @__PURE__ */ new Map();
|
|
36
|
+
#f = /* @__PURE__ */ new WeakMap();
|
|
37
|
+
#p;
|
|
38
|
+
#m = null;
|
|
39
|
+
#h = null;
|
|
40
|
+
#g = [];
|
|
41
|
+
#_;
|
|
42
|
+
#v = null;
|
|
43
|
+
#y = null;
|
|
44
|
+
#b = null;
|
|
45
|
+
#x = null;
|
|
46
|
+
#S = /* @__PURE__ */ new Map();
|
|
47
|
+
#C = [];
|
|
48
|
+
#w = [];
|
|
49
|
+
#T = null;
|
|
50
|
+
#E = !1;
|
|
51
|
+
#D = !1;
|
|
52
|
+
#O = !1;
|
|
53
|
+
#k = null;
|
|
54
|
+
#A = null;
|
|
55
|
+
constructor(e, t, o, d, p, m = {}, _ = {}, y = {}) {
|
|
56
|
+
if (c(e), this.#e = e, this.#a = r(t), typeof p != "function") throw new n({
|
|
57
|
+
room: "lockstep",
|
|
58
|
+
detail: "Transport owner requires the actual host clock"
|
|
59
|
+
});
|
|
60
|
+
this.#i = p;
|
|
61
|
+
let S = i(y, [
|
|
62
|
+
"redundantTicks",
|
|
63
|
+
"maxFlushWork",
|
|
64
|
+
"maxPendingWireBytes",
|
|
65
|
+
"maxRedundancyWireBytes",
|
|
66
|
+
"maxPendingHashResults",
|
|
67
|
+
"journal"
|
|
68
|
+
], []), { journal: C, ...T } = S, E = b(T);
|
|
69
|
+
if (this.#c = h(d), this.#_ = g(e, 65536, 67108864, 64), Object.hasOwn(S, "journal")) {
|
|
70
|
+
let e = i(S.journal, [
|
|
71
|
+
"service",
|
|
72
|
+
"runEffect",
|
|
73
|
+
"startRequestId"
|
|
74
|
+
], [
|
|
75
|
+
"service",
|
|
76
|
+
"runEffect",
|
|
77
|
+
"startRequestId"
|
|
78
|
+
]), t = i(e.service, [
|
|
79
|
+
"initialize",
|
|
80
|
+
"append",
|
|
81
|
+
"join",
|
|
82
|
+
"load",
|
|
83
|
+
"adopt",
|
|
84
|
+
"exportSubject",
|
|
85
|
+
"erase"
|
|
86
|
+
], [
|
|
87
|
+
"initialize",
|
|
88
|
+
"append",
|
|
89
|
+
"load",
|
|
90
|
+
"adopt",
|
|
91
|
+
"exportSubject",
|
|
92
|
+
"erase"
|
|
93
|
+
]);
|
|
94
|
+
(typeof e.runEffect != "function" || Object.values(t).some((e) => typeof e != "function")) && w("Durable transport requires a complete Journal capability and actual Effect runner");
|
|
95
|
+
let n = v(e.startRequestId);
|
|
96
|
+
n.length > 150 && w("Journal start request leaves no bounded immutable tick suffix"), this.#l = Object.freeze({
|
|
97
|
+
service: Object.freeze(Object.fromEntries(Object.entries(t).map(([t, n]) => [t, n.bind(e.service)]))),
|
|
98
|
+
runEffect: e.runEffect,
|
|
99
|
+
startRequestId: n
|
|
100
|
+
});
|
|
101
|
+
} else this.#l = null;
|
|
102
|
+
let D = l(m);
|
|
103
|
+
this.#s = Object.freeze(E), this.#p = D.limits.maxReplayTicks, this.#u = D.limits.hashHistoryTicks, this.#o = a(e).encode(o), this.#n = new u(e.definition.input, e.inputCodec.limits), this.#r = s(e, {
|
|
104
|
+
maxBytes: this.#s.maxPendingWireBytes,
|
|
105
|
+
maxTicks: 4096
|
|
106
|
+
});
|
|
107
|
+
let O = Object.getOwnPropertyDescriptor(m, "maxPlayers");
|
|
108
|
+
(O && (!O.enumerable || !("value" in O)) || !O && "maxPlayers" in m) && w("Start player budget requires own data without accessors"), this.frameBytes({
|
|
109
|
+
kind: "LsStart",
|
|
110
|
+
startTick: 0,
|
|
111
|
+
seed: this.#a,
|
|
112
|
+
options: this.#o,
|
|
113
|
+
serverTimeMs: 2 ** 53 - 1,
|
|
114
|
+
localPlayerId: 4294967295,
|
|
115
|
+
roster: f(O ? O.value : 8)
|
|
116
|
+
}), this.#t = x(e, t, o, d, p, m, _), this.id = this.#t.id;
|
|
117
|
+
}
|
|
118
|
+
live() {
|
|
119
|
+
if (this.#D || this.#t.isDisposed()) return w("Lockstep transport owner is withdrawn");
|
|
120
|
+
}
|
|
121
|
+
operation(e) {
|
|
122
|
+
if (this.#O) return w("Lockstep transport supervision cannot reenter active work");
|
|
123
|
+
this.#O = !0;
|
|
124
|
+
try {
|
|
125
|
+
return e();
|
|
126
|
+
} finally {
|
|
127
|
+
this.#O = !1;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
current(e) {
|
|
131
|
+
if (!T(e.evidence, e.port.identity()) || e.port.inputSchemaHash() !== this.#n.schemaHash) return w("Lockstep transport requires the same current SQL-admitted Session and input layout");
|
|
132
|
+
}
|
|
133
|
+
deliverable(e) {
|
|
134
|
+
return e.port.identity() !== null && (this.current(e), !0);
|
|
135
|
+
}
|
|
136
|
+
frameBytes(e) {
|
|
137
|
+
let t = p(e, {
|
|
138
|
+
maxBytes: this.#s.maxPendingWireBytes,
|
|
139
|
+
maxInputs: 4096
|
|
140
|
+
});
|
|
141
|
+
if (C.isFailure(t)) throw t.failure;
|
|
142
|
+
return t.success.byteLength;
|
|
143
|
+
}
|
|
144
|
+
admit(e, t) {
|
|
145
|
+
return this.operation(() => {
|
|
146
|
+
if (this.live(), this.#E || this.#b) return w("Transport roster cannot admit after start or a durable start attempt");
|
|
147
|
+
let n = y(t), r = n.identity();
|
|
148
|
+
if (!r || !n.canActivate()) return w("Transport needs a live unbound welcomed player");
|
|
149
|
+
let i = this.#t.admit(e, t), a = Object.freeze({
|
|
150
|
+
actual: t,
|
|
151
|
+
port: n,
|
|
152
|
+
evidence: r,
|
|
153
|
+
player: i
|
|
154
|
+
});
|
|
155
|
+
return this.#S.set(i.playerId, a), i;
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
stageRecovery(e) {
|
|
159
|
+
this.operation(() => {
|
|
160
|
+
if (this.live(), this.#E || this.#S.size || this.#v) return w("Recovery requires a fresh private transport owner");
|
|
161
|
+
let t = this.#_.captureStored(e, this.#c);
|
|
162
|
+
if (!this.#l || !t.adoption || t.adoption.priorEpoch !== this.#c.epoch - 1 || t.initial.seed !== this.#a || t.initial.options !== Buffer.from(this.#o).toString("base64url") || t.initial.requestId !== this.#l.startRequestId) return w("Recovery journal changed actual initial ownership");
|
|
163
|
+
let n = this.#t.serverRole === "relay" || t.ticks.length <= this.#t.roleMetrics().refereeLagTicks, r = n && t.ticks.length ? this.inputHistory(t, this.#p) : null, i = d(m(t, t.ticks.length).map((e) => ({
|
|
164
|
+
slot: e.slot,
|
|
165
|
+
playerId: e.playerId
|
|
166
|
+
})));
|
|
167
|
+
if (n) for (let e of i) this.frameBytes({
|
|
168
|
+
kind: "LsStart",
|
|
169
|
+
startTick: t.ticks.length,
|
|
170
|
+
seed: this.#a,
|
|
171
|
+
options: this.#o,
|
|
172
|
+
serverTimeMs: 2 ** 53 - 1,
|
|
173
|
+
roster: i,
|
|
174
|
+
localPlayerId: e.playerId,
|
|
175
|
+
...r ? { history: r } : {}
|
|
176
|
+
});
|
|
177
|
+
this.#v = {
|
|
178
|
+
journal: t,
|
|
179
|
+
history: r,
|
|
180
|
+
cursor: 0,
|
|
181
|
+
sealed: !1,
|
|
182
|
+
replayed: !1
|
|
183
|
+
}, this.#y = t;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
admitRecovered(e) {
|
|
187
|
+
return this.operation(() => {
|
|
188
|
+
this.live();
|
|
189
|
+
let t = this.#v;
|
|
190
|
+
if (!t || this.#E || this.#b) return w("Recovered roster is not awaiting genuine current Sessions");
|
|
191
|
+
let n = y(e), r = n.identity(), i = r ? m(t.journal, 2 ** 53 - 1).find((e) => e.sessionId === r.sessionId && e.subjectId === r.subjectId) : void 0;
|
|
192
|
+
if (!i || !r || !n.canActivate() || this.#S.has(i.playerId)) return w("Recovery requires its exact retained Subject/Seat with actual current Welcome");
|
|
193
|
+
let a = t.journal.joins?.some((e) => e.playerId === i.playerId) ?? !1 ? Object.freeze({
|
|
194
|
+
slot: i.slot,
|
|
195
|
+
playerId: i.playerId
|
|
196
|
+
}) : this.#t.admitAt({
|
|
197
|
+
slot: i.slot,
|
|
198
|
+
playerId: i.playerId
|
|
199
|
+
}, e), o = Object.freeze({
|
|
200
|
+
actual: e,
|
|
201
|
+
port: n,
|
|
202
|
+
evidence: r,
|
|
203
|
+
player: a
|
|
204
|
+
});
|
|
205
|
+
return this.#S.set(a.playerId, o), a;
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
rebindAsync(e) {
|
|
209
|
+
if (this.#m || this.#h || this.#x || this.#k || this.#O) return Promise.reject(new t({ detail: "Reconnect cannot overlap active transport supervision" }));
|
|
210
|
+
let n, r, i, a, o = this.#l, s = this.#y;
|
|
211
|
+
if (!o || !s) return Promise.reject(new t({ detail: "Reconnect requires a confirmed SQL Journal capability" }));
|
|
212
|
+
try {
|
|
213
|
+
this.operation(() => {
|
|
214
|
+
if (this.live(), !this.#E || !o || !s || this.#T || this.#g.length || this.#t.roleMetrics().pendingDeliveries > 0 || this.#w.length || s.ticks.length !== this.#t.metrics().tick) return w("Reconnect requires a fully confirmed durable current frontier");
|
|
215
|
+
let t = y(e), i = t.identity(), a = i ? [...this.#S.values()].find((e) => e.evidence.sessionId === i.sessionId && e.evidence.subjectId === i.subjectId) : void 0;
|
|
216
|
+
if (!i || !a || a.port.identity() !== null || !t.canActivate()) return w("Reconnect requires a withdrawn retained Seat and genuine current Welcome");
|
|
217
|
+
let c = m(s, 2 ** 53 - 1).find((e) => e.sessionId === i.sessionId && e.subjectId === i.subjectId);
|
|
218
|
+
if (!c || c.slot !== a.player.slot || c.playerId !== a.player.playerId) return w("Reconnect changed retained SQL player identity");
|
|
219
|
+
n = Object.freeze({
|
|
220
|
+
actual: e,
|
|
221
|
+
port: t,
|
|
222
|
+
evidence: i,
|
|
223
|
+
player: a.player
|
|
224
|
+
}), r = a;
|
|
225
|
+
});
|
|
226
|
+
} catch (e) {
|
|
227
|
+
return Promise.reject(e);
|
|
228
|
+
}
|
|
229
|
+
let c = async () => {
|
|
230
|
+
for (let e = 0; e < 2; e++) {
|
|
231
|
+
let t = this.#_.captureStored(await this.runJournal(o.service.load(this.#c)), this.#c, s.hostId);
|
|
232
|
+
if (this.live(), t.digest !== s.digest || this.#y !== s || this.#t.metrics().tick !== s.ticks.length) return w("Reconnect lost its exact current SQL journal frontier");
|
|
233
|
+
if (this.current(n), !n.port.canActivate() || r.port.identity() !== null) return w("Reconnect admission changed while confirming SQL");
|
|
234
|
+
e === 0 && this.operation(() => {
|
|
235
|
+
i = this.bootstrap(s, n.player.playerId), a = this.frameBytes(i);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
return this.operation(() => {
|
|
239
|
+
if (this.live(), this.#T || this.#S.get(r.player.playerId) !== r) return w("Reconnect lost its retained delivery owner");
|
|
240
|
+
let t = this.#t.rebind(e);
|
|
241
|
+
return n.port.activate((e) => {
|
|
242
|
+
this.receive(n, e);
|
|
243
|
+
}, () => this.#t.metrics().tick), r.port.withdraw(), this.#S.set(t.playerId, n), this.#b &&= Object.freeze(this.#b.map((e) => e === r ? n : e)), this.#T = {
|
|
244
|
+
frame: i,
|
|
245
|
+
bytes: a,
|
|
246
|
+
targets: Object.freeze([n]),
|
|
247
|
+
next: 0
|
|
248
|
+
}, this.#g.push(...this.futureJoins(s, [n])), t;
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
return this.#m = Promise.resolve().then(c).finally(() => {
|
|
252
|
+
this.#m = null;
|
|
253
|
+
}), this.#m;
|
|
254
|
+
}
|
|
255
|
+
inputHistory(e, t) {
|
|
256
|
+
let n = e.ticks.length, r = (e.joins ?? []).filter((e) => e.tick <= n);
|
|
257
|
+
return o(this.#e, {
|
|
258
|
+
maxBytes: this.#s.maxPendingWireBytes,
|
|
259
|
+
maxTicks: t,
|
|
260
|
+
maxPlayers: 64
|
|
261
|
+
}).encode({
|
|
262
|
+
fromTick: 0,
|
|
263
|
+
playerIds: m(e, n).map((e) => e.playerId),
|
|
264
|
+
...r.length ? { joins: r.map((e) => ({
|
|
265
|
+
playerId: e.playerId,
|
|
266
|
+
tick: e.tick
|
|
267
|
+
})) } : {},
|
|
268
|
+
inputs: e.ticks.map((t) => {
|
|
269
|
+
let n = m(e, t.tick);
|
|
270
|
+
return {
|
|
271
|
+
tick: t.tick,
|
|
272
|
+
inputs: t.inputs.map((e, t) => ({
|
|
273
|
+
playerId: n[t].playerId,
|
|
274
|
+
input: this.#_.decodeInput(e)
|
|
275
|
+
}))
|
|
276
|
+
};
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
futureJoins(e, t) {
|
|
281
|
+
return (e.joins ?? []).filter((t) => t.tick > e.ticks.length).map((e) => {
|
|
282
|
+
let n = {
|
|
283
|
+
kind: "LsJoin",
|
|
284
|
+
tick: e.tick,
|
|
285
|
+
slot: e.slot,
|
|
286
|
+
playerId: e.playerId
|
|
287
|
+
};
|
|
288
|
+
return {
|
|
289
|
+
frame: n,
|
|
290
|
+
bytes: this.frameBytes(n),
|
|
291
|
+
targets: Object.freeze([...t]),
|
|
292
|
+
next: 0
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
bootstrap(e, t) {
|
|
297
|
+
if (this.live(), e.ticks.length !== this.#t.metrics().tick) return w("Bootstrap requires the exact confirmed actual authority frontier");
|
|
298
|
+
let n = this.#t.roleMetrics().refereeTick, r = n !== null && n > 0 ? this.#t.recovery() : null;
|
|
299
|
+
if (r) {
|
|
300
|
+
if ((e.joins ?? []).some((t) => t.tick > r.snapshot.tick && t.tick <= e.ticks.length)) return w("Snapshot bootstrap waits until the referee passes the latest late join");
|
|
301
|
+
for (let t of [{
|
|
302
|
+
tick: r.snapshot.tick,
|
|
303
|
+
inputs: r.inputs
|
|
304
|
+
}, ...r.continuation ?? []]) {
|
|
305
|
+
let n = e.ticks[t.tick - 1], r = m(e, t.tick);
|
|
306
|
+
if (!n || t.inputs.length !== r.length) return w("Snapshot bootstrap needs its exact confirmed SQL matrix base/tail");
|
|
307
|
+
for (let e of t.inputs) {
|
|
308
|
+
let t = r.findIndex((t) => t.playerId === e.playerId), i = this.#n.full(e.input);
|
|
309
|
+
if (t < 0 || C.isFailure(i) || this.#_.captureInput(i.success) !== n.inputs[t]) return w("Snapshot bootstrap changed actual SQL intentions");
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
let i = r ? this.#r.encode(r) : void 0, a = this.#v?.journal.digest === e.digest ? this.#v : null, o = !r && e.ticks.length ? a?.history?.slice() ?? this.inputHistory(e, this.#p) : void 0, s = Math.floor(this.#i());
|
|
314
|
+
return !Number.isSafeInteger(s) || s < 0 ? w("Bootstrap needs the actual monotonic host time") : {
|
|
315
|
+
kind: "LsStart",
|
|
316
|
+
startTick: e.ticks.length,
|
|
317
|
+
seed: this.#a,
|
|
318
|
+
options: this.#o.slice(),
|
|
319
|
+
serverTimeMs: s,
|
|
320
|
+
roster: d(m(e, e.ticks.length).map((e) => ({
|
|
321
|
+
slot: e.slot,
|
|
322
|
+
playerId: e.playerId
|
|
323
|
+
}))),
|
|
324
|
+
localPlayerId: t,
|
|
325
|
+
...o ? { history: o } : {},
|
|
326
|
+
...i ? { snapshot: i } : {}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
start() {
|
|
330
|
+
return this.operation(() => {
|
|
331
|
+
if (this.live(), this.#l) return w("Durable transport must await startAsync SQL admission");
|
|
332
|
+
if (this.#E) return w("Lockstep transport is already started");
|
|
333
|
+
let e = [...this.#S.values()];
|
|
334
|
+
if (!e.length) return w("Lockstep start requires players");
|
|
335
|
+
for (let t of e) if (this.current(t), !t.port.canActivate()) return w("Lockstep Session was bound by another owner");
|
|
336
|
+
return this.queueStart(e);
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
queueStart(e, t = !1, n) {
|
|
340
|
+
let r = n?.serverTimeMs ?? Math.floor(this.#i());
|
|
341
|
+
if (!Number.isSafeInteger(r) || r < 0) return w("Invalid host start time");
|
|
342
|
+
let i = d(e.map((e) => ({
|
|
343
|
+
slot: e.player.slot,
|
|
344
|
+
playerId: e.player.playerId
|
|
345
|
+
}))), a = n ?? (t ? this.bootstrap(this.#v.journal, e[0].player.playerId) : {
|
|
346
|
+
kind: "LsStart",
|
|
347
|
+
startTick: 0,
|
|
348
|
+
seed: this.#a,
|
|
349
|
+
options: this.#o.slice(),
|
|
350
|
+
serverTimeMs: r,
|
|
351
|
+
roster: i,
|
|
352
|
+
localPlayerId: e[0].player.playerId
|
|
353
|
+
}), o = Math.max(...e.map((e) => this.frameBytes({
|
|
354
|
+
...a,
|
|
355
|
+
localPlayerId: e.player.playerId
|
|
356
|
+
})));
|
|
357
|
+
for (let t of e) if (this.current(t), !t.port.canActivate()) return w("Lockstep start lost its current Session");
|
|
358
|
+
let s = t ? Object.freeze(e.map((e) => e.player)) : this.#t.seal();
|
|
359
|
+
t || this.#t.finishBootstrap();
|
|
360
|
+
for (let t of e) if (this.current(t), !t.port.canActivate()) return w("Lockstep seal lost its unbound Session");
|
|
361
|
+
for (let t of e) t.port.activate((e) => {
|
|
362
|
+
this.receive(t, e);
|
|
363
|
+
}, () => this.#t.metrics().tick);
|
|
364
|
+
return this.#E = !0, this.#T = {
|
|
365
|
+
frame: a,
|
|
366
|
+
bytes: o,
|
|
367
|
+
targets: Object.freeze(e),
|
|
368
|
+
next: 0
|
|
369
|
+
}, s;
|
|
370
|
+
}
|
|
371
|
+
startAsync() {
|
|
372
|
+
if (!this.#l) return Promise.resolve().then(() => this.start());
|
|
373
|
+
if (this.#x || this.#O || this.#E) return Promise.reject(new t({ detail: "Durable start cannot overlap or restart a sealed owner" }));
|
|
374
|
+
let e = this.#l;
|
|
375
|
+
try {
|
|
376
|
+
this.operation(() => {
|
|
377
|
+
this.live();
|
|
378
|
+
let e = this.#b ?? Object.freeze([...this.#S.values()]);
|
|
379
|
+
if (!e.length) return w("Durable start requires actual players");
|
|
380
|
+
for (let t of e) if (this.current(t), !t.port.canActivate()) return w("Durable start lost an unbound current Session");
|
|
381
|
+
this.#b = e;
|
|
382
|
+
});
|
|
383
|
+
} catch (e) {
|
|
384
|
+
return Promise.reject(e);
|
|
385
|
+
}
|
|
386
|
+
let n = async () => {
|
|
387
|
+
if (this.#v) return this.startRecovered();
|
|
388
|
+
let t = this.#b;
|
|
389
|
+
this.live();
|
|
390
|
+
let n = this.#_.optionsWire.decode(this.#o);
|
|
391
|
+
this.live();
|
|
392
|
+
let r = e.service.initialize({
|
|
393
|
+
...this.#c,
|
|
394
|
+
requestId: e.startRequestId,
|
|
395
|
+
seed: this.#a,
|
|
396
|
+
options: n,
|
|
397
|
+
players: t.map((e) => ({
|
|
398
|
+
...e.player,
|
|
399
|
+
actualSession: e.actual
|
|
400
|
+
}))
|
|
401
|
+
}), i = await this.runJournal(r);
|
|
402
|
+
return this.operation(() => {
|
|
403
|
+
this.live();
|
|
404
|
+
let n = this.#_.captureStored(i, this.#c);
|
|
405
|
+
if (n.ownerEpoch !== this.#c.epoch || n.adoption !== null || n.ticks.length || n.initial.requestId !== e.startRequestId || n.initial.seed !== this.#a || n.initial.options !== Buffer.from(this.#o).toString("base64url") || n.initial.players.length !== t.length) return w("Durable start receipt is not the exact new SQL seed/roster");
|
|
406
|
+
for (let e = 0; e < t.length; e++) {
|
|
407
|
+
let r = t[e], i = n.initial.players[e];
|
|
408
|
+
if (this.current(r), i.slot !== r.player.slot || i.playerId !== r.player.playerId || i.subjectId !== r.evidence.subjectId || i.sessionId !== r.evidence.sessionId) return w("Durable start receipt changed actual admitted identity");
|
|
409
|
+
}
|
|
410
|
+
return this.#y = n, this.queueStart(t);
|
|
411
|
+
});
|
|
412
|
+
};
|
|
413
|
+
return this.#x = Promise.resolve().then(n).finally(() => {
|
|
414
|
+
this.#x = null;
|
|
415
|
+
}), this.#x;
|
|
416
|
+
}
|
|
417
|
+
async startRecovered() {
|
|
418
|
+
let e = this.#v, t = this.#b, n = this.#l, r = m(e.journal, 2 ** 53 - 1).map((e) => t.find((t) => t.player.playerId === e.playerId));
|
|
419
|
+
if (r.length !== t.length || r.some((e) => !e)) return w("Recovery Start requires every retained genuine Session");
|
|
420
|
+
let i = r, a = async () => {
|
|
421
|
+
if (this.#_.captureStored(await this.runJournal(n.service.load(this.#c)), this.#c, e.journal.hostId).digest !== e.journal.digest) return w("Recovery Start lost its actual current SQL journal");
|
|
422
|
+
for (let e of i) if (this.current(e), !e.port.canActivate()) return w("Recovery Start lost its actual unbound Session");
|
|
423
|
+
};
|
|
424
|
+
if (await a(), this.live(), !e.sealed) {
|
|
425
|
+
this.#t.seal();
|
|
426
|
+
for (let t of e.journal.joins ?? []) this.#t.join({
|
|
427
|
+
slot: t.slot,
|
|
428
|
+
playerId: t.playerId
|
|
429
|
+
}, i.find((e) => e.player.playerId === t.playerId).actual, t.tick);
|
|
430
|
+
e.sealed = !0;
|
|
431
|
+
}
|
|
432
|
+
for (; e.cursor < e.journal.ticks.length; e.cursor++) {
|
|
433
|
+
let t = e.journal.ticks[e.cursor], n = m(e.journal, t.tick);
|
|
434
|
+
this.#t.replayMatrix(t.tick, n.map((e) => i.find((t) => t.player.playerId === e.playerId).actual), t.inputs.map((e) => Uint8Array.from(Buffer.from(e, "base64url"))));
|
|
435
|
+
}
|
|
436
|
+
e.replayed ||= (this.#t.finishBootstrap(), !0);
|
|
437
|
+
let o = this.operation(() => this.bootstrap(e.journal, i[0].player.playerId));
|
|
438
|
+
return this.frameBytes(o), await a(), this.live(), this.operation(() => {
|
|
439
|
+
let t = this.queueStart(i, !0, o);
|
|
440
|
+
return this.#g.push(...this.futureJoins(e.journal, i)), t;
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
retains(e) {
|
|
444
|
+
let t = y(e).identity();
|
|
445
|
+
return t !== null && [...this.#S.values()].some((e) => e.evidence.sessionId === t.sessionId && e.evidence.subjectId === t.subjectId);
|
|
446
|
+
}
|
|
447
|
+
lateJoinReady() {
|
|
448
|
+
let e = this.#y;
|
|
449
|
+
if (this.#D || !this.#E || !this.#l?.service.join || !e || this.#m || this.#h || this.#x || this.#k || this.#O || this.#T || this.#g.length || this.#t.roleMetrics().pendingDeliveries > 0 || this.#w.length || e.ticks.length !== this.#t.metrics().tick) return !1;
|
|
450
|
+
let t = this.#t.roleMetrics().refereeTick;
|
|
451
|
+
return t === null || t === 0 || !(e.joins ?? []).some((e) => e.tick > t);
|
|
452
|
+
}
|
|
453
|
+
joinAsync(e, n, i) {
|
|
454
|
+
if (this.#m || this.#h || this.#x || this.#k || this.#O) return Promise.reject(new t({ detail: "Late join cannot overlap active transport supervision" }));
|
|
455
|
+
let a = this.#l, o = this.#y, s = a?.service.join;
|
|
456
|
+
if (!a || !o || !s) return Promise.reject(new t({ detail: "Late join requires a confirmed SQL Journal with join support" }));
|
|
457
|
+
let c, l, u, d;
|
|
458
|
+
try {
|
|
459
|
+
this.operation(() => {
|
|
460
|
+
if (this.live(), !this.#E || this.#T || this.#g.length || this.#t.roleMetrics().pendingDeliveries > 0 || this.#w.length || o.ticks.length !== this.#t.metrics().tick) return w("Late join requires a fully confirmed durable current frontier");
|
|
461
|
+
if (!Number.isSafeInteger(i) || i < 1 || i > 4096) return w("Late join lead must be 1..4096 ticks");
|
|
462
|
+
let t = y(e), a = t.identity(), s = m(o, 2 ** 53 - 1);
|
|
463
|
+
if (!a || !t.canActivate() || s.some((e) => e.sessionId === a.sessionId || e.playerId === n)) return w("Late join requires a new player with a genuine current Welcome");
|
|
464
|
+
let f = 0;
|
|
465
|
+
for (; s.some((e) => e.slot === f);) f++;
|
|
466
|
+
d = o.ticks.length + i, c = Object.freeze({
|
|
467
|
+
actual: e,
|
|
468
|
+
port: t,
|
|
469
|
+
evidence: a,
|
|
470
|
+
player: Object.freeze({
|
|
471
|
+
slot: f,
|
|
472
|
+
playerId: r(n)
|
|
473
|
+
})
|
|
474
|
+
}), l = this.bootstrap(o, c.player.playerId), u = this.frameBytes(l);
|
|
475
|
+
});
|
|
476
|
+
} catch (e) {
|
|
477
|
+
return Promise.reject(e);
|
|
478
|
+
}
|
|
479
|
+
let f = async () => {
|
|
480
|
+
let t = await this.runJournal(s({
|
|
481
|
+
...this.#c,
|
|
482
|
+
requestId: `${a.startRequestId}::join:${c.player.playerId}`,
|
|
483
|
+
tick: d,
|
|
484
|
+
player: {
|
|
485
|
+
...c.player,
|
|
486
|
+
actualSession: e
|
|
487
|
+
}
|
|
488
|
+
}));
|
|
489
|
+
return this.operation(() => {
|
|
490
|
+
this.live();
|
|
491
|
+
let n = this.#_.captureStored(t, this.#c, o.hostId), r = n.joins?.find((e) => e.playerId === c.player.playerId);
|
|
492
|
+
if (this.#y !== o || this.#T || this.#g.length || this.#t.metrics().tick !== o.ticks.length || JSON.stringify(n.ticks) !== JSON.stringify(o.ticks) || JSON.stringify(n.initial) !== JSON.stringify(o.initial) || !r || r.tick !== d || r.slot !== c.player.slot || r.subjectId !== c.evidence.subjectId || r.sessionId !== c.evidence.sessionId) return w("Late join receipt changed the confirmed frontier or admitted identity");
|
|
493
|
+
if (this.current(c), !c.port.canActivate()) return w("Late join lost its unbound Session");
|
|
494
|
+
let i = Object.freeze([...this.#S.values()].filter((e) => this.deliverable(e))), a = this.#t.join(c.player, e, d);
|
|
495
|
+
return c.port.activate((e) => {
|
|
496
|
+
this.receive(c, e);
|
|
497
|
+
}, () => this.#t.metrics().tick), this.#S.set(a.playerId, c), this.#y = n, this.#T = {
|
|
498
|
+
frame: l,
|
|
499
|
+
bytes: u,
|
|
500
|
+
targets: Object.freeze([c]),
|
|
501
|
+
next: 0
|
|
502
|
+
}, this.#g.push(...this.futureJoins(n, [c]).map((e) => e.frame.playerId === a.playerId ? {
|
|
503
|
+
...e,
|
|
504
|
+
targets: Object.freeze([...i, c])
|
|
505
|
+
} : e)), a;
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
return this.#h = Promise.resolve().then(f).finally(() => {
|
|
509
|
+
this.#h = null;
|
|
510
|
+
}), this.#h;
|
|
511
|
+
}
|
|
512
|
+
runJournal(e) {
|
|
513
|
+
return !this.#l || !S.isEffect(e) ? Promise.reject(new t({ detail: "Journal must return an actual Effect" })) : this.#l.runEffect(S.uninterruptible(e));
|
|
514
|
+
}
|
|
515
|
+
receive(t, n) {
|
|
516
|
+
this.operation(() => {
|
|
517
|
+
if (this.live(), this.current(t), n.kind === "LsInput") {
|
|
518
|
+
this.#t.submit(t.actual, n.firstTick, n.inputs);
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
if (this.#t.serverRole === "relay") return n.tick < 1 || n.tick > this.#t.metrics().tick ? w("Relay hash is outside actual confirmed input history") : void 0;
|
|
522
|
+
if (this.#w.length >= this.#s.maxPendingHashResults) throw new e({
|
|
523
|
+
budget: "lockstepWireHashResults",
|
|
524
|
+
limit: this.#s.maxPendingHashResults
|
|
525
|
+
});
|
|
526
|
+
let r = `${n.tick}/${t.player.playerId}`;
|
|
527
|
+
if (!this.#d.has(r) && this.#d.size >= this.#s.maxPendingHashResults) throw new e({
|
|
528
|
+
budget: "lockstepWireHashSources",
|
|
529
|
+
limit: this.#s.maxPendingHashResults
|
|
530
|
+
});
|
|
531
|
+
let i = this.#t.submitHash(t.actual, n.tick, {
|
|
532
|
+
hi: n.hi,
|
|
533
|
+
lo: n.lo
|
|
534
|
+
});
|
|
535
|
+
i._tag === "pending" && this.#d.set(r, Object.freeze({
|
|
536
|
+
tick: n.tick,
|
|
537
|
+
peer: t
|
|
538
|
+
})), i._tag === "desync" && (this.#f.set(i, t), this.#w.push(i));
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
advance() {
|
|
542
|
+
return this.operation(() => (this.live(), this.#m || this.#h ? 0 : this.#t.advance()));
|
|
543
|
+
}
|
|
544
|
+
prepareNext() {
|
|
545
|
+
return this.operation(() => {
|
|
546
|
+
if (this.live(), this.#T) return !0;
|
|
547
|
+
let t = this.#g.shift();
|
|
548
|
+
if (t) return this.#T = t, !0;
|
|
549
|
+
let n = this.#t.nextDelivery();
|
|
550
|
+
if (n) {
|
|
551
|
+
let t = Object.freeze([...this.#S.values()].filter((e) => this.deliverable(e))), r, i;
|
|
552
|
+
if (n._tag === "relayed") {
|
|
553
|
+
let t = n.inputs.map((e) => {
|
|
554
|
+
let t = this.#n.full(e.input);
|
|
555
|
+
if (C.isFailure(t)) throw t.failure;
|
|
556
|
+
return t.success;
|
|
557
|
+
}), a = Object.freeze({
|
|
558
|
+
players: n.players,
|
|
559
|
+
inputs: Object.freeze(t)
|
|
560
|
+
}), o = {
|
|
561
|
+
tick: n.tick,
|
|
562
|
+
matrix: a,
|
|
563
|
+
bytes: t.reduce((e, t) => e + t.length, 8)
|
|
564
|
+
};
|
|
565
|
+
if (i = [...this.#C, o].slice(-this.#s.redundantTicks), i.some((e, t) => t > 0 && e.tick !== i[t - 1].tick + 1)) return w("Redundant authority matrices are not contiguous");
|
|
566
|
+
if (i.reduce((e, t) => e + t.bytes, 0) > this.#s.maxRedundancyWireBytes) throw new e({
|
|
567
|
+
budget: "lockstepWireRedundancy",
|
|
568
|
+
limit: this.#s.maxRedundancyWireBytes
|
|
569
|
+
});
|
|
570
|
+
r = {
|
|
571
|
+
kind: "LsInputs",
|
|
572
|
+
firstTick: i[0].tick,
|
|
573
|
+
matrices: Object.freeze(i.map((e) => e.matrix))
|
|
574
|
+
};
|
|
575
|
+
} else r = {
|
|
576
|
+
kind: "LsStall",
|
|
577
|
+
waitingFor: n.waitingFor
|
|
578
|
+
};
|
|
579
|
+
let a = this.frameBytes(r);
|
|
580
|
+
for (let e of t) this.current(e);
|
|
581
|
+
let o = n._tag === "relayed" && this.#l ? Object.freeze({
|
|
582
|
+
...this.#c,
|
|
583
|
+
requestId: `${this.#l.startRequestId}::tick:${n.tick}`,
|
|
584
|
+
tick: n.tick,
|
|
585
|
+
inputs: Object.freeze(i[i.length - 1].matrix.inputs.map((e) => e.slice()))
|
|
586
|
+
}) : void 0;
|
|
587
|
+
return this.#T = {
|
|
588
|
+
frame: r,
|
|
589
|
+
bytes: a,
|
|
590
|
+
targets: t,
|
|
591
|
+
next: 0,
|
|
592
|
+
prepared: {
|
|
593
|
+
delivery: n,
|
|
594
|
+
...i ? { history: i } : {},
|
|
595
|
+
...o ? { append: o } : {}
|
|
596
|
+
}
|
|
597
|
+
}, !0;
|
|
598
|
+
}
|
|
599
|
+
let r = this.#t.roleMetrics().refereeTick;
|
|
600
|
+
if (r !== null) for (let [e, t] of this.#d) t.tick <= r - this.#u && this.#d.delete(e);
|
|
601
|
+
if (!this.#w.length && this.#t.serverRole !== "relay") {
|
|
602
|
+
let e = this.#t.comparePendingHashes(1);
|
|
603
|
+
if (e.length) {
|
|
604
|
+
for (let t of e) {
|
|
605
|
+
let e = t._tag === "desync" ? `${t.incident.tick}/${t.incident.playerId}` : `${t.tick}/${t.playerId}`, n = this.#d.get(e);
|
|
606
|
+
if (t._tag === "desync") {
|
|
607
|
+
if (!n) return w("Delayed hash result lost its actual Session provenance");
|
|
608
|
+
this.#f.set(t, n.peer), this.#w.push(t);
|
|
609
|
+
}
|
|
610
|
+
this.#d.delete(e);
|
|
611
|
+
}
|
|
612
|
+
if (!this.#w.length) return !0;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
let i = this.#w[0];
|
|
616
|
+
if (!i || i._tag !== "desync") return !1;
|
|
617
|
+
let a = this.#f.get(i);
|
|
618
|
+
if (!a) return w("Desync result has no actual submitted Session provenance");
|
|
619
|
+
if (!this.deliverable(a)) return this.#w.shift(), !0;
|
|
620
|
+
let o = i.action === "resync" ? {
|
|
621
|
+
kind: "LsDesync",
|
|
622
|
+
tick: i.incident.tick,
|
|
623
|
+
action: "resync",
|
|
624
|
+
snapshot: this.#r.encode({
|
|
625
|
+
snapshot: i.snapshot,
|
|
626
|
+
inputs: i.inputs,
|
|
627
|
+
continuation: i.continuation
|
|
628
|
+
})
|
|
629
|
+
} : {
|
|
630
|
+
kind: "LsDesync",
|
|
631
|
+
tick: i.incident.tick,
|
|
632
|
+
action: i.action
|
|
633
|
+
}, s = this.frameBytes(o);
|
|
634
|
+
return this.current(a), this.#w.shift(), this.#T = {
|
|
635
|
+
frame: o,
|
|
636
|
+
bytes: s,
|
|
637
|
+
targets: Object.freeze([a]),
|
|
638
|
+
next: 0
|
|
639
|
+
}, !0;
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
async commitPrepared(e) {
|
|
643
|
+
let t = e.prepared;
|
|
644
|
+
if (t) {
|
|
645
|
+
if (t.append && !t.durable) {
|
|
646
|
+
this.live();
|
|
647
|
+
let n = this.#y;
|
|
648
|
+
if (!n || !this.#l) return w("No initialized SQL input journal");
|
|
649
|
+
let r = await this.runJournal(this.#l.service.append({
|
|
650
|
+
...t.append,
|
|
651
|
+
inputs: Object.freeze(t.append.inputs.map((e) => e.slice()))
|
|
652
|
+
}));
|
|
653
|
+
this.operation(() => {
|
|
654
|
+
if (this.live(), this.#T !== e) return w("Journal completion lost its retained delivery owner");
|
|
655
|
+
let i = this.#_.captureStored(r, this.#c, n.hostId), a = t.append.tick, o = i.ticks[a - 1];
|
|
656
|
+
if (i.ticks.length !== a || JSON.stringify(i.initial) !== JSON.stringify(n.initial) || JSON.stringify(i.adoption) !== JSON.stringify(n.adoption) || !_(i, n) || !o || o.requestId !== t.append.requestId || o.inputs.length !== t.append.inputs.length || o.inputs.some((e, n) => e !== this.#_.captureInput(t.append.inputs[n]))) return w("Journal receipt changed its immutable seed/prefix or current matrix");
|
|
657
|
+
this.#y = i, t.durable = !0;
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
this.operation(() => {
|
|
661
|
+
if (this.live(), this.#T !== e) return w("Prepared delivery lost its owner");
|
|
662
|
+
for (let t of e.targets) this.deliverable(t);
|
|
663
|
+
this.#t.consumeDelivery(t.delivery), t.history && (this.#C = t.history), delete e.prepared;
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
flush() {
|
|
668
|
+
if (this.#k || this.#m || this.#h || this.#O) return Promise.reject(new t({ detail: "Lockstep flush cannot overlap or reenter supervision" }));
|
|
669
|
+
if (this.live(), !this.#E) return Promise.resolve(Object.freeze({
|
|
670
|
+
writes: 0,
|
|
671
|
+
pending: !1
|
|
672
|
+
}));
|
|
673
|
+
let e = async () => {
|
|
674
|
+
let e = 0;
|
|
675
|
+
for (let t = 0; t < this.#s.maxFlushWork && !this.#D && (this.#T || this.prepareNext()); t++) {
|
|
676
|
+
let t = this.#T;
|
|
677
|
+
if (!t) continue;
|
|
678
|
+
if (await this.commitPrepared(t), this.#D) break;
|
|
679
|
+
let n = t.targets[t.next];
|
|
680
|
+
if (!n) this.#T = null;
|
|
681
|
+
else if (!this.deliverable(n)) t.next++, t.next === t.targets.length && (this.#T = null);
|
|
682
|
+
else {
|
|
683
|
+
if (await n.port.send(t.frame.kind === "LsStart" ? {
|
|
684
|
+
...t.frame,
|
|
685
|
+
localPlayerId: n.player.playerId
|
|
686
|
+
} : t.frame), this.#D) break;
|
|
687
|
+
this.deliverable(n), t.next++, e++, t.next === t.targets.length && (this.#T = null);
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
return Object.freeze({
|
|
691
|
+
writes: e,
|
|
692
|
+
pending: this.#T !== null || this.#g.length > 0 || this.#t.roleMetrics().pendingDeliveries > 0 || this.#w.length > 0
|
|
693
|
+
});
|
|
694
|
+
};
|
|
695
|
+
return this.#k = Promise.resolve().then(e).finally(() => {
|
|
696
|
+
this.#k = null;
|
|
697
|
+
}), this.#k;
|
|
698
|
+
}
|
|
699
|
+
retryFault() {
|
|
700
|
+
this.operation(() => {
|
|
701
|
+
this.live(), this.#t.retryFault();
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
drainOutbox() {
|
|
705
|
+
return this.#t.drainOutbox();
|
|
706
|
+
}
|
|
707
|
+
metrics() {
|
|
708
|
+
return this.#t.metrics();
|
|
709
|
+
}
|
|
710
|
+
journalBoundary() {
|
|
711
|
+
if (this.live(), !this.#l || this.#O || this.#k || this.#x || this.#m || this.#h || this.#T || this.#g.length || this.#t.roleMetrics().pendingDeliveries || this.#w.length || this.#b && !this.#E) return w("Lockstep journal boundary requires completed retained supervision");
|
|
712
|
+
let e = this.#y?.ticks.length ?? 0;
|
|
713
|
+
return this.#E && e !== this.#t.metrics().tick ? w("Lockstep journal does not cover the actual simulated frontier") : Object.freeze({
|
|
714
|
+
digest: this.#y?.digest ?? null,
|
|
715
|
+
tick: e
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
transportMetrics() {
|
|
719
|
+
return Object.freeze({
|
|
720
|
+
...this.#t.roleMetrics(),
|
|
721
|
+
started: this.#E,
|
|
722
|
+
disposed: this.#D,
|
|
723
|
+
pendingWireBytes: this.#T?.bytes ?? 0,
|
|
724
|
+
pendingTargets: this.#T ? this.#T.targets.length - this.#T.next : 0,
|
|
725
|
+
redundancyTicks: this.#C.length,
|
|
726
|
+
redundancyWireBytes: this.#C.reduce((e, t) => e + t.bytes, 0),
|
|
727
|
+
pendingHashResults: this.#w.length,
|
|
728
|
+
pendingHashSources: this.#d.size,
|
|
729
|
+
reconnecting: this.#m !== null,
|
|
730
|
+
joining: this.#h !== null,
|
|
731
|
+
queuedFrames: this.#g.length,
|
|
732
|
+
flushing: this.#k !== null,
|
|
733
|
+
journaled: this.#l !== null,
|
|
734
|
+
journalTick: this.#y?.ticks.length ?? 0,
|
|
735
|
+
initializing: this.#x !== null
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
exportSubject(e, t) {
|
|
739
|
+
return this.operation(() => this.#t.exportSubject(e, t));
|
|
740
|
+
}
|
|
741
|
+
async eraseSubject(e, t) {
|
|
742
|
+
let n = this.operation(() => this.#t.eraseSubject(e, t));
|
|
743
|
+
return n && await this.disposeAsync(), n;
|
|
744
|
+
}
|
|
745
|
+
release() {
|
|
746
|
+
if (!this.#D) {
|
|
747
|
+
this.#D = !0;
|
|
748
|
+
for (let e of this.#S.values()) e.port.withdraw();
|
|
749
|
+
this.#v?.history?.fill(0), this.#v = null, this.#t.dispose(), this.#S.clear(), this.#C = [], this.#w = [], this.#d.clear(), this.#f = /* @__PURE__ */ new WeakMap(), this.#T = null, this.#g = [], this.#y = null, this.#b = null, this.#o.fill(0);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
dispose() {
|
|
753
|
+
this.operation(() => this.release());
|
|
754
|
+
}
|
|
755
|
+
disposeAsync() {
|
|
756
|
+
if (this.#A) return this.#A;
|
|
757
|
+
let e = [
|
|
758
|
+
this.#k ?? Promise.resolve(),
|
|
759
|
+
this.#x ?? Promise.resolve(),
|
|
760
|
+
this.#m ?? Promise.resolve(),
|
|
761
|
+
this.#h ?? Promise.resolve()
|
|
762
|
+
];
|
|
763
|
+
return this.dispose(), this.#A = (async () => {
|
|
764
|
+
let t = (await Promise.allSettled(e)).find((e) => e.status === "rejected");
|
|
765
|
+
if (t?.status === "rejected") throw t.reason;
|
|
766
|
+
})(), this.#A;
|
|
767
|
+
}
|
|
768
|
+
isDisposed() {
|
|
769
|
+
return this.#D || this.#t.isDisposed();
|
|
770
|
+
}
|
|
771
|
+
}, D = (e, t, n, r, i, a = {}, o = {}, s = {}) => new E(e, t, n, r, i, a, o, s);
|
|
772
|
+
export { E as RoomLockstepTransportOwner, D as createRoomLockstepTransportOwner };
|