@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/lockstep.js
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomAuthoringError as n } from "./errors.js";
|
|
2
|
+
import { unsignedWord as r } from "./fixedWords.js";
|
|
3
|
+
import { freezeSimulationValue as i, simulationOwnData as a, simulationSyncValue as o } from "./simulationAuthoring.js";
|
|
4
|
+
import { schemaSimulationHash as s } from "./simulationState.js";
|
|
5
|
+
import { createSimulationInputHistoryCodec as c } from "./simulationInputHistoryWire.js";
|
|
6
|
+
import { captureSimulationRecoveryContinuation as l } from "./simulationRecoveryWire.js";
|
|
7
|
+
import { SimulationRunner as u, assertCapturedSimulation as d, captureSimulationInputs as f, captureSimulationSnapshot as p } from "./simulation.js";
|
|
8
|
+
import { LockstepPolicyOwner as m, createLockstepPolicies as h } from "./lockstepPolicies.js";
|
|
9
|
+
import { repeatLastLockstepInput as g } from "./lockstepStrategies.js";
|
|
10
|
+
import { RoomLockstepClientSession as _, createRoomLockstepClientSession as v, isRoomLockstepClientSession as y } from "./lockstepClientSession.js";
|
|
11
|
+
// src/lockstep.ts
|
|
12
|
+
function b(e) {
|
|
13
|
+
throw new n({
|
|
14
|
+
room: "lockstep",
|
|
15
|
+
detail: e
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
var x = (t, n) => {
|
|
19
|
+
let r = t + n;
|
|
20
|
+
if (!Number.isSafeInteger(r)) throw new e({
|
|
21
|
+
budget: "lockstepCounter",
|
|
22
|
+
limit: 2 ** 53 - 1
|
|
23
|
+
});
|
|
24
|
+
return r;
|
|
25
|
+
}, S = (e) => {
|
|
26
|
+
let t = a(e, [
|
|
27
|
+
"inputDelayTicks",
|
|
28
|
+
"rollbackHorizonTicks",
|
|
29
|
+
"maxFutureTicks",
|
|
30
|
+
"maxPlayers",
|
|
31
|
+
"maxRejectionAttempts",
|
|
32
|
+
"inputPrediction"
|
|
33
|
+
], []), n = (e, n) => Object.hasOwn(t, e) ? t[e] : n, r = n("inputDelayTicks", 2), i = n("maxFutureTicks", 16), o = n("rollbackHorizonTicks", 8), s = n("maxPlayers", 8), c = n("maxRejectionAttempts", 64);
|
|
34
|
+
for (let e of [
|
|
35
|
+
r,
|
|
36
|
+
i,
|
|
37
|
+
o,
|
|
38
|
+
s,
|
|
39
|
+
c
|
|
40
|
+
]) if (!Number.isSafeInteger(e)) return b("Lockstep tick/player/RNG budgets must be integers");
|
|
41
|
+
if (r < 0 || r > i || i < 1 || i > 4096 || o < 1 || o > 4096 || s < 1 || s > 64 || c < 1 || c > 65536) return b("Lockstep tick/player/RNG budgets are outside their work limits");
|
|
42
|
+
let l = n("inputPrediction", "repeat-last");
|
|
43
|
+
return l !== "repeat-last" && l !== "none" && typeof l != "function" ? b("Unknown lockstep input prediction") : Object.freeze({
|
|
44
|
+
inputDelayTicks: r,
|
|
45
|
+
maxFutureTicks: i,
|
|
46
|
+
rollbackHorizonTicks: o,
|
|
47
|
+
maxPlayers: s,
|
|
48
|
+
maxRejectionAttempts: c,
|
|
49
|
+
inputPrediction: l
|
|
50
|
+
});
|
|
51
|
+
}, C = (e, t) => {
|
|
52
|
+
d(e);
|
|
53
|
+
let n = a(t, [
|
|
54
|
+
"localPlayerId",
|
|
55
|
+
"initialInputs",
|
|
56
|
+
"playerIds",
|
|
57
|
+
"inputDelayTicks",
|
|
58
|
+
"rollbackHorizonTicks",
|
|
59
|
+
"maxFutureTicks",
|
|
60
|
+
"maxPlayers",
|
|
61
|
+
"maxRejectionAttempts",
|
|
62
|
+
"inputPrediction",
|
|
63
|
+
"lateJoin"
|
|
64
|
+
], ["localPlayerId"]), { localPlayerId: i, initialInputs: o, playerIds: s, lateJoin: c, ...l } = n;
|
|
65
|
+
if (c !== void 0 && typeof c != "boolean") return b("Lockstep lateJoin must be a boolean");
|
|
66
|
+
let u = c === !0, p = S(l), m = p.maxPlayers, h = r(n.localPlayerId), g = Object.hasOwn(n, "initialInputs") ? f(e, n.initialInputs, m) : Object.freeze([]);
|
|
67
|
+
if (Object.hasOwn(n, "initialInputs") && !g.length) return b("Authored initial intentions require a nonempty complete matrix");
|
|
68
|
+
let _ = g.map((e) => e.playerId);
|
|
69
|
+
if (Object.hasOwn(n, "playerIds")) {
|
|
70
|
+
let e = n.playerIds;
|
|
71
|
+
if (!Array.isArray(e) || !e.length || e.length > m || Reflect.ownKeys(e).length !== e.length + 1) return b("Lockstep requires a bounded dense explicit player roster");
|
|
72
|
+
let t = [], i = /* @__PURE__ */ new Set();
|
|
73
|
+
for (let n = 0; n < e.length; n++) {
|
|
74
|
+
let a = Object.getOwnPropertyDescriptor(e, String(n));
|
|
75
|
+
if (!a?.enumerable || !("value" in a)) return b("Player roster holes and accessors refuse");
|
|
76
|
+
let o = r(a.value);
|
|
77
|
+
if (i.has(o)) return b("Player roster IDs must be unique");
|
|
78
|
+
i.add(o), t.push(o);
|
|
79
|
+
}
|
|
80
|
+
if (t.sort((e, t) => e - t), _ = Object.freeze(t), g.length && (g.length !== _.length || g.some((e, t) => e.playerId !== _[t]))) return b("Initial intentions must match the complete explicit roster");
|
|
81
|
+
}
|
|
82
|
+
return !_.length || _.includes(h) === u || u && g.length ? b(u ? "A late-joining local player is not in the Start roster and has no initial matrix" : "Lockstep requires a complete explicit roster including the local player") : Object.freeze({
|
|
83
|
+
...p,
|
|
84
|
+
localPlayerId: h,
|
|
85
|
+
initialInputs: g,
|
|
86
|
+
playerIds: Object.freeze([..._]),
|
|
87
|
+
lateJoin: u
|
|
88
|
+
});
|
|
89
|
+
}, w = (e, t) => {
|
|
90
|
+
if (e === t) return !0;
|
|
91
|
+
if (!e || !t || typeof e != "object" || typeof t != "object" || Array.isArray(e) !== Array.isArray(t)) return !1;
|
|
92
|
+
let n = Reflect.ownKeys(e), r = Reflect.ownKeys(t);
|
|
93
|
+
return n.length === r.length && n.every((n) => Object.hasOwn(t, n) && w(Object.getOwnPropertyDescriptor(e, n)?.value, Object.getOwnPropertyDescriptor(t, n)?.value));
|
|
94
|
+
}, T = class {
|
|
95
|
+
#e;
|
|
96
|
+
#t;
|
|
97
|
+
#n;
|
|
98
|
+
#r = [];
|
|
99
|
+
#i;
|
|
100
|
+
#a;
|
|
101
|
+
#o;
|
|
102
|
+
#s;
|
|
103
|
+
#c = /* @__PURE__ */ new Map();
|
|
104
|
+
#l = /* @__PURE__ */ new Map();
|
|
105
|
+
#u = /* @__PURE__ */ new Map();
|
|
106
|
+
#d = 0;
|
|
107
|
+
#f = 0;
|
|
108
|
+
#p = !1;
|
|
109
|
+
#m = !1;
|
|
110
|
+
#h = Object.freeze({
|
|
111
|
+
rollbackReplays: 0,
|
|
112
|
+
rollbackSteps: 0,
|
|
113
|
+
stallAttempts: 0
|
|
114
|
+
});
|
|
115
|
+
constructor(e, t, n, r) {
|
|
116
|
+
let i = C(e, r), a = i.initialInputs;
|
|
117
|
+
this.#e = e, this.#i = i.localPlayerId, this.#a = i.inputDelayTicks, this.#o = i.maxFutureTicks, this.#s = i.inputPrediction, this.#n = i.playerIds, a.length && this.#c.set(0, a), this.#t = new u(e, t, n, {
|
|
118
|
+
rollbackHorizonTicks: i.rollbackHorizonTicks,
|
|
119
|
+
maxReplaySteps: i.rollbackHorizonTicks,
|
|
120
|
+
maxPlayers: i.maxPlayers,
|
|
121
|
+
maxRejectionAttempts: i.maxRejectionAttempts
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
get tick() {
|
|
125
|
+
return this.#t.tick;
|
|
126
|
+
}
|
|
127
|
+
get confirmedThroughTick() {
|
|
128
|
+
return this.#d;
|
|
129
|
+
}
|
|
130
|
+
get metrics() {
|
|
131
|
+
return this.#h;
|
|
132
|
+
}
|
|
133
|
+
snapshot() {
|
|
134
|
+
return this.#t.snapshot();
|
|
135
|
+
}
|
|
136
|
+
confirmedSnapshot(e) {
|
|
137
|
+
return this.work(() => (r(e), e < 1 || !this.#l.has(e) ? b("Client hash requires an actual retained confirmed matrix") : this.#t.snapshotAt(e)));
|
|
138
|
+
}
|
|
139
|
+
installServerSnapshot(t, n, r = []) {
|
|
140
|
+
return this.work(() => {
|
|
141
|
+
let a = p(this.#e, t), o = n === void 0 ? a.tick === 0 ? this.#c.get(0) : this.#l.get(a.tick) : n;
|
|
142
|
+
if (!o || n === void 0 && a.tick > this.#d) return b("Server resync requires the actual retained confirmed input base");
|
|
143
|
+
let s = this.completeMatrix(o, a.tick), c = l(this.#e, a.tick, s, r, this.#o), u = c.length ? c[c.length - 1].tick : a.tick, d = /* @__PURE__ */ new Map();
|
|
144
|
+
for (let [t, n] of this.#u) if (t > a.tick) {
|
|
145
|
+
if (t > u + this.#o) throw new e({
|
|
146
|
+
budget: "lockstepRecoveryLocalFutureTicks",
|
|
147
|
+
limit: this.#o
|
|
148
|
+
});
|
|
149
|
+
d.set(t, i(this.#e.inputCodec.capture(n)));
|
|
150
|
+
}
|
|
151
|
+
let f = new Map(c.map((e) => [e.tick, this.completeMatrix(e.inputs, e.tick)])), m = this.#t.installSnapshot(a, s);
|
|
152
|
+
return this.#c = /* @__PURE__ */ new Map([[a.tick, s]]), this.#l = f, this.#u = d, this.#d = u, this.#f = 0, m;
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
installConfirmedHistory(e, t = {}) {
|
|
156
|
+
return this.work(() => {
|
|
157
|
+
if (this.tick !== 0 || this.#d !== 0 || this.#l.size || this.#u.size || this.#p) return b("Seed history requires a fresh unprogressed client without local samples");
|
|
158
|
+
let n = c(this.#e, t).capture(e), r = this.rosterAt(2 ** 53 - 1), i = n.joins ?? [];
|
|
159
|
+
if (n.fromTick !== 0 || n.playerIds.length !== r.length || n.playerIds.some((e, t) => e !== r[t]) || i.length !== this.#r.length || i.some((e) => !this.#r.some((t) => t.playerId === e.playerId && t.tick === e.tick))) return b("Seed history must name the actual complete initial roster from tick0");
|
|
160
|
+
let a = new Map(n.inputs.map((e) => [e.tick, e.inputs]));
|
|
161
|
+
return this.#l = a, this.#d = n.inputs.length, this.#f = this.#d, this.#p = !0, this.#d;
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
work(e) {
|
|
165
|
+
if (this.#m) return b("Lockstep mutation cannot reenter prediction, step or replay");
|
|
166
|
+
this.#m = !0;
|
|
167
|
+
try {
|
|
168
|
+
return e();
|
|
169
|
+
} finally {
|
|
170
|
+
this.#m = !1;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
captureMatrix(t, n = this.#n.length) {
|
|
174
|
+
if (!Array.isArray(t) || t.length > n) throw new e({
|
|
175
|
+
budget: "lockstepPlayers",
|
|
176
|
+
limit: n
|
|
177
|
+
});
|
|
178
|
+
if (Reflect.ownKeys(t).length !== t.length + 1) return b("Lockstep input matrix requires dense own data");
|
|
179
|
+
let o = [], s = /* @__PURE__ */ new Set();
|
|
180
|
+
for (let e = 0; e < t.length; e++) {
|
|
181
|
+
let n = Object.getOwnPropertyDescriptor(t, String(e));
|
|
182
|
+
if (!n?.enumerable || !("value" in n)) return b("Lockstep matrix holes and accessors refuse");
|
|
183
|
+
let c = a(n.value, ["playerId", "input"], ["playerId", "input"]), l = r(c.playerId);
|
|
184
|
+
if (s.has(l)) return b("Lockstep player IDs must be unique");
|
|
185
|
+
s.add(l), o.push(Object.freeze({
|
|
186
|
+
playerId: l,
|
|
187
|
+
input: i(this.#e.inputCodec.capture(c.input))
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
return o.sort((e, t) => e.playerId - t.playerId), Object.freeze(o);
|
|
191
|
+
}
|
|
192
|
+
rosterAt(e) {
|
|
193
|
+
return this.#r.length ? [...this.#n, ...this.#r.filter((t) => t.tick <= e).map((e) => e.playerId)].sort((e, t) => e - t) : this.#n;
|
|
194
|
+
}
|
|
195
|
+
completeMatrix(e, t) {
|
|
196
|
+
let n = this.rosterAt(t), r = this.captureMatrix(e, n.length);
|
|
197
|
+
return r.length !== n.length || r.some((e, t) => e.playerId !== n[t]) ? b("Confirmed matrix must match the complete roster of its tick") : r;
|
|
198
|
+
}
|
|
199
|
+
join(e, t) {
|
|
200
|
+
this.work(() => {
|
|
201
|
+
if (r(e), r(t), e <= this.#d || this.rosterAt(2 ** 53 - 1).includes(t) || this.rosterAt(2 ** 53 - 1).length >= this.#t.limits.maxPlayers) return b("Late join must be ahead of the confirmed frontier, new and within the player budget");
|
|
202
|
+
if (this.#r.some((t) => t.tick > e)) return b("Late joins arrive in tick order");
|
|
203
|
+
this.#r.push(Object.freeze({
|
|
204
|
+
tick: e,
|
|
205
|
+
playerId: t
|
|
206
|
+
}));
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
matrix(e, t, n) {
|
|
210
|
+
let r = n ?? this.#l.get(e);
|
|
211
|
+
if (r) return {
|
|
212
|
+
inputs: r,
|
|
213
|
+
predicted: [],
|
|
214
|
+
missing: []
|
|
215
|
+
};
|
|
216
|
+
let a = [], s = [], c = [];
|
|
217
|
+
for (let n of t) {
|
|
218
|
+
if (n.playerId === this.#i && this.#u.has(e)) {
|
|
219
|
+
a.push(Object.freeze({
|
|
220
|
+
playerId: n.playerId,
|
|
221
|
+
input: this.#u.get(e)
|
|
222
|
+
}));
|
|
223
|
+
continue;
|
|
224
|
+
}
|
|
225
|
+
if (this.#s === "none") {
|
|
226
|
+
c.push(n.playerId);
|
|
227
|
+
continue;
|
|
228
|
+
}
|
|
229
|
+
let t = Object.freeze({
|
|
230
|
+
playerId: n.playerId,
|
|
231
|
+
tick: e
|
|
232
|
+
}), r = this.#s === "repeat-last" ? g(n.input, t) : this.#s(n.input, t);
|
|
233
|
+
a.push(Object.freeze({
|
|
234
|
+
playerId: n.playerId,
|
|
235
|
+
input: i(this.#e.inputCodec.capture(o(r)))
|
|
236
|
+
})), s.push(n.playerId);
|
|
237
|
+
}
|
|
238
|
+
for (let n of this.rosterAt(e)) t.some((e) => e.playerId === n) || (n === this.#i && this.#u.has(e) ? a.push(Object.freeze({
|
|
239
|
+
playerId: n,
|
|
240
|
+
input: this.#u.get(e)
|
|
241
|
+
})) : this.#s === "none" && c.push(n));
|
|
242
|
+
return a.sort((e, t) => e.playerId - t.playerId), {
|
|
243
|
+
inputs: Object.freeze(a),
|
|
244
|
+
predicted: Object.freeze(s),
|
|
245
|
+
missing: Object.freeze(c)
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
prune() {
|
|
249
|
+
let e = this.#t.oldestTick;
|
|
250
|
+
for (let t of [
|
|
251
|
+
this.#c,
|
|
252
|
+
this.#l,
|
|
253
|
+
this.#u
|
|
254
|
+
]) for (let n of t.keys()) n < e && t.delete(n);
|
|
255
|
+
}
|
|
256
|
+
submitLocal(e) {
|
|
257
|
+
return this.work(() => {
|
|
258
|
+
if (this.tick < this.#f) return b("Consume retained confirmed history before sampling current intentions");
|
|
259
|
+
let t = r(this.tick + Math.max(1, this.#a));
|
|
260
|
+
if (this.#l.has(t)) return b("Local intent cannot replace an admitted server matrix");
|
|
261
|
+
let n = i(this.#e.inputCodec.capture(e)), a = Object.freeze({
|
|
262
|
+
tick: t,
|
|
263
|
+
input: n
|
|
264
|
+
});
|
|
265
|
+
return this.#u.set(t, n), a;
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
recentLocalInputs(e = 4) {
|
|
269
|
+
return !Number.isSafeInteger(e) || e < 1 || e > 64 ? b("Lockstep input redundancy requires a count from 1 through 64") : Object.freeze([...this.#u.entries()].sort((e, t) => e[0] - t[0]).slice(-e).map(([e, t]) => Object.freeze({
|
|
270
|
+
tick: e,
|
|
271
|
+
input: i(this.#e.inputCodec.capture(t))
|
|
272
|
+
})));
|
|
273
|
+
}
|
|
274
|
+
advance() {
|
|
275
|
+
return this.work(() => {
|
|
276
|
+
let e = r(this.tick + 1), t = this.#c.get(this.tick);
|
|
277
|
+
if (!t && this.tick !== 0) return b("Lockstep previous input matrix is unavailable");
|
|
278
|
+
if (!t && !this.#l.has(e)) return this.#h = Object.freeze({
|
|
279
|
+
...this.#h,
|
|
280
|
+
stallAttempts: x(this.#h.stallAttempts, 1)
|
|
281
|
+
}), Object.freeze({
|
|
282
|
+
_tag: "stalled",
|
|
283
|
+
tick: e,
|
|
284
|
+
reason: "inputs",
|
|
285
|
+
missingTick: e,
|
|
286
|
+
waitingFor: this.rosterAt(e)
|
|
287
|
+
});
|
|
288
|
+
if (e > this.#d + this.#t.limits.rollbackHorizonTicks) return this.#h = Object.freeze({
|
|
289
|
+
...this.#h,
|
|
290
|
+
stallAttempts: x(this.#h.stallAttempts, 1)
|
|
291
|
+
}), Object.freeze({
|
|
292
|
+
_tag: "stalled",
|
|
293
|
+
tick: e,
|
|
294
|
+
reason: "horizon",
|
|
295
|
+
missingTick: this.#d + 1,
|
|
296
|
+
waitingFor: this.rosterAt(this.#d + 1)
|
|
297
|
+
});
|
|
298
|
+
let n = t ? this.matrix(e, t) : {
|
|
299
|
+
inputs: this.#l.get(e),
|
|
300
|
+
predicted: [],
|
|
301
|
+
missing: []
|
|
302
|
+
};
|
|
303
|
+
if (n.missing.length) return this.#h = Object.freeze({
|
|
304
|
+
...this.#h,
|
|
305
|
+
stallAttempts: x(this.#h.stallAttempts, 1)
|
|
306
|
+
}), Object.freeze({
|
|
307
|
+
_tag: "stalled",
|
|
308
|
+
tick: e,
|
|
309
|
+
reason: "inputs",
|
|
310
|
+
missingTick: e,
|
|
311
|
+
waitingFor: n.missing
|
|
312
|
+
});
|
|
313
|
+
let i = this.#t.advance(n.inputs);
|
|
314
|
+
return this.#c.set(e, n.inputs), this.prune(), Object.freeze({
|
|
315
|
+
_tag: "advanced",
|
|
316
|
+
snapshot: i,
|
|
317
|
+
predictedPlayers: n.predicted
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
confirm(n, i) {
|
|
322
|
+
return this.work(() => {
|
|
323
|
+
if (r(n), n <= this.#t.oldestTick) return Object.freeze({
|
|
324
|
+
_tag: "expired",
|
|
325
|
+
tick: n,
|
|
326
|
+
oldestTick: this.#t.oldestTick
|
|
327
|
+
});
|
|
328
|
+
if (n > Math.max(this.tick, this.#f) + this.#o) throw new e({
|
|
329
|
+
budget: "lockstepFutureTicks",
|
|
330
|
+
limit: this.#o
|
|
331
|
+
});
|
|
332
|
+
let a = this.completeMatrix(i, n), o = this.#l.get(n);
|
|
333
|
+
if (o) {
|
|
334
|
+
if (!w(o, a)) throw new t({ detail: "Conflicting lockstep input matrix for an admitted tick" });
|
|
335
|
+
return Object.freeze({
|
|
336
|
+
_tag: "duplicate",
|
|
337
|
+
tick: n
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
let s = Object.freeze({
|
|
341
|
+
_tag: "queued",
|
|
342
|
+
tick: n
|
|
343
|
+
}), c = [], l = this.#h;
|
|
344
|
+
if (n <= this.tick) {
|
|
345
|
+
let e = this.#c.get(n);
|
|
346
|
+
if (!e) return b("Lockstep used input history is unavailable");
|
|
347
|
+
if (w(e, a)) s = Object.freeze({
|
|
348
|
+
_tag: "matched",
|
|
349
|
+
tick: n
|
|
350
|
+
});
|
|
351
|
+
else {
|
|
352
|
+
let e = this.#c.get(n - 1);
|
|
353
|
+
if (!e) return b("Lockstep rollback input base is unavailable");
|
|
354
|
+
for (let t = n; t <= this.tick; t++) {
|
|
355
|
+
let r = this.matrix(t, e, t === n ? a : void 0);
|
|
356
|
+
if (r.missing.length) return b("Lockstep replay cannot invent missing inputs");
|
|
357
|
+
c.push(Object.freeze({
|
|
358
|
+
tick: t,
|
|
359
|
+
inputs: r.inputs
|
|
360
|
+
})), e = r.inputs;
|
|
361
|
+
}
|
|
362
|
+
let t = this.tick - n + 1;
|
|
363
|
+
l = Object.freeze({
|
|
364
|
+
...this.#h,
|
|
365
|
+
rollbackReplays: x(this.#h.rollbackReplays, 1),
|
|
366
|
+
rollbackSteps: x(this.#h.rollbackSteps, t)
|
|
367
|
+
}), this.#t.replaceInputsRange(c), s = Object.freeze({
|
|
368
|
+
_tag: "replayed",
|
|
369
|
+
tick: n,
|
|
370
|
+
steps: t
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
this.#l.set(n, a);
|
|
375
|
+
for (let e of c) this.#c.set(e.tick, e.inputs);
|
|
376
|
+
for (this.#h = l; this.#l.has(this.#d + 1);) this.#d++;
|
|
377
|
+
return this.prune(), s;
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
}, E = (e, t, n, r) => new T(e, t, n, r);
|
|
381
|
+
export { T as LockstepClientSimulation, m as LockstepPolicyOwner, _ as RoomLockstepClientSession, C as captureLockstepClientOptions, S as captureLockstepClientPolicy, E as createLockstepClientSimulation, h as createLockstepPolicies, v as createRoomLockstepClientSession, y as isRoomLockstepClientSession, g as repeatLastLockstepInput, s as schemaSimulationHash };
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { unsignedWord as t } from "./fixedWords.js";
|
|
3
|
+
import { simulationOwnData as n } from "./simulationAuthoring.js";
|
|
4
|
+
import { defineRoom as r } from "./room.js";
|
|
5
|
+
import { ROOMS_TABLE as i, ROOM_CHECKPOINTS_TABLE as a, ROOM_SEATS_TABLE as o } from "./identities.js";
|
|
6
|
+
import { assertRoomSubjectAdmission as s } from "./subjectAdmission.js";
|
|
7
|
+
import { RoomLockstepAdmissionPort as c } from "./lockstepAdmissionPorts.js";
|
|
8
|
+
import { captureLockstepJournalScope as l, lockstepJournalIdentity as u } from "./lockstepJournalCodec.js";
|
|
9
|
+
import { captureRoomSnapshotEffectRunner as d } from "./snapshotBlobIndex.js";
|
|
10
|
+
import { createRoomLockstepAdmissionCodec as f, roomLockstepCreationProjection as p, sealRoomLockstepAdmission as m } from "./lockstepAdmissionCodec.js";
|
|
11
|
+
import { captureRoomLockstepRecoveryOptions as h, readRoomLockstepRecoveryTruth as g } from "./lockstepRecoveryTruth.js";
|
|
12
|
+
import { and as _, eq as v, or as y } from "@voltro/database";
|
|
13
|
+
import { Effect as b, Layer as x } from "effect";
|
|
14
|
+
// src/lockstepAdmission.ts
|
|
15
|
+
function S(t) {
|
|
16
|
+
throw new e({ detail: t });
|
|
17
|
+
}
|
|
18
|
+
var C = (e) => _(v("id", e.roomId), v("tenantId", e.tenantId)), w = (c, x, w) => {
|
|
19
|
+
let T = r(x), E = n(w, [
|
|
20
|
+
"hostId",
|
|
21
|
+
"epochNow",
|
|
22
|
+
"authorize",
|
|
23
|
+
"erasure",
|
|
24
|
+
"maxAdmissionBytes"
|
|
25
|
+
], [
|
|
26
|
+
"hostId",
|
|
27
|
+
"epochNow",
|
|
28
|
+
"authorize",
|
|
29
|
+
"erasure"
|
|
30
|
+
]), D = u(E.hostId), O = E.epochNow, k = E.authorize, A = n(E.erasure, ["erase"], ["erase"]).erase, j = Object.hasOwn(E, "maxAdmissionBytes") ? E.maxAdmissionBytes : 16777216;
|
|
31
|
+
if (typeof O != "function" || typeof k != "function" || typeof A != "function" || !Number.isSafeInteger(j) || j < 1 || j > 67108864) return S("Creation requires complete clock, authorization, coordinated erasure and bounded metadata");
|
|
32
|
+
let { optionsWire: M, stateWire: N, inputWire: P, captureStored: F } = f(T.simulation, j), I = () => {
|
|
33
|
+
let e = O();
|
|
34
|
+
return typeof e != "number" || !Number.isSafeInteger(e) || e < 0 || e > 864e13 ? S("Invalid creation wall clock") : new Date(e);
|
|
35
|
+
}, L = async (e, t) => {
|
|
36
|
+
let n = await e.query({
|
|
37
|
+
table: i,
|
|
38
|
+
predicate: C(t),
|
|
39
|
+
order: [],
|
|
40
|
+
take: 2,
|
|
41
|
+
skip: void 0,
|
|
42
|
+
projection: void 0,
|
|
43
|
+
lock: "update"
|
|
44
|
+
}), r = n[0];
|
|
45
|
+
return n.length !== 1 || !r || r.id !== t.roomId || r.tenantId !== t.tenantId || r.hostId !== D || r.epoch !== t.epoch || !["creating", "live"].includes(String(r.state)) || r.erasure != null || r.snapshotErasure != null || r.name !== T.name || r.maxClients !== T.maxClients ? S("Creation has no exact unfenced SQL owner/name/capacity") : r;
|
|
46
|
+
}, R = async (e, t, n) => {
|
|
47
|
+
let r = F(t.lockstepAdmission, n, D);
|
|
48
|
+
return t.lockstepCreatorSubjectId !== r.initial.creatorSubjectId || r.initial.name !== T.name ? S("Creation indexed owner identity changed") : (await s(e, {
|
|
49
|
+
tenantId: n.tenantId,
|
|
50
|
+
subjectId: r.initial.creatorSubjectId
|
|
51
|
+
}), r);
|
|
52
|
+
}, z = async (e, t, n) => {
|
|
53
|
+
if (await e.updateMany("_voltro_rooms", {
|
|
54
|
+
lockstepAdmission: n,
|
|
55
|
+
lockstepCreatorSubjectId: n.initial.creatorSubjectId,
|
|
56
|
+
updatedAt: I()
|
|
57
|
+
}, { where: _(C(t), v("hostId", D), v("epoch", t.epoch)) }) !== 1) return S("Creation SQL ownership CAS failed");
|
|
58
|
+
}, B = (t, n, r, i) => b.flatMap(b.context(), (a) => b.uninterruptible(b.tryPromise({
|
|
59
|
+
try: async () => {
|
|
60
|
+
let e = d(a), o = k(t, n, i);
|
|
61
|
+
return b.isEffect(o) ? (await e(o), r(e)) : S("Creation authorization must return an actual Effect");
|
|
62
|
+
},
|
|
63
|
+
catch: () => new e({ detail: "SQL lockstep creation operation remains unconfirmed" })
|
|
64
|
+
}))), V = () => b.fail(new e({ detail: "Invalid SQL lockstep creation request" }));
|
|
65
|
+
return Object.freeze({
|
|
66
|
+
prepare: (e) => {
|
|
67
|
+
try {
|
|
68
|
+
let r = [
|
|
69
|
+
"roomId",
|
|
70
|
+
"tenantId",
|
|
71
|
+
"epoch",
|
|
72
|
+
"requestId",
|
|
73
|
+
"creatorSubjectId",
|
|
74
|
+
"seed",
|
|
75
|
+
"options"
|
|
76
|
+
], i = n(e, r, r), d = l({
|
|
77
|
+
roomId: i.roomId,
|
|
78
|
+
tenantId: i.tenantId,
|
|
79
|
+
epoch: i.epoch
|
|
80
|
+
}), f = u(i.creatorSubjectId), p = m({
|
|
81
|
+
version: 1,
|
|
82
|
+
roomId: d.roomId,
|
|
83
|
+
tenantId: d.tenantId,
|
|
84
|
+
ownerEpoch: d.epoch,
|
|
85
|
+
hostId: D,
|
|
86
|
+
initial: {
|
|
87
|
+
requestId: u(i.requestId),
|
|
88
|
+
creatorSubjectId: f,
|
|
89
|
+
name: T.name,
|
|
90
|
+
seed: t(i.seed),
|
|
91
|
+
options: Buffer.from(M.encode(i.options)).toString("base64url"),
|
|
92
|
+
stateSchemaHash: N.schemaHash,
|
|
93
|
+
inputSchemaHash: P.schemaHash
|
|
94
|
+
},
|
|
95
|
+
adoption: null
|
|
96
|
+
});
|
|
97
|
+
return F(p, d, D), B(d, "prepare", () => c.transactional(async (e) => {
|
|
98
|
+
let t = await L(e, d);
|
|
99
|
+
if (await s(e, {
|
|
100
|
+
tenantId: d.tenantId,
|
|
101
|
+
subjectId: f
|
|
102
|
+
}), t.lockstepAdmission != null) {
|
|
103
|
+
let n = await R(e, t, d);
|
|
104
|
+
return JSON.stringify(n.initial) !== JSON.stringify(p.initial) || n.adoption !== null ? S("Conflicting immutable creation receipt") : n;
|
|
105
|
+
}
|
|
106
|
+
if (t.lockstepCreatorSubjectId != null || t.lockstepJournal != null || t.clients !== 0) return S("Creation cannot replace current Room authority");
|
|
107
|
+
for (let t of [o, a]) if ((await e.query({
|
|
108
|
+
table: t,
|
|
109
|
+
predicate: _(v("roomId", d.roomId), v("tenantId", d.tenantId)),
|
|
110
|
+
order: [],
|
|
111
|
+
take: 1,
|
|
112
|
+
skip: void 0,
|
|
113
|
+
projection: ["roomId"],
|
|
114
|
+
lock: "update"
|
|
115
|
+
})).length) return S("Lockstep metadata must precede Seats and never replace a state checkpoint");
|
|
116
|
+
return await z(e, d, p), p;
|
|
117
|
+
}), f);
|
|
118
|
+
} catch {
|
|
119
|
+
return V();
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
publish: (e) => {
|
|
123
|
+
try {
|
|
124
|
+
let t = l(e);
|
|
125
|
+
return B(t, "publish", () => c.transactional(async (e) => {
|
|
126
|
+
let n = await L(e, t), r = await R(e, n, t);
|
|
127
|
+
if (n.state === "live") return r;
|
|
128
|
+
if (r.adoption) {
|
|
129
|
+
let i = await g(e, n, h({
|
|
130
|
+
descriptor: (e) => e === T.name ? T : void 0,
|
|
131
|
+
maxTicks: 65536,
|
|
132
|
+
maxJournalBytes: j,
|
|
133
|
+
maxPlayers: T.maxClients
|
|
134
|
+
}));
|
|
135
|
+
if (!i || r.adoption.priorEpoch !== t.epoch - 1) return S("Successor publication needs actual adopted SQL truth");
|
|
136
|
+
let a = await e.query({
|
|
137
|
+
table: o,
|
|
138
|
+
predicate: _(v("roomId", t.roomId), v("tenantId", t.tenantId), y(v("state", "reserved"), v("state", "connected"), v("state", "grace"))),
|
|
139
|
+
order: [],
|
|
140
|
+
take: T.maxClients + 1,
|
|
141
|
+
skip: void 0,
|
|
142
|
+
projection: [
|
|
143
|
+
"sessionId",
|
|
144
|
+
"subjectId",
|
|
145
|
+
"epoch",
|
|
146
|
+
"state",
|
|
147
|
+
"role"
|
|
148
|
+
],
|
|
149
|
+
lock: "update"
|
|
150
|
+
});
|
|
151
|
+
if (a.length > T.maxClients || n.clients !== a.length || new Set(a.map((e) => e.sessionId)).size !== a.length || a.some((e) => typeof e.sessionId != "string" || e.state !== "grace" || e.epoch !== t.epoch || e.role !== "player" || i.journal && !i.journal.initial.players.some((t) => t.sessionId === e.sessionId && t.subjectId === e.subjectId))) return S("Successor publication requires only its actual fenced retained grace players");
|
|
152
|
+
for (let n of a) {
|
|
153
|
+
if (typeof n.subjectId != "string") return S("Successor publication requires registered retained Subjects");
|
|
154
|
+
await s(e, {
|
|
155
|
+
tenantId: t.tenantId,
|
|
156
|
+
subjectId: n.subjectId
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
if (n.clients !== 0) return S("Publication cannot replace existing Room players");
|
|
161
|
+
for (let n of [o, a]) if ((await e.query({
|
|
162
|
+
table: n,
|
|
163
|
+
predicate: _(v("roomId", t.roomId), v("tenantId", t.tenantId)),
|
|
164
|
+
order: [],
|
|
165
|
+
take: 1,
|
|
166
|
+
skip: void 0,
|
|
167
|
+
projection: ["roomId"],
|
|
168
|
+
lock: "update"
|
|
169
|
+
})).length) return S("Publication must precede Seats and state checkpoints");
|
|
170
|
+
}
|
|
171
|
+
return await e.updateMany("_voltro_rooms", {
|
|
172
|
+
state: "live",
|
|
173
|
+
updatedAt: I()
|
|
174
|
+
}, { where: _(C(t), v("hostId", D), v("epoch", t.epoch), v("state", "creating")) }) === 1 ? r : S("Publication SQL ownership CAS failed");
|
|
175
|
+
}));
|
|
176
|
+
} catch {
|
|
177
|
+
return V();
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
load: (e) => {
|
|
181
|
+
try {
|
|
182
|
+
let t = l(e);
|
|
183
|
+
return B(t, "load", () => c.transactional(async (e) => {
|
|
184
|
+
let n = await L(e, t);
|
|
185
|
+
return n.lockstepAdmission == null ? n.lockstepCreatorSubjectId == null ? null : S("Creation owner has no immutable receipt") : R(e, n, t);
|
|
186
|
+
}));
|
|
187
|
+
} catch {
|
|
188
|
+
return V();
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
adopt: (e, n, r) => {
|
|
192
|
+
try {
|
|
193
|
+
let i = l(e), a = t(n), o = u(r);
|
|
194
|
+
return a < 1 || i.epoch !== a + 1 ? V() : B(i, "adopt", () => c.transactional(async (e) => {
|
|
195
|
+
let t = await L(e, i), n = F(t.lockstepAdmission, i);
|
|
196
|
+
if (t.lockstepCreatorSubjectId !== n.initial.creatorSubjectId || n.initial.name !== T.name) return S("Creation indexed creator changed");
|
|
197
|
+
if (await s(e, {
|
|
198
|
+
tenantId: i.tenantId,
|
|
199
|
+
subjectId: n.initial.creatorSubjectId
|
|
200
|
+
}), n.ownerEpoch === i.epoch && n.hostId === D) return n.adoption?.requestId !== o || n.adoption.priorEpoch !== a ? S("Conflicting immutable creation adoption receipt") : n;
|
|
201
|
+
if (n.ownerEpoch !== a) return S("Creation predecessor epoch changed");
|
|
202
|
+
let { digest: r, ...c } = n, l = m({
|
|
203
|
+
...c,
|
|
204
|
+
ownerEpoch: i.epoch,
|
|
205
|
+
hostId: D,
|
|
206
|
+
adoption: {
|
|
207
|
+
requestId: o,
|
|
208
|
+
priorEpoch: a
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return await z(e, i, l), l;
|
|
212
|
+
}));
|
|
213
|
+
} catch {
|
|
214
|
+
return V();
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
exportSubject: (e, t) => {
|
|
218
|
+
try {
|
|
219
|
+
let n = l(e), r = u(t);
|
|
220
|
+
return B(n, "export", () => c.transactional(async (e) => {
|
|
221
|
+
let t = await L(e, n);
|
|
222
|
+
return t.lockstepAdmission == null ? null : p(await R(e, t, n), r);
|
|
223
|
+
}), r);
|
|
224
|
+
} catch {
|
|
225
|
+
return V();
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
erase: (e, t) => {
|
|
229
|
+
try {
|
|
230
|
+
let n = l(e), r = u(t);
|
|
231
|
+
return B(n, "erase", async (e) => {
|
|
232
|
+
let t = A(Object.freeze({
|
|
233
|
+
roomId: n.roomId,
|
|
234
|
+
tenantId: n.tenantId,
|
|
235
|
+
requestId: r
|
|
236
|
+
}));
|
|
237
|
+
if (!b.isEffect(t)) return S("Creation erasure must return the actual coordinated Effect");
|
|
238
|
+
await e(t);
|
|
239
|
+
let a = await c.query({
|
|
240
|
+
table: i,
|
|
241
|
+
predicate: C(n),
|
|
242
|
+
order: [],
|
|
243
|
+
take: 2,
|
|
244
|
+
skip: void 0,
|
|
245
|
+
projection: [
|
|
246
|
+
"id",
|
|
247
|
+
"tenantId",
|
|
248
|
+
"lockstepAdmission",
|
|
249
|
+
"lockstepCreatorSubjectId",
|
|
250
|
+
"erasure"
|
|
251
|
+
]
|
|
252
|
+
}), o = a[0], s = o?.erasure;
|
|
253
|
+
if (a.length !== 1 || o?.id !== n.roomId || o.tenantId !== n.tenantId || o.lockstepAdmission != null || o.lockstepCreatorSubjectId != null || s?.requestId !== r || s.phase !== "complete") return S("Creation erasure has no completed coordinated receipt");
|
|
254
|
+
});
|
|
255
|
+
} catch {
|
|
256
|
+
return V();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
}, T = (e, t, n) => x.succeed(c, w(e, t, n));
|
|
261
|
+
export { c as RoomLockstepAdmissionPort, w as dataStoreRoomLockstepAdmission, T as roomLockstepAdmissionLayer };
|