@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,402 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t, RoomAuthoringError as n } from "./errors.js";
|
|
2
|
+
import { captureUint64Words as r, unsignedWord as i } from "./fixedWords.js";
|
|
3
|
+
import { freezeSimulationValue as a, simulationOwnData as o } from "./simulationAuthoring.js";
|
|
4
|
+
import { createSimulationOptionsCodec as s } from "./simulationOptionsWire.js";
|
|
5
|
+
import { assertCapturedSimulation as c, createSimulationRunner as l } from "./simulation.js";
|
|
6
|
+
import { captureRoomLockstepServerOptions as u } from "./lockstepServerConfig.js";
|
|
7
|
+
import { RoomInputCodec as d } from "./stateCodec.js";
|
|
8
|
+
import { RoomLockstepInputRoster as f } from "./lockstepServer.js";
|
|
9
|
+
import { Result as p } from "effect";
|
|
10
|
+
// src/lockstepServerRoles.ts
|
|
11
|
+
function m(e) {
|
|
12
|
+
throw new t({ detail: e });
|
|
13
|
+
}
|
|
14
|
+
function h(e) {
|
|
15
|
+
throw new n({
|
|
16
|
+
room: "lockstep",
|
|
17
|
+
detail: e
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
function g(t, n) {
|
|
21
|
+
throw new e({
|
|
22
|
+
budget: t,
|
|
23
|
+
limit: n
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var _ = class {
|
|
27
|
+
#e;
|
|
28
|
+
#t;
|
|
29
|
+
#n;
|
|
30
|
+
#r;
|
|
31
|
+
#i;
|
|
32
|
+
#a;
|
|
33
|
+
#o;
|
|
34
|
+
#s;
|
|
35
|
+
#c;
|
|
36
|
+
#l = -1;
|
|
37
|
+
#u;
|
|
38
|
+
#d;
|
|
39
|
+
#f = !1;
|
|
40
|
+
#p = !1;
|
|
41
|
+
#m = /* @__PURE__ */ new Map();
|
|
42
|
+
#h = [];
|
|
43
|
+
#g = 0;
|
|
44
|
+
#_ = /* @__PURE__ */ new Map();
|
|
45
|
+
#v = [];
|
|
46
|
+
#y = 0;
|
|
47
|
+
#b;
|
|
48
|
+
#x;
|
|
49
|
+
#S = 0;
|
|
50
|
+
#C = 0;
|
|
51
|
+
constructor(e, t, n, r, a = {}) {
|
|
52
|
+
c(e), this.#e = e, this.#i = i(t);
|
|
53
|
+
let p = o(r, [
|
|
54
|
+
"roomId",
|
|
55
|
+
"tenantId",
|
|
56
|
+
"epoch"
|
|
57
|
+
], [
|
|
58
|
+
"roomId",
|
|
59
|
+
"tenantId",
|
|
60
|
+
"epoch"
|
|
61
|
+
]);
|
|
62
|
+
this.#t = Object.freeze({
|
|
63
|
+
roomId: p.roomId,
|
|
64
|
+
tenantId: p.tenantId,
|
|
65
|
+
epoch: p.epoch
|
|
66
|
+
});
|
|
67
|
+
let m = u(a), g = m.limits, _ = m.roster;
|
|
68
|
+
this.#o = m.role, this.#c = m.policies, this.#s = g, this.#n = new f(e.definition.input, this.#t, _);
|
|
69
|
+
let v = _.maxPendingBytes ?? 65536;
|
|
70
|
+
this.#r = new d(e.definition.input, {
|
|
71
|
+
maxBytes: v,
|
|
72
|
+
maxFieldId: Math.min(4096, v * 7)
|
|
73
|
+
});
|
|
74
|
+
let y = s(e).capture(n);
|
|
75
|
+
if (this.#a = y, this.#o !== "relay") {
|
|
76
|
+
let n = g.hashHistoryTicks + 2 + (this.#o === "full" ? g.maxReplayTicks + 1 : 0);
|
|
77
|
+
e.stateCodec.limits.maxBytes > Math.floor(g.maxSnapshotBudgetBytes / n) && h("Referee/full snapshot upper-bound budget is too small for the selected schema/history"), this.#d = l(e, t, y, {
|
|
78
|
+
rollbackHorizonTicks: g.hashHistoryTicks,
|
|
79
|
+
maxReplaySteps: g.hashHistoryTicks,
|
|
80
|
+
maxPlayers: _.maxPlayers ?? 8,
|
|
81
|
+
maxRejectionAttempts: g.maxRejectionAttempts
|
|
82
|
+
}), this.#o === "full" && (this.#b = this.#d.snapshot());
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
get role() {
|
|
86
|
+
return this.#o;
|
|
87
|
+
}
|
|
88
|
+
get tick() {
|
|
89
|
+
return this.#n.tick;
|
|
90
|
+
}
|
|
91
|
+
get refereeTick() {
|
|
92
|
+
return this.#d?.tick ?? null;
|
|
93
|
+
}
|
|
94
|
+
get withdrawn() {
|
|
95
|
+
return this.#p;
|
|
96
|
+
}
|
|
97
|
+
work(e, t = !1) {
|
|
98
|
+
if (this.#f || this.#p && !t) return m("Lockstep role is withdrawn or cannot reenter active work");
|
|
99
|
+
this.#f = !0;
|
|
100
|
+
try {
|
|
101
|
+
return e();
|
|
102
|
+
} finally {
|
|
103
|
+
this.#f = !1;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
admit(e, t) {
|
|
107
|
+
return this.work(() => {
|
|
108
|
+
let n = this.#n.admit(e, t);
|
|
109
|
+
return this.#m.set(n.playerId, t), n;
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
admitAt(e, t) {
|
|
113
|
+
return this.work(() => {
|
|
114
|
+
let n = this.#n.admitAt(e, t);
|
|
115
|
+
return this.#m.set(n.playerId, t), n;
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
rebind(e) {
|
|
119
|
+
return this.work(() => {
|
|
120
|
+
let t = this.#n.rebind(e);
|
|
121
|
+
return this.#m.set(t.playerId, e), t;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
seal() {
|
|
125
|
+
return this.work(() => this.#n.seal());
|
|
126
|
+
}
|
|
127
|
+
join(e, t, n) {
|
|
128
|
+
return this.work(() => {
|
|
129
|
+
let r = this.#n.join(e, t, n);
|
|
130
|
+
return this.#m.set(r.playerId, t), r;
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
playerForSession(e) {
|
|
134
|
+
return this.work(() => this.#n.playerForSession(e));
|
|
135
|
+
}
|
|
136
|
+
submit(e, t, n) {
|
|
137
|
+
return this.work(() => this.#n.submit(e, t, n));
|
|
138
|
+
}
|
|
139
|
+
copyInputs(e) {
|
|
140
|
+
return Object.freeze(e.map((e) => Object.freeze({
|
|
141
|
+
playerId: e.playerId,
|
|
142
|
+
input: a(this.#e.inputCodec.capture(e.input))
|
|
143
|
+
})));
|
|
144
|
+
}
|
|
145
|
+
advance(e) {
|
|
146
|
+
return this.work(() => {
|
|
147
|
+
if (e !== void 0 && (!Number.isInteger(e) || e < 1 || e > 16777216)) return h("Invalid lockstep delivery-input work budget");
|
|
148
|
+
let t = this.#n.next();
|
|
149
|
+
if (t._tag !== "complete") return t;
|
|
150
|
+
let n = this.copyInputs(t.inputs), r = 8;
|
|
151
|
+
for (let e of n) {
|
|
152
|
+
let t = this.#r.full(e.input);
|
|
153
|
+
if (p.isFailure(t)) throw t.failure;
|
|
154
|
+
r += 8 + t.success.length;
|
|
155
|
+
}
|
|
156
|
+
if (e !== void 0 && r > e) return g("lockstepDeliveryInputBytes", e);
|
|
157
|
+
if (this.#o !== "relay") {
|
|
158
|
+
if (this.#h.length >= this.#s.maxQueuedTicks) return g("lockstepRefereeQueueTicks", this.#s.maxQueuedTicks);
|
|
159
|
+
if (this.#g + r > this.#s.maxQueuedInputBytes) return g("lockstepRefereeQueueBytes", this.#s.maxQueuedInputBytes);
|
|
160
|
+
}
|
|
161
|
+
let i = Object.freeze({
|
|
162
|
+
tick: t.tick,
|
|
163
|
+
inputs: n,
|
|
164
|
+
bytes: r
|
|
165
|
+
}), a = Object.freeze({
|
|
166
|
+
_tag: "relayed",
|
|
167
|
+
tick: t.tick,
|
|
168
|
+
inputRecordBytes: r,
|
|
169
|
+
players: t.players,
|
|
170
|
+
inputs: n
|
|
171
|
+
}), o = this.#n.consumeNext();
|
|
172
|
+
return o._tag !== "complete" || o.tick !== t.tick ? m("Lockstep player ownership changed while preparing its matrix") : (this.#o !== "relay" && (this.#h.push(i), this.#g += r), a);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
pumpReferee(e = this.#s.maxRefereeSteps) {
|
|
176
|
+
return this.work(() => {
|
|
177
|
+
let t = this.#d;
|
|
178
|
+
if (!t) return m("Relay does not own a simulation or adjudicate results");
|
|
179
|
+
if (!Number.isInteger(e) || e < 1 || e > this.#s.maxRefereeSteps) return g("lockstepRefereeSteps", this.#s.maxRefereeSteps);
|
|
180
|
+
let n = 0;
|
|
181
|
+
for (; n < e && this.#h.length > this.#s.refereeLagTicks;) {
|
|
182
|
+
let e = this.#h[0];
|
|
183
|
+
if (e.tick !== t.tick + 1) return m("Referee input history is not contiguous");
|
|
184
|
+
let r;
|
|
185
|
+
if (this.#o === "full" && (r = this.#v.length === this.#s.maxReplayTicks ? this.#v[0] : void 0, this.#y - (r?.bytes ?? 0) + e.bytes > this.#s.maxReplayInputBytes)) return g("lockstepReplayInputBytes", this.#s.maxReplayInputBytes);
|
|
186
|
+
let i = t.advance(e.inputs);
|
|
187
|
+
this.#h.shift(), this.#g -= e.bytes, n++, this.#o === "full" && (r && (this.#v.shift(), this.#y -= r.bytes, this.#b = r.snapshot, this.#x = r.inputs), this.#v.push(Object.freeze({
|
|
188
|
+
...e,
|
|
189
|
+
snapshot: i
|
|
190
|
+
})), this.#y += e.bytes);
|
|
191
|
+
for (let [e, n] of this.#_) n.tick <= t.oldestTick && (this.#_.delete(e), this.#w.delete(e));
|
|
192
|
+
}
|
|
193
|
+
return Object.freeze({
|
|
194
|
+
steps: n,
|
|
195
|
+
tick: t.tick
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
observeStall(e) {
|
|
200
|
+
return this.work(() => {
|
|
201
|
+
if (i(e), e < this.#l) return m("Stall observation cannot move host logical ticks backwards");
|
|
202
|
+
let t = this.#n.next();
|
|
203
|
+
if (t._tag !== "waiting") return this.#l = e, this.#u = void 0, Object.freeze({
|
|
204
|
+
_tag: t._tag === "complete" ? "ready" : "empty",
|
|
205
|
+
tick: t.tick
|
|
206
|
+
});
|
|
207
|
+
let n = this.#u?.tick === t.tick ? this.#u : {
|
|
208
|
+
tick: t.tick,
|
|
209
|
+
observation: e
|
|
210
|
+
}, r = e - n.observation + 1;
|
|
211
|
+
if (r > 4294967295) return m("Stall observation age overflow requires an explicit new run");
|
|
212
|
+
let a = this.#c.stallDecision(t.tick, r, t.waitingFor);
|
|
213
|
+
return this.#l = e, this.#u = n, a;
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
snapshot() {
|
|
217
|
+
return this.work(() => this.#d ? this.#d.snapshot() : m("Relay has no authoritative snapshot"));
|
|
218
|
+
}
|
|
219
|
+
recovery() {
|
|
220
|
+
return this.work(() => this.recoveryOwned());
|
|
221
|
+
}
|
|
222
|
+
recoveryOwned() {
|
|
223
|
+
let e = this.#d;
|
|
224
|
+
if (!e || e.tick < 1) return m("Snapshot bootstrap needs an actual confirmed referee input base");
|
|
225
|
+
let t = e.snapshot(), n = e.inputsAt(t.tick), r = Object.freeze(this.#h.map((e, n) => e.tick === t.tick + n + 1 ? Object.freeze({
|
|
226
|
+
tick: e.tick,
|
|
227
|
+
inputs: this.copyInputs(e.inputs)
|
|
228
|
+
}) : m("Referee recovery authority queue is not contiguous")));
|
|
229
|
+
return (r.length ? r[r.length - 1].tick : t.tick) === this.tick ? Object.freeze({
|
|
230
|
+
snapshot: t,
|
|
231
|
+
inputs: n,
|
|
232
|
+
continuation: r
|
|
233
|
+
}) : m("Referee recovery does not reach actual input authority");
|
|
234
|
+
}
|
|
235
|
+
incident(e) {
|
|
236
|
+
let t = this.#d.snapshotAt(e.tick);
|
|
237
|
+
if (t.hash.hi === e.words.hi && t.hash.lo === e.words.lo) return Object.freeze({
|
|
238
|
+
_tag: "match",
|
|
239
|
+
tick: e.tick,
|
|
240
|
+
playerId: e.playerId
|
|
241
|
+
});
|
|
242
|
+
let n = Object.freeze({
|
|
243
|
+
tick: e.tick,
|
|
244
|
+
playerId: e.playerId,
|
|
245
|
+
expected: t.hash,
|
|
246
|
+
received: e.words
|
|
247
|
+
}), r = this.#c.desync(n);
|
|
248
|
+
if (r !== "resync" && r !== "end" && r !== "flag") return h("Desync policy returned an invalid action");
|
|
249
|
+
if (r !== "resync") return Object.freeze({
|
|
250
|
+
_tag: "desync",
|
|
251
|
+
action: r,
|
|
252
|
+
incident: n
|
|
253
|
+
});
|
|
254
|
+
let i = this.recoveryOwned();
|
|
255
|
+
return Object.freeze({
|
|
256
|
+
_tag: "desync",
|
|
257
|
+
action: r,
|
|
258
|
+
incident: n,
|
|
259
|
+
...i,
|
|
260
|
+
continuation: i.continuation ?? Object.freeze([])
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
currentPlayer(e) {
|
|
264
|
+
let t = this.#m.get(e);
|
|
265
|
+
if (!t || this.#n.playerForSession(t).playerId !== e) return m("Hash comparison requires the current actual admitted player");
|
|
266
|
+
}
|
|
267
|
+
submitHash(e, t, n) {
|
|
268
|
+
return this.work(() => {
|
|
269
|
+
let a = this.#d;
|
|
270
|
+
if (!a) return m("Relay cannot accept hashes as authoritative state or vote");
|
|
271
|
+
let o = this.#n.playerForSession(e), s = r(n);
|
|
272
|
+
if (i(t), t < 1 || t % this.#s.hashEvery !== 0) return m("Client hash tick is outside the configured hash cadence");
|
|
273
|
+
if (t <= a.oldestTick) return Object.freeze({
|
|
274
|
+
_tag: "expired",
|
|
275
|
+
tick: t,
|
|
276
|
+
playerId: o.playerId
|
|
277
|
+
});
|
|
278
|
+
if (t > this.tick) return m("Client hash cannot precede actual complete input authority");
|
|
279
|
+
let c = `${t}/${o.playerId}`, l = this.#_.get(c);
|
|
280
|
+
if (l) return l.words.hi !== s.hi || l.words.lo !== s.lo ? m("Conflicting immutable client hash claim") : Object.freeze({
|
|
281
|
+
_tag: "duplicate",
|
|
282
|
+
tick: t,
|
|
283
|
+
playerId: o.playerId
|
|
284
|
+
});
|
|
285
|
+
if (this.#_.size >= this.#s.maxPendingHashes) return g("lockstepPendingHashes", this.#s.maxPendingHashes);
|
|
286
|
+
let u = Object.freeze({
|
|
287
|
+
playerId: o.playerId,
|
|
288
|
+
tick: t,
|
|
289
|
+
words: s
|
|
290
|
+
});
|
|
291
|
+
if (t > a.tick) return this.#_.set(c, u), Object.freeze({
|
|
292
|
+
_tag: "pending",
|
|
293
|
+
tick: t,
|
|
294
|
+
playerId: o.playerId
|
|
295
|
+
});
|
|
296
|
+
let d = this.incident(u);
|
|
297
|
+
return this.currentPlayer(u.playerId), this.#_.set(c, u), this.#S++, d._tag === "desync" && this.#C++, this.#w.add(c), d;
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
#w = /* @__PURE__ */ new Set();
|
|
301
|
+
comparePendingHashes(e = this.#s.maxPendingHashes) {
|
|
302
|
+
return this.work(() => {
|
|
303
|
+
let t = this.#d;
|
|
304
|
+
if (!t) return m("Relay cannot adjudicate client hashes");
|
|
305
|
+
if (!Number.isInteger(e) || e < 1 || e > this.#s.maxPendingHashes) return g("lockstepHashComparisons", this.#s.maxPendingHashes);
|
|
306
|
+
let n = [], r = [];
|
|
307
|
+
for (let [i, a] of this.#_) {
|
|
308
|
+
if (n.length >= e) break;
|
|
309
|
+
if (this.#w.has(i) || a.tick > t.tick) continue;
|
|
310
|
+
this.currentPlayer(a.playerId);
|
|
311
|
+
let o = this.incident(a);
|
|
312
|
+
this.currentPlayer(a.playerId), r.push(i), n.push(o);
|
|
313
|
+
}
|
|
314
|
+
for (let e of r) this.currentPlayer(this.#_.get(e).playerId);
|
|
315
|
+
for (let e = 0; e < r.length; e++) this.#w.add(r[e]), this.#S++, n[e]._tag === "desync" && this.#C++;
|
|
316
|
+
return Object.freeze(n);
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
replay() {
|
|
320
|
+
return this.work(() => {
|
|
321
|
+
if (this.#o !== "full" || !this.#b) return m("Only full owns retained replay/spectator snapshot sources");
|
|
322
|
+
let e = this.copySnapshot(this.#b), t = a(this.#e.optionsCodec.capture(this.#a));
|
|
323
|
+
return Object.freeze({
|
|
324
|
+
seed: this.#i,
|
|
325
|
+
options: t,
|
|
326
|
+
base: e,
|
|
327
|
+
inputs: Object.freeze(this.#v.map((e) => Object.freeze({
|
|
328
|
+
tick: e.tick,
|
|
329
|
+
inputs: this.copyInputs(e.inputs),
|
|
330
|
+
hash: Object.freeze({ ...e.snapshot.hash })
|
|
331
|
+
}))),
|
|
332
|
+
...this.#x ? { baseInputs: this.copyInputs(this.#x) } : {}
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
copySnapshot(e) {
|
|
337
|
+
return Object.freeze({
|
|
338
|
+
tick: e.tick,
|
|
339
|
+
state: a(this.#e.stateCodec.capture(e.state)),
|
|
340
|
+
rng: Object.freeze({ ...e.rng }),
|
|
341
|
+
hash: Object.freeze({ ...e.hash })
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
exportSubject(e, t) {
|
|
345
|
+
return this.work(() => {
|
|
346
|
+
let n = new Set(this.#n.playersForSubject(e, t).map((e) => e.playerId)), r = /* @__PURE__ */ new Map(), i = (e, t) => {
|
|
347
|
+
for (let i of t) n.has(i.playerId) && r.set(`${e}/${i.playerId}`, Object.freeze({
|
|
348
|
+
tick: e,
|
|
349
|
+
playerId: i.playerId,
|
|
350
|
+
input: a(this.#e.inputCodec.capture(i.input))
|
|
351
|
+
}));
|
|
352
|
+
};
|
|
353
|
+
for (let n of this.#n.exportSubject(e, t)) i(n.tick, [n]);
|
|
354
|
+
for (let e of [...this.#v, ...this.#h]) i(e.tick, e.inputs);
|
|
355
|
+
if (this.#d) for (let e = this.#d.oldestTick + 1; e <= this.#d.tick; e++) i(e, this.#d.inputsAt(e));
|
|
356
|
+
let o = [...r.values()].sort((e, t) => e.tick - t.tick || e.playerId - t.playerId), s = [...this.#_.values()].filter((e) => n.has(e.playerId)).map((e) => Object.freeze({
|
|
357
|
+
tick: e.tick,
|
|
358
|
+
playerId: e.playerId,
|
|
359
|
+
hash: Object.freeze({ ...e.words })
|
|
360
|
+
})).sort((e, t) => e.tick - t.tick || e.playerId - t.playerId);
|
|
361
|
+
return Object.freeze({
|
|
362
|
+
inputs: Object.freeze(o),
|
|
363
|
+
hashClaims: Object.freeze(s)
|
|
364
|
+
});
|
|
365
|
+
}, !0);
|
|
366
|
+
}
|
|
367
|
+
eraseSubject(e, t) {
|
|
368
|
+
return this.work(() => {
|
|
369
|
+
let n = this.#n.playersForSubject(e, t);
|
|
370
|
+
return n.length ? (this.withdrawOwned(), n.length) : 0;
|
|
371
|
+
}, !0);
|
|
372
|
+
}
|
|
373
|
+
withdraw() {
|
|
374
|
+
this.work(() => this.withdrawOwned(), !0);
|
|
375
|
+
}
|
|
376
|
+
withdrawOwned() {
|
|
377
|
+
this.#n.withdraw(), this.#h = [], this.#g = 0, this.#v = [], this.#y = 0, this.#_.clear(), this.#w.clear(), this.#m.clear(), this.#d = void 0, this.#b = void 0, this.#x = void 0, this.#a = void 0, this.#u = void 0, this.#p = !0;
|
|
378
|
+
}
|
|
379
|
+
metrics() {
|
|
380
|
+
return Object.freeze({
|
|
381
|
+
role: this.#o,
|
|
382
|
+
tick: this.tick,
|
|
383
|
+
refereeTick: this.refereeTick,
|
|
384
|
+
withdrawn: this.#p,
|
|
385
|
+
refereeLagTicks: this.#s.refereeLagTicks,
|
|
386
|
+
stallAfterTicks: this.#c.stallPolicy.afterTicks,
|
|
387
|
+
stallAction: this.#c.stallPolicy.action,
|
|
388
|
+
players: this.#n.metrics().players,
|
|
389
|
+
pendingInputs: this.#n.metrics().pendingInputs,
|
|
390
|
+
pendingInputBytes: this.#n.metrics().pendingBytes,
|
|
391
|
+
queuedInputs: this.#h.reduce((e, t) => e + t.inputs.length, 0),
|
|
392
|
+
queuedTicks: this.#h.length,
|
|
393
|
+
queuedInputBytes: this.#g,
|
|
394
|
+
pendingHashes: this.#_.size,
|
|
395
|
+
retainedReplayTicks: this.#v.length,
|
|
396
|
+
retainedReplayInputBytes: this.#y,
|
|
397
|
+
comparedHashes: this.#S,
|
|
398
|
+
desyncs: this.#C
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}, v = (e, t, n, r, i = {}) => new _(e, t, n, r, i);
|
|
402
|
+
export { _ as RoomLockstepServer, v as createRoomLockstepServer };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineSimulation as e } from "./simulation.js";
|
|
2
|
+
import { defaultLockstepRefereeLag as t } from "./lockstepPolicies.js";
|
|
3
|
+
import { fieldId as n } from "./room.js";
|
|
4
|
+
import { createRoomLockstepServer as r } from "./lockstepServerRoles.js";
|
|
5
|
+
import { Effect as i, Schema as a } from "effect";
|
|
6
|
+
// src/lockstepServerStrategyFixtures.ts
|
|
7
|
+
var o = () => e({
|
|
8
|
+
state: a.Struct({ value: a.Int.pipe(n(1)) }),
|
|
9
|
+
input: a.Struct({ move: a.Int }),
|
|
10
|
+
options: a.Struct({}),
|
|
11
|
+
init: () => ({ value: 0 }),
|
|
12
|
+
step: (e) => e
|
|
13
|
+
}), s = {
|
|
14
|
+
roomId: "lag-fixture-room",
|
|
15
|
+
tenantId: "lag-fixture-tenant",
|
|
16
|
+
epoch: 1
|
|
17
|
+
}, c = {
|
|
18
|
+
kind: "slot",
|
|
19
|
+
defaultImplementation: t,
|
|
20
|
+
defaultProbe: {
|
|
21
|
+
run: () => i.sync(() => r(o(), 42, {}, s, { serverRole: "referee" }).metrics().refereeLagTicks),
|
|
22
|
+
expected: 12
|
|
23
|
+
},
|
|
24
|
+
overrideProbe: {
|
|
25
|
+
run: () => i.sync(() => r(o(), 42, {}, s, {
|
|
26
|
+
serverRole: "referee",
|
|
27
|
+
strategies: { refereeLag: (e) => t(e) + 2 }
|
|
28
|
+
}).metrics().refereeLagTicks),
|
|
29
|
+
expected: 14
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
export { c as lockstepRefereeLagSlotFixture };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { schemaSimulationHash as e } from "./simulationState.js";
|
|
2
|
+
import { defaultLockstepDesync as t, defaultLockstepRefereeLag as n, defaultLockstepStallPolicy as r } from "./lockstepPolicies.js";
|
|
3
|
+
// src/lockstepStrategies.ts
|
|
4
|
+
var i = (e, t) => e;
|
|
5
|
+
export { t as defaultLockstepDesync, n as defaultLockstepRefereeLag, r as defaultLockstepStallPolicy, i as repeatLastLockstepInput, e as schemaSimulationHash };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { schemaSimulationHash as e } from "./simulationState.js";
|
|
2
|
+
import { createSimulationRunner as t, defineSimulation as n } from "./simulation.js";
|
|
3
|
+
import { createLockstepPolicies as r, defaultLockstepDesync as i, defaultLockstepStallPolicy as a } from "./lockstepPolicies.js";
|
|
4
|
+
import { defaultRoomReconnectPolicy as o, defineRoom as s, fieldId as c } from "./room.js";
|
|
5
|
+
import { repeatLastLockstepInput as l } from "./lockstepStrategies.js";
|
|
6
|
+
import { createLockstepClientSimulation as u } from "./lockstep.js";
|
|
7
|
+
import { Effect as d, Schema as f } from "effect";
|
|
8
|
+
// src/lockstepStrategyFixtures.ts
|
|
9
|
+
var p = f.Struct({ x: f.Int.pipe(c(1)) }), m = f.Struct({ amount: f.Int }), h = f.Struct({}), g = () => n({
|
|
10
|
+
state: p,
|
|
11
|
+
input: m,
|
|
12
|
+
options: h,
|
|
13
|
+
init: () => ({ x: 1 }),
|
|
14
|
+
step: (e, t) => {
|
|
15
|
+
for (let n of t) e.x += n.input.amount;
|
|
16
|
+
return e;
|
|
17
|
+
}
|
|
18
|
+
}), _ = () => [{
|
|
19
|
+
playerId: 1,
|
|
20
|
+
input: { amount: 0 }
|
|
21
|
+
}, {
|
|
22
|
+
playerId: 2,
|
|
23
|
+
input: { amount: 0 }
|
|
24
|
+
}], v = {
|
|
25
|
+
kind: "slot",
|
|
26
|
+
defaultImplementation: l,
|
|
27
|
+
defaultProbe: {
|
|
28
|
+
run: () => d.sync(() => {
|
|
29
|
+
let e = u(g(), 42, {}, {
|
|
30
|
+
localPlayerId: 1,
|
|
31
|
+
initialInputs: _()
|
|
32
|
+
});
|
|
33
|
+
return e.advance(), e.snapshot().state.x;
|
|
34
|
+
}),
|
|
35
|
+
expected: 1
|
|
36
|
+
},
|
|
37
|
+
overrideProbe: {
|
|
38
|
+
run: () => d.sync(() => {
|
|
39
|
+
let e = u(g(), 42, {}, {
|
|
40
|
+
localPlayerId: 1,
|
|
41
|
+
initialInputs: _(),
|
|
42
|
+
inputPrediction: (e, t) => ({ amount: l(e, t).amount + 1 })
|
|
43
|
+
});
|
|
44
|
+
return e.advance(), e.snapshot().state.x;
|
|
45
|
+
}),
|
|
46
|
+
expected: 3
|
|
47
|
+
}
|
|
48
|
+
}, y = {
|
|
49
|
+
kind: "slot",
|
|
50
|
+
defaultImplementation: e,
|
|
51
|
+
defaultProbe: {
|
|
52
|
+
run: () => d.sync(() => {
|
|
53
|
+
let n = g(), r = t(n, 42, {}).snapshot(), i = e(n.stateCodec, r.state);
|
|
54
|
+
return r.hash.hi === i.hi && r.hash.lo === i.lo;
|
|
55
|
+
}),
|
|
56
|
+
expected: !0
|
|
57
|
+
},
|
|
58
|
+
overrideProbe: {
|
|
59
|
+
run: () => d.sync(() => {
|
|
60
|
+
let e = g(), r = n({
|
|
61
|
+
...e.definition,
|
|
62
|
+
hash: () => ({
|
|
63
|
+
hi: 7,
|
|
64
|
+
lo: 9
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
return t(r, 42, {}).snapshot().hash.hi;
|
|
68
|
+
}),
|
|
69
|
+
expected: 7
|
|
70
|
+
}
|
|
71
|
+
}, b = {
|
|
72
|
+
kind: "slot",
|
|
73
|
+
defaultImplementation: a,
|
|
74
|
+
defaultProbe: {
|
|
75
|
+
run: () => d.sync(() => r().stallDecision(1, 1, {
|
|
76
|
+
hi: 0,
|
|
77
|
+
lo: 3
|
|
78
|
+
})._tag),
|
|
79
|
+
expected: "waiting"
|
|
80
|
+
},
|
|
81
|
+
overrideProbe: {
|
|
82
|
+
run: () => d.sync(() => r({}, { stallPolicy: (e) => ({
|
|
83
|
+
...a(e),
|
|
84
|
+
afterTicks: 1
|
|
85
|
+
}) }).stallDecision(1, 1, {
|
|
86
|
+
hi: 0,
|
|
87
|
+
lo: 3
|
|
88
|
+
})._tag),
|
|
89
|
+
expected: "action"
|
|
90
|
+
}
|
|
91
|
+
}, x = () => ({
|
|
92
|
+
tick: 1,
|
|
93
|
+
playerId: 7,
|
|
94
|
+
expected: {
|
|
95
|
+
hi: 0,
|
|
96
|
+
lo: 1
|
|
97
|
+
},
|
|
98
|
+
received: {
|
|
99
|
+
hi: 0,
|
|
100
|
+
lo: 2
|
|
101
|
+
}
|
|
102
|
+
}), S = {
|
|
103
|
+
kind: "slot",
|
|
104
|
+
defaultImplementation: i,
|
|
105
|
+
defaultProbe: {
|
|
106
|
+
run: () => d.sync(() => r().desync(x())),
|
|
107
|
+
expected: "resync"
|
|
108
|
+
},
|
|
109
|
+
overrideProbe: {
|
|
110
|
+
run: () => d.sync(() => r({}, { onDesync: () => "flag" }).desync(x())),
|
|
111
|
+
expected: "flag"
|
|
112
|
+
}
|
|
113
|
+
}, C = {
|
|
114
|
+
kind: "slot",
|
|
115
|
+
defaultImplementation: o,
|
|
116
|
+
defaultProbe: {
|
|
117
|
+
run: () => d.sync(() => s({
|
|
118
|
+
name: "lockstep-reconnect-fixture",
|
|
119
|
+
mode: "lockstep",
|
|
120
|
+
simulation: g(),
|
|
121
|
+
reconnect: { graceMs: 1234 }
|
|
122
|
+
}).reconnect.graceMs),
|
|
123
|
+
expected: 1234
|
|
124
|
+
},
|
|
125
|
+
overrideProbe: {
|
|
126
|
+
run: () => d.sync(() => s({
|
|
127
|
+
name: "lockstep-reconnect-fixture",
|
|
128
|
+
mode: "lockstep",
|
|
129
|
+
simulation: g(),
|
|
130
|
+
reconnect: { graceMs: 1234 },
|
|
131
|
+
strategies: { reconnectPolicy: (e) => ({ graceMs: o(e).graceMs * 2 }) }
|
|
132
|
+
}).reconnect.graceMs),
|
|
133
|
+
expected: 2468
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
export { S as lockstepDesyncSlotFixture, y as lockstepHashSlotFixture, v as lockstepInputPredictionSlotFixture, C as lockstepReconnectSlotFixture, b as lockstepStallPolicySlotFixture };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { simulationOwnData as t } from "./simulationAuthoring.js";
|
|
3
|
+
import { defineRoom as n } from "./room.js";
|
|
4
|
+
import { ROOMS_TABLE as r, ROOM_SEATS_TABLE as i } from "./identities.js";
|
|
5
|
+
import { RoomLockstepTerminalPort as a } from "./lockstepTerminalPorts.js";
|
|
6
|
+
import { captureLockstepJournalScope as o, lockstepJournalIdentity as s } from "./lockstepJournalCodec.js";
|
|
7
|
+
import { createRoomLockstepAdmissionCodec as c } from "./lockstepAdmissionCodec.js";
|
|
8
|
+
import { and as l, eq as u } from "@voltro/database";
|
|
9
|
+
import { Effect as d, Layer as f } from "effect";
|
|
10
|
+
// src/lockstepTerminal.ts
|
|
11
|
+
var p = (n) => {
|
|
12
|
+
let r = t(n, [
|
|
13
|
+
"roomId",
|
|
14
|
+
"tenantId",
|
|
15
|
+
"epoch",
|
|
16
|
+
"disposition"
|
|
17
|
+
], [
|
|
18
|
+
"roomId",
|
|
19
|
+
"tenantId",
|
|
20
|
+
"epoch",
|
|
21
|
+
"disposition"
|
|
22
|
+
]), i = o({
|
|
23
|
+
roomId: r.roomId,
|
|
24
|
+
tenantId: r.tenantId,
|
|
25
|
+
epoch: r.epoch
|
|
26
|
+
});
|
|
27
|
+
if (r.disposition !== "faulted" && r.disposition !== "disposed") throw new e({ detail: "Invalid actual lockstep terminal disposition" });
|
|
28
|
+
return Object.freeze({
|
|
29
|
+
...i,
|
|
30
|
+
disposition: r.disposition
|
|
31
|
+
});
|
|
32
|
+
}, m = (a, o, f) => {
|
|
33
|
+
let m = n(o), h = t(f, [
|
|
34
|
+
"hostId",
|
|
35
|
+
"epochNow",
|
|
36
|
+
"authorize"
|
|
37
|
+
], [
|
|
38
|
+
"hostId",
|
|
39
|
+
"epochNow",
|
|
40
|
+
"authorize"
|
|
41
|
+
]), g = s(h.hostId), _ = h.epochNow, v = h.authorize, y = c(m.simulation, 67108864);
|
|
42
|
+
if (typeof _ != "function" || typeof v != "function") throw new e({ detail: "Lockstep terminal requires actual authorization and wall clock" });
|
|
43
|
+
return Object.freeze({ terminate: (t) => {
|
|
44
|
+
let n = p(t);
|
|
45
|
+
return d.uninterruptible(d.gen(function* () {
|
|
46
|
+
let t = v(n);
|
|
47
|
+
return d.isEffect(t) ? (yield* t, yield* d.tryPromise({
|
|
48
|
+
try: () => a.transactional(async (t) => {
|
|
49
|
+
let a = l(u("id", n.roomId), u("tenantId", n.tenantId)), o = await t.query({
|
|
50
|
+
table: r,
|
|
51
|
+
predicate: a,
|
|
52
|
+
order: [],
|
|
53
|
+
take: 2,
|
|
54
|
+
skip: void 0,
|
|
55
|
+
projection: void 0,
|
|
56
|
+
lock: "update"
|
|
57
|
+
}), s = o[0];
|
|
58
|
+
if (o.length !== 1 || !s || s.id !== n.roomId || s.tenantId !== n.tenantId || s.epoch !== n.epoch || s.hostId !== g || s.name !== m.name || s.maxClients !== m.maxClients || s.erasure != null || s.snapshotErasure != null || s.state !== "creating" && s.state !== "live" && s.state !== n.disposition) throw new e({ detail: "Terminal commit has no exact current unfenced SQL owner" });
|
|
59
|
+
let c = y.captureStored(s.lockstepAdmission, n, g);
|
|
60
|
+
if (s.lockstepCreatorSubjectId !== c.initial.creatorSubjectId || c.initial.name !== m.name) throw new e({ detail: "Terminal admission identity changed" });
|
|
61
|
+
let d = await t.query({
|
|
62
|
+
table: i,
|
|
63
|
+
predicate: l(u("roomId", n.roomId), u("tenantId", n.tenantId), u("state", "connected")),
|
|
64
|
+
order: [],
|
|
65
|
+
take: 1,
|
|
66
|
+
skip: void 0,
|
|
67
|
+
projection: ["sessionId"]
|
|
68
|
+
});
|
|
69
|
+
if (s.clients !== 0 || d.length) throw new e({ detail: "Terminal commit requires actual SQL player withdrawal" });
|
|
70
|
+
if (s.state !== n.disposition) {
|
|
71
|
+
let r = _();
|
|
72
|
+
if (typeof r != "number" || !Number.isSafeInteger(r) || r < 0 || r > 864e13) throw new e({ detail: "Invalid actual terminal wall clock" });
|
|
73
|
+
if (await t.updateMany("_voltro_rooms", {
|
|
74
|
+
state: n.disposition,
|
|
75
|
+
locked: !0,
|
|
76
|
+
updatedAt: new Date(r)
|
|
77
|
+
}, { where: l(a, u("hostId", g), u("epoch", n.epoch), u("state", s.state)) }) !== 1) throw new e({ detail: "Terminal SQL ownership CAS failed" });
|
|
78
|
+
}
|
|
79
|
+
return Object.freeze({
|
|
80
|
+
...n,
|
|
81
|
+
hostId: g
|
|
82
|
+
});
|
|
83
|
+
}),
|
|
84
|
+
catch: (t) => t instanceof e ? t : new e({ detail: "Lockstep terminal SQL outcome is unconfirmed" })
|
|
85
|
+
})) : yield* d.fail(new e({ detail: "Terminal authorization requires its actual Effect" }));
|
|
86
|
+
}).pipe(d.mapError((t) => t instanceof e ? t : new e({ detail: "Lockstep terminal authorization failed" }))));
|
|
87
|
+
} });
|
|
88
|
+
}, h = (e, t, n) => f.succeed(a, m(e, t, n));
|
|
89
|
+
export { a as RoomLockstepTerminalPort, p as captureRoomLockstepTerminal, m as dataStoreRoomLockstepTerminal, h as roomLockstepTerminalLayer };
|