@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,171 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { captureWorldData as t } from "./worldData.js";
|
|
3
|
+
import { worldActorCanonicalJson as n } from "./worldActorReceipts.js";
|
|
4
|
+
import { roomWorldEntityCodec as r } from "./worldEntityCodec.js";
|
|
5
|
+
import { Result as i, Schema as a } from "effect";
|
|
6
|
+
// src/worldGhostWire.ts
|
|
7
|
+
var o = "voltro-world-ghost/1", s = a.Struct({
|
|
8
|
+
tenantId: a.String,
|
|
9
|
+
worldId: a.String,
|
|
10
|
+
zoneId: a.String,
|
|
11
|
+
roomId: a.String,
|
|
12
|
+
hostId: a.String,
|
|
13
|
+
epoch: a.Int,
|
|
14
|
+
layer: a.Int,
|
|
15
|
+
at: a.Tuple([a.Number, a.Number])
|
|
16
|
+
}), c = a.Struct({
|
|
17
|
+
layout: a.Literal(o),
|
|
18
|
+
sequence: a.Int,
|
|
19
|
+
baseSequence: a.Int,
|
|
20
|
+
source: s,
|
|
21
|
+
entityId: a.String,
|
|
22
|
+
revision: a.Int,
|
|
23
|
+
tick: a.Int,
|
|
24
|
+
schemaHash: a.Int
|
|
25
|
+
});
|
|
26
|
+
function l() {
|
|
27
|
+
throw new e({ detail: "Invalid bounded World ghost wire frame or baseline" });
|
|
28
|
+
}
|
|
29
|
+
var u = (e, t) => {
|
|
30
|
+
(!e || typeof e != "object" || Array.isArray(e) || Object.keys(e).length !== t.length || t.some((t) => !Object.hasOwn(e, t))) && l();
|
|
31
|
+
}, d = (e, t) => {
|
|
32
|
+
let { at: r, ...i } = e.capture.source, { at: a, ...o } = t.capture.source;
|
|
33
|
+
return e.capture.entityId === t.capture.entityId && n(i) === n(o);
|
|
34
|
+
}, f = (e, n) => {
|
|
35
|
+
let s = t(n, 512);
|
|
36
|
+
u(s, [
|
|
37
|
+
"maxFrameBytes",
|
|
38
|
+
"maxHeaderBytes",
|
|
39
|
+
"maxSnapshotBytes"
|
|
40
|
+
]);
|
|
41
|
+
let { maxFrameBytes: f, maxHeaderBytes: p, maxSnapshotBytes: m } = s;
|
|
42
|
+
(![
|
|
43
|
+
f,
|
|
44
|
+
p,
|
|
45
|
+
m
|
|
46
|
+
].every((e) => Number.isSafeInteger(e) && e > 0 && e <= 16777216) || p > f - 8) && l();
|
|
47
|
+
let h = r(e, {
|
|
48
|
+
maxBytes: f,
|
|
49
|
+
maxFieldId: Math.min(4096, f * 7),
|
|
50
|
+
maxCollectionLength: Math.min(16384, f)
|
|
51
|
+
}), g = (e) => {
|
|
52
|
+
if (i.isFailure(e)) throw e.failure;
|
|
53
|
+
return e.success;
|
|
54
|
+
}, _ = (e) => {
|
|
55
|
+
let n = t(e, p);
|
|
56
|
+
u(n, [
|
|
57
|
+
"layout",
|
|
58
|
+
"sequence",
|
|
59
|
+
"baseSequence",
|
|
60
|
+
"source",
|
|
61
|
+
"entityId",
|
|
62
|
+
"revision",
|
|
63
|
+
"tick",
|
|
64
|
+
"schemaHash"
|
|
65
|
+
]), u(n.source, [
|
|
66
|
+
"tenantId",
|
|
67
|
+
"worldId",
|
|
68
|
+
"zoneId",
|
|
69
|
+
"roomId",
|
|
70
|
+
"hostId",
|
|
71
|
+
"epoch",
|
|
72
|
+
"layer",
|
|
73
|
+
"at"
|
|
74
|
+
]);
|
|
75
|
+
let r = a.decodeUnknownSync(c)(n);
|
|
76
|
+
return (![
|
|
77
|
+
r.sequence,
|
|
78
|
+
r.source.epoch,
|
|
79
|
+
r.source.layer,
|
|
80
|
+
r.revision
|
|
81
|
+
].every((e) => Number.isSafeInteger(e) && e > 0 && e <= 2147483647) || ![r.baseSequence, r.tick].every((e) => Number.isSafeInteger(e) && e >= 0 && e <= 2147483647) || r.baseSequence >= r.sequence || r.schemaHash !== h.schemaHash || ![
|
|
82
|
+
r.entityId,
|
|
83
|
+
r.source.tenantId,
|
|
84
|
+
r.source.worldId,
|
|
85
|
+
r.source.zoneId,
|
|
86
|
+
r.source.roomId,
|
|
87
|
+
r.source.hostId
|
|
88
|
+
].every((e) => e.length > 0 && e.length <= 191) || !r.source.at.every(Number.isFinite)) && l(), r;
|
|
89
|
+
}, v = (e) => {
|
|
90
|
+
let n = t(e, m);
|
|
91
|
+
u(n, ["sequence", "capture"]), u(n.capture, [
|
|
92
|
+
"source",
|
|
93
|
+
"entityId",
|
|
94
|
+
"revision",
|
|
95
|
+
"tick",
|
|
96
|
+
"snapshot"
|
|
97
|
+
]);
|
|
98
|
+
let r = n.capture.snapshot;
|
|
99
|
+
_({
|
|
100
|
+
layout: o,
|
|
101
|
+
sequence: n.sequence,
|
|
102
|
+
baseSequence: 0,
|
|
103
|
+
source: n.capture.source,
|
|
104
|
+
entityId: n.capture.entityId,
|
|
105
|
+
revision: n.capture.revision,
|
|
106
|
+
tick: n.capture.tick,
|
|
107
|
+
schemaHash: r.schemaHash
|
|
108
|
+
}), u(r, [
|
|
109
|
+
"schemaHash",
|
|
110
|
+
"bytes",
|
|
111
|
+
"entity"
|
|
112
|
+
]), (r.schemaHash !== h.schemaHash || !Array.isArray(r.bytes) || !r.bytes.length || r.bytes.length > f || !r.bytes.every((e) => Number.isInteger(e) && e >= 0 && e <= 255)) && l();
|
|
113
|
+
let i = g(h.decodeFull(Uint8Array.from(r.bytes)));
|
|
114
|
+
i && i.id === n.capture.entityId || l();
|
|
115
|
+
let s = g(h.full(a.decodeUnknownSync(h.schema)(r.entity)));
|
|
116
|
+
return (s.length !== r.bytes.length || s.some((e, t) => e !== r.bytes[t])) && l(), {
|
|
117
|
+
frame: n,
|
|
118
|
+
entity: i
|
|
119
|
+
};
|
|
120
|
+
}, y = (e) => {
|
|
121
|
+
(!(e instanceof Uint8Array) || e.byteLength < 9 || e.byteLength > f) && l();
|
|
122
|
+
let t = Uint8Array.from(e), n = new DataView(t.buffer), r = n.getUint32(4);
|
|
123
|
+
return (n.getUint32(0) !== 1447512113 || r < 1 || r > p || 8 + r >= t.length) && l(), {
|
|
124
|
+
bytes: t,
|
|
125
|
+
length: r,
|
|
126
|
+
metadata: _(JSON.parse(new TextDecoder("utf-8", { fatal: !0 }).decode(t.subarray(8, 8 + r))))
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
return Object.freeze({
|
|
130
|
+
inspect: (e) => t(y(e).metadata, p),
|
|
131
|
+
encode: (e, t) => {
|
|
132
|
+
let { frame: n, entity: r } = v(e), i = t === void 0 ? void 0 : v(t);
|
|
133
|
+
i && (!d(n, i.frame) || i.frame.sequence >= n.sequence || i.frame.capture.tick > n.capture.tick || i.frame.capture.revision > n.capture.revision) && l();
|
|
134
|
+
let a = g(h.full(r)), s = i ? g(h.delta(r, i.entity, !0)) : null, c = s !== null && s.length < a.length, u = _({
|
|
135
|
+
layout: o,
|
|
136
|
+
sequence: n.sequence,
|
|
137
|
+
baseSequence: c ? i.frame.sequence : 0,
|
|
138
|
+
source: n.capture.source,
|
|
139
|
+
entityId: n.capture.entityId,
|
|
140
|
+
revision: n.capture.revision,
|
|
141
|
+
tick: n.capture.tick,
|
|
142
|
+
schemaHash: h.schemaHash
|
|
143
|
+
}), p = new TextEncoder().encode(JSON.stringify(u)), m = c ? s : a;
|
|
144
|
+
8 + p.length + m.length > f && l();
|
|
145
|
+
let y = new Uint8Array(8 + p.length + m.length), b = new DataView(y.buffer);
|
|
146
|
+
return b.setUint32(0, 1447512113), b.setUint32(4, p.length), y.set(p, 8), y.set(m, 8 + p.length), y;
|
|
147
|
+
},
|
|
148
|
+
decode: (e, n) => {
|
|
149
|
+
let { bytes: r, length: i, metadata: a } = y(e), o = a.baseSequence === 0 ? void 0 : n === void 0 ? l() : v(n);
|
|
150
|
+
o && o.frame.sequence !== a.baseSequence && l();
|
|
151
|
+
let s = r.subarray(8 + i), c = g(o ? h.decodeDelta(s, o.entity) : h.decodeFull(s));
|
|
152
|
+
c && c.id === a.entityId || l();
|
|
153
|
+
let u = g(h.full(c)), f = t({
|
|
154
|
+
sequence: a.sequence,
|
|
155
|
+
capture: {
|
|
156
|
+
source: a.source,
|
|
157
|
+
entityId: a.entityId,
|
|
158
|
+
revision: a.revision,
|
|
159
|
+
tick: a.tick,
|
|
160
|
+
snapshot: {
|
|
161
|
+
schemaHash: h.schemaHash,
|
|
162
|
+
bytes: Array.from(u),
|
|
163
|
+
entity: JSON.parse(JSON.stringify(c))
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}, m);
|
|
167
|
+
return o && (!d(f, o.frame) || o.frame.capture.tick > f.capture.tick || o.frame.capture.revision > f.capture.revision) && l(), f;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
};
|
|
171
|
+
export { f as makeWorldGhostWireCodec, o as worldGhostWireLayout };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { captureWorldData as t } from "./worldData.js";
|
|
3
|
+
import { worldGroupTransitionRequest as n } from "./worldCommands.js";
|
|
4
|
+
import { createHash as r } from "node:crypto";
|
|
5
|
+
// src/worldGroupCommand.ts
|
|
6
|
+
function i() {
|
|
7
|
+
throw new e({ detail: "World group command receipt is invalid" });
|
|
8
|
+
}
|
|
9
|
+
var a = (e, t) => {
|
|
10
|
+
if (!e || typeof e != "object" || Object.getPrototypeOf(e) !== Object.prototype || Reflect.ownKeys(e).length !== t.length) return i();
|
|
11
|
+
let n = Object.getOwnPropertyDescriptors(e);
|
|
12
|
+
return t.some((e) => !n[e] || !("value" in n[e])) ? i() : Object.fromEntries(t.map((e) => [e, n[e].value]));
|
|
13
|
+
}, o = (e, t) => typeof e == "string" && e.length <= t && /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/.test(e) ? e : i(), s = (e) => {
|
|
14
|
+
let r = a(e, ["origin", "intent"]), i = a(r.origin, [
|
|
15
|
+
"tenantId",
|
|
16
|
+
"roomId",
|
|
17
|
+
"requestId"
|
|
18
|
+
]);
|
|
19
|
+
return Object.freeze({
|
|
20
|
+
origin: Object.freeze({
|
|
21
|
+
tenantId: o(i.tenantId, 191),
|
|
22
|
+
roomId: o(i.roomId, 191),
|
|
23
|
+
requestId: o(i.requestId, 384)
|
|
24
|
+
}),
|
|
25
|
+
intent: t(n(r.intent), 4096)
|
|
26
|
+
});
|
|
27
|
+
}, c = (e) => r("sha256").update(JSON.stringify([
|
|
28
|
+
"world-group-command-v1",
|
|
29
|
+
e.origin.tenantId,
|
|
30
|
+
e.origin.roomId,
|
|
31
|
+
e.origin.requestId
|
|
32
|
+
])).digest("hex"), l = (e) => `group:${c(e)}`, u = (e) => {
|
|
33
|
+
let t = a(e, [
|
|
34
|
+
"origin",
|
|
35
|
+
"intent",
|
|
36
|
+
"startedAt",
|
|
37
|
+
"waitUntil"
|
|
38
|
+
]), n = s({
|
|
39
|
+
origin: t.origin,
|
|
40
|
+
intent: t.intent
|
|
41
|
+
}), r = t.startedAt, o = t.waitUntil;
|
|
42
|
+
return typeof r != "number" || !Number.isSafeInteger(r) || r < 0 || typeof o != "number" || !Number.isSafeInteger(o) || o <= r || o - r !== n.intent.waitForAllMs ? i() : Object.freeze({
|
|
43
|
+
...n,
|
|
44
|
+
startedAt: r,
|
|
45
|
+
waitUntil: o
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
export { s as captureWorldGroupCommand, u as captureWorldGroupCommandReceipt, c as worldGroupCommandKey, l as worldGroupCommandRequestId };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { captureWorldGroupCommand as t, captureWorldGroupCommandReceipt as n } from "./worldGroupCommand.js";
|
|
3
|
+
import { worldTransitionGroupFromRecords as r } from "./worldTransitionGroup.js";
|
|
4
|
+
import { Effect as i, Result as a } from "effect";
|
|
5
|
+
// src/worldGroupDeadline.ts
|
|
6
|
+
function o() {
|
|
7
|
+
throw new e({ detail: "World group deadline authority is incomplete or changed" });
|
|
8
|
+
}
|
|
9
|
+
var s = (e, t) => {
|
|
10
|
+
let n = e && typeof e == "object" ? Object.getOwnPropertyDescriptor(e, t) : void 0;
|
|
11
|
+
return !n || !("value" in n) || typeof n.value != "function" ? o() : n.value.bind(e);
|
|
12
|
+
}, c = (t) => i.suspend(() => {
|
|
13
|
+
let n = t();
|
|
14
|
+
return i.isEffect(n) ? n : i.fail(new e({ detail: "World group deadline requires actual Effects" }));
|
|
15
|
+
}).pipe(i.catchCause(() => i.fail(new e({ detail: "World group deadline remains incomplete" })))), l = (l) => {
|
|
16
|
+
let u = [
|
|
17
|
+
"tenantId",
|
|
18
|
+
"maxMembers",
|
|
19
|
+
"epochNow",
|
|
20
|
+
"states",
|
|
21
|
+
"executor",
|
|
22
|
+
"authorize"
|
|
23
|
+
];
|
|
24
|
+
(!l || Object.getPrototypeOf(l) !== Object.prototype || Reflect.ownKeys(l).length !== u.length || u.some((e) => {
|
|
25
|
+
let t = Object.getOwnPropertyDescriptor(l, e);
|
|
26
|
+
return !t || !("value" in t);
|
|
27
|
+
})) && o();
|
|
28
|
+
let d = l.tenantId, f = l.maxMembers;
|
|
29
|
+
(typeof d != "string" || !/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(d) || !Number.isSafeInteger(f) || f < 1 || f > 1024) && o();
|
|
30
|
+
let p = s(l, "epochNow"), m = s(l.states, "observeGroupCommand"), h = Object.getOwnPropertyDescriptor(l.states, "proceedGroup");
|
|
31
|
+
(h && (!("value" in h) || typeof h.value != "function") || !h && "proceedGroup" in l.states) && o();
|
|
32
|
+
let g = h ? s(l.states, "proceedGroup") : void 0, _ = s(l.executor, "commitTogether"), v = s(l.executor, "cancelTogether"), y = s(l, "authorize");
|
|
33
|
+
return Object.freeze({ advance: (s, l) => {
|
|
34
|
+
let u;
|
|
35
|
+
try {
|
|
36
|
+
u = t({
|
|
37
|
+
origin: l,
|
|
38
|
+
intent: s
|
|
39
|
+
}), u.origin.tenantId !== d && o();
|
|
40
|
+
} catch {
|
|
41
|
+
return i.fail(new e({ detail: "Invalid World group deadline command" }));
|
|
42
|
+
}
|
|
43
|
+
return c(() => i.gen(function* () {
|
|
44
|
+
let s = () => c(() => m(u.origin)).pipe(i.map((e) => {
|
|
45
|
+
if (!e || !e.records.length || e.records.length > f || !r(e.records)) return o();
|
|
46
|
+
let i = n(e.command);
|
|
47
|
+
return JSON.stringify(t({
|
|
48
|
+
origin: i.origin,
|
|
49
|
+
intent: i.intent
|
|
50
|
+
})) !== JSON.stringify(u) || e.records.some((e) => !e.groupCommand || JSON.stringify(e.groupCommand) !== JSON.stringify(i)) ? o() : e;
|
|
51
|
+
})), l = yield* s();
|
|
52
|
+
for (let t = 0; t < 2; t++) {
|
|
53
|
+
let n = p();
|
|
54
|
+
if (!Number.isSafeInteger(n) || n < l.command.startedAt) return o();
|
|
55
|
+
yield* c(() => y(l, n));
|
|
56
|
+
let r = l.records, d = r.map((e) => ({
|
|
57
|
+
origin: e.origin,
|
|
58
|
+
expectedSubject: e.subject
|
|
59
|
+
})), f = r.every((e) => e.phase === "committed" || e.phase === "settled"), m = r.every((e) => (e.phase === "failed" || e.phase === "rolledBack") && e.failure === r[0].failure), h = r.every((e) => e.phase === "switching");
|
|
60
|
+
if (!f && !m && r.some((e) => [
|
|
61
|
+
"committed",
|
|
62
|
+
"settled",
|
|
63
|
+
"failed",
|
|
64
|
+
"rolledBack"
|
|
65
|
+
].includes(e.phase))) return o();
|
|
66
|
+
let b;
|
|
67
|
+
if (f || h && r.every((e) => e.ready !== void 0 || e.groupProceed !== void 0)) b = c(() => _(d));
|
|
68
|
+
else if (m) {
|
|
69
|
+
let e = r[0].failure;
|
|
70
|
+
if (!e) return o();
|
|
71
|
+
b = c(() => v(d, e));
|
|
72
|
+
} else if (n < l.command.waitUntil) return Object.freeze({
|
|
73
|
+
state: "waiting",
|
|
74
|
+
group: l
|
|
75
|
+
});
|
|
76
|
+
else if (l.command.intent.onTimeout === "cancel") b = c(() => v(d, "group_ready_timeout"));
|
|
77
|
+
else {
|
|
78
|
+
if (!g || !h) return yield* i.fail(new e({ detail: "World proceed deadline requires complete prepared members and explicit durable proceed authority" }));
|
|
79
|
+
b = c(() => g(u.origin)).pipe(i.flatMap(() => s()), i.flatMap((e) => c(() => _(e.records.map((e) => ({
|
|
80
|
+
origin: e.origin,
|
|
81
|
+
expectedSubject: e.subject
|
|
82
|
+
}))))));
|
|
83
|
+
}
|
|
84
|
+
let x = yield* i.result(b), S = yield* s();
|
|
85
|
+
if (S.records.length !== l.records.length || S.records.some((e) => !l.records.some((t) => t.id === e.id))) return o();
|
|
86
|
+
if (l = S, a.isSuccess(x)) return l.records.every((e) => e.phase === "settled") ? Object.freeze({
|
|
87
|
+
state: "settled",
|
|
88
|
+
group: l
|
|
89
|
+
}) : l.records.every((e) => e.phase === "rolledBack") ? Object.freeze({
|
|
90
|
+
state: "rolledBack",
|
|
91
|
+
group: l
|
|
92
|
+
}) : o();
|
|
93
|
+
if (t === 1) return yield* i.fail(x.failure);
|
|
94
|
+
if (l.records.every((e) => e.phase === "switching") && n >= l.command.waitUntil && l.command.intent.onTimeout === "cancel") {
|
|
95
|
+
yield* c(() => v(d, "group_ready_timeout"));
|
|
96
|
+
let e = yield* s();
|
|
97
|
+
return e.records.every((e) => e.phase === "rolledBack") ? Object.freeze({
|
|
98
|
+
state: "rolledBack",
|
|
99
|
+
group: e
|
|
100
|
+
}) : o();
|
|
101
|
+
}
|
|
102
|
+
if (l.records.every((e) => e.phase === "switching") && n >= l.command.waitUntil && l.command.intent.onTimeout === "proceed" && g) yield* c(() => g(u.origin)), l = yield* s();
|
|
103
|
+
else if (!l.records.every((e) => [
|
|
104
|
+
"committed",
|
|
105
|
+
"settled",
|
|
106
|
+
"failed",
|
|
107
|
+
"rolledBack"
|
|
108
|
+
].includes(e.phase))) return yield* i.fail(x.failure);
|
|
109
|
+
}
|
|
110
|
+
return o();
|
|
111
|
+
}));
|
|
112
|
+
} });
|
|
113
|
+
};
|
|
114
|
+
export { l as makeWorldGroupDeadline };
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { captureWorldData as t } from "./worldData.js";
|
|
3
|
+
import { captureWorldGroupCommand as n, worldGroupCommandRequestId as r } from "./worldGroupCommand.js";
|
|
4
|
+
import { worldTransitionGroupFromRecords as i } from "./worldTransitionGroup.js";
|
|
5
|
+
import { Effect as a } from "effect";
|
|
6
|
+
// src/worldGroupPreparation.ts
|
|
7
|
+
function o() {
|
|
8
|
+
throw new e({ detail: "World group preparation authority is incomplete or changed" });
|
|
9
|
+
}
|
|
10
|
+
var s = (e, t) => {
|
|
11
|
+
if (!e || typeof e != "object" || Object.getPrototypeOf(e) !== Object.prototype || Reflect.ownKeys(e).length !== t.length) return o();
|
|
12
|
+
let n = Object.getOwnPropertyDescriptors(e);
|
|
13
|
+
return t.some((e) => !n[e] || !("value" in n[e])) ? o() : Object.fromEntries(t.map((e) => [e, n[e].value]));
|
|
14
|
+
}, c = (e, t) => {
|
|
15
|
+
let n = e && typeof e == "object" ? Object.getOwnPropertyDescriptor(e, t) : void 0;
|
|
16
|
+
return !n || !("value" in n) || typeof n.value != "function" ? o() : n.value.bind(e);
|
|
17
|
+
}, l = (e) => typeof e == "string" && /^[A-Za-z0-9][A-Za-z0-9_.:-]{0,190}$/.test(e) ? e : o(), u = (t) => a.suspend(() => {
|
|
18
|
+
let n = t();
|
|
19
|
+
return a.isEffect(n) ? n : a.fail(new e({ detail: "World group preparation requires actual Effects" }));
|
|
20
|
+
}).pipe(a.catchCause(() => a.fail(new e({ detail: "World group preparation remains incomplete" })))), d = (e, t) => JSON.stringify(n({
|
|
21
|
+
origin: e.origin,
|
|
22
|
+
intent: e.intent
|
|
23
|
+
})) === JSON.stringify(t), f = (f) => {
|
|
24
|
+
s(f, [
|
|
25
|
+
"tenantId",
|
|
26
|
+
"maxMembers",
|
|
27
|
+
"maxResolvedMemberBytes",
|
|
28
|
+
"states",
|
|
29
|
+
"executor",
|
|
30
|
+
"authorize",
|
|
31
|
+
"resolveMembers",
|
|
32
|
+
"resolve"
|
|
33
|
+
]);
|
|
34
|
+
let p = l(f.tenantId), m = f.maxMembers, h = f.maxResolvedMemberBytes;
|
|
35
|
+
(!Number.isSafeInteger(m) || m < 1 || m > 1024 || !Number.isSafeInteger(h) || h < 1 || h > 16777216) && o();
|
|
36
|
+
let g = c(f.states, "observeGroupCommand"), _ = c(f.states, "beginGroup"), v = c(f.executor, "prepareTogether"), y = c(f, "authorize"), b = c(f, "resolveMembers"), x = c(f, "resolve"), S = (e) => {
|
|
37
|
+
if (!Array.isArray(e) || !e.length || e.length > m || Reflect.ownKeys(e).length !== e.length + 1) return o();
|
|
38
|
+
let t = [], n = /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
39
|
+
for (let i = 0; i < e.length; i++) {
|
|
40
|
+
let a = Object.getOwnPropertyDescriptor(e, i);
|
|
41
|
+
if (!a || !("value" in a)) return o();
|
|
42
|
+
let c = s(a.value, [
|
|
43
|
+
"entityId",
|
|
44
|
+
"roomId",
|
|
45
|
+
"subject"
|
|
46
|
+
]), u = s(c.subject, ["id", "kind"]), d = l(c.entityId), f = l(u.id);
|
|
47
|
+
if (u.kind !== "guest" && u.kind !== "user" || n.has(d) || r.has(f)) return o();
|
|
48
|
+
n.add(d), r.add(f), t.push(Object.freeze({
|
|
49
|
+
entityId: d,
|
|
50
|
+
roomId: l(c.roomId),
|
|
51
|
+
subject: Object.freeze({
|
|
52
|
+
id: f,
|
|
53
|
+
kind: u.kind
|
|
54
|
+
})
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
return Object.freeze(t.sort((e, t) => e.entityId < t.entityId ? -1 : 1));
|
|
58
|
+
}, C = (e) => u(() => g(e.origin)).pipe(a.map((t) => t ? !d(t.command, e) || !t.records.length || t.records.length > m || !i(t.records) || t.records.some((n) => !n.groupCommand || !d(n.groupCommand, e) || n.groupCommand.waitUntil !== t.command.waitUntil) ? o() : t : null)), w = (t, r, i) => {
|
|
59
|
+
try {
|
|
60
|
+
let e = n({
|
|
61
|
+
origin: r,
|
|
62
|
+
intent: t
|
|
63
|
+
});
|
|
64
|
+
return e.origin.tenantId === p ? u(() => i(e)) : o();
|
|
65
|
+
} catch {
|
|
66
|
+
return a.fail(new e({ detail: "Invalid World group command" }));
|
|
67
|
+
}
|
|
68
|
+
}, T = (e, n) => w(e, n, (e) => a.gen(function* () {
|
|
69
|
+
yield* u(() => y("prepare", e));
|
|
70
|
+
let n = yield* C(e);
|
|
71
|
+
if (!n) {
|
|
72
|
+
let i = S(yield* u(() => b(e))), a = [], s = r(e);
|
|
73
|
+
for (let n of i) {
|
|
74
|
+
let r = Object.freeze({
|
|
75
|
+
tenantId: p,
|
|
76
|
+
roomId: n.roomId,
|
|
77
|
+
requestId: `${s}:${n.entityId}`
|
|
78
|
+
}), i = Object.freeze({
|
|
79
|
+
entityId: n.entityId,
|
|
80
|
+
target: e.intent.target,
|
|
81
|
+
options: e.intent.options
|
|
82
|
+
}), c = t(yield* u(() => x(i, r)), h);
|
|
83
|
+
if (c.tenantId !== p || c.entityId !== n.entityId || c.origin.tenantId !== p || c.origin.roomId !== r.roomId || c.origin.requestId !== r.requestId || c.expectedSubject?.id !== n.subject.id || c.expectedSubject.kind !== n.subject.kind || JSON.stringify(c.intent) !== JSON.stringify(i)) return o();
|
|
84
|
+
a.push(c);
|
|
85
|
+
}
|
|
86
|
+
if (yield* u(() => _({
|
|
87
|
+
tenantId: p,
|
|
88
|
+
requestId: s,
|
|
89
|
+
members: Object.freeze(a),
|
|
90
|
+
command: e
|
|
91
|
+
})), n = yield* C(e), !n || n.records.length !== i.length || i.some((e) => !n.records.some((t) => t.entityId === e.entityId && t.subject?.id === e.subject.id && t.subject.kind === e.subject.kind))) return o();
|
|
92
|
+
}
|
|
93
|
+
if (n.records.every((e) => e.phase === "switching") || n.records.every((e) => e.phase === "committed" || e.phase === "settled") || n.records.every((e) => (e.phase === "failed" || e.phase === "rolledBack") && e.failure === n.records[0].failure)) return n;
|
|
94
|
+
if (n.records.some((e) => [
|
|
95
|
+
"committed",
|
|
96
|
+
"settled",
|
|
97
|
+
"failed",
|
|
98
|
+
"rolledBack"
|
|
99
|
+
].includes(e.phase))) return o();
|
|
100
|
+
let i = n;
|
|
101
|
+
yield* u(() => v(i.records.map((e) => ({
|
|
102
|
+
origin: e.origin,
|
|
103
|
+
expectedSubject: e.subject
|
|
104
|
+
}))));
|
|
105
|
+
let a = yield* C(e);
|
|
106
|
+
return !a || a.records.length !== i.records.length || a.records.some((e) => e.phase !== "switching" || !i.records.some((t) => t.id === e.id && t.entityId === e.entityId)) ? o() : a;
|
|
107
|
+
}));
|
|
108
|
+
return Object.freeze({
|
|
109
|
+
prepare: T,
|
|
110
|
+
transitionGroup: (e, t) => T(e, t).pipe(a.asVoid),
|
|
111
|
+
status: (e, t) => w(e, t, (e) => u(() => y("status", e)).pipe(a.flatMap(() => C(e))))
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
export { f as makeWorldGroupPreparation };
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ProtocolError as e } from "./errors.js";
|
|
2
|
+
import { captureRoomSessionAdmissionEvidence as t } from "./sessionAdmission.js";
|
|
3
|
+
import { worldTransitionGroupFromRecords as n } from "./worldTransitionGroup.js";
|
|
4
|
+
import { Subject as r } from "@voltro/protocol";
|
|
5
|
+
import { Effect as i, Schema as a } from "effect";
|
|
6
|
+
// src/worldGroupReadyControl.ts
|
|
7
|
+
function o() {
|
|
8
|
+
throw new e({ detail: "World group ready control refused admission" });
|
|
9
|
+
}
|
|
10
|
+
var s = (e, t) => {
|
|
11
|
+
e && typeof e == "object" && Object.getPrototypeOf(e) === Object.prototype || o();
|
|
12
|
+
for (let n of Reflect.ownKeys(e)) {
|
|
13
|
+
let r = Object.getOwnPropertyDescriptor(e, n);
|
|
14
|
+
typeof n == "string" && t.includes(n) && r?.enumerable && "value" in r || o();
|
|
15
|
+
}
|
|
16
|
+
}, c = (e, t = 191) => typeof e == "string" && e.length <= t && /^[A-Za-z0-9][A-Za-z0-9_.:-]*$/.test(e) ? e : o(), l = (e, t) => {
|
|
17
|
+
s(e, [
|
|
18
|
+
"tenantId",
|
|
19
|
+
"roomId",
|
|
20
|
+
"requestId"
|
|
21
|
+
]);
|
|
22
|
+
let n = Object.freeze({
|
|
23
|
+
tenantId: c(e.tenantId),
|
|
24
|
+
roomId: c(e.roomId),
|
|
25
|
+
requestId: c(e.requestId, 384)
|
|
26
|
+
});
|
|
27
|
+
return n.tenantId === t ? n : o();
|
|
28
|
+
}, u = (e, t) => {
|
|
29
|
+
let n = e && typeof e == "object" ? Object.getOwnPropertyDescriptor(e, t) : void 0;
|
|
30
|
+
return n && "value" in n && typeof n.value == "function" || o(), n.value.bind(e);
|
|
31
|
+
}, d = (t) => i.suspend(() => {
|
|
32
|
+
let n = t();
|
|
33
|
+
return i.isEffect(n) ? n : i.fail(new e({ detail: "World group ready control requires actual Effects" }));
|
|
34
|
+
}).pipe(i.catchCause(() => i.fail(new e({ detail: "World group ready control remains incomplete" })))), f = (e, t) => e.tenantId === t.tenantId && e.roomId === t.roomId && e.requestId === t.requestId, p = (p) => {
|
|
35
|
+
s(p, [
|
|
36
|
+
"tenantId",
|
|
37
|
+
"maxMembers",
|
|
38
|
+
"states",
|
|
39
|
+
"executor",
|
|
40
|
+
"authorize",
|
|
41
|
+
"resolveMembers",
|
|
42
|
+
"resolveTargetSession"
|
|
43
|
+
]);
|
|
44
|
+
let m = c(p.tenantId), h = p.maxMembers, g = Object.getOwnPropertyDescriptor(p.states, "requiresGroupReadiness"), _ = Object.getOwnPropertyDescriptor(p.states, "batchCommitRows");
|
|
45
|
+
(!Number.isSafeInteger(h) || h < 1 || h > 1024 || !g || !("value" in g) || g.value !== !0 || !_ || !("value" in _) || typeof _.value != "number" || !Number.isSafeInteger(_.value) || h > _.value) && o();
|
|
46
|
+
let v = u(p.states, "observe"), y = u(p.states, "readyMember"), b = u(p.executor, "commitTogether"), x = u(p, "authorize"), S = u(p, "resolveMembers"), C = u(p, "resolveTargetSession"), w = (e) => {
|
|
47
|
+
(!Array.isArray(e) || !e.length || e.length > h || Reflect.ownKeys(e).length !== e.length + 1) && o();
|
|
48
|
+
let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set(), r = [];
|
|
49
|
+
for (let i = 0; i < e.length; i++) {
|
|
50
|
+
let a = Object.getOwnPropertyDescriptor(e, i);
|
|
51
|
+
a && "value" in a || o();
|
|
52
|
+
let u = a.value;
|
|
53
|
+
s(u, ["origin", "expectedSubject"]), s(u.expectedSubject, ["id", "kind"]);
|
|
54
|
+
let d = l(u.origin, m), f = u.expectedSubject;
|
|
55
|
+
f.kind !== "user" && f.kind !== "guest" && o();
|
|
56
|
+
let p = Object.freeze({
|
|
57
|
+
id: c(f.id),
|
|
58
|
+
kind: f.kind
|
|
59
|
+
}), h = JSON.stringify(d);
|
|
60
|
+
(t.has(p.id) || n.has(h)) && o(), t.add(p.id), n.add(h), r.push(Object.freeze({
|
|
61
|
+
origin: d,
|
|
62
|
+
expectedSubject: p
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
return Object.freeze(r);
|
|
66
|
+
}, T = (e) => d(() => v(e)).pipe(i.map((e) => e ?? o()));
|
|
67
|
+
return Object.freeze({ commit: (s, u) => {
|
|
68
|
+
let p, h, g;
|
|
69
|
+
try {
|
|
70
|
+
p = l(s, m), h = a.decodeUnknownSync(r)(structuredClone(u)), (h.type !== "user" || h.tenantId !== m) && o(), h.scopes && Object.freeze(h.scopes), Object.freeze(h), g = Object.freeze({
|
|
71
|
+
id: c(h.id),
|
|
72
|
+
kind: h.kind === "guest" ? "guest" : "user"
|
|
73
|
+
});
|
|
74
|
+
} catch {
|
|
75
|
+
return i.fail(new e({ detail: "World group ready intention requires a trusted player origin/Subject" }));
|
|
76
|
+
}
|
|
77
|
+
return d(() => i.gen(function* () {
|
|
78
|
+
yield* d(() => x(h, p));
|
|
79
|
+
let e = yield* T(p);
|
|
80
|
+
e.group?.requiresReadiness && e.subject?.id === g.id && e.subject.kind === g.kind && [
|
|
81
|
+
"switching",
|
|
82
|
+
"committed",
|
|
83
|
+
"settled"
|
|
84
|
+
].includes(e.phase) || o();
|
|
85
|
+
let r = w(yield* d(() => S(e, h)));
|
|
86
|
+
r.filter((e) => f(e.origin, p) && e.expectedSubject?.id === g.id && e.expectedSubject.kind === g.kind).length !== 1 && o();
|
|
87
|
+
let a = () => d(() => i.gen(function* () {
|
|
88
|
+
let t = [];
|
|
89
|
+
for (let n of r) {
|
|
90
|
+
let r = yield* T(n.origin);
|
|
91
|
+
(r.subject?.id !== n.expectedSubject.id || r.subject.kind !== n.expectedSubject.kind || r.group?.key !== e.group.key || r.group?.digest !== e.group.digest) && o(), t.push(r);
|
|
92
|
+
}
|
|
93
|
+
return n(t) || o(), Object.freeze(t);
|
|
94
|
+
})), s = (t) => {
|
|
95
|
+
if (!t.every((e) => e.phase === "settled")) return null;
|
|
96
|
+
let n = t.find((e) => f(e.origin, p));
|
|
97
|
+
return (t.some((e) => e.result === null) || !n || n.id !== e.id || n.subject?.id !== g.id || n.subject.kind !== g.kind || n.group?.key !== e.group.key || n.group?.digest !== e.group.digest) && o(), n;
|
|
98
|
+
}, c = (t) => {
|
|
99
|
+
if (!t.every((e) => (e.phase === "committed" || e.phase === "settled") && e.result !== null)) return null;
|
|
100
|
+
let n = t.find((e) => f(e.origin, p));
|
|
101
|
+
return n && n.id === e.id && n.subject?.id === g.id && n.subject.kind === g.kind && n.group?.key === e.group.key && n.group?.digest === e.group.digest || o(), n;
|
|
102
|
+
}, l = (e) => e.pipe(i.catchCause((e) => a().pipe(i.flatMap((t) => {
|
|
103
|
+
let n = c(t);
|
|
104
|
+
return n ? i.succeed(n) : i.failCause(e);
|
|
105
|
+
})))), u = yield* a(), m = s(u);
|
|
106
|
+
if (m) return m;
|
|
107
|
+
if (e.phase === "switching") {
|
|
108
|
+
let n = t(yield* d(() => C(e, h))), r = yield* l(d(() => y({
|
|
109
|
+
origin: p,
|
|
110
|
+
expectedRevision: e.revision,
|
|
111
|
+
subject: g,
|
|
112
|
+
evidence: n
|
|
113
|
+
})));
|
|
114
|
+
if (r.phase !== "switching") return r;
|
|
115
|
+
e = r;
|
|
116
|
+
}
|
|
117
|
+
if (u = yield* a(), m = s(u), m) return m;
|
|
118
|
+
let _ = u.every((e) => e.phase === "switching"), v = u.every((e) => e.phase === "committed" || e.phase === "settled");
|
|
119
|
+
if (!_ && !v && o(), _ && u.some((e) => e.ready === void 0)) return e;
|
|
120
|
+
let E = yield* l(d(() => b(r)).pipe(i.map((e) => ({ replies: e }))));
|
|
121
|
+
if (!("replies" in E)) return E;
|
|
122
|
+
let D = E.replies, O = yield* a(), k = O.find((e) => f(e.origin, p));
|
|
123
|
+
return (D.length !== r.length || !n(D) || O.some((e) => e.phase !== "committed" && e.phase !== "settled" || e.result === null || !D.some((t) => f(t.origin, e.origin) && t.id === e.id && t.entityId === e.entityId && t.group?.key === e.group?.key && t.group?.digest === e.group?.digest && (t.phase === "committed" || t.phase === "settled") && t.result !== null)) || !k || k.id !== e.id || k.subject?.id !== g.id || k.subject.kind !== g.kind || k.group?.key !== e.group.key || k.group?.digest !== e.group.digest || k.phase !== "committed" && k.phase !== "settled") && o(), k;
|
|
124
|
+
}));
|
|
125
|
+
} });
|
|
126
|
+
};
|
|
127
|
+
export { p as makeWorldGroupReadyControl };
|