@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,391 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
|
|
3
|
+
declare type AnySchema = Schema.Codec<unknown, unknown>;
|
|
4
|
+
|
|
5
|
+
/* Excluded from this release type: assertCapturedSimulation */
|
|
6
|
+
|
|
7
|
+
/* Excluded from this release type: captureSimulationInputs */
|
|
8
|
+
|
|
9
|
+
/** Local snapshot capture is not network/server provenance. */
|
|
10
|
+
export declare const captureSimulationSnapshot: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(simulation: Simulation<S, I, O>, offered: SimulationSnapshot<S["Type"]>, maxRejectionAttempts?: number) => SimulationSnapshot<S["Type"]>;
|
|
11
|
+
|
|
12
|
+
/** Compare provided observations only. Runner identity/artifacts/exit status
|
|
13
|
+
* must be established outside this pure helper before any engine claim. */
|
|
14
|
+
export declare const compareSimulationConformanceTraces: <S extends AnySchema, I extends AnySchema, O extends AnySchema>(simulation: Simulation<S, I, O>, expected: SimulationConformanceTrace, actual: SimulationConformanceTrace, offeredLimits?: SimulationConformanceLimits) => {
|
|
15
|
+
readonly scope: "provided-trace-comparison";
|
|
16
|
+
readonly ticks: number;
|
|
17
|
+
readonly comparisons: number;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Source-portable fixture construction only. It never initializes simulation
|
|
21
|
+
* state, and the entire typed matrix is captured before a conformance run. */
|
|
22
|
+
export declare const createSimulationConformanceCase: <S extends AnySchema, I extends AnySchema, O extends AnySchema>(simulation: Simulation<S, I, O>, offered: SimulationConformanceCaseOptions<I["Type"], O["Type"]>) => SimulationConformanceCase;
|
|
23
|
+
|
|
24
|
+
export declare const createSimulationInputHistoryCodec: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(simulation: Simulation<S, I, O>, options?: SimulationInputHistoryCodecOptions) => SimulationInputHistoryCodec<S, I, O>;
|
|
25
|
+
|
|
26
|
+
export declare const createSimulationOptionsCodec: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(simulation: Simulation<S, I, O>) => SimulationOptionsCodec<S, I, O>;
|
|
27
|
+
|
|
28
|
+
export declare const createSimulationRecoveryCodec: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(simulation: Simulation<S, I, O>, options?: SimulationRecoveryCodecOptions) => SimulationRecoveryCodec<S, I, O>;
|
|
29
|
+
|
|
30
|
+
export declare const createSimulationRunner: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(simulation: Simulation<S, I, O>, seed: number, options: O["Type"], budgets?: SimulationRunnerOptions) => SimulationRunner<S, I, O>;
|
|
31
|
+
|
|
32
|
+
export declare const createSimulationSnapshotCodec: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(simulation: Simulation<S, I, O>, options?: SimulationSnapshotCodecOptions) => SimulationSnapshotCodec<S, I, O>;
|
|
33
|
+
|
|
34
|
+
/** Field IDs and integer raw values define authoritative hash order. Cosmetic
|
|
35
|
+
* fields are validated/copied but never hashed. This hash is not authentication. */
|
|
36
|
+
export declare const createSimulationState: <S extends Schema.Codec<unknown, unknown>>(schema: S, limits?: Partial<SimulationValueLimits>) => SimulationStateCodec<S>;
|
|
37
|
+
|
|
38
|
+
/** Whole byte/layout/count/schema admission precedes any simulation init. */
|
|
39
|
+
export declare const decodeSimulationConformanceCase: <S extends AnySchema, I extends AnySchema, O extends AnySchema>(simulation: Simulation<S, I, O>, offered: Uint8Array, offeredLimits?: SimulationConformanceLimits) => SimulationConformanceCase;
|
|
40
|
+
|
|
41
|
+
/** Pure captured author callbacks and shared schema plans. No Room mode, host,
|
|
42
|
+
* store, scheduler, port installation, network or global entropy is acquired. */
|
|
43
|
+
export declare const defineSimulation: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(offered: SimulationDefinition<S, I, O>) => Simulation<S, I, O>;
|
|
44
|
+
|
|
45
|
+
/** SCF/v1 is an offline reproducibility artifact, not a Room frame, remote
|
|
46
|
+
* authentication grant, snapshot or process-execution receipt. */
|
|
47
|
+
export declare const encodeSimulationConformanceCase: <S extends AnySchema, I extends AnySchema, O extends AnySchema>(simulation: Simulation<S, I, O>, offered: SimulationConformanceCase, offeredLimits?: SimulationConformanceLimits) => Uint8Array;
|
|
48
|
+
|
|
49
|
+
/** Cosmetic state remains schema-validated and copied, but is excluded from simulation hashes. */
|
|
50
|
+
export declare const nonAuthoritative: () => <S extends Schema.Codec<unknown, unknown>>(schema: S) => S;
|
|
51
|
+
|
|
52
|
+
/** PCG-XSH-RR 64/32. Numeric seeds are unsigned 32-bit; word seeds retain 64 bits.
|
|
53
|
+
* Algorithm reference: https://www.pcg-random.org/using-pcg-c-basic.html
|
|
54
|
+
* No global generator, BigInt, native dependency or implicit time/entropy seed. */
|
|
55
|
+
declare class Pcg32 {
|
|
56
|
+
#private;
|
|
57
|
+
constructor(seed: Pcg32Seed, stream?: Pcg32Seed, maxRejectionAttempts?: number);
|
|
58
|
+
get maxRejectionAttempts(): number;
|
|
59
|
+
nextU32(): number;
|
|
60
|
+
/** Rejection removes modulo bias. Exhaustion consumes exactly the bounded
|
|
61
|
+
* draws and fails; it never returns a biased fallback or substitutes entropy. */
|
|
62
|
+
bounded(bound: number): number;
|
|
63
|
+
snapshot(): Pcg32Snapshot;
|
|
64
|
+
restore(offered: Pcg32Snapshot): void;
|
|
65
|
+
clone(): Pcg32;
|
|
66
|
+
/** Exact skip-ahead modulo 2^64; at most 32 iterations for this delta API. */
|
|
67
|
+
advance(delta: number): void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
declare type Pcg32Seed = number | Uint64Words;
|
|
71
|
+
|
|
72
|
+
declare interface Pcg32Snapshot {
|
|
73
|
+
readonly stateHi: number;
|
|
74
|
+
readonly stateLo: number;
|
|
75
|
+
readonly incrementHi: number;
|
|
76
|
+
readonly incrementLo: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/* Excluded from this release type: prepareSimulationSnapshot */
|
|
80
|
+
|
|
81
|
+
/** Every option present and defined: `Required` keeps an explicit `| undefined`, this removes it. */
|
|
82
|
+
declare type Resolved<T> = {
|
|
83
|
+
readonly [K in keyof T]-?: Exclude<T[K], undefined>;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
declare interface RoomCodecLimits {
|
|
87
|
+
readonly maxBytes: number;
|
|
88
|
+
readonly maxCollectionLength: number;
|
|
89
|
+
readonly maxFieldId: number;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Plain mutable state; the author receives no store or database capability. */
|
|
93
|
+
declare type RoomState<A> = A extends ReadonlyArray<infer V> ? Array<RoomState<V>> : A extends object ? {
|
|
94
|
+
-readonly [K in keyof A]: RoomState<A[K]>;
|
|
95
|
+
} : A;
|
|
96
|
+
|
|
97
|
+
/** Emit actual observations in this invocation. The result does not identify an
|
|
98
|
+
* engine, authenticate a remote runner or establish a cross-engine proof. */
|
|
99
|
+
export declare const runSimulationConformanceTrace: <S extends AnySchema, I extends AnySchema, O extends AnySchema>(simulation: Simulation<S, I, O>, offered: SimulationConformanceCase, offeredLimits?: SimulationConformanceLimits) => SimulationConformanceTrace;
|
|
100
|
+
|
|
101
|
+
/** Exported default hash slot, reusing the admitted schema state codec. */
|
|
102
|
+
export declare const schemaSimulationHash: <S extends Schema.Codec<unknown, unknown>>(codec: SimulationStateCodec<S>, state: S["Type"]) => Uint64Words;
|
|
103
|
+
|
|
104
|
+
export declare interface Simulation<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
105
|
+
readonly definition: SimulationDefinition<S, I, O>;
|
|
106
|
+
readonly stateCodec: SimulationStateCodec<S>;
|
|
107
|
+
readonly inputCodec: SimulationStateCodec<I>;
|
|
108
|
+
readonly optionsCodec: SimulationStateCodec<O>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Same-invocation fresh-run and real retained rollback controls, not B31. */
|
|
112
|
+
export declare const simulationConformance: <S extends AnySchema, I extends AnySchema, O extends AnySchema>(simulation: Simulation<S, I, O>, offered: SimulationConformanceCase, offeredLimits?: SimulationConformanceLimits) => SimulationConformanceResult;
|
|
113
|
+
|
|
114
|
+
export declare interface SimulationConformanceCase {
|
|
115
|
+
readonly seed: number;
|
|
116
|
+
readonly stateSchemaHash: number;
|
|
117
|
+
/** Actual LSO bytes: never JSON-roundtrip init options. */
|
|
118
|
+
readonly options: Uint8Array;
|
|
119
|
+
/** Actual LSI bytes: complete canonical tick-zero input history. */
|
|
120
|
+
readonly inputs: Uint8Array;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export declare interface SimulationConformanceCaseOptions<I, O> {
|
|
124
|
+
readonly seed: number;
|
|
125
|
+
readonly options: O;
|
|
126
|
+
readonly playerIds: ReadonlyArray<number>;
|
|
127
|
+
readonly sample: (context: SimulationConformanceSampleContext) => I;
|
|
128
|
+
readonly inputSeed?: number;
|
|
129
|
+
readonly ticks?: number;
|
|
130
|
+
readonly maxBytes?: number | undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export declare interface SimulationConformanceLimits {
|
|
134
|
+
readonly maxTicks?: number;
|
|
135
|
+
readonly maxCaseBytes?: number;
|
|
136
|
+
readonly maxStateBytes?: number;
|
|
137
|
+
readonly maxRetainedStateBytes?: number;
|
|
138
|
+
readonly maxWorkSteps?: number;
|
|
139
|
+
readonly maxObservations?: number;
|
|
140
|
+
readonly rollbackHorizonTicks?: number;
|
|
141
|
+
readonly replayEveryTicks?: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export declare interface SimulationConformanceObservation {
|
|
145
|
+
readonly tick: number;
|
|
146
|
+
/** Always compute the schema hash even when the author overrides hash. */
|
|
147
|
+
readonly schemaHash: Uint64Words;
|
|
148
|
+
readonly hash: Uint64Words;
|
|
149
|
+
readonly rng: Pcg32Snapshot;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export declare interface SimulationConformanceResult {
|
|
153
|
+
readonly scope: 'local-repeat-and-rollback';
|
|
154
|
+
readonly trace: SimulationConformanceTrace;
|
|
155
|
+
readonly ticks: number;
|
|
156
|
+
readonly stepsExecuted: number;
|
|
157
|
+
readonly comparisons: number;
|
|
158
|
+
readonly replays: number;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export declare interface SimulationConformanceSampleContext {
|
|
162
|
+
readonly tick: number;
|
|
163
|
+
readonly playerId: number;
|
|
164
|
+
/** Separate case-generation RNG, never the simulation's retained RNG. */
|
|
165
|
+
readonly rng: Pcg32;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export declare interface SimulationConformanceTrace {
|
|
169
|
+
readonly case: SimulationConformanceCase;
|
|
170
|
+
readonly observations: ReadonlyArray<SimulationConformanceObservation>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export declare interface SimulationDefinition<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
174
|
+
readonly state: S;
|
|
175
|
+
readonly input: I;
|
|
176
|
+
readonly options: O;
|
|
177
|
+
readonly init: (seed: number, options: (O)["Type"]) => (S)["Type"];
|
|
178
|
+
readonly step: (state: RoomState<(S)["Type"]>, inputs: ReadonlyArray<SimulationPlayerInput<(I)["Type"]>>, tick: number, rng: Pcg32) => (S)["Type"];
|
|
179
|
+
readonly hash?: (state: (S)["Type"]) => Uint64Words;
|
|
180
|
+
/** Late join: runs before `step` at the tick a player's input first appears (it was absent
|
|
181
|
+
* from the previous tick's inputs), in player-ID order, e.g. to spawn the player. Pure and
|
|
182
|
+
* deterministic like `step`. Start players are `init`'s job: tick 1 runs no join. */
|
|
183
|
+
readonly join?: (state: RoomState<(S)["Type"]>, playerId: number, tick: number, rng: Pcg32) => (S)["Type"];
|
|
184
|
+
readonly limits?: Partial<SimulationValueLimits>;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export declare interface SimulationInputHistory<I> {
|
|
188
|
+
readonly fromTick: number;
|
|
189
|
+
readonly playerIds: ReadonlyArray<number>;
|
|
190
|
+
readonly inputs: ReadonlyArray<SimulationTickInputs<I>>;
|
|
191
|
+
/** Late joins (LSI/v2): these `playerIds` appear in rows from `tick` on. */
|
|
192
|
+
readonly joins?: ReadonlyArray<{
|
|
193
|
+
readonly playerId: number;
|
|
194
|
+
readonly tick: number;
|
|
195
|
+
}>;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** LSI/v1 contains public IDs and actual intentions only. LSI/v2 (late joins) adds each
|
|
199
|
+
* player's first tick; a row carries only players active at its tick. It supplies neither
|
|
200
|
+
* state/hash nor Subject/Session/epoch authentication; owner verifies provenance. */
|
|
201
|
+
export declare class SimulationInputHistoryCodec<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
202
|
+
#private;
|
|
203
|
+
constructor(simulation: Simulation<S, I, O>, offered?: SimulationInputHistoryCodecOptions);
|
|
204
|
+
private work;
|
|
205
|
+
private pack;
|
|
206
|
+
capture(offered: SimulationInputHistory<(I)["Type"]>): SimulationInputHistory<(I)["Type"]>;
|
|
207
|
+
encode(offered: SimulationInputHistory<(I)["Type"]>): Uint8Array;
|
|
208
|
+
decode(offered: Uint8Array): SimulationInputHistory<(I)["Type"]>;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
export declare interface SimulationInputHistoryCodecOptions {
|
|
212
|
+
readonly maxBytes?: number | undefined;
|
|
213
|
+
readonly maxPlayers?: number;
|
|
214
|
+
readonly maxTicks?: number;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/** Exact bounded options on wire and in SQL. One shared Room compiler with
|
|
218
|
+
* implicit field IDs and f64 defaults, not a second serialization schema. */
|
|
219
|
+
export declare class SimulationOptionsCodec<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
220
|
+
#private;
|
|
221
|
+
constructor(simulation: Simulation<S, I, O>);
|
|
222
|
+
get schemaHash(): number;
|
|
223
|
+
get maxBytes(): number;
|
|
224
|
+
private work;
|
|
225
|
+
private captureOwned;
|
|
226
|
+
capture(offered: unknown): (O)["Type"];
|
|
227
|
+
encode(offered: unknown): Uint8Array;
|
|
228
|
+
decode(offered: Uint8Array): (O)["Type"];
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export declare interface SimulationPlayerInput<I> {
|
|
232
|
+
readonly playerId: number;
|
|
233
|
+
readonly input: I;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export declare interface SimulationRecovery<S, I> {
|
|
237
|
+
readonly snapshot: SimulationSnapshot<S>;
|
|
238
|
+
readonly inputs: ReadonlyArray<SimulationPlayerInput<I>>;
|
|
239
|
+
readonly continuation?: ReadonlyArray<SimulationTickInputs<I>> | undefined;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** LSS/v2: actual current LSR snapshot, complete used input base, and following
|
|
243
|
+
* authoritative matrices. Decoding grants no Session/epoch/roster authority. */
|
|
244
|
+
export declare class SimulationRecoveryCodec<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
245
|
+
#private;
|
|
246
|
+
constructor(simulation: Simulation<S, I, O>, offered?: SimulationRecoveryCodecOptions);
|
|
247
|
+
get maxBytes(): number;
|
|
248
|
+
private work;
|
|
249
|
+
encode(offered: SimulationRecovery<(S)["Type"], (I)["Type"]>): Uint8Array;
|
|
250
|
+
decode(offered: Uint8Array): SimulationRecovery<(S)["Type"], (I)["Type"]>;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export declare interface SimulationRecoveryCodecOptions {
|
|
254
|
+
readonly maxBytes?: number | undefined;
|
|
255
|
+
readonly maxPlayers?: number;
|
|
256
|
+
readonly maxTicks?: number;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export declare interface SimulationReplay<S> {
|
|
260
|
+
readonly fromTick: number;
|
|
261
|
+
readonly steps: number;
|
|
262
|
+
readonly snapshot: SimulationSnapshot<S>;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export declare interface SimulationReplayRecording<S, I, O> {
|
|
266
|
+
readonly seed: number;
|
|
267
|
+
readonly options: O;
|
|
268
|
+
readonly base: SimulationSnapshot<S>;
|
|
269
|
+
readonly inputs: ReadonlyArray<{
|
|
270
|
+
readonly tick: number;
|
|
271
|
+
readonly inputs: ReadonlyArray<SimulationPlayerInput<I>>;
|
|
272
|
+
readonly hash: Uint64Words;
|
|
273
|
+
}>;
|
|
274
|
+
/** The matrix used at the base tick: a `join` hook on the first replayed tick compares with it. */
|
|
275
|
+
readonly baseInputs?: ReadonlyArray<SimulationPlayerInput<I>>;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export declare type SimulationReplayVerification = {
|
|
279
|
+
readonly _tag: 'verified';
|
|
280
|
+
readonly ticks: number;
|
|
281
|
+
readonly throughTick: number;
|
|
282
|
+
readonly hash: Uint64Words;
|
|
283
|
+
} | {
|
|
284
|
+
readonly _tag: 'diverged';
|
|
285
|
+
readonly tick: number;
|
|
286
|
+
readonly expected: Uint64Words;
|
|
287
|
+
readonly actual: Uint64Words;
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
export declare interface SimulationReplayVerifyOptions {
|
|
291
|
+
readonly maxReplayTicks?: number;
|
|
292
|
+
readonly maxInputBytes?: number;
|
|
293
|
+
readonly maxPlayers?: number;
|
|
294
|
+
readonly maxRejectionAttempts?: number;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Memory-only runner. Caller supplies ordered intent authority; replaceInputs
|
|
298
|
+
* and installSnapshot are explicit local operations, never socket admission. */
|
|
299
|
+
export declare class SimulationRunner<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
300
|
+
#private;
|
|
301
|
+
constructor(simulation: Simulation<S, I, O>, seed: number, options: (O)["Type"], budgets?: SimulationRunnerOptions);
|
|
302
|
+
get tick(): number;
|
|
303
|
+
/** Diagnostic for the last guarded operation only. No state/input/exception
|
|
304
|
+
* data is retained; read before starting another guarded operation. */
|
|
305
|
+
get lastFailedTransitionTick(): number | null;
|
|
306
|
+
get limits(): Resolved<SimulationRunnerOptions>;
|
|
307
|
+
get oldestTick(): number;
|
|
308
|
+
private work;
|
|
309
|
+
private position;
|
|
310
|
+
private rng;
|
|
311
|
+
private prepare;
|
|
312
|
+
private publicSnapshot;
|
|
313
|
+
snapshot(): SimulationSnapshot<(S)["Type"]>;
|
|
314
|
+
snapshotAt(tick: number): SimulationSnapshot<(S)["Type"]>;
|
|
315
|
+
/** Detached retained actual intents for scoped server export/replay owners. */
|
|
316
|
+
inputsAt(tick: number): ReadonlyArray<SimulationPlayerInput<(I)["Type"]>>;
|
|
317
|
+
private captureInputs;
|
|
318
|
+
/** Inputs of a retained tick, or undefined when the runner does not hold them (tick 0, before a snapshot). */
|
|
319
|
+
private retainedInputs;
|
|
320
|
+
private transition;
|
|
321
|
+
advance(inputs: ReadonlyArray<SimulationPlayerInput<(I)["Type"]>>): SimulationSnapshot<(S)["Type"]>;
|
|
322
|
+
replaceInputs(tick: number, inputs: ReadonlyArray<SimulationPlayerInput<(I)["Type"]>>): SimulationReplay<(S)["Type"]>;
|
|
323
|
+
replaceInputsRange(changes: ReadonlyArray<SimulationTickInputs<(I)["Type"]>>): SimulationReplay<(S)["Type"]>;
|
|
324
|
+
/** `inputs`: the matrix used at the snapshot's tick, when known; a `join` hook compares the next tick with it. */
|
|
325
|
+
installSnapshot(snapshot: SimulationSnapshot<(S)["Type"]>, inputs?: ReadonlyArray<SimulationPlayerInput<(I)["Type"]>>): SimulationSnapshot<(S)["Type"]>;
|
|
326
|
+
private advanceOwned;
|
|
327
|
+
/** Replay all affected retained steps in temporary ownership. A callback,
|
|
328
|
+
* schema/hash/RNG/work failure preserves the original ring and current tick. */
|
|
329
|
+
private replaceInputsRangeOwned;
|
|
330
|
+
/** Local reset seam. Network/server provenance must be verified by the Room
|
|
331
|
+
* integration before calling; matching a non-cryptographic hash grants none. */
|
|
332
|
+
private installSnapshotOwned;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export declare interface SimulationRunnerOptions {
|
|
336
|
+
readonly rollbackHorizonTicks?: number;
|
|
337
|
+
readonly maxReplaySteps?: number;
|
|
338
|
+
readonly maxPlayers?: number;
|
|
339
|
+
readonly maxRejectionAttempts?: number;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export declare interface SimulationSnapshot<S> {
|
|
343
|
+
readonly tick: number;
|
|
344
|
+
readonly state: S;
|
|
345
|
+
readonly rng: Pcg32Snapshot;
|
|
346
|
+
readonly hash: Uint64Words;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** LSR/v1 bounded snapshot envelope. Reuses the actual Room state codec;
|
|
350
|
+
* header validates layouts/tick/PCG words/hash, never Room/Subject authority. */
|
|
351
|
+
export declare class SimulationSnapshotCodec<S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>> {
|
|
352
|
+
#private;
|
|
353
|
+
constructor(simulation: Simulation<S, I, O>, offered?: SimulationSnapshotCodecOptions);
|
|
354
|
+
get maxBytes(): number;
|
|
355
|
+
private work;
|
|
356
|
+
encode(offered: SimulationSnapshot<(S)["Type"]>): Uint8Array;
|
|
357
|
+
decode(offered: Uint8Array): SimulationSnapshot<(S)["Type"]>;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export declare interface SimulationSnapshotCodecOptions {
|
|
361
|
+
readonly maxBytes?: number | undefined;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export declare interface SimulationStateCodec<S extends Schema.Codec<unknown, unknown>> {
|
|
365
|
+
readonly limits: SimulationValueLimits;
|
|
366
|
+
/** Admitted capture/hash plan, not a binary Room wire schema. */
|
|
367
|
+
schemaDescription?(): string;
|
|
368
|
+
capture(value: unknown): (S)["Type"];
|
|
369
|
+
hash(value: (S)["Type"]): Uint64Words;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export declare interface SimulationTickInputs<I> {
|
|
373
|
+
readonly tick: number;
|
|
374
|
+
readonly inputs: ReadonlyArray<SimulationPlayerInput<I>>;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
export declare interface SimulationValueLimits extends RoomCodecLimits {
|
|
378
|
+
readonly maxNodes: number;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/** Exact unsigned 64-bit integer as independent 32-bit words. */
|
|
382
|
+
declare interface Uint64Words {
|
|
383
|
+
readonly hi: number;
|
|
384
|
+
readonly lo: number;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/** Actual local replay execution, first divergent tick only. No engine/run
|
|
388
|
+
* provenance, live identity, network authority, Nightly or capacity conclusion. */
|
|
389
|
+
export declare const verifySimulationReplay: <S extends Schema.Codec<unknown, unknown>, I extends Schema.Codec<unknown, unknown>, O extends Schema.Codec<unknown, unknown>>(simulation: Simulation<S, I, O>, offered: SimulationReplayRecording<S["Type"], I["Type"], O["Type"]>, budgets?: SimulationReplayVerifyOptions) => SimulationReplayVerification;
|
|
390
|
+
|
|
391
|
+
export { }
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { BudgetExceeded as e, RoomAuthoringError as t } from "./errors.js";
|
|
2
|
+
import { captureUint64Words as n, unsignedWord as r } from "./fixedWords.js";
|
|
3
|
+
import { Pcg32 as i } from "./pcg32.js";
|
|
4
|
+
import { freezeSimulationValue as a, simulationOwnData as o, simulationSyncValue as s } from "./simulationAuthoring.js";
|
|
5
|
+
import { createSimulationState as c, schemaSimulationHash as l, simulationValueCodec as u } from "./simulationState.js";
|
|
6
|
+
import { SimulationOptionsCodec as d, createSimulationOptionsCodec as f } from "./simulationOptionsWire.js";
|
|
7
|
+
import { SimulationInputHistoryCodec as p, createSimulationInputHistoryCodec as m } from "./simulationInputHistoryWire.js";
|
|
8
|
+
import { compareSimulationConformanceTraces as h, createSimulationConformanceCase as g, decodeSimulationConformanceCase as _, encodeSimulationConformanceCase as v, runSimulationConformanceTrace as y, simulationConformance as b } from "./simulationConformance.js";
|
|
9
|
+
import { SimulationSnapshotCodec as x, createSimulationSnapshotCodec as S } from "./simulationSnapshotWire.js";
|
|
10
|
+
import { verifySimulationReplay as C } from "./simulationReplay.js";
|
|
11
|
+
import { SimulationRecoveryCodec as w, createSimulationRecoveryCodec as T } from "./simulationRecoveryWire.js";
|
|
12
|
+
import { nonAuthoritative as E } from "./room.js";
|
|
13
|
+
// src/simulation.ts
|
|
14
|
+
var D = /* @__PURE__ */ new WeakSet(), O = (e) => {
|
|
15
|
+
if (!e || typeof e != "object" || !D.has(e)) throw new t({
|
|
16
|
+
room: "simulation",
|
|
17
|
+
detail: "Runner requires a captured simulation declaration"
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
function k(e) {
|
|
21
|
+
throw new t({
|
|
22
|
+
room: "simulation",
|
|
23
|
+
detail: e
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
var A = (e) => {
|
|
27
|
+
let t = o(e, [
|
|
28
|
+
"state",
|
|
29
|
+
"input",
|
|
30
|
+
"options",
|
|
31
|
+
"init",
|
|
32
|
+
"step",
|
|
33
|
+
"hash",
|
|
34
|
+
"join",
|
|
35
|
+
"limits"
|
|
36
|
+
], [
|
|
37
|
+
"state",
|
|
38
|
+
"input",
|
|
39
|
+
"options",
|
|
40
|
+
"init",
|
|
41
|
+
"step"
|
|
42
|
+
]);
|
|
43
|
+
if (typeof t.init != "function" || typeof t.step != "function" || ["hash", "join"].some((e) => Object.hasOwn(t, e) && typeof t[e] != "function")) return k("Simulation callbacks must be functions");
|
|
44
|
+
let n = Object.freeze(t), r = c(n.state, n.limits), i = u(n.input, n.limits ?? {}, !1, !0), a = u(n.options, n.limits ?? {}, !1, !1), s = Object.freeze({
|
|
45
|
+
definition: Object.freeze({
|
|
46
|
+
...n,
|
|
47
|
+
limits: r.limits
|
|
48
|
+
}),
|
|
49
|
+
stateCodec: r,
|
|
50
|
+
inputCodec: i,
|
|
51
|
+
optionsCodec: a
|
|
52
|
+
});
|
|
53
|
+
return D.add(s), s;
|
|
54
|
+
}, j = (e, t) => {
|
|
55
|
+
let n = new i(0, 0, t);
|
|
56
|
+
return n.restore(e), n.snapshot();
|
|
57
|
+
}, M = (e, t, i, o, c = 64) => {
|
|
58
|
+
O(e), r(t);
|
|
59
|
+
let u = a(e.stateCodec.capture(s(i))), d = e.definition.hash ? n(s(e.definition.hash(u))) : l(e.stateCodec, u);
|
|
60
|
+
return Object.freeze({
|
|
61
|
+
tick: t,
|
|
62
|
+
state: u,
|
|
63
|
+
rng: j(o, c),
|
|
64
|
+
hash: d
|
|
65
|
+
});
|
|
66
|
+
}, N = (e, t, i = 64) => {
|
|
67
|
+
let a = o(t, [
|
|
68
|
+
"tick",
|
|
69
|
+
"state",
|
|
70
|
+
"rng",
|
|
71
|
+
"hash"
|
|
72
|
+
], [
|
|
73
|
+
"tick",
|
|
74
|
+
"state",
|
|
75
|
+
"rng",
|
|
76
|
+
"hash"
|
|
77
|
+
]), s = n(a.hash), c = M(e, r(a.tick), a.state, a.rng, i);
|
|
78
|
+
return c.hash.hi !== s.hi || c.hash.lo !== s.lo ? k("Installed snapshot hash does not match its validated state") : c;
|
|
79
|
+
}, P = (t, n, i) => {
|
|
80
|
+
if (O(t), !Number.isInteger(i) || i < 1 || i > 64) return k("Invalid simulation player work limit");
|
|
81
|
+
if (!Array.isArray(n) || n.length > i) throw new e({
|
|
82
|
+
budget: "simulationPlayers",
|
|
83
|
+
limit: i
|
|
84
|
+
});
|
|
85
|
+
if (Reflect.ownKeys(n).length !== n.length + 1) return k("Simulation inputs require a dense array without extra fields");
|
|
86
|
+
let s = /* @__PURE__ */ new Set(), c = [];
|
|
87
|
+
for (let e = 0; e < n.length; e++) {
|
|
88
|
+
let i = Object.getOwnPropertyDescriptor(n, String(e));
|
|
89
|
+
if (!i?.enumerable || !("value" in i)) return k("Simulation input arrays cannot contain holes or accessors");
|
|
90
|
+
let l = o(i.value, ["playerId", "input"], ["playerId", "input"]), u = r(l.playerId);
|
|
91
|
+
if (s.has(u)) return k("Simulation input player IDs must be unique");
|
|
92
|
+
s.add(u), c.push(Object.freeze({
|
|
93
|
+
playerId: u,
|
|
94
|
+
input: a(t.inputCodec.capture(l.input))
|
|
95
|
+
}));
|
|
96
|
+
}
|
|
97
|
+
return c.sort((e, t) => e.playerId - t.playerId), Object.freeze(c);
|
|
98
|
+
}, F = (e) => {
|
|
99
|
+
let t = o(e, [
|
|
100
|
+
"rollbackHorizonTicks",
|
|
101
|
+
"maxReplaySteps",
|
|
102
|
+
"maxPlayers",
|
|
103
|
+
"maxRejectionAttempts"
|
|
104
|
+
], []), n = (e, n) => Object.hasOwn(t, e) ? t[e] : n, r = n("rollbackHorizonTicks", 8), i = {
|
|
105
|
+
rollbackHorizonTicks: r,
|
|
106
|
+
maxReplaySteps: n("maxReplaySteps", r),
|
|
107
|
+
maxPlayers: n("maxPlayers", 8),
|
|
108
|
+
maxRejectionAttempts: n("maxRejectionAttempts", 64)
|
|
109
|
+
}, a = {
|
|
110
|
+
rollbackHorizonTicks: 4096,
|
|
111
|
+
maxReplaySteps: 4096,
|
|
112
|
+
maxPlayers: 64,
|
|
113
|
+
maxRejectionAttempts: 65536
|
|
114
|
+
};
|
|
115
|
+
for (let e of Object.keys(i)) if (!Number.isSafeInteger(i[e]) || i[e] < 1 || i[e] > a[e]) return k("Simulation runner budgets require bounded positive integers");
|
|
116
|
+
return Object.freeze(i);
|
|
117
|
+
}, I = class {
|
|
118
|
+
#e;
|
|
119
|
+
#t;
|
|
120
|
+
#n = !1;
|
|
121
|
+
#r = null;
|
|
122
|
+
#i = 0;
|
|
123
|
+
#a;
|
|
124
|
+
#o;
|
|
125
|
+
#s;
|
|
126
|
+
constructor(e, t, n, o = {}) {
|
|
127
|
+
O(e), this.#e = e, this.#t = F(o), r(t);
|
|
128
|
+
let c = a(e.optionsCodec.capture(n)), l = e.stateCodec.capture(s(e.definition.init(t, c))), u = new i(t, 54, this.#t.maxRejectionAttempts);
|
|
129
|
+
this.#a = this.prepare(0, l, u.snapshot()), this.#o = Array(this.#t.rollbackHorizonTicks + 1), this.#s = Array(this.#t.rollbackHorizonTicks + 1), this.#o[0] = this.#a;
|
|
130
|
+
}
|
|
131
|
+
get tick() {
|
|
132
|
+
return this.#a.tick;
|
|
133
|
+
}
|
|
134
|
+
get lastFailedTransitionTick() {
|
|
135
|
+
return this.#r;
|
|
136
|
+
}
|
|
137
|
+
get limits() {
|
|
138
|
+
return this.#t;
|
|
139
|
+
}
|
|
140
|
+
get oldestTick() {
|
|
141
|
+
return Math.max(this.#i, this.tick - this.#t.rollbackHorizonTicks);
|
|
142
|
+
}
|
|
143
|
+
work(e) {
|
|
144
|
+
if (this.#n) return k("Simulation mutation cannot reenter an active step or replay");
|
|
145
|
+
this.#r = null, this.#n = !0;
|
|
146
|
+
try {
|
|
147
|
+
return e();
|
|
148
|
+
} finally {
|
|
149
|
+
this.#n = !1;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
position(e) {
|
|
153
|
+
return e % this.#o.length;
|
|
154
|
+
}
|
|
155
|
+
rng(e) {
|
|
156
|
+
let t = new i(0, 0, this.#t.maxRejectionAttempts);
|
|
157
|
+
return t.restore(e), t;
|
|
158
|
+
}
|
|
159
|
+
prepare(e, t, n) {
|
|
160
|
+
return M(this.#e, e, t, n, this.#t.maxRejectionAttempts);
|
|
161
|
+
}
|
|
162
|
+
publicSnapshot(e) {
|
|
163
|
+
return Object.freeze({
|
|
164
|
+
tick: e.tick,
|
|
165
|
+
state: a(this.#e.stateCodec.capture(e.state)),
|
|
166
|
+
rng: Object.freeze({ ...e.rng }),
|
|
167
|
+
hash: Object.freeze({ ...e.hash })
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
snapshot() {
|
|
171
|
+
return this.publicSnapshot(this.#a);
|
|
172
|
+
}
|
|
173
|
+
snapshotAt(e) {
|
|
174
|
+
r(e);
|
|
175
|
+
let t = this.#o[this.position(e)];
|
|
176
|
+
return !t || t.tick !== e || e < this.oldestTick || e > this.tick ? k("Simulation snapshot is outside retained history") : this.publicSnapshot(t);
|
|
177
|
+
}
|
|
178
|
+
inputsAt(e) {
|
|
179
|
+
return this.work(() => {
|
|
180
|
+
r(e);
|
|
181
|
+
let t = this.#s[this.position(e)];
|
|
182
|
+
return !t || t.tick !== e || e <= this.oldestTick || e > this.tick ? k("Simulation inputs are outside retained history") : this.captureInputs(t.inputs);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
captureInputs(e) {
|
|
186
|
+
return P(this.#e, e, this.#t.maxPlayers);
|
|
187
|
+
}
|
|
188
|
+
retainedInputs(e) {
|
|
189
|
+
let t = this.#s[this.position(e)];
|
|
190
|
+
return t?.tick === e ? t.inputs : void 0;
|
|
191
|
+
}
|
|
192
|
+
transition(e, t, n) {
|
|
193
|
+
if (e.tick === 4294967295) return k("Simulation tick overflow requires an explicit new run");
|
|
194
|
+
try {
|
|
195
|
+
let r = this.#e.stateCodec.capture(e.state), i = this.rng(e.rng), a = this.#e.definition.join;
|
|
196
|
+
if (a && n) for (let o of t) n.some((e) => e.playerId === o.playerId) || (r = this.#e.stateCodec.capture(s(a(r, o.playerId, e.tick + 1, i))));
|
|
197
|
+
let o = this.#e.definition.step(r, t, e.tick + 1, i);
|
|
198
|
+
return this.prepare(e.tick + 1, o, i.snapshot());
|
|
199
|
+
} catch (t) {
|
|
200
|
+
throw this.#r = e.tick + 1, t;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
advance(e) {
|
|
204
|
+
return this.work(() => this.advanceOwned(e));
|
|
205
|
+
}
|
|
206
|
+
replaceInputs(e, t) {
|
|
207
|
+
return this.work(() => this.replaceInputsRangeOwned([{
|
|
208
|
+
tick: e,
|
|
209
|
+
inputs: t
|
|
210
|
+
}]));
|
|
211
|
+
}
|
|
212
|
+
replaceInputsRange(e) {
|
|
213
|
+
return this.work(() => this.replaceInputsRangeOwned(e));
|
|
214
|
+
}
|
|
215
|
+
installSnapshot(e, t) {
|
|
216
|
+
return this.work(() => this.installSnapshotOwned(e, t));
|
|
217
|
+
}
|
|
218
|
+
advanceOwned(e) {
|
|
219
|
+
let t = this.captureInputs(e), n = this.transition(this.#a, t, this.retainedInputs(this.#a.tick)), r = this.publicSnapshot(n), i = this.position(n.tick);
|
|
220
|
+
return this.#o[i] = n, this.#s[i] = Object.freeze({
|
|
221
|
+
tick: n.tick,
|
|
222
|
+
inputs: t
|
|
223
|
+
}), this.#a = n, r;
|
|
224
|
+
}
|
|
225
|
+
replaceInputsRangeOwned(t) {
|
|
226
|
+
if (!Array.isArray(t) || t.length < 1 || t.length > this.#t.maxReplaySteps) throw new e({
|
|
227
|
+
budget: "simulationReplaySteps",
|
|
228
|
+
limit: this.#t.maxReplaySteps
|
|
229
|
+
});
|
|
230
|
+
if (Reflect.ownKeys(t).length !== t.length + 1) return k("Simulation corrections require a dense own-data array");
|
|
231
|
+
let n = /* @__PURE__ */ new Map(), i = this.tick;
|
|
232
|
+
for (let e = 0; e < t.length; e++) {
|
|
233
|
+
let a = Object.getOwnPropertyDescriptor(t, String(e));
|
|
234
|
+
if (!a?.enumerable || !("value" in a)) return k("Simulation correction arrays cannot contain holes or accessors");
|
|
235
|
+
let s = o(a.value, ["tick", "inputs"], ["tick", "inputs"]), c = r(s.tick);
|
|
236
|
+
if (c < 1 || c <= this.oldestTick || c > this.tick) return k("Corrected input tick is outside retained rollback history");
|
|
237
|
+
if (n.has(c)) return k("Simulation correction ticks must be unique");
|
|
238
|
+
n.set(c, this.captureInputs(s.inputs)), i = Math.min(i, c);
|
|
239
|
+
}
|
|
240
|
+
let a = this.tick - i + 1;
|
|
241
|
+
if (a > this.#t.maxReplaySteps) throw new e({
|
|
242
|
+
budget: "simulationReplaySteps",
|
|
243
|
+
limit: this.#t.maxReplaySteps
|
|
244
|
+
});
|
|
245
|
+
let s = this.#o[this.position(i - 1)];
|
|
246
|
+
if (!s || s.tick !== i - 1) return k("Rollback base snapshot is unavailable");
|
|
247
|
+
let c = [], l = s, u = this.retainedInputs(i - 1);
|
|
248
|
+
for (let e = i; e <= this.tick; e++) {
|
|
249
|
+
let t = this.#s[this.position(e)];
|
|
250
|
+
if (!t || t.tick !== e) return k("Rollback input history is unavailable");
|
|
251
|
+
let r = n.get(e) ?? t.inputs;
|
|
252
|
+
l = this.transition(l, r, u), c.push({
|
|
253
|
+
snapshot: l,
|
|
254
|
+
inputs: r
|
|
255
|
+
}), u = r;
|
|
256
|
+
}
|
|
257
|
+
let d = Object.freeze({
|
|
258
|
+
fromTick: i,
|
|
259
|
+
steps: a,
|
|
260
|
+
snapshot: this.publicSnapshot(l)
|
|
261
|
+
});
|
|
262
|
+
for (let e of c) {
|
|
263
|
+
let t = this.position(e.snapshot.tick);
|
|
264
|
+
this.#o[t] = e.snapshot, this.#s[t] = Object.freeze({
|
|
265
|
+
tick: e.snapshot.tick,
|
|
266
|
+
inputs: e.inputs
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
return this.#a = l, d;
|
|
270
|
+
}
|
|
271
|
+
installSnapshotOwned(e, t) {
|
|
272
|
+
let n = N(this.#e, e, this.#t.maxRejectionAttempts), r = n.tick, i = t === void 0 ? void 0 : this.captureInputs(t), a = this.publicSnapshot(n), o = Array(this.#o.length);
|
|
273
|
+
o[this.position(r)] = n;
|
|
274
|
+
let s = Array(this.#s.length);
|
|
275
|
+
return i && (s[this.position(r)] = Object.freeze({
|
|
276
|
+
tick: r,
|
|
277
|
+
inputs: i
|
|
278
|
+
})), this.#o = o, this.#s = s, this.#a = n, this.#i = r, a;
|
|
279
|
+
}
|
|
280
|
+
}, L = (e, t, n, r = {}) => new I(e, t, n, r);
|
|
281
|
+
export { p as SimulationInputHistoryCodec, d as SimulationOptionsCodec, w as SimulationRecoveryCodec, I as SimulationRunner, x as SimulationSnapshotCodec, O as assertCapturedSimulation, P as captureSimulationInputs, N as captureSimulationSnapshot, h as compareSimulationConformanceTraces, g as createSimulationConformanceCase, m as createSimulationInputHistoryCodec, f as createSimulationOptionsCodec, T as createSimulationRecoveryCodec, L as createSimulationRunner, S as createSimulationSnapshotCodec, c as createSimulationState, _ as decodeSimulationConformanceCase, A as defineSimulation, v as encodeSimulationConformanceCase, E as nonAuthoritative, M as prepareSimulationSnapshot, y as runSimulationConformanceTrace, l as schemaSimulationHash, b as simulationConformance, C as verifySimulationReplay };
|