@voltro/plugin-rooms 0.0.0-stage → 0.87.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 +24329 -0
- package/LICENSE +61 -0
- package/README.md +9204 -2
- package/SECURITY.md +56 -0
- package/THIRD-PARTY-NOTICES.md +11322 -0
- package/dist/actor.js +1474 -0
- package/dist/apiBinding.js +678 -0
- package/dist/apiRegistryBinding.js +399 -0
- package/dist/apiReservations.js +433 -0
- package/dist/baselines.js +73 -0
- package/dist/bots.d.ts +1485 -0
- package/dist/bots.js +563 -0
- package/dist/catalog.js +80 -0
- package/dist/checkpointJson.js +24 -0
- package/dist/checkpointStore.js +386 -0
- package/dist/client.js +56 -0
- package/dist/clockSync.js +51 -0
- package/dist/collision.js +156 -0
- package/dist/commandDelivery.js +101 -0
- package/dist/commandRecord.js +11 -0
- package/dist/commandWithdrawal.js +183 -0
- package/dist/connection.js +497 -0
- package/dist/controlCarrier.js +375 -0
- package/dist/controlRegistry.js +79 -0
- package/dist/controlTarget.js +45 -0
- package/dist/controlTransport.js +574 -0
- package/dist/developmentBinding.js +113 -0
- package/dist/directory.js +323 -0
- package/dist/directoryProjection.js +117 -0
- package/dist/errors.d.ts +125 -0
- package/dist/errors.js +53 -0
- package/dist/fixed.d.ts +284 -0
- package/dist/fixed.js +10 -0
- package/dist/fixed32.js +134 -0
- package/dist/fixedCollision.js +60 -0
- package/dist/fixedCollision32.js +109 -0
- package/dist/fixedMath.js +56 -0
- package/dist/fixedRaw.js +11 -0
- package/dist/fixedSlabs.js +34 -0
- package/dist/fixedTrig.js +48 -0
- package/dist/fixedTrig32.js +38 -0
- package/dist/fixedVectors.js +113 -0
- package/dist/fixedVectors32.js +95 -0
- package/dist/fixedWide.js +50 -0
- package/dist/fixedWords.js +46 -0
- package/dist/gateway.js +57 -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 +82 -0
- package/dist/geometryActorInventory.js +108 -0
- package/dist/geometryAdminClient.js +87 -0
- package/dist/geometryAdminData.js +32 -0
- package/dist/geometryAdminFixtures.js +50 -0
- package/dist/geometryAdminPorts.js +5 -0
- package/dist/geometryAdminRpc.js +58 -0
- package/dist/geometryAdminRpcRoutes.js +49 -0
- package/dist/geometryAdminSchemas.js +39 -0
- package/dist/geometryAdministration.js +190 -0
- package/dist/geometryAdministrationPorts.js +5 -0
- package/dist/geometryApiBinding.js +165 -0
- package/dist/geometryAppStorage.js +58 -0
- package/dist/geometryArtifacts.js +198 -0
- package/dist/geometryAssetBundle.js +117 -0
- package/dist/geometryAssetClient.js +25 -0
- package/dist/geometryAssetData.js +106 -0
- package/dist/geometryAssetHttp.js +123 -0
- package/dist/geometryAssetPorts.js +5 -0
- package/dist/geometryAssetRpc.js +30 -0
- package/dist/geometryAssetRpcRoutes.js +40 -0
- package/dist/geometryAssetStorageGrant.js +103 -0
- package/dist/geometryBoxOverlap.js +110 -0
- package/dist/geometryCatalogueDigest.js +111 -0
- package/dist/geometryCellCoverage.js +85 -0
- package/dist/geometryCellLoader.js +28 -0
- package/dist/geometryChannel.js +134 -0
- package/dist/geometryChunkHttp.js +54 -0
- package/dist/geometryChunkLeases.js +22 -0
- package/dist/geometryClient.d.ts +1429 -0
- package/dist/geometryClient.js +149 -0
- package/dist/geometryClientChunks.js +330 -0
- package/dist/geometryClientDelta.js +25 -0
- package/dist/geometryClientHttp.js +37 -0
- package/dist/geometryClientInterest.js +109 -0
- package/dist/geometryClientStatic.js +34 -0
- package/dist/geometryCms.d.ts +763 -0
- package/dist/geometryCms.js +217 -0
- package/dist/geometryCommitCoordinator.js +241 -0
- package/dist/geometryCompactionFixture.js +84 -0
- package/dist/geometryCompactionStrategies.js +38 -0
- package/dist/geometryConnectionClient.js +23 -0
- package/dist/geometryDerivationFixtures.js +141 -0
- package/dist/geometryDerivationStrategies.js +27 -0
- package/dist/geometryDigest.js +13 -0
- package/dist/geometryEditChannel.js +70 -0
- package/dist/geometryEditIngress.js +263 -0
- package/dist/geometryEdits.js +366 -0
- package/dist/geometryEnvelope.js +41 -0
- package/dist/geometryGridRaycast.js +92 -0
- package/dist/geometryGridSweep.js +92 -0
- package/dist/geometryHeightfield.js +166 -0
- package/dist/geometryHeightfieldRaycast.js +74 -0
- package/dist/geometryHeightfieldSweep.js +85 -0
- package/dist/geometryHeightfieldVolume.js +45 -0
- package/dist/geometryHost.js +322 -0
- package/dist/geometryHostDirectory.js +207 -0
- package/dist/geometryHostMutations.js +137 -0
- package/dist/geometryHostStreams.js +124 -0
- package/dist/geometryHttpBody.js +76 -0
- package/dist/geometryHttpRoutes.js +112 -0
- package/dist/geometryImportGltf.js +300 -0
- package/dist/geometryImportLdtk.js +54 -0
- package/dist/geometryImportPng.js +144 -0
- package/dist/geometryImportPublication.js +67 -0
- package/dist/geometryImportTiled.js +39 -0
- package/dist/geometryImportTiles.js +136 -0
- package/dist/geometryImportVox.js +130 -0
- package/dist/geometryImportedSource.js +101 -0
- package/dist/geometryInspectEndpoint.js +248 -0
- package/dist/geometryInspection.js +92 -0
- package/dist/geometryInstall.js +121 -0
- package/dist/geometryJournalArchiveData.js +21 -0
- package/dist/geometryJournalArchiveIndex.js +330 -0
- package/dist/geometryJournalArchiveTable.js +21 -0
- package/dist/geometryJournalCompaction.js +100 -0
- package/dist/geometryJournalPatch.js +47 -0
- package/dist/geometryJournalRetention.js +112 -0
- package/dist/geometryJournalRetentionSchemas.js +36 -0
- package/dist/geometryJournalRetentionSweep.js +112 -0
- package/dist/geometryJournalRetentionWorkflow.js +28 -0
- package/dist/geometryJournalRetentionWorkflowData.js +31 -0
- package/dist/geometryJournalStorage.js +148 -0
- package/dist/geometryLoader.js +118 -0
- package/dist/geometryManifest.js +113 -0
- package/dist/geometryManifestChannel.js +93 -0
- package/dist/geometryManifestClient.js +122 -0
- package/dist/geometryManifestData.js +49 -0
- package/dist/geometryManifestPorts.js +5 -0
- package/dist/geometryManifestPublication.js +109 -0
- package/dist/geometryManifestSource.js +68 -0
- package/dist/geometryMigrationJournal.js +14 -0
- package/dist/geometryMigrationStrategies.js +7 -0
- package/dist/geometryMigrations.js +323 -0
- package/dist/geometryNativeMetadata.js +52 -0
- package/dist/geometryPatch.js +170 -0
- package/dist/geometryPersistence.js +449 -0
- package/dist/geometryPersistenceCapture.js +69 -0
- package/dist/geometryPersistenceData.js +140 -0
- package/dist/geometryPersistencePorts.js +5 -0
- package/dist/geometryPlayerAdmission.js +34 -0
- package/dist/geometryPlayerEditOwner.js +265 -0
- package/dist/geometryPlayerEdits.js +49 -0
- package/dist/geometryPrepared.js +188 -0
- package/dist/geometryPrivacyFence.js +24 -0
- package/dist/geometryProceduralPublication.js +91 -0
- package/dist/geometryProceduralWorker.js +164 -0
- package/dist/geometryPublication.js +110 -0
- package/dist/geometryRayAlgebra.js +116 -0
- package/dist/geometryReadClient.js +157 -0
- package/dist/geometryReadPorts.js +5 -0
- package/dist/geometryReadRpc.js +27 -0
- package/dist/geometryReadRpcRoutes.js +47 -0
- package/dist/geometryReliablePublication.js +82 -0
- package/dist/geometryReloadPorts.js +46 -0
- package/dist/geometryReloadSource.js +278 -0
- package/dist/geometryRenderCache.js +165 -0
- package/dist/geometryRenderLod.js +102 -0
- package/dist/geometryRollback.js +125 -0
- package/dist/geometryRollbackCoordinator.js +203 -0
- package/dist/geometryRollbackPorts.js +46 -0
- package/dist/geometryRollbackSource.js +209 -0
- package/dist/geometryRollbackStore.js +198 -0
- package/dist/geometrySchemas.js +27 -0
- package/dist/geometryServer.d.ts +2766 -0
- package/dist/geometryServer.js +62 -0
- package/dist/geometryShapeRaycast.js +111 -0
- package/dist/geometryShapeSegments.js +34 -0
- package/dist/geometryShapes.js +223 -0
- package/dist/geometrySnapshot.js +76 -0
- package/dist/geometrySnapshotChannel.js +160 -0
- package/dist/geometrySnapshotClient.js +159 -0
- package/dist/geometrySnapshotPreparation.js +76 -0
- package/dist/geometrySnapshotServer.js +191 -0
- package/dist/geometrySqlOwner.js +21 -0
- package/dist/geometryStorage.js +127 -0
- package/dist/geometryStorageGrant.js +69 -0
- package/dist/geometryStorageIdentity.js +9 -0
- package/dist/geometryTileArtifact.js +10 -0
- package/dist/geometryTileCodec.js +194 -0
- package/dist/geometryTileCollision.js +96 -0
- package/dist/geometryTileNavigation.js +128 -0
- package/dist/geometryTileView.js +35 -0
- package/dist/geometryVersionActivation.js +114 -0
- package/dist/geometryVersionClient.js +238 -0
- package/dist/geometryVersionCompare.js +40 -0
- package/dist/geometryVersionMigration.js +106 -0
- package/dist/geometryVoxel.js +253 -0
- package/dist/geometryWorldEntitySubject.js +32 -0
- package/dist/geometryWorldExtent.js +12 -0
- package/dist/geometryWorldMetadata.js +38 -0
- package/dist/geometryWorldStrategyFixtures.js +127 -0
- package/dist/geometryWorldView.js +307 -0
- package/dist/host.js +128 -0
- package/dist/hostBinding.js +277 -0
- package/dist/hostCellObservation.js +114 -0
- package/dist/hostClientCapacity.js +90 -0
- package/dist/hostCommandScope.js +64 -0
- package/dist/hostController.js +3094 -0
- package/dist/hostDeployment.js +65 -0
- package/dist/hostDrain.js +152 -0
- package/dist/hostDrainPorts.js +5 -0
- package/dist/hostDriver.js +179 -0
- package/dist/hostLane.js +288 -0
- package/dist/hostListener.js +79 -0
- package/dist/hostListenerBinding.js +19 -0
- package/dist/hostLoopObservation.js +90 -0
- package/dist/hostMetrics.js +56 -0
- package/dist/hostRegistryBinding.js +418 -0
- package/dist/hostSelection.js +16 -0
- package/dist/hostShutdown.js +47 -0
- package/dist/hostTurnObservation.js +53 -0
- package/dist/identities.js +4 -0
- package/dist/index.d.ts +8632 -0
- package/dist/index.js +232 -0
- package/dist/inputReceipts.js +63 -0
- package/dist/inputRedundancy.js +55 -0
- package/dist/inspect.js +238 -0
- package/dist/lockstep.d.ts +436 -0
- package/dist/lockstep.js +382 -0
- package/dist/lockstepAdmission.js +262 -0
- package/dist/lockstepAdmissionCodec.js +94 -0
- package/dist/lockstepAdmissionPorts.js +5 -0
- package/dist/lockstepClientSession.js +578 -0
- package/dist/lockstepDefinition.js +148 -0
- package/dist/lockstepHostLoop.js +243 -0
- package/dist/lockstepInitialAdmission.js +67 -0
- package/dist/lockstepInitialStrategyFixtures.js +45 -0
- package/dist/lockstepJournal.js +395 -0
- package/dist/lockstepJournalCodec.js +254 -0
- package/dist/lockstepJournalPorts.js +5 -0
- package/dist/lockstepJournalRebuild.js +208 -0
- package/dist/lockstepJournalRows.js +57 -0
- package/dist/lockstepMembers.js +131 -0
- package/dist/lockstepMessages.js +47 -0
- package/dist/lockstepOwnedRoom.js +764 -0
- package/dist/lockstepPolicies.js +84 -0
- package/dist/lockstepReact.js +47 -0
- package/dist/lockstepRecoveryTruth.js +121 -0
- package/dist/lockstepRosterConfig.js +32 -0
- package/dist/lockstepSeed.js +12 -0
- package/dist/lockstepSeedFixture.js +20 -0
- package/dist/lockstepServer.d.ts +3897 -0
- package/dist/lockstepServer.js +325 -0
- package/dist/lockstepServerConfig.js +101 -0
- package/dist/lockstepServerRoles.js +403 -0
- package/dist/lockstepServerStrategyFixtures.js +33 -0
- package/dist/lockstepStrategies.js +6 -0
- package/dist/lockstepStrategyFixtures.js +137 -0
- package/dist/lockstepTerminal.js +90 -0
- package/dist/lockstepTerminalPorts.js +5 -0
- package/dist/lockstepTransport.js +773 -0
- package/dist/lockstepTransportConfig.js +32 -0
- package/dist/lockstepWireRoster.js +34 -0
- package/dist/matchRoomProvider.js +32 -0
- package/dist/matchRooms.js +19 -0
- package/dist/membershipObserver.js +47 -0
- package/dist/moderation.js +98 -0
- package/dist/movementSpecials.js +104 -0
- package/dist/ownership.js +17 -0
- package/dist/ownershipWithdrawal.js +18 -0
- package/dist/pcg32.js +96 -0
- package/dist/ports.d.ts +1241 -0
- package/dist/ports.js +11 -0
- package/dist/quaternion.js +70 -0
- package/dist/react.d.ts +406 -0
- package/dist/react.js +109 -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 +243 -0
- package/dist/reaperSchemas.js +42 -0
- package/dist/reaperWorkflow.js +70 -0
- package/dist/recovery.js +189 -0
- package/dist/recoverySeats.js +26 -0
- package/dist/replay.d.ts +273 -0
- package/dist/replay.js +485 -0
- package/dist/replayPorts.js +5 -0
- package/dist/replayRecording.js +67 -0
- package/dist/replaySchema.js +157 -0
- package/dist/replayStorage.d.ts +149 -0
- package/dist/replayStorage.js +485 -0
- package/dist/reservationBatch.js +422 -0
- package/dist/reservationSchemas.js +17 -0
- package/dist/reservations.js +259 -0
- package/dist/reservePort.js +69 -0
- package/dist/resolvedOptions.js +4 -0
- package/dist/room.d.ts +1006 -0
- package/dist/room.js +284 -0
- package/dist/roomAccessSweep.js +95 -0
- package/dist/roomAppCommandControl.js +59 -0
- package/dist/roomAuthoringStrategy.js +17 -0
- package/dist/roomErasure.js +198 -0
- package/dist/roomPoolRuntimeDefaults.js +24 -0
- package/dist/roomPoolSelection.js +19 -0
- package/dist/roomPoolTopology.js +212 -0
- package/dist/rpc.d.ts +551 -0
- package/dist/rpc.js +112 -0
- package/dist/rpcClient.js +152 -0
- package/dist/rpcRoutes.js +28 -0
- package/dist/runtime.js +1123 -0
- package/dist/schemaHistory.js +98 -0
- package/dist/seatStore.js +151 -0
- package/dist/seatStrategyFixtures.js +52 -0
- package/dist/seatSubject.js +32 -0
- package/dist/seats.js +130 -0
- package/dist/serverSession.js +811 -0
- package/dist/serverSessionConfig.js +43 -0
- package/dist/sessionAdmission.js +53 -0
- package/dist/sidecarAdmission.js +103 -0
- package/dist/sidecarConfig.js +116 -0
- package/dist/sidecarConfigPublication.js +64 -0
- package/dist/sidecarHostListener.js +208 -0
- package/dist/sidecarIpc.js +205 -0
- package/dist/sidecarPeer.js +310 -0
- package/dist/sidecarProcessPort.js +28 -0
- package/dist/sidecarRuntime.js +168 -0
- package/dist/sidecarSelection.js +142 -0
- package/dist/sidecarWire.js +178 -0
- package/dist/sidecarWrites.js +163 -0
- package/dist/simulation.d.ts +391 -0
- package/dist/simulation.js +282 -0
- package/dist/simulationAuthoring.js +29 -0
- package/dist/simulationBytes.js +27 -0
- package/dist/simulationConformance.js +305 -0
- package/dist/simulationInputHistoryCapture.js +35 -0
- package/dist/simulationInputHistoryWire.js +193 -0
- package/dist/simulationOptionsWire.js +78 -0
- package/dist/simulationRecoveryWire.js +134 -0
- package/dist/simulationReplay.js +127 -0
- package/dist/simulationSnapshotWire.js +112 -0
- package/dist/simulationState.js +178 -0
- package/dist/snapshotBlob.js +126 -0
- package/dist/snapshotBlobCleanup.js +93 -0
- package/dist/snapshotBlobIndex.js +38 -0
- package/dist/snapshotBudget.js +80 -0
- package/dist/snapshotChain.js +185 -0
- package/dist/snapshotErasure.js +172 -0
- package/dist/snapshotInspection.js +105 -0
- package/dist/snapshotSegmentBlobs.js +58 -0
- package/dist/snapshotUploads.js +166 -0
- package/dist/socketTransport.js +253 -0
- package/dist/spatial.js +104 -0
- package/dist/spectatorPolicy.js +26 -0
- package/dist/spectatorProducer.js +89 -0
- package/dist/startFailureCause.js +4 -0
- package/dist/stateCodec.js +658 -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 +182 -0
- package/dist/streamFraming.js +122 -0
- package/dist/streamTransport.js +266 -0
- package/dist/subjectAdmission.js +50 -0
- package/dist/subjectPrivacy.js +281 -0
- package/dist/subjectPrivacyBinding.js +90 -0
- package/dist/systemManifest.js +182 -0
- package/dist/tables.js +159 -0
- package/dist/testHarness.js +89 -0
- package/dist/testing.d.ts +3684 -0
- package/dist/testing.js +221 -0
- package/dist/testingPorts.js +271 -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 +217 -0
- package/dist/transform3d.js +118 -0
- package/dist/transformCollection.js +24 -0
- package/dist/transformCollection3d.js +24 -0
- package/dist/transformCollectionCore.js +156 -0
- package/dist/transformFrames.js +121 -0
- package/dist/transformPrediction3d.js +127 -0
- package/dist/transformRules.js +123 -0
- package/dist/transformSchemas.js +20 -0
- package/dist/transport.js +32 -0
- package/dist/transportAuthoring.js +29 -0
- package/dist/transportCleanup.js +22 -0
- package/dist/transportConformance.js +124 -0
- package/dist/transportConnector.js +82 -0
- package/dist/transportEndpoints.js +38 -0
- package/dist/transportsServer.d.ts +5515 -0
- package/dist/transportsServer.js +6 -0
- package/dist/viewProjection.js +16 -0
- package/dist/web.d.ts +2286 -0
- package/dist/web.js +518 -0
- package/dist/webTransportClient.js +173 -0
- package/dist/wire.d.ts +992 -0
- package/dist/wire.js +492 -0
- package/dist/withdrawalPort.js +28 -0
- package/dist/world.d.ts +1894 -0
- package/dist/world.js +333 -0
- package/dist/worldActorReceipts.js +48 -0
- package/dist/worldActorTransferSnapshot.js +14 -0
- package/dist/worldAdmissionPending.js +8 -0
- package/dist/worldBoundaryCoordinator.js +148 -0
- package/dist/worldCatalog.js +81 -0
- package/dist/worldCellAllocation.js +203 -0
- package/dist/worldCellDestination.js +68 -0
- package/dist/worldCells.js +489 -0
- package/dist/worldChange.js +32 -0
- package/dist/worldClient.js +664 -0
- package/dist/worldClientControl.js +141 -0
- package/dist/worldClientPendingInput.js +16 -0
- package/dist/worldClientRpc.js +133 -0
- package/dist/worldClientRpcRoutes.js +43 -0
- package/dist/worldClientSchemas.js +28 -0
- package/dist/worldCommands.js +140 -0
- package/dist/worldData.js +42 -0
- package/dist/worldDefaultBinding.js +377 -0
- package/dist/worldDefaultGroupAdmission.js +82 -0
- package/dist/worldDefaultGroupAppServices.js +31 -0
- package/dist/worldDefaultGroupCompensation.js +109 -0
- package/dist/worldDefaultGroupContinuation.js +96 -0
- package/dist/worldDefaultGroupControl.js +72 -0
- package/dist/worldDefaultGroupMembers.js +85 -0
- package/dist/worldDefaultGroups.js +21 -0
- package/dist/worldDefaultPending.js +79 -0
- package/dist/worldDefaultService.js +245 -0
- package/dist/worldEntities.js +2980 -0
- package/dist/worldEntityCodec.js +21 -0
- package/dist/worldEntityHandoffView.js +154 -0
- package/dist/worldGeometry.js +170 -0
- package/dist/worldGhostAdmission.js +65 -0
- package/dist/worldGhostDestination.js +118 -0
- package/dist/worldGhostGateway.js +132 -0
- package/dist/worldGhostHandshake.js +108 -0
- package/dist/worldGhostHost.js +42 -0
- package/dist/worldGhostIngress.js +132 -0
- package/dist/worldGhostNeighborhood.js +70 -0
- package/dist/worldGhostNeighbors.js +86 -0
- package/dist/worldGhostOutbound.js +110 -0
- package/dist/worldGhostPublisher.js +216 -0
- package/dist/worldGhostReceiver.js +213 -0
- package/dist/worldGhostSender.js +146 -0
- package/dist/worldGhostSocket.js +78 -0
- package/dist/worldGhostWire.js +172 -0
- package/dist/worldGroupCommand.js +49 -0
- package/dist/worldGroupDeadline.js +115 -0
- package/dist/worldGroupPreparation.js +115 -0
- package/dist/worldGroupReadyControl.js +128 -0
- package/dist/worldGroupSupervisor.js +120 -0
- package/dist/worldHandoffMetrics.js +59 -0
- package/dist/worldHandoffView.js +100 -0
- package/dist/worldHostSource.js +69 -0
- package/dist/worldInspectEndpoint.js +250 -0
- package/dist/worldInspection.js +109 -0
- package/dist/worldInstanceAdmission.js +31 -0
- package/dist/worldInstanceAllocation.js +116 -0
- package/dist/worldInstanceDestination.js +64 -0
- package/dist/worldInstanceExpiry.js +282 -0
- package/dist/worldInstanceExpirySupervisor.js +88 -0
- package/dist/worldInstanceLifecycle.js +103 -0
- package/dist/worldInstanceState.js +52 -0
- package/dist/worldInstances.js +478 -0
- package/dist/worldJoin.js +56 -0
- package/dist/worldLayers.js +151 -0
- package/dist/worldLeases.js +78 -0
- package/dist/worldManifest.js +25 -0
- package/dist/worldMovement.js +63 -0
- package/dist/worldPersistence.js +134 -0
- package/dist/worldProjection.js +221 -0
- package/dist/worldReact.js +110 -0
- package/dist/worldRecoveryActor.js +35 -0
- package/dist/worldReturnAnchor.js +49 -0
- package/dist/worldRoomHooks.js +57 -0
- package/dist/worldRoomPool.js +27 -0
- package/dist/worldRoomSteps.js +133 -0
- package/dist/worldSeatBinding.js +36 -0
- package/dist/worldServer.d.ts +6936 -0
- package/dist/worldServer.js +48 -0
- package/dist/worldSourceSeatPending.js +9 -0
- package/dist/worldStrategyFixtures.js +164 -0
- package/dist/worldTesting.js +27 -0
- package/dist/worldTransitionDefaults.js +198 -0
- package/dist/worldTransitionExecutor.js +519 -0
- package/dist/worldTransitionGroup.js +113 -0
- package/dist/worldTransitionPhysicalSteps.js +40 -0
- package/dist/worldTransitionResolver.js +228 -0
- package/dist/worldTransitionSeatGroup.js +64 -0
- package/dist/worldTransitionSeats.js +260 -0
- package/dist/worldTransitionState.js +95 -0
- package/dist/worldTransitions.js +101 -0
- package/package.json +189 -4
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { Effect as t, Option as n } from "effect";
|
|
3
|
+
import { randomUUID as r } from "node:crypto";
|
|
4
|
+
import { HotError as i } from "@voltro/kv/hot/contract";
|
|
5
|
+
//#region src/worldLeases.ts
|
|
6
|
+
var a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakSet(), s = (e) => a.get(e), c = (e) => typeof e == "object" && !!e && o.has(e);
|
|
7
|
+
function l() {
|
|
8
|
+
throw new e({ detail: "Invalid World transition lease admission" });
|
|
9
|
+
}
|
|
10
|
+
var u = (e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(e) ? e : l(), d = (e) => {
|
|
11
|
+
(!e || Object.getPrototypeOf(e) !== Object.prototype) && l();
|
|
12
|
+
for (let t of Reflect.ownKeys(e)) {
|
|
13
|
+
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
14
|
+
(typeof t != "string" || ![
|
|
15
|
+
"namespace",
|
|
16
|
+
"tenantId",
|
|
17
|
+
"ttlMs"
|
|
18
|
+
].includes(t) || !n?.enumerable || !("value" in n)) && l();
|
|
19
|
+
}
|
|
20
|
+
let t = e.namespace, n = u(e.tenantId), r = e.ttlMs;
|
|
21
|
+
return (typeof t != "string" || !/^[A-Za-z0-9][A-Za-z0-9:_-]{0,95}$/.test(t) || !Number.isSafeInteger(r) || r <= 0) && l(), Object.freeze({
|
|
22
|
+
namespace: t,
|
|
23
|
+
tenantId: n,
|
|
24
|
+
ttlMs: r
|
|
25
|
+
});
|
|
26
|
+
}, f = (s, c) => {
|
|
27
|
+
let { namespace: f, tenantId: p, ttlMs: m } = d(c);
|
|
28
|
+
(typeof s.setNx != "function" || typeof s.compareDelete != "function" || typeof s.compareExpire != "function") && l();
|
|
29
|
+
let h = s.setNx.bind(s), g = s.compareDelete.bind(s), _ = s.compareExpire.bind(s), v = (n) => t.suspend(() => {
|
|
30
|
+
let r;
|
|
31
|
+
try {
|
|
32
|
+
r = n();
|
|
33
|
+
} catch {
|
|
34
|
+
return t.fail(new e({ detail: "World transition lease provider refused admission" }));
|
|
35
|
+
}
|
|
36
|
+
return t.isEffect(r) ? r.pipe(t.mapError((e) => new i({
|
|
37
|
+
operation: e.operation,
|
|
38
|
+
key: "worldTransitionLease",
|
|
39
|
+
reason: e.reason
|
|
40
|
+
})), t.flatMap((n) => typeof n == "boolean" ? t.succeed(n) : t.fail(new e({ detail: "Invalid World transition lease result" })))) : t.fail(new e({ detail: "World transition lease provider must return an Effect" }));
|
|
41
|
+
}), y = (e) => `${f}:wt:${Buffer.from(JSON.stringify([p, u(e)]), "utf8").toString("base64url")}`;
|
|
42
|
+
return Object.freeze({
|
|
43
|
+
tenantId: p,
|
|
44
|
+
acquire: (e) => {
|
|
45
|
+
let i = y(e);
|
|
46
|
+
return t.suspend(() => {
|
|
47
|
+
let e = r();
|
|
48
|
+
return v(() => h(i, e, m)).pipe(t.map((t) => {
|
|
49
|
+
if (!t) return n.none();
|
|
50
|
+
let r = Object.freeze({
|
|
51
|
+
renew: () => v(() => _(i, e, m)),
|
|
52
|
+
release: () => v(() => g(i, e))
|
|
53
|
+
});
|
|
54
|
+
return a.set(r, e), n.some(r);
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
verify: (r, i) => t.suspend(() => {
|
|
59
|
+
let a;
|
|
60
|
+
try {
|
|
61
|
+
a = y(r), (typeof i != "string" || !/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(i)) && l();
|
|
62
|
+
} catch {
|
|
63
|
+
return t.fail(new e({ detail: "Invalid World transition lease admission" }));
|
|
64
|
+
}
|
|
65
|
+
return v(() => _(a, i, m)).pipe(t.map((e) => {
|
|
66
|
+
if (!e) return n.none();
|
|
67
|
+
let t = Object.freeze({ renew: () => v(() => _(a, i, m)) });
|
|
68
|
+
return o.add(t), n.some(t);
|
|
69
|
+
}));
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
}, p = async (t, n) => {
|
|
73
|
+
let r = d(n);
|
|
74
|
+
if (!t.connectionRegistry || typeof t.hotStore != "function") throw new e({ detail: "World transition leases require the app-owned registry and tenant HotStore" });
|
|
75
|
+
return f(await t.hotStore.bind(t)({ tenantId: r.tenantId }), r);
|
|
76
|
+
};
|
|
77
|
+
//#endregion
|
|
78
|
+
export { p as bindWorldTransitionLeases, c as isVerifiedWorldTransitionLease, f as makeWorldTransitionLeases, s as worldTransitionLeaseToken };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/worldManifest.ts
|
|
2
|
+
var e = Object.freeze({
|
|
3
|
+
slots: Object.freeze({
|
|
4
|
+
onWorldChange: Object.freeze({
|
|
5
|
+
defaultExport: "defaultWorldOnWorldChange",
|
|
6
|
+
fixtureExport: "worldOnWorldChangeSlotFixture"
|
|
7
|
+
}),
|
|
8
|
+
layerPolicy: Object.freeze({
|
|
9
|
+
defaultExport: "defaultWorldLayerPolicy",
|
|
10
|
+
fixtureExport: "worldLayerPolicySlotFixture"
|
|
11
|
+
}),
|
|
12
|
+
transitionPolicy: Object.freeze({
|
|
13
|
+
defaultExport: "defaultWorldTransitionPolicy",
|
|
14
|
+
fixtureExport: "worldTransitionPolicySlotFixture"
|
|
15
|
+
})
|
|
16
|
+
}),
|
|
17
|
+
ports: Object.freeze({ transition: Object.freeze({
|
|
18
|
+
tagExport: "WorldTransitionPort",
|
|
19
|
+
fakeLayerExport: "worldTransitionFakeLayer",
|
|
20
|
+
fixtureExport: "worldTransitionPortFixture"
|
|
21
|
+
}) }),
|
|
22
|
+
events: Object.freeze([])
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { e as worldSystemContractManifest };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { captureWorldData as t } from "./worldData.js";
|
|
3
|
+
//#region src/worldMovement.ts
|
|
4
|
+
function n() {
|
|
5
|
+
throw new e({ detail: "World movement requires finite positions in its acquired source cell" });
|
|
6
|
+
}
|
|
7
|
+
var r = (e) => {
|
|
8
|
+
let r = t(e, 128);
|
|
9
|
+
return !Array.isArray(r) || r.length !== 2 || !r.every(Number.isFinite) ? n() : r;
|
|
10
|
+
}, i = (e) => {
|
|
11
|
+
if (e === 0) return -Number.MIN_VALUE;
|
|
12
|
+
let t = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(8));
|
|
13
|
+
return t.setFloat64(0, e), t.setBigUint64(0, t.getBigUint64(0) + (e > 0 ? -1n : 1n)), t.getFloat64(0);
|
|
14
|
+
}, a = (e) => {
|
|
15
|
+
let a = t(e, 256);
|
|
16
|
+
if (!Array.isArray(a) || a.length !== 2) return n();
|
|
17
|
+
let o = r(a[0]), s = r(a[1]), c = Object.freeze([i(s[0]), i(s[1])]);
|
|
18
|
+
if (o[0] >= s[0] || o[1] >= s[1] || c[0] < o[0] || c[1] < o[1]) return n();
|
|
19
|
+
let l = (e) => e[0] >= o[0] && e[0] < s[0] && e[1] >= o[1] && e[1] < s[1], u = (e, t) => {
|
|
20
|
+
let i = r(e), a = r(t);
|
|
21
|
+
if (!l(i)) return n();
|
|
22
|
+
if (l(a)) return Object.freeze({
|
|
23
|
+
at: a,
|
|
24
|
+
clamped: !1
|
|
25
|
+
});
|
|
26
|
+
let u = 1;
|
|
27
|
+
for (let e of [0, 1]) {
|
|
28
|
+
let t = a[e] - i[e];
|
|
29
|
+
if (!Number.isFinite(t)) return n();
|
|
30
|
+
t > 0 && a[e] >= s[e] && (u = Math.min(u, (c[e] - i[e]) / t)), t < 0 && a[e] < o[e] && (u = Math.min(u, (o[e] - i[e]) / t));
|
|
31
|
+
}
|
|
32
|
+
let d = Object.freeze([0, 1].map((e) => Math.max(o[e], Math.min(c[e], i[e] + (a[e] - i[e]) * u))));
|
|
33
|
+
return l(d) ? Object.freeze({
|
|
34
|
+
at: d,
|
|
35
|
+
clamped: !0
|
|
36
|
+
}) : n();
|
|
37
|
+
};
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
bounds: a,
|
|
40
|
+
approach: (e, t, a) => {
|
|
41
|
+
let d = r(e), f = r(t);
|
|
42
|
+
if (!l(d) || !Number.isFinite(a) || a < 0) return n();
|
|
43
|
+
let p, m = Infinity;
|
|
44
|
+
for (let e of [0, 1]) {
|
|
45
|
+
let t = f[e] - d[e];
|
|
46
|
+
if (!Number.isFinite(t)) return n();
|
|
47
|
+
if (t === 0) continue;
|
|
48
|
+
let r = t > 0 ? s[e] - f[e] : f[e] - o[e], i = ((t > 0 ? s[e] : o[e]) - d[e]) / t;
|
|
49
|
+
r <= a && i < m && (p = e, m = i);
|
|
50
|
+
}
|
|
51
|
+
if (p === void 0) return null;
|
|
52
|
+
let h = p, g = +(h === 0), _ = f[h] > d[h], v = _ ? f[h] >= s[h] : f[h] < o[h], y = [0, 0];
|
|
53
|
+
return y[h] = _ ? s[h] : i(o[h]), y[g] = Math.max(o[g], Math.min(c[g], d[g] + (f[g] - d[g]) * m)), y.every(Number.isFinite) ? Object.freeze({
|
|
54
|
+
sourceAt: u(d, f).at,
|
|
55
|
+
targetAt: Object.freeze(y),
|
|
56
|
+
crossing: v
|
|
57
|
+
}) : n();
|
|
58
|
+
},
|
|
59
|
+
constrain: u
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
//#endregion
|
|
63
|
+
export { a as makeWorldCellMovement };
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
|
|
2
|
+
import { Effect as n } from "effect";
|
|
3
|
+
import { randomUUID as r } from "node:crypto";
|
|
4
|
+
//#region src/worldPersistence.ts
|
|
5
|
+
function i(e) {
|
|
6
|
+
throw new t({ detail: e });
|
|
7
|
+
}
|
|
8
|
+
var a = (e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(e) ? e : i("Invalid World persistence scope"), o = (e) => typeof e == "number" && Number.isSafeInteger(e) && e > 0 && e < 2147483647 ? e : i("Invalid World persistence budget"), s = (e) => {
|
|
9
|
+
(!e || Object.getPrototypeOf(e) !== Object.prototype) && i("World persistence requires own options");
|
|
10
|
+
for (let t of Reflect.ownKeys(e)) {
|
|
11
|
+
let n = Object.getOwnPropertyDescriptor(e, t);
|
|
12
|
+
(typeof t != "string" || ![
|
|
13
|
+
"tenantId",
|
|
14
|
+
"roomId",
|
|
15
|
+
"maxEntries",
|
|
16
|
+
"maxRows",
|
|
17
|
+
"maxDelayMs",
|
|
18
|
+
"epochNow",
|
|
19
|
+
"onPersisted"
|
|
20
|
+
].includes(t) || !n?.enumerable || !("value" in n)) && i("Invalid World persistence option");
|
|
21
|
+
}
|
|
22
|
+
}, c = (e) => Array.isArray(e) ? e.map(c) : typeof e == "object" && e ? Object.fromEntries(Object.entries(e).sort(([e], [t]) => e < t ? -1 : +(e > t)).map(([e, t]) => [e, c(t)])) : e, l = (e, t) => e.tenantId === t.tenantId && e.entityId === t.entityId && e.source.worldId === t.source.worldId && e.source.zoneId === t.source.zoneId && e.source.layer === t.source.layer && e.source.roomId === t.source.roomId && e.source.epoch === t.source.epoch, u = (r) => n.suspend(() => {
|
|
23
|
+
let i;
|
|
24
|
+
try {
|
|
25
|
+
i = r();
|
|
26
|
+
} catch (r) {
|
|
27
|
+
return n.fail(r instanceof e || r instanceof t ? r : new t({ detail: "World persistence operation remains incomplete" }));
|
|
28
|
+
}
|
|
29
|
+
return n.isEffect(i) ? i : n.fail(new t({ detail: "World persistence provider requires an Effect" }));
|
|
30
|
+
}), d = (d, f) => {
|
|
31
|
+
s(f);
|
|
32
|
+
let p = a(f.tenantId), m = a(f.roomId), h = o(f.maxEntries), g = o(f.maxRows ?? 500), _ = o(f.maxDelayMs ?? 1e3), v = f.epochNow, y = f.onPersisted;
|
|
33
|
+
(g > h || g > o(d.persistenceBatchRows) || typeof v != "function" || typeof y != "function" || typeof d.capturePersistence != "function" || typeof d.persistBatchFromCommand != "function" || typeof d.observe != "function") && i("World persistence requires complete source and budgets");
|
|
34
|
+
let b = d.capturePersistence.bind(d), x = d.persistBatchFromCommand.bind(d), S = d.observe.bind(d), C = /* @__PURE__ */ new Map(), w = null, T = 0, E = !1, D = !1, O = !1, k = 0, A = () => {
|
|
35
|
+
let e = v();
|
|
36
|
+
return (!Number.isSafeInteger(e) || e < k || e < 0 || e > 864e13) && i("World persistence clock moved backwards or is invalid"), k = e, e;
|
|
37
|
+
}, j = () => {
|
|
38
|
+
let e = null;
|
|
39
|
+
for (let t of C.values()) e = e === null ? t.firstAt : Math.min(e, t.firstAt);
|
|
40
|
+
for (let t of w?.rows ?? []) e = e === null ? t.firstAt : Math.min(e, t.firstAt);
|
|
41
|
+
return e;
|
|
42
|
+
}, M = () => Object.freeze({
|
|
43
|
+
dirty: C.size,
|
|
44
|
+
pending: w?.rows.length ?? 0,
|
|
45
|
+
oldestAt: j(),
|
|
46
|
+
closing: D,
|
|
47
|
+
closed: O
|
|
48
|
+
}), N = (t) => {
|
|
49
|
+
(D || O) && i("World persistence is closing");
|
|
50
|
+
let n = b(t), r = n.input;
|
|
51
|
+
(r.tenantId !== p || r.source.roomId !== m) && i("World persistence snapshot escaped its owner");
|
|
52
|
+
let a = C.get(r.entityId), o = w?.rows.find((e) => e.input.entityId === r.entityId), s = a ?? o;
|
|
53
|
+
if (s && (!l(s.input, r) || s.cellId !== n.cellId || s.input.expectedRevision !== r.expectedRevision) && i("World persistence snapshot changed its active owner or revision"), !s && C.size >= h) throw new e({
|
|
54
|
+
budget: "worldPersistenceEntries",
|
|
55
|
+
limit: h
|
|
56
|
+
});
|
|
57
|
+
T === 2 ** 53 - 1 && i("World persistence generation exhausted"), C.set(r.entityId, Object.freeze({
|
|
58
|
+
input: r,
|
|
59
|
+
cellId: n.cellId,
|
|
60
|
+
generation: ++T,
|
|
61
|
+
firstAt: s?.firstAt ?? A()
|
|
62
|
+
}));
|
|
63
|
+
}, P = () => {
|
|
64
|
+
if (O) return !1;
|
|
65
|
+
if (w !== null || C.size >= g) return !0;
|
|
66
|
+
let e = j();
|
|
67
|
+
return e !== null && A() - e >= _;
|
|
68
|
+
}, F = (e, t) => {
|
|
69
|
+
let n = e.input;
|
|
70
|
+
(t === null || t.tenantId !== p || t.entityId !== n.entityId || t.revision !== n.expectedRevision + 1 || t.worldId !== n.source.worldId || t.zoneId !== n.source.zoneId || t.layer !== n.source.layer || t.cellId !== e.cellId || t.roomId !== m || t.epoch !== n.source.epoch || JSON.stringify(c(t.data)) !== JSON.stringify(c(n.data))) && i("World persistence confirmation lost its exact committed snapshot");
|
|
71
|
+
}, I = () => u(() => n.gen(function* () {
|
|
72
|
+
if (w === null) {
|
|
73
|
+
if (C.size === 0) return;
|
|
74
|
+
let e = [...C.values()].sort((e, t) => e.input.entityId < t.input.entityId ? -1 : +(e.input.entityId > t.input.entityId)).slice(0, g);
|
|
75
|
+
w = Object.freeze({
|
|
76
|
+
rows: Object.freeze(e),
|
|
77
|
+
origin: Object.freeze({
|
|
78
|
+
tenantId: p,
|
|
79
|
+
roomId: m,
|
|
80
|
+
requestId: `world-persist:${r()}`
|
|
81
|
+
})
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
let e = w;
|
|
85
|
+
yield* u(() => x(e.rows.map((e) => e.input), e.origin));
|
|
86
|
+
let t = [];
|
|
87
|
+
for (let n of e.rows) {
|
|
88
|
+
let e = yield* u(() => S({
|
|
89
|
+
tenantId: p,
|
|
90
|
+
entityId: n.input.entityId
|
|
91
|
+
}));
|
|
92
|
+
F(n, e), t.push(e);
|
|
93
|
+
}
|
|
94
|
+
A();
|
|
95
|
+
let n = [];
|
|
96
|
+
for (let t of e.rows) {
|
|
97
|
+
let e = C.get(t.input.entityId);
|
|
98
|
+
!e || e.generation === t.generation ? n.push([t.input.entityId, null]) : n.push([t.input.entityId, Object.freeze({
|
|
99
|
+
...e,
|
|
100
|
+
input: b({
|
|
101
|
+
...e.input,
|
|
102
|
+
expectedRevision: t.input.expectedRevision + 1
|
|
103
|
+
}).input
|
|
104
|
+
})]);
|
|
105
|
+
}
|
|
106
|
+
let a;
|
|
107
|
+
try {
|
|
108
|
+
a = y(Object.freeze(t));
|
|
109
|
+
} catch {
|
|
110
|
+
i("World persistence actor revision update remains incomplete");
|
|
111
|
+
}
|
|
112
|
+
a !== void 0 && (a instanceof Promise && a.catch(() => void 0), i("World persistence actor revision update must be synchronous"));
|
|
113
|
+
for (let [e, t] of n) t === null ? C.delete(e) : C.set(e, t);
|
|
114
|
+
w = null;
|
|
115
|
+
})), L = (e) => n.suspend(() => O ? n.void : E ? n.fail(new t({ detail: "World persistence flush is already running" })) : (E = !0, n.uninterruptible(u(e)).pipe(n.ensuring(n.sync(() => {
|
|
116
|
+
E = !1;
|
|
117
|
+
}))))), R = () => L(I);
|
|
118
|
+
return Object.freeze({
|
|
119
|
+
mark: N,
|
|
120
|
+
observation: M,
|
|
121
|
+
isDue: P,
|
|
122
|
+
flush: R,
|
|
123
|
+
runDue: () => u(() => P() ? R() : n.void),
|
|
124
|
+
close: () => L(() => n.gen(function* () {
|
|
125
|
+
D = !0;
|
|
126
|
+
let e = Math.ceil(h / g) + 1;
|
|
127
|
+
for (let t = 0; t < e && (w !== null || C.size > 0); t++) yield* I();
|
|
128
|
+
if (w !== null || C.size > 0) return yield* n.fail(new t({ detail: "World persistence shutdown retains incomplete batches" }));
|
|
129
|
+
O = !0;
|
|
130
|
+
}))
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
//#endregion
|
|
134
|
+
export { d as makeWorldPersistence };
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { BudgetExceeded as e, ProtocolError as t } from "./errors.js";
|
|
2
|
+
import { captureWorldCatalog as n, worldCellAt as r } from "./world.js";
|
|
3
|
+
import { Effect as i, Option as a } from "effect";
|
|
4
|
+
import { HotError as o, readHotStoreWithFallback as s } from "@voltro/kv/hot/contract";
|
|
5
|
+
//#region src/worldProjection.ts
|
|
6
|
+
function c(e) {
|
|
7
|
+
throw new t({ detail: e });
|
|
8
|
+
}
|
|
9
|
+
var l = (e) => typeof e == "string" && e.length > 0 && e.length <= 191 && e.trim() === e ? e : c("Invalid World projection identity"), u = (e, t = 0) => typeof e == "number" && Number.isSafeInteger(e) && e >= t ? e : c("Invalid World projection counter"), d = (e, t) => {
|
|
10
|
+
(typeof e != "object" || !e || Object.getPrototypeOf(e) !== Object.prototype) && c("World projection requires plain own data");
|
|
11
|
+
for (let n of Reflect.ownKeys(e)) {
|
|
12
|
+
let r = Object.getOwnPropertyDescriptor(e, n);
|
|
13
|
+
(typeof n != "string" || !t.includes(n) || !r?.enumerable || !("value" in r)) && c("Invalid World projection field");
|
|
14
|
+
}
|
|
15
|
+
}, f = (e) => {
|
|
16
|
+
d(e, [
|
|
17
|
+
"namespace",
|
|
18
|
+
"tenantId",
|
|
19
|
+
"world",
|
|
20
|
+
"ttlMs",
|
|
21
|
+
"maxEntries",
|
|
22
|
+
"maxPayloadBytes",
|
|
23
|
+
"onUnavailable"
|
|
24
|
+
]);
|
|
25
|
+
let t = e.namespace, r = l(e.tenantId), i = n([e.world])[0], a = u(e.ttlMs, 1), o = u(e.maxEntries, 1), s = u(e.maxPayloadBytes, 1), f = e.onUnavailable ?? "fail";
|
|
26
|
+
return (typeof t != "string" || !/^[a-zA-Z0-9][a-zA-Z0-9:_-]{0,95}$/.test(t) || o === 2 ** 53 - 1 || f !== "fail" && f !== "degrade") && c("Invalid World projection namespace, budgets or availability policy"), Object.freeze({
|
|
27
|
+
namespace: t,
|
|
28
|
+
tenantId: r,
|
|
29
|
+
world: i,
|
|
30
|
+
ttlMs: a,
|
|
31
|
+
maxEntries: o,
|
|
32
|
+
maxPayloadBytes: s,
|
|
33
|
+
onUnavailable: f
|
|
34
|
+
});
|
|
35
|
+
}, p = (e, t) => {
|
|
36
|
+
d(e, [
|
|
37
|
+
"zoneId",
|
|
38
|
+
"cellId",
|
|
39
|
+
"layer",
|
|
40
|
+
"roomId",
|
|
41
|
+
"hostId",
|
|
42
|
+
"epoch",
|
|
43
|
+
"revision",
|
|
44
|
+
"players",
|
|
45
|
+
"state"
|
|
46
|
+
]);
|
|
47
|
+
let n = (t) => Object.getOwnPropertyDescriptor(e, t)?.value, i = l(n("zoneId")), a = l(n("cellId")), o = t.zones.find((e) => e.id === i);
|
|
48
|
+
o || c("World projection refers to an unconfigured zone");
|
|
49
|
+
let s = a.split(":"), f = Number(s[1]), p = Number(s[2]);
|
|
50
|
+
(s.length !== 3 || s[0] !== i || !Number.isSafeInteger(f) || f < 0 || String(f) !== s[1] || !Number.isSafeInteger(p) || p < 0 || String(p) !== s[2]) && c("Invalid World projection cell");
|
|
51
|
+
let m = o.cells?.size ?? Math.max(o.bounds[1][0] - o.bounds[0][0], o.bounds[1][1] - o.bounds[0][1]);
|
|
52
|
+
r(t, {
|
|
53
|
+
zone: i,
|
|
54
|
+
at: [o.bounds[0][0] + f * m, o.bounds[0][1] + p * m]
|
|
55
|
+
}).id !== a && c("World projection escaped configured geometry");
|
|
56
|
+
let h = u(n("layer"), 1), g = l(n("roomId")), _ = n("hostId"), v = _ === null ? null : l(_), y = u(n("epoch"), 1), b = u(n("revision"), 1), x = u(n("players")), S = n("state");
|
|
57
|
+
return (S !== "live" && S !== "hibernated" || S === "hibernated" && (v !== null || x !== 0) || S === "live" && v === null || o.layering !== void 0 && x > o.layering.maxPlayers) && c("Contradictory World projection hint"), Object.freeze({
|
|
58
|
+
zoneId: i,
|
|
59
|
+
cellId: a,
|
|
60
|
+
layer: h,
|
|
61
|
+
roomId: g,
|
|
62
|
+
hostId: v,
|
|
63
|
+
epoch: y,
|
|
64
|
+
revision: b,
|
|
65
|
+
players: x,
|
|
66
|
+
state: S
|
|
67
|
+
});
|
|
68
|
+
}, m = (n, r, l) => {
|
|
69
|
+
let { namespace: u, tenantId: m, world: h, ttlMs: g, maxEntries: _, maxPayloadBytes: v, onUnavailable: y } = f(l);
|
|
70
|
+
typeof n.list != "function" && c("World projection requires an actual SQL source");
|
|
71
|
+
let b = n.list.bind(n), x = `${u}:world-cells:${Buffer.from(JSON.stringify([m, h.name]), "utf8").toString("base64url")}`, S = (t) => {
|
|
72
|
+
if (!Array.isArray(t) || t.length > _ || Reflect.ownKeys(t).length !== t.length + 1) throw new e({
|
|
73
|
+
budget: "worldProjectionEntries",
|
|
74
|
+
limit: _
|
|
75
|
+
});
|
|
76
|
+
let n = [], r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
77
|
+
for (let e = 0; e < t.length; e++) {
|
|
78
|
+
let a = Object.getOwnPropertyDescriptor(t, String(e));
|
|
79
|
+
(!a || !("value" in a)) && c("World projection entries must be own data");
|
|
80
|
+
let o = p(a.value, h), s = JSON.stringify([
|
|
81
|
+
o.zoneId,
|
|
82
|
+
o.cellId,
|
|
83
|
+
o.layer
|
|
84
|
+
]);
|
|
85
|
+
(r.has(s) || i.has(o.roomId)) && c("Duplicate World projection routing identity"), r.add(s), i.add(o.roomId), n.push(o);
|
|
86
|
+
}
|
|
87
|
+
return Object.freeze(n);
|
|
88
|
+
}, C = () => i.suspend(() => {
|
|
89
|
+
let n;
|
|
90
|
+
try {
|
|
91
|
+
n = b({
|
|
92
|
+
tenantId: m,
|
|
93
|
+
worldId: h.name
|
|
94
|
+
}, _);
|
|
95
|
+
} catch {
|
|
96
|
+
return i.fail(new t({ detail: "World projection source admission remains incomplete" }));
|
|
97
|
+
}
|
|
98
|
+
return i.isEffect(n) ? n.pipe(i.flatMap((n) => i.try({
|
|
99
|
+
try: () => {
|
|
100
|
+
if (!Array.isArray(n) || Object.getPrototypeOf(n) !== Array.prototype || n.length > _ || Reflect.ownKeys(n).length !== n.length + 1) throw new e({
|
|
101
|
+
budget: "worldProjectionEntries",
|
|
102
|
+
limit: _
|
|
103
|
+
});
|
|
104
|
+
for (let e = 0; e < n.length; e++) {
|
|
105
|
+
let t = Object.getOwnPropertyDescriptor(n, String(e));
|
|
106
|
+
(!t?.enumerable || !("value" in t)) && c("World SQL projection source must contain own data");
|
|
107
|
+
}
|
|
108
|
+
let t = n.map((e) => (d(e, [
|
|
109
|
+
"id",
|
|
110
|
+
"tenantId",
|
|
111
|
+
"worldId",
|
|
112
|
+
"zoneId",
|
|
113
|
+
"cellId",
|
|
114
|
+
"layer",
|
|
115
|
+
"roomId",
|
|
116
|
+
"hostId",
|
|
117
|
+
"epoch",
|
|
118
|
+
"revision",
|
|
119
|
+
"players",
|
|
120
|
+
"state",
|
|
121
|
+
"updatedAt"
|
|
122
|
+
]), (e.tenantId !== m || e.worldId !== h.name) && c("World SQL source escaped the exact projection scope"), {
|
|
123
|
+
zoneId: e.zoneId,
|
|
124
|
+
cellId: e.cellId,
|
|
125
|
+
layer: e.layer,
|
|
126
|
+
roomId: e.roomId,
|
|
127
|
+
hostId: e.hostId,
|
|
128
|
+
epoch: e.epoch,
|
|
129
|
+
revision: e.revision,
|
|
130
|
+
players: e.players,
|
|
131
|
+
state: e.state
|
|
132
|
+
})), r = S(t);
|
|
133
|
+
if (Buffer.byteLength(JSON.stringify({
|
|
134
|
+
version: 1,
|
|
135
|
+
tenantId: m,
|
|
136
|
+
worldId: h.name,
|
|
137
|
+
entries: r
|
|
138
|
+
}), "utf8") > v) throw new e({
|
|
139
|
+
budget: "worldProjectionPayloadBytes",
|
|
140
|
+
limit: v
|
|
141
|
+
});
|
|
142
|
+
return r;
|
|
143
|
+
},
|
|
144
|
+
catch: (n) => n instanceof e ? n : new t({ detail: "World projection SQL source failed admission" })
|
|
145
|
+
}))) : i.fail(new t({ detail: "World projection source must return an Effect" }));
|
|
146
|
+
}), w = (e) => i.try({
|
|
147
|
+
try: () => {
|
|
148
|
+
Buffer.byteLength(e, "utf8") > v && c("World projection cached payload exceeds its read budget");
|
|
149
|
+
let t = JSON.parse(e);
|
|
150
|
+
d(t, [
|
|
151
|
+
"version",
|
|
152
|
+
"tenantId",
|
|
153
|
+
"worldId",
|
|
154
|
+
"entries"
|
|
155
|
+
]);
|
|
156
|
+
let n = (e) => Object.getOwnPropertyDescriptor(t, e)?.value;
|
|
157
|
+
(n("version") !== 1 || n("tenantId") !== m || n("worldId") !== h.name) && c("Cached World projection escaped its scope");
|
|
158
|
+
let r = n("entries");
|
|
159
|
+
return Array.isArray(r) || c("Missing World projection entries"), S(r);
|
|
160
|
+
},
|
|
161
|
+
catch: () => new t({ detail: "Cached World routing hints failed admission" })
|
|
162
|
+
}), T = (e, t) => t.pipe(i.mapError((t) => t._tag === "HotError" ? new o({
|
|
163
|
+
operation: e,
|
|
164
|
+
key: "worldCells",
|
|
165
|
+
reason: t.reason
|
|
166
|
+
}) : t));
|
|
167
|
+
return Object.freeze({
|
|
168
|
+
hints: () => T("worldCellsRead", i.gen(function* () {
|
|
169
|
+
let e = yield* s({
|
|
170
|
+
store: r,
|
|
171
|
+
onUnavailable: y,
|
|
172
|
+
read: (e) => e.hget(x, "payload", { consistency: "primary" }).pipe(i.map((e) => ({
|
|
173
|
+
kind: "hot",
|
|
174
|
+
value: e
|
|
175
|
+
}))),
|
|
176
|
+
fallback: () => C().pipe(i.map((e) => ({
|
|
177
|
+
kind: "sql",
|
|
178
|
+
value: e
|
|
179
|
+
})))
|
|
180
|
+
});
|
|
181
|
+
return e.kind === "sql" ? e.value : a.isNone(e.value) ? yield* C() : yield* w(e.value.value);
|
|
182
|
+
})),
|
|
183
|
+
rebuildFromSource: () => T("worldCellsRebuild", i.gen(function* () {
|
|
184
|
+
let t = yield* C(), n = JSON.stringify({
|
|
185
|
+
version: 1,
|
|
186
|
+
tenantId: m,
|
|
187
|
+
worldId: h.name,
|
|
188
|
+
entries: t
|
|
189
|
+
});
|
|
190
|
+
return Buffer.byteLength(n, "utf8") > v ? yield* i.fail(new e({
|
|
191
|
+
budget: "worldProjectionPayloadBytes",
|
|
192
|
+
limit: v
|
|
193
|
+
})) : (yield* r.hset(x, { payload: n }, { ttlMs: g }), Object.freeze({ entries: t.length }));
|
|
194
|
+
})),
|
|
195
|
+
invalidate: () => T("worldCellsInvalidate", r.delete(x).pipe(i.asVoid))
|
|
196
|
+
});
|
|
197
|
+
}, h = async (e, t, n) => {
|
|
198
|
+
d(n, [
|
|
199
|
+
"namespace",
|
|
200
|
+
"tenantId",
|
|
201
|
+
"world",
|
|
202
|
+
"ttlMs",
|
|
203
|
+
"maxEntries",
|
|
204
|
+
"maxPayloadBytes",
|
|
205
|
+
"availabilityRole"
|
|
206
|
+
]);
|
|
207
|
+
let r = n.availabilityRole, i = e.connectionAvailability?.bind(e), a = e.hotStore?.bind(e);
|
|
208
|
+
(!e.connectionRegistry || !a || r !== void 0 && !i) && c("World projection requires the app-owned connection registry and tenant HotStore"), r !== void 0 && l(r);
|
|
209
|
+
let o = r === void 0 ? "fail" : i(r), s = f({
|
|
210
|
+
namespace: n.namespace,
|
|
211
|
+
tenantId: n.tenantId,
|
|
212
|
+
world: n.world,
|
|
213
|
+
ttlMs: n.ttlMs,
|
|
214
|
+
maxEntries: n.maxEntries,
|
|
215
|
+
maxPayloadBytes: n.maxPayloadBytes,
|
|
216
|
+
onUnavailable: o
|
|
217
|
+
});
|
|
218
|
+
return m(t, await a({ tenantId: s.tenantId }), s);
|
|
219
|
+
};
|
|
220
|
+
//#endregion
|
|
221
|
+
export { h as bindWorldCellProjection, m as makeWorldCellProjection };
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createElement as e, useId as t, useLayoutEffect as n, useRef as r, useState as i, useSyncExternalStore as a } from "react";
|
|
2
|
+
//#region src/worldReact.ts
|
|
3
|
+
var o = (e) => a((t) => e.subscribe(t), () => e.observation, () => e.observation), s = {
|
|
4
|
+
en: {
|
|
5
|
+
title: "Moving to another location",
|
|
6
|
+
preparing: "Reserving the destination",
|
|
7
|
+
loading: "Loading the destination",
|
|
8
|
+
switching: "Switching connections",
|
|
9
|
+
failed: "The move is not confirmed",
|
|
10
|
+
help: "Your source remains selected until the server confirms the commit. A connected destination alone does not confirm the move.",
|
|
11
|
+
committed: "The server confirmed the destination. Connection cleanup or buffered delivery may still be incomplete.",
|
|
12
|
+
uncertain: "Check the saved request to continue. Cancelling also requires confirmation from the server.",
|
|
13
|
+
reserve: "Reserve",
|
|
14
|
+
connect: "Connect",
|
|
15
|
+
welcome: "Receive Welcome",
|
|
16
|
+
assets: "Load assets",
|
|
17
|
+
commit: "Confirm commit",
|
|
18
|
+
cleanup: "Finish connections",
|
|
19
|
+
retry: "Check and continue",
|
|
20
|
+
cancel: "Request cancellation",
|
|
21
|
+
actionError: "The request remains incomplete. Check it again."
|
|
22
|
+
},
|
|
23
|
+
de: {
|
|
24
|
+
title: "Ortswechsel",
|
|
25
|
+
preparing: "Ziel wird reserviert",
|
|
26
|
+
loading: "Ziel wird geladen",
|
|
27
|
+
switching: "Verbindungen werden umgeschaltet",
|
|
28
|
+
failed: "Der Ortswechsel ist nicht bestätigt",
|
|
29
|
+
help: "Die Quelle bleibt ausgewählt, bis der Server den Commit bestätigt. Eine verbundene Ziel-Session bestätigt den Wechsel allein nicht.",
|
|
30
|
+
committed: "Der Server hat das Ziel bestätigt. Verbindungsbereinigung oder gepufferte Übertragung können noch unvollständig sein.",
|
|
31
|
+
uncertain: "Prüfe den gespeicherten Request, um fortzufahren. Auch Abbrechen benötigt eine Bestätigung vom Server.",
|
|
32
|
+
reserve: "Reservieren",
|
|
33
|
+
connect: "Verbinden",
|
|
34
|
+
welcome: "Welcome empfangen",
|
|
35
|
+
assets: "Assets laden",
|
|
36
|
+
commit: "Commit bestätigen",
|
|
37
|
+
cleanup: "Verbindungen abschließen",
|
|
38
|
+
retry: "Prüfen und fortsetzen",
|
|
39
|
+
cancel: "Abbruch anfordern",
|
|
40
|
+
actionError: "Der Request bleibt unvollständig. Prüfe ihn erneut."
|
|
41
|
+
}
|
|
42
|
+
}, c = ({ client: a, locale: c, showSeamless: l = !1, tip: u, className: d }) => {
|
|
43
|
+
let f = o(a), p = s[c], m = t(), h = t(), [g, _] = i(!1), [v, y] = i(!1), b = r({
|
|
44
|
+
client: a,
|
|
45
|
+
revision: 0,
|
|
46
|
+
mounted: !1
|
|
47
|
+
});
|
|
48
|
+
n(() => (b.current = {
|
|
49
|
+
client: a,
|
|
50
|
+
revision: b.current.revision + 1,
|
|
51
|
+
mounted: !0
|
|
52
|
+
}, _(!1), y(!1), () => {
|
|
53
|
+
b.current.mounted = !1, b.current.revision++;
|
|
54
|
+
}), [a]);
|
|
55
|
+
let x = (e) => {
|
|
56
|
+
if (g || b.current.client !== a || !b.current.mounted) return;
|
|
57
|
+
let t = b.current.revision;
|
|
58
|
+
_(!0), y(!1);
|
|
59
|
+
let n = () => b.current.mounted && b.current.client === a && b.current.revision === t;
|
|
60
|
+
Promise.resolve().then(() => a[e]()).then(() => {
|
|
61
|
+
n() && _(!1);
|
|
62
|
+
}, () => {
|
|
63
|
+
n() && (_(!1), y(!0));
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
if (f.status === "idle" || f.status === "settled" || f.status === "closed" || f.mode === "seamless" && !l && f.status !== "failed") return null;
|
|
67
|
+
let S = f.committed ? p.switching : p[f.status];
|
|
68
|
+
return e("section", {
|
|
69
|
+
className: d ?? "mx-auto w-full max-w-xl space-y-4 rounded-xl border border-border bg-background p-5 text-foreground",
|
|
70
|
+
"aria-labelledby": m,
|
|
71
|
+
"aria-describedby": h,
|
|
72
|
+
"aria-busy": g
|
|
73
|
+
}, e("h2", {
|
|
74
|
+
id: m,
|
|
75
|
+
className: "text-xl font-semibold"
|
|
76
|
+
}, p.title), e("p", {
|
|
77
|
+
role: "status",
|
|
78
|
+
"aria-live": "polite",
|
|
79
|
+
className: "text-base font-medium"
|
|
80
|
+
}, S), e("p", {
|
|
81
|
+
id: h,
|
|
82
|
+
className: "max-w-prose text-sm text-muted-foreground"
|
|
83
|
+
}, f.committed ? p.committed : f.status === "failed" ? p.uncertain : p.help), e("ol", { className: "flex flex-wrap gap-x-4 gap-y-2 text-sm" }, ...[
|
|
84
|
+
"reserve",
|
|
85
|
+
"connect",
|
|
86
|
+
"welcome",
|
|
87
|
+
"assets",
|
|
88
|
+
"commit",
|
|
89
|
+
"cleanup"
|
|
90
|
+
].map((t) => e("li", {
|
|
91
|
+
key: t,
|
|
92
|
+
"aria-current": f.step === t ? "step" : void 0,
|
|
93
|
+
className: f.step === t ? "font-semibold text-foreground" : "text-muted-foreground"
|
|
94
|
+
}, p[t]))), u === void 0 ? null : e("div", { className: "text-sm" }, u), f.status === "failed" ? e("div", { className: "space-y-3" }, v ? e("p", {
|
|
95
|
+
role: "alert",
|
|
96
|
+
className: "text-sm"
|
|
97
|
+
}, p.actionError) : null, e("div", { className: "flex flex-wrap gap-2" }, e("button", {
|
|
98
|
+
type: "button",
|
|
99
|
+
"aria-disabled": g,
|
|
100
|
+
className: "rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
101
|
+
onClick: () => x("resume")
|
|
102
|
+
}, p.retry), f.committed ? null : e("button", {
|
|
103
|
+
type: "button",
|
|
104
|
+
"aria-disabled": g,
|
|
105
|
+
className: "rounded-md border border-input px-3 py-2 text-sm font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",
|
|
106
|
+
onClick: () => x("cancel")
|
|
107
|
+
}, p.cancel))) : null);
|
|
108
|
+
};
|
|
109
|
+
//#endregion
|
|
110
|
+
export { c as TransitionScreen, o as useWorldTransition };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { captureWorldData as t } from "./worldData.js";
|
|
3
|
+
//#region src/worldRecoveryActor.ts
|
|
4
|
+
var n = /* @__PURE__ */ new WeakSet(), r = (t, r) => {
|
|
5
|
+
if (!t || !n.has(t) || t.scope.tenantId !== r.tenantId || t.scope.roomId !== r.roomId || t.scope.hostId !== r.hostId || t.scope.epoch !== r.epoch || t.scope.priorEpoch !== r.priorEpoch || (t.scope.worldRecoveryEpoch ?? t.scope.priorEpoch) !== (r.worldRecoveryEpoch ?? r.priorEpoch)) throw new e({ detail: "World recovery actor requires its active adoption scope" });
|
|
6
|
+
return t;
|
|
7
|
+
}, i = async (i, a, o) => {
|
|
8
|
+
let s = Object.freeze({ ...i }), c, l, u = !1, d = Object.freeze({
|
|
9
|
+
scope: s,
|
|
10
|
+
rollback: async (n, i, o, f) => {
|
|
11
|
+
if (r(d, s), c) throw new e({ detail: "World recovery actor already has an outstanding rollback" });
|
|
12
|
+
let p = t(n, 4096);
|
|
13
|
+
if (p.tenantId !== s.tenantId || p.roomId !== s.roomId) throw new e({ detail: "World recovery rollback escaped its Room" });
|
|
14
|
+
let m = Promise.resolve().then(() => a(p, i, o, f, d));
|
|
15
|
+
c = m;
|
|
16
|
+
try {
|
|
17
|
+
await m;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw u = !0, l = e, e;
|
|
20
|
+
} finally {
|
|
21
|
+
c === m && (c = void 0);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
n.add(d);
|
|
26
|
+
try {
|
|
27
|
+
let e = await o(d);
|
|
28
|
+
if (c && await c, u) throw l;
|
|
29
|
+
return e;
|
|
30
|
+
} finally {
|
|
31
|
+
n.delete(d), c && await c;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
//#endregion
|
|
35
|
+
export { r as captureWorldRecoveryActor, i as withWorldRecoveryActor };
|